From 52bbd9cc00b5a1e15e4f96b5c5fa5e75855692c1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 19 Nov 2013 17:06:06 +0200 Subject: remove unnecessary RTL_CONSTASCII_STRINGPARAM in appendAscii calls Convert code like: aStrBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "ln(x)" )); to: aStrBuf.append( "ln(x)" ); which compiles down to the same code. Change-Id: I24c7cb45ceb32fd7cd6ec7ed203c2a5d746f1c5c --- cli_ure/source/climaker/climaker_app.cxx | 7 ++-- cli_ure/source/climaker/climaker_emit.cxx | 2 +- cli_ure/source/uno_bridge/cli_data.cxx | 60 +++++++++++++++---------------- cli_ure/source/uno_bridge/cli_proxy.cxx | 26 ++++++-------- cli_ure/source/uno_bridge/cli_uno.cxx | 5 ++- 5 files changed, 43 insertions(+), 57 deletions(-) (limited to 'cli_ure/source') diff --git a/cli_ure/source/climaker/climaker_app.cxx b/cli_ure/source/climaker/climaker_app.cxx index 12c63a7b8bc7..e11aee5855ce 100644 --- a/cli_ure/source/climaker/climaker_app.cxx +++ b/cli_ure/source/climaker/climaker_app.cxx @@ -378,12 +378,9 @@ SAL_IMPLEMENT_MAIN() if (option_info == 0) { OUStringBuffer buf; - buf.appendAscii( - RTL_CONSTASCII_STRINGPARAM("unknown option ") ); + buf.append("unknown option "); buf.append( cmd_arg ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( - "! Use climaker --help " - "to print all options.") ); + buf.append( "! Use climaker --help to print all options." ); throw RuntimeException( buf.makeStringAndClear(), css::uno::Reference< XInterface >() ); diff --git a/cli_ure/source/climaker/climaker_emit.cxx b/cli_ure/source/climaker/climaker_emit.cxx index fcefc2637572..628547135df9 100644 --- a/cli_ure/source/climaker/climaker_emit.cxx +++ b/cli_ure/source/climaker/climaker_emit.cxx @@ -43,7 +43,7 @@ static inline ::System::String ^ to_cts_name( OUString const & uno_name ) { OUStringBuffer buf( 7 + uno_name.getLength() ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("unoidl.") ); + buf.append( "unoidl." ); buf.append( uno_name ); return ustring_to_String( buf.makeStringAndClear() ); } diff --git a/cli_ure/source/uno_bridge/cli_data.cxx b/cli_ure/source/uno_bridge/cli_data.cxx index d6b7000359d9..219438a2fb66 100644 --- a/cli_ure/source/uno_bridge/cli_data.cxx +++ b/cli_ure/source/uno_bridge/cli_data.cxx @@ -444,9 +444,7 @@ typelib_TypeDescriptionReference* mapCliType(System::Type^ cliType) if (retVal == NULL) { OUStringBuffer buf( 128 ); - buf.appendAscii( - RTL_CONSTASCII_STRINGPARAM("[cli_uno bridge] mapCliType():" - "could not map type: ") ); + buf.append( "[cli_uno bridge] mapCliType():could not map type: " ); buf.append(mapCliString(cliType->FullName)); throw BridgeRuntimeError( buf.makeStringAndClear() ); } @@ -978,9 +976,9 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data, default: { OUStringBuffer buf( 128 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("[map_to_uno():") ); + buf.append( "[map_to_uno():" ); buf.append(value_td.getTypeName()); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("] unsupported value type of any!") ); + buf.append( "] unsupported value type of any!" ); throw BridgeRuntimeError( buf.makeStringAndClear() ); } } @@ -991,12 +989,11 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data, if (assign) uno_any_construct( pAny, 0, 0, 0 ); // restore some valid any OUStringBuffer buf( 256 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("[map_to_uno():Any") ); + buf.append( "[map_to_uno():Any" ); buf.append(value_td.getTypeName()); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("]The Any type ")); + buf.append( "]The Any type "); buf.append(value_td.getTypeName()); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" does not correspont " - "to its value type: ") ); + buf.append( " does not correspond to its value type: " ); if(aAny.Value != nullptr) { css::uno::Type td(mapCliType(aAny.Value->GetType()), SAL_NO_ACQUIRE); @@ -1093,7 +1090,7 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data, else { OUStringBuffer buf(512); - buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("[map_to_uno(): Member: ")); + buf.append("[map_to_uno(): Member: "); buf.append(comp_td->ppMemberNames[nPos]); throw BridgeRuntimeError(buf.makeStringAndClear()); } @@ -1191,13 +1188,13 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data, { bException= true; OUStringBuffer buf(512); - buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("[map_to_uno():")); + buf.append("[map_to_uno():"); if (cliType) { buf.append(mapCliString(cliType->FullName)); - buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(".")); + buf.append("."); buf.append(comp_td->ppMemberNames[nPos]); - buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(" ")); + buf.append(" "); } buf.append(e.m_message); throw BridgeRuntimeError(buf.makeStringAndClear()); @@ -1206,14 +1203,14 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data, { bException= true; OUStringBuffer buf( 256 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("[map_to_uno():") ); + buf.append( "[map_to_uno():" ); if (cliType) { buf.append(mapCliString(cliType->FullName)); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(".")); + buf.append( "." ); buf.append(comp_td->ppMemberNames[nPos]); } - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("] Value has not the required type.")); + buf.append( "] Value has not the required type." ); throw BridgeRuntimeError(buf.makeStringAndClear()); } catch (...) @@ -1379,9 +1376,9 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data, default: { OUStringBuffer buf( 128 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("[map_to_uno():") ); + buf.append( "[map_to_uno():" ); buf.append( *reinterpret_cast< OUString const * >( &type->pTypeName ) ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("] unsupported sequence element type: ") ); + buf.append( "] unsupported sequence element type: " ); buf.append( *reinterpret_cast< OUString const * >( &element_type->pTypeName ) ); throw BridgeRuntimeError( buf.makeStringAndClear() ); } @@ -1390,9 +1387,9 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data, catch (BridgeRuntimeError& e) { OUStringBuffer buf( 128 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("[map_to_uno():") ); + buf.append( "[map_to_uno():" ); buf.append( *reinterpret_cast< OUString const * >( &type->pTypeName )); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("] conversion failed\n ")); + buf.append( "] conversion failed\n "); buf.append(e.m_message); throw BridgeRuntimeError(buf.makeStringAndClear()); } @@ -1400,9 +1397,9 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data, { // Ok, checked OUStringBuffer buf( 128 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("[map_to_uno():") ); + buf.append( "[map_to_uno():" ); buf.append( *reinterpret_cast< OUString const * >( &type->pTypeName) ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("] could not convert sequence element type: ") ); + buf.append( "] could not convert sequence element type: " ); buf.append( *reinterpret_cast< OUString const * >( &element_type->pTypeName ) ); throw BridgeRuntimeError( buf.makeStringAndClear() ); } @@ -1448,9 +1445,9 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data, { //ToDo check OUStringBuffer buf( 128 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("[map_to_uno():") ); + buf.append( "[map_to_uno():" ); buf.append( *reinterpret_cast< OUString const * >( &type->pTypeName ) ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("] unsupported type!") ); + buf.append( "] unsupported type!" ); throw BridgeRuntimeError( buf.makeStringAndClear() ); } } @@ -1460,16 +1457,15 @@ void Bridge::map_to_uno(void * uno_data, System::Object^ cli_data, { //ToDo check OUStringBuffer buf( 128 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("[map_to_uno():") ); + buf.append( "[map_to_uno():" ); buf.append( *reinterpret_cast< OUString const * >( &type->pTypeName ) ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("] could not convert type!") ); + buf.append( "] could not convert type!" ); throw BridgeRuntimeError( buf.makeStringAndClear() ); } catch (System::NullReferenceException ^ e) { OUStringBuffer buf(512); - buf.appendAscii(RTL_CONSTASCII_STRINGPARAM( - "[map_to_uno()] Illegal null reference passed!\n")); + buf.append( "[map_to_uno()] Illegal null reference passed!\n" ); buf.append(mapCliString(e->StackTrace)); throw BridgeRuntimeError( buf.makeStringAndClear() ); } @@ -1955,9 +1951,9 @@ void Bridge::map_to_cli( default: { OUStringBuffer buf( 128 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("[map_to_cli():") ); + buf.append( "[map_to_cli():" ); buf.append( *reinterpret_cast< OUString const * >( &type->pTypeName ) ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("] unsupported element type: ") ); + buf.append( "] unsupported element type: " ); buf.append( *reinterpret_cast< OUString const * >( &element_type->pTypeName ) ); throw BridgeRuntimeError( buf.makeStringAndClear() ); } @@ -1981,9 +1977,9 @@ void Bridge::map_to_cli( { //ToDo check this exception. The String is probably crippled OUStringBuffer buf( 128 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("[map_to_cli():") ); + buf.append( "[map_to_cli():" ); buf.append( *reinterpret_cast< OUString const * >( &type->pTypeName ) ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("] unsupported type!") ); + buf.append( "] unsupported type!" ); throw BridgeRuntimeError( buf.makeStringAndClear() ); } } //switch diff --git a/cli_ure/source/uno_bridge/cli_proxy.cxx b/cli_ure/source/uno_bridge/cli_proxy.cxx index f7f865f4b802..09bfe60931e8 100644 --- a/cli_ure/source/uno_bridge/cli_proxy.cxx +++ b/cli_ure/source/uno_bridge/cli_proxy.cxx @@ -80,8 +80,7 @@ UnoInterfaceInfo::UnoInterfaceInfo(Bridge const * bridge, uno_Interface* unoI, if( ! bComplete) { OUStringBuffer buf( 128 ); - buf.appendAscii(RTL_CONSTASCII_STRINGPARAM( - "cannot make type complete: ") ); + buf.append( "cannot make type complete: " ); buf.append( *reinterpret_cast< OUString const * >( & m_typeDesc->aBase.pTypeName)); throw BridgeRuntimeError(buf.makeStringAndClear()); @@ -198,11 +197,11 @@ void UnoInterfaceProxy::addUnoInterface(uno_Interface* pUnoI, // add to the string that contains all interface names _numInterfaces ++; OUStringBuffer buf(512); - buf.appendAscii("\t"); + buf.append("\t"); buf.append( OUString::valueOf((sal_Int32)_numInterfaces)); - buf.appendAscii(". "); + buf.append(". "); buf.append(mapCliString(sInterfaceName)); - buf.appendAscii("\n"); + buf.append("\n"); OUString _sNewInterface = buf.makeStringAndClear(); rtl_uString * __pin * pp_sInterfaces = & _sInterfaces; rtl_uString_newConcat( pp_sInterfaces, * pp_sInterfaces, @@ -551,12 +550,10 @@ srrm::IMessage^ UnoInterfaceProxy::Invoke(srrm::IMessage^ callmsg) // ToDo check if the message of the exception is not crippled // the thing that should not be... no method info found! OUStringBuffer buf( 64 ); - buf.appendAscii(RTL_CONSTASCII_STRINGPARAM( - "[cli_uno bridge]calling undeclared function on " - "interface ") ); + buf.append( "[cli_uno bridge]calling undeclared function on interface " ); buf.append( *reinterpret_cast< OUString const * >( & ((typelib_TypeDescription *)info->m_typeDesc)->pTypeName)); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(": ") ); + buf.append( ": " ); buf.append( usMethodName ); throw BridgeRuntimeError( buf.makeStringAndClear() ); } @@ -762,11 +759,9 @@ void CliProxy::makeMethodInfos() catch (System::InvalidCastException^ ) { OUStringBuffer buf( 128 ); - buf.appendAscii(RTL_CONSTASCII_STRINGPARAM( - "[cli_uno bridge] preparing proxy for " - "cli interface: ") ); + buf.append( "[cli_uno bridge] preparing proxy for cli interface: " ); buf.append(mapCliString(m_type->ToString() )); - buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(" \nfailed!")); + buf.append( " \nfailed!" ); throw BridgeRuntimeError( buf.makeStringAndClear() ); } } @@ -840,9 +835,8 @@ sr::MethodInfo^ CliProxy::getMethodInfo(int nUnoFunctionPos, if (indexCliMethod == -1) { OUStringBuffer buf(256); - buf.appendAscii(RTL_CONSTASCII_STRINGPARAM( - "[cli_uno bridge] CliProxy::getMethodInfo():" - "cli object does not implement interface method: ")); + buf.append( "[cli_uno bridge] CliProxy::getMethodInfo():" + "cli object does not implement interface method: " ); buf.append(usMethodName); throw BridgeRuntimeError(buf.makeStringAndClear()); } diff --git a/cli_ure/source/uno_bridge/cli_uno.cxx b/cli_ure/source/uno_bridge/cli_uno.cxx index c1598d98f376..e705de141d8d 100644 --- a/cli_ure/source/uno_bridge/cli_uno.cxx +++ b/cli_ure/source/uno_bridge/cli_uno.cxx @@ -230,9 +230,8 @@ void Bridge::call_cli( catch (System::Exception^ e) { OUStringBuffer buf( 128 ); - buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( - "Unexspected exception during invocation of cli object. " - "Original message is: \n") ); + buf.append( "Unexpected exception during invocation of cli object. " + "Original message is: \n" ); buf.append(mapCliString(e->Message)); throw BridgeRuntimeError( buf.makeStringAndClear() ); } -- cgit v1.2.3