sc/source/core/tool/compiler.cxx | 5 ++-- sc/source/core/tool/interpr2.cxx | 4 +-- sc/source/core/tool/interpr7.cxx | 2 - sc/source/core/tool/reffind.cxx | 2 - sc/source/core/tool/webservicelink.cxx | 2 - sc/source/filter/dif/difexp.cxx | 26 +++++++++++++++------- sc/source/filter/excel/xehelper.cxx | 3 +- sc/source/filter/oox/pagesettings.cxx | 3 +- sc/source/filter/xml/XMLTrackedChangesContext.cxx | 4 +-- sc/source/ui/app/inputhdl.cxx | 2 - sc/source/ui/docshell/docsh.cxx | 2 - sc/source/ui/miscdlgs/crnrdlg.cxx | 4 +-- sc/source/ui/view/output2.cxx | 2 - 13 files changed, 37 insertions(+), 24 deletions(-)
New commits: commit e0b72bea05ae685fb0e91b90d2fd319bfd6f4c21 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Jun 3 08:46:09 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Jun 3 10:11:38 2022 +0200 elide some makeStringAndClear() class when we are passing the result to a string_view, it is pointless. Change-Id: I5af990cbe1a8f2d5b19fea9a031d7d64aeba1c37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135329 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index cd050ef794a4..34accc2593df 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4249,7 +4249,8 @@ void ScCompiler::AutoCorrectParsedSymbol() else nRefs--; } - aSymbol = aSym.makeStringAndClear() + aTmp1; + aSymbol = aSym + aTmp1; + aSym.setLength(0); } else bColons = false; @@ -4286,7 +4287,7 @@ void ScCompiler::AutoCorrectParsedSymbol() while ( *p && rtl::isAsciiDigit( *p ) ) aStr2.append(*p++); aRef[j] = OUString( p ); - aRef[j] += aStr2.makeStringAndClear(); + aRef[j] += aStr2; if ( bColons || aRef[j] != aOld ) { bChanged = true; diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index fda54fcf898f..31c42a4b728a 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -3463,7 +3463,7 @@ void ScInterpreter::ScBahtText() if( fBaht > 0.0 ) aBlock.insert( 0, UTF8_TH_1E6 ); - aText.insert(0, aBlock.makeStringAndClear()); + aText.insert(0, aBlock); } if (!aText.isEmpty()) aText.append( UTF8_TH_BAHT ); @@ -3483,7 +3483,7 @@ void ScInterpreter::ScBahtText() if( bMinus ) aText.insert( 0, UTF8_TH_MINUS ); - PushString( OStringToOUString(aText.makeStringAndClear(), RTL_TEXTENCODING_UTF8) ); + PushString( OStringToOUString(aText, RTL_TEXTENCODING_UTF8) ); } void ScInterpreter::ScGetPivotData() diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx index 7b2a7a7a563a..315afed32284 100644 --- a/sc/source/core/tool/interpr7.cxx +++ b/sc/source/core/tool/interpr7.cxx @@ -444,7 +444,7 @@ void ScInterpreter::ScEncodeURL() aUrlBuf.append(convertedChar); } } - PushString( OUString::fromUtf8( aUrlBuf.makeStringAndClear() ) ); + PushString( OUString::fromUtf8( aUrlBuf ) ); } void ScInterpreter::ScDebugVar() diff --git a/sc/source/core/tool/reffind.cxx b/sc/source/core/tool/reffind.cxx index 00df3e2fdb5d..1d930dadf554 100644 --- a/sc/source/core/tool/reffind.cxx +++ b/sc/source/core/tool/reffind.cxx @@ -324,7 +324,7 @@ void ScRefFinder::ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos ) nLoopStart = nEEnd; } - OUString aTotal = maFormula.subView(0, nStartPos) + aResult.makeStringAndClear(); + OUString aTotal = maFormula.subView(0, nStartPos) + aResult; if (nEndPos < maFormula.getLength()-1) aTotal += maFormula.subView(nEndPos+1); diff --git a/sc/source/core/tool/webservicelink.cxx b/sc/source/core/tool/webservicelink.cxx index 12fe4785ebca..9bd14de22092 100644 --- a/sc/source/core/tool/webservicelink.cxx +++ b/sc/source/core/tool/webservicelink.cxx @@ -66,7 +66,7 @@ sfx2::SvBaseLink::UpdateResult ScWebServiceLink::DataChanged(const OUString&, co xStream->closeInput(); - aResult = OStringToOUString(aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8); + aResult = OStringToOUString(aBuffer, RTL_TEXTENCODING_UTF8); bHasResult = true; // Something happened... diff --git a/sc/source/filter/dif/difexp.cxx b/sc/source/filter/dif/difexp.cxx index 4e5984f9e943..89bafd754114 100644 --- a/sc/source/filter/dif/difexp.cxx +++ b/sc/source/filter/dif/difexp.cxx @@ -111,7 +111,8 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc, pDoc->GetName( nTab, aString ); aOS.append(aString); aOS.append("\"\n"); - rOut.WriteUnicodeOrByteText(aOS.makeStringAndClear()); + rOut.WriteUnicodeOrByteText(aOS); + aOS.setLength(0); // VECTORS aOS.append(pKeyVECTORS); @@ -119,7 +120,8 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc, aOS.append(static_cast<sal_Int32>(nNumCols)); aOS.append('\n'); aOS.append(p2DoubleQuotes_LF); - rOut.WriteUnicodeOrByteText(aOS.makeStringAndClear()); + rOut.WriteUnicodeOrByteText(aOS); + aOS.setLength(0); // TUPLES aOS.append(pKeyTUPLES); @@ -127,13 +129,15 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc, aOS.append(static_cast<sal_Int32>(nNumRows)); aOS.append('\n'); aOS.append(p2DoubleQuotes_LF); - rOut.WriteUnicodeOrByteText(aOS.makeStringAndClear()); + rOut.WriteUnicodeOrByteText(aOS); + aOS.setLength(0); // DATA aOS.append(pKeyDATA); aOS.append("\n0,0\n"); aOS.append(p2DoubleQuotes_LF); - rOut.WriteUnicodeOrByteText(aOS.makeStringAndClear()); + rOut.WriteUnicodeOrByteText(aOS); + aOS.setLength(0); SCCOL nColCnt; SCROW nRowCnt; @@ -144,7 +148,8 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc, aOS.append(pSpecDataType_LF); aOS.append(pKeyBOT); aOS.append('\n'); - rOut.WriteUnicodeOrByteText(aOS.makeStringAndClear()); + rOut.WriteUnicodeOrByteText(aOS); + aOS.setLength(0); for( nColCnt = rRange.aStart.Col() ; nColCnt <= nEndCol ; nColCnt++ ) { assert( aOS.isEmpty() && "aOS should be empty"); @@ -188,7 +193,10 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc, } if ( !bWriteStringData ) - rOut.WriteUnicodeOrByteText(aOS.makeStringAndClear()); + { + rOut.WriteUnicodeOrByteText(aOS); + aOS.setLength(0); + } else { // for an explanation why this complicated, see @@ -198,7 +206,8 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc, assert( aOS.isEmpty() && "aOS should be empty"); OUString aTmpStr = aString; aOS.append(pStringData); - rOut.WriteUnicodeOrByteText(aOS.makeStringAndClear(), eCharSet); + rOut.WriteUnicodeOrByteText(aOS, eCharSet); + aOS.setLength(0); if ( eCharSet == RTL_TEXTENCODING_UNICODE ) { sal_Int32 nPos = aTmpStr.indexOf( cStrDelim ); @@ -260,7 +269,8 @@ void ScFormatFilterPluginImpl::ScExportDif( SvStream& rOut, ScDocument* pDoc, aOS.append(pSpecDataType_LF); aOS.append(pKeyEOD); aOS.append('\n'); - rOut.WriteUnicodeOrByteText(aOS.makeStringAndClear()); + rOut.WriteUnicodeOrByteText(aOS); + aOS.setLength(0); // restore original value rOut.SetStreamCharSet( eStreamCharSet ); diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index eaa196eac5e9..038ec8f71c4e 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -863,7 +863,8 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico aSel.nStartPos = aSel.nEndPos; } - aText = ScGlobal::addToken( aText, aParaText.makeStringAndClear(), '\n' ); + aText = ScGlobal::addToken( aText, aParaText, '\n' ); + aParaText.setLength(0); if( nParaHeight == 0 ) nParaHeight = aFontData.mnHeight * 20; // points -> twips nHeight += nParaHeight; diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx index 9c923d51a57b..28cf7c742000 100644 --- a/sc/source/filter/oox/pagesettings.cxx +++ b/sc/source/filter/oox/pagesettings.cxx @@ -686,7 +686,8 @@ double HeaderFooterParser::parse( const Reference<sheet::XHeaderFooterContent>& case '\"': setAttributes(); convertFontName( aFontName.makeStringAndClear() ); - convertFontStyle( aFontStyle.makeStringAndClear() ); + convertFontStyle( aFontStyle ); + aFontStyle.setLength(0); eState = STATE_TEXT; break; default: diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx index 9bc4a132da6b..b3dfb353c068 100644 --- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx +++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx @@ -431,8 +431,8 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > ScXMLChangeInfoContext void SAL_CALL ScXMLChangeInfoContext::endFastElement( sal_Int32 /*nElement*/ ) { aInfo.sUser = sAuthorBuffer.makeStringAndClear(); - ::sax::Converter::parseDateTime(aInfo.aDateTime, - sDateTimeBuffer.makeStringAndClear()); + ::sax::Converter::parseDateTime(aInfo.aDateTime, sDateTimeBuffer); + sDateTimeBuffer.setLength(0); aInfo.sComment = sCommentBuffer.makeStringAndClear(); pChangeTrackingImportHelper->SetActionInfo(aInfo); } diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 3cd4c3cfaebf..4ae9f923b09e 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1505,7 +1505,7 @@ void ScInputHandler::ShowFuncList( const ::std::vector< OUString > & rFuncStrVec { OUString aMessage( ScResId( STR_FUNCTIONS_FOUND ) ); aMessage = aMessage.replaceFirst("%2", OUString::number(nRemainNumber)); - aMessage = aMessage.replaceFirst("%1", aTipStr.makeStringAndClear()); + aMessage = aMessage.replaceFirst("%1", aTipStr); aTipStr = aMessage; } FormulaHelper aHelper(ScGlobal::GetStarCalcFunctionMgr()); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 827958de5858..e46c3df81742 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -318,7 +318,7 @@ void ScDocShell::AfterXMLLoading(bool bRet) if( *pNameBuffer == SC_COMPILER_FILE_TAB_SEP ) // after the last quote of the docname should be the # char { sal_Int32 nIndex = nNameLength - nLinkTabNameLength; - INetURLObject aINetURLObject(aDocURLBuffer.makeStringAndClear()); + INetURLObject aINetURLObject(aDocURLBuffer); if(aName.match( aLinkTabName, nIndex) && (aName[nIndex - 1] == '#') && // before the table name should be the # char !aINetURLObject.HasError()) // the docname should be a valid URL diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index 980b92161c87..38a0cfe668d6 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -388,7 +388,7 @@ void ScColRowNameRangesDlg::UpdateNames() strShow.append("]"); //@008 Add string to listbox - OUString aInsStr = aString + strShow.makeStringAndClear(); + OUString aInsStr = aString + strShow; aRangeMap.emplace( aInsStr, aRange ); m_xLbRange->append(OUString::number(nEntryDataCol), aInsStr); } @@ -425,7 +425,7 @@ void ScColRowNameRangesDlg::UpdateNames() } strShow.append("]"); - OUString aInsStr = aString + strShow.makeStringAndClear(); + OUString aInsStr = aString + strShow; aRangeMap.emplace( aInsStr, aRange ); m_xLbRange->append(OUString::number(nEntryDataRow), aInsStr); } diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 55291b388514..cdd9329d3fcb 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -594,7 +594,7 @@ void ScDrawStringsVars::RepeatToFill( tools::Long nColWidth ) sal_Int32 nCharsToInsert = nSpaceToFill / nCharWidth; OUStringBuffer aFill(nCharsToInsert); comphelper::string::padToLength(aFill, nCharsToInsert, nRepeatChar); - aString = aString.replaceAt( nRepeatPos, 0, aFill.makeStringAndClear() ); + aString = aString.replaceAt( nRepeatPos, 0, aFill ); TextChanged(); }