From f5eeaaac7c4e73b60e69355303a4e9a2f9180d55 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 31 Aug 2015 08:02:45 +0200 Subject: loplugin:stringconstant: OUStringBuffer: appendAscii -> append Change-Id: I98058ff0653a3aab3399735271d04b16a05a3684 --- pyuno/source/loader/pyuno_loader.cxx | 4 +-- pyuno/source/module/pyuno_adapter.cxx | 12 ++++----- pyuno/source/module/pyuno_except.cxx | 14 +++++----- pyuno/source/module/pyuno_module.cxx | 50 +++++++++++++++++------------------ pyuno/source/module/pyuno_runtime.cxx | 32 +++++++++++----------- pyuno/source/module/pyuno_type.cxx | 14 +++++----- pyuno/source/module/pyuno_util.cxx | 2 +- 7 files changed, 64 insertions(+), 64 deletions(-) (limited to 'pyuno') diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx index 913954ec8361..e5daae177e52 100644 --- a/pyuno/source/loader/pyuno_loader.cxx +++ b/pyuno/source/loader/pyuno_loader.cxx @@ -71,7 +71,7 @@ static void raiseRuntimeExceptionWhenNeeded() throw ( RuntimeException ) Runtime runtime; com::sun::star::uno::Any a = runtime.extractUnoException( excType, excValue, excTraceback ); OUStringBuffer buf; - buf.appendAscii( "python-loader:" ); + buf.append( "python-loader:" ); if( a.hasValue() ) buf.append( static_cast(a.getValue())->Message ); throw RuntimeException( buf.makeStringAndClear() ); @@ -98,7 +98,7 @@ static PyRef getObjectFromLoaderModule( const char * func ) if( !object.is() ) { OUStringBuffer buf; - buf.appendAscii( "pythonloader: couldn't find core element pythonloader." ); + buf.append( "pythonloader: couldn't find core element pythonloader." ); buf.appendAscii( func ); throw RuntimeException(buf.makeStringAndClear()); } diff --git a/pyuno/source/module/pyuno_adapter.cxx b/pyuno/source/module/pyuno_adapter.cxx index ce4995d41eaa..d1ab7201ef2d 100644 --- a/pyuno/source/module/pyuno_adapter.cxx +++ b/pyuno/source/module/pyuno_adapter.cxx @@ -241,8 +241,8 @@ Any Adapter::invoke( const OUString &aFunctionName, if( !method.is() ) { OUStringBuffer buf; - buf.appendAscii( "pyuno::Adapter: Method " ).append( aFunctionName ); - buf.appendAscii( " is not implemented at object " ); + buf.append( "pyuno::Adapter: Method " ).append( aFunctionName ); + buf.append( " is not implemented at object " ); PyRef str( PyObject_Repr( mWrappedObject.get() ), SAL_NO_ACQUIRE ); buf.append(pyString2ustring(str.get())); throw IllegalArgumentException( buf.makeStringAndClear(), Reference< XInterface > (),0 ); @@ -359,8 +359,8 @@ void Adapter::setValue( const OUString & aPropertyName, const Any & value ) if( !hasProperty( aPropertyName ) ) { OUStringBuffer buf; - buf.appendAscii( "pyuno::Adapter: Property " ).append( aPropertyName ); - buf.appendAscii( " is unknown." ); + buf.append( "pyuno::Adapter: Property " ).append( aPropertyName ); + buf.append( " is unknown." ); throw UnknownPropertyException( buf.makeStringAndClear() ); } @@ -406,8 +406,8 @@ Any Adapter::getValue( const OUString & aPropertyName ) if (!pyRef.is() || PyErr_Occurred()) { OUStringBuffer buf; - buf.appendAscii( "pyuno::Adapter: Property " ).append( aPropertyName ); - buf.appendAscii( " is unknown." ); + buf.append( "pyuno::Adapter: Property " ).append( aPropertyName ); + buf.append( " is unknown." ); throw UnknownPropertyException( buf.makeStringAndClear() ); } ret = runtime.pyObject2Any( pyRef ); diff --git a/pyuno/source/module/pyuno_except.cxx b/pyuno/source/module/pyuno_except.cxx index f9adec7f08da..2c14af9be646 100644 --- a/pyuno/source/module/pyuno_except.cxx +++ b/pyuno/source/module/pyuno_except.cxx @@ -50,11 +50,11 @@ void raisePyExceptionWithAny( const com::sun::star::uno::Any &anyExc ) anyExc >>= e; OUStringBuffer buf; - buf.appendAscii( "Couldn't convert uno exception to a python exception (" ); + buf.append( "Couldn't convert uno exception to a python exception (" ); buf.append(anyExc.getValueType().getTypeName()); - buf.appendAscii( ": " ); + buf.append( ": " ); buf.append(e.Message ); - buf.appendAscii( ")" ); + buf.append( ")" ); PyErr_SetString( PyExc_SystemError, OUStringToOString(buf.makeStringAndClear(),RTL_TEXTENCODING_ASCII_US).getStr() ); @@ -87,8 +87,8 @@ static PyRef createClass( const OUString & name, const Runtime &runtime ) if( ! desc.is() ) { OUStringBuffer buf; - buf.appendAscii( "pyuno.getClass: uno exception " ); - buf.append(name).appendAscii( " is unknown" ); + buf.append( "pyuno.getClass: uno exception " ); + buf.append(name).append( " is unknown" ); throw RuntimeException( buf.makeStringAndClear() ); } @@ -98,10 +98,10 @@ static PyRef createClass( const OUString & name, const Runtime &runtime ) if( !isStruct && !isExc && ! isInterface ) { OUStringBuffer buf; - buf.appendAscii( "pyuno.getClass: " ).append(name).appendAscii( "is a " ); + buf.append( "pyuno.getClass: " ).append(name).append( "is a " ); buf.appendAscii( typeClassToString( (com::sun::star::uno::TypeClass) desc.get()->eTypeClass)); - buf.appendAscii( ", expected EXCEPTION, STRUCT or INTERFACE" ); + buf.append( ", expected EXCEPTION, STRUCT or INTERFACE" ); throw RuntimeException( buf.makeStringAndClear() ); } diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx index 01d5a62bacd2..32b6440a7e96 100644 --- a/pyuno/source/module/pyuno_module.cxx +++ b/pyuno/source/module/pyuno_module.cxx @@ -111,15 +111,15 @@ public: if (initialised[key]) { OUStringBuffer buf; - buf.appendAscii( "pyuno._createUnoStructHelper: member '"); + buf.append( "pyuno._createUnoStructHelper: member '"); buf.append(key); - buf.appendAscii( "'"); + buf.append( "'"); if ( pos >= 0 ) { - buf.appendAscii( " at position "); + buf.append( " at position "); buf.append(pos); } - buf.appendAscii( " initialised multiple times."); + buf.append( " initialised multiple times."); throw RuntimeException(buf.makeStringAndClear()); } initialised[key] = true; @@ -189,11 +189,11 @@ static void fillStruct( if ( ! state.isInitialised( memberName ) ) { OUStringBuffer buf; - buf.appendAscii( "pyuno._createUnoStructHelper: member '"); + buf.append( "pyuno._createUnoStructHelper: member '"); buf.append(memberName); - buf.appendAscii( "' of struct type '"); + buf.append( "' of struct type '"); buf.append(pCompType->aBase.pTypeName); - buf.appendAscii( "' not given a value."); + buf.append( "' not given a value."); throw RuntimeException(buf.makeStringAndClear()); } } @@ -265,10 +265,10 @@ static PyObject* getComponentContext( OUStringBuffer iniFileName; iniFileName.append( path ); #ifdef MACOSX - iniFileName.appendAscii( "/../" LIBO_ETC_FOLDER ); + iniFileName.append( "/../" LIBO_ETC_FOLDER ); #endif - iniFileName.appendAscii( "/" ); - iniFileName.appendAscii( SAL_CONFIGFILE( "pyuno" ) ); + iniFileName.append( "/" ); + iniFileName.append( SAL_CONFIGFILE( "pyuno" ) ); iniFile = iniFileName.makeStringAndClear(); osl::DirectoryItem item; if( osl::DirectoryItem::get( iniFile, item ) == item.E_None ) @@ -419,10 +419,10 @@ static PyObject *createUnoStructHelper( if( state.getCntConsumed() != PyTuple_Size(initializer) ) { OUStringBuffer buf; - buf.appendAscii( "pyuno._createUnoStructHelper: too many "); - buf.appendAscii( "elements in the initializer list, expected " ); + buf.append( "pyuno._createUnoStructHelper: too many "); + buf.append( "elements in the initializer list, expected " ); buf.append( state.getCntConsumed() ); - buf.appendAscii( ", got " ); + buf.append( ", got " ); buf.append( (sal_Int32) PyTuple_Size(initializer) ); throw RuntimeException( buf.makeStringAndClear()); } @@ -521,8 +521,8 @@ static PyObject *getConstantByName( >>= td)) { OUStringBuffer buf; - buf.appendAscii( "pyuno.getConstantByName: " ).append( typeName ); - buf.appendAscii( "is not a constant" ); + buf.append( "pyuno.getConstantByName: " ).append( typeName ); + buf.append( "is not a constant" ); throw RuntimeException(buf.makeStringAndClear() ); } PyRef constant = runtime.any2PyObject( td->getConstantValue() ); @@ -663,11 +663,11 @@ static PyObject *systemPathToFileUrl( if( e != osl::FileBase::E_None ) { OUStringBuffer buf; - buf.appendAscii( "Couldn't convert " ); + buf.append( "Couldn't convert " ); buf.append( sysPath ); - buf.appendAscii( " to a file url for reason (" ); + buf.append( " to a file url for reason (" ); buf.append( (sal_Int32) e ); - buf.appendAscii( ")" ); + buf.append( ")" ); raisePyExceptionWithAny( makeAny( RuntimeException( buf.makeStringAndClear() ))); return NULL; @@ -689,11 +689,11 @@ static PyObject * fileUrlToSystemPath( if( e != osl::FileBase::E_None ) { OUStringBuffer buf; - buf.appendAscii( "Couldn't convert file url " ); + buf.append( "Couldn't convert file url " ); buf.append( sysPath ); - buf.appendAscii( " to a system path for reason (" ); + buf.append( " to a system path for reason (" ); buf.append( (sal_Int32) e ); - buf.appendAscii( ")" ); + buf.append( ")" ); raisePyExceptionWithAny( makeAny( RuntimeException( buf.makeStringAndClear() ))); return NULL; @@ -712,13 +712,13 @@ static PyObject * absolutize( SAL_UNUSED_PARAMETER PyObject *, PyObject * args ) if( e != osl_File_E_None ) { OUStringBuffer buf; - buf.appendAscii( "Couldn't absolutize " ); + buf.append( "Couldn't absolutize " ); buf.append( ouRel ); - buf.appendAscii( " using root " ); + buf.append( " using root " ); buf.append( ouPath ); - buf.appendAscii( " for reason (" ); + buf.append( " for reason (" ); buf.append( (sal_Int32) e ); - buf.appendAscii( ")" ); + buf.append( ")" ); PyErr_SetString( PyExc_OSError, diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx index 0219742dcef0..1f431aeee5ac 100644 --- a/pyuno/source/module/pyuno_runtime.cxx +++ b/pyuno/source/module/pyuno_runtime.cxx @@ -168,11 +168,11 @@ static PyRef importUnoModule( ) throw ( RuntimeException ) PyRef str( PyObject_Str( excTraceback.get() ), SAL_NO_ACQUIRE ); OUStringBuffer buf; - buf.appendAscii( "python object raised an unknown exception (" ); + buf.append( "python object raised an unknown exception (" ); PyRef valueRep( PyObject_Repr( excValue.get() ), SAL_NO_ACQUIRE ); - buf.appendAscii( PyStr_AsString( valueRep.get())).appendAscii( ", traceback follows\n" ); + buf.appendAscii( PyStr_AsString( valueRep.get())).append( ", traceback follows\n" ); buf.appendAscii( PyStr_AsString( str.get() ) ); - buf.appendAscii( ")" ); + buf.append( ")" ); throw RuntimeException( buf.makeStringAndClear() ); } PyRef dict( PyModule_GetDict( module.get() ) ); @@ -472,9 +472,9 @@ PyRef Runtime::any2PyObject (const Any &a ) const } } OUStringBuffer buf; - buf.appendAscii( "Any carries enum " ); + buf.append( "Any carries enum " ); buf.append( a.getValueType().getTypeName()); - buf.appendAscii( " with invalid value " ).append( l ); + buf.append( " with invalid value " ).append( l ); throw RuntimeException( buf.makeStringAndClear() ); } case typelib_TypeClass_EXCEPTION: @@ -488,7 +488,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const if( ! ret.is() ) { OUStringBuffer buf; - buf.appendAscii( "Couldn't instantiate python representation of structured UNO type " ); + buf.append( "Couldn't instantiate python representation of structured UNO type " ); buf.append( a.getValueType().getTypeName() ); throw RuntimeException( buf.makeStringAndClear() ); } @@ -561,7 +561,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const default: { OUStringBuffer buf; - buf.appendAscii( "Unknown UNO type class " ); + buf.append( "Unknown UNO type class " ); buf.append( (sal_Int32 ) a.getValueTypeClass() ); throw RuntimeException(buf.makeStringAndClear( ) ); } @@ -599,13 +599,13 @@ static OUString lcl_ExceptionMessage(PyObject *const o, OUString const*const pWrapped) { OUStringBuffer buf; - buf.appendAscii("Couldn't convert "); + buf.append("Couldn't convert "); PyRef reprString( PyObject_Str(o), SAL_NO_ACQUIRE ); buf.appendAscii( PyStr_AsString(reprString.get()) ); - buf.appendAscii(" to a UNO type"); + buf.append(" to a UNO type"); if (pWrapped) { - buf.appendAscii("; caught exception: "); + buf.append("; caught exception: "); buf.append(*pWrapped); } return buf.makeStringAndClear(); @@ -973,9 +973,9 @@ Any Runtime::extractUnoException( const PyRef & excType, const PyRef &excValue, } else { - buf.appendAscii( "no typename available" ); + buf.append( "no typename available" ); } - buf.appendAscii( ": " ); + buf.append( ": " ); PyRef valueRep( PyObject_Str( excValue.get() ), SAL_NO_ACQUIRE ); if( valueRep.is() ) { @@ -983,17 +983,17 @@ Any Runtime::extractUnoException( const PyRef & excType, const PyRef &excValue, } else { - buf.appendAscii( "Couldn't convert exception value to a string" ); + buf.append( "Couldn't convert exception value to a string" ); } - buf.appendAscii( ", traceback follows\n" ); + buf.append( ", traceback follows\n" ); if( !str.isEmpty() ) { buf.append( str ); - buf.appendAscii( "\n" ); + buf.append( "\n" ); } else { - buf.appendAscii( ", no traceback available\n" ); + buf.append( ", no traceback available\n" ); } RuntimeException e; e.Message = buf.makeStringAndClear(); diff --git a/pyuno/source/module/pyuno_type.cxx b/pyuno/source/module/pyuno_type.cxx index d2230e4d114a..71551a032035 100644 --- a/pyuno/source/module/pyuno_type.cxx +++ b/pyuno/source/module/pyuno_type.cxx @@ -165,10 +165,10 @@ Any PyEnum2Enum( PyObject *obj ) throw ( RuntimeException ) if(desc.get()->eTypeClass != typelib_TypeClass_ENUM ) { OUStringBuffer buf; - buf.appendAscii( "pyuno.checkEnum: " ).append(strTypeName).appendAscii( "is a " ); + buf.append( "pyuno.checkEnum: " ).append(strTypeName).append( "is a " ); buf.appendAscii( typeClassToString( (com::sun::star::uno::TypeClass) desc.get()->eTypeClass)); - buf.appendAscii( ", expected ENUM" ); + buf.append( ", expected ENUM" ); throw RuntimeException( buf.makeStringAndClear() ); } @@ -186,7 +186,7 @@ Any PyEnum2Enum( PyObject *obj ) throw ( RuntimeException ) if( i == pEnumDesc->nEnumValues ) { OUStringBuffer buf; - buf.appendAscii( "value " ).appendAscii( stringValue ).appendAscii( "is unknown in enum " ); + buf.append( "value " ).appendAscii( stringValue ).append( "is unknown in enum " ); buf.appendAscii( PyStr_AsString( typeName.get() ) ); throw RuntimeException( buf.makeStringAndClear() ); } @@ -195,7 +195,7 @@ Any PyEnum2Enum( PyObject *obj ) throw ( RuntimeException ) else { OUStringBuffer buf; - buf.appendAscii( "enum " ).appendAscii( PyStr_AsString(typeName.get()) ).appendAscii( " is unknown" ); + buf.append( "enum " ).appendAscii( PyStr_AsString(typeName.get()) ).append( " is unknown" ); throw RuntimeException( buf.makeStringAndClear() ); } return ret; @@ -219,15 +219,15 @@ Type PyType2Type( PyObject * o ) throw(RuntimeException ) if( ! desc.is() ) { OUStringBuffer buf; - buf.appendAscii( "type " ).append(name).appendAscii( " is unknown" ); + buf.append( "type " ).append(name).append( " is unknown" ); throw RuntimeException( buf.makeStringAndClear() ); } if( desc.get()->eTypeClass != (typelib_TypeClass) *static_cast(enumValue.getValue()) ) { OUStringBuffer buf; - buf.appendAscii( "pyuno.checkType: " ).append(name).appendAscii( " is a " ); + buf.append( "pyuno.checkType: " ).append(name).append( " is a " ); buf.appendAscii( typeClassToString( (TypeClass) desc.get()->eTypeClass) ); - buf.appendAscii( ", but type got construct with typeclass " ); + buf.append( ", but type got construct with typeclass " ); buf.appendAscii( typeClassToString( (TypeClass) *static_cast(enumValue.getValue()) ) ); throw RuntimeException( buf.makeStringAndClear() ); } diff --git a/pyuno/source/module/pyuno_util.cxx b/pyuno/source/module/pyuno_util.cxx index 356524fabf4f..e6abadcf8ec8 100644 --- a/pyuno/source/module/pyuno_util.cxx +++ b/pyuno/source/module/pyuno_util.cxx @@ -106,7 +106,7 @@ PyRef getObjectFromUnoModule( const Runtime &runtime, const char * func ) if( !object.is() ) { OUStringBuffer buf; - buf.appendAscii( "couldn't find core function " ); + buf.append( "couldn't find core function " ); buf.appendAscii( func ); throw RuntimeException(buf.makeStringAndClear()); } -- cgit