diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-07-21 18:50:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-07-22 11:13:28 +0200 |
commit | aa2067dda63852b0eb84d5c32497f5a28177bb1c (patch) | |
tree | c55e9293ba60ac588e2b9431905c5ea0d3e48895 /svtools | |
parent | 7335d912de04eaa279dc805ee0ed5be0fcac5326 (diff) |
elide some makeStringAndClear() calls
Change-Id: Iccdb04df53bc981e2240240daddf15e9e1bb5a16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137310
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/svhtml/htmlout.cxx | 41 | ||||
-rw-r--r-- | svtools/source/svhtml/parhtml.cxx | 8 | ||||
-rw-r--r-- | svtools/source/svrtf/parrtf.cxx | 10 |
3 files changed, 40 insertions, 19 deletions
diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 473be3c3fb1c..3c9090f1062a 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -611,7 +611,8 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, " " OOO_STRING_SVTOOLS_HTML_O_name "=\""); - rStream.WriteOString( sOut.makeStringAndClear() ); + rStream.WriteOString( sOut ); + sOut.setLength(0); Out_String( rStream, rOutName ); rStream.WriteCharPtr( "\">" ); @@ -704,7 +705,8 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, "=" + pShape + " " OOO_STRING_SVTOOLS_HTML_O_coords "=\"" + aCoords + "\" "); - rStream.WriteOString( sOut.makeStringAndClear() ); + rStream.WriteOString( sOut ); + sOut.setLength(0); OUString aURL( pObj->GetURL() ); if( !aURL.isEmpty() && pObj->IsActive() ) @@ -712,7 +714,8 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, aURL = URIHelper::simpleNormalizedMakeRelative( rBaseURL, aURL ); sOut.append(OOO_STRING_SVTOOLS_HTML_O_href "=\""); - rStream.WriteOString( sOut.makeStringAndClear() ); + rStream.WriteOString( sOut ); + sOut.setLength(0); Out_String( rStream, aURL ).WriteChar( '\"' ); } else @@ -722,7 +725,8 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, if( !rObjName.isEmpty() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_name "=\""); - rStream.WriteOString( sOut.makeStringAndClear() ); + rStream.WriteOString( sOut ); + sOut.setLength(0); Out_String( rStream, rObjName ).WriteChar( '\"' ); } @@ -730,7 +734,8 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, if( !rTarget.isEmpty() && pObj->IsActive() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_target "=\""); - rStream.WriteOString( sOut.makeStringAndClear() ); + rStream.WriteOString( sOut ); + sOut.setLength(0); Out_String( rStream, rTarget ).WriteChar( '\"' ); } @@ -741,7 +746,8 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, if( !rDesc.isEmpty() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_alt "=\""); - rStream.WriteOString( sOut.makeStringAndClear() ); + rStream.WriteOString( sOut ); + sOut.setLength(0); Out_String( rStream, rDesc ).WriteChar( '\"' ); } @@ -782,7 +788,8 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, if( !rLanguage.isEmpty() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_language "=\""); - rStrm.WriteOString( sOut.makeStringAndClear() ); + rStrm.WriteOString( sOut ); + sOut.setLength(0); Out_String( rStrm, rLanguage ); sOut.append('\"'); } @@ -790,7 +797,8 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, if( !rSrc.isEmpty() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_src "=\""); - rStrm.WriteOString( sOut.makeStringAndClear() ); + rStrm.WriteOString( sOut ); + sOut.setLength(0); Out_String( rStrm, URIHelper::simpleNormalizedMakeRelative(rBaseURL, rSrc) ); sOut.append('\"'); } @@ -798,7 +806,8 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, if( STARBASIC != eScriptType && pSBLibrary ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_sdlibrary "=\""); - rStrm.WriteOString( sOut.makeStringAndClear() ); + rStrm.WriteOString( sOut ); + sOut.setLength(0); Out_String( rStrm, *pSBLibrary ); sOut.append('\"'); } @@ -806,14 +815,16 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, if( STARBASIC != eScriptType && pSBModule ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_sdmodule "=\""); - rStrm.WriteOString( sOut.makeStringAndClear() ); + rStrm.WriteOString( sOut ); + sOut.setLength(0); Out_String( rStrm, *pSBModule ); sOut.append('\"'); } sOut.append('>'); - rStrm.WriteOString( sOut.makeStringAndClear() ); + rStrm.WriteOString( sOut ); + sOut.setLength(0); if( !rSource.empty() || pSBLibrary || pSBModule ) { @@ -831,14 +842,16 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, { sOut.append("' " OOO_STRING_SVTOOLS_HTML_SB_library " " + OUStringToOString(*pSBLibrary, RTL_TEXTENCODING_UTF8)); - rStrm.WriteOString( sOut.makeStringAndClear() ).WriteCharPtr( SAL_NEWLINE_STRING ); + rStrm.WriteOString( sOut ).WriteCharPtr( SAL_NEWLINE_STRING ); + sOut.setLength(0); } if( pSBModule ) { sOut.append("' " OOO_STRING_SVTOOLS_HTML_SB_module " " + OUStringToOString(*pSBModule, RTL_TEXTENCODING_UTF8)); - rStrm.WriteOString( sOut.makeStringAndClear() ).WriteCharPtr( SAL_NEWLINE_STRING ); + rStrm.WriteOString( sOut ).WriteCharPtr( SAL_NEWLINE_STRING ); + sOut.setLength(0); } } @@ -974,7 +987,7 @@ void HtmlWriterHelper::applyColor(HtmlWriter& rHtmlWriter, std::string_view aAtt sBuffer.append(sStringStream.str().c_str()); } - rHtmlWriter.attribute(aAttributeName, sBuffer.makeStringAndClear()); + rHtmlWriter.attribute(aAttributeName, sBuffer); } diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index d29027449181..0ac10578981c 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -1140,7 +1140,8 @@ HtmlTokenId HTMLParser::GetNextToken_() if( !bDone ) nNextCh = GetNextChar(); } - aToken = sTmpBuffer.makeStringAndClear(); + aToken = sTmpBuffer; + sTmpBuffer.setLength(0); if( !bDone && IsParserWorking() && nCStreamPos ) { rInput.Seek( nCStreamPos ); @@ -1246,7 +1247,8 @@ HtmlTokenId HTMLParser::GetNextToken_() nRet = HtmlTokenId::TEXTTOKEN; break; } - aToken = aTmpBuffer.makeStringAndClear(); + aToken = aTmpBuffer; + aTmpBuffer.setLength(0); if( IsParserWorking() ) { sSaveToken = aToken; @@ -1608,7 +1610,7 @@ HtmlTokenId HTMLParser::FilterPRE( HtmlTokenId nToken ) { using comphelper::string::padToLength; OUStringBuffer aBuf(aToken); - aToken = padToLength(aBuf, nSpaces, ' ').makeStringAndClear(); + aToken = padToLength(aBuf, nSpaces, ' '); } nPre_LinePos += nSpaces; nToken = HtmlTokenId::TEXTTOKEN; diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx index 24272800f49c..8f55ae448d44 100644 --- a/svtools/source/svrtf/parrtf.cxx +++ b/svtools/source/svrtf/parrtf.cxx @@ -342,7 +342,10 @@ void SvRTFParser::ScanText() if (next>0xFF) // fix for #i43933# and #i35653# { if (!aByteString.isEmpty()) - aToken.append( OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()) ); + { + aToken.append( OStringToOUString(aByteString, GetSrcEncoding()) ); + aByteString.setLength(0); + } aToken.append(static_cast<sal_Unicode>(next)); continue; @@ -383,7 +386,10 @@ void SvRTFParser::ScanText() bNextCh = false; if (!aByteString.isEmpty()) - aToken.append( OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()) ); + { + aToken.append( OStringToOUString(aByteString, GetSrcEncoding()) ); + aByteString.setLength(0); + } } break; case '\\': |