[Libreoffice-commits] core.git: chart2/qa codemaker/source comphelper/source compilerplugins/clang connectivity/source cppuhelper/source cppu/source cui/source editeng/source filter/source i18npool/source idlc/inc include/oox include/rtl jvmfwk/source l10ntools/source oox/source opencl/source package/qa sal/osl sal/qa sal/rtl sc/qa sc/source sd/qa sd/source sfx2/source shell/source stoc/source svl/qa svtools/source svx/source sw/qa sw/source test/source ucb/source unotools/source vcl/source vcl/unx xmloff/source xmlsecurity/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Oct 14 06:27:03 UTC 2019


 chart2/qa/extras/chart2dump/chart2dump.cxx                  |    4 
 codemaker/source/cppumaker/cppuoptions.cxx                  |   20 +-
 codemaker/source/javamaker/javaoptions.cxx                  |   14 -
 comphelper/source/misc/storagehelper.cxx                    |    2 
 compilerplugins/clang/stringadd.cxx                         |   89 ++++++++++--
 compilerplugins/clang/test/stringadd.cxx                    |   44 +++++
 connectivity/source/drivers/firebird/Util.cxx               |    2 
 cppu/source/uno/EnvStack.cxx                                |    2 
 cppu/source/uno/lbenv.cxx                                   |    2 
 cppuhelper/source/implbase_ex.cxx                           |    2 
 cui/source/dialogs/FontFeaturesDialog.cxx                   |    3 
 cui/source/dialogs/about.cxx                                |    2 
 editeng/source/items/borderline.cxx                         |    2 
 editeng/source/items/frmitems.cxx                           |   20 +-
 editeng/source/items/itemtype.cxx                           |    4 
 editeng/source/items/textitem.cxx                           |    2 
 filter/source/msfilter/rtfutil.cxx                          |    2 
 i18npool/source/breakiterator/breakiterator_unicode.cxx     |    2 
 i18npool/source/localedata/localedata.cxx                   |    2 
 idlc/inc/astsequence.hxx                                    |    2 
 include/oox/export/utils.hxx                                |    2 
 include/rtl/stringconcat.hxx                                |   12 +
 jvmfwk/source/fwkbase.cxx                                   |   18 +-
 l10ntools/source/po.cxx                                     |    8 -
 l10ntools/source/pocheck.cxx                                |   20 +-
 oox/source/export/drawingml.cxx                             |    8 -
 opencl/source/openclwrapper.cxx                             |    2 
 package/qa/cppunit/test_package.cxx                         |    4 
 sal/osl/unx/file_misc.cxx                                   |    2 
 sal/qa/osl/file/osl_File.cxx                                |    8 -
 sal/rtl/uri.cxx                                             |    2 
 sc/qa/unit/helper/shared_test_impl.hxx                      |    2 
 sc/qa/unit/subsequent_export-test.cxx                       |    6 
 sc/qa/unit/ucalc.cxx                                        |    2 
 sc/qa/unit/ucalc_formula.cxx                                |    6 
 sc/source/filter/ftools/ftools.cxx                          |    8 -
 sc/source/filter/html/htmlexp.cxx                           |    2 
 sc/source/filter/lotus/lotform.cxx                          |    2 
 sc/source/ui/dbgui/scuiasciiopt.cxx                         |    2 
 sc/source/ui/miscdlgs/acredlin.cxx                          |    2 
 sc/source/ui/navipi/content.cxx                             |    6 
 sc/source/ui/view/tabview5.cxx                              |    2 
 sd/qa/unit/export-tests.cxx                                 |    8 -
 sd/source/filter/ppt/pptin.cxx                              |    2 
 sd/source/ui/dlg/copydlg.cxx                                |   16 +-
 sfx2/source/control/msg.cxx                                 |    2 
 sfx2/source/statbar/stbitem.cxx                             |    2 
 sfx2/source/view/lokhelper.cxx                              |    6 
 shell/source/unix/exec/shellexec.cxx                        |    2 
 stoc/source/corereflection/criface.cxx                      |    4 
 svl/qa/unit/svl.cxx                                         |    8 -
 svtools/source/dialogs/addresstemplate.cxx                  |    4 
 svx/source/svdraw/svdmrkv.cxx                               |    2 
 sw/qa/extras/globalfilter/globalfilter.cxx                  |   30 ++--
 sw/qa/extras/inc/swmodeltestbase.hxx                        |    4 
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx                  |    2 
 sw/qa/extras/uiwriter/uiwriter2.cxx                         |    4 
 sw/qa/extras/ww8export/ww8export2.cxx                       |    2 
 sw/source/core/fields/docufld.cxx                           |    2 
 sw/source/core/fields/reffld.cxx                            |    2 
 sw/source/filter/html/css1atr.cxx                           |    8 -
 sw/source/filter/html/htmlatr.cxx                           |    6 
 sw/source/filter/html/htmlfld.cxx                           |    3 
 sw/source/filter/html/htmlforw.cxx                          |   16 +-
 sw/source/filter/html/htmlnumwriter.cxx                     |    2 
 sw/source/filter/html/wrthtml.cxx                           |    2 
 sw/source/filter/ww8/docxattributeoutput.cxx                |    2 
 sw/source/filter/ww8/rtfattributeoutput.cxx                 |    2 
 sw/source/filter/ww8/wrtw8nds.cxx                           |    4 
 sw/source/filter/ww8/ww8atr.cxx                             |    2 
 sw/source/filter/ww8/ww8scan.cxx                            |    2 
 sw/source/ui/index/cnttab.cxx                               |    2 
 sw/source/uibase/app/docstyle.cxx                           |    2 
 sw/source/uibase/misc/redlndlg.cxx                          |    2 
 test/source/sheet/xsheetauditing.cxx                        |    3 
 test/source/xmltesttools.cxx                                |   26 +--
 ucb/source/ucp/ftp/ftpurl.cxx                               |    4 
 unotools/source/i18n/resmgr.cxx                             |    2 
 vcl/source/font/OpenTypeFeatureDefinitonList.cxx            |    2 
 vcl/source/window/builder.cxx                               |    2 
 vcl/unx/generic/fontmanager/fontconfig.cxx                  |    2 
 vcl/unx/generic/fontmanager/helper.cxx                      |    2 
 vcl/unx/generic/print/glyphset.cxx                          |    5 
 xmloff/source/core/xmlexp.cxx                               |    3 
 xmloff/source/style/prstylecond.cxx                         |    5 
 xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx |    2 
 86 files changed, 338 insertions(+), 225 deletions(-)

New commits:
commit 9b5dad13b56bdde7c40970351af3da3a2c3c9350
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sun Oct 13 08:47:47 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Oct 14 08:26:14 2019 +0200

    loplugin:stringadd look for unnecessary temporaries
    
    which defeat the *StringConcat optimisation.
    Also make StringConcat conversions treat a nullptr as an empty string,
    to match the O*String(char*) constructors.
    
    Change-Id: If45f5b4b6a535c97bfeeacd9ec472a7603a52e5b
    Reviewed-on: https://gerrit.libreoffice.org/80724
    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 a03f98a0527d..faf8ead6256a 100644
--- a/chart2/qa/extras/chart2dump/chart2dump.cxx
+++ b/chart2/qa/extras/chart2dump/chart2dump.cxx
@@ -150,7 +150,7 @@ protected:
         std::string sTemp;
         getline(m_aReferenceFile, sTemp);
         OString sAssertMessage =
-            OString("The reference file does not contain the right content. Maybe it needs an update:")
+            "The reference file does not contain the right content. Maybe it needs an update:"
             + OUStringToOString(m_sTestFileName, RTL_TEXTENCODING_UTF8);
         CPPUNIT_ASSERT_EQUAL_MESSAGE(sAssertMessage.getStr(), OUString("// " + sCheck), OUString(sTemp.data(), sTemp.length(), RTL_TEXTENCODING_UTF8));
         getline(m_aReferenceFile, sTemp);
@@ -172,7 +172,7 @@ protected:
         std::string sTemp;
         getline(m_aReferenceFile, sTemp);
         OString sAssertMessage =
-            OString("The reference file does not contain the right content. Maybe it needs an update:")
+            "The reference file does not contain the right content. Maybe it needs an update:"
             + OUStringToOString(m_sTestFileName, RTL_TEXTENCODING_UTF8);
         CPPUNIT_ASSERT_EQUAL_MESSAGE(sAssertMessage.getStr(), OUString("/// " + sNote), OUString(sTemp.data(), sTemp.length(), RTL_TEXTENCODING_UTF8));
     }
diff --git a/codemaker/source/cppumaker/cppuoptions.cxx b/codemaker/source/cppumaker/cppuoptions.cxx
index 0e25ae2f5da7..05c941b2c68a 100644
--- a/codemaker/source/cppumaker/cppuoptions.cxx
+++ b/codemaker/source/cppumaker/cppuoptions.cxx
@@ -76,7 +76,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
                             OString tmp("'-O', please check");
                             if (i <= ac - 1)
                             {
-                                tmp += " your input '" + OString(av[i+1]) + "'";
+                                tmp += OStringLiteral(" your input '") + av[i+1] + "'";
                             }
 
                             throw IllegalArgument(tmp);
@@ -92,7 +92,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
                 case 'n':
                     if (av[i][2] != 'D' || av[i][3] != '\0')
                     {
-                        OString tmp = "'-nD', please check your input '" + OString(av[i]) + "'";
+                        OString tmp = OStringLiteral("'-nD', please check your input '") + av[i] + "'";
                         throw IllegalArgument(tmp);
                     }
 
@@ -111,7 +111,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
                             OString tmp("'-T', please check");
                             if (i <= ac - 1)
                             {
-                                tmp += " your input '" + OString(av[i+1]) + "'";
+                                tmp += OStringLiteral(" your input '") + av[i+1] + "'";
                             }
 
                             throw IllegalArgument(tmp);
@@ -138,7 +138,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
                         OString tmp("'-L', please check");
                         if (i <= ac - 1)
                         {
-                            tmp += " your input '" + OString(av[i]) + "'";
+                            tmp += OStringLiteral(" your input '") + av[i] + "'";
                         }
 
                         throw IllegalArgument(tmp);
@@ -158,7 +158,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
                             OString tmp("'-CS', please check");
                             if (i <= ac - 1)
                             {
-                                tmp += " your input '" + OString(av[i]) + "'";
+                                tmp += OStringLiteral(" your input '") + av[i] + "'";
                             }
 
                             throw IllegalArgument(tmp);
@@ -176,7 +176,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
                         OString tmp("'-C', please check");
                         if (i <= ac - 1)
                         {
-                            tmp += " your input '" + OString(av[i]) + "'";
+                            tmp += OStringLiteral(" your input '") + av[i] + "'";
                         }
 
                         throw IllegalArgument(tmp);
@@ -196,7 +196,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
                             OString tmp("'-Gc', please check");
                             if (i <= ac - 1)
                             {
-                                tmp += " your input '" + OString(av[i]) + "'";
+                                tmp += OStringLiteral(" your input '") + av[i] + "'";
                             }
 
                             throw IllegalArgument(tmp);
@@ -210,7 +210,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
                         OString tmp("'-G', please check");
                         if (i <= ac - 1)
                         {
-                            tmp += " your input '" + OString(av[i]) + "'";
+                            tmp += OStringLiteral(" your input '") + av[i] + "'";
                         }
 
                         throw IllegalArgument(tmp);
@@ -232,7 +232,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
                             OString tmp("'-X', please check");
                             if (i <= ac - 1)
                             {
-                                tmp += " your input '" + OString(av[i+1]) + "'";
+                                tmp += OStringLiteral(" your input '") + av[i+1] + "'";
                             }
 
                             throw IllegalArgument(tmp);
@@ -248,7 +248,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
                 }
 
                 default:
-                    throw IllegalArgument("the option is unknown" + OString(av[i]));
+                    throw IllegalArgument(OStringLiteral("the option is unknown") + av[i]);
             }
         } else
         {
diff --git a/codemaker/source/javamaker/javaoptions.cxx b/codemaker/source/javamaker/javaoptions.cxx
index 4783087ecd0a..795d1bbf8955 100644
--- a/codemaker/source/javamaker/javaoptions.cxx
+++ b/codemaker/source/javamaker/javaoptions.cxx
@@ -71,7 +71,7 @@ bool JavaOptions::initOptions(int ac, char* av[], bool bCmdFile)
                             OString tmp("'-O', please check");
                             if (i <= ac - 1)
                             {
-                                tmp += " your input '" + OString(av[i+1]) + "'";
+                                tmp += OStringLiteral(" your input '") + av[i+1] + "'";
                             }
 
                             throw IllegalArgument(tmp);
@@ -86,7 +86,7 @@ bool JavaOptions::initOptions(int ac, char* av[], bool bCmdFile)
                 case 'n':
                     if (av[i][2] != 'D' || av[i][3] != '\0')
                     {
-                        OString tmp("'-nD', please check your input '" + OString(av[i]) + "'");
+                        OString tmp(OStringLiteral("'-nD', please check your input '") + av[i] + "'");
                         throw IllegalArgument(tmp);
                     }
 
@@ -104,7 +104,7 @@ bool JavaOptions::initOptions(int ac, char* av[], bool bCmdFile)
                             OString tmp("'-T', please check");
                             if (i <= ac - 1)
                             {
-                                tmp += " your input '" + OString(av[i+1]) + "'";
+                                tmp += OStringLiteral(" your input '") + av[i+1] + "'";
                             }
 
                             throw IllegalArgument(tmp);
@@ -131,7 +131,7 @@ bool JavaOptions::initOptions(int ac, char* av[], bool bCmdFile)
                             OString tmp("'-Gc', please check");
                             if (i <= ac - 1)
                             {
-                                tmp += " your input '" + OString(av[i]) + "'";
+                                tmp += OStringLiteral(" your input '") + av[i] + "'";
                             }
 
                             throw IllegalArgument(tmp);
@@ -144,7 +144,7 @@ bool JavaOptions::initOptions(int ac, char* av[], bool bCmdFile)
                         OString tmp("'-G', please check");
                         if (i <= ac - 1)
                         {
-                            tmp += " your input '" + OString(av[i]) + "'";
+                            tmp += OStringLiteral(" your input '") + av[i] + "'";
                         }
 
                         throw IllegalArgument(tmp);
@@ -165,7 +165,7 @@ bool JavaOptions::initOptions(int ac, char* av[], bool bCmdFile)
                             OString tmp("'-X', please check");
                             if (i <= ac - 1)
                             {
-                                tmp += " your input '" + OString(av[i+1]) + "'";
+                                tmp += OStringLiteral(" your input '") + av[i+1] + "'";
                             }
 
                             throw IllegalArgument(tmp);
@@ -180,7 +180,7 @@ bool JavaOptions::initOptions(int ac, char* av[], bool bCmdFile)
                 }
 
                 default:
-                    throw IllegalArgument("the option is unknown" + OString(av[i]));
+                    throw IllegalArgument(OStringLiteral("the option is unknown") + av[i]);
             }
         } else
         {
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index f7180bdd230a..4c9d55b68251 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -284,7 +284,7 @@ sal_Int32 OStorageHelper::GetXStorageFormat(
     else
     {
         // the mediatype is not known
-        OUString aMsg = OUString(OSL_THIS_FUNC)
+        OUString aMsg = OUStringLiteral(OSL_THIS_FUNC)
                       + ":"
                       + OUString::number(__LINE__)
                       + ": unknown media type '"
diff --git a/compilerplugins/clang/stringadd.cxx b/compilerplugins/clang/stringadd.cxx
index 641000e28ecf..a3435bab7cb5 100644
--- a/compilerplugins/clang/stringadd.cxx
+++ b/compilerplugins/clang/stringadd.cxx
@@ -68,11 +68,13 @@ public:
     }
 
     bool VisitCompoundStmt(CompoundStmt const*);
+    bool VisitCXXOperatorCallExpr(CXXOperatorCallExpr const*);
 
 private:
     const VarDecl* findAssignOrAdd(Stmt const*);
-    Expr const* ignore(Expr const*);
     void checkForCompoundAssign(Stmt const* stmt1, Stmt const* stmt2, VarDecl const* varDecl);
+
+    Expr const* ignore(Expr const*);
     std::string getSourceAsString(SourceLocation startLoc, SourceLocation endLoc);
     bool isSideEffectFree(Expr const*);
 };
@@ -175,6 +177,65 @@ void StringAdd::checkForCompoundAssign(Stmt const* stmt1, Stmt const* stmt2, Var
         << stmt2->getSourceRange();
 }
 
+// Check for generating temporaries when adding strings
+//
+bool StringAdd::VisitCXXOperatorCallExpr(CXXOperatorCallExpr const* operatorCall)
+{
+    if (ignoreLocation(operatorCall))
+        return true;
+    // TODO PlusEqual seems to generate temporaries, does not do the StringConcat optimisation
+    if (operatorCall->getOperator() != OO_Plus)
+        return true;
+    auto tc = loplugin::TypeCheck(operatorCall->getType()->getUnqualifiedDesugaredType());
+    if (!tc.Struct("OUStringConcat").Namespace("rtl").GlobalNamespace()
+        && !tc.Struct("OStringConcat").Namespace("rtl").GlobalNamespace()
+        && !tc.Class("OUString").Namespace("rtl").GlobalNamespace()
+        && !tc.Class("OString").Namespace("rtl").GlobalNamespace())
+        return true;
+
+    auto check = [operatorCall, this, &tc](const MaterializeTemporaryExpr* matTempExpr) {
+        auto tc3 = loplugin::TypeCheck(matTempExpr->getType());
+        if (!tc3.Class("OUString").Namespace("rtl").GlobalNamespace()
+            && !tc3.Class("OString").Namespace("rtl").GlobalNamespace())
+            return;
+        if (auto bindTemp
+            = dyn_cast<CXXBindTemporaryExpr>(matTempExpr->GetTemporaryExpr()->IgnoreCasts()))
+        {
+            // ignore temporaries returned from function calls
+            if (isa<CallExpr>(bindTemp->getSubExpr()))
+                return;
+            // we don't have OStringLiteral1, so char needs to generate a temporary
+            if (tc.Class("OString").Namespace("rtl").GlobalNamespace()
+                || tc.Struct("OStringConcat").Namespace("rtl").GlobalNamespace())
+                if (auto cxxConstruct = dyn_cast<CXXConstructExpr>(bindTemp->getSubExpr()))
+                    if (loplugin::TypeCheck(
+                            cxxConstruct->getConstructor()->getParamDecl(0)->getType())
+                            .Char())
+                        return;
+            // calls where we pass in an explicit character encoding
+            if (auto cxxTemp = dyn_cast<CXXTemporaryObjectExpr>(bindTemp->getSubExpr()))
+                if (cxxTemp->getNumArgs() > 1)
+                    return;
+        }
+        // conditional operators ( a ? b : c ) will result in temporaries
+        if (isa<ConditionalOperator>(
+                matTempExpr->GetTemporaryExpr()->IgnoreCasts()->IgnoreParens()))
+            return;
+        report(DiagnosticsEngine::Warning, "avoid constructing temporary copies during +",
+               compat::getBeginLoc(matTempExpr))
+            << matTempExpr->getSourceRange();
+        //        operatorCall->dump();
+        //        matTempExpr->getType()->dump();
+        //        operatorCall->getType()->getUnqualifiedDesugaredType()->dump();
+    };
+
+    if (auto matTempExpr = dyn_cast<MaterializeTemporaryExpr>(operatorCall->getArg(0)))
+        check(matTempExpr);
+    if (auto matTempExpr = dyn_cast<MaterializeTemporaryExpr>(operatorCall->getArg(1)))
+        check(matTempExpr);
+    return true;
+}
+
 Expr const* StringAdd::ignore(Expr const* expr)
 {
     return compat::IgnoreImplicit(compat::IgnoreImplicit(expr)->IgnoreParens());
@@ -183,6 +244,9 @@ Expr const* StringAdd::ignore(Expr const* expr)
 bool StringAdd::isSideEffectFree(Expr const* expr)
 {
     expr = ignore(expr);
+    // I don't think the OUStringAppend functionality can handle this efficiently
+    if (isa<ConditionalOperator>(expr))
+        return false;
     // Multiple statements have a well defined evaluation order (sequence points between them)
     // but a single expression may be evaluated in arbitrary order;
     // if there are side effects in one of the sub-expressions that have an effect on another subexpression,
@@ -204,15 +268,20 @@ bool StringAdd::isSideEffectFree(Expr const* expr)
 
     if (auto callExpr = dyn_cast<CallExpr>(expr))
     {
-        // check for calls through OUString::number
+        // check for calls through OUString::number/OUString::unacquired
         if (auto calleeMethodDecl = dyn_cast_or_null<CXXMethodDecl>(callExpr->getCalleeDecl()))
-            if (calleeMethodDecl && calleeMethodDecl->getIdentifier()
-                && calleeMethodDecl->getName() == "number")
+            if (calleeMethodDecl && calleeMethodDecl->getIdentifier())
             {
-                auto tc = loplugin::TypeCheck(calleeMethodDecl->getParent());
-                if (tc.Class("OUString") || tc.Class("OString"))
-                    if (isSideEffectFree(callExpr->getArg(0)))
-                        return true;
+                auto name = calleeMethodDecl->getName();
+                if (name == "number" || name == "unacquired")
+                {
+                    auto tc = loplugin::TypeCheck(calleeMethodDecl->getParent());
+                    if (tc.Class("OUString") || tc.Class("OString"))
+                    {
+                        if (isSideEffectFree(callExpr->getArg(0)))
+                            return true;
+                    }
+                }
             }
         if (auto calleeFunctionDecl = dyn_cast_or_null<FunctionDecl>(callExpr->getCalleeDecl()))
             if (calleeFunctionDecl && calleeFunctionDecl->getIdentifier())
@@ -222,8 +291,8 @@ bool StringAdd::isSideEffectFree(Expr const* expr)
                 if (name == "OUStringToOString" || name == "OStringToOUString")
                     if (isSideEffectFree(callExpr->getArg(0)))
                         return true;
-                // check for calls through *ResId
-                if (name.endswith("ResId"))
+                // whitelist some known-safe methods
+                if (name.endswith("ResId") || name == "GetXMLToken")
                     if (isSideEffectFree(callExpr->getArg(0)))
                         return true;
             }
diff --git a/compilerplugins/clang/test/stringadd.cxx b/compilerplugins/clang/test/stringadd.cxx
index c9ef37f09bfd..0e0986258254 100644
--- a/compilerplugins/clang/test/stringadd.cxx
+++ b/compilerplugins/clang/test/stringadd.cxx
@@ -7,8 +7,13 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include <rtl/ustring.hxx>
+#include <rtl/strbuf.hxx>
 #include <rtl/string.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/ustring.hxx>
+
+// ---------------------------------------------------------------
+// += tests
 
 namespace test1
 {
@@ -147,4 +152,41 @@ void g(int x, const Foo& aValidation)
 }
 }
 
+// ---------------------------------------------------------------
+// detecting OUString temporary construction in +
+
+namespace test9
+{
+OUString getByValue();
+const OUString& getByRef();
+void f1(OUString s, OUString t, int i, const char* pChar)
+{
+    // no warning expected
+    t = t + "xxx";
+    // expected-error at +1 {{avoid constructing temporary copies during + [loplugin:stringadd]}}
+    s = s + OUString("xxx");
+    // expected-error at +1 {{avoid constructing temporary copies during + [loplugin:stringadd]}}
+    s = s + OUString(getByRef());
+
+    // no warning expected
+    OUString a;
+    a = a + getByValue();
+
+    // no warning expected
+    OUString b;
+    b = b + (i == 1 ? "aaa" : "bbb");
+
+    // no warning expected
+    OUString c;
+    c = c + OUString(pChar, strlen(pChar), RTL_TEXTENCODING_UTF8);
+}
+void f2(char ch)
+{
+    OString s;
+    // expected-error at +1 {{avoid constructing temporary copies during + [loplugin:stringadd]}}
+    s = s + OString("xxx");
+    // no warning expected, no OStringLiteral1
+    s = s + OString(ch);
+}
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx
index eb7216e9d1c5..0c63c048d32e 100644
--- a/connectivity/source/drivers/firebird/Util.cxx
+++ b/connectivity/source/drivers/firebird/Util.cxx
@@ -395,7 +395,7 @@ OUString firebird::escapeWith( const OUString& sText, const char aKey, const cha
     while( (aIndex = sRet.indexOf(aKey, aIndex)) > 0 &&
             aIndex < sRet.getLength())
     {
-            sRet = sRet.replaceAt(aIndex, 1, OUString(aEscapeChar) + OUString(aKey)  );
+            sRet = sRet.replaceAt(aIndex, 1, OUStringLiteral1(aEscapeChar) + OUStringLiteral1(aKey)  );
             aIndex+= 2;
     }
 
diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx
index 5757023cbb88..748557e8b98a 100644
--- a/cppu/source/uno/EnvStack.cxx
+++ b/cppu/source/uno/EnvStack.cxx
@@ -119,7 +119,7 @@ extern "C" void SAL_CALL uno_getCurrentEnvironment(uno_Environment ** ppEnv, rtl
 
     if (pTypeName && rtl_uString_getLength(pTypeName))
     {
-        OUString envDcp = OUString(pTypeName) + currPurpose;
+        OUString envDcp = OUString::unacquired(&pTypeName) + currPurpose;
 
         uno_getEnvironment(ppEnv, envDcp.pData, nullptr);
     }
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index 71a8e8cb484d..fd1464d5244f 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -933,7 +933,7 @@ void EnvironmentsData::registerEnvironment( uno_Environment ** ppEnv )
 
     OUString aKey =
         OUString::number( reinterpret_cast< sal_IntPtr >(pEnv->pContext) ) +
-        OUString(pEnv->pTypeName);
+        OUString::unacquired(&pEnv->pTypeName);
 
     // try to find registered environment
     OUString2EnvironmentMap::const_iterator const iFind(
diff --git a/cppuhelper/source/implbase_ex.cxx b/cppuhelper/source/implbase_ex.cxx
index d46f40ddb9b4..00eeaf376618 100644
--- a/cppuhelper/source/implbase_ex.cxx
+++ b/cppuhelper/source/implbase_ex.cxx
@@ -200,7 +200,7 @@ static void * queryDeepNoXInterface(
         }
         else
         {
-            OUString msg( "cannot get type description for type \"" + OUString(pEntries[ n ].m_type.typeRef->pTypeName) + "\"!" );
+            OUString msg( "cannot get type description for type \"" + OUString::unacquired(&pEntries[ n ].m_type.typeRef->pTypeName) + "\"!" );
             SAL_WARN( "cppuhelper", msg );
             throw RuntimeException( msg );
         }
diff --git a/cui/source/dialogs/FontFeaturesDialog.cxx b/cui/source/dialogs/FontFeaturesDialog.cxx
index 957a2c8e1228..6e9831561ce0 100644
--- a/cui/source/dialogs/FontFeaturesDialog.cxx
+++ b/cui/source/dialogs/FontFeaturesDialog.cxx
@@ -206,7 +206,8 @@ OUString FontFeaturesDialog::createFontNameWithFeatures()
     }
     sResultFontName = vcl::font::trimFontNameFeatures(m_sFontName);
     if (!sNameSuffix.isEmpty())
-        sResultFontName += OUString(vcl::font::FeaturePrefix) + sNameSuffix.makeStringAndClear();
+        sResultFontName
+            += OUStringLiteral1(vcl::font::FeaturePrefix) + sNameSuffix.makeStringAndClear();
     return sResultFontName;
 }
 
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx
index 0dc219df8156..06ead113ddb8 100644
--- a/cui/source/dialogs/about.cxx
+++ b/cui/source/dialogs/about.cxx
@@ -224,7 +224,7 @@ OUString AboutDialog::GetLocaleString()
     if ( pLocale && pLocale->Language )
     {
         if (pLocale->Country && rtl_uString_getLength( pLocale->Country) > 0)
-            aLocaleStr = OUString(pLocale->Language) + "_" + OUString(pLocale->Country);
+            aLocaleStr = OUString::unacquired(&pLocale->Language) + "_" + OUString::unacquired(&pLocale->Country);
         else
             aLocaleStr = OUString(pLocale->Language);
         if (pLocale->Variant && rtl_uString_getLength( pLocale->Variant) > 0)
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx
index 33cd0ca6de31..00fff9797f28 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -642,7 +642,7 @@ OUString SvxBorderLine::GetValueString(MapUnit eSrcUnit,
         RID_DASH_DOT,
         RID_DASH_DOT_DOT
     };
-    OUString aStr = "(" + ::GetColorString( aColor ) + OUString(cpDelim);
+    OUString aStr = "(" + ::GetColorString( aColor ) + cpDelim;
 
     if ( static_cast<int>(m_nStyle) < int(SAL_N_ELEMENTS(aStyleIds)) )
     {
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 1d74227313fe..7ee4258df96f 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -799,7 +799,7 @@ bool SvxULSpaceItem::GetPresentation
                 rText += GetMetricText( static_cast<long>(nUpper), eCoreUnit, ePresUnit, &rIntl ) +
                         " " + EditResId(GetMetricId(ePresUnit));
             }
-            rText += OUString(cpDelim) + EditResId(RID_SVXITEMS_ULSPACE_LOWER);
+            rText += cpDelim + EditResId(RID_SVXITEMS_ULSPACE_LOWER);
             if ( 100 != nPropLower )
             {
                 rText += unicode::formatPercent(nPropLower,
@@ -955,12 +955,12 @@ bool SvxProtectItem::GetPresentation
 
     if ( bCntnt )
         pId = RID_SVXITEMS_PROT_CONTENT_TRUE;
-    rText = EditResId(pId) + OUString(cpDelim);
+    rText = EditResId(pId) + cpDelim;
     pId = RID_SVXITEMS_PROT_SIZE_FALSE;
 
     if ( bSize )
         pId = RID_SVXITEMS_PROT_SIZE_TRUE;
-    rText += EditResId(pId) + OUString(cpDelim);
+    rText += EditResId(pId) + cpDelim;
     pId = RID_SVXITEMS_PROT_POS_FALSE;
 
     if ( bPos )
@@ -1166,15 +1166,15 @@ bool SvxShadowItem::GetPresentation
     {
         case SfxItemPresentation::Nameless:
         {
-            rText = ::GetColorString( aShadowColor ) + OUString(cpDelim);
+            rText = ::GetColorString( aShadowColor ) + cpDelim;
             const char* pId = RID_SVXITEMS_TRANSPARENT_FALSE;
 
             if ( aShadowColor.GetTransparency() )
                 pId = RID_SVXITEMS_TRANSPARENT_TRUE;
             rText += EditResId(pId) +
-                    OUString(cpDelim) +
+                    cpDelim +
                     GetMetricText( static_cast<long>(nWidth), eCoreUnit, ePresUnit, &rIntl ) +
-                    OUString(cpDelim) +
+                    cpDelim +
                     EditResId(RID_SVXITEMS_SHADOW[static_cast<int>(eLocation)]);
             return true;
         }
@@ -1182,16 +1182,16 @@ bool SvxShadowItem::GetPresentation
         {
             rText = EditResId(RID_SVXITEMS_SHADOW_COMPLETE) +
                     ::GetColorString( aShadowColor ) +
-                    OUString(cpDelim);
+                    cpDelim;
 
             const char* pId = RID_SVXITEMS_TRANSPARENT_FALSE;
             if ( aShadowColor.GetTransparency() )
                 pId = RID_SVXITEMS_TRANSPARENT_TRUE;
             rText += EditResId(pId) +
-                    OUString(cpDelim) +
+                    cpDelim +
                     GetMetricText( static_cast<long>(nWidth), eCoreUnit, ePresUnit, &rIntl ) +
                     " " + EditResId(GetMetricId(ePresUnit)) +
-                    OUString(cpDelim) +
+                    cpDelim +
                     EditResId(RID_SVXITEMS_SHADOW[static_cast<int>(eLocation)]);
             return true;
         }
@@ -3047,7 +3047,7 @@ bool SvxBrushItem::GetPresentation
 {
     if ( GPOS_NONE  == eGraphicPos )
     {
-        rText = ::GetColorString( aColor ) + OUString(cpDelim);
+        rText = ::GetColorString( aColor ) + cpDelim;
         const char* pId = RID_SVXITEMS_TRANSPARENT_FALSE;
 
         if ( aColor.GetTransparency() )
diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx
index 78b31841869a..9b3996e79975 100644
--- a/editeng/source/items/itemtype.cxx
+++ b/editeng/source/items/itemtype.cxx
@@ -181,8 +181,8 @@ OUString GetColorString( const Color& rCol )
     if ( sStr.isEmpty() )
     {
         sStr += "RGB(" +
-                OUString::number( rCol.GetRed() )   + OUString(cpDelim) +
-                OUString::number( rCol.GetGreen() ) + OUString(cpDelim) +
+                OUString::number( rCol.GetRed() )   + cpDelim +
+                OUString::number( rCol.GetGreen() ) + cpDelim +
                 OUString::number( rCol.GetBlue() )  + ")";
     }
     return sStr;
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 82889dc91be7..ae7239a8e878 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -965,7 +965,7 @@ bool SvxTextLineItem::GetPresentation
 {
     rText = GetValueTextByPos( GetValue() );
     if( !mColor.GetTransparency() )
-        rText += OUString(cpDelim) + ::GetColorString( mColor );
+        rText += cpDelim + ::GetColorString( mColor );
     return true;
 }
 
diff --git a/filter/source/msfilter/rtfutil.cxx b/filter/source/msfilter/rtfutil.cxx
index 358502b196ce..7b650e69c1e9 100644
--- a/filter/source/msfilter/rtfutil.cxx
+++ b/filter/source/msfilter/rtfutil.cxx
@@ -171,7 +171,7 @@ static bool TryOutString(const OUString& rStr, rtl_TextEncoding eDestEnc)
 OString OutStringUpr(const sal_Char* pToken, const OUString& rStr, rtl_TextEncoding eDestEnc)
 {
     if (TryOutString(rStr, eDestEnc))
-        return OString("{") + pToken + " " + OutString(rStr, eDestEnc) + "}";
+        return OStringLiteral("{") + pToken + " " + OutString(rStr, eDestEnc) + "}";
 
     OStringBuffer aRet;
     aRet.append("{" OOO_STRING_SVTOOLS_RTF_UPR "{");
diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx
index fea868eb85e9..6312d1feecd5 100644
--- a/i18npool/source/breakiterator/breakiterator_unicode.cxx
+++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx
@@ -213,7 +213,7 @@ void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocal
                     rbi.reset();
 
                     // ;rule (only)
-                    const OString aBIMapRuleOnlyKey( OString(";") + rule);
+                    const OString aBIMapRuleOnlyKey( OStringLiteral(";") + rule);
                     aMapIt = theBIMap.find( aBIMapRuleOnlyKey);
                     bInMap = (aMapIt != theBIMap.end());
                     if (bInMap)
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index d09f65772c60..68a0d9359b47 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -1093,7 +1093,7 @@ OUString
 LocaleDataImpl::getIndexKeysByAlgorithm( const Locale& rLocale, const OUString& algorithm )
 {
     sal_Unicode **indexArray = getIndexArrayForAlgorithm(rLocale, algorithm);
-    return indexArray ? "0-9"+OUString(indexArray[2]) : OUString();
+    return indexArray ? (OUStringLiteral("0-9") + indexArray[2]) : OUString();
 }
 
 OUString
diff --git a/idlc/inc/astsequence.hxx b/idlc/inc/astsequence.hxx
index 229b17dbd2f7..2d65edbaba6c 100644
--- a/idlc/inc/astsequence.hxx
+++ b/idlc/inc/astsequence.hxx
@@ -25,7 +25,7 @@ class AstSequence : public AstType
 {
 public:
     AstSequence(AstType const * pMemberType, AstScope* pScope)
-        : AstType(NT_sequence, OString("[]")+pMemberType->getScopedName(), pScope)
+        : AstType(NT_sequence, OStringLiteral("[]")+pMemberType->getScopedName(), pScope)
         , m_pMemberType(pMemberType)
     {}
 
diff --git a/include/oox/export/utils.hxx b/include/oox/export/utils.hxx
index e28b01c1d95d..4e9fa9866341 100644
--- a/include/oox/export/utils.hxx
+++ b/include/oox/export/utils.hxx
@@ -27,7 +27,7 @@ inline OString I32SHEX(sal_Int32 x)
 {
     OString aStr = OString::number(x, 16);
     while (aStr.getLength() < 6)
-        aStr = OString("0") + aStr;
+        aStr = "0" + aStr;
     return aStr;
 }
 
diff --git a/include/rtl/stringconcat.hxx b/include/rtl/stringconcat.hxx
index b751c020e75b..3fd8b6720851 100644
--- a/include/rtl/stringconcat.hxx
+++ b/include/rtl/stringconcat.hxx
@@ -113,9 +113,11 @@ template<>
 struct ToStringHelper< const char* >
     {
     static std::size_t length( const char* str ) {
-        return strlen( str );
+        return str ? strlen( str ) : 0;
+    }
+    static char* addData( char* buffer, const char* str ) {
+        return str ? addDataCString( buffer, str ) : buffer;
     }
-    static char* addData( char* buffer, const char* str ) { return addDataCString( buffer, str ); }
     static const bool allowOStringConcat = true;
     static const bool allowOUStringConcat = false;
     };
@@ -148,9 +150,11 @@ template<>
 struct ToStringHelper< const sal_Unicode* >
     {
     static std::size_t length( const sal_Unicode* str ) {
-        return std::char_traits<char16_t>::length( str );
+        return str ? std::char_traits<char16_t>::length( str ) : 0;
+    }
+    static sal_Unicode* addData( sal_Unicode* buffer, const sal_Unicode* str ) {
+        return str ? addDataUString( buffer, str ) : buffer;
     }
-    static sal_Unicode* addData( sal_Unicode* buffer, const sal_Unicode* str ) { return addDataUString( buffer, str ); }
     static const bool allowOStringConcat = false;
     static const bool allowOUStringConcat = true;
     };
diff --git a/jvmfwk/source/fwkbase.cxx b/jvmfwk/source/fwkbase.cxx
index 3e17431ebc1c..ece4dd2bd717 100644
--- a/jvmfwk/source/fwkbase.cxx
+++ b/jvmfwk/source/fwkbase.cxx
@@ -100,7 +100,7 @@ VendorSettings::VendorSettings():
         if (m_xmlDocVendorSettings == nullptr)
             throw FrameworkException(
                 JFW_E_ERROR,
-                OString("[Java framework] Error while parsing file: ")
+                OStringLiteral("[Java framework] Error while parsing file: ")
                 + sSettingsPath + ".");
 
         m_xmlPathContextVendorSettings = xmlXPathNewContext(m_xmlDocVendorSettings);
@@ -130,9 +130,9 @@ boost::optional<VersionInfo> VendorSettings::getVersionInformation(const OUStrin
 
     VersionInfo aVersionInfo;
     //Get minVersion
-    OString sExpression = OString(
-        "/jf:javaSelection/jf:vendorInfos/jf:vendor[@name=\"") +
-        osVendor + OString("\"]/jf:minVersion");
+    OString sExpression =
+        "/jf:javaSelection/jf:vendorInfos/jf:vendor[@name=\"" +
+        osVendor + "\"]/jf:minVersion";
 
     CXPathObjectPtr xPathObjectMin =
         xmlXPathEvalExpression(reinterpret_cast<xmlChar const *>(sExpression.getStr()),
@@ -152,8 +152,8 @@ boost::optional<VersionInfo> VendorSettings::getVersionInformation(const OUStrin
     }
 
     //Get maxVersion
-    sExpression = OString("/jf:javaSelection/jf:vendorInfos/jf:vendor[@name=\"") +
-        osVendor + OString("\"]/jf:maxVersion");
+    sExpression = "/jf:javaSelection/jf:vendorInfos/jf:vendor[@name=\"" +
+        osVendor + "\"]/jf:maxVersion";
     CXPathObjectPtr xPathObjectMax = xmlXPathEvalExpression(
         reinterpret_cast<xmlChar const *>(sExpression.getStr()),
         m_xmlPathContextVendorSettings);
@@ -172,8 +172,8 @@ boost::optional<VersionInfo> VendorSettings::getVersionInformation(const OUStrin
     }
 
     //Get excludeVersions
-    sExpression = OString("/jf:javaSelection/jf:vendorInfos/jf:vendor[@name=\"") +
-        osVendor + OString("\"]/jf:excludeVersions/jf:version");
+    sExpression = "/jf:javaSelection/jf:vendorInfos/jf:vendor[@name=\"" +
+        osVendor + "\"]/jf:excludeVersions/jf:version";
     CXPathObjectPtr xPathObjectVersions =
         xmlXPathEvalExpression(reinterpret_cast<xmlChar const *>(sExpression.getStr()),
                                m_xmlPathContextVendorSettings);
@@ -253,7 +253,7 @@ OString BootParams::getClasspath()
         if (pCp)
         {
             char szSep[] = {SAL_PATHSEPARATOR,0};
-            sClassPath += OString(szSep) + OString(pCp);
+            sClassPath += OStringLiteral(szSep) + pCp;
         }
         SAL_INFO(
             "jfw.level2",
diff --git a/l10ntools/source/po.cxx b/l10ntools/source/po.cxx
index 20c728e6338c..4df1e1782d63 100644
--- a/l10ntools/source/po.cxx
+++ b/l10ntools/source/po.cxx
@@ -459,18 +459,18 @@ PoHeader::PoHeader( const OString& rExtSrc )
 {
     m_pGenPo->setExtractCom("extracted from " + rExtSrc);
     m_pGenPo->setMsgStr(
-        OString("Project-Id-Version: PACKAGE VERSION\n"
+        "Project-Id-Version: PACKAGE VERSION\n"
         "Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?"
         "product=LibreOffice&bug_status=UNCONFIRMED&component=UI\n"
-        "POT-Creation-Date: ") + lcl_GetTime() +
-        OString("\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+        "POT-Creation-Date: " + lcl_GetTime() +
+        "\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
         "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
         "Language-Team: LANGUAGE <LL at li.org>\n"
         "MIME-Version: 1.0\n"
         "Content-Type: text/plain; charset=UTF-8\n"
         "Content-Transfer-Encoding: 8bit\n"
         "X-Accelerator-Marker: ~\n"
-        "X-Generator: LibreOffice\n"));
+        "X-Generator: LibreOffice\n");
     m_bIsInitialized = true;
 }
 
diff --git a/l10ntools/source/pocheck.cxx b/l10ntools/source/pocheck.cxx
index e080138ed3fc..6f3252451dfa 100644
--- a/l10ntools/source/pocheck.cxx
+++ b/l10ntools/source/pocheck.cxx
@@ -22,8 +22,8 @@ static void checkStyleNames(const OString& aLanguage)
     std::map<OString,sal_uInt16> aLocalizedNumStyleNames;
     std::vector<PoEntry> repeatedEntries;
 
-    OString aPoPath = OString(getenv("SRC_ROOT")) +
-                      "/translations/source/" +
+    OString aPoPath = getenv("SRC_ROOT") +
+                      OStringLiteral("/translations/source/") +
                       aLanguage + "/sw/messages.po";
     PoIfstream aPoInput;
     aPoInput.open(aPoPath);
@@ -144,8 +144,8 @@ static void checkFunctionNames(const OString& aLanguage)
     OString aPoPaths[2];
     OUString aPoPathURL;
 
-    aPoPaths[0] = OString(getenv("SRC_ROOT")) +
-                      "/translations/source/" +
+    aPoPaths[0] = getenv("SRC_ROOT") +
+                      OStringLiteral("/translations/source/") +
                       aLanguage +
                       "/formula/messages.po";
     PoIfstream aPoInput;
@@ -180,8 +180,8 @@ static void checkFunctionNames(const OString& aLanguage)
     }
     aPoInput.close();
 
-    aPoPaths[1] = OString(getenv("SRC_ROOT")) +
-        "/translations/source/" +
+    aPoPaths[1] = getenv("SRC_ROOT") +
+        OStringLiteral("/translations/source/") +
         aLanguage +
         "/scaddins/messages.po";
     aPoInput.open(aPoPaths[1]);
@@ -290,8 +290,8 @@ static void checkFunctionNames(const OString& aLanguage)
 // with '|', too.
 static void checkVerticalBar(const OString& aLanguage)
 {
-    OString aPoPath = OString(getenv("SRC_ROOT")) +
-                      "/translations/source/" +
+    OString aPoPath = getenv("SRC_ROOT") +
+                      OStringLiteral("/translations/source/") +
                       aLanguage +
                       "/instsetoo_native/inc_openoffice/windows/msi_languages.po";
     PoIfstream aPoInput;
@@ -343,8 +343,8 @@ static void checkVerticalBar(const OString& aLanguage)
 // must not contain spaces
 static void checkMathSymbolNames(const OString& aLanguage)
 {
-    OString aPoPath = OString(getenv("SRC_ROOT")) +
-                      "/translations/source/" +
+    OString aPoPath = getenv("SRC_ROOT") +
+                      OStringLiteral("/translations/source/") +
                       aLanguage +
                       "/starmath/messages.po";
     PoIfstream aPoInput;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 83c709c4633e..168bb53e8217 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2754,7 +2754,7 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin
                 mpFS->startElementNS(XML_a, XML_avLst);
                 for (sal_Int32 i = 0, nElems = aAdjustmentSeq.getLength(); i < nElems; ++i )
                 {
-                    OString sName = OString("adj") + (( nElems > 1 ) ? OString::number(i + 1) : OString());
+                    OString sName = "adj" + (( nElems > 1 ) ? OString::number(i + 1) : OString());
                     double fValue(0.0);
                     if (aAdjustmentSeq[i].Value.getValueTypeClass() == TypeClass_DOUBLE)
                         aAdjustmentSeq[i].Value >>= fValue;
@@ -2788,7 +2788,7 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin
                     {
                         fValue /= 0.216;
                     }
-                    OString sFmla = OString("val ") + OString::number(std::lround(fValue));
+                    OString sFmla = "val " + OString::number(std::lround(fValue));
                     mpFS->singleElementNS(XML_a, XML_gd, XML_name, sName, XML_fmla, sFmla);
                 }
                 mpFS->endElementNS( XML_a, XML_avLst );
@@ -2904,8 +2904,8 @@ void DrawingML::WritePresetShape( const char* pShape , std::vector< std::pair<sa
         mpFS->startElementNS(XML_a, XML_avLst);
         for (auto const& elem : rAvList)
         {
-            OString sName = OString("adj") + ( ( elem.first > 0 ) ? OString::number(elem.first) : OString() );
-            OString sFmla = OString("val ") + OString::number( elem.second );
+            OString sName = "adj" + ( ( elem.first > 0 ) ? OString::number(elem.first) : OString() );
+            OString sFmla = "val " + OString::number( elem.second );
 
             mpFS->singleElementNS(XML_a, XML_gd, XML_name, sName, XML_fmla, sFmla);
         }
diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index ffb1cc788f31..e1645ebe85ff 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -185,7 +185,7 @@ OString createFileName(cl_device_id deviceId, const char* clFileName)
             platformVersion, nullptr);
 
     // create hash for deviceName + driver version + platform version
-    OString aString = OString(deviceName) + driverVersion + platformVersion;
+    OString aString = OStringLiteral(deviceName) + driverVersion + platformVersion;
     OString aHash = generateMD5(aString.getStr(), aString.getLength());
 
     return getCacheFolder() + fileName + "-" + aHash + ".bin";
diff --git a/package/qa/cppunit/test_package.cxx b/package/qa/cppunit/test_package.cxx
index 2353e7b3de07..cf191781ad30 100644
--- a/package/qa/cppunit/test_package.cxx
+++ b/package/qa/cppunit/test_package.cxx
@@ -152,7 +152,7 @@ namespace
 
             for (char c = 'a'; c <= 'z'; ++c, ++itBuf)
             {
-                OUString aName = OUString(c) + ".txt";
+                OUString aName = OUStringLiteral1(c) + ".txt";
 
                 uno::Reference<io::XInputStream> xStrm;
                 mxNA->getByName(aName) >>= xStrm;
@@ -174,7 +174,7 @@ namespace
 
         for (char c = 'a'; c <= 'z'; ++c, ++itBuf)
         {
-            OUString aName = OUString(c) + ".txt";
+            OUString aName = OUStringLiteral1(c) + ".txt";
 
             uno::Reference<io::XInputStream> xStrm;
             //Size of each stream is 1mb (>10000) => XBufferedThreadedStream
diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx
index ce9eee8ec1c0..7b6ec7457e94 100644
--- a/sal/osl/unx/file_misc.cxx
+++ b/sal/osl/unx/file_misc.cxx
@@ -841,7 +841,7 @@ static oslFileError oslDoCopy(const sal_Char* pszSourceFileName, const sal_Char*
     {
         //TODO: better pick a temp file name instead of adding .osl-tmp:
         // use the destination file to avoid EXDEV /* Cross-device link */
-        tmpDestFile = OString(pszDestFileName) + ".osl-tmp";
+        tmpDestFile = pszDestFileName + OStringLiteral(".osl-tmp");
         if (rename(pszDestFileName, tmpDestFile.getStr()) != 0)
         {
             int e = errno;
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index cf8875b020ac..348b259bc4e0 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -262,7 +262,7 @@ static void deleteTestDirectory(const OUString& dirname)
 
     nError = Directory::remove(aPathURL);
 
-    OString strError = OString("In deleteTestDirectory function: remove Directory ") +
+    OString strError = "In deleteTestDirectory function: remove Directory " +
         OUStringToOString(aPathURL, RTL_TEXTENCODING_ASCII_US);
     CPPUNIT_ASSERT_MESSAGE(strError.getStr(), (osl::FileBase::E_None == nError) || (nError == osl::FileBase::E_NOENT));
 }
@@ -370,8 +370,8 @@ static OString outputError(const OString & returnVal, const OString & rightVal,
     if (returnVal == rightVal)
         return OString();
 
-    OString aString = OString(msg) +
-        ": the returned value is '" +
+    OString aString = msg +
+        OStringLiteral(": the returned value is '") +
         returnVal +
         "', but the value should be '" +
         rightVal +
@@ -4787,7 +4787,7 @@ namespace osl_Directory
                 osl_File_Attribute_OwnWrite |
                 osl_File_Attribute_OwnExe);
             deleteTestDirectory(aTmpDir);
-            sError = OString("test for create function: create a directory under '") +
+            sError = "test for create function: create a directory under '" +
                 OUStringToOString(aTmpDir, RTL_TEXTENCODING_ASCII_US) +
                 "' for access test.";
             CPPUNIT_ASSERT_EQUAL_MESSAGE(sError.getStr(), osl::FileBase::E_ACCES, nError1);
diff --git a/sal/rtl/uri.cxx b/sal/rtl/uri.cxx
index 0504650b80fe..ae88e18b8774 100644
--- a/sal/rtl/uri.cxx
+++ b/sal/rtl/uri.cxx
@@ -792,7 +792,7 @@ sal_Bool SAL_CALL rtl_uriConvertRelToAbs(rtl_uString * pBaseUriRef,
             rtl_uString_assign(
                 pException,
                 (OUString(
-                    "<" + OUString(pBaseUriRef)
+                    "<" + OUString::unacquired(&pBaseUriRef)
                     + "> does not start with a scheme component")
                  .pData));
             return false;
diff --git a/sc/qa/unit/helper/shared_test_impl.hxx b/sc/qa/unit/helper/shared_test_impl.hxx
index 88548cca3699..e75a521f0fce 100644
--- a/sc/qa/unit/helper/shared_test_impl.hxx
+++ b/sc/qa/unit/helper/shared_test_impl.hxx
@@ -283,7 +283,7 @@ void testCeilingFloor_Impl( ScDocument& rDoc )
     ScAddress aPos;
     aPos.Parse(aRef);
     ASSERT_FORMULA_EQUAL(rDoc, aPos, "AND(K3:K81)", "Wrong formula.");
-    CPPUNIT_ASSERT_MESSAGE( OString( OString(pORef) + " result is error.").getStr(),
+    CPPUNIT_ASSERT_MESSAGE( OString( pORef + OStringLiteral(" result is error.")).getStr(),
             isFormulaWithoutError( rDoc, aPos));
     CPPUNIT_ASSERT_EQUAL(1.0, rDoc.GetValue(aPos));
 }
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 4c53441de68a..6711b3aecabb 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -3174,7 +3174,7 @@ void ScExportTest::testSwappedOutImageExport()
         // Check whether the export code swaps in the image which was swapped out before.
         ScDocShellRef xDocSh = loadDoc("document_with_two_images.", FORMAT_ODS);
 
-        const OString sFailedMessage = OString("Failed on filter: ") + aFilterNames[nFilter];
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + aFilterNames[nFilter];
         CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xDocSh.is());
 
         // Export the document and import again for a check
@@ -3288,7 +3288,7 @@ void ScExportTest::testLinkedGraphicRT()
     {
         // Load the original file with one image
         ScDocShellRef xDocSh = loadDoc("document_with_linked_graphic.", FORMAT_ODS);
-        const OString sFailedMessage = OString("Failed on filter: ") + aFilterNames[nFilter];
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + aFilterNames[nFilter];
 
         // Export the document and import again for a check
         ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), nFilter);
@@ -3330,7 +3330,7 @@ void ScExportTest::testImageWithSpecialID()
     {
         ScDocShellRef xDocSh = loadDoc("images_with_special_IDs.", FORMAT_ODS);
 
-        const OString sFailedMessage = OString("Failed on filter: ") + aFilterNames[nFilter];
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + aFilterNames[nFilter];
         CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xDocSh.is());
 
         // Export the document and import again for a check
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 0daed452d103..e697dc700aad 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4821,7 +4821,7 @@ void Test::testAutoFillSimple()
         }
         else
         {
-            OString aMsg = OString("wrong value in row: ") + OString::number(nRow);
+            OString aMsg = "wrong value in row: " + OString::number(nRow);
             double nVal = m_pDoc->GetValue(0, nRow, 0);
             CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsg.getStr(), 10.0, nVal);
         }
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 55749266ffb5..96c97c5793b9 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -159,7 +159,7 @@ void Test::testFormulaCreateStringFromTokens()
         bool bInserted = pDBs->getNamedDBs().insert(std::move(pData));
         CPPUNIT_ASSERT_MESSAGE(
             OString(
-                "Failed to insert \"" + OString(aDBs[i].pName) + "\"").getStr(),
+                OStringLiteral("Failed to insert \"") + aDBs[i].pName + "\"").getStr(),
             bInserted);
     }
 
@@ -6976,7 +6976,7 @@ void Test::testFuncTableRef()
                     ScAddress(2,4,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE);
             bool bInserted = pGlobalNames->insert(pName);
             CPPUNIT_ASSERT_MESSAGE(
-                    OString("Failed to insert named expression "+ OString(aNames[i].pName) +".").getStr(), bInserted);
+                    OString(OStringLiteral("Failed to insert named expression ") + aNames[i].pName +".").getStr(), bInserted);
         }
     }
 
@@ -7150,7 +7150,7 @@ void Test::testFuncTableRef()
                     ScAddress(6,12,0), ScRangeData::Type::Name, formula::FormulaGrammar::GRAM_NATIVE);
             bool bInserted = pGlobalNames->insert(pName);
             CPPUNIT_ASSERT_MESSAGE(
-                    OString("Failed to insert named expression "+ OString(aHlNames[i].pName) +".").getStr(), bInserted);
+                    OString(OStringLiteral("Failed to insert named expression ") + aHlNames[i].pName +".").getStr(), bInserted);
         }
     }
 
diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx
index c34c446ea482..a116d448d971 100644
--- a/sc/source/filter/ftools/ftools.cxx
+++ b/sc/source/filter/ftools/ftools.cxx
@@ -117,10 +117,10 @@ rtl_TextEncoding ScfTools::GetSystemTextEncoding()
 OUString ScfTools::GetHexStr( sal_uInt16 nValue )
 {
     const sal_Char pHex[] = "0123456789ABCDEF";
-    OUString aStr = OUString( pHex[ nValue >> 12 ] )
-                  + OUString( pHex[ (nValue >> 8) & 0x000F ] )
-                  + OUString( pHex[ (nValue >> 4) & 0x000F ] )
-                  + OUString( pHex[ nValue & 0x000F ] );
+    OUString aStr = OUStringLiteral1( pHex[ nValue >> 12 ] )
+                  + OUStringLiteral1( pHex[ (nValue >> 8) & 0x000F ] )
+                  + OUStringLiteral1( pHex[ (nValue >> 4) & 0x000F ] )
+                  + OUStringLiteral1( pHex[ nValue & 0x000F ] );
     return aStr;
 }
 
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index df24f8f0a219..646b3d281c47 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -323,7 +323,7 @@ void ScHTMLExport::WriteHeader()
         if (!xDocProps->getPrintedBy().isEmpty())
         {
             OUT_COMMENT( GLOBSTR( STR_DOC_INFO ) );
-            OUString aStrOut = ( GLOBSTR( STR_DOC_PRINTED ) ) + ": ";
+            OUString aStrOut = GLOBSTR( STR_DOC_PRINTED ) + ": ";
             lcl_AddStamp( aStrOut, xDocProps->getPrintedBy(),
                 xDocProps->getPrintDate(), *ScGlobal::pLocaleData );
             OUT_COMMENT( aStrOut );
diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx
index 360b5da2d40d..9692a95f08ff 100644
--- a/sc/source/filter/lotus/lotform.cxx
+++ b/sc/source/filter/lotus/lotform.cxx
@@ -62,7 +62,7 @@ void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nCnt, const sal_Char* pExtStri
             eOc = lcl_KnownAddIn( t );
 
             if( eOc == ocNoName )
-                t = OString("L123_") + t;
+                t = "L123_" + t;
         }
         else
             t = "#UNKNOWN FUNC NAME#";
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 8e3db03ccca0..b6f3b065df45 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -679,7 +679,7 @@ void ScImportAsciiDlg::SetSeparators()
             case ' ':   pCkbSpace->Check();      break;
             default:
                 pCkbOther->Check();
-                pEdOther->SetText( pEdOther->GetText() + OUString( aSep[i] ) );
+                pEdOther->SetText( pEdOther->GetText() + OUStringLiteral1(aSep[i]) );
         }
     }
 }
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index 82333e4afbb3..a30c56ef0b00 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -1607,7 +1607,7 @@ IMPL_LINK(ScAcceptChgDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
 
     int nSortedCol = rTreeView.get_sort_column();
     for (sal_Int32 i = 0; i < 5; ++i)
-        m_xPopup->set_active(OString("calcsort") + OString::number(i), i == nSortedCol);
+        m_xPopup->set_active("calcsort" + OString::number(i), i == nSortedCol);
 
     m_xPopup->set_sensitive("calcedit", false);
 
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 5c46df802295..c26808a26ece 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -636,7 +636,7 @@ void ScContentTree::Command( const CommandEvent& rCEvt )
                         else
                             aEntry += pParentWindow->aStrNotActive;
                         ++i;
-                        aDocMenu->InsertItem(i, aEntry, MenuItemBits::AUTOCHECK | MenuItemBits::RADIOCHECK, OString("document") + OString::number(i));
+                        aDocMenu->InsertItem(i, aEntry, MenuItemBits::AUTOCHECK | MenuItemBits::RADIOCHECK, "document" + OString::number(i));
                         if ( !bHiddenDoc && aName == aManualDoc )
                             nPos = i;
                     }
@@ -644,7 +644,7 @@ void ScContentTree::Command( const CommandEvent& rCEvt )
                 }
                 //  "active window"
                 ++i;
-                aDocMenu->InsertItem(i, pParentWindow->aStrActiveWin, MenuItemBits::AUTOCHECK | MenuItemBits::RADIOCHECK, OString("document") + OString::number(i));
+                aDocMenu->InsertItem(i, pParentWindow->aStrActiveWin, MenuItemBits::AUTOCHECK | MenuItemBits::RADIOCHECK, "document" + OString::number(i));
                 if (!bHiddenDoc && aManualDoc.isEmpty())
                     nPos = i;
                 //  hidden document
@@ -653,7 +653,7 @@ void ScContentTree::Command( const CommandEvent& rCEvt )
                     OUString aEntry = aHiddenTitle;
                     aEntry += pParentWindow->aStrHidden;
                     ++i;
-                    aDocMenu->InsertItem(i, aEntry, MenuItemBits::AUTOCHECK | MenuItemBits::RADIOCHECK, OString("document") + OString::number(i));
+                    aDocMenu->InsertItem(i, aEntry, MenuItemBits::AUTOCHECK | MenuItemBits::RADIOCHECK, "document" + OString::number(i));
                     if (bHiddenDoc)
                         nPos = i;
                 }
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 22afcdb908cd..b075b748f0e3 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -330,7 +330,7 @@ void ScTabView::TabChanged( bool bSameTabButMoved )
 
             // Invalidate first
             tools::Rectangle aRectangle(0, 0, 1000000000, 1000000000);
-            OString sPayload = aRectangle.toString() + OString(", ") + OString::number(aViewData.GetTabNo());
+            OString sPayload = aRectangle.toString() + ", " + OString::number(aViewData.GetTabNo());
             pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sPayload.getStr());
 
             ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(pViewShell->GetCurrentDocument());
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index b8a17934d441..57fe771339f1 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -423,7 +423,7 @@ void SdExportTest::testSwappedOutImageExport()
     {
         // Load the original file with one image
         ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/document_with_two_images.odp"), ODP);
-        const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName);
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + aFileFormats[vFormats[nExportFormat]].pFilterName;
 
         // Export the document and import again for a check
         uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel();
@@ -642,7 +642,7 @@ void SdExportTest::testLinkedGraphicRT()
 
         // Check whether graphic imported well after export
         {
-            const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName);
+            const OString sFailedMessage = OStringLiteral("Failed on filter: ") + aFileFormats[vFormats[nExportFormat]].pFilterName;
 
             SdDrawDocument *pDoc = xDocShRef->GetDoc();
             CPPUNIT_ASSERT_MESSAGE( sFailedMessage.getStr(), pDoc != nullptr );
@@ -680,7 +680,7 @@ void SdExportTest::testImageWithSpecialID()
     {
         // Load the original file
         ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/images_with_special_IDs.odp"), ODP);
-        const OString sFailedMessage = OString("Failed on filter: ") + OString(aFileFormats[vFormats[nExportFormat]].pFilterName);
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + aFileFormats[vFormats[nExportFormat]].pFilterName;
 
         // Export the document and import again for a check
         uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel();
@@ -986,7 +986,7 @@ void SdExportTest::testBulletsAsImage()
     for (sal_Int32 nExportFormat : {ODP, PPTX, PPT})
     {
         ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/BulletsAsImage.odp"), ODP);
-        const OString sFailedMessageBase = OString("Failed on filter '") + OString(aFileFormats[nExportFormat].pFilterName) + OString("': ");
+        const OString sFailedMessageBase = OStringLiteral("Failed on filter '") + aFileFormats[nExportFormat].pFilterName + "': ";
 
         uno::Reference< lang::XComponent > xComponent = xDocShRef->GetModel();
         uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 92327dbee3f2..a2c111662c72 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -487,7 +487,7 @@ bool ImplSdPPTImport::Import()
                                                     aHyperlink.aConvSubString = maSlideNameList[ nPageNumber ];
                                                 if ( aHyperlink.aConvSubString.isEmpty() )
                                                 {
-                                                    aHyperlink.aConvSubString = SdResId( STR_PAGE ) + " " + ( mpDoc->CreatePageNumValue( static_cast<sal_uInt16>(nPageNumber) + 1 ) );
+                                                    aHyperlink.aConvSubString = SdResId( STR_PAGE ) + " " + mpDoc->CreatePageNumValue( static_cast<sal_uInt16>(nPageNumber) + 1 );
                                                 }
                                             } else {
                                                 // if sub address is given but not internal, use it as it is
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx
index 8e176c294dc0..d83576b80abf 100644
--- a/sd/source/ui/dlg/copydlg.cxx
+++ b/sd/source/ui/dlg/copydlg.cxx
@@ -34,7 +34,7 @@
 
 namespace sd {
 
-#define TOKEN ';'
+constexpr char TOKEN = ';';
 
 CopyDlg::CopyDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pInView)
     : SfxDialogController(pWindow, "modules/sdraw/ui/copydlg.ui", "DuplicateDialog")
@@ -71,13 +71,13 @@ CopyDlg::~CopyDlg()
 {
     SvtViewOptions aDlgOpt(EViewType::Dialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8));
     OUString sStr =
-        OUString::number(m_xNumFldCopies->get_value()) + OUString(TOKEN) +
-        OUString::number(m_xMtrFldMoveX->get_value(FieldUnit::NONE)) + OUString(TOKEN) +
-        OUString::number(m_xMtrFldMoveY->get_value(FieldUnit::NONE)) + OUString(TOKEN) +
-        OUString::number(m_xMtrFldAngle->get_value(FieldUnit::NONE)) + OUString(TOKEN) +
-        OUString::number(m_xMtrFldWidth->get_value(FieldUnit::NONE)) + OUString(TOKEN) +
-        OUString::number(m_xMtrFldHeight->get_value(FieldUnit::NONE)) + OUString(TOKEN) +
-        OUString::number(static_cast<sal_uInt32>(m_xLbStartColor->GetSelectEntryColor())) + OUString(TOKEN) +
+        OUString::number(m_xNumFldCopies->get_value()) + OUStringLiteral1(TOKEN) +
+        OUString::number(m_xMtrFldMoveX->get_value(FieldUnit::NONE)) + OUStringLiteral1(TOKEN) +
+        OUString::number(m_xMtrFldMoveY->get_value(FieldUnit::NONE)) + OUStringLiteral1(TOKEN) +
+        OUString::number(m_xMtrFldAngle->get_value(FieldUnit::NONE)) + OUStringLiteral1(TOKEN) +
+        OUString::number(m_xMtrFldWidth->get_value(FieldUnit::NONE)) + OUStringLiteral1(TOKEN) +
+        OUString::number(m_xMtrFldHeight->get_value(FieldUnit::NONE)) + OUStringLiteral1(TOKEN) +
+        OUString::number(static_cast<sal_uInt32>(m_xLbStartColor->GetSelectEntryColor())) + OUStringLiteral1(TOKEN) +
         OUString::number(static_cast<sal_uInt32>(m_xLbEndColor->GetSelectEntryColor()));
     aDlgOpt.SetUserItem("UserItem", css::uno::makeAny(sStr));
 }
diff --git a/sfx2/source/control/msg.cxx b/sfx2/source/control/msg.cxx
index faf69598ea06..6ffa3c7408a2 100644
--- a/sfx2/source/control/msg.cxx
+++ b/sfx2/source/control/msg.cxx
@@ -46,7 +46,7 @@ sal_uInt16 SfxSlot::GetWhich( const SfxItemPool &rPool ) const
 
 OString SfxSlot::GetCommand() const
 {
-    return OString(".uno:") + pUnoName;
+    return OStringLiteral(".uno:") + pUnoName;
 }
 
 OUString SfxSlot::GetCommandString() const
diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx
index 23fd6ecc41ba..3d7bb290e781 100644
--- a/sfx2/source/statbar/stbitem.cxx
+++ b/sfx2/source/statbar/stbitem.cxx
@@ -119,7 +119,7 @@ svt::StatusbarController* SfxStatusBarControllerFactory(
         sal_uInt16 nSlotId = pSlot->GetSlotId();
         if ( nSlotId > 0 )
         {
-            OString aCmd = OString(".uno:") + pSlot->GetUnoName();
+            OString aCmd = OStringLiteral(".uno:") + pSlot->GetUnoName();
             pStatusBar->SetHelpId( nSlotId, aCmd );
             return SfxStatusBarControl::CreateControl( nSlotId, nID, pStatusBar, pModule );
         }
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 4224c54a3df7..5d72a583d67b 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -161,7 +161,7 @@ static OString lcl_escapeQuotes(const OString &rStr)
 
 void SfxLokHelper::notifyOtherView(SfxViewShell* pThisView, SfxViewShell const* pOtherView, int nType, const OString& rKey, const OString& rPayload)
 {
-    OString aPayload = OString("{ \"viewId\": \"") + OString::number(SfxLokHelper::getView(pThisView)) +
+    OString aPayload = OStringLiteral("{ \"viewId\": \"") + OString::number(SfxLokHelper::getView(pThisView)) +
                        "\", \"part\": \"" + OString::number(pThisView->getPart()) +
                        "\", \"" + rKey + "\": \"" + lcl_escapeQuotes(rPayload) + "\" }";
 
@@ -236,7 +236,7 @@ void SfxLokHelper::notifyDocumentSizeChanged(SfxViewShell const* pThisView, cons
         for (int i = 0; i < pDoc->getParts(); ++i)
         {
             tools::Rectangle aRectangle(0, 0, 1000000000, 1000000000);
-            OString sPayload = aRectangle.toString() + OString(", ") + OString::number(i);
+            OString sPayload = aRectangle.toString() + ", " + OString::number(i);
             pThisView->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sPayload.getStr());
         }
     }
@@ -261,7 +261,7 @@ void SfxLokHelper::notifyVisCursorInvalidation(OutlinerViewShell const* pThisVie
     OString sPayload;
     if (comphelper::LibreOfficeKit::isViewIdForVisCursorInvalidation())
     {
-        sPayload = OString("{ \"viewId\": \"") + OString::number(SfxLokHelper::getView()) +
+        sPayload = OStringLiteral("{ \"viewId\": \"") + OString::number(SfxLokHelper::getView()) +
             "\", \"rectangle\": \"" + rRectangle + "\" }";
     }
     else
diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx
index 1e669b695e1d..2448a045105d 100644
--- a/shell/source/unix/exec/shellexec.cxx
+++ b/shell/source/unix/exec/shellexec.cxx
@@ -182,7 +182,7 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar
 
         if ( pDesktopLaunch && *pDesktopLaunch )
         {
-            aLaunchBuffer.append( OString(pDesktopLaunch) + " ");
+            aLaunchBuffer.append( pDesktopLaunch + OStringLiteral(" "));
             escapeForShell(aLaunchBuffer, OUStringToOString(aURL, osl_getThreadTextEncoding()));
         }
     } else if ((nFlags & css::system::SystemShellExecuteFlags::URIS_ONLY) != 0)
diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx
index d71fc12a8dbc..8dd7d55e7fd7 100644
--- a/stoc/source/corereflection/criface.cxx
+++ b/stoc/source/corereflection/criface.cxx
@@ -643,8 +643,8 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > &
                     IllegalArgumentException aExc(
                         "cannot coerce argument type during corereflection call:"
                         "\narg no.: " + OUString::number(nPos)
-                        + " expected: \"" + OUString(pTD->pTypeName)
-                        + "\" actual: \"" + OUString(pCppArgs[nPos].getValueTypeRef()->pTypeName)
+                        + " expected: \"" + OUString::unacquired(&pTD->pTypeName)
+                        + "\" actual: \"" + OUString::unacquired(&pCppArgs[nPos].getValueTypeRef()->pTypeName)
                         + "\"",
                         *o3tl::doAccess<Reference<XInterface>>(rObj), static_cast<sal_Int16>(nPos) );
 
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 04394af2090b..d61daae8dd30 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -1081,8 +1081,8 @@ void Test::checkDateInput( SvNumberFormatter& rFormatter, const char* pTimezone,
     sal_uInt32 nIndex = 0;
     double fVal = 0.0;
     bool bVal = rFormatter.IsNumberFormat( aDate, nIndex, fVal);
-    CPPUNIT_ASSERT_MESSAGE( OString("Date not recognized: " +
-                OString(pTimezone) + " " + OString(pIsoDate)).getStr(), bVal);
+    CPPUNIT_ASSERT_MESSAGE( OString(OStringLiteral("Date not recognized: ") +
+                pTimezone + " " + pIsoDate).getStr(), bVal);
     CPPUNIT_ASSERT_MESSAGE("Format parsed is not date.",
             (rFormatter.GetType(nIndex) & SvNumFormatType::DATE));
     OUString aOutString;
@@ -1152,7 +1152,7 @@ void checkSpecificNumberFormats( SvNumberFormatter& rFormatter,
         double fNumber = 0;
         OUString aString( OUString::fromUtf8( rVec[i].mpInput));
         const bool bIsNumber = rFormatter.IsNumberFormat( aString, nIndex, fNumber);
-        CPPUNIT_ASSERT_EQUAL_MESSAGE( OString( OString(pName) + " " + OString::number(i) +
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( OString( pName + OStringLiteral(" ") + OString::number(i) +
                     (rVec[i].mbNumber ? " not recognized: " : " should not be recognized: ") +
                     OUStringToOString( aString, RTL_TEXTENCODING_UTF8)).getStr(), rVec[i].mbNumber, bIsNumber);
         if (bIsNumber)
@@ -1161,7 +1161,7 @@ void checkSpecificNumberFormats( SvNumberFormatter& rFormatter,
                 nIndex = rVec[i].mnOutputIndex;
             Color* pColor;
             rFormatter.GetOutputString( fNumber, nIndex, aString, &pColor);
-            CPPUNIT_ASSERT_EQUAL_MESSAGE( OString( OString(pName) + " " + OString::number(i)  + " mismatch").getStr(),
+            CPPUNIT_ASSERT_EQUAL_MESSAGE( OString( pName + OStringLiteral(" ") + OString::number(i)  + " mismatch").getStr(),
                     OUString::fromUtf8( rVec[i].mpOutput), aString);
         }
     }
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index ef6401ba6ebf..2ed288bbac99 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -498,9 +498,9 @@ void AssignmentPersistentData::ImplCommit()
             for (sal_Int32 column=0; column<2; ++column)
             {
                 // the label
-                m_pImpl->pFieldLabels[row * 2 + column] = m_xBuilder->weld_label(OString("label") + OString::number(row * 2 + column));
+                m_pImpl->pFieldLabels[row * 2 + column] = m_xBuilder->weld_label("label" + OString::number(row * 2 + column));
                 // the listbox
-                m_pImpl->pFields[row * 2 + column] = m_xBuilder->weld_combo_box(OString("box") + OString::number(row * 2 + column));
+                m_pImpl->pFields[row * 2 + column] = m_xBuilder->weld_combo_box("box" + OString::number(row * 2 + column));
                 m_pImpl->pFields[row * 2 + column]->connect_changed(LINK(this, AddressBookSourceDialog, OnFieldSelect));
             }
         }
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 3d8d1be7b6c2..0a3f5052d437 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -979,7 +979,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
                     }
                 }
                 sSelectionText = aSelection.toString();
-                sSelectionText += OString(", ") + OString::number(nRotAngle);
+                sSelectionText += OStringLiteral(", ") + OString::number(nRotAngle);
                 if (!aExtraInfo.isEmpty())
                 {
                     sSelectionText += ", ";
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
index b6af6e5ea1dc..356e017ebb55 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -111,7 +111,7 @@ void Test::testEmbeddedGraphicRoundtrip()
         uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
         uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage();
 
-        const OString sFailedMessage = OString("Failed on filter: ") + rFilterName.toUtf8();
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8();
         CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(2), xDraws->getCount());
 
         // First image
@@ -163,7 +163,7 @@ void Test::testLinkedGraphicRT()
             mxComponent->dispose();
         mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/document_with_linked_graphic.odt"), "com.sun.star.text.TextDocument");
 
-        const OString sFailedMessage = OString("Failed on filter: ") + rFilterName.toUtf8();
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8();
 
         // Export the document and import again for a check
         uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
@@ -248,7 +248,7 @@ void Test::testImageWithSpecialID()
         uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
         uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage();
 
-        const OString sFailedMessage = OString("Failed on filter: ") + rFilterName.toUtf8();
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8();
         CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(2), xDraws->getCount());
 
         uno::Reference<drawing::XShape> xImage = getShape(1);
@@ -346,7 +346,7 @@ void Test::testGraphicShape()
         uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
         uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage();
 
-        const OString sFailedMessage = OString("Failed on filter: ") + rFilterName.toUtf8();
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8();
         CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), static_cast<sal_Int32>(2), xDraws->getCount());
 
         uno::Reference<drawing::XShape> xImage = lcl_getShape(mxComponent, true);
@@ -371,7 +371,7 @@ void Test::testGraphicShape()
         // Second image is a linked one
         xImage = lcl_getShape(mxComponent, false);
         XPropSet.set(xImage, uno::UNO_QUERY);
-        const OString sFailedImageLoad = OString("Couldn't load the shape/image for ") + rFilterName.toUtf8();
+        const OString sFailedImageLoad = OStringLiteral("Couldn't load the shape/image for ") + rFilterName.toUtf8();
         CPPUNIT_ASSERT_MESSAGE(sFailedImageLoad.getStr(), xImage.is());
 
         // Check size
@@ -411,7 +411,7 @@ void Test::testCharHighlightBody()
         mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/char_highlight.docx"),
                                       "com.sun.star.text.TextDocument");
 
-        const OString sFailedMessage = OString("Failed on filter: ") + rFilterName.toUtf8();
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8();
 
         // Export the document and import again for a check
         uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
@@ -599,7 +599,7 @@ void Test::testMSCharBackgroundEditing()
         mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/char_background_editing.docx"),
                                       "com.sun.star.text.TextDocument");
 
-        const OString sFailedMessage = OString("Failed on filter: ") + rFilterName.toUtf8();
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8();
 
         // Check whether import was done on the right way
         uno::Reference< text::XTextRange > xPara = getParagraph(1);
@@ -711,7 +711,7 @@ void Test::testCharBackgroundToHighlighting()
         mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/char_background.odt"),
                                       "com.sun.star.text.TextDocument");
 
-        OString sFailedMessage = OString("Failed on filter: ") + rFilterName.toUtf8();
+        OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8();
 
 
         SvtFilterOptions& rOpt = SvtFilterOptions::Get();
@@ -890,7 +890,7 @@ void Test::testRedlineFlags()
 
         // tdf#97103 check that redline mode is properly restored
         CPPUNIT_ASSERT_EQUAL_MESSAGE(
-            OString(OString("redline mode not restored in ") + rFilterName.toUtf8()).getStr(),
+            OString(OStringLiteral("redline mode not restored in ") + rFilterName.toUtf8()).getStr(),
             static_cast<int>(nRedlineFlags), static_cast<int>(rIDRA.GetRedlineFlags()));
     }
 }
@@ -906,7 +906,7 @@ void Test::testBulletAsImage()
 
     for (OUString const & rFilterName : aFilterNames)
     {
-        OString sFailedMessage = OString("Failed on filter: ") + rFilterName.toUtf8();
+        OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8();
 
         if (mxComponent.is())
             mxComponent->dispose();
@@ -1049,7 +1049,7 @@ void Test::testTextFormField()
             mxComponent->dispose();
         mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/text_form_field.odt"), "com.sun.star.text.TextDocument");
 
-        const OString sFailedMessage = OString("Failed on filter: ") + rFilterName.toUtf8();
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8();
 
         // Export the document and import again for a check
         uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
@@ -1104,7 +1104,7 @@ void Test::testCheckBoxFormField()
             mxComponent->dispose();
         mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/checkbox_form_field.odt"), "com.sun.star.text.TextDocument");
 
-        const OString sFailedMessage = OString("Failed on filter: ") + rFilterName.toUtf8();
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8();
 
         // Export the document and import again for a check
         uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
@@ -1170,7 +1170,7 @@ void Test::testDropDownFormField()
             mxComponent->dispose();
         mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/dropdown_form_field.odt"), "com.sun.star.text.TextDocument");
 
-        const OString sFailedMessage = OString("Failed on filter: ") + rFilterName.toUtf8();
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8();
 
         // Export the document and import again for a check
         uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
@@ -1255,7 +1255,7 @@ void Test::testDateFormField()
             mxComponent->dispose();
         mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/date_form_field.odt"), "com.sun.star.text.TextDocument");
 
-        const OString sFailedMessage = OString("Failed on filter: ") + rFilterName.toUtf8();
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8();
 
         // Export the document and import again for a check
         uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
@@ -1371,7 +1371,7 @@ void Test::testDateFormFieldCharacterFormatting()
             mxComponent->dispose();
         mxComponent = loadFromDesktop(m_directories.getURLFromSrc("/sw/qa/extras/globalfilter/data/date_form_field_char_formatting.odt"), "com.sun.star.text.TextDocument");
 
-        const OString sFailedMessage = OString("Failed on filter: ") + rFilterName.toUtf8();
+        const OString sFailedMessage = OStringLiteral("Failed on filter: ") + rFilterName.toUtf8();
 
         // Export the document and import again for a check
         uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index b73ca07bf83f..af6f492d90f3 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -848,8 +848,8 @@ protected:
             }
             else
             {
-                OString aMessage = "validation requested, but don't know how to validate " +
-                    OString(filename) +
+                OString aMessage = OStringLiteral("validation requested, but don't know how to validate ") +
+                    filename +
                     " (" +
                     OUStringToOString(aFilterName, RTL_TEXTENCODING_UTF8) +
                     ")";
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 835e991f5651..2f1207098c9b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -579,7 +579,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf112118_DOCX, "tdf112118.docx")
         for (const auto& side : style.sideParams)
         {
             const OUString sSide = OUString::createFromAscii(side.sideName);
-            const OString sStage = OString(style.styleName) + " " + side.sideName;
+            const OString sStage = style.styleName + OStringLiteral(" ") + side.sideName;
 
             sal_Int32 nMargin = getProperty<sal_Int32>(xStyle, sSide + "Margin");
             CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(sStage + " margin width").getStr(),
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 83cc90bc5d84..de1ff27bfc96 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -987,7 +987,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloatButton)
     for (const OUString& aTestFile : aTestFiles)
     {
         OString sTestFileName = OUStringToOString(aTestFile, RTL_TEXTENCODING_UTF8);
-        OString sFailureMessage = OString("Failure in the test file: ") + sTestFileName;
+        OString sFailureMessage = OStringLiteral("Failure in the test file: ") + sTestFileName;
 
         load(FLOATING_TABLE_DATA_DIRECTORY, sTestFileName.getStr());
         SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
@@ -1061,7 +1061,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloating)
     for (const OUString& aTestFile : aTestFiles)
     {
         OString sTestFileName = OUStringToOString(aTestFile, RTL_TEXTENCODING_UTF8);
-        OString sFailureMessage = OString("Failure in the test file: ") + sTestFileName;
+        OString sFailureMessage = OStringLiteral("Failure in the test file: ") + sTestFileName;
 
         // Test what happens when pushing the unfloat button
         load(FLOATING_TABLE_DATA_DIRECTORY, "unfloatable_floating_table.docx");
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index 58997a1c7e27..43c3252953f5 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -865,7 +865,7 @@ DECLARE_WW8EXPORT_TEST(testTdf112118_DOC, "tdf112118.doc")
         for (const auto& side : style.sideParams)
         {
             const OUString sSide = OUString::createFromAscii(side.sideName);
-            const OString sStage = OString(style.styleName) + " " + side.sideName;
+            const OString sStage = style.styleName + OStringLiteral(" ") + side.sideName;
 
             sal_Int32 nMargin = getProperty<sal_Int32>(xStyle, sSide + "Margin");
             CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(sStage + " margin width").getStr(),
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index 0a7fa64efd7b..6e9c1f1533e6 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1076,7 +1076,7 @@ OUString SwDocInfoField::ExpandImpl(SwRootFrame const*const) const
                     }
                     else if( aAny >>= aDuration )
                     {
-                        sVal = OUString(aDuration.Negative ? '-' : '+')
+                        sVal = OUStringLiteral1(aDuration.Negative ? '-' : '+')
                              + SwViewShell::GetShellRes()->sDurationFormat;
                         sVal = sVal.replaceFirst("%1", OUString::number( aDuration.Years  ) );
                         sVal = sVal.replaceFirst("%2", OUString::number( aDuration.Months ) );
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 3d430ee495be..2d954c15db9c 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -295,7 +295,7 @@ static void lcl_formatReferenceLanguage( OUString& rRefText,
             0x00E1, 0x00C1, 0x00E9, 0x00C9, 0x00ED, 0x00CD,
             0x00F3, 0x00D3, 0x00F6, 0x00D6, 0x0151, 0x0150,
             0x00FA, 0x00DA, 0x00FC, 0x00DC, 0x0171, 0x0170, 0 };
-        static OUString sVowels = "aAeEiIoOuU" + OUString(sVowelsWithDiacritic);
+        static OUString sVowels = OUStringLiteral("aAeEiIoOuU") + sVowelsWithDiacritic;
 
         // handle more than 1-letter long Roman numbers and
         // their possible combinations with letters:
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 892569bcd0db..0e0192063e31 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -328,7 +328,7 @@ void SwHTMLWriter::OutCSS1_Property( const sal_Char *pProp,
         sOut.append("; ");
     }
 
-    sOut.append(OString(pProp) + ": ");
+    sOut.append(pProp + OStringLiteral(": "));
     if( m_nCSS1OutMode & CSS1_OUTMODE_ENCODE )
     {
         // for STYLE-Option encode string
@@ -2472,7 +2472,7 @@ static Writer& OutCSS1_SvxFontHeight( Writer& rWrt, const SfxPoolItem& rHt )
         return rWrt;
 
     sal_uInt32 nHeight = static_cast<const SvxFontHeightItem&>(rHt).GetHeight();
-    OString sHeight(OString::number(nHeight/20) + OString(sCSS1_UNIT_pt));
+    OString sHeight(OString::number(nHeight/20) + sCSS1_UNIT_pt);
     rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_font_size, sHeight);
 
     return rWrt;
@@ -2533,7 +2533,7 @@ static Writer& OutCSS1_SvxKerning( Writer& rWrt, const SfxPoolItem& rHt )
         // Width as n.n pt
         nValue = (nValue + 1) / 2;  // 1/10pt
         sOut.append(OString::number(nValue  / 10) + "." + OString::number(nValue % 10) +
-                    OString(sCSS1_UNIT_pt));
+                    sCSS1_UNIT_pt);
 
         rHTMLWrt.OutCSS1_PropertyAscii(sCSS1_P_letter_spacing,
             sOut.makeStringAndClear());
@@ -3332,7 +3332,7 @@ static void OutCSS1_SvxBorderLine( SwHTMLWriter& rHTMLWrt,
 
         // width in n.nn pt
         sOut.append(OString::number(nWidth / 100) + "." + OString::number((nWidth/10) % 10) +
-                    OString::number(nWidth % 10) + OString(sCSS1_UNIT_pt));
+                    OString::number(nWidth % 10) + sCSS1_UNIT_pt);
     }
 
     // Line-Style: solid or double
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index a50b3f7836b8..cc2d0753b32b 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -2980,7 +2980,7 @@ Writer& OutHTML_INetFormat( Writer& rWrt, const SwFormatINetFormat& rINetFormat,
             pStr = "ctl";
             break;
         }
-        sOut += OString(pStr) + "\"";
+        sOut += pStr + OStringLiteral("\"");
     }
 
     rWrt.Strm().WriteOString( sOut );
@@ -3177,8 +3177,8 @@ static Writer& OutHTML_SvxAdjust( Writer& rWrt, const SfxPoolItem& rHt )
     }
     if( pStr )
     {
-        OString sOut = " " OOO_STRING_SVTOOLS_HTML_O_align "=\"" +
-            OString(pStr) + "\"";
+        OString sOut = OStringLiteral(" " OOO_STRING_SVTOOLS_HTML_O_align "=\"") +
+            pStr + "\"";
         rWrt.Strm().WriteOString( sOut );
     }
 
diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx
index db7edb38a868..54bd87050034 100644
--- a/sw/source/filter/html/htmlfld.cxx
+++ b/sw/source/filter/html/htmlfld.cxx
@@ -588,8 +588,7 @@ void SwHTMLParser::InsertCommentText( const sal_Char *pTag )
     m_aContents += aToken;
     if( bEmpty && pTag )
     {
-        OUString aTmp( m_aContents );
-        m_aContents = "HTML: <" + OUString( *pTag ) + ">" + aTmp;
+        m_aContents = OUStringLiteral("HTML: <") + OUStringLiteral1(*pTag) + ">" + m_aContents;
     }
 }
 
diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index 3b01bcf938a6..a8468320b5e9 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -176,7 +176,7 @@ static void lcl_html_outEvents( SvStream& rStrm,
             sOut += OString(pOpt);
         else
         {
-            sOut += OString(OOO_STRING_SVTOOLS_HTML_O_sdevent) +
+            sOut += OOO_STRING_SVTOOLS_HTML_O_sdevent +
                 OUStringToOString(sListener, RTL_TEXTENCODING_ASCII_US) + "-" +
                 OUStringToOString(sMethod, RTL_TEXTENCODING_ASCII_US);
         }
@@ -510,8 +510,8 @@ void SwHTMLWriter::OutForm( bool bOn,
 
         if( pStr )
         {
-            sOut += " " OOO_STRING_SVTOOLS_HTML_O_enctype "=\"" +
-                OString(pStr) + "\"";
+            sOut += OStringLiteral(" " OOO_STRING_SVTOOLS_HTML_O_enctype "=\"") +
+                pStr + "\"";
         }
     }
 
@@ -853,8 +853,8 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
                     auto b = o3tl::tryAccess<bool>(aTmp2);
                     pWrapStr = (b && *b) ? OOO_STRING_SVTOOLS_HTML_WW_hard
                                          : OOO_STRING_SVTOOLS_HTML_WW_soft;
-                    sOptions += " " OOO_STRING_SVTOOLS_HTML_O_wrap "=\"" +
-                        OString(pWrapStr) + "\"";
+                    sOptions += OStringLiteral(" " OOO_STRING_SVTOOLS_HTML_O_wrap "=\"") +
+                        pWrapStr + "\"";
                 }
             }
             else
@@ -931,11 +931,11 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt,
     if( eTag == TAG_NONE )
         return rWrt;
 
-    OString sOut = "<" + OString(TagNames[eTag]);
+    OString sOut = OStringLiteral("<") + TagNames[eTag];
     if( eType != TYPE_NONE )
     {
-        sOut += " " OOO_STRING_SVTOOLS_HTML_O_type "=\"" +
-            OString(TypeNames[eType]) + "\"";
+        sOut += OStringLiteral(" " OOO_STRING_SVTOOLS_HTML_O_type "=\"") +
+            TypeNames[eType] + "\"";
     }
 
     aTmp = xPropSet->getPropertyValue("Name");
diff --git a/sw/source/filter/html/htmlnumwriter.cxx b/sw/source/filter/html/htmlnumwriter.cxx
index c4fd8ea9bdf7..22c63e29ec78 100644
--- a/sw/source/filter/html/htmlnumwriter.cxx
+++ b/sw/source/filter/html/htmlnumwriter.cxx
@@ -212,7 +212,7 @@ Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt,
 
             if( pStr )
             {
-                sOut += " " OOO_STRING_SVTOOLS_HTML_O_type "=\"" + OString(pStr) + "\"";
+                sOut += OStringLiteral(" " OOO_STRING_SVTOOLS_HTML_O_type "=\"") + pStr + "\"";
             }
         }
         else if( SVX_NUM_BITMAP == eType )
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 0bc8cc347d64..2ccdcc932ab9 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -910,7 +910,7 @@ static void OutBodyColor( const sal_Char* pTag, const SwFormat *pFormat,
     if( pColorItem )
     {
         OStringBuffer sOut;
-        sOut.append(" " + OString(pTag) + "=");
+        sOut.append(OStringLiteral(" ") + pTag + "=");
         rHWrt.Strm().WriteOString( sOut.makeStringAndClear() );
         Color aColor( pColorItem->GetValue() );
         if( COL_AUTO == aColor )
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 27b3bb1a4c62..196970c2b4da 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6378,7 +6378,7 @@ void DocxAttributeOutput::FontCharset( sal_uInt8 nCharSet, rtl_TextEncoding nEnc
 
     OString aCharSet( OString::number( nCharSet, 16 ) );
     if ( aCharSet.getLength() == 1 )
-        aCharSet = OString( "0" ) + aCharSet;
+        aCharSet = "0" + aCharSet;
     pAttr->add( FSNS( XML_w, XML_val ), aCharSet.getStr());
 
     if( GetExport().GetFilter().getVersion( ) != oox::core::ECMA_DIALECT )
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 4d2c56e67593..65c1158686e0 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -517,7 +517,7 @@ void RtfAttributeOutput::StartRuby(const SwTextNode& rNode, sal_Int32 nPos,
     aStr += " \\o";
     if (aWW8Ruby.GetDirective())
     {
-        aStr += "\\a" + OUString(aWW8Ruby.GetDirective());
+        aStr += "\\a" + OUStringLiteral1(aWW8Ruby.GetDirective());
     }
     aStr += "(\\s\\up ";
 
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index fd0f55dc7063..ad1768d25d84 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -837,7 +837,7 @@ void WW8AttributeOutput::StartRuby( const SwTextNode& rNode, sal_Int32 /*nPos*/,
     aStr += " \\o";
     if (aWW8Ruby.GetDirective())
     {
-        aStr += "\\a" + OUString(aWW8Ruby.GetDirective());
+        aStr += OUStringLiteral("\\a") + OUStringLiteral1(aWW8Ruby.GetDirective());
     }
     aStr += "(\\s\\up ";
 
@@ -1241,7 +1241,7 @@ void AttributeOutputBase::TOXMark( const SwTextNode& rNode, const SwTOXMark& rAt
             break;
 
         case TOX_USER:
-            sText += "\" \\f \"" + OUString(static_cast<sal_Char>( 'A' + GetExport( ).GetId( *rAttr.GetTOXType() ) ));
+            sText += "\" \\f \"" + OUStringLiteral1(static_cast<sal_Char>( 'A' + GetExport( ).GetId( *rAttr.GetTOXType() ) ));
             [[fallthrough]];
         case TOX_CONTENT:
             {
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 73059165f100..4f959c18a28b 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2289,7 +2289,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
                         if( TOX_USER == pTOX->GetType() )
                         {
                             sStr += "\""
-                                + OUString(static_cast<sal_Char>( 'A' + GetExport( ).GetId( *pTOX->GetTOXType() ) ))
+                                + OUStringLiteral1(static_cast<sal_Char>( 'A' + GetExport( ).GetId( *pTOX->GetTOXType() ) ))
                                 + sEntryEnd;
                         }
                     }
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 01b434d2829f..1e0a1fc066a9 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -7402,7 +7402,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib const & rFib )
 #ifdef OSL_BIGENDIAN
                     swapEndian(pSecondary);
 #endif
-                    p->sFontname += ";" + OUString(pSecondary);
+                    p->sFontname += OUStringLiteral(";") + pSecondary;
                 }
 
                 // #i43762# check font name for illegal characters
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 21ab12a588ce..3600d05bcb8e 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -3198,7 +3198,7 @@ OUString SwTokenWindow::CreateQuickHelp(const SwFormToken& rToken)
     {
         if (!rToken.sCharStyleName.isEmpty())
         {
-            sEntry += OUString(' ') + m_sCharStyle + rToken.sCharStyleName;
+            sEntry += " " + m_sCharStyle + rToken.sCharStyleName;
         }
     }
 
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index 0f24525ffc05..10a1ed6a9fed 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -438,7 +438,7 @@ void SwStyleSheetIterator::SwPoolFormatList::RemoveName(SfxStyleFamily eFam,
 // Add Strings to the list of templates
 void SwStyleSheetIterator::SwPoolFormatList::Append( char cChar, const OUString& rStr )
 {
-    const OUString aStr = OUString(cChar) + rStr;
+    const OUString aStr = OUStringLiteral1(cChar) + rStr;
 
     UniqueHash::const_iterator it = maUnique.find(aStr);
     if (it != maUnique.end())
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index 6e32ee92dcb3..431441c9f15c 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -1025,7 +1025,7 @@ IMPL_LINK(SwRedlineAcceptDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
     if (nColumn == -1)
         nColumn = 4;
     for (sal_Int32 i = 0; i < 5; ++i)
-        m_xPopup->set_active(OString("writersort") + OString::number(i), i == nColumn);
+        m_xPopup->set_active("writersort" + OString::number(i), i == nColumn);
 
     OString sCommand = m_xPopup->popup_at_rect(&rTreeView, tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1)));
 
diff --git a/test/source/sheet/xsheetauditing.cxx b/test/source/sheet/xsheetauditing.cxx
index 3e832413ffe4..61e96d09d92f 100644
--- a/test/source/sheet/xsheetauditing.cxx
+++ b/test/source/sheet/xsheetauditing.cxx
@@ -87,7 +87,8 @@ void XSheetAuditing::testShowErrors()
     uno::Reference<sheet::XSpreadsheet> xSheet(xAuditing, UNO_QUERY_THROW);
     uno::Reference<table::XCell> xCell = xSheet->getCellByPosition(7, 6);
     xCell->setValue(-9);
-    xCell->setFormula("=SQRT(" + OUString(static_cast<char>('A' + 7)) + OUString::number(7) + ")");
+    xCell->setFormula("=SQRT(" + OUStringLiteral1(static_cast<char>('A' + 7)) + OUString::number(7)
+                      + ")");
 
     uno::Reference<text::XText> xText(xCell, UNO_QUERY_THROW);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("No error code", OUString("Err:522"), xText->getString());
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 4b0ba89de7d4..38420ba384d2 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -82,7 +82,7 @@ OUString XmlTestTools::getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const
     CPPUNIT_ASSERT(pXmlDoc);
     xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, rXPath);
     xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
-    CPPUNIT_ASSERT_EQUAL_MESSAGE(OString("In <" + OString(pXmlDoc->name) + ">, XPath '" + rXPath + "' number of nodes is incorrect").getStr(),
+    CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OStringLiteral("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' number of nodes is incorrect").getStr(),
                                  1, xmlXPathNodeSetGetLength(pXmlNodes));
     if (rAttribute.isEmpty())
     {
@@ -91,7 +91,7 @@ OUString XmlTestTools::getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const
     }
     xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
     xmlChar * prop = xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr()));
-    OString sAttAbsent = "In <" + OString(pXmlDoc->name) + ">, XPath '" + rXPath
+    OString sAttAbsent = OStringLiteral("In <") + pXmlDoc->name + ">, XPath '" + rXPath
                          + "' no attribute '" + rAttribute + "' exist";
     CPPUNIT_ASSERT_MESSAGE(sAttAbsent.getStr(), prop);
     OUString s(convert(prop));
@@ -112,7 +112,7 @@ OUString XmlTestTools::getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath)
             xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
 
             CPPUNIT_ASSERT_MESSAGE(
-                OString("In <" + OString(pXmlDoc->name) + ">, XPath '" + rXPath + "' not found")
+                OString(OStringLiteral("In <") + pXmlDoc->name + ">, XPath '" + rXPath + "' not found")
                     .getStr(),
                 xmlXPathNodeSetGetLength(pXmlNodes) > 0);
 
@@ -164,7 +164,7 @@ void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath)
 void XmlTestTools::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute, const OUString& rExpectedValue)
 {
     OUString aValue = getXPath(pXmlDoc, rXPath, rAttribute);
-    CPPUNIT_ASSERT_EQUAL_MESSAGE(OString("In <" + OString(pXmlDoc->name) + ">, attribute '" + rAttribute + "' of '" + rXPath + "' incorrect value.").getStr(),
+    CPPUNIT_ASSERT_EQUAL_MESSAGE(OString(OStringLiteral("In <") + pXmlDoc->name + ">, attribute '" + rAttribute + "' of '" + rXPath + "' incorrect value.").getStr(),
                                  rExpectedValue, aValue);
 }
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list