summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-09-05 12:17:07 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-09-05 16:39:21 +0200
commit4e9714d2870ce02abe552a41e6278678265b9df9 (patch)
treef84175e1e5b4e9f2834132df15af86948ddea27c /sal
parent078d5c629ed9ad48b8e6bc4bd73e077a024fdef1 (diff)
Fix osl_systemPathEnsureSeparator precondition
Change-Id: I0165a14f159a6c2c7bce84d1ca646435146d1da0 Reviewed-on: https://gerrit.libreoffice.org/78643 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/file_path_helper.cxx27
1 files changed, 14 insertions, 13 deletions
diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx
index 2f70c3687eda..b75070c304ca 100644
--- a/sal/osl/unx/file_path_helper.cxx
+++ b/sal/osl/unx/file_path_helper.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cassert>
+
#include "file_path_helper.hxx"
#include "uunxapi.hxx"
@@ -56,21 +60,18 @@ void osl_systemPathRemoveSeparator(rtl_uString* pustrPath)
void osl_systemPathEnsureSeparator(OUString* ppustrPath)
{
- OSL_PRECOND(nullptr != ppustrPath, "osl_systemPathEnsureSeparator: Invalid parameter");
- if (ppustrPath != nullptr)
- {
- sal_Int32 lp = ppustrPath->getLength();
- sal_Int32 i = ppustrPath->lastIndexOf(FPH_CHAR_PATH_SEPARATOR);
+ assert(nullptr != ppustrPath);
+ sal_Int32 lp = ppustrPath->getLength();
+ sal_Int32 i = ppustrPath->lastIndexOf(FPH_CHAR_PATH_SEPARATOR);
- if ((lp > 1 && i != (lp - 1)) || ((lp < 2) && i < 0))
- {
- *ppustrPath += FPH_PATH_SEPARATOR;
- }
-
- SAL_WARN_IF( !ppustrPath->endsWith(FPH_PATH_SEPARATOR),
- "sal.osl",
- "osl_systemPathEnsureSeparator: Post condition failed");
+ if ((lp > 1 && i != (lp - 1)) || ((lp < 2) && i < 0))
+ {
+ *ppustrPath += FPH_PATH_SEPARATOR;
}
+
+ SAL_WARN_IF( !ppustrPath->endsWith(FPH_PATH_SEPARATOR),
+ "sal.osl",
+ "osl_systemPathEnsureSeparator: Post condition failed");
}
bool osl_systemPathIsRelativePath(const rtl_uString* pustrPath)