diff options
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/file_path_helper.cxx | 2 | ||||
-rw-r--r-- | sal/osl/w32/path_helper.cxx | 2 | ||||
-rw-r--r-- | sal/qa/osl/file/osl_File.cxx | 8 | ||||
-rw-r--r-- | sal/qa/osl/module/osl_Module.cxx | 5 |
4 files changed, 7 insertions, 10 deletions
diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx index ce1b47b62c90..71c3c3206d16 100644 --- a/sal/osl/unx/file_path_helper.cxx +++ b/sal/osl/unx/file_path_helper.cxx @@ -71,7 +71,7 @@ void SAL_CALL osl_systemPathEnsureSeparator(rtl_uString** ppustrPath) rtl_uString_assign(ppustrPath, path.pData); } - OSL_POSTCOND(path.lastIndexOf(FPH_CHAR_PATH_SEPARATOR) == (path.getLength() - 1), \ + OSL_POSTCOND(path.endsWith(FPH_PATH_SEPARATOR()), \ "osl_systemPathEnsureSeparator: Post condition failed"); } } diff --git a/sal/osl/w32/path_helper.cxx b/sal/osl/w32/path_helper.cxx index b91c1874c4b7..c58d70dd18e4 100644 --- a/sal/osl/w32/path_helper.cxx +++ b/sal/osl/w32/path_helper.cxx @@ -54,7 +54,7 @@ void osl_systemPathEnsureSeparator(/*inout*/ rtl_uString** ppustrPath) rtl_uString_assign(ppustrPath, path.pData); } - OSL_POSTCOND(path.lastIndexOf(BACKSLASH) == (path.getLength() - 1), \ + OSL_POSTCOND(path.endsWith(BACKSLASH), \ "osl_systemPathEnsureSeparator: Post condition failed"); } diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index 54966aca78c9..50268ff49a57 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -322,9 +322,9 @@ inline sal_Bool isURL( const sal_Char *pathname ) /** simple version to judge if a file name or directory name is a URL or a system path, just to see if it is start with "file:///";. */ -inline sal_Bool isURL( const ::rtl::OUString pathname ) +inline bool isURL( const ::rtl::OUString pathname ) { - return ( ( pathname.indexOf( aPreURL ) == 0 ) ? sal_True : sal_False ); + return pathname.startsWith( aPreURL ); } /** concat two part to form a URL or system path, add PATH_SEPARATOR between them if necessary, add "file:///" to beginning if necessary. @@ -339,10 +339,8 @@ inline void concatURL( ::rtl::OUString & pathname1, const ::rtl::OUString & path pathname1 = aPathName.copy( 0 ); } - sal_Int32 index = 0; //check if '/' is in the end of pathname1 or at the begin of pathname2; - if ( ( ( index = pathname1.lastIndexOf( aSlashURL ) ) != ( pathname1.getLength() - 1 ) ) && - ( ( index = pathname2.indexOf( aSlashURL ) ) != 0 ) ) + if ( !pathname1.endsWith( aSlashURL ) && !pathname2.startsWith( aSlashURL ) ) pathname1 += aSlashURL; pathname1 += pathname2; } diff --git a/sal/qa/osl/module/osl_Module.cxx b/sal/qa/osl/module/osl_Module.cxx index 2b51bdfbc5fa..d6358d4c692c 100644 --- a/sal/qa/osl/module/osl_Module.cxx +++ b/sal/qa/osl/module/osl_Module.cxx @@ -70,10 +70,9 @@ inline ::rtl::OUString getDllURL( void ) return dllPath; } -inline sal_Bool isURL( const ::rtl::OUString pathname ) +inline bool isURL( const ::rtl::OUString pathname ) { - ::rtl::OUString aPreURL( "file:///" ); - return ( ( pathname.indexOf( aPreURL ) == 0 ) ? sal_True : sal_False ); + return pathname.startsWith( "file:///" ); } /** create a temp test directory using OUString name of full qualified URL or system path. |