[Libreoffice-commits] .: bridges/test

David Tardon dtardon at kemper.freedesktop.org
Sat Nov 20 02:23:15 PST 2010


 bridges/test/java_uno/acquire/testacquire.cxx                         |   10 +--
 bridges/test/java_uno/equals/testequals.cxx                           |    9 +--
 bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx |   26 +++-------
 bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx |   18 ++----
 bridges/test/testcomp.cxx                                             |    4 -
 bridges/test/testoffice.cxx                                           |    4 -
 bridges/test/testserver.cxx                                           |    2 
 7 files changed, 28 insertions(+), 45 deletions(-)

New commits:
commit 122022f5a368b6adca85e99dc9f987cad10dd0e6
Author: Kevin Hunter <hunteke at earlham.edu>
Date:   Fri Nov 19 10:07:01 2010 -0500

    EasyHack: RTL_CONST macro from createFromAscii
    
    They're only in the tests, but it compiles, and the createFromAscii
    messed with my grep-age!

diff --git a/bridges/test/java_uno/acquire/testacquire.cxx b/bridges/test/java_uno/acquire/testacquire.cxx
index 9c4ab2b..1b46e36 100644
--- a/bridges/test/java_uno/acquire/testacquire.cxx
+++ b/bridges/test/java_uno/acquire/testacquire.cxx
@@ -494,14 +494,12 @@ sal_Int32 Service::run(css::uno::Sequence< rtl::OUString > const & arguments)
 }
 
 rtl::OUString Service::getImplementationName_static() {
-    return rtl::OUString::createFromAscii(
-        "com.sun.star.test.bridges.testacquire.impl");
+    return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.test.bridges.testacquire.impl" ));
 }
 
 css::uno::Sequence< rtl::OUString > Service::getSupportedServiceNames_static() {
     css::uno::Sequence< rtl::OUString > names(1);
-    names[0] = rtl::OUString::createFromAscii(
-        "com.sun.star.test.bridges.testacquire");
+    names[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.test.bridges.testacquire" ));
     return names;
 }
 
@@ -543,9 +541,9 @@ namespace {
 
 bool writeInfo(void * registryKey, rtl::OUString const & implementationName,
                css::uno::Sequence< rtl::OUString > const & serviceNames) {
-    rtl::OUString keyName(rtl::OUString::createFromAscii("/"));
+    rtl::OUString keyName( RTL_CONSTASCII_USTRINGPARAM( "/" ));
     keyName += implementationName;
-    keyName += rtl::OUString::createFromAscii("/UNO/SERVICES");
+    keyName += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES" ));
     css::uno::Reference< css::registry::XRegistryKey > key;
     try {
         key = static_cast< css::registry::XRegistryKey * >(registryKey)->
diff --git a/bridges/test/java_uno/equals/testequals.cxx b/bridges/test/java_uno/equals/testequals.cxx
index 6f8197c..4788a02 100644
--- a/bridges/test/java_uno/equals/testequals.cxx
+++ b/bridges/test/java_uno/equals/testequals.cxx
@@ -123,7 +123,7 @@ void Service::connect(rtl::OUString const & rConnection,
         css::connection::Connector::create(m_xContext)->connect(rConnection));
     css::uno::Reference< css::bridge::XBridgeFactory > xBridgeFactory(
         m_xContext->getServiceManager()->createInstanceWithContext(
-            rtl::OUString::createFromAscii("com.sun.star.bridge.BridgeFactory"),
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.bridge.BridgeFactory" )),
             m_xContext),
         css::uno::UNO_QUERY);
     m_xBridge = xBridgeFactory->createBridge(rtl::OUString(), rProtocol,
@@ -139,8 +139,7 @@ Service::get(rtl::OUString const & rName) throw (css::uno::RuntimeException)
 css::uno::Sequence< rtl::OUString > Service::getSupportedServiceNames_static()
 {
     css::uno::Sequence< rtl::OUString > aNames(1);
-    aNames[0] = rtl::OUString::createFromAscii(
-        "com.sun.star.test.bridges.testequals");
+    aNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.test.bridges.testequals" ));
     return aNames;
 }
 
@@ -197,9 +196,9 @@ namespace {
 bool writeInfo(void * pRegistryKey, sal_Char const * pImplementationName,
                css::uno::Sequence< rtl::OUString > const & rServiceNames)
 {
-    rtl::OUString aKeyName(rtl::OUString::createFromAscii("/"));
+    rtl::OUString aKeyName( RTL_CONSTASCII_USTRINGPARAM( "/" ));
     aKeyName += rtl::OUString::createFromAscii(pImplementationName);
-    aKeyName += rtl::OUString::createFromAscii("/UNO/SERVICES");
+    aKeyName += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES" ));
     css::uno::Reference< css::registry::XRegistryKey > xKey;
     try
     {
diff --git a/bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx b/bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx
index fa2277e..24b4e9d 100644
--- a/bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx
+++ b/bridges/test/java_uno/nativethreadpool/testnativethreadpoolclient.cxx
@@ -88,30 +88,27 @@ sal_Int32 Client::run(css::uno::Sequence< rtl::OUString > const &)
         context->getServiceManager());
     if (!factory.is()) {
         throw new css::uno::RuntimeException(
-            rtl::OUString::createFromAscii(
-                "no component context service manager"),
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "no component context service manager" )),
             static_cast< cppu::OWeakObject * >(this));
     }
     css::uno::Reference< test::javauno::nativethreadpool::XRelay > relay;
     try {
         relay = css::uno::Reference< test::javauno::nativethreadpool::XRelay >(
             factory->createInstanceWithContext(
-                rtl::OUString::createFromAscii(
-                    "test.javauno.nativethreadpool.Relay"),
+                rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "test.javauno.nativethreadpool.Relay" )),
                 context),
             css::uno::UNO_QUERY_THROW);
     } catch (css::uno::RuntimeException &) {
         throw;
     } catch (css::uno::Exception & e) {
         throw css::lang::WrappedTargetRuntimeException(
-            rtl::OUString::createFromAscii(
-                "creating test.javauno.nativethreadpool.Relay service"),
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "creating test.javauno.nativethreadpool.Relay service" )),
             static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e));
     }
     relay->start(this);
     if (!data.setData(reinterpret_cast< void * >(12345))) {
         throw new css::uno::RuntimeException(
-            rtl::OUString::createFromAscii("osl::ThreadData::setData failed"),
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "osl::ThreadData::setData failed" )),
             static_cast< cppu::OWeakObject * >(this));
     }
     css::uno::Reference< test::javauno::nativethreadpool::XSource > source;
@@ -119,23 +116,19 @@ sal_Int32 Client::run(css::uno::Sequence< rtl::OUString > const &)
         source
             = css::uno::Reference< test::javauno::nativethreadpool::XSource >(
                 css::bridge::UnoUrlResolver::create(context)->resolve(
-                    rtl::OUString::createFromAscii(
-                        "uno:socket,host=localhost,port=3830;urp;test")),
+                    rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "uno:socket,host=localhost,port=3830;urp;test" ))),
                 css::uno::UNO_QUERY_THROW);
     } catch (css::connection::NoConnectException & e) {
         throw css::lang::WrappedTargetRuntimeException(
-            rtl::OUString::createFromAscii(
-                "com.sun.star.uno.UnoUrlResolver.resolve"),
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.uno.UnoUrlResolver.resolve" )),
             static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e));
     } catch (css::connection::ConnectionSetupException & e) {
         throw css::lang::WrappedTargetRuntimeException(
-            rtl::OUString::createFromAscii(
-                "com.sun.star.uno.UnoUrlResolver.resolve"),
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.uno.UnoUrlResolver.resolve" )),
             static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e));
     } catch (css::lang::IllegalArgumentException & e) {
         throw css::lang::WrappedTargetRuntimeException(
-            rtl::OUString::createFromAscii(
-                "com.sun.star.uno.UnoUrlResolver.resolve"),
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.uno.UnoUrlResolver.resolve" )),
             static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e));
     }
     bool success = source->get() == 12345;
@@ -155,8 +148,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL create(
 }
 
 rtl::OUString SAL_CALL getImplementationName() {
-    return rtl::OUString::createFromAscii(
-        "test.javauno.nativethreadpool.client");
+    return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "test.javauno.nativethreadpool.client" ));
 }
 
 css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() {
diff --git a/bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx b/bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx
index 1aa1caa..60553a5 100644
--- a/bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx
+++ b/bridges/test/java_uno/nativethreadpool/testnativethreadpoolserver.cxx
@@ -77,8 +77,7 @@ sal_Int32 Server::get() throw (css::uno::RuntimeException) {
         context->getServiceManager());
     if (!factory.is()) {
         throw new css::uno::RuntimeException(
-            rtl::OUString::createFromAscii(
-                "no component context service manager"),
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "no component context service manager" )),
             static_cast< cppu::OWeakObject * >(this));
     }
     css::uno::Reference< test::javauno::nativethreadpool::XSource > source;
@@ -87,23 +86,19 @@ sal_Int32 Server::get() throw (css::uno::RuntimeException) {
         source
             = css::uno::Reference< test::javauno::nativethreadpool::XSource >(
                 css::bridge::UnoUrlResolver::create(context)->resolve(
-                    rtl::OUString::createFromAscii(
-                        "uno:socket,host=127.0.0.1,port=3831;urp;test")),
+                    rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "uno:socket,host=127.0.0.1,port=3831;urp;test" ))),
                 css::uno::UNO_QUERY_THROW);
     } catch (css::connection::NoConnectException & e) {
         throw css::lang::WrappedTargetRuntimeException(
-            rtl::OUString::createFromAscii(
-                "com.sun.star.uno.UnoUrlResolver.resolve"),
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.uno.UnoUrlResolver.resolve" )),
             static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e));
     } catch (css::connection::ConnectionSetupException & e) {
         throw css::lang::WrappedTargetRuntimeException(
-            rtl::OUString::createFromAscii(
-                "com.sun.star.uno.UnoUrlResolver.resolve"),
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.uno.UnoUrlResolver.resolve" )),
             static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e));
     } catch (css::lang::IllegalArgumentException & e) {
         throw css::lang::WrappedTargetRuntimeException(
-            rtl::OUString::createFromAscii(
-                "com.sun.star.uno.UnoUrlResolver.resolve"),
+            rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.uno.UnoUrlResolver.resolve" )),
             static_cast< cppu::OWeakObject * >(this), css::uno::makeAny(e));
     }
     return source->get();
@@ -117,8 +112,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL create(
 }
 
 rtl::OUString SAL_CALL getImplementationName() {
-    return rtl::OUString::createFromAscii(
-        "test.javauno.nativethreadpool.server");
+    return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "test.javauno.nativethreadpool.server" ));
 }
 
 css::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() {
diff --git a/bridges/test/testcomp.cxx b/bridges/test/testcomp.cxx
index 11675c5..87785ed 100644
--- a/bridges/test/testcomp.cxx
+++ b/bridges/test/testcomp.cxx
@@ -774,7 +774,7 @@ Reference <XInterface > createComponent( const ::rtl::OUString &sService ,
         // erst registrieren
         Reference < XImplementationRegistration > rReg (
             rSMgr->createInstance(
-                OUString::createFromAscii( "com.sun.star.registry.ImplementationRegistration" )),
+                OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.registry.ImplementationRegistration" ))),
             UNO_QUERY );
 
         OSL_ASSERT( rReg.is() );
@@ -783,7 +783,7 @@ Reference <XInterface > createComponent( const ::rtl::OUString &sService ,
         try
         {
             rReg->registerImplementation(
-                OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ),
+                OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.loader.SharedLibrary" )),
                 aDllName,
                 Reference< XSimpleRegistry > () );
             rInterface = rSMgr->createInstance( sService );
diff --git a/bridges/test/testoffice.cxx b/bridges/test/testoffice.cxx
index d073cc2..5db5f63 100644
--- a/bridges/test/testoffice.cxx
+++ b/bridges/test/testoffice.cxx
@@ -87,7 +87,7 @@ void mygetchar()
 void testPipe( const Reference < XMultiServiceFactory > & rSmgr )
 {
     Reference < XOutputStream > rOut(
-        rSmgr->createInstance( OUString::createFromAscii( "com.sun.star.io.Pipe" ) ),
+        rSmgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.Pipe" )) ),
         UNO_QUERY );
 
     OSL_ASSERT( rOut.is() );
@@ -195,7 +195,7 @@ void doSomething( const  Reference < XInterface > &r )
     {
         printf( "got the remote naming service !\n" );
         Reference < XInterface > rXsmgr = rName->getRegisteredObject(
-            OUString::createFromAscii( "StarOffice.ServiceManager" ) );
+            OUString( RTL_CONSTASCII_USTRINGPARAM( "StarOffice.ServiceManager" )) );
 
         Reference < XMultiServiceFactory > rSmgr( rXsmgr , UNO_QUERY );
         if( rSmgr.is() )
diff --git a/bridges/test/testserver.cxx b/bridges/test/testserver.cxx
index d5fbb77..0973f36 100644
--- a/bridges/test/testserver.cxx
+++ b/bridges/test/testserver.cxx
@@ -160,7 +160,7 @@ void MyThread::run()
                             OUString( RTL_CONSTASCII_USTRINGPARAM("my test string")) , 2 );
                     }
                     printf( "all oneway are send\n" );
-                    rCallMe->call( OUString::createFromAscii( "reverse call me test finished" ) , 0 );
+                    rCallMe->call( OUString( RTL_CONSTASCII_USTRINGPARAM( "reverse call me test finished" )) , 0 );
                 printf( "revers callme test finished\n" );
                 }
             }


More information about the Libreoffice-commits mailing list