diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-06-24 19:14:36 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2018-06-30 23:00:14 +0200 |
commit | ab1e5f514c6f7d9ca482fe628b38e00d51c1e4a5 (patch) | |
tree | cb1bb5349e78468925c059cf9e25ccd24c55704a /svx | |
parent | 842bb20958af0a1a8af7e0403142fe3cf0112731 (diff) |
Bail out early and reduce temporaries
Change-Id: I78e3d50f0bcbbb482ce79bbb1f14885e1e412569
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/xml/xmlgrhlp.cxx | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index cd785f8d0e1d..4063179e9082 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -397,26 +397,22 @@ bool SvXMLGraphicHelper::ImplGetStreamNames( const OUString& rURLStr, OUString& rPictureStorageName, OUString& rPictureStreamName ) { - OUString aURLStr( rURLStr ); - bool bRet = false; + if (rURLStr.isEmpty()) + return false; - if( !aURLStr.isEmpty() ) - { - aURLStr = aURLStr.copy(aURLStr.lastIndexOf(':')+1); - - if( comphelper::string::getTokenCount(aURLStr, '/') == 1 ) - { - rPictureStorageName = XML_GRAPHICSTORAGE_NAME; - rPictureStreamName = aURLStr; - } - else - SvXMLEmbeddedObjectHelper::splitObjectURL(aURLStr, rPictureStorageName, rPictureStreamName); + const OUString aURLStr {rURLStr.copy(rURLStr.lastIndexOf(':')+1)}; - bRet = !rPictureStreamName.isEmpty(); - SAL_WARN_IF(!bRet, "svx", "SvXMLGraphicHelper::ImplInsertGraphicURL: invalid scheme: " << rURLStr); + if( comphelper::string::getTokenCount(aURLStr, '/') == 1 ) + { + rPictureStorageName = XML_GRAPHICSTORAGE_NAME; + rPictureStreamName = aURLStr; } + else + SvXMLEmbeddedObjectHelper::splitObjectURL(aURLStr, rPictureStorageName, rPictureStreamName); + + SAL_WARN_IF(rPictureStreamName.isEmpty(), "svx", "SvXMLGraphicHelper::ImplInsertGraphicURL: invalid scheme: " << rURLStr); - return bRet; + return !rPictureStreamName.isEmpty(); } uno::Reference < embed::XStorage > SvXMLGraphicHelper::ImplGetGraphicStorage( const OUString& rStorageName ) |