basctl/source/basicide/uiobject.cxx | 3 - basegfx/source/polygon/b2dsvgpolypolygon.cxx | 6 +-- basic/source/basmgr/basmgr.cxx | 6 +-- basic/source/classes/sbunoobj.cxx | 51 +++++++++------------------ basic/source/sbx/sbxscan.cxx | 3 - bridges/source/jni_uno/jni_info.cxx | 9 +--- bridges/source/jni_uno/jni_uno2java.cxx | 3 - 7 files changed, 29 insertions(+), 52 deletions(-)
New commits: commit c76fb95d45f0240ee00f831a88e8a52bf3faacbc Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Mar 24 09:29:24 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Mar 24 09:50:49 2023 +0000 loplugin:stringadd in b* after my patch to merge the bufferadd loplugin into stringadd Change-Id: Ieb9b4f5154173738e26b429b55c7a3ea38733553 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149478 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/basctl/source/basicide/uiobject.cxx b/basctl/source/basicide/uiobject.cxx index 80807d3a40a6..b875b1eceda7 100644 --- a/basctl/source/basicide/uiobject.cxx +++ b/basctl/source/basicide/uiobject.cxx @@ -28,8 +28,7 @@ StringMap EditorWindowUIObject::get_state() OUStringBuffer aRes; for (i = 0, nParas = pEditEngine->GetParagraphCount(); i < nParas; ++i) { - aRes.append(pEditEngine->GetText(i)); - aRes.append("\n"); + aRes.append(pEditEngine->GetText(i) + "\n"); } aMap["Text"] = aRes.makeStringAndClear(); diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx index aa0fedb2ddf2..6bb34614c6ae 100644 --- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx +++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx @@ -704,9 +704,9 @@ namespace basegfx::utils aResult.append(' '); } - aResult.append(aPoint.getX()); - aResult.append(','); - aResult.append(aPoint.getY()); + aResult.append(OUString::number(aPoint.getX()) + + "," + + OUString::number(aPoint.getY())); } return aResult.makeStringAndClear(); diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 72776dd08153..c00221f27a12 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -1540,9 +1540,9 @@ ErrCode BasicManager::ExecuteMacro( OUString const& i_fullyQualifiedName, std::u sal_Int32 nPos {0}; for (;;) { - aBuff.append( "\"" ); - aBuff.append( o3tl::getToken(sArgs2, 0, ',', nPos) ); - aBuff.append( "\"" ); + aBuff.append( OUString::Concat("\"") + + o3tl::getToken(sArgs2, 0, ',', nPos) + + "\"" ); if (nPos<0) break; aBuff.append( "," ); diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 71ef915e942a..36feb923a6de 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -1605,9 +1605,7 @@ static OUString getDbgObjectName(SbUnoObject& rUnoObj) { aRet.append( "\n" ); } - aRet.append( "\"" ); - aRet.append( aName ); - aRet.append( "\":" ); + aRet.append( "\"" + aName + "\":" ); return aRet.makeStringAndClear(); } @@ -1739,16 +1737,16 @@ static OUString Impl_GetSupportedInterfaces(SbUnoObject& rUnoObj) auto x = o3tl::tryAccess<Reference<XInterface>>(aToInspectObj); if( !x ) { - aRet.append( ID_DBG_SUPPORTEDINTERFACES ); - aRet.append( " not available.\n(TypeClass is not TypeClass_INTERFACE)\n" ); + aRet.append( ID_DBG_SUPPORTEDINTERFACES + + " not available.\n(TypeClass is not TypeClass_INTERFACE)\n" ); } else { Reference< XTypeProvider > xTypeProvider( *x, UNO_QUERY ); - aRet.append( "Supported interfaces by object " ); - aRet.append(getDbgObjectName(rUnoObj)); - aRet.append( "\n" ); + aRet.append( "Supported interfaces by object " + + getDbgObjectName(rUnoObj) + + "\n" ); if( xTypeProvider.is() ) { // get the interfaces of the implementation @@ -1769,9 +1767,9 @@ static OUString Impl_GetSupportedInterfaces(SbUnoObject& rUnoObj) typelib_TypeDescription * pTD = nullptr; rType.getDescription( &pTD ); - aRet.append( "*** ERROR: No IdlClass for type \"" ); - aRet.append( pTD->pTypeName ); - aRet.append( "\"\n*** Please check type library\n" ); + aRet.append( OUString::Concat("*** ERROR: No IdlClass for type \"") + + OUString::unacquired(&pTD->pTypeName) + + "\"\n*** Please check type library\n" ); } } } @@ -1827,9 +1825,7 @@ static OUString Dbg_SbxDataType2String( SbxDataType eType ) // Debugging help method to display the properties of a SbUnoObjects static OUString Impl_DumpProperties(SbUnoObject& rUnoObj) { - OUStringBuffer aRet; - aRet.append("Properties of object "); - aRet.append(getDbgObjectName(rUnoObj)); + OUStringBuffer aRet("Properties of object " + getDbgObjectName(rUnoObj)); // analyse the Uno-Infos to recognise the arrays Reference< XIntrospectionAccess > xAccess = rUnoObj.getIntrospectionAccess(); @@ -1887,8 +1883,7 @@ static OUString Impl_DumpProperties(SbUnoObject& rUnoObj) aPropStr.append( Dbg_SbxDataType2String( eType ) ); if( bMaybeVoid ) aPropStr.append( "/void" ); - aPropStr.append( " " ); - aPropStr.append( pVar->GetName() ); + aPropStr.append( " " + pVar->GetName() ); if( i == nPropCount - 1 ) aPropStr.append( "\n" ); @@ -1904,9 +1899,7 @@ static OUString Impl_DumpProperties(SbUnoObject& rUnoObj) // Debugging help method to display the methods of an SbUnoObjects static OUString Impl_DumpMethods(SbUnoObject& rUnoObj) { - OUStringBuffer aRet; - aRet.append("Methods of object "); - aRet.append(getDbgObjectName(rUnoObj)); + OUStringBuffer aRet("Methods of object " + getDbgObjectName(rUnoObj)); // XIntrospectionAccess, so that the types of the parameter could be outputted Reference< XIntrospectionAccess > xAccess = rUnoObj.getIntrospectionAccess(); @@ -1953,10 +1946,8 @@ static OUString Impl_DumpMethods(SbUnoObject& rUnoObj) eType = SbxDataType( SbxOBJECT | SbxARRAY ); } // output the name and the type - aRet.append( Dbg_SbxDataType2String( eType ) ); - aRet.append( " " ); - aRet.append ( pVar->GetName() ); - aRet.append( " ( " ); + aRet.append( Dbg_SbxDataType2String( eType ) + + " " + pVar->GetName() + " ( " ); // the get-method mustn't have a parameter Sequence< Reference< XIdlClass > > aParamsSeq = rxMethod->getParameterTypes(); @@ -4751,9 +4742,7 @@ Any SbUnoStructRefObject::getUnoAny() OUString SbUnoStructRefObject::Impl_DumpProperties() { - OUStringBuffer aRet; - aRet.append("Properties of object "); - aRet.append( getDbgObjectName() ); + OUStringBuffer aRet("Properties of object " + getDbgObjectName() ); sal_uInt32 nPropCount = pProps->Count(); sal_uInt32 nPropsPerLine = 1 + nPropCount / 30; @@ -4786,10 +4775,8 @@ OUString SbUnoStructRefObject::Impl_DumpProperties() } } } - aPropStr.append( Dbg_SbxDataType2String( eType ) ); - - aPropStr.append( " " ); - aPropStr.append( pVar->GetName() ); + aPropStr.append( Dbg_SbxDataType2String( eType ) + + " " + pVar->GetName() ); if( i == nPropCount - 1 ) { @@ -4910,9 +4897,7 @@ OUString SbUnoStructRefObject::getDbgObjectName() const { aRet.append( "\n" ); } - aRet.append( "\"" ); - aRet.append( aName ); - aRet.append( "\":" ); + aRet.append( "\"" + aName + "\":" ); return aRet.makeStringAndClear(); } diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx index 71633b086a35..317539fbeecd 100644 --- a/basic/source/sbx/sbxscan.cxx +++ b/basic/source/sbx/sbxscan.cxx @@ -114,8 +114,7 @@ ErrCode ImpScan( const OUString& rWSrc, double& nVal, SbxDataType& rType, short decsep = 0; short ndig = 0; short ncdig = 0; // number of digits after decimal point - OUStringBuffer aSearchStr("0123456789DEde"); - aSearchStr.append(cNonIntntlDecSep); + OUStringBuffer aSearchStr(OUString::Concat("0123456789DEde") + OUStringChar(cNonIntntlDecSep)); if( cIntntlDecSep != cNonIntntlDecSep ) aSearchStr.append(cIntntlDecSep); if( cIntntlDecSepAlt && cIntntlDecSepAlt != cNonIntntlDecSep ) diff --git a/bridges/source/jni_uno/jni_info.cxx b/bridges/source/jni_uno/jni_info.cxx index 3dd00d01c24d..0195ed9d1300 100644 --- a/bridges/source/jni_uno/jni_info.cxx +++ b/bridges/source/jni_uno/jni_info.cxx @@ -166,8 +166,7 @@ JNI_interface_type_info::JNI_interface_type_info( &attribute_td->aBase.pMemberName ); // getter - sig_buf.append( "()" ); - sig_buf.append( type_sig ); + sig_buf.append( "()" + type_sig ); OString method_signature( sig_buf.makeStringAndClear() ); OString method_name( OUStringToOString( @@ -182,11 +181,7 @@ JNI_interface_type_info::JNI_interface_type_info( if (! attribute_td->bReadOnly) { // setter - sig_buf.ensureCapacity( 64 ); - sig_buf.append( '(' ); - sig_buf.append( type_sig ); - sig_buf.append( ")V" ); - method_signature = sig_buf.makeStringAndClear(); + method_signature = "(" + type_sig + ")V"; method_name = OUStringToOString( rtl::Concat2View("set" + member_name), RTL_TEXTENCODING_JAVA_UTF8 ); diff --git a/bridges/source/jni_uno/jni_uno2java.cxx b/bridges/source/jni_uno/jni_uno2java.cxx index bc908fc5db98..98666dfc1929 100644 --- a/bridges/source/jni_uno/jni_uno2java.cxx +++ b/bridges/source/jni_uno/jni_uno2java.cxx @@ -775,8 +775,7 @@ void UNO_proxy_dispatch( typelib_InterfaceMemberTypeDescription const * >( member_td )->pMemberName ) ); } - buf.append( ": " ); - buf.append( err.m_message ); + buf.append( ": " + err.m_message ); // binary identical struct css::uno::RuntimeException exc( buf.makeStringAndClear(),