[Libreoffice-commits] core.git: cppuhelper/source cppuhelper/test cpputools/source

Chr. Rossmanith ChrRossmanith at gmx.de
Wed Oct 23 01:45:15 PDT 2013


 cppuhelper/source/bootstrap.cxx              |   25 +-----
 cppuhelper/source/component_context.cxx      |   55 +++++++-------
 cppuhelper/source/implbase_ex.cxx            |   33 +-------
 cppuhelper/source/implementationentry.cxx    |    9 --
 cppuhelper/source/propshlp.cxx               |   22 -----
 cppuhelper/source/unourl.cxx                 |    2 
 cppuhelper/test/bootstrap/bootstrap.test.cxx |  100 ++++++++++-----------------
 cppuhelper/test/loader/loader.test.cxx       |   28 +++----
 cppuhelper/test/testlib/defbootstrap_lib.cxx |    2 
 cpputools/source/unoexe/unoexe.cxx           |   65 ++++++-----------
 10 files changed, 122 insertions(+), 219 deletions(-)

New commits:
commit 1ed2c24a6e638ad7793c46427e4c49e42d435239
Author: Chr. Rossmanith <ChrRossmanith at gmx.de>
Date:   Tue Oct 22 21:58:03 2013 +0200

    remove RTL_CONSTASCII_(U)STRINGPARAM
    
    Change-Id: I0bce921bfc7102b9a33b1c87eee3ddec0ebaed7b
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>, with one little typo fix

diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
index 6522f72..6c90e55 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 f758912..ab2ebf9 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 30e4d08..8875c08 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 b6d9dd4..7a84d45 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 4b45c54..f0e35f0 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 f073ef4..c5981f9 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:");
diff --git a/cppuhelper/test/bootstrap/bootstrap.test.cxx b/cppuhelper/test/bootstrap/bootstrap.test.cxx
index 8614910..ef57f71 100644
--- a/cppuhelper/test/bootstrap/bootstrap.test.cxx
+++ b/cppuhelper/test/bootstrap/bootstrap.test.cxx
@@ -75,14 +75,10 @@ static bool s_check_object_is_in(void * pObject)
 static void s_test__loadSharedLibComponentFactory(rtl::OUString const & clientPurpose,
                                                   rtl::OUString const & servicePurpose)
 {
-    cppu::EnvGuard envGuard(uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))
-                                               + clientPurpose, NULL));
-    if (clientPurpose.getLength() && !envGuard.is())
+    cppu::EnvGuard envGuard(uno::Environment(UNO_LB_UNO + clientPurpose, NULL));
+    if (!clientPurpose.isEmpty() && !envGuard.is())
     {
-        s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tcouldn't get purpose env: \""));
-        s_comment += clientPurpose;
-        s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" - FAILURE\n"));
-
+        s_comment += "\t\tcouldn't get purpose env: \"" + clientPurpose + "\" - FAILURE\n";
         return;
     }
 
@@ -90,13 +86,13 @@ static void s_test__loadSharedLibComponentFactory(rtl::OUString const & clientPu
 
     uno::Reference<uno::XInterface> xItf(
         cppu::loadSharedLibComponentFactory(
-            rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SAL_DLLPREFIX "TestComponent.uno" SAL_DLLEXTENSION)),
+            rtl::OUString(SAL_DLLPREFIX "TestComponent.uno" SAL_DLLEXTENSION),
 #ifdef WIN32
-            rtl::OUString(""),
+            "",
 #else
-            rtl::OUString("file://../lib/"),
+            "file://../lib/",
 #endif
-            rtl::OUString("impl.test.TestComponent") + servicePurpose,
+            "impl.test.TestComponent" + servicePurpose,
             uno::Reference<lang::XMultiServiceFactory>(),
             uno::Reference<registry::XRegistryKey>()
             )
@@ -110,48 +106,41 @@ static void s_test__loadSharedLibComponentFactory(rtl::OUString const & clientPu
 
     if (!clientPurpose.equals(servicePurpose) && !s_check_object_is_in(xItf.get()))
     {
-        s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tcouldn't find object in current purpose \""));
-        s_comment += clientPurpose;
-        s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" - FAILURE\n"));
+        s_comment += "\t\tcouldn't find object in current purpose \"" + clientPurpose + "\" - FAILURE\n";
     }
 
     if (!cppu::EnvDcp::getPurpose(uno::Environment::getCurrent().getTypeName()).equals(clientPurpose))
     {
-        s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tdid not enter client purpose \""));
-        s_comment += clientPurpose;
-        s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" - FAILURE\n"));
+        s_comment += "\t\tdid not enter client purpose \"" + clientPurpose + "\" - FAILURE\n";
     }
 }
 
 static void s_test__loadSharedLibComponentFactory__free_free()
 {
-    s_comment += rtl::OUString("\ts_test__loadSharedLibComponentFactory__free_free\n");
+    s_comment += "\ts_test__loadSharedLibComponentFactory__free_free\n";
 
-    s_test__loadSharedLibComponentFactory(rtl::OUString(), rtl::OUString());
+    s_test__loadSharedLibComponentFactory("", "");
 }
 
 static void s_test__loadSharedLibComponentFactory__free_purpose()
 {
-    s_comment += rtl::OUString("\ts_test__loadSharedLibComponentFactory__free_purpose\n");
+    s_comment += "\ts_test__loadSharedLibComponentFactory__free_purpose\n";
 
-    s_test__loadSharedLibComponentFactory(rtl::OUString(),
-                                          rtl::OUString(":testenv"));
+    s_test__loadSharedLibComponentFactory("", ":testenv");
 }
 
 static void s_test__loadSharedLibComponentFactory__purpose_free()
 {
-    s_comment += rtl::OUString("\ts_test__loadSharedLibComponentFactory__purpose_free\n");
+    s_comment += "\ts_test__loadSharedLibComponentFactory__purpose_free\n";
 
-    s_test__loadSharedLibComponentFactory(rtl::OUString(":testenv"),
-                                          rtl::OUString());
+    s_test__loadSharedLibComponentFactory(":testenv", "");
 }
 
 static void s_test__loadSharedLibComponentFactory__purpose_purpose()
 {
-    s_comment += rtl::OUString("\ts_test__loadSharedLibComponentFactory__purpose_purpose\n");
+    s_comment += "\ts_test__loadSharedLibComponentFactory__purpose_purpose\n";
 
-    s_test__loadSharedLibComponentFactory(rtl::OUString(":testenv"),
-                                          rtl::OUString(":testenv"));
+    s_test__loadSharedLibComponentFactory(":testenv", ":testenv");
 }
 
 static rtl::OUString s_getSDrive(void)
@@ -166,10 +155,9 @@ static rtl::OUString s_getSDrive(void)
     path += rtl::OUString(tmp, rtl_str_getLength(tmp), RTL_TEXTENCODING_ASCII_US);
     path += rtl::OUString(SAL_PATHDELIMITER);
 #ifdef WIN32
-    path += rtl::OUString("bin");
-
+    path += "bin";
 #else
-    path += rtl::OUString("lib");
+    path += "lib";
 #endif
 
     tmp = getenv("UPDMINOREXT");
@@ -183,14 +171,11 @@ static rtl::OUString s_getSDrive(void)
 
 static void s_test__createSimpleRegistry(rtl::OUString const & clientPurpose)
 {
-    cppu::EnvGuard envGuard(uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))
+    cppu::EnvGuard envGuard(uno::Environment(rtl::OUString(UNO_LB_UNO)
                                                + clientPurpose, NULL));
-    if (clientPurpose.getLength() && !envGuard.is())
+    if (!clientPurpose.isEmpty() && !envGuard.is())
     {
-        s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tcouldn't get purpose env: \""));
-        s_comment += clientPurpose;
-        s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" - FAILURE\n"));
-
+        s_comment += "\t\tcouldn't get purpose env: \"" + clientPurpose + "\" - FAILURE\n";
         return;
     }
 
@@ -199,43 +184,38 @@ static void s_test__createSimpleRegistry(rtl::OUString const & clientPurpose)
 
     if (!registry.is())
     {
-        s_comment += rtl::OUString("\t\tgot no object - FAILURE\n");
+        s_comment += "\t\tgot no object - FAILURE\n";
         return;
     }
 
-    if (clientPurpose.getLength() != 0 && !s_check_object_is_in(registry.get()))
+    if (!clientPurpose.isEmpty() && !s_check_object_is_in(registry.get()))
     {
-        s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tcouldn't find object in current purpose \""));
-        s_comment += clientPurpose;
-        s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" - FAILURE\n"));
+        s_comment += "\t\tcouldn't find object in current purpose \"" + clientPurpose + "\" - FAILURE\n";
     }
 }
 
 static void s_test__createSimpleRegistry__free(void)
 {
-    s_comment += rtl::OUString("\ts_test__createSimpleRegistry__free\n");
+    s_comment += "\ts_test__createSimpleRegistry__free\n";
 
     s_test__createSimpleRegistry(rtl::OUString());
 }
 
 static void s_test__createSimpleRegistry__purpose(void)
 {
-    s_comment += rtl::OUString("\ts_test__createSimpleRegistry__purpose\n");
+    s_comment += "\ts_test__createSimpleRegistry__purpose\n";
 
-    s_test__createSimpleRegistry(rtl::OUString(":testenv"));
+    s_test__createSimpleRegistry(":testenv");
 }
 
 
 static void s_test__bootstrap_InitialComponentContext(rtl::OUString const & clientPurpose)
 {
-    cppu::EnvGuard envGuard(uno::Environment(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))
+    cppu::EnvGuard envGuard(uno::Environment(rtl::OUString(UNO_LB_UNO)
                                                + clientPurpose, NULL));
-    if (clientPurpose.getLength() && !envGuard.is())
+    if (!clientPurpose.isEmpty() && !envGuard.is())
     {
-        s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tcouldn't get purpose env: \""));
-        s_comment += clientPurpose;
-        s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" - FAILURE\n"));
-
+        s_comment += "\t\tcouldn't get purpose env: \"" + clientPurpose + "\" - FAILURE\n";
         return;
     }
 
@@ -247,15 +227,13 @@ static void s_test__bootstrap_InitialComponentContext(rtl::OUString const & clie
 
     if (!xContext.is())
     {
-        s_comment += rtl::OUString("\t\tgot no object - FAILURE\n");
+        s_comment += "\t\tgot no object - FAILURE\n";
         return;
     }
 
-    if (clientPurpose.getLength() != 0 && !s_check_object_is_in(xContext.get()))
+    if (!clientPurpose.isEmpty() && !s_check_object_is_in(xContext.get()))
     {
-        s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t\tcouldn't find object in current purpose \""));
-        s_comment += clientPurpose;
-        s_comment += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\" - FAILURE\n"));
+        s_comment += "\t\tcouldn't find object in current purpose \"" + clientPurpose + "\" - FAILURE\n";
     }
 
     uno::Reference<lang::XComponent> xComponent(xContext, uno::UNO_QUERY_THROW);
@@ -264,16 +242,16 @@ static void s_test__bootstrap_InitialComponentContext(rtl::OUString const & clie
 
 static void s_test__bootstrap_InitialComponentContext__free(void)
 {
-    s_comment += rtl::OUString("\ts_test__bootstrap_InitialComponentContext__free\n");
+    s_comment += "\ts_test__bootstrap_InitialComponentContext__free\n";
 
     s_test__bootstrap_InitialComponentContext(rtl::OUString());
 }
 
 static void s_test__bootstrap_InitialComponentContext__purpose(void)
 {
-    s_comment += rtl::OUString("\ts_test__bootstrap_InitialComponentContext__purpose\n");
+    s_comment += "\ts_test__bootstrap_InitialComponentContext__purpose\n";
 
-    s_test__bootstrap_InitialComponentContext(rtl::OUString(":testenv"));
+    s_test__bootstrap_InitialComponentContext(":testenv");
 }
 
 
@@ -293,12 +271,12 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(/*argc*/, argv)
     int ret;
     if (s_comment.indexOf("FAILURE") == -1)
     {
-        s_comment += rtl::OUString("TESTS PASSED\n");
+        s_comment += "TESTS PASSED\n";
         ret = 0;
     }
     else
     {
-        s_comment += rtl::OUString("TESTS _NOT_ PASSED\n");
+        s_comment += "TESTS _NOT_ PASSED\n";
         ret = -1;
     }
 
diff --git a/cppuhelper/test/loader/loader.test.cxx b/cppuhelper/test/loader/loader.test.cxx
index cbaf734..be4ee12 100644
--- a/cppuhelper/test/loader/loader.test.cxx
+++ b/cppuhelper/test/loader/loader.test.cxx
@@ -83,14 +83,14 @@ static rtl::OUString s_test__cppu_loadSharedLibComponentFactory(char const * pSe
                                                  RTL_TEXTENCODING_ASCII_US);
 
     result += rtl::OUString("\ts_test__cppu_loadSharedLibComponentFactory ");
-    result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("(\""));
+    result += rtl::OUString("(\"");
     result += servicePurpose;
-    result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\") - "));
+    result += rtl::OUString("\") - ");
 
     try {
         uno::Reference<uno::XInterface> xObject(
             cppu::loadSharedLibComponentFactory(
-                rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SAL_DLLPREFIX "TestComponent.uno" SAL_DLLEXTENSION)),
+                rtl::OUString(SAL_DLLPREFIX "TestComponent.uno" SAL_DLLEXTENSION),
                 rtl::OUString(),
                 rtl::OUString("impl.test.TestComponent") + servicePurpose,
                 uno::Reference<lang::XMultiServiceFactory>(),
@@ -103,15 +103,15 @@ static rtl::OUString s_test__cppu_loadSharedLibComponentFactory(char const * pSe
 
         else
         {
-            result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILED - got: \""));
+            result += rtl::OUString("FAILED - got: \"");
             result += envDcp_purpose;
-            result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n"));
+            result += rtl::OUString("\"\n");
         }
     }
     catch(uno::Exception & exception) {
-        result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILED - got: \""));
+        result += rtl::OUString("FAILED - got: \"");
         result += exception.Message;
-        result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n"));
+        result += rtl::OUString("\"\n");
     }
 
     return result;
@@ -126,9 +126,9 @@ static rtl::OUString s_test__cppu_writeSharedLibComponentInfo(char const * pServ
                                                  RTL_TEXTENCODING_ASCII_US);
 
     result += rtl::OUString("\ts_test__cppu_writeSharedLibComponentInfo ");
-    result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("(\""));
+    result += rtl::OUString("(\"");
     result += servicePurpose;
-    result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\") - "));
+    result += rtl::OUString("\") - ");
 
     char buff[256];
     strcpy(buff, "TestComponent.uno=");
@@ -138,7 +138,7 @@ static rtl::OUString s_test__cppu_writeSharedLibComponentInfo(char const * pServ
 
     try {
         cppu::writeSharedLibComponentInfo(
-            rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SAL_DLLPREFIX "TestComponent.uno" SAL_DLLEXTENSION)),
+            rtl::OUString(SAL_DLLPREFIX "TestComponent.uno" SAL_DLLEXTENSION),
             rtl::OUString(),
             uno::Reference<lang::XMultiServiceFactory>(),
             uno::Reference<registry::XRegistryKey>(new MyKey)
@@ -150,15 +150,15 @@ static rtl::OUString s_test__cppu_writeSharedLibComponentInfo(char const * pServ
 
         else
         {
-            result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILED - got: \""));
+            result += rtl::OUString("FAILED - got: \"");
             result += envDcp_purpose;
-            result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n"));
+            result += rtl::OUString("\"\n");
         }
     }
     catch(uno::Exception & exception) {
-        result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILED - got: \""));
+        result += rtl::OUString("FAILED - got: \"");
         result += exception.Message;
-        result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\"\n"));
+        result += rtl::OUString("\"\n");
     }
 
     return result;
diff --git a/cppuhelper/test/testlib/defbootstrap_lib.cxx b/cppuhelper/test/testlib/defbootstrap_lib.cxx
index e101eb7..e25a383 100644
--- a/cppuhelper/test/testlib/defbootstrap_lib.cxx
+++ b/cppuhelper/test/testlib/defbootstrap_lib.cxx
@@ -42,7 +42,7 @@ static sal_Bool tryService(const char * serviceName)
     ::osl::Module::getUrlFromAddress((void *)tryService, libraryFileUrl);
 
     OUString iniName = libraryFileUrl.copy(0, libraryFileUrl.lastIndexOf((sal_Unicode)'.')); // cut the library extension
-    iniName += OUString(RTL_CONSTASCII_USTRINGPARAM(SAL_CONFIGFILE(""))); // add the rc file extension
+    iniName += OUString(SAL_CONFIGFILE("")); // add the rc file extension
 
 #if OSL_DEBUG_LEVEL > 1
     OString sIniName = OUStringToOString(iniName, RTL_TEXTENCODING_ASCII_US);
diff --git a/cpputools/source/unoexe/unoexe.cxx b/cpputools/source/unoexe/unoexe.cxx
index 1a7ace1..fe1d976 100644
--- a/cpputools/source/unoexe/unoexe.cxx
+++ b/cpputools/source/unoexe/unoexe.cxx
@@ -105,11 +105,9 @@ static sal_Bool readOption( OUString * pValue, const sal_Char * pOpt,
         rtl_getAppCommandArg(*pnIndex, &pValue->pData);
         if (*pnIndex >= rtl_getAppCommandArgCount() || pValue->copy(1).equals(dash))
         {
-            OUStringBuffer buf( 32 );
-            buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("incomplete option \"-") );
-            buf.appendAscii( pOpt );
-            buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\" given!") );
-            throw RuntimeException( buf.makeStringAndClear(), Reference< XInterface >() );
+            throw RuntimeException(
+                "incomplete option \"-" + aOpt + "\" given!",
+                Reference< XInterface >() );
         }
         else
         {
@@ -172,24 +170,20 @@ void createInstance(
 
     if (! x.is())
     {
-        OUStringBuffer buf( 64 );
-        buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("cannot get service instance \"") );
-        buf.append( rServiceName );
-        buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\"!") );
-        throw RuntimeException( buf.makeStringAndClear(), Reference< XInterface >() );
+        throw RuntimeException(
+            "cannot get service instance \"" + rServiceName + "\"!",
+            Reference< XInterface >() );
     }
 
     rxOut = Reference< T >::query( x );
     if (! rxOut.is())
     {
-        OUStringBuffer buf( 64 );
-        buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("service instance \"") );
-        buf.append( rServiceName );
-        buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\" does not support demanded interface \"") );
         const Type & rType = ::getCppuType( (const Reference< T > *)0 );
-        buf.append( rType.getTypeName() );
-        buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\"!") );
-        throw RuntimeException( buf.makeStringAndClear(), Reference< XInterface >() );
+        throw RuntimeException(
+            "service instance \"" + rServiceName +
+            "\" does not support demanded interface \"" +
+            rType.getTypeName() + "\"!",
+            Reference< XInterface >() );
     }
 }
 
@@ -222,11 +216,9 @@ static Reference< XInterface > loadComponent(
         }
         else
         {
-            OUStringBuffer buf( 64 );
-            buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("unknown extension of \"") );
-            buf.append( rLocation );
-            buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\"!  No loader available!") );
-            throw RuntimeException( buf.makeStringAndClear(), Reference< XInterface >() );
+            throw RuntimeException(
+                "unknown extension of \"" + rLocation + "\"!  No loader available!",
+                Reference< XInterface >() );
         }
 
         Reference< XInterface > xInstance;
@@ -256,24 +248,18 @@ static Reference< XInterface > loadComponent(
 
         if (! xInstance.is())
         {
-            OUStringBuffer buf( 64 );
-            buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("activating component \"") );
-            buf.append( rImplName );
-            buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\" from location \"") );
-            buf.append( rLocation );
-            buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\" failed!") );
-            throw RuntimeException( buf.makeStringAndClear(), Reference< XInterface >() );
+            throw RuntimeException(
+                "activating component \"" + rImplName + "\" from location \"" + rLocation + "\" failed!",
+                Reference< XInterface >() );
         }
 
         return xInstance;
     }
     else
     {
-        OUStringBuffer buf( 64 );
-        buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("location \"") );
-        buf.append( rLocation );
-        buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\" has no extension!  Cannot determine loader to be used!") );
-        throw RuntimeException( buf.makeStringAndClear(), Reference< XInterface >() );
+        throw RuntimeException(
+            "location \"" + rLocation + "\" has no extension!  Cannot determine loader to be used!",
+            Reference< XInterface >() );
     }
 }
 
@@ -370,11 +356,9 @@ Reference< XInterface > OInstanceProvider::getInstance( const OUString & rName )
         out( "\n> error: " );
         out( rExc.Message );
     }
-    OUStringBuffer buf( 64 );
-    buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("no such element \"") );
-    buf.append( rName );
-    buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("\"!") );
-    throw NoSuchElementException( buf.makeStringAndClear(), Reference< XInterface >() );
+    throw NoSuchElementException(
+        "no such element \"" + rName + "\"!",
+        Reference< XInterface >() );
 }
 
 struct ODisposingListener : public WeakImplHelper1< XEventListener >
@@ -462,8 +446,7 @@ SAL_IMPLEMENT_MAIN()
             throw RuntimeException("give component exOR service name!", Reference< XInterface >() );
         if (aImplName.isEmpty() && aServiceName.isEmpty())
         {
-            if (! aUnoUrl.endsWithIgnoreAsciiCaseAsciiL(
-                    RTL_CONSTASCII_STRINGPARAM(";uno.ComponentContext") ))
+            if (! aUnoUrl.endsWithIgnoreAsciiCase( ";uno.ComponentContext" ))
                 throw RuntimeException(
                     OUString("expected UNO-URL with instance name uno.ComponentContext!" ),
                     Reference<XInterface>() );


More information about the Libreoffice-commits mailing list