basctl/source/basicide/baside2b.cxx                               |    8 +--
 chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx      |    2 
 chart2/source/tools/PolynomialRegressionCurveCalculator.cxx       |    2 
 comphelper/source/misc/docpasswordhelper.cxx                      |    2 
 dbaccess/source/core/api/OptimisticSet.cxx                        |   14 +++---
 dbaccess/source/core/recovery/settingsimport.cxx                  |    4 -
 desktop/source/app/crashreport.cxx                                |    2 
 desktop/source/migration/migration.cxx                            |    2 
 filter/source/xsltfilter/OleHandler.cxx                           |    4 -
 i18npool/source/characterclassification/cclass_unicode_parser.cxx |    2 
 i18nutil/source/utility/unicode.cxx                               |    2 
 linguistic/source/hyphdsp.cxx                                     |   23 
+++-------
 sc/source/core/tool/calcconfig.cxx                                |    2 
 sc/source/filter/dif/difimp.cxx                                   |    5 --
 sc/source/filter/html/htmlimp.cxx                                 |    7 +--
 sc/source/ui/docshell/docfunc.cxx                                 |    2 
 sc/source/ui/view/editsh.cxx                                      |    5 +-
 sfx2/source/control/emojicontrol.cxx                              |    6 +-
 sfx2/source/control/emojiviewitem.cxx                             |    6 +-
 svl/source/numbers/zforlist.cxx                                   |    4 -
 svl/source/numbers/zformat.cxx                                    |    2 
 sw/source/core/crsr/crstrvl.cxx                                   |    2 
 tools/source/fsys/urlobj.cxx                                      |    4 -
 vcl/source/control/edit.cxx                                       |   10 ++--
 vcl/source/control/field2.cxx                                     |   12 +++--
 xmloff/source/draw/ximpcustomshape.cxx                            |    2 
 xmloff/source/style/xmlnumfi.cxx                                  |    5 --
 27 files changed, 69 insertions(+), 72 deletions(-)

New commits:
commit a23a7eea5cfcdc50d09be248828cb1e6293e5ebb
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sun Dec 26 10:03:40 2021 +0100
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sun Dec 26 20:36:26 2021 +0100

    Avoid OUStringBuffer::toString where possible
    
    Change-Id: I99abbe97a48b2077e28d6221fb70036e5e412657
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127479
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/basctl/source/basicide/baside2b.cxx 
b/basctl/source/basicide/baside2b.cxx
index 54be8d956b64..9671d149ca2b 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -2591,7 +2591,7 @@ void CodeCompleteWindow::SetMatchingEntries()
     for (sal_Int32 i = 0, nEntryCount = m_xListBox->n_children(); i< 
nEntryCount; ++i)
     {
         OUString sEntry = m_xListBox->get_text(i);
-        if (sEntry.startsWithIgnoreAsciiCase(aFuncBuffer.toString()))
+        if (sEntry.startsWithIgnoreAsciiCase(aFuncBuffer))
         {
             m_xListBox->select(i);
             break;
@@ -2657,8 +2657,8 @@ bool CodeCompleteWindow::HandleKeyInput( const KeyEvent& 
rKeyEvt )
                         for (sal_Int32 i = nInd; i != nEntryCount; ++i)
                         {
                             OUString sEntry = m_xListBox->get_text(i);
-                            if( sEntry.startsWithIgnoreAsciiCase( 
aFuncBuffer.toString() )
-                                && (aFuncBuffer.toString() != sTypedText) && 
(i != nInd) )
+                            if( sEntry.startsWithIgnoreAsciiCase( aFuncBuffer )
+                                && (std::u16string_view(aFuncBuffer) != 
sTypedText) && (i != nInd) )
                             {
                                 m_xListBox->select(i);
                                 bFound = true;
@@ -2688,7 +2688,7 @@ bool CodeCompleteWindow::HandleKeyInput( const KeyEvent& 
rKeyEvt )
                     OUString aTabInsertedStr( 
GetParentEditView()->GetSelected() );
                     GetParentEditView()->SetSelection( aSel );
 
-                    if( !aTabInsertedStr.isEmpty() && aTabInsertedStr != 
aFuncBuffer.toString() )
+                    if( !aTabInsertedStr.isEmpty() && aTabInsertedStr != 
std::u16string_view(aFuncBuffer) )
                     {
                         aFuncBuffer = aTabInsertedStr;
                     }
diff --git a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx 
b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
index 58b0a66da1d1..ffd1808dfd22 100644
--- a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
@@ -175,7 +175,7 @@ OUString 
LogarithmicRegressionCurveCalculator::ImplGetRepresentation(
         addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth );
     }
 
-    if ( aBuf.toString() == OUStringConcatenation(mYName + " = ") )
+    if ( std::u16string_view(aBuf) == OUStringConcatenation(mYName + " = ") )
         aBuf.append( "0" );
 
     return aBuf.makeStringAndClear();
diff --git a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx 
b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
index 2c2e6be4b5bf..3d7f1c07601b 100644
--- a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
@@ -381,7 +381,7 @@ OUString 
PolynomialRegressionCurveCalculator::ImplGetRepresentation(
         }
         addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth );
     }
-    if ( aBuf.toString() == OUStringConcatenation( mYName + " = ") )
+    if ( std::u16string_view(aBuf) == OUStringConcatenation( mYName + " = ") )
         aBuf.append( "0" );
 
     return aBuf.makeStringAndClear();
diff --git a/comphelper/source/misc/docpasswordhelper.cxx 
b/comphelper/source/misc/docpasswordhelper.cxx
index 71f92db48d00..a31f829ddfa9 100644
--- a/comphelper/source/misc/docpasswordhelper.cxx
+++ b/comphelper/source/misc/docpasswordhelper.cxx
@@ -114,7 +114,7 @@ 
DocPasswordHelper::GenerateNewModifyPasswordInfoOOXML(std::u16string_view aPassw
     uno::Sequence<sal_Int8> aSalt = GenerateRandomByteSequence(16);
     OUStringBuffer aBuffer;
     comphelper::Base64::encode(aBuffer, aSalt);
-    OUString sSalt = aBuffer.toString();
+    OUString sSalt = aBuffer.makeStringAndClear();
 
     sal_Int32 const nIterationCount = 100000;
     OUString sAlgorithm("SHA-512");
diff --git a/dbaccess/source/core/api/OptimisticSet.cxx 
b/dbaccess/source/core/api/OptimisticSet.cxx
index c214402f50c5..a95384eed2b7 100644
--- a/dbaccess/source/core/api/OptimisticSet.cxx
+++ b/dbaccess/source/core/api/OptimisticSet.cxx
@@ -208,7 +208,7 @@ void OptimisticSet::updateRow(const ORowSetRow& _rInsertRow 
,const ORowSetRow& _
             OUString sCatalog,sSchema,sTable;
             
::dbtools::qualifiedNameComponents(xMetaData,elem.first,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
             OUStringBuffer sSql("UPDATE " + 
::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable 
) +
-                                       " SET " + elem.second.toString());
+                                       " SET " + elem.second);
             OUStringBuffer& rCondition = aKeyConditions[elem.first];
             if ( !rCondition.isEmpty() )
                 sSql.append(" WHERE " + rCondition );
@@ -266,14 +266,14 @@ void OptimisticSet::insertRow( const ORowSetRow& 
_rInsertRow,const connectivity:
             OUString sCatalog,sSchema,sTable;
             
::dbtools::qualifiedNameComponents(xMetaData,elem.first,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
             OUString sComposedTableName = 
::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable 
);
-            OUString sSql("INSERT INTO " + sComposedTableName + " ( " + 
elem.second.toString() +
-                                 ") VALUES ( " + 
aParameter[elem.first].toString() + " )");
+            OUString sSql("INSERT INTO " + sComposedTableName + " ( " + 
elem.second +
+                                 ") VALUES ( " + aParameter[elem.first] + " 
)");
 
             OUStringBuffer& rCondition = aKeyConditions[elem.first];
             if ( !rCondition.isEmpty() )
             {
-                OUString sQuery("SELECT " + elem.second.toString() + " FROM " 
+ sComposedTableName +
-                                       " WHERE " + rCondition.toString());
+                OUString sQuery("SELECT " + elem.second + " FROM " + 
sComposedTableName +
+                                       " WHERE " + rCondition);
 
                 try
                 {
@@ -330,7 +330,7 @@ void OptimisticSet::deleteRow(const ORowSetRow& 
_rDeleteRow,const connectivity::
             OUString sCatalog,sSchema,sTable;
             
::dbtools::qualifiedNameComponents(xMetaData,keyCondition.first,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
             OUString sSql("DELETE FROM " + 
::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable 
) +
-                                 " WHERE " + rCondition.toString() );
+                                 " WHERE " + rCondition );
             executeDelete(_rDeleteRow, sSql, keyCondition.first);
         }
     }
@@ -544,7 +544,7 @@ void 
OptimisticSet::fillMissingValues(ORowSetValueVector::Vector& io_aRow) const
                 OUString sCatalog,sSchema,sTable;
                 
::dbtools::qualifiedNameComponents(xMetaData,elem.first,sCatalog,sSchema,sTable,::dbtools::EComposeRule::InDataManipulation);
                 OUString sComposedTableName = 
::dbtools::composeTableNameForSelect( m_xConnection, sCatalog, sSchema, sTable 
);
-                OUString sQuery("SELECT " + elem.second.toString() + " FROM " 
+ sComposedTableName + " WHERE " +
+                OUString sQuery("SELECT " + elem.second + " FROM " + 
sComposedTableName + " WHERE " +
                                        rCondition.makeStringAndClear());
 
                 try
diff --git a/dbaccess/source/core/recovery/settingsimport.cxx 
b/dbaccess/source/core/recovery/settingsimport.cxx
index 2353202681c4..821dea04517b 100644
--- a/dbaccess/source/core/recovery/settingsimport.cxx
+++ b/dbaccess/source/core/recovery/settingsimport.cxx
@@ -139,7 +139,7 @@ namespace dbaccess
         o_rValue.clear();
 
         // the characters building up th evalue
-        const OUString sValue = getAccumulatedCharacters().toString();
+        std::u16string_view sValue = getAccumulatedCharacters();
 
         const OUString& rItemType( getItemType() );
         ENSURE_OR_RETURN_VOID( !rItemType.isEmpty(), "no item type -> no item 
value" );
@@ -170,7 +170,7 @@ namespace dbaccess
         }
         else if ( ::xmloff::token::IsXMLToken( rItemType, 
::xmloff::token::XML_STRING ) )
         {
-            o_rValue <<= sValue;
+            o_rValue <<= OUString(sValue);
         }
         else
         {
diff --git a/desktop/source/app/crashreport.cxx 
b/desktop/source/app/crashreport.cxx
index 7d70c9603d9a..a14527c621e2 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -202,7 +202,7 @@ OUString CrashReporter::getLoggedUnoCommands()
         aUnoCommandBuffer.append(unocommand);
         aCommandSeperator=",";
     }
-    return aUnoCommandBuffer.toString();
+    return aUnoCommandBuffer.makeStringAndClear();
 }
 
 namespace {
diff --git a/desktop/source/migration/migration.cxx 
b/desktop/source/migration/migration.cxx
index c846eaa673fd..7d3b272973be 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -670,7 +670,7 @@ void MigrationImpl::copyConfig()
                     buf.append(enc);
                 } while (n >= 0);
                 buf.append(".xcu");
-                regFilePath = buf.toString();
+                regFilePath = buf.makeStringAndClear();
             }
             configuration::Update::get(
                 comphelper::getProcessComponentContext())->
diff --git a/filter/source/xsltfilter/OleHandler.cxx 
b/filter/source/xsltfilter/OleHandler.cxx
index 12aff3bcc7c2..3ec4b56fb30e 100644
--- a/filter/source/xsltfilter/OleHandler.cxx
+++ b/filter/source/xsltfilter/OleHandler.cxx
@@ -127,7 +127,7 @@ namespace XSLT
         //return the base64 string of the uncompressed data
         OUStringBuffer buf(oleLength);
         ::comphelper::Base64::encode(buf, result);
-        return OUStringToOString(buf.toString(), RTL_TEXTENCODING_UTF8);
+        return OUStringToOString(buf.makeStringAndClear(), 
RTL_TEXTENCODING_ASCII_US);
     }
 
     void
@@ -160,7 +160,7 @@ namespace XSLT
             //return the base64 encoded string
             OUStringBuffer buf(oleLength);
             ::comphelper::Base64::encode(buf, oledata);
-            return OUStringToOString(buf.toString(), RTL_TEXTENCODING_UTF8);
+            return OUStringToOString(buf.makeStringAndClear(), 
RTL_TEXTENCODING_ASCII_US);
         }
         return encodeSubStorage(streamName);
     }
diff --git a/i18npool/source/characterclassification/cclass_unicode_parser.cxx 
b/i18npool/source/characterclassification/cclass_unicode_parser.cxx
index c5637e8ae876..59f10339b5d3 100644
--- a/i18npool/source/characterclassification/cclass_unicode_parser.cxx
+++ b/i18npool/source/characterclassification/cclass_unicode_parser.cxx
@@ -1057,7 +1057,7 @@ void cclass_Unicode::parseText( ParseResult& r, const 
OUString& rText, sal_Int32
             aSymbol.append(rText.subView(postSymbolIndex, nextCharIndex - 
postSymbolIndex - 1));
             r.TokenType |= KParseType::MISSING_QUOTE;
         }
-        r.DequotedNameOrString = aSymbol.toString();
+        r.DequotedNameOrString = aSymbol.makeStringAndClear();
     }
 }
 
diff --git a/i18nutil/source/utility/unicode.cxx 
b/i18nutil/source/utility/unicode.cxx
index b4e3640d3d71..be34ea58f44a 100644
--- a/i18nutil/source/utility/unicode.cxx
+++ b/i18nutil/source/utility/unicode.cxx
@@ -1085,7 +1085,7 @@ OUString ToggleUnicodeCodepoint::ReplacementString()
             output.append( aTmp );
         }
     }
-    return output.toString();
+    return output.makeStringAndClear();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index 4036d0c2d5b0..17c0bff0e872 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -21,6 +21,9 @@
 #include <sal/log.hxx>
 
 #include <algorithm>
+#if OSL_DEBUG_LEVEL > 0
+#include <utility>
+#endif
 
 #include <cppuhelper/factory.hxx>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -123,23 +126,15 @@ Reference<XHyphenatedWord>  
HyphenatorDispatcher::buildHyphWord(
             {
 #if OSL_DEBUG_LEVEL > 0
                 {
-                    if (aTmp.toString() != rOrigWord)
+                    if (std::u16string_view(aTmp) != rOrigWord)
                     {
                         // both words should only differ by a having a 
trailing '.'
                         // character or not...
-                        OUString aShorter, aLonger;
-                        if (aTmp.getLength() <= rOrigWord.getLength())
-                        {
-                            aShorter = aTmp.toString();
-                            aLonger  = rOrigWord;
-                        }
-                        else
-                        {
-                            aShorter = rOrigWord;
-                            aLonger  = aTmp.toString();
-                        }
-                        sal_Int32 nS = aShorter.getLength();
-                        sal_Int32 nL = aLonger.getLength();
+                        std::u16string_view aShorter(aTmp), aLonger(rOrigWord);
+                        if (aTmp.getLength() > rOrigWord.getLength())
+                            std::swap(aShorter, aLonger);
+                        sal_Int32 nS = aShorter.size();
+                        sal_Int32 nL = aLonger.size();
                         if (nS > 0 && nL > 0)
                         {
                             assert( ((nS + 1 == nL) && aLonger[nL-1] == '.') 
&& "HyphenatorDispatcher::buildHyphWord: unexpected difference between words!" 
);
diff --git a/sc/source/core/tool/calcconfig.cxx 
b/sc/source/core/tool/calcconfig.cxx
index 2b0ff8c2e19e..adb51efdf1ff 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -199,7 +199,7 @@ OUString ScOpCodeSetToSymbolicString(const 
ScCalcConfig::OpCodeSet& rOpCodes)
         result.append(pOpCodeMap->getSymbol(*i));
     }
 
-    return result.toString();
+    return result.makeStringAndClear();
 }
 
 ScCalcConfig::OpCodeSet ScStringToOpCodeSet(std::u16string_view rOpCodes)
diff --git a/sc/source/filter/dif/difimp.cxx b/sc/source/filter/dif/difimp.cxx
index 5f7178b9fe8a..ed222fdb5852 100644
--- a/sc/source/filter/dif/difimp.cxx
+++ b/sc/source/filter/dif/difimp.cxx
@@ -129,6 +129,7 @@ ErrCode ScFormatFilterPluginImpl::ScImportDif(SvStream& 
rIn, ScDocument* pDoc, c
 
         ScSetStringParam aStrParam; // used to set string value without number 
detection.
         aStrParam.setTextInput();
+        const OUString aData = rData.makeStringAndClear();
 
         while( eCurrent != D_EOD )
         {
@@ -137,8 +138,6 @@ ErrCode ScFormatFilterPluginImpl::ScImportDif(SvStream& 
rIn, ScDocument* pDoc, c
             aPrgrsBar.Progress();
             ScAddress aPos(nColCnt, nRowCnt, nBaseTab);
 
-            OUString aData = rData.toString();
-
             switch( eCurrent )
             {
                 case D_BOT:
@@ -391,7 +390,7 @@ static void lcl_DeEscapeQuotesDif(OUStringBuffer& rString)
     //  escape quotes in strings (and Excel doesn't when using the clipboard).
     //  The quotes around the string are removed before this function is 
called.
 
-    rString = rString.toString().replaceAll("\"\"", "\"");
+    rString = rString.makeStringAndClear().replaceAll("\"\"", "\"");
 }
 
 // Determine if passed in string is numeric data and set fVal/nNumFormat if so
diff --git a/sc/source/filter/html/htmlimp.cxx 
b/sc/source/filter/html/htmlimp.cxx
index 5e1af28b04d9..57b92e0d5ef9 100644
--- a/sc/source/filter/html/htmlimp.cxx
+++ b/sc/source/filter/html/htmlimp.cxx
@@ -188,10 +188,9 @@ void ScHTMLImport::WriteToDocument(
         // insert table caption as name
         if (!pTable->GetTableCaption().isEmpty())
             aName.append(" - " + pTable->GetTableCaption());
-        if (!mpDoc->GetRangeName()->findByUpperName(
-                ScGlobal::getCharClass().uppercase(aName.toString())))
-            InsertRangeName(*mpDoc, aName.toString(), aNewRange);
-
+        const OUString sName(aName.makeStringAndClear());
+        if 
(!mpDoc->GetRangeName()->findByUpperName(ScGlobal::getCharClass().uppercase(sName)))
+            InsertRangeName(*mpDoc, sName, aNewRange);
     }
 }
 
diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index 31b49b1faf4f..be6f7178f094 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5428,7 +5428,7 @@ bool ScDocFunc::InsertNameList( const ScAddress& 
rStartPos, bool bApi )
                 pData->GetName(aName);
                 // adjust relative references to the left column in 
Excel-compliant way:
                 pData->UpdateSymbol(aContent, ScAddress( nStartCol, nOutRow, 
nTab ));
-                aFormula = "=" + aContent.toString();
+                aFormula = "=" + aContent;
                 ScSetStringParam aParam;
                 aParam.setTextInput();
                 rDoc.SetString(ScAddress(nStartCol,nOutRow,nTab), aName, 
&aParam);
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index c75739ed79df..9d7cc3351c6e 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -483,9 +483,10 @@ void ScEditShell::Execute( SfxRequest& rReq )
                         {
                             aBuffer.append(rName).append(' ');
                         }
-                        pTableView->InsertText(aBuffer.toString());
+                        const OUString s = aBuffer.makeStringAndClear();
+                        pTableView->InsertText(s);
                         if (pTopView)
-                            pTopView->InsertText(aBuffer.makeStringAndClear());
+                            pTopView->InsertText(s);
                     }
                 }
                 pDlg.disposeAndClear();
diff --git a/sfx2/source/control/emojicontrol.cxx 
b/sfx2/source/control/emojicontrol.cxx
index 63093efc3601..445815a7568f 100644
--- a/sfx2/source/control/emojicontrol.cxx
+++ b/sfx2/source/control/emojicontrol.cxx
@@ -93,10 +93,10 @@ SfxEmojiControl::~SfxEmojiControl()
 
 void SfxEmojiControl::ConvertLabelToUnicode(weld::ToggleButton& rBtn)
 {
-    OUStringBuffer sHexText;
     OUString sLabel = rBtn.get_label();
-    sHexText.appendUtf32(sLabel.toUInt32(16));
-    rBtn.set_label(sHexText.toString());
+    sal_uInt32 nCodePoint = sLabel.toUInt32(16);
+    const OUString sHexText(&nCodePoint, 1);
+    rBtn.set_label(sHexText);
 }
 
 FILTER_CATEGORY SfxEmojiControl::getFilter(const weld::Toggleable& rCurPageId) 
const
diff --git a/sfx2/source/control/emojiviewitem.cxx 
b/sfx2/source/control/emojiviewitem.cxx
index 5b3075e503b7..6d506b198efb 100644
--- a/sfx2/source/control/emojiviewitem.cxx
+++ b/sfx2/source/control/emojiviewitem.cxx
@@ -74,10 +74,10 @@ void 
EmojiViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProcessor
                                                  0.0,
                                                  true));
 
-    OUStringBuffer sHexText = "";
-    sHexText.appendUtf32(maTitle.toUInt32(16));
+    sal_uInt32 nCodePoint = maTitle.toUInt32(16);
+    const OUString sHexText(&nCodePoint, 1);
 
-    addTextPrimitives(sHexText.toString(), pAttrs, maTextPos, aSeq);
+    addTextPrimitives(sHexText, pAttrs, maTextPos, aSeq);
 
     pProcessor->process(aSeq);
 }
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index fbd05a481df9..98f607e6f07a 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -3910,10 +3910,10 @@ bool SvNumberFormatter::GetNewCurrencySymbolString( 
sal_uInt32 nFormat, OUString
     const SvNumberformat* pFormat = GetFormatEntry(nFormat);
     if ( pFormat )
     {
-        OUStringBuffer sBuff(128); // guess-estimate of a value that will 
pretty much guarantee no re-alloc
         OUString aSymbol, aExtension;
         if ( pFormat->GetNewCurrencySymbol( aSymbol, aExtension ) )
         {
+            OUStringBuffer sBuff(128); // guess-estimate of a value that will 
pretty much guarantee no re-alloc
             if ( ppEntry )
             {
                 bool bFoundBank = false;
@@ -3949,7 +3949,7 @@ bool SvNumberFormatter::GetNewCurrencySymbolString( 
sal_uInt32 nFormat, OUString
                 }
                 sBuff.append(']');
             }
-            rStr = sBuff.toString();
+            rStr = sBuff.makeStringAndClear();
             return true;
         }
     }
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 34e439ee4921..4b1e2a48c152 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -5157,7 +5157,7 @@ static void lcl_insertLCID( OUStringBuffer& rFormatStr, 
sal_uInt32 nLCID, sal_In
     }
     aLCIDString.insert( 0, "[$-" );
     aLCIDString.append( "]" );
-    rFormatStr.insert( nPosInsertLCID, aLCIDString.toString() );
+    rFormatStr.insert( nPosInsertLCID, aLCIDString.makeStringAndClear() );
 }
 
 /** Increment nAlphabetID for CJK numerals
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index da22013cc31f..e548b748753c 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1886,7 +1886,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
                     {
                         if( !rContentAtPos.sStr.isEmpty() )
                             rContentAtPos.sStr += "\n";
-                        rContentAtPos.sStr += "Attr: " + sAttrs.toString();
+                        rContentAtPos.sStr += "Attr: " + 
sAttrs.makeStringAndClear();
                     }
                 }
                 bRet = true;
diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx
index 1d08a5590eaa..0ab541147357 100644
--- a/tools/source/fsys/urlobj.cxx
+++ b/tools/source/fsys/urlobj.cxx
@@ -3695,7 +3695,7 @@ bool INetURLObject::operator ==(INetURLObject const & 
rObject) const
     if (m_eScheme != rObject.m_eScheme)
         return false;
     if (m_eScheme == INetProtocol::NotValid)
-        return m_aAbsURIRef.toString() == rObject.m_aAbsURIRef.toString();
+        return std::u16string_view(m_aAbsURIRef) == 
std::u16string_view(rObject.m_aAbsURIRef);
     if ((m_aScheme.compare(
              rObject.m_aScheme, m_aAbsURIRef, rObject.m_aAbsURIRef)
          != 0)
@@ -3904,7 +3904,7 @@ OUString INetURLObject::getExternalURL() const
 {
     OUString aTheExtURIRef;
     translateToExternal(
-        m_aAbsURIRef.toString(), aTheExtURIRef);
+        m_aAbsURIRef, aTheExtURIRef);
     return aTheExtURIRef;
 }
 
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 46d9f67dc240..ceb238feaf52 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -692,12 +692,13 @@ void Edit::ImplDelete( const Selection& rSelection, 
sal_uInt8 nDirection, sal_uI
         {
             if ( nMode == EDIT_DELMODE_RESTOFWORD )
             {
-                i18n::Boundary aBoundary = xBI->getWordBoundary( 
maText.toString(), aSelection.Min(),
+                const OUString sText = maText.toString();
+                i18n::Boundary aBoundary = xBI->getWordBoundary( sText, 
aSelection.Min(),
                         GetSettings().GetLanguageTag().getLocale(), 
i18n::WordType::ANYWORD_IGNOREWHITESPACES, true );
                 auto startPos = aBoundary.startPos;
                 if ( startPos == aSelection.Min() )
                 {
-                    aBoundary = xBI->previousWord( maText.toString(), 
aSelection.Min(),
+                    aBoundary = xBI->previousWord( sText, aSelection.Min(),
                             GetSettings().GetLanguageTag().getLocale(), 
i18n::WordType::ANYWORD_IGNOREWHITESPACES );
                     startPos = std::max(aBoundary.startPos, sal_Int32(0));
                 }
@@ -1561,10 +1562,11 @@ bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
                     {
                         if ( bWord )
                         {
-                            i18n::Boundary aBoundary = xBI->getWordBoundary( 
maText.toString(), aSel.Max(),
+                            const OUString sText = maText.toString();
+                            i18n::Boundary aBoundary = xBI->getWordBoundary( 
sText, aSel.Max(),
                                     
GetSettings().GetLanguageTag().getLocale(), 
i18n::WordType::ANYWORD_IGNOREWHITESPACES, true );
                             if ( aBoundary.startPos == aSel.Max() )
-                                aBoundary = xBI->previousWord( 
maText.toString(), aSel.Max(),
+                                aBoundary = xBI->previousWord( sText, 
aSel.Max(),
                                         
GetSettings().GetLanguageTag().getLocale(), 
i18n::WordType::ANYWORD_IGNOREWHITESPACES );
                             aSel.Max() = aBoundary.startPos;
                         }
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 3af74c6d92b9..f1e24cd2fb6b 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -647,12 +647,13 @@ static bool ImplPatternProcessKeyInput( 
IEditImplementation& rEdit, const KeyEve
                 }
             }
 
-            if ( aOldStr != aStr.toString() )
+            OUString sStr = aStr.makeStringAndClear();
+            if ( aOldStr != sStr )
             {
                 if ( bSameMask )
-                    aStr = ImplPatternReformat( aStr.toString(), rEditMask, 
rLiteralMask, nFormatFlags );
+                    sStr = ImplPatternReformat( sStr, rEditMask, rLiteralMask, 
nFormatFlags );
                 rbInKeyInput = true;
-                rEdit.SetText( aStr.toString(), Selection( nNewPos ) );
+                rEdit.SetText( sStr, Selection( nNewPos ) );
                 rEdit.SetModified();
                 rbInKeyInput = false;
             }
@@ -776,8 +777,9 @@ static bool ImplPatternProcessKeyInput( 
IEditImplementation& rEdit, const KeyEve
         if ( !bError )
         {
             rbInKeyInput = true;
-            Selection aNewSel( ImplPatternRightPos( aStr.toString(), 
rEditMask, nFormatFlags, bSameMask, nNewPos ) );
-            rEdit.SetText( aStr.toString(), aNewSel );
+            const OUString sStr = aStr.makeStringAndClear();
+            Selection aNewSel( ImplPatternRightPos( sStr, rEditMask, 
nFormatFlags, bSameMask, nNewPos ) );
+            rEdit.SetText( sStr, aNewSel );
             rEdit.SetModified();
             rbInKeyInput = false;
         }
diff --git a/xmloff/source/draw/ximpcustomshape.cxx 
b/xmloff/source/draw/ximpcustomshape.cxx
index cf794da63df6..c8dbf70ba143 100644
--- a/xmloff/source/draw/ximpcustomshape.cxx
+++ b/xmloff/source/draw/ximpcustomshape.cxx
@@ -935,7 +935,7 @@ void XMLEnhancedCustomShapeContext::startFastElement(
                             rDepth.Value <<= fDepth;
                         }
                     }
-                    if ( rValue.matchIgnoreAsciiCase( aUnitStr.toString(), 
nIndex ) )
+                    if ( rValue.matchIgnoreAsciiCase( aUnitStr, nIndex ) )
                         nIndex += aUnitStr.getLength();
 
                     // skipping white spaces
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 87f653873904..e4083d3517ba 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -546,8 +546,7 @@ static void lcl_EnquoteIfNecessary( OUStringBuffer& 
rContent, const SvXMLNumForm
         //  the percent character in percentage styles must be left out of 
quoting
         //  (one occurrence is enough even if there are several percent 
characters in the string)
 
-        OUString aString( rContent.toString() );
-        sal_Int32 nPos = aString.indexOf( '%' );
+        sal_Int32 nPos = rContent.indexOf( '%' );
         if ( nPos >= 0 )
         {
             if ( nPos + 1 < nLength )
@@ -861,7 +860,7 @@ void SvXMLNumFmtElementContext::endFastElement(sal_Int32 )
     {
         case SvXMLStyleTokens::Text:
             if ( rParent.HasLongDoW() &&
-                 aContent.toString() == 
rParent.GetLocaleData().getLongDateDayOfWeekSep() )
+                 std::u16string_view(aContent) == 
rParent.GetLocaleData().getLongDateDayOfWeekSep() )
             {
                 //  skip separator constant after long day of week
                 //  (NF_KEY_NNNN contains the separator)

Reply via email to