diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-23 09:21:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-23 14:32:41 +0200 |
commit | d8b60f77f389a248f98aa45592e6e1045baafbe1 (patch) | |
tree | 2f5167826a2dd5b09582d1c4b54623415fae1d6f /sal | |
parent | 6ed597a7dd1da40248236e7a71843c2d76d6173e (diff) |
rtl_String->OString in DirectoryItem_Impl
Change-Id: Id7b97cbc4160b0d5953c5e378b11a2006292a9ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134799
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/file_impl.hxx | 4 | ||||
-rw-r--r-- | sal/osl/unx/file_misc.cxx | 14 | ||||
-rw-r--r-- | sal/osl/unx/file_stat.cxx | 6 |
3 files changed, 10 insertions, 14 deletions
diff --git a/sal/osl/unx/file_impl.hxx b/sal/osl/unx/file_impl.hxx index 078474cf05ff..a4e0c66adc57 100644 --- a/sal/osl/unx/file_impl.hxx +++ b/sal/osl/unx/file_impl.hxx @@ -27,12 +27,12 @@ struct DirectoryItem_Impl { - rtl_String * m_strFilePath; /* holds native file name */ + OString m_strFilePath; /* holds native file name */ sal_Int32 m_RefCount; unsigned char m_DType; explicit DirectoryItem_Impl( - rtl_String * strFilePath, unsigned char DType = 0); + OString strFilePath, unsigned char DType = 0); ~DirectoryItem_Impl(); static void * operator new(size_t n); diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index fee04804ea19..50fdcc040765 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -84,18 +84,14 @@ struct DirectoryImpl } DirectoryItem_Impl::DirectoryItem_Impl( - rtl_String * strFilePath, unsigned char DType) - : m_strFilePath (strFilePath), + OString strFilePath, unsigned char DType) + : m_strFilePath (std::move(strFilePath)), m_RefCount (1), m_DType (DType) { - if (m_strFilePath != nullptr) - rtl_string_acquire(m_strFilePath); } DirectoryItem_Impl::~DirectoryItem_Impl() { - if (m_strFilePath != nullptr) - rtl_string_release(m_strFilePath); } void * DirectoryItem_Impl::operator new(size_t n) @@ -343,9 +339,9 @@ oslFileError SAL_CALL osl_getNextDirectoryItem(oslDirectory pDirectory, pImpl = nullptr; } #ifdef _DIRENT_HAVE_D_TYPE - pImpl = new DirectoryItem_Impl(strFilePath.pData, pEntry->d_type); + pImpl = new DirectoryItem_Impl(std::move(strFilePath), pEntry->d_type); #else - pImpl = new DirectoryItem_Impl(strFilePath.pData); + pImpl = new DirectoryItem_Impl(std::move(strFilePath)); #endif /* _DIRENT_HAVE_D_TYPE */ *pItem = pImpl; @@ -372,7 +368,7 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString* ustrFileURL, oslDirector } else { - *pItem = new DirectoryItem_Impl(strSystemPath.pData); + *pItem = new DirectoryItem_Impl(std::move(strSystemPath)); } return osl_error; diff --git a/sal/osl/unx/file_stat.cxx b/sal/osl/unx/file_stat.cxx index d08a6ed56894..3b702905cb99 100644 --- a/sal/osl/unx/file_stat.cxx +++ b/sal/osl/unx/file_stat.cxx @@ -191,7 +191,7 @@ namespace if ((pImpl == nullptr) || (pStat == nullptr)) return osl_File_E_INVAL; - file_path = OString(pImpl->m_strFilePath); + file_path = pImpl->m_strFilePath; OSL_ASSERT(!file_path.isEmpty()); if (file_path.isEmpty()) return osl_File_E_INVAL; @@ -443,8 +443,8 @@ SAL_CALL osl_identicalDirectoryItem( oslDirectoryItem a, oslDirectoryItem b) struct stat a_stat, b_stat; - if (osl::lstat(OString(pA->m_strFilePath), a_stat) != 0 || - osl::lstat(OString(pB->m_strFilePath), b_stat) != 0) + if (osl::lstat(pA->m_strFilePath, a_stat) != 0 || + osl::lstat(pB->m_strFilePath, b_stat) != 0) return false; return (a_stat.st_ino == b_stat.st_ino); |