[Libreoffice-commits] core.git: sal/osl

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 30 20:33:01 UTC 2019


 sal/osl/unx/file_misc.cxx |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

New commits:
commit d9fab1c4bb4a2c629a64dc301fcecdc16f589bc2
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Aug 30 19:31:01 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Aug 30 22:32:06 2019 +0200

    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 at redhat.com>

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);
 


More information about the Libreoffice-commits mailing list