From 8333cbf2a3940abd0ed6b6bbb2ac25513f86a2fd Mon Sep 17 00:00:00 2001 From: "Chr. Rossmanith" Date: Thu, 28 Mar 2013 21:22:54 +0100 Subject: Remove RTL_CONSTASCII_(U)STRINGPARAM in pyuno and use append() instead of appendAscii() Change-Id: Iaf29a2f18eff39db5d1b5cc298cce23442ac51a9 --- pyuno/source/loader/pyuno_loader.cxx | 2 +- pyuno/source/module/pyuno.cxx | 62 +++++++++++++++++------------------ pyuno/source/module/pyuno_adapter.cxx | 16 ++++----- pyuno/source/module/pyuno_util.cxx | 18 +++++----- 4 files changed, 48 insertions(+), 50 deletions(-) (limited to 'pyuno') diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx index 07d0cc6dff73..9a9fb638f367 100644 --- a/pyuno/source/loader/pyuno_loader.cxx +++ b/pyuno/source/loader/pyuno_loader.cxx @@ -184,7 +184,7 @@ Reference< XInterface > CreateInstance( const Reference< XComponentContext > & c { OUString pythonPath; OUString pythonHome; - OUString path( RTL_CONSTASCII_USTRINGPARAM( "$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("pythonloader.uno" ))); + OUString path( "$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("pythonloader.uno" )); rtl::Bootstrap::expandMacros(path); //TODO: detect failure rtl::Bootstrap bootstrap(path); diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx index d42aa20589e6..cf18d9c6de6a 100644 --- a/pyuno/source/module/pyuno.cxx +++ b/pyuno/source/module/pyuno.cxx @@ -83,41 +83,41 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef { case typelib_TypeClass_INTERFACE: { - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") ); + buf.append( "0x" ); buf.append( reinterpret_cast< sal_IntPtr >(*(void **)pVal), 16 ); if( VAL2STR_MODE_DEEP == mode ) { - buf.appendAscii( "{" ); Reference< XInterface > r = *( Reference< XInterface > * ) pVal; + buf.append( "{" ); Reference< XInterface > r = *( Reference< XInterface > * ) pVal; Reference< XServiceInfo > serviceInfo( r, UNO_QUERY); Reference< XTypeProvider > typeProvider(r,UNO_QUERY); if( serviceInfo.is() ) { - buf.appendAscii("implementationName=" ); + buf.append("implementationName=" ); buf.append(serviceInfo->getImplementationName() ); - buf.appendAscii(", supportedServices={" ); + buf.append(", supportedServices={" ); Sequence< OUString > seq = serviceInfo->getSupportedServiceNames(); for( int i = 0 ; i < seq.getLength() ; i ++ ) { buf.append( seq[i] ); if( i +1 != seq.getLength() ) - buf.appendAscii( "," ); + buf.append( "," ); } - buf.appendAscii("}"); + buf.append("}"); } if( typeProvider.is() ) { - buf.appendAscii(", supportedInterfaces={" ); + buf.append(", supportedInterfaces={" ); Sequence< Type > seq (typeProvider->getTypes()); for( int i = 0 ; i < seq.getLength() ; i ++ ) { buf.append(seq[i].getTypeName()); if( i +1 != seq.getLength() ) - buf.appendAscii( "," ); + buf.append( "," ); } - buf.appendAscii("}"); + buf.append("}"); } - buf.appendAscii( "}" ); + buf.append( "}" ); } break; @@ -129,7 +129,7 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("{ ") ); + buf.append( "{ " ); typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef ); OSL_ASSERT( pTypeDescr ); @@ -141,7 +141,7 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef { buf.append( val2str( pVal, ((typelib_TypeDescription *)pCompType->pBaseTypeDescription)->pWeakRef,mode ) ); if (nDescr) - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", ") ); + buf.append( ", " ); } typelib_TypeDescriptionReference ** ppTypeRefs = pCompType->ppTypeRefs; @@ -151,18 +151,18 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef for ( sal_Int32 nPos = 0; nPos < nDescr; ++nPos ) { buf.append( ppMemberNames[nPos] ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" = ") ); + buf.append( " = " ); typelib_TypeDescription * pMemberType = 0; TYPELIB_DANGER_GET( &pMemberType, ppTypeRefs[nPos] ); buf.append( val2str( (char *)pVal + pMemberOffsets[nPos], pMemberType->pWeakRef, mode ) ); TYPELIB_DANGER_RELEASE( pMemberType ); if (nPos < (nDescr -1)) - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", ") ); + buf.append( ", " ); } TYPELIB_DANGER_RELEASE( pTypeDescr ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" }") ); + buf.append( " }" ); break; } case typelib_TypeClass_SEQUENCE: @@ -179,30 +179,30 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef if (nElements) { - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("{ ") ); + buf.append( "{ " ); char * pElements = pSequence->elements; for ( sal_Int32 nPos = 0; nPos < nElements; ++nPos ) { buf.append( val2str( pElements + (nElementSize * nPos), pElementTypeDescr->pWeakRef, mode ) ); if (nPos < (nElements -1)) - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", ") ); + buf.append( ", " ); } - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" }") ); + buf.append( " }" ); } else { - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("{}") ); + buf.append( "{}" ); } TYPELIB_DANGER_RELEASE( pElementTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); break; } case typelib_TypeClass_ANY: - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("{ ") ); + buf.append( "{ " ); buf.append( val2str( ((uno_Any *)pVal)->pData, ((uno_Any *)pVal)->pType , mode) ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" }") ); + buf.append( " }" ); break; case typelib_TypeClass_TYPE: buf.append( (*(typelib_TypeDescriptionReference **)pVal)->pTypeName ); @@ -234,9 +234,9 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef } case typelib_TypeClass_BOOLEAN: if (*(sal_Bool *)pVal) - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("true") ); + buf.append( "true" ); else - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("false") ); + buf.append( "false" ); break; case typelib_TypeClass_CHAR: buf.append( (sal_Unicode)'\'' ); @@ -250,28 +250,28 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef buf.append( *(double *)pVal ); break; case typelib_TypeClass_BYTE: - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") ); + buf.append( "0x" ); buf.append( (sal_Int32)*(sal_Int8 *)pVal, 16 ); break; case typelib_TypeClass_SHORT: - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") ); + buf.append( "0x" ); buf.append( (sal_Int32)*(sal_Int16 *)pVal, 16 ); break; case typelib_TypeClass_UNSIGNED_SHORT: - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") ); + buf.append( "0x" ); buf.append( (sal_Int32)*(sal_uInt16 *)pVal, 16 ); break; case typelib_TypeClass_LONG: - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") ); + buf.append( "0x" ); buf.append( *(sal_Int32 *)pVal, 16 ); break; case typelib_TypeClass_UNSIGNED_LONG: - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") ); + buf.append( "0x" ); buf.append( (sal_Int64)*(sal_uInt32 *)pVal, 16 ); break; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") ); + buf.append( "0x" ); #if defined(__GNUC__) && defined(SPARC) // I guess this really should check if there are strict alignment // requirements, not just "GCC on SPARC". @@ -338,9 +338,9 @@ PyObject *PyUNO_invoke( PyObject *object, const char *name , PyObject *args ) if (! me->members->xInvocation->hasMethod (attrName)) { OUStringBuffer buf; - buf.appendAscii( "Attribute " ); + buf.append( "Attribute " ); buf.append( attrName ); - buf.appendAscii( " unknown" ); + buf.append( " unknown" ); throw RuntimeException( buf.makeStringAndClear(), Reference< XInterface > () ); } callable = PyUNO_callable_new ( diff --git a/pyuno/source/module/pyuno_adapter.cxx b/pyuno/source/module/pyuno_adapter.cxx index 968f52bb9f9e..e987a7e42762 100644 --- a/pyuno/source/module/pyuno_adapter.cxx +++ b/pyuno/source/module/pyuno_adapter.cxx @@ -128,7 +128,7 @@ Sequence< sal_Int16 > Adapter::getOutIndexes( const OUString & functionName ) if( !introspection.is() ) { throw RuntimeException( - OUString( RTL_CONSTASCII_USTRINGPARAM( "pyuno bridge: Couldn't inspect uno adapter ( the python class must implement com.sun.star.lang.XTypeProvider !)" ) ), + OUString( "pyuno bridge: Couldn't inspect uno adapter ( the python class must implement com.sun.star.lang.XTypeProvider !)" ), Reference< XInterface > () ); } @@ -270,10 +270,8 @@ Any Adapter::invoke( const OUString &aFunctionName, if( ! ( ret >>= seq ) ) { throw RuntimeException( - (OUString( - RTL_CONSTASCII_USTRINGPARAM( - "pyuno bridge: Couldn't extract out" - " parameters for method ")) + (OUString("pyuno bridge: Couldn't extract out" + " parameters for method ") + aFunctionName), Reference< XInterface > () ); } @@ -281,13 +279,13 @@ Any Adapter::invoke( const OUString &aFunctionName, if( aOutParamIndex.getLength() +1 != seq.getLength() ) { OUStringBuffer buf; - buf.appendAscii( "pyuno bridge: expected for method " ); + buf.append( "pyuno bridge: expected for method " ); buf.append( aFunctionName ); - buf.appendAscii( " one return value and " ); + buf.append( " one return value and " ); buf.append( (sal_Int32) aOutParamIndex.getLength() ); - buf.appendAscii( " out parameters, got a sequence of " ); + buf.append( " out parameters, got a sequence of " ); buf.append( seq.getLength() ); - buf.appendAscii( " elements as return value." ); + buf.append( " elements as return value." ); throw RuntimeException(buf.makeStringAndClear(), *this ); } diff --git a/pyuno/source/module/pyuno_util.cxx b/pyuno/source/module/pyuno_util.cxx index 6d56279fce53..0b0d6ef488a4 100644 --- a/pyuno/source/module/pyuno_util.cxx +++ b/pyuno/source/module/pyuno_util.cxx @@ -183,9 +183,9 @@ void logException( RuntimeCargo *cargo, const char *intro, rtl::OUStringBuffer buf( 128 ); buf.appendAscii( intro ); appendPointer(buf, ptr); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("].") ); + buf.append( "]." ); buf.append( aFunctionName ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " = " ) ); + buf.append( " = " ); buf.append( val2str( data, type.getTypeLibType(), VAL2STR_MODE_SHALLOW ) ); log( cargo,LogLevel::CALL, buf.makeStringAndClear() ); @@ -204,16 +204,16 @@ void logReply( rtl::OUStringBuffer buf( 128 ); buf.appendAscii( intro ); appendPointer(buf, ptr); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("].") ); + buf.append( "]." ); buf.append( aFunctionName ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("()=") ); + buf.append( "()=" ); if( isLog( cargo, LogLevel::ARGS ) ) { buf.append( val2str( returnValue.getValue(), returnValue.getValueTypeRef(), VAL2STR_MODE_SHALLOW) ); for( int i = 0; i < aParams.getLength() ; i ++ ) { - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", " ) ); + buf.append( ", " ); buf.append( val2str( aParams[i].getValue(), aParams[i].getValueTypeRef(), VAL2STR_MODE_SHALLOW) ); } @@ -229,20 +229,20 @@ void logCall( RuntimeCargo *cargo, const char *intro, rtl::OUStringBuffer buf( 128 ); buf.appendAscii( intro ); appendPointer(buf, ptr); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("].") ); + buf.append( "]." ); buf.append( aFunctionName ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("(") ); + buf.append( "(" ); if( isLog( cargo, LogLevel::ARGS ) ) { for( int i = 0; i < aParams.getLength() ; i ++ ) { if( i > 0 ) - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", " ) ); + buf.append( ", " ); buf.append( val2str( aParams[i].getValue(), aParams[i].getValueTypeRef(), VAL2STR_MODE_SHALLOW) ); } } - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(")") ); + buf.append( ")" ); log( cargo,LogLevel::CALL, buf.makeStringAndClear() ); } -- cgit