summaryrefslogtreecommitdiff
path: root/pyuno/source
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 /pyuno/source
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>
Diffstat (limited to 'pyuno/source')
-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
4 files changed, 26 insertions, 33 deletions
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 );