dbaccess/source/ui/browser/unodatbr.cxx                               |    3 -
 forms/source/xforms/model_ui.cxx                                      |    6 --
 i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx |    2 
 sc/source/ui/xmlsource/xmlsourcedlg.cxx                               |    7 +-
 starmath/source/mathtype.cxx                                          |   12 
+---
 svl/source/numbers/zforlist.cxx                                       |   26 
+++-------
 svx/source/svdraw/svdattr.cxx                                         |    3 -
 xmloff/source/style/xmlnumfi.cxx                                      |    4 -
 8 files changed, 22 insertions(+), 41 deletions(-)

New commits:
commit 13d3ae64dbf2ac4bda8e831c1da890b09024a8bb
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Mar 13 12:51:29 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Mar 13 16:47:32 2023 +0000

    make more use of OUStringBuffer::append(OUStringConcat)
    
    where we can avoid constructing temporary OUStrings
    
    Change-Id: I0eacd68a8d1b450894c2ea769055f16886b78ad0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148780
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/dbaccess/source/ui/browser/unodatbr.cxx 
b/dbaccess/source/ui/browser/unodatbr.cxx
index 0a54ccb4051d..06081b665108 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -2541,8 +2541,7 @@ bool SbaTableQueryBrowser::implSelect(const 
weld::TreeIter* pEntry)
         {
             while (rTreeView.iter_compare(*xNextTemp, *xConnection) != 0)
             {
-                sNameBuffer.insert(0,'/');
-                sNameBuffer.insert(0, rTreeView.get_text(*xTemp));
+                sNameBuffer.insert(0, rTreeView.get_text(*xTemp) + "/");
                 rTreeView.copy_iterator(*xNextTemp, *xTemp);
                 if (!rTreeView.iter_parent(*xNextTemp))
                     break;
diff --git a/forms/source/xforms/model_ui.cxx b/forms/source/xforms/model_ui.cxx
index 616ea8863180..e8208565f4fe 100644
--- a/forms/source/xforms/model_ui.cxx
+++ b/forms/source/xforms/model_ui.cxx
@@ -159,8 +159,7 @@ static void lcl_OutName( OUStringBuffer& rBuffer,
     OUString sPrefix = xNode->getPrefix();
     if( !sPrefix.isEmpty() )
     {
-        rBuffer.insert( 0, ':' );
-        rBuffer.insert( 0, sPrefix );
+        rBuffer.insert( 0, sPrefix + ":" );
     }
 }
 
@@ -194,8 +193,7 @@ static void lcl_OutInstance( OUStringBuffer& rBuffer,
             sInstanceName = sId;
     }
 
-    rBuffer.insert( 0, sInstanceName );
-    rBuffer.insert( 0, "instance('" );
+    rBuffer.insert( 0, "instance('" + sInstanceName );
 }
 
 OUString Model::getDefaultBindingExpressionForNode(
diff --git 
a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx 
b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index 7d807a31ac8d..68e0fe2bb704 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -452,7 +452,7 @@ void lcl_formatPersianWord( sal_Int32 nNumber, OUString& 
rsResult )
         {
             if (nSection > SAL_N_ELEMENTS( table_PersianWord_decadeX))
                 throw IllegalArgumentException();   // does not happen with 
sal_Int32
-            aTemp.insert( 0, asPersianWord_conjunction).insert( 0, 
table_PersianWord_decadeX[nSection-1]);
+            aTemp.insert( 0, table_PersianWord_decadeX[nSection-1] + 
asPersianWord_conjunction );
         }
 
         unsigned int nDigit;
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx 
b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 663db63475d8..f82b693e6073 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -49,11 +49,12 @@ OUString getXPath(
             rNamespaces.push_back(pData->mnNamespaceID);
 
         // element separator is '/' whereas attribute separator is '/@' in 
xpath.
-        aBuf.insert(0, rTree.get_text(*xEntry, 0));
+        std::u16string_view sSeparator;
         if (isAttribute(rTree, *xEntry))
-            aBuf.insert(0, "/@");
+            sSeparator = u"/@";
         else
-            aBuf.insert(0, '/');
+            sSeparator = u"/";
+        aBuf.insert(0, sSeparator + rTree.get_text(*xEntry, 0));
     }
     while (rTree.iter_parent(*xEntry));
 
diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx
index 9273a4498b61..a3199c06c686 100644
--- a/starmath/source/mathtype.cxx
+++ b/starmath/source/mathtype.cxx
@@ -683,8 +683,7 @@ bool MathType::HandleRecords(int nLevel, sal_uInt8 
nSelector,
             {
                 OUString aStr;
                 TypeFaceToString(aStr,nTypeFace);
-                aStr += "\"";
-                rRet.insert(nTextStart,aStr);
+                rRet.insert(nTextStart, aStr + "\"");
                 rRet.append("\"");
             }
             else if (nRecord == END && !rRet.isEmpty())
@@ -2895,8 +2894,7 @@ bool MathType::HandleChar(sal_Int32 &rTextStart, int 
&rSetSize, int nLevel,
             {
                 OUString aStr;
                 TypeFaceToString(aStr,nOldTypeFace);
-                aStr += "\"";
-                rRet.insert(std::min(rTextStart, rRet.getLength()), aStr);
+                rRet.insert(std::min(rTextStart, rRet.getLength()), aStr + 
"\"");
 
                 aStr.clear();
                 TypeFaceToString(aStr,nTypeFace);
@@ -2921,8 +2919,7 @@ bool MathType::HandleChar(sal_Int32 &rTextStart, int 
&rSetSize, int nLevel,
                 rRet.insert(nOldLen, "\"");
                 OUString aStr;
                 TypeFaceToString(aStr,nOldTypeFace);
-                aStr += "\"";
-                rRet.insert(rTextStart,aStr);
+                rRet.insert(rTextStart, aStr + "\"");
             }
             rTextStart = rRet.getLength();
         }
@@ -2934,8 +2931,7 @@ bool MathType::HandleChar(sal_Int32 &rTextStart, int 
&rSetSize, int nLevel,
                 rRet.insert(nOldLen, "\"");
                 OUString aStr;
                 TypeFaceToString(aStr,nOldTypeFace);
-                aStr += "\"";
-                rRet.insert(rTextStart, aStr);
+                rRet.insert(rTextStart, aStr + "\"");
             }
             rTextStart = rRet.getLength();
         }
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 53914a0266cd..b9055a63d2fc 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -4596,8 +4596,7 @@ void 
NfCurrencyEntry::CompletePositiveFormatString(OUStringBuffer& rStr, std::u1
         break;
         case 2:                                         // $ 1
         {
-            rStr.insert(0, ' ');
-            rStr.insert(0, rSymStr);
+            rStr.insert(0, OUString::Concat(rSymStr) + " ");
         }
         break;
         case 3:                                         // 1 $
@@ -4622,21 +4621,18 @@ void 
NfCurrencyEntry::CompleteNegativeFormatString(OUStringBuffer& rStr,
     {
         case 0:                                         // ($1)
         {
-            rStr.insert(0, rSymStr);
-            rStr.insert(0, '(');
+            rStr.insert(0, OUString::Concat("(") + rSymStr);
             rStr.append(')');
         }
         break;
         case 1:                                         // -$1
         {
-            rStr.insert(0, rSymStr);
-            rStr.insert(0, '-');
+            rStr.insert(0, OUString::Concat("-") + rSymStr);
         }
         break;
         case 2:                                         // $-1
         {
-            rStr.insert(0, '-');
-            rStr.insert(0, rSymStr);
+            rStr.insert(0, OUString::Concat(rSymStr) + "-");
         }
         break;
         case 3:                                         // $1-
@@ -4679,9 +4675,7 @@ void 
NfCurrencyEntry::CompleteNegativeFormatString(OUStringBuffer& rStr,
         break;
         case 9:                                         // -$ 1
         {
-            rStr.insert(0, ' ');
-            rStr.insert(0, rSymStr);
-            rStr.insert(0, '-');
+            rStr.insert(0, OUString::Concat("-") + rSymStr + " ");
         }
         break;
         case 10:                                        // 1 $-
@@ -4693,14 +4687,12 @@ void 
NfCurrencyEntry::CompleteNegativeFormatString(OUStringBuffer& rStr,
         break;
         case 11:                                        // $ -1
         {
-            rStr.insert(0, " -");
-            rStr.insert(0, rSymStr);
+            rStr.insert(0, OUString::Concat(rSymStr) + " -");
         }
         break;
         case 12 :                                       // $ 1-
         {
-            rStr.insert(0, ' ');
-            rStr.insert(0, rSymStr);
+            rStr.insert(0, OUString::Concat(rSymStr) + " ");
             rStr.append('-');
         }
         break;
@@ -4713,9 +4705,7 @@ void 
NfCurrencyEntry::CompleteNegativeFormatString(OUStringBuffer& rStr,
         break;
         case 14 :                                       // ($ 1)
         {
-            rStr.insert(0, ' ');
-            rStr.insert(0, rSymStr);
-            rStr.insert(0, '(');
+            rStr.insert(0, OUString::Concat("(") + rSymStr + " ");
             rStr.append(')');
         }
         break;
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index 86794dc92bfe..3503fae4f6ce 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -868,8 +868,7 @@ bool SdrAngleItem::GetPresentation(
     if(ePres == SfxItemPresentation::Complete)
     {
         OUString aStr = SdrItemPool::GetItemName(Which());
-        aText.insert(0, ' ');
-        aText.insert(0, aStr);
+        aText.insert(0, aStr + " ");
     }
 
     rText = aText.makeStringAndClear();
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 7cb1b7d679ef..1b566ed8d93c 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -1821,9 +1821,7 @@ void SvXMLNumFormatContext::AddNumber( const 
SvXMLNumberInfo& rInfo )
                 //  #107805# always quote embedded strings - even space would 
otherwise
                 //  be recognized as thousands separator in French.
 
-                aNumStr.insert(nInsertPos, '"');
-                aNumStr.insert(nInsertPos, it.second);
-                aNumStr.insert(nInsertPos, '"');
+                aNumStr.insert(nInsertPos, OUString::Concat("\"") + it.second 
+ "\"");
             }
         }
     }

Reply via email to