summaryrefslogtreecommitdiff
path: root/cppuhelper/source
diff options
context:
space:
mode:
authorChr. Rossmanith <ChrRossmanith@gmx.de>2013-10-22 21:58:03 +0200
committerStephan Bergmann <sbergman@redhat.com>2013-10-23 10:44:09 +0200
commit1ed2c24a6e638ad7793c46427e4c49e42d435239 (patch)
treec1da9eb5d79baea4eb1e3bbf87e11407d8894076 /cppuhelper/source
parentcd7c0c6adfff3509630fda21d483c2cf5d76d275 (diff)
remove RTL_CONSTASCII_(U)STRINGPARAM
Change-Id: I0bce921bfc7102b9a33b1c87eee3ddec0ebaed7b Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, with one little typo fix
Diffstat (limited to 'cppuhelper/source')
-rw-r--r--cppuhelper/source/bootstrap.cxx25
-rw-r--r--cppuhelper/source/component_context.cxx55
-rw-r--r--cppuhelper/source/implbase_ex.cxx33
-rw-r--r--cppuhelper/source/implementationentry.cxx9
-rw-r--r--cppuhelper/source/propshlp.cxx22
-rw-r--r--cppuhelper/source/unourl.cxx2
6 files changed, 44 insertions, 102 deletions
diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
index 6522f722ca62..6c90e5516c13 100644
--- a/cppuhelper/source/bootstrap.cxx
+++ b/cppuhelper/source/bootstrap.cxx
@@ -137,18 +137,11 @@ Reference< XComponentContext > SAL_CALL bootstrap()
!= rtl_Random_E_None )
throw BootstrapException( "random pool error!" );
rtl_random_destroyPool( hPool );
- ::rtl::OUStringBuffer buf;
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "uno" ) );
+ ::rtl::OUStringBuffer buf("uno");
for ( sal_uInt32 i = 0; i < ARLEN( bytes ); ++i )
buf.append( static_cast< sal_Int32 >( bytes[ i ] ) );
OUString sPipeName( buf.makeStringAndClear() );
- // accept string
- OSL_ASSERT( buf.isEmpty() );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "--accept=pipe,name=" ) );
- buf.append( sPipeName );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( ";urp;" ) );
-
// arguments
OUString args [] = {
OUString("--nologo"),
@@ -156,7 +149,7 @@ Reference< XComponentContext > SAL_CALL bootstrap()
OUString("--norestore"),
OUString("--nocrashreport"),
OUString("--nolockcheck"),
- buf.makeStringAndClear()
+ OUString("--accept=pipe,name=" + sPipeName + ";urp;")
};
rtl_uString * ar_args [] = {
args[ 0 ].pData,
@@ -200,12 +193,7 @@ Reference< XComponentContext > SAL_CALL bootstrap()
bridge::UnoUrlResolver::create( xLocalContext ) );
// connection string
- OSL_ASSERT( buf.isEmpty() );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "uno:pipe,name=" ) );
- buf.append( sPipeName );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(
- ";urp;StarOffice.ComponentContext" ) );
- OUString sConnectString( buf.makeStringAndClear() );
+ OUString sConnectString( "uno:pipe,name=" + sPipeName + ";urp;StarOffice.ComponentContext" );
// wait until office is started
for ( ; ; )
@@ -235,12 +223,11 @@ Reference< XComponentContext > SAL_CALL bootstrap()
}
OUString bootstrap_expandUri(OUString const & uri) {
- static char const PREFIX[] = "vnd.sun.star.expand:";
- return uri.matchAsciiL(RTL_CONSTASCII_STRINGPARAM(PREFIX))
+ OUString rest;
+ return uri.startsWith("vnd.sun.star.expand:", &rest)
? cppuhelper::detail::expandMacros(
rtl::Uri::decode(
- uri.copy(RTL_CONSTASCII_LENGTH(PREFIX)),
- rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8))
+ rest, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8))
: uri;
}
diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx
index f75891238832..ab2ebf91ae71 100644
--- a/cppuhelper/source/component_context.cxx
+++ b/cppuhelper/source/component_context.cxx
@@ -80,20 +80,18 @@ static OUString val2str( void const * pVal, typelib_TypeDescriptionReference * p
return "void";
OUStringBuffer buf( 64 );
- buf.append( (sal_Unicode)'(' );
- buf.append( pTypeRef->pTypeName );
- buf.append( (sal_Unicode)')' );
+ buf.append( "(" + pTypeRef->pTypeName + ")" );
switch (pTypeRef->eTypeClass)
{
case typelib_TypeClass_INTERFACE:
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("0x") );
+ buf.append( "0x" );
buf.append( (sal_Int64)*(void **)pVal, 16 );
break;
case typelib_TypeClass_STRUCT:
case typelib_TypeClass_EXCEPTION:
{
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("{ ") );
+ buf.append( "{ " );
typelib_TypeDescription * pTypeDescr = 0;
::typelib_typedescriptionreference_getDescription( &pTypeDescr, pTypeRef );
OSL_ASSERT( pTypeDescr );
@@ -107,7 +105,7 @@ static OUString val2str( void const * pVal, typelib_TypeDescriptionReference * p
{
buf.append( val2str( pVal, ((typelib_TypeDescription *)pCompType->pBaseTypeDescription)->pWeakRef ) );
if (nDescr)
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", ") );
+ buf.append( ", " );
}
typelib_TypeDescriptionReference ** ppTypeRefs = pCompType->ppTypeRefs;
@@ -117,18 +115,18 @@ static OUString val2str( void const * pVal, typelib_TypeDescriptionReference * p
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 ) );
TYPELIB_DANGER_RELEASE( pMemberType );
if (nPos < (nDescr -1))
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(", ") );
+ buf.append( ", " );
}
::typelib_typedescription_release( pTypeDescr );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" }") );
+ buf.append( " }" );
break;
}
case typelib_TypeClass_SEQUENCE:
@@ -145,29 +143,29 @@ static OUString val2str( void const * pVal, typelib_TypeDescriptionReference * p
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 ) );
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 ) );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(" }") );
+ buf.append( " }" );
break;
case typelib_TypeClass_TYPE:
buf.append( (*(typelib_TypeDescriptionReference **)pVal)->pTypeName );
@@ -202,9 +200,9 @@ static OUString val2str( void const * pVal, typelib_TypeDescriptionReference * p
}
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)'\'' );
@@ -218,28 +216,28 @@ static OUString val2str( void const * pVal, typelib_TypeDescriptionReference * p
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".
@@ -414,7 +412,7 @@ void ComponentContext::insertByName(
new ContextEntry(
element,
/* lateInit_: */
- name.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("/singletons/") ) &&
+ name.startsWith( "/singletons/" ) &&
!element.hasValue() ) );
MutexGuard guard( m_mutex );
::std::pair<t_map::iterator, bool> insertion( m_map.insert(
@@ -454,7 +452,7 @@ void ComponentContext::replaceByName(
throw container::NoSuchElementException(
"no such element: " + name,
static_cast<OWeakObject *>(this) );
- if (name.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("/singletons/") ) &&
+ if (name.startsWith( "/singletons/" ) &&
!element.hasValue())
{
iFind->second->value.clear();
@@ -606,10 +604,9 @@ Any ComponentContext::lookupMap( OUString const & rName )
{
Any caught( getCaughtException() );
OUStringBuffer buf;
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(
- "exception occurred raising singleton \"") );
+ buf.append( "exception occurred raising singleton \"" );
buf.append( rName );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\": ") );
+ buf.append( "\": " );
buf.append( exc.Message );
throw lang::WrappedTargetRuntimeException(
buf.makeStringAndClear(), static_cast<OWeakObject *>(this),caught );
@@ -705,7 +702,7 @@ void ComponentContext::disposing()
// service manager disposed separately
if (!m_xSMgr.is() ||
- !iPos->first.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(SMGR_SINGLETON) ))
+ !iPos->first.startsWith( SMGR_SINGLETON ))
{
if (pEntry->lateInit)
{
diff --git a/cppuhelper/source/implbase_ex.cxx b/cppuhelper/source/implbase_ex.cxx
index 30e4d08e6cc4..8875c0814150 100644
--- a/cppuhelper/source/implbase_ex.cxx
+++ b/cppuhelper/source/implbase_ex.cxx
@@ -51,15 +51,8 @@ static inline void checkInterface( Type const & rType )
{
if (TypeClass_INTERFACE != rType.getTypeClass())
{
- OUStringBuffer buf( 64 );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("querying for interface \"") );
- buf.append( rType.getTypeName() );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\": no interface type!") );
- OUString msg( buf.makeStringAndClear() );
-#if OSL_DEBUG_LEVEL > 0
- OString str( OUStringToOString( msg, RTL_TEXTENCODING_ASCII_US ) );
- OSL_FAIL( str.getStr() );
-#endif
+ OUString msg( "querying for interface \"" + rType.getTypeName() + "\": no interface type!" );
+ SAL_WARN( "cppuhelper", msg );
throw RuntimeException( msg, Reference< XInterface >() );
}
}
@@ -101,15 +94,8 @@ static inline type_entry * __getTypeEntries( class_data * cd )
OSL_ENSURE( ! isXInterface( rType.getTypeLibType()->pTypeName ), "### want to implement XInterface: template argument is XInterface?!?!?!" );
if (rType.getTypeClass() != TypeClass_INTERFACE)
{
- OUStringBuffer buf( 48 );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("type \"") );
- buf.append( rType.getTypeName() );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\" is no interface type!") );
- OUString msg( buf.makeStringAndClear() );
-#if OSL_DEBUG_LEVEL > 0
- OString str( OUStringToOString( msg, RTL_TEXTENCODING_ASCII_US ) );
- OSL_FAIL( str.getStr() );
-#endif
+ OUString msg( "type \"" + rType.getTypeName() + "\" is no interface type!" );
+ SAL_WARN( "cppuhelper", msg );
throw RuntimeException( msg, Reference< XInterface >() );
}
// ref is statically held by getCppuType()
@@ -214,15 +200,8 @@ static inline void * __queryDeepNoXInterface(
}
else
{
- OUStringBuffer buf( 64 );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("cannot get type description for type \"") );
- buf.append( pEntries[ n ].m_type.typeRef->pTypeName );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\"!") );
- OUString msg( buf.makeStringAndClear() );
-#if OSL_DEBUG_LEVEL > 0
- OString str( OUStringToOString( msg, RTL_TEXTENCODING_ASCII_US ) );
- OSL_FAIL( str.getStr() );
-#endif
+ OUString msg( "cannot get type description for type \"" + OUString(pEntries[ n ].m_type.typeRef->pTypeName) + "\"!" );
+ SAL_WARN( "cppuhelper", msg );
throw RuntimeException( msg, Reference< XInterface >() );
}
}
diff --git a/cppuhelper/source/implementationentry.cxx b/cppuhelper/source/implementationentry.cxx
index b6d9dd42c9b0..7a84d45ff8cd 100644
--- a/cppuhelper/source/implementationentry.cxx
+++ b/cppuhelper/source/implementationentry.cxx
@@ -18,14 +18,12 @@
*/
#include <cppuhelper/implementationentry.hxx>
-#include <rtl/ustrbuf.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;
using rtl::OUString;
-using rtl::OUStringBuffer;
namespace cppu {
@@ -40,12 +38,9 @@ sal_Bool component_writeInfoHelper(
{
for( sal_Int32 i = 0; entries[i].create ; i ++ )
{
- OUStringBuffer buf( 124 );
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("/") );
- buf.append( entries[i].getImplementationName() );
- buf.appendAscii(RTL_CONSTASCII_STRINGPARAM( "/UNO/SERVICES" ) );
+ OUString sKey = "/" + entries[i].getImplementationName() + "/UNO/SERVICES";
Reference< XRegistryKey > xNewKey(
- reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( buf.makeStringAndClear() ) );
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( sKey ) );
Sequence< OUString > seq = entries[i].getSupportedServiceNames();
const OUString *pArray = seq.getConstArray();
diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx
index 4b45c54ef04e..f0e35f0ff6aa 100644
--- a/cppuhelper/source/propshlp.cxx
+++ b/cppuhelper/source/propshlp.cxx
@@ -34,7 +34,6 @@ using namespace com::sun::star::lang;
using namespace cppu;
using ::rtl::OUString;
-using ::rtl::OUStringToOString;
namespace cppu {
@@ -725,12 +724,7 @@ void OPropertySetHelper::fire
}
catch (RuntimeException & exc)
{
- OSL_TRACE(
- OUStringToOString(
- OUString( RTL_CONSTASCII_USTRINGPARAM(
- "caught RuntimeException while "
- "firing listeners: ") ) +
- exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ SAL_INFO("cppuhelper", "caught RuntimeException while firing listeners: " << exc.Message);
if (! bIgnoreRuntimeExceptionsWhileFiring)
throw;
}
@@ -782,12 +776,7 @@ void OPropertySetHelper::fire
}
catch (RuntimeException & exc)
{
- OSL_TRACE(
- OUStringToOString(
- OUString( RTL_CONSTASCII_USTRINGPARAM(
- "caught RuntimeException while "
- "firing listeners: ") ) +
- exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ SAL_INFO("cppuhelper", "caught RuntimeException while firing listeners: " << exc.Message);
if (! bIgnoreRuntimeExceptionsWhileFiring)
throw;
}
@@ -832,12 +821,7 @@ void OPropertySetHelper::fire
}
catch (RuntimeException & exc)
{
- OSL_TRACE(
- OUStringToOString(
- OUString( RTL_CONSTASCII_USTRINGPARAM(
- "caught RuntimeException while "
- "firing listeners: ") ) +
- exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ SAL_INFO("cppuhelper", "caught RuntimeException while firing listeners: " << exc.Message);
if (! bIgnoreRuntimeExceptionsWhileFiring)
throw;
}
diff --git a/cppuhelper/source/unourl.cxx b/cppuhelper/source/unourl.cxx
index f073ef4ee2a7..c5981f9a4264 100644
--- a/cppuhelper/source/unourl.cxx
+++ b/cppuhelper/source/unourl.cxx
@@ -209,7 +209,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
inline UnoUrl::Impl * UnoUrl::Impl::create(rtl::OUString const & rUrl)
{
- if (!rUrl.matchIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("uno:"), 0))
+ if (!rUrl.startsWithIgnoreAsciiCase("uno:"))
throw rtl::MalformedUriException(
rtl::OUString("UNO URL does not start with \"uno:\""));
sal_Int32 i = RTL_CONSTASCII_LENGTH("uno:");