diff options
-rw-r--r-- | sal/osl/unx/file_path_helper.cxx | 18 | ||||
-rw-r--r-- | sal/osl/unx/file_path_helper.hxx | 7 |
2 files changed, 11 insertions, 14 deletions
diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx index a89e00bf76ed..2f70c3687eda 100644 --- a/sal/osl/unx/file_path_helper.cxx +++ b/sal/osl/unx/file_path_helper.cxx @@ -54,22 +54,20 @@ void osl_systemPathRemoveSeparator(rtl_uString* pustrPath) } } -void osl_systemPathEnsureSeparator(rtl_uString** ppustrPath) +void osl_systemPathEnsureSeparator(OUString* ppustrPath) { - OSL_PRECOND((nullptr != ppustrPath) && (nullptr != *ppustrPath), "osl_systemPathEnsureSeparator: Invalid parameter"); - if ((ppustrPath != nullptr) && (*ppustrPath != nullptr)) + OSL_PRECOND(nullptr != ppustrPath, "osl_systemPathEnsureSeparator: Invalid parameter"); + if (ppustrPath != nullptr) { - OUString path(*ppustrPath); - sal_Int32 lp = path.getLength(); - sal_Int32 i = path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR); + sal_Int32 lp = ppustrPath->getLength(); + sal_Int32 i = ppustrPath->lastIndexOf(FPH_CHAR_PATH_SEPARATOR); if ((lp > 1 && i != (lp - 1)) || ((lp < 2) && i < 0)) { - path += FPH_PATH_SEPARATOR; - rtl_uString_assign(ppustrPath, path.pData); + *ppustrPath += FPH_PATH_SEPARATOR; } - SAL_WARN_IF( !path.endsWith(FPH_PATH_SEPARATOR), + SAL_WARN_IF( !ppustrPath->endsWith(FPH_PATH_SEPARATOR), "sal.osl", "osl_systemPathEnsureSeparator: Post condition failed"); } @@ -90,7 +88,7 @@ void osl_systemPathMakeAbsolutePath( OUString rel(const_cast<rtl_uString*>(pustrRelPath)); if (!base.isEmpty()) - osl_systemPathEnsureSeparator(&base.pData); + osl_systemPathEnsureSeparator(&base); base += rel; diff --git a/sal/osl/unx/file_path_helper.hxx b/sal/osl/unx/file_path_helper.hxx index 18af761cb310..0f09ccac2025 100644 --- a/sal/osl/unx/file_path_helper.hxx +++ b/sal/osl/unx/file_path_helper.hxx @@ -44,13 +44,12 @@ void osl_systemPathRemoveSeparator(rtl_uString* pustrPath); @param pustrPath [inout] a system path if the path is not the root path '/' and has no trailing separator a separator - will be added ppustrPath must not be NULL and - must point to a valid rtl_uString + will be added ppustrPath must not be NULL @returns nothing */ -void osl_systemPathEnsureSeparator(rtl_uString** ppustrPath); +void osl_systemPathEnsureSeparator(OUString* ppustrPath); /** Returns true if the given path is a relative path and so starts not with '/' @@ -208,7 +207,7 @@ namespace osl inline void systemPathEnsureSeparator(/*inout*/ OUString& Path) { - osl_systemPathEnsureSeparator(&Path.pData); + osl_systemPathEnsureSeparator(&Path); } /******************************************* |