targeted string re-work

Change-Id: Ibe5c739c3066f3e706a44b64d4ad775abde9662c
This commit is contained in:
Norbert Thiebaud
2012-06-01 09:15:09 -05:00
parent 4de8cc3465
commit 9601b63509
4 changed files with 67 additions and 74 deletions

View File

@@ -180,46 +180,46 @@ void testConnection( const OUString &sConnectionDescription ,
int SAL_CALL main( int argc, char * argv[] )
{
Reference< XMultiServiceFactory > xMgr(
createRegistryServiceFactory( OUString( RTL_CONSTASCII_USTRINGPARAM("applicat.rdb")) ) );
createRegistryServiceFactory( OUString( "applicat.rdb") ) );
Reference< XImplementationRegistration > xImplReg(
xMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration")) ), UNO_QUERY );
xMgr->createInstance( OUString("com.sun.star.registry.ImplementationRegistration") ), UNO_QUERY );
OSL_ENSURE( xImplReg.is(), "### no impl reg!" );
OUString aLibName =
OUString(RTL_CONSTASCII_USTRINGPARAM( "connector.uno" SAL_DLLEXTENSION ));
OUString( "connector.uno" SAL_DLLEXTENSION );
xImplReg->registerImplementation(
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), aLibName, Reference< XSimpleRegistry >() );
OUString("com.sun.star.loader.SharedLibrary"), aLibName, Reference< XSimpleRegistry >() );
aLibName = OUString(RTL_CONSTASCII_USTRINGPARAM( "acceptor.uno" SAL_DLLEXTENSION ));
aLibName = OUString( "acceptor.uno" SAL_DLLEXTENSION );
xImplReg->registerImplementation(
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")), aLibName, Reference< XSimpleRegistry >() );
OUString("com.sun.star.loader.SharedLibrary"), aLibName, Reference< XSimpleRegistry >() );
Reference < XAcceptor > rAcceptor(
xMgr->createInstance(
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.connection.Acceptor")) ) , UNO_QUERY );
OUString("com.sun.star.connection.Acceptor") ) , UNO_QUERY );
Reference < XAcceptor > rAcceptorPipe(
xMgr->createInstance(
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.connection.Acceptor")) ) , UNO_QUERY );
OUString("com.sun.star.connection.Acceptor") ) , UNO_QUERY );
Reference < XConnector > rConnector(
xMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.connection.Connector")) ) , UNO_QUERY );
xMgr->createInstance( OUString("com.sun.star.connection.Connector") ) , UNO_QUERY );
printf( "Testing sockets" );
fflush( stdout );
testConnection( OUString(RTL_CONSTASCII_USTRINGPARAM("socket,host=localhost,port=2001")), rAcceptor , rConnector );
testConnection( OUString("socket,host=localhost,port=2001"), rAcceptor , rConnector );
printf( " Done\n" );
printf( "Testing pipe" );
fflush( stdout );
testConnection( OUString(RTL_CONSTASCII_USTRINGPARAM("pipe,name=bla")) , rAcceptorPipe , rConnector );
testConnection( OUString("pipe,name=bla") , rAcceptorPipe , rConnector );
printf( " Done\n" );
// check, if errornous strings make any problem
rAcceptor = Reference< XAcceptor > (
xMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.connection.Acceptor")) ),
xMgr->createInstance( OUString("com.sun.star.connection.Acceptor") ),
UNO_QUERY );
try
@@ -251,14 +251,14 @@ int SAL_CALL main( int argc, char * argv[] )
}
MyThread thread( rAcceptor , OUString(RTL_CONSTASCII_USTRINGPARAM("socket,host=localhost,port=2001")) );
MyThread thread( rAcceptor , OUString("socket,host=localhost,port=2001") );
thread.create();
TimeValue value = {0,1};
osl_waitThread( &value );
try
{
rAcceptor->accept( OUString(RTL_CONSTASCII_USTRINGPARAM("socket,host=localhost,port=2001")) );
rAcceptor->accept( OUString("socket,host=localhost,port=2001") );
OSL_FAIL( "already existing exception expected" );
}
catch( AlreadyAcceptingException & )

View File

@@ -69,7 +69,7 @@ using com::sun::star::beans::XIntrospection;
namespace pyuno
{
#define USTR_ASCII(x) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) )
#define USTR_ASCII(x) OUString( x )
static PyTypeObject RuntimeImpl_Type =
{
@@ -133,8 +133,7 @@ static void getRuntimeImpl( PyRef & globalDict, PyRef &runtimeImpl )
PyThreadState * state = PyThreadState_Get();
if( ! state )
{
throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM(
"python global interpreter must be held (thread must be attached)" )),
throw RuntimeException( OUString( "python global interpreter must be held (thread must be attached" )),
Reference< XInterface > () );
}
@@ -142,8 +141,7 @@ static void getRuntimeImpl( PyRef & globalDict, PyRef &runtimeImpl )
if( ! globalDict.is() ) // FATAL !
{
throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM(
"can't find __main__ module" )), Reference< XInterface > ());
throw RuntimeException( OUString( "can't find __main__ module" ), Reference< XInterface > ());
}
runtimeImpl = PyDict_GetItemString( globalDict.get() , "pyuno_runtime" );
}
@@ -182,7 +180,7 @@ static void readLoggingConfig( sal_Int32 *pLevel, FILE **ppFile )
reinterpret_cast< oslGenericFunction >(readLoggingConfig),
(rtl_uString **) &fileName );
fileName = OUString( fileName.getStr(), fileName.lastIndexOf( '/' )+1 );
fileName += OUString(RTL_CONSTASCII_USTRINGPARAM( SAL_CONFIGFILE("pyuno") ));
fileName += OUString( SAL_CONFIGFILE("pyuno" ));
rtl::Bootstrap bootstrapHandle( fileName );
OUString str;
@@ -246,7 +244,7 @@ PyRef stRuntimeImpl::create( const Reference< XComponentContext > &ctx )
RuntimeImpl *me = PyObject_New (RuntimeImpl, &RuntimeImpl_Type);
if( ! me )
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM( "cannot instantiate pyuno::RuntimeImpl" ) ),
OUString( "cannot instantiate pyuno::RuntimeImpl" ),
Reference< XInterface > () );
me->cargo = 0;
// must use a different struct here, as the PyObject_New
@@ -259,60 +257,59 @@ PyRef stRuntimeImpl::create( const Reference< XComponentContext > &ctx )
c->xContext = ctx;
c->xInvocation = Reference< XSingleServiceFactory > (
ctx->getServiceManager()->createInstanceWithContext(
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.Invocation" ) ),
OUString( "com.sun.star.script.Invocation" ),
ctx ),
UNO_QUERY );
if( ! c->xInvocation.is() )
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM( "pyuno: couldn't instantiate invocation service" ) ),
OUString( "pyuno: couldn't instantiate invocation service" ),
Reference< XInterface > () );
c->xTypeConverter = Reference< XTypeConverter > (
ctx->getServiceManager()->createInstanceWithContext(
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.Converter" ) ),
OUString( "com.sun.star.script.Converter" ),
ctx ),
UNO_QUERY );
if( ! c->xTypeConverter.is() )
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM( "pyuno: couldn't instantiate typeconverter service" )),
OUString( "pyuno: couldn't instantiate typeconverter service" ),
Reference< XInterface > () );
c->xCoreReflection = Reference< XIdlReflection > (
ctx->getServiceManager()->createInstanceWithContext(
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.reflection.CoreReflection" ) ),
OUString( "com.sun.star.reflection.CoreReflection" ),
ctx ),
UNO_QUERY );
if( ! c->xCoreReflection.is() )
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM( "pyuno: couldn't instantiate corereflection service" )),
OUString( "pyuno: couldn't instantiate corereflection service" ),
Reference< XInterface > () );
c->xAdapterFactory = Reference< XInvocationAdapterFactory2 > (
ctx->getServiceManager()->createInstanceWithContext(
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.InvocationAdapterFactory" ) ),
OUString( "com.sun.star.script.InvocationAdapterFactory" ),
ctx ),
UNO_QUERY );
if( ! c->xAdapterFactory.is() )
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM( "pyuno: couldn't instantiate invocation adapter factory service" )),
OUString( "pyuno: couldn't instantiate invocation adapter factory service" ),
Reference< XInterface > () );
c->xIntrospection = Reference< XIntrospection > (
ctx->getServiceManager()->createInstanceWithContext(
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.Introspection" ) ),
OUString( "com.sun.star.beans.Introspection" ),
ctx ),
UNO_QUERY );
if( ! c->xIntrospection.is() )
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM( "pyuno: couldn't instantiate introspection service" )),
OUString( "pyuno: couldn't instantiate introspection service" ),
Reference< XInterface > () );
Any a = ctx->getValueByName(OUString(
RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.reflection.theTypeDescriptionManager" )) );
Any a = ctx->getValueByName(OUString( "/singletons/com.sun.star.reflection.theTypeDescriptionManager" ) );
a >>= c->xTdMgr;
if( ! c->xTdMgr.is() )
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM( "pyuno: couldn't retrieve typedescriptionmanager" )),
OUString( "pyuno: couldn't retrieve typedescriptionmanager" ),
Reference< XInterface > () );
me->cargo =c;
@@ -338,8 +335,7 @@ void Runtime::initialize( const Reference< XComponentContext > & ctx )
if( runtime.is() && impl->cargo->valid )
{
throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM(
"pyuno runtime has already been initialized before" ) ),
throw RuntimeException( OUString( "pyuno runtime has already been initialized before" ),
Reference< XInterface > () );
}
PyRef keep( RuntimeImpl::create( ctx ) );
@@ -364,8 +360,8 @@ Runtime::Runtime() throw( RuntimeException )
if( ! runtime.is() )
{
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM("pyuno runtime is not initialized, "
"(the pyuno.bootstrap needs to be called before using any uno classes)")),
OUString( "pyuno runtime is not initialized, "
"(the pyuno.bootstrap needs to be called before using any uno classes")),
Reference< XInterface > () );
}
impl = reinterpret_cast< RuntimeImpl * > (runtime.get());
@@ -399,8 +395,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const
{
if( ! impl->cargo->valid )
{
throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM(
"pyuno runtime must be initialized before calling any2PyObject" )),
throw RuntimeException( OUString( "pyuno runtime must be initialized before calling any2PyObject" ),
Reference< XInterface > () );
}
@@ -640,8 +635,7 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
{
if( ! impl->cargo->valid )
{
throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM(
"pyuno runtime must be initialized before calling any2PyObject" )),
throw RuntimeException( OUString( "pyuno runtime must be initialized before calling any2PyObject" ),
Reference< XInterface > () );
}
@@ -834,9 +828,8 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
else
{
throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM(
"uno.Any instance not accepted during method call, "
"use uno.invoke instead" ) ),
OUString( "uno.Any instance not accepted during method call, "
"use uno.invoke instead" ),
Reference< XInterface > () );
}
}
@@ -931,17 +924,17 @@ Any Runtime::extractUnoException( const PyRef & excType, const PyRef &excValue,
}
else
{
str = OUString(RTL_CONSTASCII_USTRINGPARAM("Couldn't find uno._uno_extract_printable_stacktrace"));
str = OUString("Couldn't find uno._uno_extract_printable_stacktrace");
}
}
else
{
str = OUString(RTL_CONSTASCII_USTRINGPARAM("Could not load uno.py, no stacktrace available"));
str = OUString("Could not load uno.py, no stacktrace available");
if ( !e.Message.isEmpty() )
{
str += OUString (RTL_CONSTASCII_USTRINGPARAM(" (Error loading uno.py: "));
str += OUString (" (Error loading uno.py: ");
str += e.Message;
str += OUString (RTL_CONSTASCII_USTRINGPARAM(")"));
str += OUString (")");
}
}
@@ -949,7 +942,7 @@ Any Runtime::extractUnoException( const PyRef & excType, const PyRef &excValue,
else
{
// it may occur, that no traceback is given (e.g. only native code below)
str = OUString( RTL_CONSTASCII_USTRINGPARAM( "no traceback available" ) );
str = OUString( "no traceback available" );
}
if( isInstanceOfStructOrException( excValue.get() ) )
@@ -1026,7 +1019,7 @@ PyThreadAttach::PyThreadAttach( PyInterpreterState *interp)
tstate = PyThreadState_New( interp );
if( !tstate )
throw RuntimeException(
OUString(RTL_CONSTASCII_USTRINGPARAM( "Couldn't create a pythreadstate" ) ),
OUString( "Couldn't create a pythreadstate" ),
Reference< XInterface > () );
PyEval_AcquireThread( tstate);
// set LC_NUMERIC to "C"

View File

@@ -92,7 +92,7 @@ void OfficeClientMain::testWriter( const Reference< XComponent > & rComponent )
Reference< XTextCursor > rCursor = rText->createTextCursor();
Reference< XTextRange > rRange ( rCursor , UNO_QUERY );
rText->insertString( rRange, OUString(RTL_CONSTASCII_USTRINGPARAM("This text has been posted by the officeclient component")), sal_False );
rText->insertString( rRange, OUString("This text has been posted by the officeclient component"), sal_False );
}
/********************
@@ -105,7 +105,7 @@ void OfficeClientMain::registerServices( )
Reference < XImplementationRegistration > rImplementationRegistration(
m_xSMgr->createInstance(
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.ImplementationRegistration"))),
OUString("com.sun.star.registry.ImplementationRegistration")),
UNO_QUERY );
if( ! rImplementationRegistration.is() )
@@ -116,13 +116,13 @@ void OfficeClientMain::registerServices( )
OUString aSharedLibrary[4];
aSharedLibrary[0] =
OUString(RTL_CONSTASCII_USTRINGPARAM( "connector.uno" SAL_DLLEXTENSION ));
OUString( "connector.uno" SAL_DLLEXTENSION );
aSharedLibrary[1] =
OUString(RTL_CONSTASCII_USTRINGPARAM( "remotebridge.uno" SAL_DLLEXTENSION ));
OUString( "remotebridge.uno" SAL_DLLEXTENSION );
aSharedLibrary[2] =
OUString(RTL_CONSTASCII_USTRINGPARAM( "bridgefac.uno" SAL_DLLEXTENSION ));
OUString( "bridgefac.uno" SAL_DLLEXTENSION );
aSharedLibrary[3] =
OUString(RTL_CONSTASCII_USTRINGPARAM( "uuresolver.uno" SAL_DLLEXTENSION ));
OUString( "uuresolver.uno" SAL_DLLEXTENSION );
sal_Int32 i;
for( i = 0 ; i < 4 ; i ++ )
@@ -135,7 +135,7 @@ void OfficeClientMain::registerServices( )
{
// register the needed services in the servicemanager
rImplementationRegistration->registerImplementation(
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.loader.SharedLibrary")),
OUString("com.sun.star.loader.SharedLibrary"),
aDllName,
Reference< XSimpleRegistry > () );
}
@@ -156,7 +156,7 @@ sal_Int32 OfficeClientMain::run( const Sequence< OUString > & aArguments ) throw
try {
registerServices();
Reference < XInterface > r =
m_xSMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.UnoUrlResolver")) );
m_xSMgr->createInstance( OUString("com.sun.star.bridge.UnoUrlResolver") );
Reference < XUnoUrlResolver > rResolver( r , UNO_QUERY );
r = rResolver->resolve( aArguments.getConstArray()[0] );
@@ -165,12 +165,12 @@ sal_Int32 OfficeClientMain::run( const Sequence< OUString > & aArguments ) throw
{
printf( "got the remote NamingService\n" );
r = rNamingService->getRegisteredObject(OUString(RTL_CONSTASCII_USTRINGPARAM("StarOffice.ServiceManager")));
r = rNamingService->getRegisteredObject(OUString("StarOffice.ServiceManager"));
Reference< XMultiServiceFactory > rRemoteSMgr( r , UNO_QUERY );
Reference < XComponentLoader > rLoader(
rRemoteSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop" ))),
rRemoteSMgr->createInstance( OUString( "com.sun.star.frame.Desktop" )),
UNO_QUERY );
if( rLoader.is() )
@@ -198,7 +198,7 @@ sal_Int32 OfficeClientMain::run( const Sequence< OUString > & aArguments ) throw
Reference< XComponent > rComponent =
rLoader->loadComponentFromURL(
OUString::createFromAscii( urls[i] ) ,
OUString( RTL_CONSTASCII_USTRINGPARAM("_blank")),
OUString( "_blank"),
0 ,
Sequence < ::com::sun::star::beans::PropertyValue >() );
@@ -262,7 +262,7 @@ Sequence< OUString > getSupportedServiceNames()
if( !pNames )
{
static Sequence< OUString > seqNames(2);
seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.example.OfficeClientExample"));
seqNames.getArray()[0] = OUString("com.sun.star.bridge.example.OfficeClientExample");
pNames = &seqNames;
}
}
@@ -287,7 +287,7 @@ sal_Bool SAL_CALL component_writeInfo(
{
Reference< XRegistryKey > xNewKey(
reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey(
OUString(RTL_CONSTASCII_USTRINGPARAM( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" )) ) );
OUString( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) );
const Sequence< OUString > & rSNL = getSupportedServiceNames();
const OUString * pArray = rSNL.getConstArray();

View File

@@ -172,7 +172,7 @@ DirectoryTraveller::DirectoryTraveller (
m_nCount (0)
{
m_aPath += rName;
m_aPath += OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
m_aPath += OUString("/");
}
/*
@@ -344,7 +344,7 @@ int SAL_CALL main (int argc, char **argv)
}
// Stream Read/Write.
OUString aPath (RTL_CONSTASCII_USTRINGPARAM("/"));
OUString aPath ("/");
if ((nOptions & OPTION_READ) || (nOptions & OPTION_WRITE))
{
// Mode.
@@ -366,9 +366,9 @@ int SAL_CALL main (int argc, char **argv)
for (int i = 0; i < _DEMOSTOR_LOOPS; i++)
{
OUString aName (RTL_CONSTASCII_USTRINGPARAM("demostor-"));
OUString aName ("demostor-");
aName += OUString::valueOf ((sal_Int32)(i + 1), 10);
aName += OUString(RTL_CONSTASCII_USTRINGPARAM (".dat"));
aName += OUString(".dat");
#if (_DEMOSTOR_REMOVE == 1)
eErrCode = aFile.remove (aPath, aName);
@@ -456,7 +456,7 @@ int SAL_CALL main (int argc, char **argv)
{
// Create symlink to (root) directory.
eErrCode = aFile.symlink (
aPath, OUString(RTL_CONSTASCII_USTRINGPARAM("000000/")),
aPath, OUString("000000/"),
OUString(), aPath);
OSL_POSTCOND(
((eErrCode == store_E_None ) ||
@@ -464,11 +464,11 @@ int SAL_CALL main (int argc, char **argv)
"t_store::main(): store_symlink() failed");
// Create symlink to file.
OUString aLinkName (RTL_CONSTASCII_USTRINGPARAM("demostor-1.lnk"));
OUString aLinkName ("demostor-1.lnk");
eErrCode = aFile.symlink (
aPath, aLinkName,
aPath, OUString(RTL_CONSTASCII_USTRINGPARAM("demostor-1.dat")));
aPath, OUString("demostor-1.dat"));
OSL_POSTCOND(
((eErrCode == store_E_None ) ||
(eErrCode == store_E_AlreadyExists) ),
@@ -477,7 +477,7 @@ int SAL_CALL main (int argc, char **argv)
(eErrCode == store_E_AlreadyExists) )
{
OUString aShortcut (
RTL_CONSTASCII_USTRINGPARAM("Shortcut to demostor-1.dat"));
"Shortcut to demostor-1.dat");
eErrCode = aFile.rename (
aPath, aLinkName,
aPath, aShortcut);
@@ -488,7 +488,7 @@ int SAL_CALL main (int argc, char **argv)
}
// Create directory.
OUString aDirName (RTL_CONSTASCII_USTRINGPARAM("demostor-1.dir"));
OUString aDirName ("demostor-1.dir");
store::OStoreDirectory aDir;
eErrCode = aDir.create (
@@ -515,7 +515,7 @@ int SAL_CALL main (int argc, char **argv)
{
// Open symlink entry.
eErrCode = aRootDir.create (
aFile, aPath, OUString(RTL_CONSTASCII_USTRINGPARAM("000000")),
aFile, aPath, OUString("000000"),
store_AccessReadOnly);
}
else