summaryrefslogtreecommitdiff
path: root/xmloff/source/transform
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-07-07 13:05:57 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-07-07 15:21:33 +0200
commitadf419792743a4c79b2054e42618dff75bb552ce (patch)
tree18869048ab4255831c5846709ebd522e0bd64ca3 /xmloff/source/transform
parent23f80b26098bcf9a8ae870e8ded878cca6e0c541 (diff)
elide some string copies
Change-Id: I3e0d9f7e5a446689e007b9d01fb1c6bf9bc068e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136880 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/transform')
-rw-r--r--xmloff/source/transform/DocumentTContext.cxx12
-rw-r--r--xmloff/source/transform/TransformerBase.cxx4
2 files changed, 6 insertions, 10 deletions
diff --git a/xmloff/source/transform/DocumentTContext.cxx b/xmloff/source/transform/DocumentTContext.cxx
index 894146897af7..14ad377a68fc 100644
--- a/xmloff/source/transform/DocumentTContext.cxx
+++ b/xmloff/source/transform/DocumentTContext.cxx
@@ -64,20 +64,18 @@ void XMLDocumentTransformerContext::StartElement( const Reference< XAttributeLis
IsXMLToken( aLocalName, XML_MIMETYPE ) )
{
const OUString& rValue = xAttrList->getValueByIndex( i );
- static const char * aTmp[] =
+ static constexpr std::string_view aTmp[]
{
"application/vnd.oasis.openoffice.",
"application/x-vnd.oasis.openoffice.",
"application/vnd.oasis.opendocument.",
- "application/x-vnd.oasis.document.",
- nullptr
+ "application/x-vnd.oasis.document."
};
- for (int k=0; aTmp[k]; k++)
+ for (const auto & rPrefix : aTmp)
{
- OUString sTmpString = OUString::createFromAscii(aTmp[k]);
- if( rValue.matchAsciiL( aTmp[k], sTmpString.getLength() ) )
+ if( rValue.matchAsciiL( rPrefix.data(), rPrefix.size() ) )
{
- aClass = rValue.copy( sTmpString.getLength() );
+ aClass = rValue.copy( rPrefix.size() );
break;
}
}
diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx
index 90f8b198862a..87a6ae23836e 100644
--- a/xmloff/source/transform/TransformerBase.cxx
+++ b/xmloff/source/transform/TransformerBase.cxx
@@ -1332,11 +1332,9 @@ bool XMLTransformerBase::ConvertURIToOOo( OUString& rURI,
if( bPackage && bSupportPackage )
{
- OUString sTmp( '#' );
if( rURI.startsWith( "./" ) )
rURI = rURI.copy( 2 );
- sTmp += rURI;
- rURI = sTmp;
+ rURI = "#" + rURI;
bRet = true;
}
}