diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-25 14:24:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-25 18:43:52 +0200 |
commit | e810bd2b99777e192fb464572fa64a34bc0768fe (patch) | |
tree | 22e209b88814242c1914931dff28112cbf8c0e6f /xmloff | |
parent | 578758835e700b38b167753ccda9527f3a8cc43b (diff) |
merge some stringadds
found with a lightly tweaked version of the loplugin:stringadd
and some hand-holding.
Change-Id: I146aadcaf665e98fea89a9cad2df4dc3935622f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152275
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/xmlexp.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/style/xmlexppr.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/text/txtparae.cxx | 17 |
3 files changed, 9 insertions, 21 deletions
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index f98ad0540896..03277884ae0b 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -876,12 +876,9 @@ SvXMLExport::EnsureNamespace(OUString const & i_rNamespace) sPrefix = aPreferredPrefix; nKey = GetNamespaceMap_().GetKeyByPrefix( sPrefix ); sal_Int32 n( 0 ); - OUStringBuffer buf; while( nKey != USHRT_MAX ) { - buf.append( aPreferredPrefix ); - buf.append( ++n ); - sPrefix = buf.makeStringAndClear(); + sPrefix = aPreferredPrefix + OUString::number(++n); nKey = GetNamespaceMap_().GetKeyByPrefix( sPrefix ); } diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx index 4cb8e7b05150..b296ee8e9d98 100644 --- a/xmloff/source/style/xmlexppr.cxx +++ b/xmloff/source/style/xmlexppr.cxx @@ -965,7 +965,6 @@ void SvXMLExportPropertyMapper::_exportXML( const uno::Sequence< OUString > aAttribNames( xAttrContainer->getElementNames() ); - OUStringBuffer sNameBuffer; xml::AttributeData aData; for( const auto& rAttribName : aAttribNames ) { @@ -1008,9 +1007,7 @@ void SvXMLExportPropertyMapper::_exportXML( OUString sOrigPrefix( sPrefix ); do { - sNameBuffer.append( sOrigPrefix ); - sNameBuffer.append( ++n ); - sPrefix = sNameBuffer.makeStringAndClear(); + sPrefix = sOrigPrefix + OUString::number( ++n ); nKey = pNamespaceMap->GetKeyByPrefix( sPrefix ); } while( nKey != USHRT_MAX ); @@ -1024,8 +1021,7 @@ void SvXMLExportPropertyMapper::_exportXML( sPrefix = pNamespaceMap->GetPrefixByKey( nKey ); } // In any case, the attribute name has to be adapted. - sNameBuffer.append(sPrefix + ":" + rAttribName.subView(nColonPos+1)); - sAttribName = sNameBuffer.makeStringAndClear(); + sAttribName = sPrefix + ":" + rAttribName.subView(nColonPos+1); } if( bAddNamespace ) diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index d621d2c75cd6..e5344665b5e6 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -1201,10 +1201,9 @@ void XMLTextParagraphExport::exportListChange( { if ( rNextInfo.HasStartValue() ) { - OUStringBuffer aBuffer; - aBuffer.append( static_cast<sal_Int32>(rNextInfo.GetStartValue()) ); + OUString aTmp = OUString::number( static_cast<sal_Int32>(rNextInfo.GetStartValue()) ); GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE, - aBuffer.makeStringAndClear() ); + aTmp ); } else if (bRestartNumberingAtContinuedList) { @@ -1276,19 +1275,15 @@ void XMLTextParagraphExport::exportListChange( GetExport().CheckAttrList(); if( rNextInfo.HasStartValue() ) { - OUStringBuffer aBuffer; - aBuffer.append( static_cast<sal_Int32>(rNextInfo.GetStartValue()) ); - GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE, - aBuffer.makeStringAndClear() ); + OUString aTmp = OUString::number( static_cast<sal_Int32>(rNextInfo.GetStartValue()) ); + GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE, aTmp ); } // Handle restart without start value on list level 1 (#i103745#) else if ( rNextInfo.IsRestart() && /*!rNextInfo.HasStartValue() &&*/ rNextInfo.GetLevel() == 1 ) { - OUStringBuffer aBuffer; - aBuffer.append( static_cast<sal_Int32>(rNextInfo.GetListLevelStartValue()) ); - GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE, - aBuffer.makeStringAndClear() ); + OUString aTmp = OUString::number( static_cast<sal_Int32>(rNextInfo.GetListLevelStartValue()) ); + GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE, aTmp ); } if ( ( GetExport().getExportFlags() & SvXMLExportFlags::OASIS ) && GetExport().getSaneDefaultVersion() >= SvtSaveOptions::ODFSVER_012) |