diff options
36 files changed, 177 insertions, 181 deletions
diff --git a/codemaker/source/cppumaker/cppuoptions.cxx b/codemaker/source/cppumaker/cppuoptions.cxx index 05c941b2c68a..90f16fdd3332 100644 --- a/codemaker/source/cppumaker/cppuoptions.cxx +++ b/codemaker/source/cppumaker/cppuoptions.cxx @@ -311,8 +311,8 @@ OString CppuOptions::prepareHelp() " -nD = no dependent types are generated.\n" " -G = generate only target files which does not exists.\n" " -Gc = generate only target files which content will be changed.\n" - " -X<file> = extra types which will not be taken into account for generation.\n\n"; - help += prepareVersion(); + " -X<file> = extra types which will not be taken into account for generation.\n\n" + + prepareVersion(); return help; } diff --git a/codemaker/source/javamaker/javaoptions.cxx b/codemaker/source/javamaker/javaoptions.cxx index 795d1bbf8955..31e43414c68c 100644 --- a/codemaker/source/javamaker/javaoptions.cxx +++ b/codemaker/source/javamaker/javaoptions.cxx @@ -234,8 +234,8 @@ OString JavaOptions::prepareHelp() " -nD = no dependent types are generated.\n" " -G = generate only target files which does not exists.\n" " -Gc = generate only target files which content will be changed.\n" - " -X<file> = extra types which will not be taken into account for generation.\n\n"; - help += prepareVersion(); + " -X<file> = extra types which will not be taken into account for generation.\n\n" + + prepareVersion(); return help; } diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index 749b9896cb0b..5421f1510ba4 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -1702,8 +1702,7 @@ namespace comphelper if (mbSafeModeDirExists) { // adapt work URL to do all repair op's in the correct directory - maUserConfigWorkURL += "/"; - maUserConfigWorkURL += getSafeModeName(); + maUserConfigWorkURL += "/" + getSafeModeName(); } } diff --git a/compilerplugins/clang/stringadd.cxx b/compilerplugins/clang/stringadd.cxx index 8b96de07e109..c1023c641bbb 100644 --- a/compilerplugins/clang/stringadd.cxx +++ b/compilerplugins/clang/stringadd.cxx @@ -74,11 +74,20 @@ public: bool VisitCXXOperatorCallExpr(CXXOperatorCallExpr const*); private: - const VarDecl* findAssignOrAdd(Stmt const*); - void checkForCompoundAssign(Stmt const* stmt1, Stmt const* stmt2, VarDecl const* varDecl); + struct VarDeclAndConstant + { + const VarDecl* varDecl; + bool bCompileTimeConstant; + bool bSideEffectFree; + }; + + VarDeclAndConstant findAssignOrAdd(Stmt const*); + void checkForCompoundAssign(Stmt const* stmt1, Stmt const* stmt2, + VarDeclAndConstant const& varDecl); Expr const* ignore(Expr const*); bool isSideEffectFree(Expr const*); + bool isCompileTimeConstant(Expr const*); }; bool StringAdd::VisitCompoundStmt(CompoundStmt const* compoundStmt) @@ -91,9 +100,9 @@ bool StringAdd::VisitCompoundStmt(CompoundStmt const* compoundStmt) { if (it == compoundStmt->body_end()) break; - const VarDecl* foundVar = findAssignOrAdd(*it); + VarDeclAndConstant foundVar = findAssignOrAdd(*it); // reference types have slightly weird behaviour - if (foundVar && !foundVar->getType()->isReferenceType()) + if (foundVar.varDecl && !foundVar.varDecl->getType()->isReferenceType()) { auto stmt1 = *it; ++it; @@ -109,7 +118,7 @@ bool StringAdd::VisitCompoundStmt(CompoundStmt const* compoundStmt) return true; } -const VarDecl* StringAdd::findAssignOrAdd(Stmt const* stmt) +StringAdd::VarDeclAndConstant StringAdd::findAssignOrAdd(Stmt const* stmt) { if (auto exprCleanup = dyn_cast<ExprWithCleanups>(stmt)) stmt = exprCleanup->getSubExpr(); @@ -123,14 +132,13 @@ const VarDecl* StringAdd::findAssignOrAdd(Stmt const* stmt) auto tc = loplugin::TypeCheck(varDeclLHS->getType()); if (!tc.Class("OUString").Namespace("rtl").GlobalNamespace() && !tc.Class("OString").Namespace("rtl").GlobalNamespace()) - return nullptr; + return {}; if (varDeclLHS->getStorageDuration() == SD_Static) - return nullptr; + return {}; if (!varDeclLHS->hasInit()) - return nullptr; - if (!isSideEffectFree(varDeclLHS->getInit())) - return nullptr; - return varDeclLHS; + return {}; + return { varDeclLHS, isCompileTimeConstant(varDeclLHS->getInit()), + isSideEffectFree(varDeclLHS->getInit()) }; } if (auto operatorCall = dyn_cast<CXXOperatorCallExpr>(stmt)) if (operatorCall->getOperator() == OO_Equal || operatorCall->getOperator() == OO_PlusEqual) @@ -140,16 +148,15 @@ const VarDecl* StringAdd::findAssignOrAdd(Stmt const* stmt) auto tc = loplugin::TypeCheck(varDeclLHS->getType()); if (!tc.Class("OUString").Namespace("rtl").GlobalNamespace() && !tc.Class("OString").Namespace("rtl").GlobalNamespace()) - return nullptr; + return {}; auto rhs = operatorCall->getArg(1); - if (!isSideEffectFree(rhs)) - return nullptr; - return varDeclLHS; + return { varDeclLHS, isCompileTimeConstant(rhs), isSideEffectFree(rhs) }; } - return nullptr; + return {}; } -void StringAdd::checkForCompoundAssign(Stmt const* stmt1, Stmt const* stmt2, VarDecl const* varDecl) +void StringAdd::checkForCompoundAssign(Stmt const* stmt1, Stmt const* stmt2, + VarDeclAndConstant const& varDecl) { // OString additions are frequently wrapped in these if (auto exprCleanup = dyn_cast<ExprWithCleanups>(stmt2)) @@ -164,10 +171,14 @@ void StringAdd::checkForCompoundAssign(Stmt const* stmt1, Stmt const* stmt2, Var auto declRefExprLHS = dyn_cast<DeclRefExpr>(ignore(operatorCall->getArg(0))); if (!declRefExprLHS) return; - if (declRefExprLHS->getDecl() != varDecl) + if (declRefExprLHS->getDecl() != varDecl.varDecl) return; + // if either side is a compile-time-constant, then we don't care about + // side-effects auto rhs = operatorCall->getArg(1); - if (!isSideEffectFree(rhs)) + if (varDecl.bCompileTimeConstant || isCompileTimeConstant(rhs)) + ; // good + else if (!varDecl.bSideEffectFree || !isSideEffectFree(rhs)) return; // if we cross a #ifdef boundary if (containsPreprocessingConditionalInclusion( @@ -304,6 +315,16 @@ bool StringAdd::isSideEffectFree(Expr const* expr) return false; } +bool StringAdd::isCompileTimeConstant(Expr const* expr) +{ + expr = compat::IgnoreImplicit(expr); + if (auto cxxConstructExpr = dyn_cast<CXXConstructExpr>(expr)) + if (cxxConstructExpr->getNumArgs() > 0 + && isa<clang::StringLiteral>(cxxConstructExpr->getArg(0))) + return true; + return false; +} + loplugin::Plugin::Registration<StringAdd> stringadd("stringadd"); } diff --git a/compilerplugins/clang/test/stringadd.cxx b/compilerplugins/clang/test/stringadd.cxx index a8469026e509..f36bbbca999e 100644 --- a/compilerplugins/clang/test/stringadd.cxx +++ b/compilerplugins/clang/test/stringadd.cxx @@ -99,6 +99,13 @@ void f(Bar b1, Bar& b2, Bar* b3) // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}} s3 += b3->m_field; } +OUString side_effect(); +void f2() +{ + OUString sRet = "xxx"; + // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}} + sRet += side_effect(); +} } // no warning expected @@ -117,17 +124,10 @@ void f() namespace test5 { OUString side_effect(); -int side_effect2(); void f() { - OUString sRet = "xxx"; - sRet += side_effect(); - sRet += OUString::number(side_effect2()); -} -void g() -{ OUString sRet = side_effect(); - sRet += "xxx"; + sRet += side_effect(); } } diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx index 748557e8b98a..71c87bec7c37 100644 --- a/cppu/source/uno/EnvStack.cxx +++ b/cppu/source/uno/EnvStack.cxx @@ -366,8 +366,7 @@ int SAL_CALL uno_Environment_isValid(uno_Environment * pEnv, rtl_uString ** pRea } else { - OUString envDcp(UNO_LB_UNO); - envDcp += cppu::EnvDcp::getPurpose(pEnv->pTypeName); + OUString envDcp = UNO_LB_UNO + cppu::EnvDcp::getPurpose(pEnv->pTypeName); uno::Environment env(envDcp); diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index e0d17f5247ec..ebe405aefb9d 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -7285,9 +7285,7 @@ SdrOle2Obj* SvxMSDffManager::CreateSdrOLEFromStorage( // (that's not the case for e.g. Fontwork ) // If that's not the case -> include it as graphic bool bValidStorage = false; - OUString aDstStgName(MSO_OLE_Obj); - - aDstStgName += OUString::number( ++nMSOleObjCntr ); + OUString aDstStgName = MSO_OLE_Obj + OUString::number( ++nMSOleObjCntr ); { tools::SvRef<SotStorage> xObjStg = rSrcStorage->OpenSotStorage( rStorageName ); diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx index 0d8a8656afd4..b2d018befbd2 100644 --- a/formula/source/ui/dlg/funcutl.cxx +++ b/formula/source/ui/dlg/funcutl.cxx @@ -231,8 +231,7 @@ void ArgInput::Show() void ArgInput::UpdateAccessibleNames() { - OUString aArgName(":"); - aArgName += pFtArg->get_label(); + OUString aArgName = ":" + pFtArg->get_label(); OUString aName = pBtnFx->get_tooltip_text(); aName += aArgName; diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx index d9b0003a60cb..2f2e3bb1e6f9 100644 --- a/idlc/source/options.cxx +++ b/idlc/source/options.cxx @@ -285,8 +285,7 @@ bool Options::initOptions(std::vector< std::string > & rArgs) { return badOption("invalid", option); } - OString param("-D"); - param += OString((*first).c_str(), (*first).size()); + OString param = "-D" + rtl::OStringView((*first).c_str(), (*first).size()); if (m_options.count("-D") > 0) { param = m_options["-D"] + " " + param; @@ -393,8 +392,8 @@ OString Options::prepareHelp() const " -verbose = verbose output.\n" " -w = display warning messages.\n" " -we = treat warnings as errors.\n" - " -h|-? = print this help message and exit.\n\n"; - help += prepareVersion(); + " -h|-? = print this help message and exit.\n\n" + + prepareVersion(); return help; } diff --git a/io/source/acceptor/acc_socket.cxx b/io/source/acceptor/acc_socket.cxx index ba6938928bbe..a72179ecb356 100644 --- a/io/source/acceptor/acc_socket.cxx +++ b/io/source/acceptor/acc_socket.cxx @@ -168,8 +168,8 @@ namespace io_acceptor { if(i != nBytesToRead) { - OUString message("acc_socket.cxx:SocketConnection::read: error - "); - message += m_socket.getErrorAsString(); + OUString message = "acc_socket.cxx:SocketConnection::read: error - " + + m_socket.getErrorAsString(); IOException ioException(message, static_cast<XConnection *>(this)); @@ -202,8 +202,8 @@ namespace io_acceptor { { if( m_socket.write( seq.getConstArray() , seq.getLength() ) != seq.getLength() ) { - OUString message("acc_socket.cxx:SocketConnection::write: error - "); - message += m_socket.getErrorAsString(); + OUString message = "acc_socket.cxx:SocketConnection::write: error - " + + m_socket.getErrorAsString(); IOException ioException(message, static_cast<XConnection *>(this)); diff --git a/io/source/connector/ctr_socket.cxx b/io/source/connector/ctr_socket.cxx index ab2eefd87872..6523d6408599 100644 --- a/io/source/connector/ctr_socket.cxx +++ b/io/source/connector/ctr_socket.cxx @@ -129,8 +129,8 @@ namespace stoc_connector { if(i != nBytesToRead && m_socket.getError() != osl_Socket_E_None) { - OUString message("ctr_socket.cxx:SocketConnection::read: error - "); - message += m_socket.getErrorAsString(); + OUString message = "ctr_socket.cxx:SocketConnection::read: error - " + + m_socket.getErrorAsString(); IOException ioException(message, static_cast<XConnection *>(this)); @@ -163,8 +163,8 @@ namespace stoc_connector { { if( m_socket.write( seq.getConstArray() , seq.getLength() ) != seq.getLength() ) { - OUString message("ctr_socket.cxx:SocketConnection::write: error - "); - message += m_socket.getErrorAsString(); + OUString message = "ctr_socket.cxx:SocketConnection::write: error - "+ + m_socket.getErrorAsString(); IOException ioException(message, static_cast<XConnection *>(this)); diff --git a/lotuswordpro/source/filter/lwptblformula.cxx b/lotuswordpro/source/filter/lwptblformula.cxx index c6af01f6e34f..fa8f39fa0bb4 100644 --- a/lotuswordpro/source/filter/lwptblformula.cxx +++ b/lotuswordpro/source/filter/lwptblformula.cxx @@ -101,9 +101,9 @@ void LwpFormulaInfo::ReadText() std::vector<char> aBuf(nStrLen + 1); m_pObjStrm->QuickRead(aBuf.data(), nStrLen); aBuf[nStrLen]= '\0'; - OUString aText = "\""; - aText += OUString(aBuf.data(), nStrLen, osl_getThreadTextEncoding()); - aText += "\""; + OUString aText = "\"" + + OUString(aBuf.data(), nStrLen, osl_getThreadTextEncoding()) + + "\""; m_aStack.push_back(std::make_unique<LwpFormulaText>(aText)); } diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx index e9ae753773a4..9061f583f152 100644 --- a/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx +++ b/lotuswordpro/source/filter/xfilter/xfdrawpath.cxx @@ -128,9 +128,9 @@ void XFDrawPath::ToXml(IXFStream *pStrm) //view-box: XFRect rect = m_aRect; - OUString strViewBox = "0 0 "; - strViewBox += OUString::number(rect.GetWidth()*1000) + " "; - strViewBox += OUString::number(rect.GetHeight()*1000); + OUString strViewBox = "0 0 " + + OUString::number(rect.GetWidth()*1000) + " " + + OUString::number(rect.GetHeight()*1000); pAttrList->AddAttribute( "svg:viewBox", strViewBox); //points diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx index 6b50db7c56ed..dcc12c2dadb8 100644 --- a/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx +++ b/lotuswordpro/source/filter/xfilter/xfdrawpolygon.cxx @@ -71,9 +71,9 @@ void XFDrawPolygon::ToXml(IXFStream *pStrm) pAttrList->Clear(); //view-box: XFRect rect = CalcViewBox(); - OUString strViewBox = "0 0 "; - strViewBox += OUString::number(rect.GetWidth()*1000) + " "; - strViewBox += OUString::number(rect.GetHeight()*1000); + OUString strViewBox = "0 0 " + + OUString::number(rect.GetWidth()*1000) + " " + + OUString::number(rect.GetHeight()*1000); pAttrList->AddAttribute( "svg:viewBox", strViewBox); //points diff --git a/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx b/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx index 2ddeca7f0c58..4cad76ebb3c4 100644 --- a/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx +++ b/lotuswordpro/source/filter/xfilter/xfdrawpolyline.cxx @@ -71,9 +71,9 @@ void XFDrawPolyline::ToXml(IXFStream *pStrm) pAttrList->Clear(); //view-box: XFRect rect = CalcViewBox(); - OUString strViewBox = "0 0 "; - strViewBox += OUString::number(rect.GetWidth()*1000) + " "; - strViewBox += OUString::number(rect.GetHeight()*1000); + OUString strViewBox = "0 0 " + + OUString::number(rect.GetWidth()*1000) + " " + + OUString::number(rect.GetHeight()*1000); pAttrList->AddAttribute( "svg:viewBox", strViewBox); //points diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index 348b259bc4e0..6b17d07098c6 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -967,11 +967,12 @@ namespace osl_FileBase bool bOk = compareFileName(aUStr, aUResultURL); - OString sError = "test for getSystemPathFromFileURL(' " + + OString sError = + "test for getSystemPathFromFileURL(' " + OUStringToOString(aUNormalURL, RTL_TEXTENCODING_ASCII_US) + - " ') function:use an absolute file URL, "; - sError += outputError(OUStringToOString(aUStr, RTL_TEXTENCODING_ASCII_US), - OUStringToOString(aUResultURL, RTL_TEXTENCODING_ASCII_US)); + " ') function:use an absolute file URL, " + + outputError(OUStringToOString(aUStr, RTL_TEXTENCODING_ASCII_US), + OUStringToOString(aUResultURL, RTL_TEXTENCODING_ASCII_US)); CPPUNIT_ASSERT_EQUAL_MESSAGE(sError.getStr(), osl::FileBase::E_None, nError); CPPUNIT_ASSERT_MESSAGE(sError.getStr(), bOk); @@ -990,11 +991,12 @@ namespace osl_FileBase bool bOk = compareFileName(aUStr, aUResultURL); - OString sError = "test for getSystemPathFromFileURL(' " + + OString sError = + "test for getSystemPathFromFileURL(' " + OUStringToOString(aUNormalURL, RTL_TEXTENCODING_ASCII_US) + - " ') function:use a CJK coded absolute URL, "; - sError += outputError(OUStringToOString(aUStr, RTL_TEXTENCODING_ASCII_US), - OUStringToOString(aUResultURL, RTL_TEXTENCODING_ASCII_US)); + " ') function:use a CJK coded absolute URL, " + + outputError(OUStringToOString(aUStr, RTL_TEXTENCODING_ASCII_US), + OUStringToOString(aUResultURL, RTL_TEXTENCODING_ASCII_US)); deleteTestDirectory(aTmpName10); CPPUNIT_ASSERT_EQUAL_MESSAGE(sError.getStr(), osl::FileBase::E_None, nError); diff --git a/sc/source/ui/unoobj/cellvaluebinding.cxx b/sc/source/ui/unoobj/cellvaluebinding.cxx index 8063ecf4b54e..a5d43ab012e2 100644 --- a/sc/source/ui/unoobj/cellvaluebinding.cxx +++ b/sc/source/ui/unoobj/cellvaluebinding.cxx @@ -405,9 +405,9 @@ namespace calc OCellValueBinding* pNonConstThis = const_cast< OCellValueBinding* >( this ); if ( !pNonConstThis->supportsType( _rType ) ) { - OUString sMessage( "The given type (" ); - sMessage += _rType.getTypeName(); - sMessage += ") is not supported by this binding."; + OUString sMessage = "The given type (" + + _rType.getTypeName() + + ") is not supported by this binding."; // TODO: localize this error message throw IncompatibleTypesException( sMessage, *pNonConstThis ); diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index d4f48cccc012..fcdb5c036f32 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -333,9 +333,7 @@ void SfxRequest_Impl::Record */ { - OUString aCommand(".uno:"); - aCommand += OUString( pSlot->GetUnoName(), strlen( pSlot->GetUnoName() ), RTL_TEXTENCODING_UTF8 ); - OUString aCmd( aCommand ); + OUString aCmd = ".uno:" + OUString::createFromAscii( pSlot->GetUnoName() ); if(!xRecorder.is()) return; diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 5340f841454c..7ca803627124 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -1480,9 +1480,8 @@ UCBStorage_Impl::UCBStorage_Impl( const OUString& rName, StreamMode nMode, UCBSt if ( m_bIsRoot ) { // create the special package URL for the package content - OUString aTemp = "vnd.sun.star.pkg://"; - aTemp += INetURLObject::encode( aName, INetURLObject::PART_AUTHORITY, INetURLObject::EncodeMechanism::All ); - m_aURL = aTemp; + m_aURL = "vnd.sun.star.pkg://" + + INetURLObject::encode( aName, INetURLObject::PART_AUTHORITY, INetURLObject::EncodeMechanism::All ); if ( m_nMode & StreamMode::WRITE ) { @@ -1521,9 +1520,8 @@ UCBStorage_Impl::UCBStorage_Impl( SvStream& rStream, UCBStorage* pStorage, bool // UCBStorages work on a content, so a temporary file for a content must be created, even if the stream is only // accessed readonly // the root storage opens the package; create the special package URL for the package content - OUString aTemp = "vnd.sun.star.pkg://"; - aTemp += INetURLObject::encode( m_pTempFile->GetURL(), INetURLObject::PART_AUTHORITY, INetURLObject::EncodeMechanism::All ); - m_aURL = aTemp; + m_aURL = "vnd.sun.star.pkg://" + + INetURLObject::encode( m_pTempFile->GetURL(), INetURLObject::PART_AUTHORITY, INetURLObject::EncodeMechanism::All ); // copy data into the temporary file std::unique_ptr<SvStream> pStream(::utl::UcbStreamHelper::CreateStream( m_pTempFile->GetURL(), StreamMode::STD_READWRITE, true /* bFileExists */ )); diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 4b9300d5a1bf..17035f29dc86 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -415,8 +415,8 @@ void Test::checkPreviewString(SvNumberFormatter& aFormatter, "\", " + OString::number( fPreviewNumber ) + ", sStr, ppColor, "; - aMessage += OString::number( static_cast<sal_uInt16>(eLang) ); - aMessage += " ) failed"; + aMessage += OString::number( static_cast<sal_uInt16>(eLang) ) + + " ) failed"; CPPUNIT_FAIL( aMessage.getStr() ); } CPPUNIT_ASSERT_EQUAL(sExpected, sStr); diff --git a/svx/source/dialog/hexcolorcontrol.cxx b/svx/source/dialog/hexcolorcontrol.cxx index a387a427687d..8cd9089c7051 100644 --- a/svx/source/dialog/hexcolorcontrol.cxx +++ b/svx/source/dialog/hexcolorcontrol.cxx @@ -70,8 +70,7 @@ Color HexColorControl::GetColor() const { sal_Int32 nColor = -1; - OUString aStr("#"); - aStr += m_xEntry->get_text(); + OUString aStr = "#" + m_xEntry->get_text(); sal_Int32 nLen = aStr.getLength(); if (nLen < 7) diff --git a/svx/source/form/fmcontrollayout.cxx b/svx/source/form/fmcontrollayout.cxx index 7d503519650f..5fcea4b7d6bc 100644 --- a/svx/source/form/fmcontrollayout.cxx +++ b/svx/source/form/fmcontrollayout.cxx @@ -74,8 +74,8 @@ namespace svxform { ::utl::OConfigurationNode getLayoutSettings( DocumentType _eDocType ) { - OUString sConfigName = "/org.openoffice.Office.Common/Forms/ControlLayout/"; - sConfigName += DocumentClassification::getModuleIdentifierForDocumentType( _eDocType ); + OUString sConfigName = "/org.openoffice.Office.Common/Forms/ControlLayout/" + + DocumentClassification::getModuleIdentifierForDocumentType( _eDocType ); return OConfigurationTreeRoot::createWithComponentContext( ::comphelper::getProcessComponentContext(), // TODO sConfigName ); diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 6b8e42bfe340..e709b9c7fa86 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -566,9 +566,9 @@ namespace svx sUnoSlotName = lcl_getUnoSlotName( nSlotId ); else sUnoSlotName = "<unknown>"; - OString sUnoSlotNameAscii( "\"" ); - sUnoSlotNameAscii += OString( sUnoSlotName.getStr(), sUnoSlotName.getLength(), RTL_TEXTENCODING_ASCII_US ); - sUnoSlotNameAscii += "\""; + OString sUnoSlotNameAscii = "\"" + + OString( sUnoSlotName.getStr(), sUnoSlotName.getLength(), RTL_TEXTENCODING_ASCII_US ) + + "\""; #endif if ( _bTranslateLatin ) diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index e02802525313..fa3ab3ea9167 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -303,9 +303,7 @@ INetURLObject GalleryTheme::ImplCreateUniqueURL( SgaObjKind eObjKind, ConvertDat } else { - OUString aFileName( "dd" ); - - aFileName += OUString::number( ++nNextNumber % 999999 ); + OUString aFileName = "dd" + OUString::number( ++nNextNumber % 999999 ); if (pExt) aFileName += OUString( pExt, strlen(pExt), RTL_TEXTENCODING_ASCII_US ); diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index c012cc0fb10e..56a1ef2b91a6 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -953,13 +953,13 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell) aSelection = OutputDevice::LogicToLogic(aSelection, MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM)); - OString sSVGElem(R"elem(<svg version=\"1.2\" width=\")elem"); - sSVGElem += OString::number(aSelection.GetWidth() / 100.0); - sSVGElem += R"elem(mm\" height=\")elem"; - sSVGElem += OString::number(aSelection.GetHeight() / 100.0); - sSVGElem += R"elem(mm\" viewBox=\")elem"; - sSVGElem += aSelection.toString(); - sSVGElem += R"elem(\" preserveAspectRatio=\"xMidYMid\" xmlns=\"http://www.w3.org/2000/svg\">)elem"; + OString sSVGElem = R"elem(<svg version=\"1.2\" width=\")elem" + + OString::number(aSelection.GetWidth() / 100.0) + + R"elem(mm\" height=\")elem" + + OString::number(aSelection.GetHeight() / 100.0) + + R"elem(mm\" viewBox=\")elem" + + aSelection.toString() + + R"elem(\" preserveAspectRatio=\"xMidYMid\" xmlns=\"http://www.w3.org/2000/svg\">)elem"; aExtraInfo.append(", \"svg\": \""); aExtraInfo.append(sSVGElem); @@ -982,8 +982,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell) sSelectionText += OStringLiteral(", ") + OString::number(nRotAngle); if (!aExtraInfo.isEmpty()) { - sSelectionText += ", "; - sSelectionText += aExtraInfo.makeStringAndClear(); + sSelectionText += ", " + aExtraInfo.makeStringAndClear(); } } diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index d8cef7ef98aa..5b90067a174f 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3168,10 +3168,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testShapeAllowOverlap) // <bounds left="1984" top="1984" width="1137" height="1137"/> // <bounds left="2551" top="2551" width="1137" height="1137"/> // so there was a clear vertical overlap. (Allow for 1px tolerance.) - OString aMessage("Unexpected overlap: first shape's bottom is "); - aMessage += OString::number(pFirst->GetObjRect().Bottom()); - aMessage += ", second shape's top is "; - aMessage += OString::number(pSecond->GetObjRect().Top()); + OString aMessage = "Unexpected overlap: first shape's bottom is " + + OString::number(pFirst->GetObjRect().Bottom()) + ", second shape's top is " + + OString::number(pSecond->GetObjRect().Top()); CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), std::abs(pFirst->GetObjRect().Bottom() - pSecond->GetObjRect().Top()) < 15); diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx index c90f4ca201db..ff63ac7db40f 100644 --- a/sw/qa/extras/rtfexport/rtfexport2.cxx +++ b/sw/qa/extras/rtfexport/rtfexport2.cxx @@ -746,8 +746,7 @@ DECLARE_RTFEXPORT_TEST(testFdo52989, "fdo52989.rtf") { // Same as n#192129, but for JPEG files. uno::Reference<drawing::XShape> xShape = getShape(1); - OString aMessage("xShape->getSize().Width() = "); - aMessage += OString::number(xShape->getSize().Width); + OString aMessage = "xShape->getSize().Width() = " + OString::number(xShape->getSize().Width); // This was 2, should be 423 (or 369?). CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), xShape->getSize().Width >= 273); diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index 62cd9e4da77e..26792bd8e3a0 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -279,15 +279,14 @@ const char * dbg_out(const SfxItemSet & rSet) static OUString lcl_dbg_out(const SwTextAttr & rAttr) { - OUString aStr("[ "); - - aStr += OUString::number(rAttr.GetStart()); - aStr += "->"; - aStr += OUString::number(*rAttr.End()); - aStr += " "; - aStr += lcl_dbg_out(rAttr.GetAttr()); - - aStr += " ]"; + OUString aStr = + "[ " + + OUString::number(rAttr.GetStart()) + + "->" + + OUString::number(*rAttr.End()) + + " " + + lcl_dbg_out(rAttr.GetAttr()) + + " ]"; return aStr; } @@ -320,16 +319,14 @@ const char * dbg_out(const SwpHints &rHints) static OUString lcl_dbg_out(const SwPosition & rPos) { - OUString aStr("( "); - - aStr += OUString::number(rPos.nNode.GetIndex()); - aStr += ", "; - aStr += OUString::number(rPos.nContent.GetIndex()); - aStr += ": "; - aStr += OUString::number - (reinterpret_cast<sal_IntPtr>(rPos.nContent.GetIdxReg()), 16); - - aStr += " )"; + OUString aStr = + "( " + + OUString::number(rPos.nNode.GetIndex()) + + ", " + + OUString::number(rPos.nContent.GetIndex()) + + ": " + + OUString::number(reinterpret_cast<sal_IntPtr>(rPos.nContent.GetIdxReg()), 16) + + " )"; return aStr; } @@ -341,9 +338,9 @@ const char * dbg_out(const SwPosition & rPos) static OUString lcl_dbg_out(const SwPaM & rPam) { - OUString aStr("[ Pt: "); - - aStr += lcl_dbg_out(*rPam.GetPoint()); + OUString aStr = + "[ Pt: " + + lcl_dbg_out(*rPam.GetPoint()); if (rPam.HasMark()) { @@ -373,17 +370,16 @@ const char * dbg_out(const SwNodeNum & rNum) static OUString lcl_dbg_out(const SwRect & rRect) { - OUString aResult("[ ["); - - aResult += OUString::number(rRect.Left()); - aResult += ", "; - aResult += OUString::number(rRect.Top()); - aResult += "], ["; - aResult += OUString::number(rRect.Right()); - aResult += ", "; - aResult += OUString::number(rRect.Bottom()); - - aResult += "] ]"; + OUString aResult = + "[ [" + + OUString::number(rRect.Left()) + + ", " + + OUString::number(rRect.Top()) + + "], [" + + OUString::number(rRect.Right()) + + ", " + + OUString::number(rRect.Bottom()) + + "] ]"; return aResult; } @@ -857,13 +853,12 @@ const char * dbg_out(const SwFormTokens & rTokens) static OUString lcl_dbg_out(const SwNodeRange & rRange) { - OUString aStr("["); - - aStr += lcl_dbg_out(SwPosition(rRange.aStart)); - aStr += ", "; - aStr += lcl_dbg_out(SwPosition(rRange.aEnd)); - - aStr += "]"; + OUString aStr = + "[" + + lcl_dbg_out(SwPosition(rRange.aStart)) + + ", " + + lcl_dbg_out(SwPosition(rRange.aEnd)) + + "]"; return aStr; } diff --git a/sw/source/filter/html/htmlnumwriter.cxx b/sw/source/filter/html/htmlnumwriter.cxx index cb21883db528..0d20869ee8be 100644 --- a/sw/source/filter/html/htmlnumwriter.cxx +++ b/sw/source/filter/html/htmlnumwriter.cxx @@ -186,8 +186,7 @@ Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt, rWrt.OutNewLine(); // <OL>/<UL> in a new row rWrt.m_aBulletGrfs[i].clear(); - OString sOut = "<"; - sOut += rWrt.GetNamespace(); + OString sOut = "<" + rWrt.GetNamespace(); const SwNumFormat& rNumFormat = rInfo.GetNumRule()->Get( i ); sal_Int16 eType = rNumFormat.GetNumberingType(); if( SVX_NUM_CHAR_SPECIAL == eType ) diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx index b2ae6f5ff08c..509784e78818 100644 --- a/sw/source/filter/xml/xmltexte.cxx +++ b/sw/source/filter/xml/xmltexte.cxx @@ -561,8 +561,7 @@ void SwXMLTextParagraphExport::_exportTextEmbedded( } if( SV_EMBEDDED_OUTPLACE==nType || SV_EMBEDDED_OWN==nType ) { - OUString sURL(XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE); - sURL += rOLEObj.GetCurrentPersistName(); + OUString sURL = XML_EMBEDDEDOBJECTGRAPHIC_URL_BASE + rOLEObj.GetCurrentPersistName(); if( !(rXMLExport.getExportFlags() & SvXMLExportFlags::EMBEDDED) ) { sURL = GetExport().AddEmbeddedObject( sURL ); diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index c127143bf848..2fa0ee8a4055 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -272,8 +272,8 @@ void SAL_CALL SwDataSourceRemovedListener::revokedDatabaseLocation(const sdb::Da return; OUString aOwnURL = pDocShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::WithCharset); - OUString sTmpName = "vnd.sun.star.pkg://"; - sTmpName += INetURLObject::encode(aOwnURL, INetURLObject::PART_AUTHORITY, INetURLObject::EncodeMechanism::All); + OUString sTmpName = "vnd.sun.star.pkg://" + + INetURLObject::encode(aOwnURL, INetURLObject::PART_AUTHORITY, INetURLObject::EncodeMechanism::All); sTmpName += "/" + m_pDBManager->getEmbeddedName(); if (sTmpName != rEvent.OldLocation) @@ -2625,15 +2625,15 @@ uno::Any GetDBunoURI(const INetURLObject &rURL, DBConnURIType& rType) break; case DBConnURIType::CALC: { - OUString sDBURL("sdbc:calc:"); - sDBURL += rURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); + OUString sDBURL = "sdbc:calc:" + + rURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); aURLAny <<= sDBURL; } break; case DBConnURIType::WRITER: { - OUString sDBURL("sdbc:writer:"); - sDBURL += rURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); + OUString sDBURL = "sdbc:writer:" + + rURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); aURLAny <<= sDBURL; } break; @@ -2642,8 +2642,8 @@ uno::Any GetDBunoURI(const INetURLObject &rURL, DBConnURIType& rType) INetURLObject aUrlTmp(rURL); aUrlTmp.removeSegment(); aUrlTmp.removeFinalSlash(); - OUString sDBURL("sdbc:dbase:"); - sDBURL += aUrlTmp.GetMainURL(INetURLObject::DecodeMechanism::NONE); + OUString sDBURL = "sdbc:dbase:" + + aUrlTmp.GetMainURL(INetURLObject::DecodeMechanism::NONE); aURLAny <<= sDBURL; } break; @@ -2652,9 +2652,9 @@ uno::Any GetDBunoURI(const INetURLObject &rURL, DBConnURIType& rType) INetURLObject aUrlTmp(rURL); aUrlTmp.removeSegment(); aUrlTmp.removeFinalSlash(); - OUString sDBURL("sdbc:flat:"); - //only the 'path' has to be added - sDBURL += aUrlTmp.GetMainURL(INetURLObject::DecodeMechanism::NONE); + OUString sDBURL = "sdbc:flat:" + + //only the 'path' has to be added + aUrlTmp.GetMainURL(INetURLObject::DecodeMechanism::NONE); aURLAny <<= sDBURL; } break; diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx index c1c35b5db02e..413b89c8605c 100644 --- a/ucb/source/ucp/ftp/ftpurl.cxx +++ b/ucb/source/ucp/ftp/ftpurl.cxx @@ -715,15 +715,13 @@ OUString FTPURL::ren(const OUString& NewTitle) CURL *curl = m_pFCP->handle(); // post request - OString renamefrom("RNFR "); OUString OldTitle = net_title(); - renamefrom += + OString renamefrom = "RNFR " + OString(OldTitle.getStr(), OldTitle.getLength(), RTL_TEXTENCODING_UTF8); - OString renameto("RNTO "); - renameto += + OString renameto = "RNTO " + OString(NewTitle.getStr(), NewTitle.getLength(), RTL_TEXTENCODING_UTF8); diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx index 123475515522..3750398c0800 100644 --- a/writerfilter/source/dmapper/OLEHandler.cxx +++ b/writerfilter/source/dmapper/OLEHandler.cxx @@ -284,8 +284,7 @@ OUString OLEHandler::copyOLEOStream( //hack to work with the ImportEmbeddedObjectResolver static sal_Int32 nObjectCount = 100; uno::Reference< container::XNameAccess > xNA( xEmbeddedResolver, uno::UNO_QUERY_THROW ); - OUString aURL("Obj"); - aURL += OUString::number( nObjectCount++ ); + OUString aURL = "Obj" + OUString::number( nObjectCount++ ); uno::Reference < io::XOutputStream > xOLEStream; if( (xNA->getByName( aURL ) >>= xOLEStream) && xOLEStream.is() ) { diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 8e99fe22df03..6893c17cc213 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -819,11 +819,11 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam, OUString xslURL = pDatabases->getInstallPathAsURL(); - OString xslURLascii( - xslURL.getStr(), - xslURL.getLength(), - RTL_TEXTENCODING_UTF8); - xslURLascii += "main_transform.xsl"; + OString xslURLascii = OString( + xslURL.getStr(), + xslURL.getLength(), + RTL_TEXTENCODING_UTF8) + + "main_transform.xsl"; ugblData = &userData; diff --git a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx index 6a7f4c7cac73..82159e0175fc 100644 --- a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx +++ b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx @@ -44,8 +44,7 @@ const OUString& UnoInterfaceToUniqueIdentifierMapper::registerReference( const R } else { - OUString aId( "id" ); - aId += OUString::number( mnNextId++ ); + OUString aId = "id" + OUString::number( mnNextId++ ); return (*maEntries.emplace( aId, xRef ).first).first; } } diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 930539053467..212f6060edae 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -689,8 +689,8 @@ bool SdXMLExport::ImpPrepAutoLayoutInfo(const Reference<XDrawPage>& xPage, OUStr { pNew = new ImpXMLAutoLayoutInfo(nType, pInfo); mvAutoLayoutInfoList.emplace_back( pNew ); - OUString sNewName = "AL"; - sNewName += OUString::number(mvAutoLayoutInfoList.size() - 1); + OUString sNewName = + "AL" + OUString::number(mvAutoLayoutInfoList.size() - 1); sNewName += "T" + OUString::number(nType); pNew->SetLayoutName(sNewName); } |