diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2017-05-20 18:17:13 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2017-05-20 13:09:06 +0200 |
commit | 0a72b799718a17b0ea49dc36d974da28000fc952 (patch) | |
tree | 964ee942a62e8b2ca2a6763040f48f7f455f98e3 /sal | |
parent | c6c245bd4d759bb0a220e2d057ba1e0a556f9aab (diff) |
tdf#107968 - double slash handling misleading; add unit test
Change-Id: Ide52926eff56065e7368615338ea33dcb2f87c62
Reviewed-on: https://gerrit.libreoffice.org/37850
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/file_url.cxx | 4 | ||||
-rw-r--r-- | sal/qa/osl/file/osl_File.cxx | 9 |
2 files changed, 11 insertions, 2 deletions
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(""); |