diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-09-05 12:14:33 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-09-05 16:39:10 +0200 |
commit | 078d5c629ed9ad48b8e6bc4bd73e077a024fdef1 (patch) | |
tree | 297cbc347b354f722a93f8cd2e072165778f4a91 /sal | |
parent | 396869e0e71bd33f5d962779abf72f35d01245e5 (diff) |
Let osl_systemPathEnsureSeparator directly take an OUString
Change-Id: Ia9505298fe92d62d716e2c28ac0a5098c4b61121
Reviewed-on: https://gerrit.libreoffice.org/78642
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal')
-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); } /******************************************* |