[Libreoffice-commits] core.git: chart2/qa chart2/source compilerplugins/clang connectivity/source dbaccess/qa dbaccess/source filter/source forms/source i18nlangtag/source sc/source sd/source sfx2/source solenv/CompilerTest_compilerplugins_clang.mk sw/source vcl/source xmloff/source xmlsecurity/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Aug 29 07:05:45 UTC 2018


 chart2/qa/extras/chart2dump/chart2dump.cxx                   |    4 
 chart2/source/tools/ExponentialRegressionCurveCalculator.cxx |   12 -
 chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx |    8 -
 chart2/source/tools/PolynomialRegressionCurveCalculator.cxx  |    2 
 chart2/source/tools/PotentialRegressionCurveCalculator.cxx   |    6 
 chart2/source/view/charttypes/VSeriesPlotter.cxx             |    2 
 compilerplugins/clang/stringbuffer.cxx                       |   67 +++++++++++
 compilerplugins/clang/test/stringbuffer.cxx                  |   22 +++
 connectivity/source/drivers/postgresql/pq_xkeys.cxx          |    2 
 connectivity/source/drivers/postgresql/pq_xtables.cxx        |    2 
 connectivity/source/drivers/postgresql/pq_xuser.cxx          |    6 
 connectivity/source/drivers/postgresql/pq_xviews.cxx         |    6 
 dbaccess/qa/unit/embeddeddb_performancetest.cxx              |   17 +-
 dbaccess/source/core/api/CacheSet.cxx                        |    6 
 dbaccess/source/core/api/KeySet.cxx                          |   10 -
 dbaccess/source/core/api/OptimisticSet.cxx                   |    4 
 dbaccess/source/core/api/SingleSelectQueryComposer.cxx       |   20 +--
 dbaccess/source/core/dataaccess/ContentHelper.cxx            |    2 
 dbaccess/source/ext/macromigration/migrationlog.cxx          |    8 -
 dbaccess/source/filter/xml/xmlServerDatabase.cxx             |   22 +--
 dbaccess/source/ui/misc/WCopyTable.cxx                       |    2 
 dbaccess/source/ui/querydesign/QueryDesignView.cxx           |    2 
 dbaccess/source/ui/uno/copytablewizard.cxx                   |    2 
 filter/source/config/cache/filtercache.cxx                   |   24 +--
 forms/source/xforms/model_ui.cxx                             |    2 
 i18nlangtag/source/languagetag/languagetag.cxx               |    6 
 sc/source/core/tool/chgtrack.cxx                             |    4 
 sc/source/core/tool/compiler.cxx                             |    4 
 sd/source/filter/html/htmlex.cxx                             |   12 -
 sfx2/source/control/unoctitm.cxx                             |    6 
 solenv/CompilerTest_compilerplugins_clang.mk                 |    1 
 sw/source/uibase/uiview/pview.cxx                            |    4 
 vcl/source/uitest/logger.cxx                                 |   12 -
 xmloff/source/draw/animationexport.cxx                       |    2 
 xmloff/source/draw/shapeexport.cxx                           |    2 
 xmloff/source/style/xmlbahdl.cxx                             |    4 
 xmloff/source/style/xmlexppr.cxx                             |    2 
 xmloff/source/style/xmlnumfi.cxx                             |    6 
 xmloff/source/xforms/xformsexport.cxx                        |    6 
 xmlsecurity/source/dialogs/resourcemanager.cxx               |    2 
 40 files changed, 212 insertions(+), 121 deletions(-)

New commits:
commit 4c91b89d8ce9c34179f31854dc88bd0a9fa84cba
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 28 15:09:33 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 29 09:05:18 2018 +0200

    new loplugin:oustringbuffer
    
    look for places where we are appending the temporary result of adding
    strings together, to an OUStringBuffer, where we could rather call
    append repeatedly and avoid the temporary creation
    
    Change-Id: I481435124291ac7fb54b91a78344a9fe5b379a82
    Reviewed-on: https://gerrit.libreoffice.org/59708
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx
index ceb818c70e0f..e06ce2f76415 100644
--- a/chart2/qa/extras/chart2dump/chart2dump.cxx
+++ b/chart2/qa/extras/chart2dump/chart2dump.cxx
@@ -230,7 +230,7 @@ protected:
         OUStringBuffer aBufer;
         for (const OUString& seqItem : rSeq)
         {
-            aBufer.append(seqItem + ";");
+            aBufer.append(seqItem).append(";");
         }
         return aBufer.makeStringAndClear();
     }
@@ -240,7 +240,7 @@ protected:
         OUStringBuffer aBufer;
         for (const double& vectorItem : rVector)
         {
-            aBufer.append(OUString::number(vectorItem) + ";");
+            aBufer.append(OUString::number(vectorItem)).append(";");
         }
         return aBufer.makeStringAndClear();
     }
diff --git a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
index db59250b76b0..42d0480d6b73 100644
--- a/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/ExponentialRegressionCurveCalculator.cxx
@@ -179,13 +179,13 @@ OUString ExponentialRegressionCurveCalculator::ImplGetRepresentation(
         // if nValueLength not calculated then nullptr
     sal_Int32* pValueLength = nValueLength ? &nValueLength : nullptr;
     if ( m_fSign < 0.0 )
-        aTmpBuf.append( OUStringLiteral1(aMinusSign) + " " );
+        aTmpBuf.append( OUStringLiteral1(aMinusSign) ).append( " " );
     if ( bHasIntercept )
     {
         OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fIntercept, pValueLength );
         if ( aValueString != "1" )  // aValueString may be rounded to 1 if nValueLength is small
         {
-            aTmpBuf.append( aValueString + " " );
+            aTmpBuf.append( aValueString ).append( " " );
             addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth );
             aTmpBuf.truncate();
         }
@@ -199,21 +199,21 @@ OUString ExponentialRegressionCurveCalculator::ImplGetRepresentation(
             OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, m_fLogIntercept, pValueLength );
             if ( aValueString != "0" )  // aValueString may be rounded to 0 if nValueLength is small
             {
-                aTmpBuf.append( aValueString + ( (m_fLogSlope < 0.0) ? OUStringLiteral(" ") : OUStringLiteral(" + ") ) );
+                aTmpBuf.append( aValueString ).append( (m_fLogSlope < 0.0) ? OUStringLiteral(" ") : OUStringLiteral(" + ") );
             }
         }
     }
     if ( m_fLogSlope < 0.0 )
-        aTmpBuf.append( OUStringLiteral1(aMinusSign) + " " );
+        aTmpBuf.append( OUStringLiteral1(aMinusSign) ).append( " " );
     if ( bHasLogSlope )
     {
         OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fLogSlope), pValueLength );
         if ( aValueString != "1" )  // aValueString may be rounded to 1 if nValueLength is small
         {
-            aTmpBuf.append( aValueString + " " );
+            aTmpBuf.append( aValueString ).append( " " );
         }
     }
-    aTmpBuf.append( mXName + " )");
+    aTmpBuf.append( mXName ).append(" )");
     addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth );
 
     return aBuf.makeStringAndClear();
diff --git a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
index 377c1ccfe102..aecbc4ed39c9 100644
--- a/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/LogarithmicRegressionCurveCalculator.cxx
@@ -156,17 +156,17 @@ OUString LogarithmicRegressionCurveCalculator::ImplGetRepresentation(
     {
         if( m_fSlope < 0.0 )
         {
-            aTmpBuf.append( OUStringLiteral1(aMinusSign) + " " );
+            aTmpBuf.append( OUStringLiteral1(aMinusSign) ).append( " " );
         }
         if( bHasSlope )
         {
             OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fSlope), pValueLength );
             if ( aValueString != "1" )  // aValueString may be rounded to 1 if nValueLength is small
             {
-                aTmpBuf.append( aValueString + " " );
+                aTmpBuf.append( aValueString ).append( " " );
             }
         }
-        aTmpBuf.append( "ln(" + mXName + ") " );
+        aTmpBuf.append( "ln(" ).append( mXName ).append( ") " );
         addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth );
         aTmpBuf.truncate();
 
@@ -175,7 +175,7 @@ OUString LogarithmicRegressionCurveCalculator::ImplGetRepresentation(
     }
              // add intercept value
     if( m_fIntercept < 0.0 )
-        aTmpBuf.append( OUStringLiteral1(aMinusSign)+" " );
+        aTmpBuf.append( OUStringLiteral1(aMinusSign) ).append( " " );
     OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fIntercept), pValueLength );
     if ( aValueString != "0" )  // aValueString may be rounded to 0 if nValueLength is small
     {
diff --git a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
index ab67bbd09e36..3727e38806ef 100644
--- a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx
@@ -274,7 +274,7 @@ OUString PolynomialRegressionCurveCalculator::ImplGetRepresentation(
         {
             if ( bFindValue ) // if it is not the first aValue
                 aTmpBuf.append( " " );
-            aTmpBuf.append( OUStringLiteral1(aMinusSign) + " ");
+            aTmpBuf.append( OUStringLiteral1(aMinusSign) ).append(" ");
             aValue = - aValue;
         }
         else
diff --git a/chart2/source/tools/PotentialRegressionCurveCalculator.cxx b/chart2/source/tools/PotentialRegressionCurveCalculator.cxx
index d4901d843279..6f4f507d039f 100644
--- a/chart2/source/tools/PotentialRegressionCurveCalculator.cxx
+++ b/chart2/source/tools/PotentialRegressionCurveCalculator.cxx
@@ -170,18 +170,18 @@ OUString PotentialRegressionCurveCalculator::ImplGetRepresentation(
         // if nValueLength not calculated then nullptr
         sal_Int32* pValueLength = nValueLength ? &nValueLength : nullptr;
         if ( m_fIntercept < 0.0 )    // add intercept value
-             aTmpBuf.append( OUStringLiteral1(aMinusSign)+" " );
+             aTmpBuf.append( OUStringLiteral1(aMinusSign) ).append( " " );
         if( bHasIntercept )
         {
             OUString aValueString = getFormattedString( xNumFormatter, nNumberFormatKey, fabs(m_fIntercept), pValueLength );
             if ( aValueString != "1" )  // aValueString may be rounded to 1 if nValueLength is small
             {
-                aTmpBuf.append( aValueString + " " );
+                aTmpBuf.append( aValueString ).append( " " );
             }
         }
         if( m_fSlope != 0.0 )  // add slope value
         {
-            aTmpBuf.append( mXName + "^" );
+            aTmpBuf.append( mXName ).append( "^" );
             aTmpBuf.append( getFormattedString( xNumFormatter, nNumberFormatKey, m_fSlope, pValueLength ));
         }
         addStringToEquation( aBuf, nLineLength, aTmpBuf, pFormulaMaxWidth );
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index bad0d71432da..4b4602af7589 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -1352,7 +1352,7 @@ void VSeriesPlotter::createRegressionCurveEquationShapes(
             }
             if( bShowCorrCoeff )
             {
-                aFormula.append( "R" + OUStringLiteral1( aSuperscriptFigures[2] ) + " = " );
+                aFormula.append( "R" ).append( OUStringLiteral1( aSuperscriptFigures[2] ) ).append( " = " );
                 double fR( xRegressionCurveCalculator->getCorrelationCoefficient());
                 if( m_apNumberFormatterWrapper.get())
                 {
diff --git a/compilerplugins/clang/stringbuffer.cxx b/compilerplugins/clang/stringbuffer.cxx
new file mode 100644
index 000000000000..154a460a0007
--- /dev/null
+++ b/compilerplugins/clang/stringbuffer.cxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "check.hxx"
+#include "plugin.hxx"
+#include <vector>
+
+/** Look for appending result of adding OUString/OString to OUStringBuffer
+ */
+namespace
+{
+class StringBuffer : public loplugin::FilteringPlugin<StringBuffer>
+{
+public:
+    explicit StringBuffer(loplugin::InstantiationData const& rData)
+        : FilteringPlugin(rData)
+    {
+    }
+
+    void run() override;
+    bool VisitCXXMemberCallExpr(CXXMemberCallExpr const*);
+};
+
+void StringBuffer::run()
+{
+    StringRef fn(handler.getMainFileName());
+    if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/qa/"))
+        return;
+    TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+}
+
+bool StringBuffer::VisitCXXMemberCallExpr(CXXMemberCallExpr const* memberCallExpr)
+{
+    if (ignoreLocation(memberCallExpr))
+        return true;
+    if (!loplugin::DeclCheck(memberCallExpr->getRecordDecl())
+             .Class("OUStringBuffer")
+             .Namespace("rtl")
+             .GlobalNamespace())
+        return true;
+    if (!memberCallExpr->getMethodDecl()->getIdentifier())
+        return true;
+    if (memberCallExpr->getMethodDecl()->getName() != "append")
+        return true;
+    auto matTemp = dyn_cast<MaterializeTemporaryExpr>(memberCallExpr->getArg(0));
+    if (!matTemp)
+        return true;
+    if (!isa<CXXOperatorCallExpr>(matTemp->GetTemporaryExpr()))
+        return true;
+    report(DiagnosticsEngine::Warning,
+           "appending added result of OUString to OUStringBuffer, rather do .append(x).append(y)",
+           compat::getBeginLoc(memberCallExpr))
+        << memberCallExpr->getSourceRange();
+    return true;
+}
+
+loplugin::Plugin::Registration<StringBuffer> X("stringbuffer");
+
+} // namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/compilerplugins/clang/test/stringbuffer.cxx b/compilerplugins/clang/test/stringbuffer.cxx
new file mode 100644
index 000000000000..929eb478275d
--- /dev/null
+++ b/compilerplugins/clang/test/stringbuffer.cxx
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "sal/config.h"
+#include "rtl/string.hxx"
+#include "rtl/ustring.hxx"
+#include "rtl/ustrbuf.hxx"
+
+void func2(OUString s1, OUString s2)
+{
+    OUStringBuffer buf;
+    buf.append(s1 + s2);
+    // expected-error at -1 {{appending added result of OUString to OUStringBuffer, rather do .append(x).append(y) [loplugin:stringbuffer]}}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/postgresql/pq_xkeys.cxx b/connectivity/source/drivers/postgresql/pq_xkeys.cxx
index 09aa41ea0f15..22e8f57891ac 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeys.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeys.cxx
@@ -175,7 +175,7 @@ void Keys::refresh()
             if( css::sdbcx::KeyType::FOREIGN == keyType )
             {
                 OUStringBuffer buf( 128 );
-                buf.append( xRow->getString( 6 ) + "." + xRow->getString( 5 ) );
+                buf.append( xRow->getString( 6 ) ).append( "." ).append( xRow->getString( 5 ) );
                 pKey->setPropertyValue_NoBroadcast_public(
                     st.REFERENCED_TABLE, makeAny( buf.makeStringAndClear() ) );
 
diff --git a/connectivity/source/drivers/postgresql/pq_xtables.cxx b/connectivity/source/drivers/postgresql/pq_xtables.cxx
index 907e777f273d..adb4fd7b4fd3 100644
--- a/connectivity/source/drivers/postgresql/pq_xtables.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtables.cxx
@@ -135,7 +135,7 @@ void Tables::refresh()
             {
                 m_values.push_back( makeAny( prop ) );
                 OUStringBuffer buf( name.getLength() + schema.getLength() + 1);
-                buf.append( schema + "." + name );
+                buf.append( schema ).append( "." ).append( name );
                 map[ buf.makeStringAndClear() ] = tableIndex;
                 ++tableIndex;
             }
diff --git a/connectivity/source/drivers/postgresql/pq_xuser.cxx b/connectivity/source/drivers/postgresql/pq_xuser.cxx
index 766b80d2587a..e3985edbd0a1 100644
--- a/connectivity/source/drivers/postgresql/pq_xuser.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xuser.cxx
@@ -128,9 +128,9 @@ sal_Int32 User::getPrivileges( const OUString& objName, sal_Int32 objType )
         Statics & st = getStatics();
 
         OUStringBuffer buf( 128 );
-        buf.append( "User::getPrivileges[" + extractStringProperty( this, st.NAME ) +
-                    "] got called for " + objName + "(type=" +
-                    OUString::number(objType) + ")");
+        buf.append( "User::getPrivileges[" ).append( extractStringProperty( this, st.NAME ) )
+                    .append( "] got called for " ).append( objName ).append( "(type=" )
+                    .append( OUString::number(objType) ).append(")");
         log(m_pSettings, LogLevel::Info, buf.makeStringAndClear());
     }
     // all privileges
diff --git a/connectivity/source/drivers/postgresql/pq_xviews.cxx b/connectivity/source/drivers/postgresql/pq_xviews.cxx
index 8f1d58d07f8e..e6503485a9c0 100644
--- a/connectivity/source/drivers/postgresql/pq_xviews.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xviews.cxx
@@ -117,7 +117,7 @@ void Views::refresh()
             {
                 m_values.push_back( makeAny( prop ) );
                 OUStringBuffer buf( table.getLength() + schema.getLength() + 1);
-                buf.append( schema + "." + table );
+                buf.append( schema ).append( "." ).append( table );
                 map[ buf.makeStringAndClear() ] = viewIndex;
                 ++viewIndex;
             }
@@ -151,7 +151,7 @@ void Views::appendByDescriptor(
 
     buf.append( "CREATE VIEW ");
     bufferQuoteQualifiedIdentifier( buf, schema, name, m_pSettings );
-    buf.append(" AS " + command );
+    buf.append(" AS " ).append( command );
 
     stmt->executeUpdate( buf.makeStringAndClear() );
 
@@ -193,7 +193,7 @@ void Views::dropByIndex( sal_Int32 index )
     set->getPropertyValue( st.NAME ) >>= name;
 
     OUStringBuffer update( 128 );
-    update.append( "DROP VIEW \"" + schema + "\".\"" + name + "\"" );
+    update.append( "DROP VIEW \"" ).append( schema ).append( "\".\"" ).append( name ).append( "\"" );
 
     Reference< XStatement > stmt = m_origin->createStatement( );
 
diff --git a/dbaccess/qa/unit/embeddeddb_performancetest.cxx b/dbaccess/qa/unit/embeddeddb_performancetest.cxx
index 26b77b555fe1..444f283d9630 100644
--- a/dbaccess/qa/unit/embeddeddb_performancetest.cxx
+++ b/dbaccess/qa/unit/embeddeddb_performancetest.cxx
@@ -137,12 +137,11 @@ void EmbeddedDBPerformanceTest::printTimes(
     const TimeValue* pTime2,
     const TimeValue* pTime3)
 {
-    m_aOutputBuffer.append(
-        getPrintableTimeValue(pTime1) + "\t" +
-        getPrintableTimeValue(pTime2) + "\t" +
-        getPrintableTimeValue(pTime3) + "\t"
-        "\n"
-   );
+    m_aOutputBuffer
+        .append(getPrintableTimeValue(pTime1)).append("\t")
+        .append(getPrintableTimeValue(pTime2)).append("\t")
+        .append(getPrintableTimeValue(pTime3)).append("\t")
+        .append("\n");
 }
 
 const char EmbeddedDBPerformanceTest::our_sEnableTestEnvVar[] = "DBA_PERFTEST";
@@ -284,7 +283,7 @@ void EmbeddedDBPerformanceTest::performPreparedStatementInsertTest(
     getTimeDifference(&aStart, &aMiddle, &aTimeInsert);
     getTimeDifference(&aMiddle, &aEnd, &aTimeCommit);
     getTimeDifference(&aStart, &aEnd, &aTimeTotal);
-    m_aOutputBuffer.append("Insert: " + rDBName + "\n");
+    m_aOutputBuffer.append("Insert: ").append(rDBName).append("\n");
     printTimes(&aTimeInsert, &aTimeCommit, &aTimeTotal);
 
     pFile->Close();
@@ -322,7 +321,7 @@ void EmbeddedDBPerformanceTest::performStatementInsertTest(
     getTimeDifference(&aStart, &aMiddle, &aTimeInsert);
     getTimeDifference(&aMiddle, &aEnd, &aTimeCommit);
     getTimeDifference(&aStart, &aEnd, &aTimeTotal);
-    m_aOutputBuffer.append("Insert: " + rDBName + "\n");
+    m_aOutputBuffer.append("Insert: ").append(rDBName).append("\n");
     printTimes(&aTimeInsert, &aTimeCommit, &aTimeTotal);
 
     pFile->Close();
@@ -353,7 +352,7 @@ void EmbeddedDBPerformanceTest::performReadTest(
     getTimeDifference(&aStart, &aMiddle, &aTimeSelect);
     getTimeDifference(&aMiddle, &aEnd, &aTimeIterate);
     getTimeDifference(&aStart, &aEnd, &aTimeTotal);
-    m_aOutputBuffer.append("Read from: " + rDBName + "\n");
+    m_aOutputBuffer.append("Read from: ").append(rDBName).append("\n");
     printTimes(&aTimeSelect, &aTimeIterate, &aTimeTotal);
 }
 
diff --git a/dbaccess/source/core/api/CacheSet.cxx b/dbaccess/source/core/api/CacheSet.cxx
index bf547d6a53c1..fe930722ab68 100644
--- a/dbaccess/source/core/api/CacheSet.cxx
+++ b/dbaccess/source/core/api/CacheSet.cxx
@@ -163,7 +163,7 @@ void OCacheSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQ
     connectivity::ORowVector< ORowSetValue > ::Vector::iterator aEnd = _rInsertRow->get().end();
     for(; aIter != aEnd;++aIter)
     {
-        aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)) + ",");
+        aSql.append(::dbtools::quoteName( aQuote,m_xSetMetaData->getColumnName(i++)) ).append(",");
         aValues.append("?,");
     }
 
@@ -264,7 +264,7 @@ void OCacheSet::fillParameters( const ORowSetRow& _rRow
         }
         if(aIter->isModified())
         {
-            _sParameter.append(::dbtools::quoteName( aQuote,aColumnName) + "?,");
+            _sParameter.append(::dbtools::quoteName( aQuote,aColumnName) ).append("?,");
         }
     }
 }
@@ -285,7 +285,7 @@ void OCacheSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOri
     {
         aCondition.setLength(aCondition.getLength()-5);
 
-        aSql.append(" WHERE " + aCondition.makeStringAndClear());
+        aSql.append(" WHERE " ).append( aCondition.makeStringAndClear());
     }
     else
         ::dbtools::throwSQLException(
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index eb866c82bad2..1cd92ab7835a 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -223,11 +223,11 @@ namespace
             fullName = tblName + "." + colName;
         if ( _rValue.isNull() )
         {
-            o_buf.append(fullName + " IS NULL ");
+            o_buf.append(fullName).append(" IS NULL ");
         }
         else
         {
-            o_buf.append(fullName + " = ? ");
+            o_buf.append(fullName).append(" = ? ");
         }
     }
 }
@@ -503,7 +503,7 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi
         }
         if((_rInsertRow->get())[columnName.second.nPosition].isModified())
         {
-            aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName) + aPara);
+            aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName)).append(aPara);
         }
         ++i;
     }
@@ -520,7 +520,7 @@ void OKeySet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrigi
         aSql.append(" WHERE ");
         if(!sKeyCondition.isEmpty() && !sIndexCondition.isEmpty())
         {
-            aSql.append(sKeyCondition.makeStringAndClear() + sIndexCondition.makeStringAndClear());
+            aSql.append(sKeyCondition.makeStringAndClear()).append(sIndexCondition.makeStringAndClear());
         }
         else if(!sKeyCondition.isEmpty())
         {
@@ -618,7 +618,7 @@ void OKeySet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLT
             {
                 bRefetch = std::find(m_aFilterColumns.begin(),m_aFilterColumns.end(),columnName.second.sRealName) == m_aFilterColumns.end();
             }
-            aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName) + ",");
+            aSql.append(::dbtools::quoteName( aQuote,columnName.second.sRealName)).append(",");
             aValues.append("?,");
             bModified = true;
         }
diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx
index 5c2a45017f44..bf272f18471a 100644
--- a/dbaccess/source/core/api/OptimisticSet.cxx
+++ b/dbaccess/source/core/api/OptimisticSet.cxx
@@ -202,7 +202,7 @@ void OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _
             OUStringBuffer& rPart = aSql[columnName.second.sTableName];
             if ( !rPart.isEmpty() )
                 rPart.append(", ");
-            rPart.append(sQuotedColumnName + " = ?");
+            rPart.append(sQuotedColumnName).append(" = ?");
         }
     }
 
@@ -225,7 +225,7 @@ void OptimisticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _
                                        " SET " + elem.second.toString());
             OUStringBuffer& rCondition = aKeyConditions[elem.first];
             if ( !rCondition.isEmpty() )
-                sSql.append(" WHERE " + rCondition.toString() );
+                sSql.append(" WHERE ").append( rCondition.toString() );
 
             executeUpdate(_rInsertRow ,_rOriginalRow,sSql.makeStringAndClear(),elem.first);
         }
diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
index 9a8eea35ed10..6d4ba1b0d87c 100644
--- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
+++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx
@@ -177,28 +177,28 @@ namespace
         switch( i_nFilterOperator )
         {
             case SQLFilterOperator::EQUAL:
-                o_sRet.append(" = " + i_sValue);
+                o_sRet.append(" = " ).append( i_sValue);
                 break;
             case SQLFilterOperator::NOT_EQUAL:
-                o_sRet.append(" <> " + i_sValue);
+                o_sRet.append(" <> " ).append( i_sValue);
                 break;
             case SQLFilterOperator::LESS:
-                o_sRet.append(" < " + i_sValue);
+                o_sRet.append(" < " ).append( i_sValue);
                 break;
             case SQLFilterOperator::GREATER:
-                o_sRet.append(" > " + i_sValue);
+                o_sRet.append(" > " ).append( i_sValue);
                 break;
             case SQLFilterOperator::LESS_EQUAL:
-                o_sRet.append(" <= " + i_sValue);
+                o_sRet.append(" <= " ).append( i_sValue);
                 break;
             case SQLFilterOperator::GREATER_EQUAL:
-                o_sRet.append(" >= " + i_sValue);
+                o_sRet.append(" >= " ).append( i_sValue);
                 break;
             case SQLFilterOperator::LIKE:
-                o_sRet.append(" LIKE " + i_sValue);
+                o_sRet.append(" LIKE " ).append( i_sValue);
                 break;
             case SQLFilterOperator::NOT_LIKE:
-                o_sRet.append(" NOT LIKE " + i_sValue);
+                o_sRet.append(" NOT LIKE " ).append( i_sValue);
                 break;
             case SQLFilterOperator::SQLNULL:
                 o_sRet.append(" IS NULL");
@@ -763,7 +763,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns(  )
         OUString sOriginalWhereClause = getSQLPart( Where, m_aSqlIterator, false );
         if ( !sOriginalWhereClause.isEmpty() )
         {
-            aSQL.append( " AND ( " + sOriginalWhereClause + " ) " );
+            aSQL.append( " AND ( " ).append( sOriginalWhereClause ).append( " ) " );
         }
 
         OUString sGroupBy = getSQLPart( Group, m_aSqlIterator, true );
@@ -1666,7 +1666,7 @@ void OSingleSelectQueryComposer::setConditionByColumn( const Reference< XPropert
                         const ::sal_Int64 nLength = xClob->length();
                         if ( sal_Int64(nLength + aSQL.getLength() + STR_LIKE.getLength() ) < sal_Int64(SAL_MAX_INT32) )
                         {
-                            aSQL.append("'" + xClob->getSubString(1,static_cast<sal_Int32>(nLength)) + "'");
+                            aSQL.append("'").append(xClob->getSubString(1,static_cast<sal_Int32>(nLength))).append("'");
                         }
                     }
                     else
diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx
index 5f8bb59e0b59..b59e70b63490 100644
--- a/dbaccess/source/core/dataaccess/ContentHelper.cxx
+++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx
@@ -107,7 +107,7 @@ OUString OContentHelper::impl_getHierarchicalName( bool _includingRootContainer
             xProp->getPropertyValue( PROPERTY_NAME ) >>= sName;
 
             OUString sPrevious = aHierarchicalName.makeStringAndClear();
-            aHierarchicalName.append( sName + "/" + sPrevious );
+            aHierarchicalName.append( sName ).append( "/" ).append( sPrevious );
         }
     }
     OUString sHierarchicalName( aHierarchicalName.makeStringAndClear() );
diff --git a/dbaccess/source/ext/macromigration/migrationlog.cxx b/dbaccess/source/ext/macromigration/migrationlog.cxx
index 6a0b71b12bfe..13953894bf8b 100644
--- a/dbaccess/source/ext/macromigration/migrationlog.cxx
+++ b/dbaccess/source/ext/macromigration/migrationlog.cxx
@@ -382,8 +382,8 @@ namespace dbmm
             OUString sBackedUp( DBA_RES( STR_SAVED_COPY_TO ) );
             sBackedUp = sBackedUp.replaceAll( "$location$", m_pData->sBackupLocation );
 
-            aBuffer.append( "=== " + DBA_RES( STR_DATABASE_DOCUMENT )
-                    + " ===\n" + sBackedUp + "\n\n");
+            aBuffer.append( "=== " ).append( DBA_RES( STR_DATABASE_DOCUMENT ) )
+                   .append( " ===\n" ).append( sBackedUp ).append("\n\n");
         }
 
         if ( !m_pData->aFailures.empty() )
@@ -405,7 +405,7 @@ namespace dbmm
                 OUString sDocTitle( DBA_RES( rDoc.eType == eForm ? STR_FORM : STR_REPORT ) );
                 sDocTitle = sDocTitle.replaceAll( "$name$", rDoc.sName );
 
-                aBuffer.append( "=== " + sDocTitle + " ===\n" );
+                aBuffer.append( "=== " ).append( sDocTitle ).append( " ===\n" );
 
                 for (auto const& elem : rDoc.aMovedLibraries)
                 {
@@ -414,7 +414,7 @@ namespace dbmm
                     sMovedLib = sMovedLib.replaceAll( "$old$", elem.sOldName );
                     sMovedLib = sMovedLib.replaceAll( "$new$", elem.sNewName );
 
-                    aBuffer.append( sMovedLib + "\n" );
+                    aBuffer.append( sMovedLib ).append( "\n" );
                 }
 
                 aBuffer.append( '\n' );
diff --git a/dbaccess/source/filter/xml/xmlServerDatabase.cxx b/dbaccess/source/filter/xml/xmlServerDatabase.cxx
index 7ce8a7e3ff9a..6eb9ce76ef12 100644
--- a/dbaccess/source/filter/xml/xmlServerDatabase.cxx
+++ b/dbaccess/source/filter/xml/xmlServerDatabase.cxx
@@ -82,46 +82,46 @@ OXMLServerDatabase::OXMLServerDatabase( ODBFilter& rImport,
         OUStringBuffer sURL;
         if  ( sType == "sdbc:mysql:jdbc" || sType == "sdbc:mysqlc" || sType == "sdbc:mysql:mysqlc" )
         {
-            sURL.append( sType + ":" + sHostName);
+            sURL.append( sType ).append( ":" ).append(sHostName);
             if ( !sPortNumber.isEmpty() )
             {
-                sURL.append(":" + sPortNumber);
+                sURL.append(":").append(sPortNumber);
             }
             if ( !sDatabaseName.isEmpty() )
             {
-                sURL.append("/" + sDatabaseName);
+                sURL.append("/").append(sDatabaseName);
             }
         }
         else if ( sType == "jdbc:oracle:thin" )
         {
-            sURL.append("jdbc:oracle:thin:@" + sHostName);
+            sURL.append("jdbc:oracle:thin:@").append(sHostName);
             if ( !sPortNumber.isEmpty() )
             {
-                sURL.append(":" + sPortNumber);
+                sURL.append(":").append(sPortNumber);
             }
             if ( !sDatabaseName.isEmpty() )
             {
-                sURL.append(":" + sDatabaseName);
+                sURL.append(":").append(sDatabaseName);
             }
         }
         else if ( sType == "sdbc:address:ldap" )
         {
-            sURL.append("sdbc:address:ldap:" + sHostName);
+            sURL.append("sdbc:address:ldap:").append(sHostName);
             if ( !sPortNumber.isEmpty() )
             {
-                sURL.append(":" + sPortNumber);
+                sURL.append(":").append(sPortNumber);
             }
         }
         else
         {
-            sURL.append(sType + ":" + sHostName);
+            sURL.append(sType).append(":").append(sHostName);
             if ( !sPortNumber.isEmpty() )
             {
-                sURL.append(":" + sPortNumber);
+                sURL.append(":").append(sPortNumber);
             }
             if ( !sDatabaseName.isEmpty() )
             {
-                sURL.append(":" + sDatabaseName);
+                sURL.append(":").append(sDatabaseName);
             }
         }
         try
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index f602ed3abcfc..7c86eced09f2 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -238,7 +238,7 @@ OUString ObjectCopySource::getSelectStatement() const
                 aSQL.append( ", " );
         }
 
-        aSQL.append( "FROM " + ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) );
+        aSQL.append( "FROM " ).append( ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) );
 
         sSelectStatement = aSQL.makeStringAndClear();
     }
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 68ffb367abb7..f977ec528d03 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -2814,7 +2814,7 @@ OUString OQueryDesignView::getStatement()
         const sal_Int64 nLimit = rController.getLimit();
         if( nLimit != -1 )
         {
-            aSqlCmd.append( " LIMIT " + OUString::number(nLimit) );
+            aSqlCmd.append( " LIMIT " ).append( OUString::number(nLimit) );
         }
     }
 
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
index 53685f07f2c1..c129679211bc 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -1436,7 +1436,7 @@ OUString CopyTableWizard::impl_getServerSideCopyStatement_throw(const Reference<
         {
             if ( !sColumns.isEmpty() )
                 sColumns.append(",");
-            sColumns.append(sQuote + aDestColumnNames[rColumnPositionPair.second - 1] + sQuote);
+            sColumns.append(sQuote).append(aDestColumnNames[rColumnPositionPair.second - 1]).append(sQuote);
         }
     }
     const OUString sComposedTableName = ::dbtools::composeTableName( xDestMetaData, _xTable, ::dbtools::EComposeRule::InDataManipulation, true );
diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index 3725a7995f93..d3cf357f165d 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -1001,13 +1001,13 @@ void FilterCache::impl_validateAndOptimize()
         aType[PROPNAME_NAME] >>= sInternalTypeNameCheck;
         if (sInternalTypeNameCheck != sType)
         {
-            sLog.append("Warning\t:\t" "The type \"" + sType + "\" does support the property \"Name\" correctly.\n");
+            sLog.append("Warning\t:\t" "The type \"").append(sType).append("\" does support the property \"Name\" correctly.\n");
             ++nWarnings;
         }
 
         if (!ce && !cu)
         {
-            sLog.append("Warning\t:\t" "The type \"" + sType + "\" does not contain any URL pattern nor any extensions.\n");
+            sLog.append("Warning\t:\t" "The type \"").append(sType).append("\" does not contain any URL pattern nor any extensions.\n");
             ++nWarnings;
         }
 #endif
@@ -1083,7 +1083,7 @@ void FilterCache::impl_validateAndOptimize()
                 (!bReferencedByHandler)
                )
             {
-                sLog.append("Warning\t:\t" "The type \"" + sType + "\" is not used by any filter, loader or content handler.\n");
+                sLog.append("Warning\t:\t" "The type \"").append(sType).append("\" is not used by any filter, loader or content handler.\n");
                 ++nWarnings;
             }
         }
@@ -1104,7 +1104,7 @@ void FilterCache::impl_validateAndOptimize()
                     sLog.append("warning\t:\t");
                 }
 
-                sLog.append("The type \"" + sType + "\" points to an invalid filter \"" + sPrefFilter + "\".\n");
+                sLog.append("The type \"").append(sType).append("\" points to an invalid filter \"").append(sPrefFilter).append("\".\n");
                 continue;
             }
 
@@ -1113,10 +1113,10 @@ void FilterCache::impl_validateAndOptimize()
             aPrefFilter[PROPNAME_TYPE] >>= sFilterTypeReg;
             if (sFilterTypeReg != sType)
             {
-                sLog.append("error\t:\t" "The preferred filter \""
-                    + sPrefFilter + "\" of type \"" + sType +
-                    "\" is registered for another type \"" + sFilterTypeReg +
-                    "\".\n");
+                sLog.append("error\t:\t" "The preferred filter \"")
+                    .append(sPrefFilter).append("\" of type \"").append(sType)
+                    .append("\" is registered for another type \"").append(sFilterTypeReg)
+                    .append("\".\n");
                 ++nErrors;
             }
 
@@ -1124,8 +1124,8 @@ void FilterCache::impl_validateAndOptimize()
             aPrefFilter[PROPNAME_FLAGS] >>= nFlags;
             if (!(static_cast<SfxFilterFlags>(nFlags) & SfxFilterFlags::IMPORT))
             {
-                sLog.append("error\t:\t" "The preferred filter \"" + sPrefFilter + "\" of type \"" +
-                            sType + "\" is not an IMPORT filter!\n");
+                sLog.append("error\t:\t" "The preferred filter \"").append(sPrefFilter).append("\" of type \"")
+                            .append(sType).append("\" is not an IMPORT filter!\n");
                 ++nErrors;
             }
 
@@ -1133,8 +1133,8 @@ void FilterCache::impl_validateAndOptimize()
             aPrefFilter[PROPNAME_NAME] >>= sInternalFilterNameCheck;
             if (sInternalFilterNameCheck !=  sPrefFilter)
             {
-                sLog.append("Warning\t:\t" "The filter \"" + sPrefFilter +
-                            "\" does support the property \"Name\" correctly.\n");
+                sLog.append("Warning\t:\t" "The filter \"").append(sPrefFilter)
+                            .append("\" does support the property \"Name\" correctly.\n");
                 ++nWarnings;
             }
         }
diff --git a/forms/source/xforms/model_ui.cxx b/forms/source/xforms/model_ui.cxx
index ba3bbff52191..93bd72f06951 100644
--- a/forms/source/xforms/model_ui.cxx
+++ b/forms/source/xforms/model_ui.cxx
@@ -286,7 +286,7 @@ OUString Model::getNodeDisplayName( const XNode_t& xNode,
             OUString sContent = xNode->getNodeValue();
             if( bDetail || ! lcl_isWhitespace( sContent ) )
             {
-                aBuffer.append("\"" + Convert::collapseWhitespace( sContent ) + "\"");
+                aBuffer.append("\"").append(Convert::collapseWhitespace( sContent )).append("\"");
             }
         }
         break;
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index 9809edef6777..ed768a907303 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -1097,11 +1097,11 @@ bool LanguageTagImpl::canonicalize()
                                 1 + aCountry.getLength() + 1 + aVariants.getLength());
                         aBuf.append( aLanguage);
                         if (!aScript.isEmpty())
-                            aBuf.append("-" + aScript);
+                            aBuf.append("-").append(aScript);
                         if (!aCountry.isEmpty())
-                            aBuf.append("-" + aCountry);
+                            aBuf.append("-").append(aCountry);
                         if (!aVariants.isEmpty())
-                            aBuf.append("-" + aVariants);
+                            aBuf.append("-").append(aVariants);
                         OUString aStr( aBuf.makeStringAndClear());
 
                         if (maBcp47 != aStr)
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 149a7f016c7a..b1d8fcc18a1a 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -437,7 +437,7 @@ void ScChangeAction::GetDescription(
     if (GetType() == SC_CAT_MOVE)
     {
         aBuf.append(
-            ScResId(STR_CHANGED_MOVE_REJECTION_WARNING) + " ");
+            ScResId(STR_CHANGED_MOVE_REJECTION_WARNING)).append(" ");
         rStr = aBuf.makeStringAndClear();
         return;
     }
@@ -445,7 +445,7 @@ void ScChangeAction::GetDescription(
     if (IsInsertType())
     {
         aBuf.append(
-            ScResId(STR_CHANGED_DELETE_REJECTION_WARNING) + " ");
+            ScResId(STR_CHANGED_DELETE_REJECTION_WARNING)).append(" ");
         rStr = aBuf.makeStringAndClear();
         return;
     }
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 39a70965e205..e86e2d756e78 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -658,7 +658,7 @@ static OUString lcl_makeExternalNameStr(const OUString& rFile, const OUString& r
     OUStringBuffer aBuf(aFile.getLength() + aName.getLength() + 9);
     if (bODF)
         aBuf.append( '[');
-    aBuf.append( "'" + aFile + "'" + OUStringLiteral1(cSep));
+    aBuf.append( "'" ).append( aFile ).append( "'" ).append( OUStringLiteral1(cSep) );
     if (bODF)
         aBuf.append( "$$'" );
     aBuf.append( aName);
@@ -910,7 +910,7 @@ struct ConventionOOO_A1 : public Convention_A1
             else
                 aFile = INetURLObject::decode(rFileName, INetURLObject::DecodeMechanism::Unambiguous);
 
-            rBuffer.append("'" + aFile.replaceAll("'", "''") + "'#");
+            rBuffer.append("'").append(aFile.replaceAll("'", "''")).append("'#");
 
             if (!rRef.IsTabRel())
                 rBuffer.append('$');
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index cccf3494a477..a9377b468e1a 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -335,9 +335,9 @@ OUString getParagraphStyle( SdrOutliner* pOutliner, sal_Int32 nPara )
 void lclAppendStyle(OUStringBuffer& aBuffer, const OUString& aTag, const OUString& aStyle)
 {
     if (aStyle.isEmpty())
-        aBuffer.append("<" + aTag + ">");
+        aBuffer.append("<").append(aTag).append(">");
     else
-        aBuffer.append("<" + aTag + " style=\"" + aStyle + "\">");
+        aBuffer.append("<").append(aTag).append(" style=\"").append(aStyle).append("\">");
 }
 
 } // anonymous namespace
@@ -1348,7 +1348,7 @@ void HtmlExport::WriteOutlinerParagraph(OUStringBuffer& aStr, SdrOutliner* pOutl
             lclAppendStyle(aStr, aTag, getParagraphStyle(pOutliner, nIndex));
 
             aStr.append(aParaText);
-            aStr.append("</" + aTag + ">\r\n");
+            aStr.append("</").append(aTag).append(">\r\n");
         }
         else
         {
@@ -1594,7 +1594,7 @@ bool HtmlExport::CreateHtmlForPresPages()
         // HTML Head
         OUStringBuffer aStr(gaHTMLHeader);
         aStr.append(CreateMetaCharset());
-        aStr.append("  <title>" + StringToHTMLString(maPageNames[nSdPage]) + "</title>\r\n");
+        aStr.append("  <title>" ).append( StringToHTMLString(maPageNames[nSdPage]) ).append("</title>\r\n");
 
         // insert timing information
         pPage = maPages[ nSdPage ];
@@ -2807,12 +2807,12 @@ OUString HtmlExport::CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon& rPo
 
             aPnt.setX( static_cast<long>(aPnt.X() * fFactor) );
             aPnt.setY( static_cast<long>(aPnt.Y() * fFactor) );
-            aStr.append(OUString::number(aPnt.X()) + "," + OUString::number(aPnt.Y()));
+            aStr.append(OUString::number(aPnt.X())).append(",").append(OUString::number(aPnt.Y()));
 
             if (nPoint < nNoOfPoints - 1)
                 aStr.append(',');
         }
-        aStr.append("\" href=\"" + rHRef + "\">\n");
+        aStr.append("\" href=\"").append(rHRef).append("\">\n");
     }
 
     return aStr.makeStringAndClear();
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 819d3c4cb238..52792be21741 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1154,7 +1154,7 @@ static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const c
 
         if (aEvent.IsEnabled && (aEvent.State >>= aPoint))
         {
-            aBuffer.append(OUString::number(aPoint.X) + " / " + OUString::number(aPoint.Y));
+            aBuffer.append(OUString::number(aPoint.X)).append(" / ").append(OUString::number(aPoint.Y));
         }
     }
     else if (aEvent.FeatureURL.Path == "Size")
@@ -1163,7 +1163,7 @@ static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const c
 
         if (aEvent.IsEnabled && (aEvent.State >>= aSize))
         {
-            aBuffer.append(OUString::number(aSize.Width) + " x " + OUString::number(aSize.Height));
+            aBuffer.append(OUString::number(aSize.Width)).append(" x ").append(OUString::number(aSize.Height));
         }
     }
     else if (aEvent.FeatureURL.Path == "LanguageStatus")
@@ -1194,7 +1194,7 @@ static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const c
                 aBuffer.append(u'{');
                 for (sal_Int32 itSeq = 0; itSeq < aSeq.getLength(); itSeq++)
                 {
-                    aBuffer.append("\"" + aSeq[itSeq]);
+                    aBuffer.append("\"").append(aSeq[itSeq]);
                     if (itSeq != aSeq.getLength() - 1)
                         aBuffer.append("\":true,");
                     else
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk
index 950bca605378..6aacf7547c60 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -49,6 +49,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
     compilerplugins/clang/test/shouldreturnbool \
     compilerplugins/clang/test/simplifybool \
     compilerplugins/clang/test/simplifydynamiccast \
+    compilerplugins/clang/test/stringbuffer \
     compilerplugins/clang/test/stringconstant \
     compilerplugins/clang/test/stringloop \
     compilerplugins/clang/test/unnecessarycatchthrow \
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index c4a2055bc218..3f4e568aa60c 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -410,9 +410,9 @@ OUString SwPagePreviewWin::GetStatusStr( sal_uInt16 nPageCnt ) const
     const sal_uInt16 nVirtPageNum = mpPgPreviewLayout->GetVirtPageNumByPageNum( nPageNum );
     if( nVirtPageNum && nVirtPageNum != nPageNum )
     {
-        aStatusStr.append( OUString::number(nVirtPageNum) + " " );
+        aStatusStr.append( OUString::number(nVirtPageNum) ).append( " " );
     }
-    aStatusStr.append( OUString::number(nPageNum) + " / " + OUString::number(nPageCnt) );
+    aStatusStr.append( OUString::number(nPageNum) ).append( " / " ).append( OUString::number(nPageCnt) );
     return aStatusStr.makeStringAndClear();
 }
 
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index be2648ead428..82da48256cc4 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -57,21 +57,21 @@ void UITestLogger::logCommand(const OUString& rAction, const css::uno::Sequence<
             {
                 sal_Int32 nValue = 0;
                 rProp.Value >>= nValue;
-                aBuffer.append("\"" + rProp.Name + "\": ");
-                aBuffer.append(OUString::number(nValue) + ", ");
+                aBuffer.append("\"").append(rProp.Name).append("\": ");
+                aBuffer.append(OUString::number(nValue)).append(", ");
             }
             else if (aTypeName == "unsigned long")
             {
                 sal_uInt32 nValue = 0;
                 rProp.Value >>= nValue;
-                aBuffer.append("\"" + rProp.Name + "\": ");
-                aBuffer.append(OUString::number(nValue) + ", ");
+                aBuffer.append("\"").append(rProp.Name).append("\": ");
+                aBuffer.append(OUString::number(nValue)).append(", ");
             }
             else if (aTypeName == "boolean")
             {
                 bool bValue = false;
                 rProp.Value >>= bValue;
-                aBuffer.append("\"" + rProp.Name + "\": ");
+                aBuffer.append("\"").append(rProp.Name).append("\": ");
                 if (bValue)
                     aBuffer.append("True, ");
                 else
@@ -231,7 +231,7 @@ OUString StringMapToOUString(const std::map<OUString, OUString>& rParameters)
     {
         if (itr != rParameters.begin())
             aParameterString.append(", ");
-        aParameterString.append("\"" + itr->first + "\": \"" + itr->second + "\"");
+        aParameterString.append("\"").append(itr->first).append("\": \"").append(itr->second).append("\"");
     }
 
     aParameterString.append("}");
diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx
index 6efa20d7b5c5..1229b5f922d0 100644
--- a/xmloff/source/draw/animationexport.cxx
+++ b/xmloff/source/draw/animationexport.cxx
@@ -1235,7 +1235,7 @@ void AnimationsExporterImpl::exportAnimate( const Reference< XAnimate >& xAnimat
                     if( !sTmp.isEmpty() )
                         sTmp.append( ';' );
 
-                    sTmp.append( OUString::number(p->Time) + "," + OUString::number(p->Progress) );
+                    sTmp.append( OUString::number(p->Time) ).append( "," ).append( OUString::number(p->Progress) );
 
                     p++;
                 }
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 36342fb1c66b..9936f974183d 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -3758,7 +3758,7 @@ void ExportParameter( OUStringBuffer& rStrBuffer, const css::drawing::EnhancedCu
         {
             case css::drawing::EnhancedCustomShapeParameterType::EQUATION :
             {
-                rStrBuffer.append( "?f" + OUString::number( nValue ) );
+                rStrBuffer.append( "?f" ).append(OUString::number( nValue ) );
             }
             break;
 
diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx
index 6a348b436006..debf07244872 100644
--- a/xmloff/source/style/xmlbahdl.cxx
+++ b/xmloff/source/style/xmlbahdl.cxx
@@ -488,7 +488,9 @@ bool XMLColorPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, cons
         Sequence< double > aHSL;
         if( (rValue >>= aHSL) && (aHSL.getLength() == 3) )
         {
-            aOut.append( "hsl(" + OUString::number(aHSL[0]) + "," + OUString::number(aHSL[1] * 100.0) + "%," + OUString::number(aHSL[2] * 100.0) + "%)" );
+            aOut.append( "hsl(" ).append( OUString::number(aHSL[0]) ).append( "," )
+                .append( OUString::number(aHSL[1] * 100.0) ).append( "%," )
+                .append( OUString::number(aHSL[2] * 100.0) ).append( "%)" );
             rStrExpValue = aOut.makeStringAndClear();
 
             bRet = true;
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index 80dd7e979dc9..e86521ca7f4a 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -949,7 +949,7 @@ void SvXMLExportPropertyMapper::_exportXML(
                                 pNamespaceMap = pNewNamespaceMap;
                             }
                             pNewNamespaceMap->Add( sPrefix, sNamespace );
-                            sNameBuffer.append( GetXMLToken(XML_XMLNS) + ":" + sPrefix );
+                            sNameBuffer.append( GetXMLToken(XML_XMLNS) ).append( ":" ).append( sPrefix );
                             rAttrList.AddAttribute( sNameBuffer.makeStringAndClear(),
                                                     sNamespace );
                         }
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 59b48edf7c70..17a86b0ebfaf 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -2044,7 +2044,7 @@ void SvXMLNumFormatContext::AddCurrency( const OUString& rContent, LanguageType
         if ( nLang != LANGUAGE_SYSTEM )
         {
             //  '-' sign and language code in hex:
-            aFormatCode.append("-" + OUString::number(sal_uInt16(nLang), 16).toAsciiUpperCase());
+            aFormatCode.append("-").append(OUString::number(sal_uInt16(nLang), 16).toAsciiUpperCase());
         }
 
         aFormatCode.append( ']' );    // end of "new" currency symbol
@@ -2075,7 +2075,7 @@ void SvXMLNumFormatContext::AddNfKeyword( sal_uInt16 nIndex )
         if ( !bTruncate && !bHasDateTime )
         {
             //  with truncate-on-overflow = false, add "[]" to first time part
-            aFormatCode.append("[" + sKeyword + "]");
+            aFormatCode.append("[").append(sKeyword).append("]");
         }
         else
         {
@@ -2200,7 +2200,7 @@ void SvXMLNumFormatContext::AddCondition( const sal_Int32 nIndex )
                     sRealCond = sRealCond.replaceAt( nPos, 1, rDecSep );
                 }
             }
-            aConditions.append("[" + sRealCond + "]");
+            aConditions.append("[").append(sRealCond).append("]");
         }
 
         const SvNumberformat* pFormat = pFormatter->GetEntry(l_nKey);
diff --git a/xmloff/source/xforms/xformsexport.cxx b/xmloff/source/xforms/xformsexport.cxx
index 69a8d703f117..d31ddcc9a1a2 100644
--- a/xmloff/source/xforms/xformsexport.cxx
+++ b/xmloff/source/xforms/xformsexport.cxx
@@ -659,9 +659,9 @@ OUString xforms_bool( const Any& rAny )
 
 void xforms_formatDate( OUStringBuffer& aBuffer, const util::Date& rDate )
 {
-    aBuffer.append(OUString::number(static_cast<sal_Int32>( rDate.Year ) )
-            + "-" + OUString::number(static_cast<sal_Int32>( rDate.Month ))
-            + "-" + OUString::number(static_cast<sal_Int32>( rDate.Day )) );
+    aBuffer.append(OUString::number(static_cast<sal_Int32>( rDate.Year ) ))
+            .append("-").append(OUString::number(static_cast<sal_Int32>( rDate.Month )))
+            .append("-").append(OUString::number(static_cast<sal_Int32>( rDate.Day )));
 }
 
 void xforms_formatTime( OUStringBuffer& aBuffer, const css::util::Time& rTime )
diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx b/xmlsecurity/source/dialogs/resourcemanager.cxx
index 3b2db2a800eb..16ca346bcbc3 100644
--- a/xmlsecurity/source/dialogs/resourcemanager.cxx
+++ b/xmlsecurity/source/dialogs/resourcemanager.cxx
@@ -91,7 +91,7 @@ namespace XmlSec
                 s2.append('\n');
             }
             s1.append(i->second);
-            s2.append(i->first + " = " + i->second);
+            s2.append(i->first).append(" = ").append(i->second);
         }
         return make_pair(s1.makeStringAndClear(), s2.makeStringAndClear());
     }


More information about the Libreoffice-commits mailing list