oox/source/core/xmlfilterbase.cxx | 2 +- oox/source/dump/dumperbase.cxx | 10 +++++----- oox/source/export/drawingml.cxx | 3 +-- pyuno/source/module/pyuno_util.cxx | 6 +++--- sax/source/tools/converter.cxx | 3 ++- sd/source/filter/html/htmlex.cxx | 21 ++++++++++++--------- sd/source/ui/remotecontrol/ImagePreparer.cxx | 5 ++--- sd/source/ui/view/frmview.cxx | 7 +++++-- sdext/source/pdfimport/pdfparse/pdfentries.cxx | 2 +- 9 files changed, 32 insertions(+), 27 deletions(-)
New commits: commit e7903c01b112665a300350b7e86c2bf65f81b8a7 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Jul 21 18:49:47 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Jul 22 11:14:37 2022 +0200 elide some makeStringAndClear() calls Change-Id: I3b80d0f5b6d39c071242bc6ccc1e4333886c835d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137309 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index e8e1a138984b..d415a739fe3e 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -610,7 +610,7 @@ writeElement( const FSHelperPtr& pDoc, sal_Int32 nXmlElement, const Sequence< OU ::comphelper::intersperse(aItems.begin(), aItems.end(), ::comphelper::OUStringBufferAppender(sRep), OUString(" ")); - writeElement( pDoc, nXmlElement, sRep.makeStringAndClear() ); + writeElement( pDoc, nXmlElement, sRep ); } static void diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx index 61d603228b42..9633352d85c6 100644 --- a/oox/source/dump/dumperbase.cxx +++ b/oox/source/dump/dumperbase.cxx @@ -523,7 +523,7 @@ void StringHelper::appendIndex( OUStringBuffer& rStr, sal_Int64 nIdx ) { OUStringBuffer aToken; appendDec( aToken, nIdx ); - rStr.append( '[' ).append( aToken.makeStringAndClear() ).append( ']' ); + rStr.append( '[' ).append( aToken ).append( ']' ); } std::u16string_view StringHelper::getToken( std::u16string_view rData, sal_Int32& rnPos, sal_Unicode cSep ) @@ -575,7 +575,7 @@ OUString lclTrimQuotedStringList( const OUString& rStr ) } while( (nPos < nLen) && (rStr[ nPos ] != OOX_DUMP_CFG_QUOTE) ); // add token, seek to list separator, ignore text following closing quote - aBuffer.append( aToken.makeStringAndClear() ); + aBuffer.append( aToken ); nPos = lclIndexOf( rStr, OOX_DUMP_CFG_LISTSEP, nPos ); if( nPos < nLen ) aBuffer.append( OOX_DUMP_LF ); @@ -1100,7 +1100,7 @@ OUString FlagsList::implGetName( const Config& /*rCfg*/, sal_Int64 nKey ) const aUnknown.append( OOX_DUMP_ITEMSEP ); StringHelper::appendShortHex( aUnknown, nKey ); StringHelper::enclose( aUnknown, '(', ')' ); - StringHelper::appendToken( aName, aUnknown.makeStringAndClear() ); + StringHelper::appendToken( aName, aUnknown ); } return aName.makeStringAndClear(); } @@ -1203,14 +1203,14 @@ OUString CombiList::implGetName( const Config& rCfg, sal_Int64 nKey ) const case DATATYPE_DOUBLE: StringHelper::appendValue( aValue, static_cast< double >( nSValue ), rItemFmt.meFmtType ); break; default:; } - StringHelper::appendToken( aItem, aValue.makeStringAndClear(), OOX_DUMP_ITEMSEP ); + StringHelper::appendToken( aItem, aValue, OOX_DUMP_ITEMSEP ); if( !rItemFmt.maListName.isEmpty() ) { OUString aValueName = rCfg.getName( rItemFmt.maListName, static_cast< sal_Int64 >( nUValue ) ); StringHelper::appendToken( aItem, aValueName, OOX_DUMP_ITEMSEP ); } StringHelper::enclose( aItem, '(', ')' ); - StringHelper::appendToken( aName, aItem.makeStringAndClear() ); + StringHelper::appendToken( aName, aItem ); setFlag( nFound, nMask ); } } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index df9b039640d4..d889f475c556 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -5644,8 +5644,7 @@ OString DrawingML::WriteWdpPicture( const OUString& rFileId, const Sequence< sal oox::getRelationship(Relationship::HDPHOTO), OUStringBuffer() .appendAscii( GetRelationCompPrefix() ) - .append( sFileName ) - .makeStringAndClear() ); + .append( sFileName ) ); maWdpCache[rFileId] = sId; return OUStringToOString( sId, RTL_TEXTENCODING_UTF8 ); diff --git a/pyuno/source/module/pyuno_util.cxx b/pyuno/source/module/pyuno_util.cxx index 12d58f0eca20..b66700773d00 100644 --- a/pyuno/source/module/pyuno_util.cxx +++ b/pyuno/source/module/pyuno_util.cxx @@ -154,7 +154,7 @@ void logException( RuntimeCargo *cargo, const char *intro, buf.append( OUString::Concat("].") + aFunctionName + " = " ); buf.append( val2str( data, type.getTypeLibType(), VAL2STR_MODE_SHALLOW ) ); - log( cargo,LogLevel::CALL, buf.makeStringAndClear() ); + log( cargo,LogLevel::CALL, buf ); } } @@ -181,7 +181,7 @@ void logReply( buf.append( val2str( p.getValue(), p.getValueTypeRef(), VAL2STR_MODE_SHALLOW) ); } } - log( cargo,LogLevel::CALL, buf.makeStringAndClear() ); + log( cargo,LogLevel::CALL, buf ); } @@ -204,7 +204,7 @@ void logCall( RuntimeCargo *cargo, const char *intro, } } buf.append( ")" ); - log( cargo,LogLevel::CALL, buf.makeStringAndClear() ); + log( cargo,LogLevel::CALL, buf ); } diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 2abfe35750c2..b19add9c616a 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -30,6 +30,7 @@ #include <rtl/math.hxx> #include <rtl/character.hxx> #include <sal/log.hxx> +#include <o3tl/string_view.hxx> #include <o3tl/typed_flags_set.hxx> #include <o3tl/unit_conversion.hxx> #include <osl/diagnose.h> @@ -1046,7 +1047,7 @@ static bool convertDurationHelper(double& rfTime, V pStr) double fHour = nHours; double fMin = nMins; double fSec = nSecs; - double fFraction = sDoubleStr.makeStringAndClear().toDouble(); + double fFraction = o3tl::toDouble(sDoubleStr); double fTempTime = fHour / 24; fTempTime += fMin / (24 * 60); fTempTime += fSec / (24 * 60 * 60); diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index 072ac3c27165..a277f976bf41 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -684,7 +684,7 @@ void HtmlExport::ExportSingleDocument() // close page aStr.append("</body>\r\n</html>"); - WriteHtml(maDocFileName, false, aStr.makeStringAndClear()); + WriteHtml(maDocFileName, false, aStr); pOutliner->Clear(); ResetProgress(); @@ -1127,7 +1127,7 @@ bool HtmlExport::CreateHtmlTextForPresPages() // close page aStr.append("</body>\r\n</html>"); - bOk = WriteHtml(maTextFiles[nSdPage], false, aStr.makeStringAndClear()); + bOk = WriteHtml(maTextFiles[nSdPage], false, aStr); if (mpProgress) mpProgress->SetState(++mnPagesWritten); @@ -1879,7 +1879,8 @@ bool HtmlExport::CreateHtmlForPresPages() aStr.append("</body>\r\n</html>"); - bOk = WriteHtml(maHTMLFiles[nSdPage], false, aStr.makeStringAndClear()); + bOk = WriteHtml(maHTMLFiles[nSdPage], false, aStr); + aStr.setLength(0); if (mpProgress) mpProgress->SetState(++mnPagesWritten); @@ -2013,7 +2014,7 @@ bool HtmlExport::CreateContentPage() aStr.append("</body>\r\n</html>"); - bool bOk = WriteHtml(maIndex, false, aStr.makeStringAndClear()); + bool bOk = WriteHtml(maIndex, false, aStr); if (mpProgress) mpProgress->SetState(++mnPagesWritten); @@ -2048,7 +2049,7 @@ bool HtmlExport::CreateNotesPages() aStr.append("</body>\r\n</html>"); OUString aFileName("note" + OUString::number(nSdPage)); - bOk = WriteHtml(aFileName, true, aStr.makeStringAndClear()); + bOk = WriteHtml(aFileName, true, aStr); if (mpProgress) mpProgress->SetState(++mnPagesWritten); @@ -2109,7 +2110,8 @@ bool HtmlExport::CreateOutlinePages() aStr.append("</body>\r\n</html>"); OUString aFileName("outline" + OUString::number(nPage)); - bOk = WriteHtml(aFileName, true, aStr.makeStringAndClear()); + bOk = WriteHtml(aFileName, true, aStr); + aStr.setLength(0); if (mpProgress) mpProgress->SetState(++mnPagesWritten); @@ -2359,7 +2361,7 @@ bool HtmlExport::CreateFrames() aStr.append(RESTOHTML(STR_HTMLEXP_NOFRAMES)); aStr.append("\r\n</noframes>\r\n</frameset>\r\n</html>"); - bool bOk = WriteHtml(maFramePage, false, aStr.makeStringAndClear()); + bool bOk = WriteHtml(maFramePage, false, aStr); if (mpProgress) mpProgress->SetState(++mnPagesWritten); @@ -2481,7 +2483,8 @@ bool HtmlExport::CreateNavBarFrames() OUString aFileName("navbar" + OUString::number(nFile)); - bOk = WriteHtml(aFileName, true, aStr.makeStringAndClear()); + bOk = WriteHtml(aFileName, true, aStr); + aStr.setLength(0); if (mpProgress) mpProgress->SetState(++mnPagesWritten); @@ -2947,7 +2950,7 @@ bool HtmlExport::CreateImageFileList() aStr.append("\r\n"); } - bool bOk = WriteHtml("picture.txt", false, aStr.makeStringAndClear()); + bool bOk = WriteHtml("picture.txt", false, aStr); if (mpProgress) mpProgress->SetState(++mnPagesWritten); diff --git a/sd/source/ui/remotecontrol/ImagePreparer.cxx b/sd/source/ui/remotecontrol/ImagePreparer.cxx index ba8d2c1f3309..0166bd1665f0 100644 --- a/sd/source/ui/remotecontrol/ImagePreparer.cxx +++ b/sd/source/ui/remotecontrol/ImagePreparer.cxx @@ -87,7 +87,7 @@ void ImagePreparer::sendPreview( sal_uInt32 aSlideNumber ) ::comphelper::Base64::encode( aStrBuffer, aImageData ); OString aEncodedShortString = OUStringToOString( - aStrBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); + aStrBuffer, RTL_TEXTENCODING_UTF8 ); // Start the writing OString aBuffer = "slide_preview\n" + @@ -248,8 +248,7 @@ OString ImagePreparer::prepareNotes( sal_uInt32 aSlideNumber ) aRet.insert( i+1, "br/>" ); } } - return OUStringToOString( - aRet.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); + return OUStringToOString( aRet, RTL_TEXTENCODING_UTF8 ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx index fad0dc9ad9ea..22d85aac91d5 100644 --- a/sd/source/ui/view/frmview.cxx +++ b/sd/source/ui/view/frmview.cxx @@ -26,6 +26,7 @@ #include <unokywds.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <vector> @@ -499,7 +500,8 @@ static void createHelpLinesFromString( const OUString& rLines, SdrHelpLineList& sBuffer.append( *pStr++ ); } - sal_Int32 nValue = sBuffer.makeStringAndClear().toInt32(); + sal_Int32 nValue = o3tl::toInt32(sBuffer); + sBuffer.setLength(0); if( aNewHelpLine.GetKind() == SdrHelpLineKind::Horizontal ) { @@ -519,7 +521,8 @@ static void createHelpLinesFromString( const OUString& rLines, SdrHelpLineList& sBuffer.append( *pStr++ ); } - aPoint.setY( sBuffer.makeStringAndClear().toInt32() ); + aPoint.setY( o3tl::toInt32(sBuffer) ); + sBuffer.setLength(0); } } diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx index 6fba80f7029e..9c9a269d6098 100644 --- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx @@ -183,7 +183,7 @@ OUString PDFName::getFilteredName() const else aFilter.append( pStr[i] ); } - return OStringToOUString( aFilter.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); + return OStringToOUString( aFilter, RTL_TEXTENCODING_UTF8 ); } PDFString::~PDFString()