elide some makeStringAndClear() calls

Change-Id: I3b80d0f5b6d39c071242bc6ccc1e4333886c835d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137309
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2022-07-21 18:49:47 +02:00 committed by Noel Grandin
parent e7cc97d1e9
commit e7903c01b1
9 changed files with 32 additions and 27 deletions

View file

@ -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

View file

@ -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 );
}
}

View file

@ -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 );

View file

@ -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 );
}

View file

@ -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);

View file

@ -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);

View file

@ -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: */

View file

@ -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);
}
}

View file

@ -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()