summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-15 20:24:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-16 07:57:45 +0200
commit3ee177a14d8b816ef5b62500aeb54524c289e045 (patch)
tree982b524a298c2b2f959f5c858c81be9b3420566a
parent820f340f285932bbb8d6739177e9bb81c23c1a5d (diff)
loplugin:stringadd look through a couple more known-good methods
Change-Id: Ifbdb3e41eae665f7dcaf5301aaba2b6e4662cf48 Reviewed-on: https://gerrit.libreoffice.org/80855 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--compilerplugins/clang/stringadd.cxx15
-rw-r--r--compilerplugins/clang/test/stringadd.cxx10
-rw-r--r--editeng/source/outliner/outliner.cxx4
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx4
-rw-r--r--extensions/source/update/check/updatecheck.cxx4
-rw-r--r--filter/source/pdf/pdfexport.cxx7
-rw-r--r--framework/source/fwe/xml/statusbardocumenthandler.cxx8
-rw-r--r--framework/source/fwe/xml/toolboxdocumenthandler.cxx8
-rw-r--r--framework/source/uielement/generictoolbarcontroller.cxx12
-rw-r--r--framework/source/uielement/menubarmanager.cxx12
-rw-r--r--sal/qa/osl/process/osl_process.cxx4
-rw-r--r--sal/qa/rtl/process/rtl_Process.cxx6
-rw-r--r--sax/qa/cppunit/xmlimport.cxx5
-rw-r--r--sc/qa/unit/ucalc.cxx3
-rw-r--r--sc/qa/unit/ucalc_formula.cxx3
-rw-r--r--sc/source/core/tool/rangeutl.cxx3
-rw-r--r--sc/source/filter/html/htmlpars.cxx8
-rw-r--r--sc/source/ui/docshell/impex.cxx3
-rw-r--r--scripting/source/dlgprov/dlgevtatt.cxx16
-rw-r--r--sd/source/core/drawdoc2.cxx8
-rw-r--r--sd/source/ui/unoidl/unopage.cxx8
-rw-r--r--sfx2/source/appl/appuno.cxx14
-rw-r--r--sfx2/source/control/thumbnailviewitem.cxx3
-rw-r--r--starmath/source/dialog.cxx4
-rw-r--r--svx/source/form/fmtextcontrolshell.cxx3
-rw-r--r--svx/source/svdraw/svdotext.cxx3
-rw-r--r--sw/source/core/access/accpara.cxx6
-rw-r--r--sw/source/core/layout/dbg_lay.cxx14
-rw-r--r--sw/source/core/undo/undel.cxx6
-rw-r--r--sw/source/filter/html/htmlfld.cxx6
-rw-r--r--sw/source/filter/html/htmlform.cxx12
-rw-r--r--unoxml/source/dom/characterdata.cxx15
-rw-r--r--vcl/source/outdev/text.cxx3
-rw-r--r--xmlhelp/source/cxxhelp/provider/urlparameter.cxx10
-rw-r--r--xmloff/source/draw/sdxmlexp.cxx8
35 files changed, 114 insertions, 144 deletions
diff --git a/compilerplugins/clang/stringadd.cxx b/compilerplugins/clang/stringadd.cxx
index 7ae30922d5c8..986b2f938c7d 100644
--- a/compilerplugins/clang/stringadd.cxx
+++ b/compilerplugins/clang/stringadd.cxx
@@ -46,10 +46,13 @@ public:
{
std::string fn(handler.getMainFileName());
loplugin::normalizeDotDotInFilePath(fn);
- if (fn == SRCDIR "/sal/qa/rtl/oustring/rtl_OUString2.cxx"
- || fn == SRCDIR "/sal/qa/rtl/strings/test_oustring_concat.cxx"
- || fn == SRCDIR "/sal/qa/rtl/strings/test_ostring_concat.cxx"
- || fn == SRCDIR "/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx")
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/qa/rtl/oustring/"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/qa/rtl/oustringbuffer/"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/qa/rtl/strings/"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/qa/OStringBuffer/"))
return false;
// there is an ifdef here, but my check is not working, not sure why
if (fn == SRCDIR "/pyuno/source/module/pyuno_runtime.cxx")
@@ -183,7 +186,6 @@ 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());
@@ -261,7 +263,8 @@ bool StringAdd::isSideEffectFree(Expr const* expr)
if (calleeMethodDecl && calleeMethodDecl->getIdentifier())
{
auto name = calleeMethodDecl->getName();
- if (name == "number" || name == "unacquired")
+ if (callExpr->getNumArgs() > 0
+ && (name == "number" || name == "unacquired" || "boolean"))
{
auto tc = loplugin::TypeCheck(calleeMethodDecl->getParent());
if (tc.Class("OUString") || tc.Class("OString"))
diff --git a/compilerplugins/clang/test/stringadd.cxx b/compilerplugins/clang/test/stringadd.cxx
index c4fe15b16d68..27cc57f1395e 100644
--- a/compilerplugins/clang/test/stringadd.cxx
+++ b/compilerplugins/clang/test/stringadd.cxx
@@ -19,7 +19,7 @@ namespace test1
{
static const char XXX1[] = "xxx";
static const char XXX2[] = "xxx";
-void f(OUString s1, int i, OString o)
+void f1(OUString s1, int i, OString o)
{
OUString s2 = s1;
// expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}}
@@ -41,7 +41,7 @@ void f(OUString s1, int i, OString o)
// expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}}
s2 += OStringToOUString(o, RTL_TEXTENCODING_UTF8);
}
-void g(OString s1, int i, OUString u)
+void f2(OString s1, int i, OUString u)
{
OString s2 = s1;
// expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}}
@@ -59,6 +59,12 @@ void g(OString s1, int i, OUString u)
// expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}}
s2 += OUStringToOString(u, RTL_TEXTENCODING_ASCII_US);
}
+void f3(OUString aStr, int nFirstContent)
+{
+ OUString aFirstStr = aStr.copy(0, nFirstContent);
+ // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}}
+ aFirstStr += "...";
+}
}
namespace test2
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 515a9bcebe02..c6116b3b9520 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -704,8 +704,8 @@ void Outliner::ImplSetLevelDependentStyleSheet( sal_Int32 nPara )
nDepth = 0;
OUString aNewStyleSheetName( pStyle->GetName() );
- aNewStyleSheetName = aNewStyleSheetName.copy( 0, aNewStyleSheetName.getLength()-1 );
- aNewStyleSheetName += OUString::number( nDepth+1 );
+ aNewStyleSheetName = aNewStyleSheetName.copy( 0, aNewStyleSheetName.getLength()-1 ) +
+ OUString::number( nDepth+1 );
SfxStyleSheet* pNewStyle = static_cast<SfxStyleSheet*>(GetStyleSheetPool()->Find( aNewStyleSheetName, pStyle->GetFamily() ));
DBG_ASSERT( pNewStyle, "AutoStyleSheetName - Style not found!" );
if ( pNewStyle && ( pNewStyle != GetStyleSheet( nPara ) ) )
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 166e6989cd0b..186853dfd355 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -2148,8 +2148,8 @@ namespace pcr
for ( sal_Int32 i = 0; i < nKnownControlTypes; ++i )
{
- OUString sServiceName( "com.sun.star.awt." );
- sServiceName += OUString::createFromAscii( aControlModelServiceNames[ i ] );
+ OUString sServiceName = "com.sun.star.awt." +
+ OUString::createFromAscii( aControlModelServiceNames[ i ] );
if ( xServiceInfo->supportsService( sServiceName ) )
{
diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx
index e416e8cdea95..cc196ce7d180 100644
--- a/extensions/source/update/check/updatecheck.cxx
+++ b/extensions/source/update/check/updatecheck.cxx
@@ -118,8 +118,8 @@ OUString getImageFromFileName(const OUString& aFile)
sal_uInt32 lastIndex = aUnpackPath.lastIndexOf('/');
if ( lastIndex > 0 )
{
- aUnpackPath = aUnpackPath.copy( 0, lastIndex+1 );
- aUnpackPath += "unpack_update";
+ aUnpackPath = aUnpackPath.copy( 0, lastIndex+1 ) +
+ "unpack_update";
}
oslFileHandle hOut = nullptr;
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 2cf302bda668..199bcf10cb14 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -1178,10 +1178,9 @@ void PDFExport::ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rP
while(lnCount)
{
- OUString tempstr = watermark;
- watermark = watermark.copy(0, lnIndex);
- watermark += "\n";
- watermark += tempstr.copy(lnIndex);
+ watermark = watermark.copy(0, lnIndex) +
+ "\n" +
+ watermark.copy(lnIndex);
lnIndex += lineLength;
lnCount--;
}
diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx
index d4fb733c7d2c..b0289933114e 100644
--- a/framework/source/fwe/xml/statusbardocumenthandler.cxx
+++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx
@@ -156,14 +156,14 @@ OReadStatusBarDocumentHandler::OReadStatusBarDocumentHandler(
{
if ( StatusBarEntries[i].nNamespace == SB_NS_STATUSBAR )
{
- OUString temp = XMLNS_STATUSBAR XMLNS_FILTER_SEPARATOR;
- temp += OUString::createFromAscii( StatusBarEntries[i].aEntryName );
+ OUString temp = XMLNS_STATUSBAR XMLNS_FILTER_SEPARATOR +
+ OUString::createFromAscii( StatusBarEntries[i].aEntryName );
m_aStatusBarMap.emplace( temp, static_cast<StatusBar_XML_Entry>(i) );
}
else
{
- OUString temp = XMLNS_XLINK XMLNS_FILTER_SEPARATOR;
- temp += OUString::createFromAscii( StatusBarEntries[i].aEntryName );
+ OUString temp = XMLNS_XLINK XMLNS_FILTER_SEPARATOR +
+ OUString::createFromAscii( StatusBarEntries[i].aEntryName );
m_aStatusBarMap.emplace( temp, static_cast<StatusBar_XML_Entry>(i) );
}
}
diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
index 50d7246a7a4c..509a7235cd50 100644
--- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx
+++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
@@ -134,14 +134,14 @@ OReadToolBoxDocumentHandler::OReadToolBoxDocumentHandler( const Reference< XInde
{
if ( ToolBoxEntries[i].nNamespace == TB_NS_TOOLBAR )
{
- OUString temp = XMLNS_TOOLBAR XMLNS_FILTER_SEPARATOR;
- temp += OUString::createFromAscii( ToolBoxEntries[i].aEntryName );
+ OUString temp = XMLNS_TOOLBAR XMLNS_FILTER_SEPARATOR +
+ OUString::createFromAscii( ToolBoxEntries[i].aEntryName );
m_aToolBoxMap.emplace( temp, static_cast<ToolBox_XML_Entry>(i) );
}
else
{
- OUString temp = XMLNS_XLINK XMLNS_FILTER_SEPARATOR;
- temp += OUString::createFromAscii( ToolBoxEntries[i].aEntryName );
+ OUString temp = XMLNS_XLINK XMLNS_FILTER_SEPARATOR +
+ OUString::createFromAscii( ToolBoxEntries[i].aEntryName );
m_aToolBoxMap.emplace( temp, static_cast<ToolBox_XML_Entry>(i) );
}
}
diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx
index 0049006c9099..31b02118b2c9 100644
--- a/framework/source/uielement/generictoolbarcontroller.cxx
+++ b/framework/source/uielement/generictoolbarcontroller.cxx
@@ -209,21 +209,15 @@ void GenericToolbarController::statusChanged( const FeatureStateEvent& Event )
// Replacement for place holders
if ( aStrValue.startsWith("($1)") )
{
- OUString aTmp(FwkResId(STR_UPDATEDOC));
- aTmp += " " + aStrValue.copy( 4 );
- aStrValue = aTmp;
+ aStrValue = FwkResId(STR_UPDATEDOC) + " " + aStrValue.copy( 4 );
}
else if ( aStrValue.startsWith("($2)") )
{
- OUString aTmp(FwkResId(STR_CLOSEDOC_ANDRETURN));
- aTmp += aStrValue.copy( 4 );
- aStrValue = aTmp;
+ aStrValue = FwkResId(STR_CLOSEDOC_ANDRETURN) + aStrValue.copy( 4 );
}
else if ( aStrValue.startsWith("($3)") )
{
- OUString aTmp(FwkResId(STR_SAVECOPYDOC));
- aTmp += aStrValue.copy( 4 );
- aStrValue = aTmp;
+ aStrValue = FwkResId(STR_SAVECOPYDOC) + aStrValue.copy( 4 );
}
m_pToolbar->SetItemText( m_nID, aStrValue );
m_pToolbar->SetQuickHelpText( m_nID, aStrValue );
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index ae83e530c00b..41f358d819f9 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -366,21 +366,15 @@ void SAL_CALL MenuBarManager::statusChanged( const FeatureStateEvent& Event )
// Replacement for place holders
if ( aItemText.startsWith("($1)") )
{
- OUString aTmp(FwkResId(STR_UPDATEDOC));
- aTmp += " " + aItemText.copy( 4 );
- aItemText = aTmp;
+ aItemText = FwkResId(STR_UPDATEDOC) + " " + aItemText.copy( 4 );
}
else if ( aItemText.startsWith("($2)") )
{
- OUString aTmp(FwkResId(STR_CLOSEDOC_ANDRETURN));
- aTmp += aItemText.copy( 4 );
- aItemText = aTmp;
+ aItemText = FwkResId(STR_CLOSEDOC_ANDRETURN) + aItemText.copy( 4 );
}
else if ( aItemText.startsWith("($3)") )
{
- OUString aTmp(FwkResId(STR_SAVECOPYDOC));
- aTmp += aItemText.copy( 4 );
- aItemText = aTmp;
+ aItemText = FwkResId(STR_SAVECOPYDOC) + aItemText.copy( 4 );
}
m_pVCLMenu->ShowItem( menuItemHandler->nItemId );
diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx
index 6ba730af5cd6..eaf34bd46d5b 100644
--- a/sal/qa/osl/process/osl_process.cxx
+++ b/sal/qa/osl/process/osl_process.cxx
@@ -73,8 +73,8 @@ static OUString getExecutablePath()
osl::Module::getUrlFromAddress(
reinterpret_cast<oslGenericFunction>(&getExecutablePath), dirPath);
dirPath = dirPath.copy( 0, dirPath.lastIndexOf('/') );
- dirPath = dirPath.copy( 0, dirPath.lastIndexOf('/') + 1);
- dirPath += "Executable";
+ dirPath = dirPath.copy( 0, dirPath.lastIndexOf('/') + 1) +
+ "Executable";
return dirPath;
}
diff --git a/sal/qa/rtl/process/rtl_Process.cxx b/sal/qa/rtl/process/rtl_Process.cxx
index acb8f9501f08..6b7ba799a415 100644
--- a/sal/qa/rtl/process/rtl_Process.cxx
+++ b/sal/qa/rtl/process/rtl_Process.cxx
@@ -57,8 +57,7 @@ static OUString getModulePath()
printUString(suDirPath, "modulePath:");
suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') );
- suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') + 1);
- suDirPath += "bin";
+ suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') + 1) + "bin";
return suDirPath;
}
@@ -232,8 +231,7 @@ public:
//we could get return value only after the process terminated
osl_joinProcess(hProcess);
- sal_Char pUUID2[33];
- pUUID2[32] = '\0';
+ sal_Char pUUID2[33] {};
sal_uInt64 nRead = 0;
osl_readFile( *pChildOutputRead, pUUID2, 32, &nRead );
printf("read buffer is %s, nRead is %" SAL_PRIdINT64 "\n", pUUID2, nRead );
diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx
index 63415c8b0b39..91c955982746 100644
--- a/sax/qa/cppunit/xmlimport.cxx
+++ b/sax/qa/cppunit/xmlimport.cxx
@@ -229,9 +229,8 @@ OUString resolveNamespace( const OUString& aName )
{
if ( aName.getLength() > index + 1 )
{
- OUString aAttributeName = getNamespaceValue( aName.copy( 0, index ) );
- aAttributeName += ":";
- aAttributeName += aName.copy( index + 1 );
+ OUString aAttributeName = getNamespaceValue( aName.copy( 0, index ) ) +
+ ":" + aName.copy( index + 1 );
return aAttributeName;
}
}
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index e697dc700aad..e3fdc96c32d4 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1619,8 +1619,7 @@ void Test::testInsertNameList()
ScAddress aExprPos = aPos;
aExprPos.IncCol();
OUString aExpr = m_pDoc->GetString(aExprPos);
- OUString aExpected = "=";
- aExpected += OUString::createFromAscii(aNames[i].mpExpr);
+ OUString aExpected = "=" + OUString::createFromAscii(aNames[i].mpExpr);
CPPUNIT_ASSERT_EQUAL(aExpected, aExpr);
}
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 96c97c5793b9..66a83d4618aa 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -284,8 +284,7 @@ void Test::testFormulaParseReference()
for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
{
// Use the 'Dummy' sheet for this.
- OUString aInput("=");
- aInput += OUString::createFromAscii(aChecks[i]);
+ OUString aInput = "=" + OUString::createFromAscii(aChecks[i]);
m_pDoc->SetString(ScAddress(0,0,0), aInput);
ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,0,0), aChecks[i], "Wrong formula");
}
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 968b2d7ddd49..ea87576d7df5 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -53,8 +53,7 @@ bool ScRangeUtil::MakeArea( const OUString& rAreaStr,
if ( nColonPos == -1 && nPointPos != -1 )
{
- aStrArea += ":";
- aStrArea += rAreaStr.copy( nPointPos+1 ); // do not include '.' in copy
+ aStrArea += ":" + rAreaStr.copy( nPointPos+1 ); // do not include '.' in copy
}
bSuccess = ConvertDoubleRef( pDoc, aStrArea, nTab, startPos, endPos, rDetails );
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index eb547482b0d9..67ff279b84bc 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -257,8 +257,8 @@ ErrCode ScHTMLLayoutParser::Read( SvStream& rStream, const OUString& rBaseURL )
const sal_Char* pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 );
if( pCharSet )
{
- OUString aContentType = "text/html; charset=";
- aContentType += OUString::createFromAscii( pCharSet );
+ OUString aContentType = "text/html; charset=" +
+ OUString::createFromAscii( pCharSet );
xValues = new SvKeyValueIterator;
xValues->Append( SvKeyValue( OOO_STRING_SVTOOLS_HTML_META_content_type, aContentType ) );
@@ -2772,8 +2772,8 @@ ErrCode ScHTMLQueryParser::Read( SvStream& rStrm, const OUString& rBaseURL )
const sal_Char* pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 );
if( pCharSet )
{
- OUString aContentType = "text/html; charset=";
- aContentType += OUString::createFromAscii( pCharSet );
+ OUString aContentType = "text/html; charset=" +
+ OUString::createFromAscii( pCharSet );
xValues = new SvKeyValueIterator;
xValues->Append( SvKeyValue( OOO_STRING_SVTOOLS_HTML_META_content_type, aContentType ) );
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index cc04c75b57f0..494f0548a0c7 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -1174,8 +1174,7 @@ static bool lcl_PutString(
if (nFound > 6)
{
sal_Unicode cDec = '.';
- OUString aT( &cDec, 1);
- aT += rStr.copy( nStart[6], nEnd[6]+1-nStart[6]);
+ OUString aT = OUStringLiteral1(cDec) + rStr.copy( nStart[6], nEnd[6]+1-nStart[6]);
rtl_math_ConversionStatus eStatus;
double fV = rtl::math::stringToDouble( aT, cDec, 0, &eStatus );
if (eStatus == rtl_math_ConversionStatus_Ok)
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx
index 5523881fd59f..33e979753d3e 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -511,10 +511,10 @@ namespace dlgprov
sal_Int32 nIndex = sScriptCode.indexOf( ':' );
if ( nIndex >= 0 && nIndex < sScriptCode.getLength() )
{
- sScriptURL = "vnd.sun.star.script:";
- sScriptURL += sScriptCode.copy( nIndex + 1 );
- sScriptURL += "?language=Basic&location=";
- sScriptURL += sScriptCode.copy( 0, nIndex );
+ sScriptURL = "vnd.sun.star.script:" +
+ sScriptCode.copy( nIndex + 1 ) +
+ "?language=Basic&location=" +
+ sScriptCode.copy( 0, nIndex );
}
ScriptEvent aSFScriptEvent( aScriptEvent );
aSFScriptEvent.ScriptCode = sScriptURL;
@@ -611,10 +611,10 @@ namespace dlgprov
sal_Int32 nIndex = aRes.indexOf( '%' );
- OUString aOUFinal;
- aOUFinal += aRes.copy( 0, nIndex );
- aOUFinal += aQuoteChar + aMethodName + aQuoteChar;
- aOUFinal += aRes.copy( nIndex + 2 );
+ OUString aOUFinal =
+ aRes.copy( 0, nIndex ) +
+ aQuoteChar + aMethodName + aQuoteChar +
+ aRes.copy( nIndex + 2 );
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
VclMessageType::Warning, VclButtonsType::Ok, aOUFinal));
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index c4a776605a30..cc27e8553d8e 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -288,8 +288,8 @@ void SdDrawDocument::UpdatePageRelativeURLs(const OUString& rOldName, const OUSt
{
if (aURL.getLength() == rOldName.getLength() + 1) // standard page name
{
- aURL = aURL.replaceAt(1, aURL.getLength() - 1, "");
- aURL += rNewName;
+ aURL = aURL.replaceAt(1, aURL.getLength() - 1, "") +
+ rNewName;
pURLField->SetURL(aURL);
}
else
@@ -298,8 +298,8 @@ void SdDrawDocument::UpdatePageRelativeURLs(const OUString& rOldName, const OUSt
if (aURL.getLength() == rOldName.getLength() + 2 + sNotes.getLength()
&& aURL.indexOf(sNotes, rOldName.getLength() + 2) == rOldName.getLength() + 2)
{
- aURL = aURL.replaceAt(1, aURL.getLength() - 1, "");
- aURL += rNewName + " " + sNotes;
+ aURL = aURL.replaceAt(1, aURL.getLength() - 1, "") +
+ rNewName + " " + sNotes;
pURLField->SetURL(aURL);
}
}
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index ca082fe01c11..f0eb22d9bf2b 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -2828,8 +2828,8 @@ void SdMasterPage::setBackground( const Any& rValue )
if(pSSPool)
{
OUString aLayoutName( static_cast< SdPage* >( SvxFmDrawPage::mpPage )->GetLayoutName() );
- aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4);
- aLayoutName += STR_LAYOUT_BACKGROUND;
+ aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4) +
+ STR_LAYOUT_BACKGROUND;
SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SfxStyleFamily::Page );
if( pStyleSheet )
@@ -2875,8 +2875,8 @@ void SdMasterPage::getBackground( Any& rValue )
if(pSSPool)
{
OUString aLayoutName( static_cast< SdPage* >(SvxFmDrawPage::mpPage)->GetLayoutName() );
- aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4);
- aLayoutName += STR_LAYOUT_BACKGROUND;
+ aLayoutName = aLayoutName.copy(0, aLayoutName.indexOf(SD_LT_SEPARATOR)+4) +
+ STR_LAYOUT_BACKGROUND;
SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SfxStyleFamily::Page );
if( pStyleSheet )
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 069d1b1fe47c..d5e315147957 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -1272,10 +1272,9 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b
nSubId |= CONVERT_TWIPS;
DBG_ASSERT(( pType->aAttrib[n-1].nAID ) <= 127, "Member ID out of range" );
- OUString aName( OUString::createFromAscii( pSlot->pUnoName ) ) ;
- aName += ".";
- aName += OUString::createFromAscii( pType->aAttrib[n-1].pName ) ;
- pValue[nActProp].Name = aName;
+ pValue[nActProp].Name = OUString::createFromAscii( pSlot->pUnoName ) +
+ "." +
+ OUString::createFromAscii( pType->aAttrib[n-1].pName );
if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
{
SAL_WARN( "sfx", "Sub item " << pType->aAttrib[n-1].nAID
@@ -1318,10 +1317,9 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b
nSubId |= CONVERT_TWIPS;
DBG_ASSERT((rArg.pType->aAttrib[n-1].nAID) <= 127, "Member ID out of range" );
- OUString aName( OUString::createFromAscii( rArg.pName ) ) ;
- aName += ".";
- aName += OUString::createFromAscii( rArg.pType->aAttrib[n-1].pName ) ;
- pValue[nActProp].Name = aName;
+ pValue[nActProp].Name = OUString::createFromAscii( rArg.pName ) +
+ "." +
+ OUString::createFromAscii( rArg.pType->aAttrib[n-1].pName ) ;
if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
{
SAL_WARN( "sfx", "Sub item "
diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx
index 6e0619daf945..c2957f9ff4bd 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -242,8 +242,7 @@ void ThumbnailViewItem::addTextPrimitives (const OUString& rText, const Thumbnai
--nLength;
}
- aText = aText.copy(0, nLineStart+nLength);
- aText += "...";
+ aText = aText.copy(0, nLineStart+nLength) + "...";
nLineLength = nLength + 3;
}
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 3d5442fb4075..1c2d5f3405fc 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -1585,8 +1585,8 @@ IMPL_LINK_NOARG(SmSymDefineDialog, CharHighlightHdl, SvxShowCharSet*, void)
// display Unicode position as symbol name while iterating over characters
const OUString aHex(OUString::number(cChar, 16).toAsciiUpperCase());
const OUString aPattern( (aHex.getLength() > 4) ? OUString("Ux000000") : OUString("Ux0000") );
- OUString aUnicodePos( aPattern.copy( 0, aPattern.getLength() - aHex.getLength() ) );
- aUnicodePos += aHex;
+ OUString aUnicodePos = aPattern.copy( 0, aPattern.getLength() - aHex.getLength() ) +
+ aHex;
m_xSymbols->set_entry_text(aUnicodePos);
m_xSymbolName->set_label(aUnicodePos);
}
diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx
index 15d36a0e82f3..53de54235b4f 100644
--- a/svx/source/form/fmtextcontrolshell.cxx
+++ b/svx/source/form/fmtextcontrolshell.cxx
@@ -434,8 +434,7 @@ namespace svx
if ( pAsciiUnoName )
{
- sSlotUnoName = ".uno:";
- sSlotUnoName += OUString::createFromAscii( pAsciiUnoName );
+ sSlotUnoName = ".uno:" + OUString::createFromAscii( pAsciiUnoName );
}
else
{
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 7fd3a450bd2c..c593b9a2beaa 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -969,8 +969,7 @@ OUString SdrTextObj::TakeObjNameSingul() const
if(aStr2.getLength() > 10)
{
- aStr2 = aStr2.copy(0, 8);
- aStr2 += "...";
+ aStr2 = aStr2.copy(0, 8) + "...";
}
aStr += aStr2 + "\'";
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index b834d11c7920..335f06e86452 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -3470,10 +3470,12 @@ uno::Any SAL_CALL SwAccessibleParagraph::getExtendedAttributes()
OUString strHeading("heading-level:");
if( m_nHeadingLevel >= 0 )
strHeading += OUString::number(m_nHeadingLevel);
+ // tdf#84102: expose the same attribute with the name "level"
+ strHeading += ";level:";
+ if( m_nHeadingLevel >= 0 )
+ strHeading += OUString::number(m_nHeadingLevel);
strHeading += ";";
- strHeading += strHeading.copy(8); // tdf#84102: expose the same attribute with the name "level"
-
Ret <<= strHeading;
return Ret;
diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx
index 46dfae637ef2..9df20a47fc69 100644
--- a/sw/source/core/layout/dbg_lay.cxx
+++ b/sw/source/core/layout/dbg_lay.cxx
@@ -508,7 +508,6 @@ static OUString lcl_CellText(const SwCellFrame* pFrame)
{
OUString result;
int n = 0;
- sal_Char sz[RTL_STR_MAX_VALUEOFINT64];
const SwStartNode* pStartNode = pFrame->GetTabBox()->GetSttNd();
const SwEndNode* pEndNode = pStartNode->EndOfSectionNode();
@@ -526,19 +525,12 @@ static OUString lcl_CellText(const SwCellFrame* pFrame)
else if (pNode->IsTextNode())
{
n++;
- result += "Para:";
- rtl_str_valueOfInt64(sz, n, 10);
- OUString s = OUString::createFromAscii(sz);
- result += s + " ";
- result += pNode->GetTextNode()->GetText();
+ result += "Para:" + OUString::number(10) + " " +
+ pNode->GetTextNode()->GetText();
}
}
- rtl_str_valueOfInt64(sz, n, 10);
- OUString s = OUString::createFromAscii(sz);
- s += " para(s):" + result;
-
- return s;
+ return OUString::number(n) + " para(s):" + result;
}
static OString lcl_CellInfo(const SwCellFrame* pFrame)
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index e23382e5f0a3..ebdf25a63978 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -696,9 +696,9 @@ static OUString lcl_DenotedPortion(const OUString& rStr, sal_Int32 nStart, sal_I
}
else
{
- aResult = SwResId(STR_START_QUOTE);
- aResult += rStr.copy(nStart, nCount);
- aResult += SwResId(STR_END_QUOTE);
+ aResult = SwResId(STR_START_QUOTE) +
+ rStr.copy(nStart, nCount) +
+ SwResId(STR_END_QUOTE);
}
}
diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx
index 54bd87050034..ef27a0e91049 100644
--- a/sw/source/filter/html/htmlfld.cxx
+++ b/sw/source/filter/html/htmlfld.cxx
@@ -597,9 +597,9 @@ void SwHTMLParser::InsertComment( const OUString& rComment, const sal_Char *pTag
OUString aComment( rComment );
if( pTag )
{
- aComment += "</";
- aComment += OUString::createFromAscii(pTag);
- aComment += ">";
+ aComment += "</" +
+ OUString::createFromAscii(pTag) +
+ ">";
}
// MIB 24.06.97: If a PostIt should be insert after a space, we
diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx
index 6058d7df206e..ae5940dfcd7b 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -821,14 +821,14 @@ static void lcl_html_getEvents( const OUString& rOption, const OUString& rValue,
{
if( rOption.startsWithIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_sdevent ) )
{
- OUString aEvent( rOption.copy( strlen( OOO_STRING_SVTOOLS_HTML_O_sdevent ) ) );
- aEvent += "-" + rValue;
+ OUString aEvent = rOption.copy( strlen( OOO_STRING_SVTOOLS_HTML_O_sdevent ) ) +
+ "-" + rValue;
rUnoMacroTable.push_back(aEvent);
}
else if( rOption.startsWithIgnoreAsciiCase( OOO_STRING_SVTOOLS_HTML_O_sdaddparam ) )
{
- OUString aParam( rOption.copy( strlen( OOO_STRING_SVTOOLS_HTML_O_sdaddparam ) ) );
- aParam += "-" + rValue;
+ OUString aParam = rOption.copy( strlen( OOO_STRING_SVTOOLS_HTML_O_sdaddparam ) ) +
+ "-" + rValue;
rUnoMacroParamTable.push_back(aParam);
}
}
@@ -1594,8 +1594,8 @@ void SwHTMLParser::InsertInput()
if( !rServiceFactory.is() )
return;
- OUString sServiceName("com.sun.star.form.component.");
- sServiceName += OUString::createFromAscii(pType);
+ OUString sServiceName = "com.sun.star.form.component." +
+ OUString::createFromAscii(pType);
uno::Reference< XInterface > xInt =
rServiceFactory->createInstance( sServiceName );
if( !xInt.is() )
diff --git a/unoxml/source/dom/characterdata.cxx b/unoxml/source/dom/characterdata.cxx
index 2afc767995e3..f9fa0cce650f 100644
--- a/unoxml/source/dom/characterdata.cxx
+++ b/unoxml/source/dom/characterdata.cxx
@@ -98,8 +98,7 @@ namespace DOM
if ((offset+count) > tmp.getLength())
count = tmp.getLength() - offset;
- OUString tmp2 = tmp.copy(0, offset);
- tmp2 += tmp.copy(offset+count);
+ OUString tmp2 = tmp.copy(0, offset) + tmp.copy(offset+count);
OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
@@ -167,9 +166,9 @@ namespace DOM
throw e;
}
- OUString tmp2 = tmp.copy(0, offset);
- tmp2 += arg;
- tmp2 += tmp.copy(offset);
+ OUString tmp2 = tmp.copy(0, offset) +
+ arg +
+ tmp.copy(offset);
OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
@@ -204,9 +203,9 @@ namespace DOM
if ((offset+count) > tmp.getLength())
count = tmp.getLength() - offset;
- OUString tmp2 = tmp.copy(0, offset);
- tmp2 += arg;
- tmp2 += tmp.copy(offset+count);
+ OUString tmp2 = tmp.copy(0, offset) +
+ arg +
+ tmp.copy(offset+count);
OUString oldValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
xmlNodeSetContent(m_aNodePtr, reinterpret_cast<const xmlChar*>(OUStringToOString(tmp2, RTL_TEXTENCODING_UTF8).getStr()));
OUString newValue(reinterpret_cast<char*>(m_aNodePtr->content), strlen(reinterpret_cast<char*>(m_aNodePtr->content)), RTL_TEXTENCODING_UTF8);
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index ab32920fb8a4..63a68966c819 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -2006,8 +2006,7 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice,
{
if ( nFirstContent > 4 )
nFirstContent = 4;
- OUString aFirstStr = aStr.copy( 0, nFirstContent );
- aFirstStr += "...";
+ OUString aFirstStr = aStr.copy( 0, nFirstContent ) + "...";
OUString aTempStr = aFirstStr + aLastStr;
if ( _rLayout.GetTextWidth( aTempStr, 0, aTempStr.getLength() ) > nMaxWidth )
aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | DrawTextFlags::EndEllipsis, _rLayout );
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
index 8a395226e99f..05b7f1dbb1e9 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
@@ -378,12 +378,10 @@ bool URLParameter::scheme()
m_aExpr.copy(sal::static_int_cast<sal_uInt32>(nLen) - 6);
if( aLastStr == "DbPAR=" )
{
- OUString aNewExpr = m_aExpr.copy( 0, 20 );
- OUString aSharedStr("shared");
- aNewExpr += aSharedStr;
- aNewExpr += m_aExpr.copy( 20 );
- aNewExpr += aSharedStr;
- m_aExpr = aNewExpr;
+ m_aExpr = m_aExpr.copy( 0, 20 ) +
+ "shared" +
+ m_aExpr.copy( 20 ) +
+ "shared";
}
}
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 7cff2ef05666..7fa2fa86c315 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -1327,9 +1327,7 @@ static OUString findOrAppendImpl( std::vector< OUString >& rVector, const OUStri
// create a reference string with pPrefix and the index of the
// found or created rText
- OUString aStr( OUString::createFromAscii( pPrefix ) );
- aStr += OUString::number( nIndex );
- return aStr;
+ return OUString::createFromAscii( pPrefix ) + OUString::number( nIndex );
}
static OUString findOrAppendImpl( std::vector< DateTimeDeclImpl >& rVector, const OUString& rText, bool bFixed, sal_Int32 nFormat, const sal_Char* pPrefix )
@@ -1355,9 +1353,7 @@ static OUString findOrAppendImpl( std::vector< DateTimeDeclImpl >& rVector, cons
// create a reference string with pPrefix and the index of the
// found or created DateTimeDeclImpl
- OUString aStr( OUString::createFromAscii( pPrefix ) );
- aStr += OUString::number( nIndex );
- return aStr;
+ return OUString::createFromAscii( pPrefix ) + OUString::number( nIndex );
}
static const sal_Char gpStrHeaderTextPrefix[] = "hdr";