diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-09-05 15:21:04 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-09-05 21:18:38 +0200 |
commit | 001f739f1bca7607b0f8cf5f0c7e500dea70db44 (patch) | |
tree | 24de97c7adf5974fa8765452258db5f405adf840 /sal | |
parent | 467387ed2f4f226b580da7a674c2ed88365c976a (diff) |
Clean up {osl_,osl::}systemPathMakeAbsolutePath combo
Change-Id: Iec4c2ff8c8239069f95fff195c49fac9f7c865d4
Reviewed-on: https://gerrit.libreoffice.org/78656
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/file_misc.cxx | 3 | ||||
-rw-r--r-- | sal/osl/unx/file_path_helper.cxx | 15 | ||||
-rw-r--r-- | sal/osl/unx/file_path_helper.hxx | 45 | ||||
-rw-r--r-- | sal/osl/unx/file_url.cxx | 5 |
4 files changed, 12 insertions, 56 deletions
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index 518a1b407a31..8ecc59299265 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -297,7 +297,6 @@ oslFileError SAL_CALL osl_getNextDirectoryItem(oslDirectory pDirectory, DirectoryImpl* pDirImpl = static_cast<DirectoryImpl*>(pDirectory); OUString ustrFileName; - OUString ustrFilePath; struct dirent* pEntry; if ((pDirectory == nullptr) || (pItem == nullptr)) @@ -335,7 +334,7 @@ oslFileError SAL_CALL osl_getNextDirectoryItem(oslDirectory pDirectory, osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS); assert(ustrFileName.pData); - osl::systemPathMakeAbsolutePath(pDirImpl->ustrPath, ustrFileName, ustrFilePath); + auto const ustrFilePath = osl::systemPathMakeAbsolutePath(pDirImpl->ustrPath, ustrFileName); DirectoryItem_Impl* pImpl = static_cast< DirectoryItem_Impl* >(*pItem); if (pImpl) diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx index b75070c304ca..5ddef5873585 100644 --- a/sal/osl/unx/file_path_helper.cxx +++ b/sal/osl/unx/file_path_helper.cxx @@ -80,21 +80,16 @@ bool osl_systemPathIsRelativePath(const rtl_uString* pustrPath) return ((pustrPath == nullptr) || (pustrPath->length == 0) || (pustrPath->buffer[0] != FPH_CHAR_PATH_SEPARATOR)); } -void osl_systemPathMakeAbsolutePath( - const rtl_uString* pustrBasePath, - const rtl_uString* pustrRelPath, - rtl_uString** ppustrAbsolutePath) +OUString osl::systemPathMakeAbsolutePath( + const OUString& BasePath, + const OUString& RelPath) { - OUString base(rtl_uString_getStr(const_cast<rtl_uString*>(pustrBasePath))); - OUString rel(const_cast<rtl_uString*>(pustrRelPath)); + OUString base(BasePath); if (!base.isEmpty()) osl_systemPathEnsureSeparator(&base); - base += rel; - - rtl_uString_acquire(base.pData); - *ppustrAbsolutePath = base.pData; + return base + RelPath; } void osl_systemPathGetFileNameOrLastDirectoryPart( diff --git a/sal/osl/unx/file_path_helper.hxx b/sal/osl/unx/file_path_helper.hxx index 0f09ccac2025..9fe7c8e047e9 100644 --- a/sal/osl/unx/file_path_helper.hxx +++ b/sal/osl/unx/file_path_helper.hxx @@ -64,30 +64,6 @@ bool osl_systemPathIsRelativePath( const rtl_uString* pustrPath); /** - Append a relative path to a base path - - @param pustrBasePath [in] a system path that will be considered as - base path pustrBasePath must not be NULL - - @param pustrRelPath [in] a system path that will be considered as - relative path pustrBasePath must not be NULL - - @param ppustrAbsolutePath [out] the resulting path which is a concatenation - of the base and the relative path if base path - is empty the resulting absolute path is the - relative path if relative path is empty the - resulting absolute path is the base path if base - and relative path are empty the resulting absolute - path is also empty ppustrAbsolutePath must not be - NULL and *ppustrAbsolutePath must be 0 or point to - a valid rtl_uString -*/ -void osl_systemPathMakeAbsolutePath( - const rtl_uString* pustrBasePath, - const rtl_uString* pustrRelPath, - rtl_uString** ppustrAbsolutePath); - -/** Returns the file or the directory part of the given path @param pustrPath [in] a system path, must not be NULL @@ -233,17 +209,15 @@ namespace osl systemPathMakeAbsolutePath Append a relative path to a base path - @param pustrBasePath [in] a system + @param BasePath [in] a system path that will be considered as base path - pustrBasePath must not be NULL - @param pustrRelPath [in] a system path + @param RelPath [in] a system path that will be considered as relative path - pustrBasePath must not be NULL - @param ppustrAbsolutePath [out] the + @return the resulting path which is a concatenation of the base and the relative path @@ -256,21 +230,12 @@ namespace osl if base and relative path are empty the resulting absolute path is also empty - ppustrAbsolutePath must not be - NULL and *ppustrAbsolutePath - must be 0 or point to a valid - rtl_uString *****************************************/ - inline void systemPathMakeAbsolutePath( + OUString systemPathMakeAbsolutePath( const OUString& BasePath, - const OUString& RelPath, - OUString& AbsolutePath) - { - osl_systemPathMakeAbsolutePath( - BasePath.pData, RelPath.pData, &AbsolutePath.pData); - } + const OUString& RelPath); /******************************************** systemPathIsHiddenFileOrDirectoryEntry diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx index af79767cca3b..75c058735c06 100644 --- a/sal/osl/unx/file_url.cxx +++ b/sal/osl/unx/file_url.cxx @@ -614,10 +614,7 @@ oslFileError osl_getAbsoluteFileURL( if (rc != osl_File_E_None) return rc; - OUString abs_path; - systemPathMakeAbsolutePath(base_path, unresolved_path, abs_path); - - unresolved_path = abs_path; + unresolved_path = systemPathMakeAbsolutePath(base_path, unresolved_path); } OUString resolved_path; |