summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2018-06-24 19:14:36 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2018-06-30 23:00:14 +0200
commitab1e5f514c6f7d9ca482fe628b38e00d51c1e4a5 (patch)
treecb1bb5349e78468925c059cf9e25ccd24c55704a /svx
parent842bb20958af0a1a8af7e0403142fe3cf0112731 (diff)
Bail out early and reduce temporaries
Change-Id: I78e3d50f0bcbbb482ce79bbb1f14885e1e412569
Diffstat (limited to 'svx')
-rw-r--r--svx/source/xml/xmlgrhlp.cxx28
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 )