diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-08-30 19:31:01 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-08-30 22:32:06 +0200 |
commit | d9fab1c4bb4a2c629a64dc301fcecdc16f589bc2 (patch) | |
tree | c71d9c130965f74d95e611eb6ae8ce84870898aa /sal/osl/unx | |
parent | 69fbf74d5bf9c474a6ec04101426dfe79b4ad9bf (diff) |
Extract common code from #if/#else blocks
Change-Id: I7d14fd76ec4e571d5971131b5ee16f4dfe648b23
Reviewed-on: https://gerrit.libreoffice.org/78316
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal/osl/unx')
-rw-r--r-- | sal/osl/unx/file_misc.cxx | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index ac2b1de2eca1..880ed3045e32 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -317,26 +317,24 @@ oslFileError SAL_CALL osl_getNextDirectoryItem(oslDirectory pDirectory, if (!pEntry) return osl_File_E_NOENT; -#if defined(MACOSX) + char const * filename = pEntry->d_name; - // convert decomposed filename to precomposed unicode +#if defined(MACOSX) + // convert decomposed filename to precomposed UTF-8 char composed_name[BUFSIZ]; CFMutableStringRef strRef = CFStringCreateMutable(nullptr, 0 ); - CFStringAppendCString(strRef, pEntry->d_name, kCFStringEncodingUTF8); // UTF8 is default on Mac OSX + CFStringAppendCString(strRef, filename, kCFStringEncodingUTF8); // UTF8 is default on Mac OSX CFStringNormalize(strRef, kCFStringNormalizationFormC); CFStringGetCString(strRef, composed_name, BUFSIZ, kCFStringEncodingUTF8); CFRelease(strRef); - rtl_string2UString(&ustrFileName, composed_name, strlen(composed_name), - osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS); + filename = composed_name; +#endif -#else // not MACOSX /* convert file name to unicode */ - rtl_string2UString(&ustrFileName, pEntry->d_name, strlen(pEntry->d_name), + rtl_string2UString(&ustrFileName, filename, strlen(filename), osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS); assert(ustrFileName); -#endif - osl_systemPathMakeAbsolutePath(pDirImpl->ustrPath.pData, ustrFileName, &ustrFilePath); rtl_uString_release(ustrFileName); |