summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-03-25 16:41:29 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-03-27 11:04:46 +0000
commit7f91e4a982672969c80e6117d09ae816a8dc5f21 (patch)
treebd190f71219f8afc36a367322b8a2292f2a30949
parentd9031bd83ffe718a80da9ecbdbeb485e35fbabee (diff)
loplugin:stringadd in oox..pyuno
after my patch to merge the bufferadd loplugin into stringadd Change-Id: I5fdc0a33923fe00e7b588f4576607515a93e5c13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149579 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--oox/source/drawingml/chart/chartconverter.cxx3
-rw-r--r--oox/source/dump/dumperbase.cxx3
-rw-r--r--oox/source/export/vmlexport.cxx3
-rw-r--r--oox/source/ole/vbacontrol.cxx3
-rw-r--r--opencl/source/openclwrapper.cxx5
-rw-r--r--pyuno/source/loader/pyuno_loader.cxx3
-rw-r--r--pyuno/source/module/pyuno.cxx20
-rw-r--r--pyuno/source/module/pyuno_module.cxx33
-rw-r--r--pyuno/source/module/pyuno_util.cxx3
9 files changed, 32 insertions, 44 deletions
diff --git a/oox/source/drawingml/chart/chartconverter.cxx b/oox/source/drawingml/chart/chartconverter.cxx
index 725b28c3bfe2..3f004ffd2c9e 100644
--- a/oox/source/drawingml/chart/chartconverter.cxx
+++ b/oox/source/drawingml/chart/chartconverter.cxx
@@ -47,8 +47,7 @@ const sal_Unicode API_TOKEN_ARRAY_COLSEP = ';';
static OUString lclGenerateApiArray(const std::vector<Any>& rRow, sal_Int32 nStart, sal_Int32 nCount)
{
OSL_ENSURE( !rRow.empty(), "ChartConverter::lclGenerateApiArray - missing matrix values" );
- OUStringBuffer aBuffer;
- aBuffer.append( API_TOKEN_ARRAY_OPEN );
+ OUStringBuffer aBuffer(( OUStringChar(API_TOKEN_ARRAY_OPEN) ));
for (auto aBeg = rRow.begin() + nStart, aIt = aBeg, aEnd = aBeg + nCount; aIt != aEnd; ++aIt)
{
double fValue = 0.0;
diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx
index 0263396928c1..cfc53d944232 100644
--- a/oox/source/dump/dumperbase.cxx
+++ b/oox/source/dump/dumperbase.cxx
@@ -1097,8 +1097,7 @@ OUString FlagsList::implGetName( const Config& /*rCfg*/, sal_Int64 nKey ) const
setFlag( nKey, nFound, false );
if( nKey != 0 )
{
- OUStringBuffer aUnknown( OOX_DUMP_UNKNOWN );
- aUnknown.append( OOX_DUMP_ITEMSEP );
+ OUStringBuffer aUnknown( OUString::Concat(OOX_DUMP_UNKNOWN) + OUStringChar(OOX_DUMP_ITEMSEP) );
StringHelper::appendShortHex( aUnknown, nKey );
StringHelper::enclose( aUnknown, '(', ')' );
StringHelper::appendToken( aName, aUnknown );
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 2844be0bc8da..7cbfe1f14bfa 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1080,8 +1080,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle&
if ( opt.nProp.size() )
{
const sal_uInt8 *pIt = opt.nProp.data();
- OStringBuffer buf;
- buf.append( " ( " );
+ OStringBuffer buf( " ( " );
for ( int nCount = opt.nProp.size(); nCount; --nCount )
{
buf.append( OString::number(static_cast<sal_Int32>(*pIt), 16) + " ");
diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx
index bdfe6b363556..217fc32fcf2e 100644
--- a/oox/source/ole/vbacontrol.cxx
+++ b/oox/source/ole/vbacontrol.cxx
@@ -225,8 +225,7 @@ OUString VbaSiteModel::getSubStorageName() const
{
if( mnId >= 0 )
{
- OUStringBuffer aBuffer;
- aBuffer.append( 'i' );
+ OUStringBuffer aBuffer( "i" );
if( mnId < 10 )
aBuffer.append( '0' );
aBuffer.append( mnId );
diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index dd1850976c08..8d840d65c181 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -77,12 +77,11 @@ OString generateMD5(const void* pData, size_t length)
pBuffer, RTL_DIGEST_LENGTH_MD5);
SAL_WARN_IF(aError != rtl_Digest_E_None, "opencl", "md5 generation failed");
- OStringBuffer aBuffer;
+ OStringBuffer aBuffer(length * 2);
const char* const pString = "0123456789ABCDEF";
for(sal_uInt8 val : pBuffer)
{
- aBuffer.append(pString[val/16]);
- aBuffer.append(pString[val%16]);
+ aBuffer.append(OStringChar(pString[val/16]) + OStringChar(pString[val%16]));
}
return aBuffer.makeStringAndClear();
}
diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx
index da0467f450c6..e9cbc807ebf3 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -72,8 +72,7 @@ static void raiseRuntimeExceptionWhenNeeded()
PyErr_Fetch(reinterpret_cast<PyObject **>(&excType), reinterpret_cast<PyObject**>(&excValue), reinterpret_cast<PyObject**>(&excTraceback));
Runtime runtime;
css::uno::Any a = runtime.extractUnoException( excType, excValue, excTraceback );
- OUStringBuffer buf;
- buf.append( "python-loader:" );
+ OUStringBuffer buf( "python-loader:" );
if( auto e = o3tl::tryAccess<css::uno::Exception>(a) )
buf.append( e->Message );
throw RuntimeException( buf.makeStringAndClear() );
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index cc4858279949..bd4904d5f729 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -106,9 +106,9 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
Reference< XTypeProvider > typeProvider(r,UNO_QUERY);
if( serviceInfo.is() )
{
- buf.append("implementationName=" );
- buf.append(serviceInfo->getImplementationName() );
- buf.append(", supportedServices={" );
+ buf.append("implementationName="
+ + serviceInfo->getImplementationName()
+ + ", supportedServices={" );
Sequence< OUString > seq = serviceInfo->getSupportedServiceNames();
for( int i = 0 ; i < seq.getLength() ; i ++ )
{
@@ -207,11 +207,11 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
break;
}
case typelib_TypeClass_ANY:
- buf.append( "{ " );
- buf.append( val2str( static_cast<uno_Any const *>(pVal)->pData,
+ buf.append( "{ "
+ + val2str( static_cast<uno_Any const *>(pVal)->pData,
static_cast<uno_Any const *>(pVal)->pType ,
- mode) );
- buf.append( " }" );
+ mode)
+ + " }" );
break;
case typelib_TypeClass_TYPE:
buf.append( (*static_cast<typelib_TypeDescriptionReference * const *>(pVal))->pTypeName );
@@ -248,9 +248,9 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
buf.append( "false" );
break;
case typelib_TypeClass_CHAR:
- buf.append( '\'' );
- buf.append( *static_cast<sal_Unicode const *>(pVal) );
- buf.append( '\'' );
+ buf.append( "\'"
+ + OUStringChar(*static_cast<sal_Unicode const *>(pVal) )
+ + "\'" );
break;
case typelib_TypeClass_FLOAT:
buf.append( *static_cast<float const *>(pVal) );
diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx
index 81c8ef7aa5cf..d91b608b6671 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -110,8 +110,7 @@ public:
{
if (initialised[key])
{
- OUStringBuffer buf;
- buf.append( "pyuno._createUnoStructHelper: member '" + key + "'");
+ OUStringBuffer buf( "pyuno._createUnoStructHelper: member '" + key + "'");
if ( pos >= 0 )
{
buf.append( " at position " + OUString::number(pos));
@@ -442,10 +441,9 @@ static PyObject *createUnoStructHelper(
}
else
{
- OStringBuffer buf;
- buf.append( "UNO struct " );
- buf.append( PyUnicode_AsUTF8(structName) );
- buf.append( " is unknown" );
+ OString buf = OString::Concat("UNO struct ")
+ + PyUnicode_AsUTF8(structName)
+ + " is unknown";
PyErr_SetString (PyExc_RuntimeError, buf.getStr());
}
}
@@ -750,20 +748,18 @@ static PyObject * invoke(SAL_UNUSED_PARAMETER PyObject *, PyObject *args)
}
else
{
- OStringBuffer buf;
- buf.append("uno.invoke expects a tuple as 3rd argument, got ");
- buf.append(PyUnicode_AsUTF8(PyObject_Str(item2)));
+ OString buf = OString::Concat("uno.invoke expects a tuple as 3rd argument, got ")
+ + PyUnicode_AsUTF8(PyObject_Str(item2));
PyErr_SetString(
- PyExc_RuntimeError, buf.makeStringAndClear().getStr());
+ PyExc_RuntimeError, buf.getStr());
}
}
else
{
- OStringBuffer buf;
- buf.append("uno.invoke expected a string as 2nd argument, got ");
- buf.append(PyUnicode_AsUTF8(PyObject_Str(item1)));
+ OString buf = OString::Concat("uno.invoke expected a string as 2nd argument, got ")
+ + PyUnicode_AsUTF8(PyObject_Str(item1));
PyErr_SetString(
- PyExc_RuntimeError, buf.makeStringAndClear().getStr());
+ PyExc_RuntimeError, buf.getStr());
}
}
else
@@ -811,12 +807,11 @@ static PyObject *setCurrentContext(
}
else
{
- OStringBuffer buf;
- buf.append( "uno.setCurrentContext expects an XComponentContext implementation, got " );
- buf.append(
- PyUnicode_AsUTF8(PyObject_Str(PyTuple_GetItem(args, 0))));
+ OString buf =
+ OString::Concat("uno.setCurrentContext expects an XComponentContext implementation, got ")
+ + PyUnicode_AsUTF8(PyObject_Str(PyTuple_GetItem(args, 0)));
PyErr_SetString(
- PyExc_RuntimeError, buf.makeStringAndClear().getStr() );
+ PyExc_RuntimeError, buf.getStr() );
}
}
else
diff --git a/pyuno/source/module/pyuno_util.cxx b/pyuno/source/module/pyuno_util.cxx
index b66700773d00..f01d33acfb86 100644
--- a/pyuno/source/module/pyuno_util.cxx
+++ b/pyuno/source/module/pyuno_util.cxx
@@ -177,8 +177,7 @@ void logReply(
val2str( returnValue.getValue(), returnValue.getValueTypeRef(), VAL2STR_MODE_SHALLOW) );
for( const auto & p : aParams )
{
- buf.append( ", " );
- buf.append( val2str( p.getValue(), p.getValueTypeRef(), VAL2STR_MODE_SHALLOW) );
+ buf.append( ", " + val2str( p.getValue(), p.getValueTypeRef(), VAL2STR_MODE_SHALLOW) );
}
}
log( cargo,LogLevel::CALL, buf );