summaryrefslogtreecommitdiffstats
path: root/svtools/source/misc/imageresourceaccess.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-10-25 16:43:20 +0200
committerNoel Grandin <noel@peralex.com>2013-10-31 08:34:21 +0200
commite2451bd729d0f1d795a5b689deba65bc4e9d92c6 (patch)
tree4f2356107b0e58db7afda0fc324b9eac49ff68c0 /svtools/source/misc/imageresourceaccess.cxx
parentUse ScDocumentImport to insert data table cells. (diff)
downloadcore-e2451bd729d0f1d795a5b689deba65bc4e9d92c6.tar.gz
core-e2451bd729d0f1d795a5b689deba65bc4e9d92c6.zip
Convert indexOf->startsWith and lastIndexOf->endsWith
This is both an optimisation and a cleanup. This converts code like aStr.indexOf("XX") == 0 to aStr.startsWith("XX") and converts code like aStr.lastIndexOf("XXX") == aStr.getLength() - 3 to aStr.endsWith("XXX") Note that in general aStr.lastIndexOf("X") == aStr.getLength() - 1 converts to aStr.isEmpty() || aStr.endsWith("X") so I used the surrounding context to determine if aStr could be empty when modifying the code. Change-Id: I22cb8ca7c2a4d0288b001f72adb27fd63af87669
Diffstat (limited to 'svtools/source/misc/imageresourceaccess.cxx')
-rw-r--r--svtools/source/misc/imageresourceaccess.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/svtools/source/misc/imageresourceaccess.cxx b/svtools/source/misc/imageresourceaccess.cxx
index 40df75d7e98f..fe6e4740222e 100644
--- a/svtools/source/misc/imageresourceaccess.cxx
+++ b/svtools/source/misc/imageresourceaccess.cxx
@@ -126,11 +126,11 @@ namespace svt
//--------------------------------------------------------------------
bool GraphicAccess::isSupportedURL( const OUString& _rURL )
{
- if ( ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/" ) ) == 0 )
- || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:graphicrepository/" ) ) == 0 )
- || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:standardimage/" ) ) == 0 )
- || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) == 0 )
- || ( _rURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.extension://" ) ) == 0 )
+ if ( _rURL.startsWith( "private:resource/" )
+ || _rURL.startsWith( "private:graphicrepository/" )
+ || _rURL.startsWith( "private:standardimage/" )
+ || _rURL.startsWith( "vnd.sun.star.GraphicObject:" )
+ || _rURL.startsWith( "vnd.sun.star.extension://" )
)
return true;
return false;