sal/osl/unx/file_url.cxx | 4 ++-- sal/qa/osl/file/osl_File.cxx | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-)
New commits: commit 0a72b799718a17b0ea49dc36d974da28000fc952 Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Sat May 20 18:17:13 2017 +1000 tdf#107968 - double slash handling misleading; add unit test Change-Id: Ide52926eff56065e7368615338ea33dcb2f87c62 Reviewed-on: https://gerrit.libreoffice.org/37850 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherloc...@gmail.com> diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx index b47f94192833..e6c0ecc2a02f 100644 --- a/sal/osl/unx/file_url.cxx +++ b/sal/osl/unx/file_url.cxx @@ -281,7 +281,7 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath, } } - /* check if initial string contains double instances of '/' */ + /* check if initial string contains repeated '/' characters */ nIndex = rtl_ustr_indexOfStr_WithLength( ustrSystemPath->buffer, ustrSystemPath->length, pDoubleSlash, 2 ); if( nIndex != -1 ) { @@ -295,7 +295,7 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath, /* adapt index to pTmp */ nIndex += pTmp->length - ustrSystemPath->length; - /* remove all occurrences of '//' */ + /* replace repeated '/' characters with a single '/' */ for( nSrcIndex = nIndex + 1; nSrcIndex < pTmp->length; nSrcIndex++ ) { if( (pTmp->buffer[nSrcIndex] == '/') && (pTmp->buffer[nIndex] == '/') ) diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index 4e635a1d559f..7176885dbbae 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -611,6 +611,7 @@ namespace osl_FileBase void getFileURLFromSystemPath_002(); void getFileURLFromSystemPath_003(); void getFileURLFromSystemPath_004(); + void getFileURLFromSystemPath_004_1(); void getFileURLFromSystemPath_005(); CPPUNIT_TEST_SUITE(SystemPath_FileURL); @@ -641,6 +642,7 @@ namespace osl_FileBase CPPUNIT_TEST(getFileURLFromSystemPath_002); CPPUNIT_TEST(getFileURLFromSystemPath_003); CPPUNIT_TEST(getFileURLFromSystemPath_004); + CPPUNIT_TEST(getFileURLFromSystemPath_004_1); CPPUNIT_TEST(getFileURLFromSystemPath_005); CPPUNIT_TEST_SUITE_END(); @@ -1017,6 +1019,13 @@ namespace osl_FileBase checkWNTBehaviour_getFileURLFromSystemPath(sSysPath, osl::FileBase::E_INVAL, ""); } + void SystemPath_FileURL::getFileURLFromSystemPath_004_1() + { + OString sSysPath("/tmp///first start"); + checkUNXBehaviour_getFileURLFromSystemPath(sSysPath, osl::FileBase::E_None, "file:///tmp/first%20start"); + checkWNTBehaviour_getFileURLFromSystemPath(sSysPath, osl::FileBase::E_INVAL, ""); + } + void SystemPath_FileURL::getFileURLFromSystemPath_005() { OString sSysPath(""); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits