[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sal/osl sal/qa

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 3 08:12:12 UTC 2019


 sal/osl/w32/file_url.cxx                                              |   10 ++++++----
 sal/qa/osl/getsystempathfromfileurl/test-getsystempathfromfileurl.cxx |    2 --
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 7a22576478efcf9445a572574b905d6dd07b1e74
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Tue Nov 26 22:05:10 2019 +0100
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Tue Dec 3 09:11:18 2019 +0100

    WIN accept single-backslash file URIs
    
    From all I could find, a single (back-)slash file URI is fine as
    a local file path.
    
    This includes the commit "WIN enable NoAuthority test"
    (cherry picked from commit f9fd9d4cd4f792cd4ec8e14df78f3193653dae67)
    
    Change-Id: I75e95c809894cdef88f708d0477cb98eb114a107
    Reviewed-on: https://gerrit.libreoffice.org/83837
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit 895cd72158fc8a455f705764ae4ae000b933eba4)
    Reviewed-on: https://gerrit.libreoffice.org/83952

diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index e44a17a4d472..a5aba24248c4 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -676,7 +676,7 @@ oslFileError osl_getSystemPathFromFileURL_( rtl_uString *strURL, rtl_uString **p
 
     SAL_WARN_IF(
         strUTF8->length != strURL->length &&
-        0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( strURL->buffer, strURL->length, "file:\\\\", 7 )
+        0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( strURL->buffer, strURL->length, "file:\\", 6 )
         , "sal.osl"
         ,"osl_getSystemPathFromFileURL: \"" << OUString(strURL) << "\" is not encoded !!!");
 
@@ -695,8 +695,8 @@ oslFileError osl_getSystemPathFromFileURL_( rtl_uString *strURL, rtl_uString **p
         const sal_Unicode *pDecodedURL = rtl_uString_getStr( strDecodedURL );
         nDecodedLen = rtl_uString_getLength( strDecodedURL );
 
-        /* Must start with "file://" */
-        if ( 0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL, nDecodedLen, "file:\\\\", 7 ) )
+        /* Must start with "file:/" */
+        if ( 0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL, nDecodedLen, "file:\\", 6 ) )
         {
             sal_uInt32  nSkip;
 
@@ -707,8 +707,10 @@ oslFileError osl_getSystemPathFromFileURL_( rtl_uString *strURL, rtl_uString **p
                 0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL, nDecodedLen, "file:\\\\127.0.0.1\\", 17 )
                       )
                 nSkip = 17;
-            else
+            else if ( 0 == rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL, nDecodedLen, "file:\\\\", 7 ) )
                 nSkip = 5;
+            else
+                nSkip = 6;
 
             /* Indicates local root */
             if ( nDecodedLen == nSkip )
diff --git a/sal/qa/osl/getsystempathfromfileurl/test-getsystempathfromfileurl.cxx b/sal/qa/osl/getsystempathfromfileurl/test-getsystempathfromfileurl.cxx
index 51022d9e3fe2..4fd5d6b16ffb 100644
--- a/sal/qa/osl/getsystempathfromfileurl/test-getsystempathfromfileurl.cxx
+++ b/sal/qa/osl/getsystempathfromfileurl/test-getsystempathfromfileurl.cxx
@@ -134,12 +134,10 @@ void Test::testLocalhost3Authority() {
 }
 
 void Test::testNoAuthority() {
-#if !defined(_WIN32) //TODO
     OUString p;
     auto e = osl::FileBase::getSystemPathFromFileURL("file:" MY_PATH_IN, p);
     CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, e);
     CPPUNIT_ASSERT_EQUAL(OUString(MY_PATH_OUT), p);
-#endif
 }
 
 void Test::testEmptyPath() {


More information about the Libreoffice-commits mailing list