diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-06-02 16:12:08 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-06-02 16:48:34 -0500 |
commit | acb7bd175abe6c7f793cc673feaab46c90b9a260 (patch) | |
tree | 206be73ecd4a2af07310e8efe348f9647382d331 /sal | |
parent | targeted string re-work (diff) | |
download | core-acb7bd175abe6c7f793cc673feaab46c90b9a260.tar.gz core-acb7bd175abe6c7f793cc673feaab46c90b9a260.zip |
targeted string re-work
Change-Id: I145731d9f28faf0065f5960f2c5a32f27d8c8620
Diffstat (limited to 'sal')
24 files changed, 409 insertions, 409 deletions
diff --git a/sal/osl/w32/path_helper.cxx b/sal/osl/w32/path_helper.cxx index 0cc0d714411a..ddbb1a43512e 100644 --- a/sal/osl/w32/path_helper.cxx +++ b/sal/osl/w32/path_helper.cxx @@ -42,8 +42,8 @@ Constants ******************************************************************/ -const rtl::OUString BACKSLASH (RTL_CONSTASCII_USTRINGPARAM("\\")); -const rtl::OUString SLASH (RTL_CONSTASCII_USTRINGPARAM("/")); +const rtl::OUString BACKSLASH ("\\"); +const rtl::OUString SLASH ("/"); /******************************************************************* osl_systemPathEnsureSeparator diff --git a/sal/qa/osl/module/osl_Module.cxx b/sal/qa/osl/module/osl_Module.cxx index c460acbbdc14..022e2e01b8c6 100644 --- a/sal/qa/osl/module/osl_Module.cxx +++ b/sal/qa/osl/module/osl_Module.cxx @@ -66,9 +66,9 @@ inline void printUString( const ::rtl::OUString & str ) inline ::rtl::OUString getDllURL( void ) { #if ( defined WNT ) // lib in Unix and lib in Windows are not same in file name. - ::rtl::OUString libPath( RTL_CONSTASCII_USTRINGPARAM("test_Module_DLL.dll") ); + ::rtl::OUString libPath( "test_Module_DLL.dll" ); #else - ::rtl::OUString libPath( RTL_CONSTASCII_USTRINGPARAM("libtest_Module_DLL.so") ); + ::rtl::OUString libPath( "libtest_Module_DLL.so" ); #endif ::rtl::OUString dirPath, dllPath; @@ -81,7 +81,7 @@ inline ::rtl::OUString getDllURL( void ) inline sal_Bool isURL( const ::rtl::OUString pathname ) { - ::rtl::OUString aPreURL( RTL_CONSTASCII_USTRINGPARAM("file:///") ); + ::rtl::OUString aPreURL( "file:///" ); return ( ( pathname.indexOf( aPreURL ) == 0 ) ? sal_True : sal_False ); } @@ -243,7 +243,7 @@ namespace osl_Module #if !defined( MACOSX ) // TODO: Find out why this fails on Mac OS X ::osl::Module aMod( getDllURL( ) ); - FuncPtr pFunc = ( FuncPtr ) aMod.getSymbol( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("firstfunc")) ); + FuncPtr pFunc = ( FuncPtr ) aMod.getSymbol( rtl::OUString("firstfunc") ); OUString aFileURL; bRes = osl::Module::getUrlFromAddress( ( void* )pFunc, aFileURL ); @@ -366,7 +366,7 @@ namespace osl_Module #if !defined( MACOSX ) // TODO: Find out why this fails on Mac OS X ::osl::Module aMod( getDllURL( ) ); - FuncPtr pFunc = ( FuncPtr ) aMod.getSymbol( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("firstfunc")) ); + FuncPtr pFunc = ( FuncPtr ) aMod.getSymbol( rtl::OUString("firstfunc") ); bRes = sal_False; if ( pFunc ) bRes = pFunc( bRes ); @@ -413,7 +413,7 @@ namespace osl_Module #if !defined( MACOSX ) // TODO: Find out why this fails on Mac OS X ::osl::Module aMod( getDllURL( ) ); - ::rtl::OUString funcName( RTL_CONSTASCII_USTRINGPARAM("firstfunc") ); + ::rtl::OUString funcName( "firstfunc" ); FuncPtr pFunc = ( FuncPtr ) osl_getSymbol( (oslModule)aMod, funcName.pData ); bRes = sal_False; @@ -446,7 +446,7 @@ namespace osl_Module #if !defined( MACOSX ) // TODO: Find out why this fails on Mac OS X ::osl::Module aMod( getDllURL( ) ); - oslGenericFunction oslFunc = aMod.getFunctionSymbol( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("firstfunc")) ); + oslGenericFunction oslFunc = aMod.getFunctionSymbol( rtl::OUString("firstfunc") ); ::rtl::OUString aLibraryURL; bRes = ::osl::Module::getUrlFromAddress( oslFunc, aLibraryURL); aMod.unload(); diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx index a393e4b9d881..85982858c330 100644 --- a/sal/qa/osl/pipe/osl_Pipe.cxx +++ b/sal/qa/osl/pipe/osl_Pipe.cxx @@ -133,9 +133,9 @@ inline void printPipeError( ::osl::Pipe aPipe ) //------------------------------------------------------------------------ // pipe name and transfer contents //------------------------------------------------------------------------ -const rtl::OUString aTestPipeName(RTL_CONSTASCII_USTRINGPARAM("testpipe2")); -const rtl::OUString aTestPipe1(RTL_CONSTASCII_USTRINGPARAM("testpipe1")); -const rtl::OUString aTestString(RTL_CONSTASCII_USTRINGPARAM("Sun Microsystems")); +const rtl::OUString aTestPipeName("testpipe2"); +const rtl::OUString aTestPipe1("testpipe1"); +const rtl::OUString aTestString("Sun Microsystems"); const OString m_pTestString1("Sun Microsystems"); const OString m_pTestString2("test pipe PASS/OK"); diff --git a/sal/qa/osl/socket/osl_AcceptorSocket.cxx b/sal/qa/osl/socket/osl_AcceptorSocket.cxx index fbfa5c0793e1..2666b14b512d 100644 --- a/sal/qa/osl/socket/osl_AcceptorSocket.cxx +++ b/sal/qa/osl/socket/osl_AcceptorSocket.cxx @@ -195,8 +195,8 @@ namespace osl_AcceptorSocket void listen_accept_001() { - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT3 ); - ::osl::SocketAddr saTargetSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT3 ); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT3 ); + ::osl::SocketAddr saTargetSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT3 ); ::osl::StreamSocket ssConnection; /// launch server socket @@ -217,9 +217,9 @@ namespace osl_AcceptorSocket void listen_accept_002() { - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT4 ); - ::osl::SocketAddr saTargetSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT4 ); - ::osl::SocketAddr saPeerSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_FTP ); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT4 ); + ::osl::SocketAddr saTargetSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT4 ); + ::osl::SocketAddr saPeerSocketAddr( rtl::OUString("129.158.217.202"), IP_PORT_FTP ); ::osl::StreamSocket ssConnection; /// launch server socket diff --git a/sal/qa/osl/socket/osl_ConnectorSocket.cxx b/sal/qa/osl/socket/osl_ConnectorSocket.cxx index ce7fd59f6ae8..255013acc034 100644 --- a/sal/qa/osl/socket/osl_ConnectorSocket.cxx +++ b/sal/qa/osl/socket/osl_ConnectorSocket.cxx @@ -160,9 +160,9 @@ namespace osl_ConnectorSocket void connect_001() { - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT2 ); - ::osl::SocketAddr saTargetSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT2 ); - ::osl::SocketAddr saPeerSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_FTP ); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT2 ); + ::osl::SocketAddr saTargetSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT2 ); + ::osl::SocketAddr saPeerSocketAddr( rtl::OUString("129.158.217.202"), IP_PORT_FTP ); ::osl::StreamSocket ssConnection; /// launch server socket @@ -189,9 +189,9 @@ namespace osl_ConnectorSocket //non-blocking mode connect? void connect_002() { - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT3 ); - ::osl::SocketAddr saTargetSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT3 ); - ::osl::SocketAddr saPeerSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_FTP ); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT3 ); + ::osl::SocketAddr saTargetSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT3 ); + ::osl::SocketAddr saPeerSocketAddr( rtl::OUString("129.158.217.202"), IP_PORT_FTP ); asAcceptorSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True); asAcceptorSocket.enableNonBlockingMode( sal_True ); @@ -215,8 +215,8 @@ namespace osl_ConnectorSocket // how to design senarios that will return osl_Socket_Interrupted, osl_Socket_TimedOut void connect_003() { - ::osl::SocketAddr saTargetSocketAddr1( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT3 ); - ::osl::SocketAddr saTargetSocketAddr2( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("123.345.67.89")), IP_PORT_MYPORT3 ); + ::osl::SocketAddr saTargetSocketAddr1( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT3 ); + ::osl::SocketAddr saTargetSocketAddr2( rtl::OUString("123.345.67.89"), IP_PORT_MYPORT3 ); csConnectorSocket.enableNonBlockingMode( sal_False ); @@ -233,7 +233,7 @@ namespace osl_ConnectorSocket // really an error in non-blocking mode void connect_004() { - ::osl::SocketAddr saTargetSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("123.345.67.89")), IP_PORT_MYPORT3 ); + ::osl::SocketAddr saTargetSocketAddr( rtl::OUString("123.345.67.89"), IP_PORT_MYPORT3 ); csConnectorSocket.enableNonBlockingMode( sal_True ); diff --git a/sal/qa/osl/socket/osl_DatagramSocket.cxx b/sal/qa/osl/socket/osl_DatagramSocket.cxx index 586c197eea88..b5979ebbd57e 100644 --- a/sal/qa/osl/socket/osl_DatagramSocket.cxx +++ b/sal/qa/osl/socket/osl_DatagramSocket.cxx @@ -152,7 +152,7 @@ protected: public: TalkerThread( ): - saTargetSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT9 ) + saTargetSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT9 ) { } @@ -173,7 +173,7 @@ protected: void SAL_CALL run( ) { - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT10 ); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT10 ); dsSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); if ( dsSocket.bind( saLocalSocketAddr ) == sal_False ) { @@ -195,7 +195,7 @@ protected: public: sal_Char pRecvBuffer[30]; ListenerThread( ): - saTargetSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT10 ) + saTargetSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT10 ) { pRecvBuffer[0] = '\0'; } @@ -221,7 +221,7 @@ public: void sr_001() { - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT9 ); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT9 ); ::osl::DatagramSocket dsSocket; dsSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); dsSocket.bind( saLocalSocketAddr ); @@ -241,7 +241,7 @@ public: void sr_002() { - ::osl::SocketAddr saListenSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT10 ); + ::osl::SocketAddr saListenSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT10 ); ::osl::DatagramSocket dsSocket; //listener thread construct a DatagramSocket, recvFrom waiting for data, then main thread sendto data @@ -266,7 +266,7 @@ public: //sendTo error, return -1; recvFrom error, return -1 void sr_003() { - ::osl::SocketAddr saListenSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("123.345.67.89")), IP_PORT_MYPORT10 ); + ::osl::SocketAddr saListenSocketAddr( rtl::OUString("123.345.67.89"), IP_PORT_MYPORT10 ); ::osl::DatagramSocket dsSocket; // Transport endpoint is not connected sal_Int32 nSend = dsSocket.sendTo( saListenSocketAddr, pTestString2, strlen( pTestString2 ) + 1 ); @@ -276,8 +276,8 @@ public: void sr_004() { - ::osl::SocketAddr saListenSocketAddr1( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("123.345.67.89")), IP_PORT_MYPORT10 ); - ::osl::SocketAddr saListenSocketAddr2( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_MYPORT10 ); + ::osl::SocketAddr saListenSocketAddr1( rtl::OUString("123.345.67.89"), IP_PORT_MYPORT10 ); + ::osl::SocketAddr saListenSocketAddr2( rtl::OUString("129.158.217.202"), IP_PORT_MYPORT10 ); ::osl::DatagramSocket dsSocket; dsSocket.enableNonBlockingMode( sal_True ); diff --git a/sal/qa/osl/socket/osl_Socket.cxx b/sal/qa/osl/socket/osl_Socket.cxx index 92c4a37691c0..77a8515e9c4c 100644 --- a/sal/qa/osl/socket/osl_Socket.cxx +++ b/sal/qa/osl/socket/osl_Socket.cxx @@ -223,11 +223,11 @@ inline ::rtl::OUString outputError( const ::rtl::OUString & returnVal, const ::r if ( returnVal.equals( rightVal ) ) return aUString; aUString += ::rtl::OUString::createFromAscii(msg); - aUString += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(": the returned value is '")); + aUString += ::rtl::OUString(": the returned value is '"); aUString += returnVal; - aUString += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("', but the value should be '")); + aUString += ::rtl::OUString("', but the value should be '"); aUString += rightVal; - aUString += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'.")); + aUString += ::rtl::OUString("'."); return aUString; } @@ -781,11 +781,11 @@ namespace osl_SocketAddr sal_Bool bOk = compareUString(suHost, suHost2); - rtl::OUString suError (RTL_CONSTASCII_USTRINGPARAM("Host names should be the same. From SocketAddr.getLocalHostname() it is'")); + rtl::OUString suError ("Host names should be the same. From SocketAddr.getLocalHostname() it is'"); suError += suHost; - suError += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("', from getThisHostname() it is '")); + suError += rtl::OUString("', from getThisHostname() it is '"); suError += suHost2; - suError += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'.")); + suError += rtl::OUString("'."); CPPUNIT_ASSERT_MESSAGE(STD_STRING(suError), sal_True == bOk); } @@ -973,7 +973,7 @@ namespace osl_SocketAddr // LLA: this function does not work in company (Linux, Windows) but at home void getHostname_002() { - rtl::OUString suHostname (RTL_CONSTASCII_USTRINGPARAM("cn-1.germany.sun.com")); + rtl::OUString suHostname ("cn-1.germany.sun.com"); rtl::OUString aHostIP = getIPbyName( oustring2char( suHostname ) ); ::osl::SocketAddr saSocketAddr( aHostName1, IP_PORT_FTP ); @@ -1439,7 +1439,7 @@ namespace osl_SocketAddr /** testing the method: static inline sal_Int32 SAL_CALL getServicePort( const ::rtl::OUString& strServiceName, - const ::rtl::OUString & strProtocolName= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tcp")) ); + const ::rtl::OUString & strProtocolName= ::rtl::OUString("tcp") ); */ class gettheServicePort : public CppUnit::TestFixture @@ -1467,7 +1467,7 @@ namespace osl_SocketAddr void gettheServicePort_004() { CPPUNIT_ASSERT_MESSAGE( "test for getServicePort() function: try to get a service port which is not exist.", - OSL_INVALID_PORT == ::osl::SocketAddr::getServicePort( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("notexist")), aProtocolUDP ) ); + OSL_INVALID_PORT == ::osl::SocketAddr::getServicePort( ::rtl::OUString("notexist"), aProtocolUDP ) ); } CPPUNIT_TEST_SUITE( gettheServicePort ); @@ -1809,7 +1809,7 @@ namespace osl_Socket sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True); sal_Bool bOK1 = sSocket.bind( saBindSocketAddr ); - ::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString(); + ::rtl::OUString suError1 = ::rtl::OUString("Socket bind fail:") + sSocket.getErrorAsString(); CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 ); sSocket.getLocalAddr( saLocalSocketAddr ); @@ -1857,7 +1857,7 @@ namespace osl_Socket sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True); sal_Bool bOK1 = sSocket.bind( saBindSocketAddr ); - ::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString(); + ::rtl::OUString suError1 = ::rtl::OUString("Socket bind fail:") + sSocket.getErrorAsString(); CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 ); sal_Bool bOK = ( IP_PORT_MYPORT7 == sSocket.getLocalPort( ) ); @@ -1888,7 +1888,7 @@ namespace osl_Socket (void)bOK; #else //on Unix, if Addr is not an address of type osl_Socket_FamilyInet, it returns OSL_INVALID_PORT - ::rtl::OUString suError (RTL_CONSTASCII_USTRINGPARAM("on Unix, if Addr is not an address of type osl_Socket_FamilyInet, it returns OSL_INVALID_PORT, but can not create Addr of that case")); + ::rtl::OUString suError ("on Unix, if Addr is not an address of type osl_Socket_FamilyInet, it returns OSL_INVALID_PORT, but can not create Addr of that case"); #endif CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_False ); @@ -1902,10 +1902,10 @@ namespace osl_Socket sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True); sal_Bool bOK1 = sSocket.bind( saBindSocketAddr ); - ::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString(); + ::rtl::OUString suError1 = ::rtl::OUString("Socket bind fail:") + sSocket.getErrorAsString(); CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 ); ::rtl::OUString suError = outputError(::rtl::OUString::valueOf(sSocket.getLocalPort( )), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("34463")), + ::rtl::OUString("34463"), "test for getLocalPort function: first create a new socket, then an invalid socket address, bind them, and check the port assigned"); sal_Bool bOK = ( sSocket.getLocalPort( ) >= 1 && sSocket.getLocalPort( ) <= 65535); @@ -1954,7 +1954,7 @@ namespace osl_Socket sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True); sal_Bool bOK1 = sSocket.bind( saBindSocketAddr ); - ::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString(); + ::rtl::OUString suError1 = ::rtl::OUString("Socket bind fail:") + sSocket.getErrorAsString(); CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 ); sal_Bool bOK; ::rtl::OUString suError; diff --git a/sal/qa/osl/socket/osl_Socket2.cxx b/sal/qa/osl/socket/osl_Socket2.cxx index 040c64493d15..ac3fcf5dc98b 100644 --- a/sal/qa/osl/socket/osl_Socket2.cxx +++ b/sal/qa/osl/socket/osl_Socket2.cxx @@ -379,7 +379,7 @@ namespace osl_Socket { //#if defined(LINUX) ::osl::AcceptorSocket asSocket( osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream ); - AcceptorThread myAcceptorThread( asSocket, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")) ); + AcceptorThread myAcceptorThread( asSocket, rtl::OUString("127.0.0.1") ); myAcceptorThread.create(); thread_sleep( 1 ); @@ -398,7 +398,7 @@ namespace osl_Socket void close_003() { ::osl::AcceptorSocket asSocket( osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream ); - AcceptorThread myAcceptorThread( asSocket, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("0.0.0.0")) ); + AcceptorThread myAcceptorThread( asSocket, rtl::OUString("0.0.0.0") ); myAcceptorThread.create(); thread_sleep( 1 ); @@ -440,13 +440,13 @@ namespace osl_Socket void getLocalAddr_001() { ::osl::Socket sSocket(sHandle); - ::osl::SocketAddr saBindSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT8 ); + ::osl::SocketAddr saBindSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT8 ); ::osl::SocketAddr saLocalSocketAddr; sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True); sal_Bool bOK1 = sSocket.bind( saBindSocketAddr ); - ::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString(); + ::rtl::OUString suError1 = ::rtl::OUString("Socket bind fail:") + sSocket.getErrorAsString(); CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 ); sSocket.getLocalAddr( saLocalSocketAddr ); @@ -488,13 +488,13 @@ namespace osl_Socket void getLocalPort_001() { ::osl::Socket sSocket(sHandle); - ::osl::SocketAddr saBindSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT7 ); // aHostIp1 localhost + ::osl::SocketAddr saBindSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT7 ); // aHostIp1 localhost ::osl::SocketAddr saLocalSocketAddr; sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True); sal_Bool bOK1 = sSocket.bind( saBindSocketAddr ); - ::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString(); + ::rtl::OUString suError1 = ::rtl::OUString("Socket bind fail:") + sSocket.getErrorAsString(); CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 ); sal_Bool bOK = ( IP_PORT_MYPORT7 == sSocket.getLocalPort( ) ); @@ -512,7 +512,7 @@ namespace osl_Socket */ void getLocalPort_002() { - ::osl::SocketAddr saBindSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("123.45.67.89")), IP_PORT_TELNET); + ::osl::SocketAddr saBindSocketAddr( rtl::OUString("123.45.67.89"), IP_PORT_TELNET); #ifdef WNT ::osl::Socket sSocket(sHandle); sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); // sal_True); @@ -525,7 +525,7 @@ namespace osl_Socket (void)bOK; #else //on Unix, if Addr is not an address of type osl_Socket_FamilyInet, it returns OSL_INVALID_PORT - ::rtl::OUString suError (RTL_CONSTASCII_USTRINGPARAM("on Unix, if Addr is not an address of type osl_Socket_FamilyInet, it returns OSL_INVALID_PORT, but can not create Addr of that case")); + ::rtl::OUString suError ("on Unix, if Addr is not an address of type osl_Socket_FamilyInet, it returns OSL_INVALID_PORT, but can not create Addr of that case"); #endif CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_False ); @@ -539,10 +539,10 @@ namespace osl_Socket sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True); sal_Bool bOK1 = sSocket.bind( saBindSocketAddr ); - ::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString(); + ::rtl::OUString suError1 = ::rtl::OUString("Socket bind fail:") + sSocket.getErrorAsString(); CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 ); ::rtl::OUString suError = outputError(::rtl::OUString::valueOf(sSocket.getLocalPort( )), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("34463")), + ::rtl::OUString("34463"), "test for getLocalPort function: first create a new socket, then an invalid socket address, bind them, and check the port assigned"); sal_Bool bOK = ( sSocket.getLocalPort( ) >= 1 && sSocket.getLocalPort( ) <= 65535); @@ -586,12 +586,12 @@ namespace osl_Socket { ::osl::Socket sSocket(sHandle); //port number from IP_PORT_HTTP1 to IP_PORT_MYPORT6, mindyliu - ::osl::SocketAddr saBindSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT6 ); + ::osl::SocketAddr saBindSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT6 ); sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True); sal_Bool bOK1 = sSocket.bind( saBindSocketAddr ); - ::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString(); + ::rtl::OUString suError1 = ::rtl::OUString("Socket bind fail:") + sSocket.getErrorAsString(); CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 ); sal_Bool bOK; ::rtl::OUString suError; @@ -613,13 +613,13 @@ namespace osl_Socket void getLocalHost_002() { ::osl::Socket sSocket(sHandle); - ::osl::SocketAddr saBindSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("123.45.67.89")), IP_PORT_POP3); + ::osl::SocketAddr saBindSocketAddr( rtl::OUString("123.45.67.89"), IP_PORT_POP3); ::osl::SocketAddr saLocalSocketAddr; sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True); sSocket.bind( saBindSocketAddr ); //Invalid IP, so bind should fail - sal_Bool bOK = compareUString( sSocket.getLocalHost( ), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")) ) ; + sal_Bool bOK = compareUString( sSocket.getLocalHost( ), rtl::OUString("") ) ; ::rtl::OUString suError = outputError(sSocket.getLocalHost( ), rtl::OUString(), "test for getLocalHost function: getLocalHost with invalid SocketAddr"); CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_True == bOK ); @@ -667,9 +667,9 @@ namespace osl_Socket void getPeer_001() { - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT ); - ::osl::SocketAddr saTargetSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT ); - ::osl::SocketAddr saPeerSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_FTP ); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT ); + ::osl::SocketAddr saTargetSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT ); + ::osl::SocketAddr saPeerSocketAddr( rtl::OUString("129.158.217.202"), IP_PORT_FTP ); ::osl::StreamSocket ssConnection; asAcceptorSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True); /// launch server socket @@ -743,7 +743,7 @@ namespace osl_Socket void bind_002() { ::osl::Socket sSocket(sHandle); - ::osl::SocketAddr saBindSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("123.45.67.89")), IP_PORT_NETBIOS ); + ::osl::SocketAddr saBindSocketAddr( rtl::OUString("123.45.67.89"), IP_PORT_NETBIOS ); ::osl::SocketAddr saLocalSocketAddr; sSocket.setOption( osl_Socket_OptionReuseAddr, 1); // sal_True); @@ -795,9 +795,9 @@ namespace osl_Socket void isRecvReady_001() { - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT1 ); - ::osl::SocketAddr saTargetSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT1 ); - ::osl::SocketAddr saPeerSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_FTP ); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT1 ); + ::osl::SocketAddr saTargetSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT1 ); + ::osl::SocketAddr saPeerSocketAddr( rtl::OUString("129.158.217.202"), IP_PORT_FTP ); ::osl::StreamSocket ssConnection; /// launch server socket asAcceptorSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); // sal_True); @@ -858,9 +858,9 @@ namespace osl_Socket void isSendReady_001() { - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT ); - ::osl::SocketAddr saTargetSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT ); - ::osl::SocketAddr saPeerSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_FTP ); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT ); + ::osl::SocketAddr saTargetSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT ); + ::osl::SocketAddr saPeerSocketAddr( rtl::OUString("129.158.217.202"), IP_PORT_FTP ); ::osl::StreamSocket ssConnection; /// launch server socket @@ -1211,7 +1211,7 @@ namespace osl_Socket void enableNonBlockingMode_001() { - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT ); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT ); ::osl::StreamSocket ssConnection; /// launch server socket @@ -1249,7 +1249,7 @@ namespace osl_Socket void isNonBlockingMode_001() { - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT ); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT ); ::osl::StreamSocket ssConnection; /// launch server socket @@ -1300,7 +1300,7 @@ namespace osl_Socket void clearError_001() { ::osl::Socket sSocket(sHandle); - ::osl::SocketAddr saBindSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("123.45.67.89")), IP_PORT_HTTP2 ); + ::osl::SocketAddr saBindSocketAddr( rtl::OUString("123.45.67.89"), IP_PORT_HTTP2 ); ::osl::SocketAddr saLocalSocketAddr; sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True); sSocket.bind( saBindSocketAddr );//build an error "osl_Socket_E_AddrNotAvail" @@ -1342,7 +1342,7 @@ namespace osl_Socket void getError_001() { ::osl::Socket sSocket(sHandle); - ::osl::SocketAddr saBindSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_FTP ); + ::osl::SocketAddr saBindSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_FTP ); ::osl::SocketAddr saLocalSocketAddr; CPPUNIT_ASSERT_MESSAGE( "test for getError function: should get no error.", @@ -1352,7 +1352,7 @@ namespace osl_Socket void getError_002() { ::osl::Socket sSocket(sHandle); - ::osl::SocketAddr saBindSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("123.45.67.89")), IP_PORT_FTP ); + ::osl::SocketAddr saBindSocketAddr( rtl::OUString("123.45.67.89"), IP_PORT_FTP ); ::osl::SocketAddr saLocalSocketAddr; sSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); //sal_True); sSocket.bind( saBindSocketAddr );//build an error "osl_Socket_E_AddrNotAvail" diff --git a/sal/qa/osl/socket/osl_SocketAddr.cxx b/sal/qa/osl/socket/osl_SocketAddr.cxx index 7b8c2c9f1eb0..daeae38b0dbf 100644 --- a/sal/qa/osl/socket/osl_SocketAddr.cxx +++ b/sal/qa/osl/socket/osl_SocketAddr.cxx @@ -122,11 +122,11 @@ namespace osl_SocketAddr sal_Bool bOk = compareUString(suHost, suHost2); - rtl::OUString suError (RTL_CONSTASCII_USTRINGPARAM("Host names should be the same. From SocketAddr.getLocalHostname() it is'")); + rtl::OUString suError ("Host names should be the same. From SocketAddr.getLocalHostname() it is'"); suError += suHost; - suError += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("', from getThisHostname() it is '")); + suError += rtl::OUString("', from getThisHostname() it is '"); suError += suHost2; - suError += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'.")); + suError += rtl::OUString("'."); CPPUNIT_ASSERT_MESSAGE(STD_STRING(suError), sal_True == bOk); } @@ -134,7 +134,7 @@ namespace osl_SocketAddr void ctors_copy() { /// SocketAddr copy constructor. - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("localhost")), IP_PORT_HTTP1 ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("localhost"), IP_PORT_HTTP1 ); ::osl::SocketAddr saCopySocketAddr( saSocketAddr ); sal_Int32 nPort = saCopySocketAddr.getPort( ); @@ -145,7 +145,7 @@ namespace osl_SocketAddr void ctors_copy_no_001() { - ::osl::SocketAddr* pSocketAddr = new ::osl::SocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("localhost")), IP_PORT_HTTP1 ); + ::osl::SocketAddr* pSocketAddr = new ::osl::SocketAddr( rtl::OUString("localhost"), IP_PORT_HTTP1 ); CPPUNIT_ASSERT_MESSAGE("check for new SocketAddr", pSocketAddr != NULL); oslSocketAddr psaOSLSocketAddr = pSocketAddr->getHandle( ); @@ -162,7 +162,7 @@ namespace osl_SocketAddr void ctors_copy_no_002() { - ::osl::SocketAddr* pSocketAddr = new ::osl::SocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("localhost")), IP_PORT_HTTP1 ); + ::osl::SocketAddr* pSocketAddr = new ::osl::SocketAddr( rtl::OUString("localhost"), IP_PORT_HTTP1 ); CPPUNIT_ASSERT_MESSAGE("check for new SocketAddr", pSocketAddr != NULL); oslSocketAddr psaOSLSocketAddr = pSocketAddr->getHandle( ); ::osl::SocketAddr* pSocketAddrCopy = new ::osl::SocketAddr( psaOSLSocketAddr, SAL_NO_COPY ); @@ -175,7 +175,7 @@ namespace osl_SocketAddr void ctors_copy_handle_001() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("localhost")), IP_PORT_HTTP1 ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("localhost"), IP_PORT_HTTP1 ); ::osl::SocketAddr saSocketAddrCopy( saSocketAddr.getHandle( ) ); CPPUNIT_ASSERT_MESSAGE("test for SocketAddr copy handle constructor function: copy another Socket's handle, get its port to check copy effect.", @@ -184,7 +184,7 @@ namespace osl_SocketAddr void ctors_copy_handle_002() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("localhost")), IP_PORT_HTTP1 ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("localhost"), IP_PORT_HTTP1 ); ::osl::SocketAddr saSocketAddrCopy( saSocketAddr.getHandle( ) ); saSocketAddrCopy.setPort( IP_PORT_HTTP2 ); @@ -195,7 +195,7 @@ namespace osl_SocketAddr void ctors_hostname_port_001() { /// tcpip-specif constructor. - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_FTP ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_FTP ); printUString( saSocketAddr.getHostname( ), "ctors_hostname_port_001:getHostname"); CPPUNIT_ASSERT_MESSAGE("test for SocketAddr tcpip specif constructor function: do a constructor using tcpip spec, check the result.", @@ -208,7 +208,7 @@ namespace osl_SocketAddr void ctors_hostname_port_002() { /// tcpip-specif constructor. - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("123.345.67.89")), IP_PORT_MYPORT2 ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("123.345.67.89"), IP_PORT_MYPORT2 ); CPPUNIT_ASSERT_MESSAGE("test for SocketAddr tcpip specif constructor function: using an invalid IP address, the socketaddr ctors should fail", sal_False == saSocketAddr.is( )); } @@ -244,7 +244,7 @@ namespace osl_SocketAddr // refer to setPort_003() void is_002() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_INVAL ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_INVAL ); CPPUNIT_ASSERT_MESSAGE("test for is() function: create a tcp-ip socket using invalid port number", sal_True == saSocketAddr.is( ) ); @@ -252,7 +252,7 @@ namespace osl_SocketAddr void is_003() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("123.345.67.89")), IP_PORT_MYPORT ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("123.345.67.89"), IP_PORT_MYPORT ); CPPUNIT_ASSERT_MESSAGE("test for is() function: create a tcp-ip socket using invalid Ip number", sal_True != saSocketAddr.is( ) ); @@ -284,7 +284,7 @@ namespace osl_SocketAddr void getHostname_000() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.107")), IP_PORT_FTP ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("129.158.217.107"), IP_PORT_FTP ); rtl::OUString suResult = saSocketAddr.getHostname( 0 ); } @@ -296,16 +296,16 @@ namespace osl_SocketAddr */ void getHostname_001() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.107")), IP_PORT_FTP ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("129.158.217.107"), IP_PORT_FTP ); rtl::OUString suResult = saSocketAddr.getHostname( 0 ); - rtl::OUString suError = outputError(suResult, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sceri.PRC.Sun.COM")), "test for getHostname(0)"); - sal_Bool bOK = compareUString( suResult, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sceri.PRC.Sun.COM")) ); + rtl::OUString suError = outputError(suResult, rtl::OUString("sceri.PRC.Sun.COM"), "test for getHostname(0)"); + sal_Bool bOK = compareUString( suResult, rtl::OUString("sceri.PRC.Sun.COM") ); // search the returned hostname in /etc/hosts, if find, and the IP in the row is same as IP // in the Addr, it's right also. if ( bOK == sal_False) { rtl::OString aString = ::rtl::OUStringToOString( suResult, RTL_TEXTENCODING_ASCII_US ); - if ( compareUString( getIPbyName( aString ), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.107")) ) == sal_True ) + if ( compareUString( getIPbyName( aString ), rtl::OUString("129.158.217.107") ) == sal_True ) bOK = sal_True; } CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_True == bOK); @@ -315,11 +315,11 @@ namespace osl_SocketAddr // LLA: this function does not work in company (Linux, Windows) but at home void getHostname_002() { - rtl::OUString suHostname (RTL_CONSTASCII_USTRINGPARAM("cn-1.germany.sun.com")); + rtl::OUString suHostname ("cn-1.germany.sun.com"); rtl::OString aString = ::rtl::OUStringToOString( suHostname, RTL_TEXTENCODING_ASCII_US ); rtl::OUString aHostIP = getIPbyName( aString ); - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("localhost")), IP_PORT_FTP ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("localhost"), IP_PORT_FTP ); sal_Bool bOK = saSocketAddr.setHostname( suHostname ); CPPUNIT_ASSERT_MESSAGE("#SocketAddr.setHostname failed", sal_True == bOK ); oslSocketResult aResult; @@ -359,7 +359,7 @@ namespace osl_SocketAddr public: void getPort_001() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_FTP ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_FTP ); CPPUNIT_ASSERT_MESSAGE( "test for getPort() function: get a normal port number.", IP_PORT_FTP == saSocketAddr.getPort( ) ); @@ -367,7 +367,7 @@ namespace osl_SocketAddr void getPort_002() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_INVAL ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("129.158.217.202"), IP_PORT_INVAL ); //t_print("#getPort_002: Port number is %d \n", saSocketAddr.getPort( )); @@ -378,7 +378,7 @@ namespace osl_SocketAddr //2. SocketAddr family is not osl_Socket_FamilyInet, but case 2 could not be constructed void getPort_003() { - rtl::OUString suInvalidIP (RTL_CONSTASCII_USTRINGPARAM("123.345.67.89")); + rtl::OUString suInvalidIP ("123.345.67.89"); ::osl::SocketAddr saSocketAddr( suInvalidIP, IP_PORT_MYPORT ); CPPUNIT_ASSERT_MESSAGE( "test for getPort( ) function: give an invalid IP to a SocketAddr, get the port to see returned value. ", @@ -405,7 +405,7 @@ namespace osl_SocketAddr public: void setPort_001() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_FTP ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_FTP ); sal_Bool bOK = saSocketAddr.setPort( IP_PORT_TELNET ); CPPUNIT_ASSERT_MESSAGE( "test for setPort() function: modify a port number setting, and check it.", @@ -423,7 +423,7 @@ namespace osl_SocketAddr */ void setPort_002() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_FTP ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_FTP ); sal_Bool bOK = saSocketAddr.setPort( IP_PORT_ZERO ); oslSocket sHandle = osl_createSocket( osl_Socket_FamilyInet, osl_Socket_TypeStream, osl_Socket_ProtocolIp ); @@ -442,7 +442,7 @@ namespace osl_SocketAddr void setPort_003() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_FTP); + ::osl::SocketAddr saSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_FTP); sal_Bool bOK = saSocketAddr.setPort( IP_PORT_INVAL ); //on Linux, getPort return 34463 //t_print("#Port number is %d \n", saSocketAddr.getPort( )); @@ -455,7 +455,7 @@ namespace osl_SocketAddr /* this is not a inet-addr => can't set port */ void setPort_004() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("123.345.67.89")), IP_PORT_FTP); + ::osl::SocketAddr saSocketAddr( rtl::OUString("123.345.67.89"), IP_PORT_FTP); sal_Bool bOK = saSocketAddr.setPort( IP_PORT_MYPORT ); CPPUNIT_ASSERT_MESSAGE( "test for setPort( ) function: set an invalid address with valid port. it should return error.", @@ -492,8 +492,8 @@ namespace osl_SocketAddr public: void setAddr_001() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_FTP ); - saSocketAddr.setAddr( UStringIPToByteSequence( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")) ) ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("129.158.217.202"), IP_PORT_FTP ); + saSocketAddr.setAddr( UStringIPToByteSequence( rtl::OUString("127.0.0.1") ) ); ::rtl::ByteSequence bsSocketAddr = saSocketAddr.getAddr( 0 ); sal_Bool bOK = sal_False; @@ -523,7 +523,7 @@ namespace osl_SocketAddr void getAddr_001() { oslSocketResult SocketResult; - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_FTP ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_FTP ); ::rtl::ByteSequence bsSocketAddr = saSocketAddr.getAddr( &SocketResult ); sal_Bool bOK = sal_False; @@ -556,8 +556,8 @@ namespace osl_SocketAddr public: void operator_equal_001() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_TELNET); - ::osl::SocketAddr saSocketAddrEqual( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_FTP ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_TELNET); + ::osl::SocketAddr saSocketAddrEqual( rtl::OUString("129.158.217.202"), IP_PORT_FTP ); saSocketAddrEqual = saSocketAddr; sal_Bool bOK = sal_False; @@ -574,8 +574,8 @@ namespace osl_SocketAddr void operator_equal_002() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.199")), IP_PORT_TELNET); - ::osl::SocketAddr saSocketAddrEqual( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_FTP ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("129.158.217.199"), IP_PORT_TELNET); + ::osl::SocketAddr saSocketAddrEqual( rtl::OUString("129.158.217.202"), IP_PORT_FTP ); saSocketAddrEqual = saSocketAddr; CPPUNIT_ASSERT_MESSAGE( "after assign, the assigned SocketAddr is not same as the original Addr", @@ -589,8 +589,8 @@ namespace osl_SocketAddr void operator_equal_const_001() { - const ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_TELNET); - ::osl::SocketAddr saSocketAddrEqual( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_FTP ); + const ::osl::SocketAddr saSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_TELNET); + ::osl::SocketAddr saSocketAddrEqual( rtl::OUString("129.158.217.202"), IP_PORT_FTP ); saSocketAddrEqual = saSocketAddr; sal_Bool bOK = sal_False; @@ -606,8 +606,8 @@ namespace osl_SocketAddr void operator_equal_const_002() { - const ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_TELNET); - ::osl::SocketAddr saSocketAddrEqual( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_FTP ); + const ::osl::SocketAddr saSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_TELNET); + ::osl::SocketAddr saSocketAddrEqual( rtl::OUString("129.158.217.202"), IP_PORT_FTP ); saSocketAddrEqual = saSocketAddr; saSocketAddrEqual.setPort( IP_PORT_HTTP1 ); @@ -618,9 +618,9 @@ namespace osl_SocketAddr void operator_equal_assign_001() { - ::osl::SocketAddr* pSocketAddr = new ::osl::SocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_TELNET ); + ::osl::SocketAddr* pSocketAddr = new ::osl::SocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_TELNET ); CPPUNIT_ASSERT_MESSAGE("check for new SocketAddr", pSocketAddr != NULL); - ::osl::SocketAddr* pSocketAddrAssign = new ::osl::SocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_FTP ); + ::osl::SocketAddr* pSocketAddrAssign = new ::osl::SocketAddr( rtl::OUString("129.158.217.202"), IP_PORT_FTP ); oslSocketAddr poslSocketAddr = pSocketAddr->getHandle( ); //if( m_handle ) osl_destroySocketAddr( m_handle ); so pSocketAddrAssign had been destroyed and then point to pSocketAddr pSocketAddrAssign->assign(poslSocketAddr, SAL_NO_COPY); @@ -633,8 +633,8 @@ namespace osl_SocketAddr void operator_is_equal_001() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_TELNET); - ::osl::SocketAddr saSocketAddrequal( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_TELNET ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_TELNET); + ::osl::SocketAddr saSocketAddrequal( rtl::OUString("127.0.0.1"), IP_PORT_TELNET ); CPPUNIT_ASSERT_MESSAGE( "test for operator_equal_equal() function: check two identical Address.", sal_True == ( saSocketAddrequal == saSocketAddr.getHandle( ) ) ); @@ -642,8 +642,8 @@ namespace osl_SocketAddr void operator_is_equal_002() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.202")), IP_PORT_FTP); - ::osl::SocketAddr saSocketAddrequal( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_TELNET ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("129.158.217.202"), IP_PORT_FTP); + ::osl::SocketAddr saSocketAddrequal( rtl::OUString("127.0.0.1"), IP_PORT_TELNET ); CPPUNIT_ASSERT_MESSAGE( "test for operator_equal_equal() function: check two different Address.", sal_False == ( saSocketAddrequal == saSocketAddr.getHandle( ) ) ); @@ -673,7 +673,7 @@ namespace osl_SocketAddr void getSocketAddrHandle_001() { - ::osl::SocketAddr* pSocketAddr = new ::osl::SocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("localhost")), IP_PORT_HTTP1 ); + ::osl::SocketAddr* pSocketAddr = new ::osl::SocketAddr( rtl::OUString("localhost"), IP_PORT_HTTP1 ); CPPUNIT_ASSERT_MESSAGE("check for new SocketAddr", pSocketAddr != NULL); oslSocketAddr psaOSLSocketAddr = pSocketAddr->getHandle( ); ::osl::SocketAddr* pSocketAddrCopy = new ::osl::SocketAddr( psaOSLSocketAddr, SAL_NO_COPY ); @@ -686,7 +686,7 @@ namespace osl_SocketAddr void getSocketAddrHandle_002() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("deuce.PRC.Sun.COM")), IP_PORT_MYPORT4 ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("deuce.PRC.Sun.COM"), IP_PORT_MYPORT4 ); oslSocketAddr poslSocketAddr = saSocketAddr.getHandle( ); sal_Bool bOK = ( saSocketAddr == poslSocketAddr ); @@ -767,7 +767,7 @@ namespace osl_SocketAddr void resolveHostname_001() { ::osl::SocketAddr saSocketAddr; - ::osl::SocketAddr::resolveHostname( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), saSocketAddr ); + ::osl::SocketAddr::resolveHostname( rtl::OUString("127.0.0.1"), saSocketAddr ); ::rtl::ByteSequence bsSocketAddr = saSocketAddr.getAddr( 0 ); sal_Bool bOK = sal_False; @@ -788,7 +788,7 @@ namespace osl_SocketAddr /** testing the method: static inline sal_Int32 SAL_CALL getServicePort( const ::rtl::OUString& strServiceName, - const ::rtl::OUString & strProtocolName= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tcp")) ); + const ::rtl::OUString & strProtocolName= ::rtl::OUString("tcp") ); */ class gettheServicePort : public CppUnit::TestFixture @@ -796,8 +796,8 @@ namespace osl_SocketAddr public: void gettheServicePort_001() { - rtl::OUString suServiceFTP (RTL_CONSTASCII_USTRINGPARAM("ftp")); - rtl::OUString suProtocolTCP (RTL_CONSTASCII_USTRINGPARAM("tcp")); + rtl::OUString suServiceFTP ("ftp"); + rtl::OUString suProtocolTCP ("tcp"); CPPUNIT_ASSERT_MESSAGE( "test for getServicePort() function: try to get ftp service port on TCP protocol.", IP_PORT_FTP== ::osl::SocketAddr::getServicePort( suServiceFTP, suProtocolTCP ) ); @@ -805,8 +805,8 @@ namespace osl_SocketAddr void gettheServicePort_002() { - rtl::OUString suServiceTELNET (RTL_CONSTASCII_USTRINGPARAM("telnet")); - rtl::OUString suProtocolTCP (RTL_CONSTASCII_USTRINGPARAM("tcp")); + rtl::OUString suServiceTELNET ("telnet"); + rtl::OUString suProtocolTCP ("tcp"); CPPUNIT_ASSERT_MESSAGE( "test for getServicePort() function: try to get telnet service port on TCP protocol.", IP_PORT_TELNET== ::osl::SocketAddr::getServicePort( suServiceTELNET, suProtocolTCP ) ); } @@ -814,17 +814,17 @@ namespace osl_SocketAddr void gettheServicePort_003() { //Solaris has no service called "https", please see /etc/services - rtl::OUString suServiceNETBIOS (RTL_CONSTASCII_USTRINGPARAM("netbios-dgm")); - rtl::OUString suProtocolUDP (RTL_CONSTASCII_USTRINGPARAM("udp")); + rtl::OUString suServiceNETBIOS ("netbios-dgm"); + rtl::OUString suProtocolUDP ("udp"); CPPUNIT_ASSERT_MESSAGE( "test for getServicePort() function: try to get netbios-ssn service port on UDP protocol.", IP_PORT_NETBIOS_DGM == ::osl::SocketAddr::getServicePort( suServiceNETBIOS, suProtocolUDP ) ); } void gettheServicePort_004() { - rtl::OUString suProtocolUDP(RTL_CONSTASCII_USTRINGPARAM( "udp" )); + rtl::OUString suProtocolUDP("udp" ); CPPUNIT_ASSERT_MESSAGE( "test for getServicePort() function: try to get a service port which is not exist.", - OSL_INVALID_PORT == ::osl::SocketAddr::getServicePort( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("notexist")), suProtocolUDP ) ); + OSL_INVALID_PORT == ::osl::SocketAddr::getServicePort( ::rtl::OUString("notexist"), suProtocolUDP ) ); } CPPUNIT_TEST_SUITE( gettheServicePort ); @@ -845,7 +845,7 @@ namespace osl_SocketAddr public: void getFamilyOfSocketAddr_001() { - ::osl::SocketAddr saSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("localhost")), IP_PORT_HTTP1 ); + ::osl::SocketAddr saSocketAddr( rtl::OUString("localhost"), IP_PORT_HTTP1 ); oslSocketAddr psaOSLSocketAddr = saSocketAddr.getHandle( ); CPPUNIT_ASSERT_EQUAL( osl_Socket_FamilyInet, diff --git a/sal/qa/osl/socket/osl_StreamSocket.cxx b/sal/qa/osl/socket/osl_StreamSocket.cxx index 1d36c3a2549f..876951bdf467 100644 --- a/sal/qa/osl/socket/osl_StreamSocket.cxx +++ b/sal/qa/osl/socket/osl_StreamSocket.cxx @@ -142,7 +142,7 @@ protected: void SAL_CALL run( ) { ::osl::AcceptorSocket asAcceptorSocket( osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream ); - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT9 ); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT9 ); ::osl::StreamSocket ssStreamConnection; //if has not set this option, socket addr can not be binded in some time(maybe 2 minutes) by another socket @@ -252,7 +252,7 @@ protected: public: ClientSocketThread( osl::Condition &_aCond ): m_aCondition(_aCond), - m_saTargetSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT9 ), + m_saTargetSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT9 ), m_csConnectorSocket( ) { m_id = getIdentifier( ); @@ -335,7 +335,7 @@ protected: void SAL_CALL run( ) { - ::osl::SocketAddr m_aTargetSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT10 ); + ::osl::SocketAddr m_aTargetSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT10 ); ::osl::ConnectorSocket m_aConnectorSocket; if (! m_aTargetSocketAddr.is()) @@ -416,7 +416,7 @@ protected: { t_print("start WriteSocketThread\n"); ::osl::AcceptorSocket asAcceptorSocket( osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream ); - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT10 ); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT10 ); if (! saLocalSocketAddr.is()) { t_print("LocalSocketAddr was NOT created successfully!\n"); @@ -615,7 +615,7 @@ namespace osl_StreamSocket void send_recv2() { ::osl::AcceptorSocket asAcceptorSocket( osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream ); - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT9 ); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT9 ); ::osl::StreamSocket ssStreamConnection; sal_Char pReadBuffer[30] = ""; @@ -740,7 +740,7 @@ namespace osl_StreamSocket } public: SendClientThread( ): - m_saTargetSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT9 ), + m_saTargetSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT9 ), m_csConnectorSocket( ) { //t_print("# successfully creat this SendClientThread %d!\n", m_id ); @@ -772,7 +772,7 @@ namespace osl_StreamSocket { #if defined(LINUX) ::osl::AcceptorSocket asSocket( osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream ); - AcceptorThread myAcceptorThread( asSocket, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")) ); + AcceptorThread myAcceptorThread( asSocket, rtl::OUString("127.0.0.1") ); myAcceptorThread.create(); thread_sleep( 1 ); @@ -789,7 +789,7 @@ namespace osl_StreamSocket void shutdown_002() { ::osl::AcceptorSocket asSocket( osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream ); - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT9); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT9); asSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); CPPUNIT_ASSERT_MESSAGE("shutdown_002: bind fail", asSocket.bind( saLocalSocketAddr ) == sal_True); CPPUNIT_ASSERT_MESSAGE("shutdown_002: listen fail", asSocket.listen( 1 ) == sal_True ); @@ -842,7 +842,7 @@ namespace osl_StreamSocket void shutdown_003() { ::osl::AcceptorSocket asSocket( osl_Socket_FamilyInet, osl_Socket_ProtocolIp, osl_Socket_TypeStream ); - ::osl::SocketAddr saLocalSocketAddr( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("127.0.0.1")), IP_PORT_MYPORT9); + ::osl::SocketAddr saLocalSocketAddr( rtl::OUString("127.0.0.1"), IP_PORT_MYPORT9); asSocket.setOption( osl_Socket_OptionReuseAddr, 1 ); CPPUNIT_ASSERT_MESSAGE("shutdown_002: bind fail", asSocket.bind( saLocalSocketAddr ) == sal_True); CPPUNIT_ASSERT_MESSAGE("shutdown_002: listen fail", asSocket.listen( 1 ) == sal_True ); @@ -1194,7 +1194,7 @@ namespace osl_StreamSocket void send_recv() { rtl::OString sAddr; - // if ( ifAvailable(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("margritte.germany"))) == sal_True ) + // if ( ifAvailable(rtl::OUString("margritte.germany")) == sal_True ) // { // t_print("margritte is alive ! \n"); // sAddr = "margritte.germany"; @@ -1207,21 +1207,21 @@ namespace osl_StreamSocket } // else // { -// if ( ifAvailable(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("192.168.7.2"))) == sal_True ) +// if ( ifAvailable(rtl::OUString("192.168.7.2")) == sal_True ) // { // sAddr = "192.168.7.2"; // t_print("moon found ! \n"); // } // else // { -// if ( ifAvailable(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("moon.linux.bogus"))) == sal_True ) +// if ( ifAvailable(rtl::OUString("moon.linux.bogus")) == sal_True ) // { // sAddr = "moon.linux.bogus"; // t_print("moon found ! \n"); // } // else // { -// if ( ifAvailable(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("moon"))) == sal_True ) +// if ( ifAvailable(rtl::OUString("moon")) == sal_True ) // { // sAddr = "moon"; // t_print("moon found ! \n"); @@ -1230,7 +1230,7 @@ namespace osl_StreamSocket // } // } - // if ( ifAvailable(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("10.16.64.196"))) == sal_False ) + // if ( ifAvailable(rtl::OUString("10.16.64.196")) == sal_False ) // { // t_print("ip 10.16.64.196 is not alive! \n"); // return; diff --git a/sal/qa/osl/socket/sockethelper.cxx b/sal/qa/osl/socket/sockethelper.cxx index 91c49868bde9..8f448e258d6e 100644 --- a/sal/qa/osl/socket/sockethelper.cxx +++ b/sal/qa/osl/socket/sockethelper.cxx @@ -185,11 +185,11 @@ void printUString( const ::rtl::OUString & str, const char* msg) if ( returnVal.equals( rightVal ) ) return aUString; aUString += ::rtl::OUString::createFromAscii(msg); - aUString += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(": the returned value is '")); + aUString += ::rtl::OUString(": the returned value is '"); aUString += returnVal; - aUString += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("', but the value should be '")); + aUString += ::rtl::OUString("', but the value should be '"); aUString += rightVal; - aUString += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'.")); + aUString += ::rtl::OUString("'."); return aUString; } diff --git a/sal/qa/rtl/bootstrap/bootstrap_process.cxx b/sal/qa/rtl/bootstrap/bootstrap_process.cxx index 6455073224b5..3b989a474b85 100644 --- a/sal/qa/rtl/bootstrap/bootstrap_process.cxx +++ b/sal/qa/rtl/bootstrap/bootstrap_process.cxx @@ -43,14 +43,14 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) //custom .ini/rc file Bootstrap aBs_custom( OUString::createFromAscii(argv[3]) ); OUString suValue; - OUString suDefault( RTL_CONSTASCII_USTRINGPARAM("mydefault") ); + OUString suDefault( "mydefault" ); int flag = atoi( argv[1] ); switch( flag ) { case 1: // parameters may be passed by command line arguments aBootstrap.getFrom( - OUString(RTL_CONSTASCII_USTRINGPARAM("UNO_SERVICES")), + OUString("UNO_SERVICES"), suValue ); if ( suValue == "service.rdb" ) { @@ -61,7 +61,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) case 2: // parameters may be passed by ini file aBootstrap.getFrom( - OUString(RTL_CONSTASCII_USTRINGPARAM("EXECUTABLE_RC")), + OUString("EXECUTABLE_RC"), suValue ); if ( suValue == "true" ) { @@ -72,7 +72,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) case 3: // parameters may be passed by command line arguments aBootstrap.getFrom( - OUString(RTL_CONSTASCII_USTRINGPARAM("QADEV_BOOTSTRAP")), + OUString("QADEV_BOOTSTRAP"), suValue ); if ( suValue == "sun&ms" ) { @@ -83,7 +83,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) case 4: // parameters may be passed by custom .ini/rc file aBs_custom.getFrom( - OUString(RTL_CONSTASCII_USTRINGPARAM("RTLVALUE")), + OUString("RTLVALUE"), suValue ); if ( suValue == "qadev17" ) { @@ -94,7 +94,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) case 5: // parameters may be passed by inheritance aBs_custom.getFrom( - OUString(RTL_CONSTASCII_USTRINGPARAM("EXECUTABLE_RC")), + OUString("EXECUTABLE_RC"), suValue ); if ( suValue == "true" ) { @@ -105,7 +105,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) default: // parameters may be passed by inheritance aBs_custom.getFrom( - OUString(RTL_CONSTASCII_USTRINGPARAM("ABCDE")), + OUString("ABCDE"), suValue, suDefault ); if ( suValue == "mydefault" ) { diff --git a/sal/qa/rtl/locale/rtl_locale.cxx b/sal/qa/rtl/locale/rtl_locale.cxx index 2cc938701e36..8d153b87ae1e 100644 --- a/sal/qa/rtl/locale/rtl_locale.cxx +++ b/sal/qa/rtl/locale/rtl_locale.cxx @@ -42,7 +42,7 @@ namespace rtl_locale // default locale for test purpose void setDefaultLocale() { - rtl::OLocale::setDefault(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("de")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DE")), /* rtl::OUString() */ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("hochdeutsch")) ); + rtl::OLocale::setDefault(rtl::OUString("de"), rtl::OUString("DE"), /* rtl::OUString() */ rtl::OUString("hochdeutsch") ); } class getDefault : public CppUnit::TestFixture @@ -73,7 +73,7 @@ public: void getDefault_001() { - // rtl::OLocale::setDefault(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("de")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DE")), rtl::OUString()); + // rtl::OLocale::setDefault(rtl::OUString("de"), rtl::OUString("DE"), rtl::OUString()); rtl::OLocale aLocale = ::rtl::OLocale::getDefault(); CPPUNIT_ASSERT_MESSAGE("locale must not null", aLocale.getData() != NULL); } @@ -107,7 +107,7 @@ public: // insert your test code here. void setDefault_001() { - rtl::OLocale::setDefault(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")), rtl::OUString()); + rtl::OLocale::setDefault(rtl::OUString("en"), rtl::OUString("US"), rtl::OUString()); rtl::OLocale aLocale = ::rtl::OLocale::getDefault(); CPPUNIT_ASSERT_MESSAGE("locale must not null", aLocale.getData() != NULL); @@ -297,8 +297,8 @@ public: // insert your test code here. void equals_001() { - rtl::OLocale aLocale1 = rtl::OLocale::registerLocale(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")), rtl::OUString()); - rtl::OLocale aLocale2 = rtl::OLocale::registerLocale(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US"))); + rtl::OLocale aLocale1 = rtl::OLocale::registerLocale(rtl::OUString("en"), rtl::OUString("US"), rtl::OUString()); + rtl::OLocale aLocale2 = rtl::OLocale::registerLocale(rtl::OUString("en"), rtl::OUString("US")); sal_Bool bLocaleAreEqual = sal_False; bLocaleAreEqual = (aLocale1 == aLocale2); @@ -308,8 +308,8 @@ public: void equals_002() { - rtl::OLocale aLocale1 = rtl::OLocale::registerLocale(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US")), rtl::OUString()); - rtl::OLocale aLocale2 = rtl::OLocale::registerLocale(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US"))); + rtl::OLocale aLocale1 = rtl::OLocale::registerLocale(rtl::OUString("en"), rtl::OUString("US"), rtl::OUString()); + rtl::OLocale aLocale2 = rtl::OLocale::registerLocale(rtl::OUString("en"), rtl::OUString("US")); sal_Int32 nEqual = rtl_locale_equals(aLocale1.getData(), aLocale2.getData()); CPPUNIT_ASSERT(nEqual != 0); diff --git a/sal/qa/rtl/logfile/rtl_logfile.cxx b/sal/qa/rtl/logfile/rtl_logfile.cxx index 78120212da13..0d539f3f0125 100644 --- a/sal/qa/rtl/logfile/rtl_logfile.cxx +++ b/sal/qa/rtl/logfile/rtl_logfile.cxx @@ -73,9 +73,9 @@ inline void printUString( const ::rtl::OUString & str, const sal_Char * msg = "" inline ::rtl::OUString getTempPath( void ) { #ifdef UNX - rtl::OUString suDirURL( RTL_CONSTASCII_USTRINGPARAM("file:///tmp/") ); + rtl::OUString suDirURL( "file:///tmp/" ); #else /* Windows */ - rtl::OUString suDirURL( RTL_CONSTASCII_USTRINGPARAM("file:///c:/temp/") ); + rtl::OUString suDirURL( "file:///c:/temp/" ); #endif return suDirURL; } @@ -139,8 +139,8 @@ namespace rtl_logfile rtl_logfile_trace("trace %d %d %d\n" , 1 , 2 ,3 ); rtl::OUString suFilePath = getTempPath(); - suFilePath += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("logfile1_")) + getCurrentPID( ); - suFilePath += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".log")); + suFilePath += rtl::OUString("logfile1_") + getCurrentPID( ); + suFilePath += rtl::OUString(".log"); ::osl::FileBase::RC nError1; ::osl::File aTestFile( suFilePath ); @@ -228,8 +228,8 @@ public: { printf( "\n#Do some clean-ups ... only delete logfile1_*.log here!\n" ); rtl::OUString suFilePath = getTempPath(); - suFilePath += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("logfile1_")) + getCurrentPID( ); - suFilePath += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".log")); + suFilePath += rtl::OUString("logfile1_") + getCurrentPID( ); + suFilePath += rtl::OUString(".log"); //if ( ifFileExist( suFilePath ) == sal_True ) ::osl::FileBase::RC nError1; diff --git a/sal/qa/rtl/oustring/rtl_OUString2.cxx b/sal/qa/rtl/oustring/rtl_OUString2.cxx index aca03781bc3e..eebbcc6b2f4a 100644 --- a/sal/qa/rtl/oustring/rtl_OUString2.cxx +++ b/sal/qa/rtl/oustring/rtl_OUString2.cxx @@ -57,7 +57,7 @@ namespace rtl_OUString /// test of OUString(rtl_uString*) void ctors_001() { - rtl::OUString *pStr = new rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("a String") ); + rtl::OUString *pStr = new rtl::OUString( "a String" ); rtl::OUString aStrToTest(pStr->pData); delete pStr; @@ -344,21 +344,21 @@ sal_Int16 SAL_CALL checkPrecisionSize() void test() { CPPUNIT_ASSERT_EQUAL( static_cast< sal_Int32 >(-0x76543210), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-76543210")). + (rtl::OUString("-76543210"). toInt32(16))); CPPUNIT_ASSERT_EQUAL( static_cast< sal_Int32 >(0xFEDCBA98), - (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("+FEDCBA98")). + (rtl::OUString("+FEDCBA98"). toInt32(16))); CPPUNIT_ASSERT_EQUAL( static_cast< sal_Int64 >(-SAL_CONST_INT64(0x76543210FEDCBA98)), (rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("-76543210FEDCBA98")). + "-76543210FEDCBA98"). toInt64(16))); CPPUNIT_ASSERT_EQUAL( static_cast< sal_Int64 >(SAL_CONST_INT64(0xFEDCBA9876543210)), (rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM("+FEDCBA9876543210")). + "+FEDCBA9876543210"). toInt64(16))); } @@ -690,88 +690,88 @@ public: void lastIndexOf_test_oustring_offset_001() { // search for sun, start at the end, found (pos==0) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("sun java system")); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun")); + rtl::OUString aStr("sun java system"); + rtl::OUString aSearchStr("sun"); lastIndexOf_oustring_offset(aStr, aSearchStr, 0, aStr.getLength()); } void lastIndexOf_test_oustring_offset_002() { // search for sun, start at pos = 3, found (pos==0) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("sun java system")); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun")); + rtl::OUString aStr("sun java system"); + rtl::OUString aSearchStr("sun"); lastIndexOf_oustring_offset(aStr, aSearchStr, 0, 3); } void lastIndexOf_test_oustring_offset_003() { // search for sun, start at pos = 2, found (pos==-1) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("sun java system")); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun")); + rtl::OUString aStr("sun java system"); + rtl::OUString aSearchStr("sun"); lastIndexOf_oustring_offset(aStr, aSearchStr, -1, 2); } void lastIndexOf_test_oustring_offset_004() { // search for sun, start at the end, found (pos==0) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("sun java system")); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun")); + rtl::OUString aStr("sun java system"); + rtl::OUString aSearchStr("sun"); lastIndexOf_oustring_offset(aStr, aSearchStr, -1, -1); } void lastIndexOf_test_oustring_001() { // search for sun, found (pos==0) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("sun java system")); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun")); + rtl::OUString aStr("sun java system"); + rtl::OUString aSearchStr("sun"); lastIndexOf_oustring(aStr, aSearchStr, 0); } void lastIndexOf_test_oustring_002() { // search for sun, found (pos==4) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun java system")); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun")); + rtl::OUString aStr("the sun java system"); + rtl::OUString aSearchStr("sun"); lastIndexOf_oustring(aStr, aSearchStr, 4); } void lastIndexOf_test_oustring_003() { // search for sun, found (pos==8) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun sun java system")); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun")); + rtl::OUString aStr("the sun sun java system"); + rtl::OUString aSearchStr("sun"); lastIndexOf_oustring(aStr, aSearchStr, 8); } void lastIndexOf_test_oustring_004() { // search for sun, found (pos==8) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun sun")); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun")); + rtl::OUString aStr("the sun sun"); + rtl::OUString aSearchStr("sun"); lastIndexOf_oustring(aStr, aSearchStr, 8); } void lastIndexOf_test_oustring_005() { // search for sun, found (pos==4) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun su")); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun")); + rtl::OUString aStr("the sun su"); + rtl::OUString aSearchStr("sun"); lastIndexOf_oustring(aStr, aSearchStr, 4); } void lastIndexOf_test_oustring_006() { // search for sun, found (pos==-1) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the su su")); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("sun")); + rtl::OUString aStr("the su su"); + rtl::OUString aSearchStr("sun"); lastIndexOf_oustring(aStr, aSearchStr, -1); } void lastIndexOf_test_oustring_007() { // search for earth, not found (-1) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the su su")); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("earth")); + rtl::OUString aStr("the su su"); + rtl::OUString aSearchStr("earth"); lastIndexOf_oustring(aStr, aSearchStr, -1); } @@ -779,7 +779,7 @@ public: { // search for earth, not found (-1) rtl::OUString aStr = rtl::OUString(); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("earth")); + rtl::OUString aSearchStr("earth"); lastIndexOf_oustring(aStr, aSearchStr, -1); } @@ -795,7 +795,7 @@ public: void lastIndexOf_test_salunicode_001() { // search for 's', found (19) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun sun java system")); + rtl::OUString aStr("the sun sun java system"); sal_Unicode suChar = L's'; lastIndexOf_salunicode(aStr, suChar, 19); } @@ -803,7 +803,7 @@ public: void lastIndexOf_test_salunicode_002() { // search for 'x', not found (-1) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun sun java system")); + rtl::OUString aStr("the sun sun java system"); sal_Unicode suChar = L'x'; lastIndexOf_salunicode(aStr, suChar, -1); } @@ -811,21 +811,21 @@ public: void lastIndexOf_test_salunicode_offset_001() { // search for 's', start from pos last char, found (19) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun sun java system")); + rtl::OUString aStr("the sun sun java system"); sal_Unicode cuChar = L's'; lastIndexOf_salunicode_offset(aStr, cuChar, 19, aStr.getLength()); } void lastIndexOf_test_salunicode_offset_002() { // search for 's', start pos is last occur from search behind, found (17) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun sun java system")); + rtl::OUString aStr("the sun sun java system"); sal_Unicode cuChar = L's'; lastIndexOf_salunicode_offset(aStr, cuChar, 17, 19); } void lastIndexOf_test_salunicode_offset_003() { // search for 't', start pos is 1, found (0) - rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("the sun sun java system")); + rtl::OUString aStr("the sun sun java system"); sal_Unicode cuChar = L't'; lastIndexOf_salunicode_offset(aStr, cuChar, 0, 1); } @@ -884,7 +884,7 @@ public: void getToken_001() { - rtl::OUString suTokenStr(RTL_CONSTASCII_USTRINGPARAM("a;b")); + rtl::OUString suTokenStr("a;b"); sal_Int32 nIndex = 0; @@ -898,7 +898,7 @@ public: void getToken_002() { - rtl::OUString suTokenStr(RTL_CONSTASCII_USTRINGPARAM("a;b.c")); + rtl::OUString suTokenStr("a;b.c"); sal_Int32 nIndex = 0; @@ -915,7 +915,7 @@ public: void getToken_003() { - rtl::OUString suTokenStr(RTL_CONSTASCII_USTRINGPARAM("a;;b")); + rtl::OUString suTokenStr("a;;b"); sal_Int32 nIndex = 0; @@ -932,7 +932,7 @@ public: void getToken_004() { - rtl::OUString suTokenStr(RTL_CONSTASCII_USTRINGPARAM("longer.then.ever.")); + rtl::OUString suTokenStr("longer.then.ever."); sal_Int32 nIndex = 0; @@ -952,7 +952,7 @@ public: } void getToken_005() { - rtl::OUString ab(RTL_CONSTASCII_USTRINGPARAM("ab")); + rtl::OUString ab("ab"); sal_Int32 n = 0; CPPUNIT_ASSERT_MESSAGE( "token should be 'ab'", ab.getToken(0, '-', n) == ab); @@ -1001,13 +1001,13 @@ public: void construct() { #ifdef RTL_INLINE_STRINGS - ::rtl::OUString aFoo( RTL_CONSTASCII_USTRINGPARAM("foo") ); + ::rtl::OUString aFoo( "foo" ); CPPUNIT_ASSERT_MESSAGE("string contents", aFoo[0] == 'f'); CPPUNIT_ASSERT_MESSAGE("string contents", aFoo[1] == 'o'); CPPUNIT_ASSERT_MESSAGE("string contents", aFoo[2] == 'o'); CPPUNIT_ASSERT_MESSAGE("string length", aFoo.getLength() == 3); - ::rtl::OUString aBaa( RTL_CONSTASCII_USTRINGPARAM("this is a very long string with a lot of long things inside it and it goes on and on and on forever etc.") ); + ::rtl::OUString aBaa( "this is a very long string with a lot of long things inside it and it goes on and on and on forever etc." ); CPPUNIT_ASSERT_MESSAGE("string length", aBaa.getLength() == 104); // Dig at the internals ... FIXME: should we have the bit-flag defines public ? CPPUNIT_ASSERT_MESSAGE("string static flags", (aBaa.pData->refCount & 1<<30) != 0); @@ -1018,9 +1018,9 @@ public: { // The empty string is 'static' a special case ... rtl::OUString aEmpty = rtl::OUString().intern(); - rtl::OUString aEmpty2 = rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "" ) ); + rtl::OUString aEmpty2 = rtl::OUString::intern( "" ); - ::rtl::OUString aFoo( RTL_CONSTASCII_USTRINGPARAM("foo") ); + ::rtl::OUString aFoo( "foo" ); ::rtl::OUString aFooIntern = aFoo.intern(); CPPUNIT_ASSERT_MESSAGE( "string contents", aFooIntern == "foo" ); CPPUNIT_ASSERT_MESSAGE("string length", aFooIntern.getLength() == 3); @@ -1094,23 +1094,23 @@ void indexOfAscii::test() { rtl::OUString().lastIndexOfAsciiL(RTL_CONSTASCII_STRINGPARAM(""))); CPPUNIT_ASSERT_EQUAL( sal_Int32(0), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foo")).indexOfAsciiL( + rtl::OUString("foo").indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM("foo"))); CPPUNIT_ASSERT_EQUAL( sal_Int32(0), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foo")).lastIndexOfAsciiL( + rtl::OUString("foo").lastIndexOfAsciiL( RTL_CONSTASCII_STRINGPARAM("foo"))); CPPUNIT_ASSERT_EQUAL( sal_Int32(2), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("fofoobar")).indexOfAsciiL( + rtl::OUString("fofoobar").indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM("foo"))); CPPUNIT_ASSERT_EQUAL( sal_Int32(3), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foofoofob")). + rtl::OUString("foofoofob"). lastIndexOfAsciiL(RTL_CONSTASCII_STRINGPARAM("foo"))); CPPUNIT_ASSERT_EQUAL( sal_Int32(3), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foofoobar")).indexOfAsciiL( + rtl::OUString("foofoobar").indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM("foo"), 1)); } @@ -1132,15 +1132,15 @@ void endsWith::test() { rtl::OUString().endsWithAsciiL(RTL_CONSTASCII_STRINGPARAM("foo"))); CPPUNIT_ASSERT_EQUAL( true, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bar")).endsWithAsciiL( + rtl::OUString("bar").endsWithAsciiL( RTL_CONSTASCII_STRINGPARAM("bar"))); CPPUNIT_ASSERT_EQUAL( true, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("foobar")).endsWithAsciiL( + rtl::OUString("foobar").endsWithAsciiL( RTL_CONSTASCII_STRINGPARAM("bar"))); CPPUNIT_ASSERT_EQUAL( false, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FOOBAR")).endsWithAsciiL( + rtl::OUString("FOOBAR").endsWithAsciiL( RTL_CONSTASCII_STRINGPARAM("bar"))); } diff --git a/sal/qa/rtl/oustring/rtl_ustr.cxx b/sal/qa/rtl/oustring/rtl_ustr.cxx index b787488912fe..d547cf280490 100644 --- a/sal/qa/rtl/oustring/rtl_ustr.cxx +++ b/sal/qa/rtl/oustring/rtl_ustr.cxx @@ -57,7 +57,7 @@ namespace rtl_ustr void compare_000_1() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString aStr1("Line must be equal."); rtl_ustr_compare( aStr1.getStr(), NULL); // should not GPF } @@ -72,8 +72,8 @@ namespace rtl_ustr void compare_002() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); - rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString aStr1("Line must be equal."); + rtl::OUString aStr2("Line must be equal."); sal_Int32 nValue = rtl_ustr_compare( aStr1.getStr(), aStr2.getStr()); CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0); @@ -81,8 +81,8 @@ namespace rtl_ustr void compare_003() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ.")); - rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("Line foo bar, ok, differ.")); + rtl::OUString aStr1("Line must differ."); + rtl::OUString aStr2("Line foo bar, ok, differ."); sal_Int32 nValue = rtl_ustr_compare( aStr1.getStr(), aStr2.getStr()); CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", nValue != 0); @@ -113,7 +113,7 @@ namespace rtl_ustr void compare_000_1() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString aStr1("Line must be equal."); rtl_ustr_compareIgnoreAsciiCase( aStr1.getStr(), NULL); } void compare_001() @@ -127,8 +127,8 @@ namespace rtl_ustr void compare_002() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); - rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString aStr1("Line must be equal."); + rtl::OUString aStr2("Line must be equal."); sal_Int32 nValue = rtl_ustr_compareIgnoreAsciiCase( aStr1.getStr(), aStr2.getStr()); CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal.", nValue == 0); @@ -136,8 +136,8 @@ namespace rtl_ustr void compare_002_1() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); - rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("LINE MUST BE EQUAL.")); + rtl::OUString aStr1("Line must be equal."); + rtl::OUString aStr2("LINE MUST BE EQUAL."); sal_Int32 nValue = rtl_ustr_compareIgnoreAsciiCase( aStr1.getStr(), aStr2.getStr()); CPPUNIT_ASSERT_MESSAGE("compare failed, strings are equal (if case insensitve).", nValue == 0); @@ -145,8 +145,8 @@ namespace rtl_ustr void compare_003() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ.")); - rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("Line foo bar, ok, differ.")); + rtl::OUString aStr1("Line must differ."); + rtl::OUString aStr2("Line foo bar, ok, differ."); sal_Int32 nValue = rtl_ustr_compareIgnoreAsciiCase( aStr1.getStr(), aStr2.getStr()); CPPUNIT_ASSERT_MESSAGE("compare failed, strings differ.", nValue != 0); @@ -179,7 +179,7 @@ namespace rtl_ustr void compare_000_1() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString aStr1("Line must be equal."); rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(), NULL, 0, 1); } void compare_001() @@ -193,8 +193,8 @@ namespace rtl_ustr void compare_002() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); - rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString aStr1("Line must be equal."); + rtl::OUString aStr2("Line must be equal."); sal_Int32 nValue = rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(), aStr2.getStr(), aStr2.getLength(), @@ -204,8 +204,8 @@ namespace rtl_ustr void compare_002_1() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); - rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("LINE MUST BE EQUAL.")); + rtl::OUString aStr1("Line must be equal."); + rtl::OUString aStr2("LINE MUST BE EQUAL."); sal_Int32 nValue = rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(), aStr2.getStr(), aStr2.getLength(), @@ -215,8 +215,8 @@ namespace rtl_ustr void compare_003() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ.")); - rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("Line foo bar, ok, differ.")); + rtl::OUString aStr1("Line must differ."); + rtl::OUString aStr2("Line foo bar, ok, differ."); sal_Int32 nValue = rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(), aStr2.getStr(), aStr2.getLength(), @@ -226,8 +226,8 @@ namespace rtl_ustr void compare_004() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ.")); - rtl::OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("Line foo bar, ok, differ.")); + rtl::OUString aStr1("Line must differ."); + rtl::OUString aStr2("Line foo bar, ok, differ."); sal_Int32 nValue = rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(), aStr2.getStr(), aStr2.getLength(), @@ -319,7 +319,7 @@ namespace rtl_ustr void indexOfChar_001() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a indexOfChar.")); + rtl::OUString aStr1("Line for a indexOfChar."); sal_Int32 nIndex = rtl_ustr_indexOfChar( aStr1.getStr(), 'L' ); CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 0); @@ -336,7 +336,7 @@ namespace rtl_ustr void indexOfChar_002() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a indexOfChar.")); + rtl::OUString aStr1("Line for a indexOfChar."); sal_Int32 nIndex = rtl_ustr_indexOfChar( aStr1.getStr(), 'y' ); CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 ); @@ -365,7 +365,7 @@ namespace rtl_ustr void lastIndexOfChar_001() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a lastIndexOfChar.")); + rtl::OUString aStr1("Line for a lastIndexOfChar."); sal_Int32 nIndex = rtl_ustr_lastIndexOfChar( aStr1.getStr(), 'C' ); CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 22); @@ -382,7 +382,7 @@ namespace rtl_ustr void lastIndexOfChar_002() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a lastIndexOfChar.")); + rtl::OUString aStr1("Line for a lastIndexOfChar."); sal_Int32 nIndex = rtl_ustr_lastIndexOfChar( aStr1.getStr(), 'y' ); CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 ); @@ -413,35 +413,35 @@ namespace rtl_ustr void indexOfStr_000_1() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a indexOfStr.")); + rtl::OUString aStr1("Line for a indexOfStr."); rtl_ustr_indexOfStr( aStr1.getStr(), 0 ); } void indexOfStr_001() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a indexOfStr.")); + rtl::OUString aStr1("Line for a indexOfStr."); - rtl::OUString suSearch(RTL_CONSTASCII_USTRINGPARAM("Line")); + rtl::OUString suSearch("Line"); sal_Int32 nIndex = rtl_ustr_indexOfStr( aStr1.getStr(), suSearch ); CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 0); - /* rtl::OUString */ suSearch(RTL_CONSTASCII_USTRINGPARAM("for")); + /* rtl::OUString */ suSearch("for"); /* sal_Int32 */ nIndex = rtl_ustr_indexOfStr( aStr1.getStr(), suSearch ); CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 5); - /* rtl::OUString */ suSearch(RTL_CONSTASCII_USTRINGPARAM("a")); + /* rtl::OUString */ suSearch("a"); /* sal_Int32 */ nIndex = rtl_ustr_indexOfStr( aStr1.getStr(), suSearch ); CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 9); - /* rtl::OUString */ suSearch(RTL_CONSTASCII_USTRINGPARAM("a index")); + /* rtl::OUString */ suSearch("a index"); /* sal_Int32 */ nIndex = rtl_ustr_indexOfStr( aStr1.getStr(), suSearch ); CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex ==9); } void indexOfStr_002() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a indexOfStr.")); - rtl::OUString suSearch(RTL_CONSTASCII_USTRINGPARAM("not exist")); + rtl::OUString aStr1("Line for a indexOfStr."); + rtl::OUString suSearch("not exist"); sal_Int32 nIndex = rtl_ustr_indexOfStr( aStr1.getStr(), suSearch ); CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 ); @@ -471,31 +471,31 @@ namespace rtl_ustr void lastIndexOfStr_000_1() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a lastIndexOfStr.")); + rtl::OUString aStr1("Line for a lastIndexOfStr."); rtl_ustr_lastIndexOfStr( aStr1.getStr(), NULL ); } void lastIndexOfStr_001() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a lastIndexOfStr.")); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("Index")); + rtl::OUString aStr1("Line for a lastIndexOfStr."); + rtl::OUString aSearchStr("Index"); sal_Int32 nIndex = rtl_ustr_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() ); CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 15); - /* rtl::OString */ aSearchStr = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Line")); + /* rtl::OString */ aSearchStr = rtl::OUString("Line"); /* sal_Int32 */ nIndex = rtl_ustr_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() ); CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 0); - /* rtl::OString */ aSearchStr = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); + /* rtl::OString */ aSearchStr = rtl::OUString(""); /* sal_Int32 */ nIndex = rtl_ustr_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() ); CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1); } void lastIndexOfStr_002() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a lastIndexOfStr.")); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("foo")); + rtl::OUString aStr1("Line for a lastIndexOfStr."); + rtl::OUString aSearchStr("foo"); sal_Int32 nIndex = rtl_ustr_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() ); CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == -1 ); @@ -503,8 +503,8 @@ namespace rtl_ustr void lastIndexOfStr_003() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line for a lastIndexOfStr.")); - rtl::OUString aSearchStr(RTL_CONSTASCII_USTRINGPARAM("O")); + rtl::OUString aStr1("Line for a lastIndexOfStr."); + rtl::OUString aSearchStr("O"); sal_Int32 nIndex = rtl_ustr_lastIndexOfStr( aStr1.getStr(), aSearchStr.getStr() ); CPPUNIT_ASSERT_MESSAGE("index is wrong.", nIndex == 20 ); @@ -535,8 +535,8 @@ namespace rtl_ustr void replaceChar_001() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("replace char.")); - rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("ruplacu char.")); + rtl::OUString aStr1("replace char."); + rtl::OUString aShouldStr1("ruplacu char."); sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode); sal_Unicode* pStr = (sal_Unicode*) malloc( nLength + sizeof(sal_Unicode)); // length + 1 (null terminator) @@ -578,8 +578,8 @@ namespace rtl_ustr } void replaceChar_WithLength_001() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("replace char.")); - rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("ruplace char.")); + rtl::OUString aStr1("replace char."); + rtl::OUString aShouldStr1("ruplace char."); sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode); sal_Unicode* pStr = (sal_Unicode*) malloc(nLength); @@ -595,8 +595,8 @@ namespace rtl_ustr void replaceChar_WithLength_002() { - rtl::OUString aStr1 (RTL_CONSTASCII_USTRINGPARAM("eeeeeeeeeeeee")); - rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("uuuuuueeeeeee")); + rtl::OUString aStr1 ("eeeeeeeeeeeee"); + rtl::OUString aShouldStr1("uuuuuueeeeeee"); sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode); sal_Unicode* pStr = (sal_Unicode*) malloc(nLength); // no null terminator is need @@ -636,8 +636,8 @@ namespace rtl_ustr void toAsciiLowerCase_001() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("CHANGE THIS TO ASCII LOWER CASE.")); - rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("change this to ascii lower case.")); + rtl::OUString aStr1("CHANGE THIS TO ASCII LOWER CASE."); + rtl::OUString aShouldStr1("change this to ascii lower case."); sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode); sal_Unicode* pStr = (sal_Unicode*) malloc(nLength + sizeof(sal_Unicode) ); // we need to add '\0' so one more @@ -674,8 +674,8 @@ namespace rtl_ustr void toAsciiLowerCase_WithLength_001() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("CHANGE THIS TO ASCII LOWER CASE.")); - rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("change thiS TO ASCII LOWER CASE.")); + rtl::OUString aStr1("CHANGE THIS TO ASCII LOWER CASE."); + rtl::OUString aShouldStr1("change thiS TO ASCII LOWER CASE."); sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode); sal_Unicode* pStr = (sal_Unicode*) malloc(nLength); @@ -718,8 +718,8 @@ namespace rtl_ustr void toAsciiUpperCase_001() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("change this to ascii upper case.")); - rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("CHANGE THIS TO ASCII UPPER CASE.")); + rtl::OUString aStr1("change this to ascii upper case."); + rtl::OUString aShouldStr1("CHANGE THIS TO ASCII UPPER CASE."); sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode); sal_Unicode* pStr = (sal_Unicode*) malloc(nLength + sizeof(sal_Unicode)); // length + null terminator @@ -756,8 +756,8 @@ namespace rtl_ustr void toAsciiUpperCase_WithLength_001() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("change this to ascii lower case.")); - rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("CHANGE THIs to ascii lower case.")); + rtl::OUString aStr1("change this to ascii lower case."); + rtl::OUString aShouldStr1("CHANGE THIs to ascii lower case."); sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode); sal_Unicode* pStr = (sal_Unicode*) malloc(nLength); @@ -796,7 +796,7 @@ namespace rtl_ustr void trim_WithLength_000_1() { - rtl::OUString suStr(RTL_CONSTASCII_USTRINGPARAM(" trim this")); + rtl::OUString suStr(" trim this"); sal_uInt32 nLength = suStr.getLength() * sizeof(sal_Unicode); sal_Unicode *pStr = (sal_Unicode*)malloc(nLength); @@ -808,7 +808,7 @@ namespace rtl_ustr void trim_WithLength_001() { - rtl::OUString suStr(RTL_CONSTASCII_USTRINGPARAM(" trim this")); + rtl::OUString suStr(" trim this"); sal_uInt32 nLength = suStr.getLength() * sizeof(sal_Unicode); sal_Unicode *pStr = (sal_Unicode*)malloc(nLength); memcpy(pStr, suStr.getStr(), nLength); @@ -822,7 +822,7 @@ namespace rtl_ustr void trim_WithLength_002() { - rtl::OUString suStr(RTL_CONSTASCII_USTRINGPARAM("trim this")); + rtl::OUString suStr("trim this"); sal_uInt32 nLength = suStr.getLength() * sizeof(sal_Unicode); sal_Unicode *pStr = (sal_Unicode*)malloc(nLength); @@ -837,7 +837,7 @@ namespace rtl_ustr void trim_WithLength_003() { - rtl::OUString suStr(RTL_CONSTASCII_USTRINGPARAM(" trim this")); + rtl::OUString suStr(" trim this"); sal_uInt32 nLength = suStr.getLength() * sizeof(sal_Unicode); sal_Unicode *pStr = (sal_Unicode*)malloc(nLength); @@ -851,7 +851,7 @@ namespace rtl_ustr void trim_WithLength_004() { - rtl::OUString suStr(RTL_CONSTASCII_USTRINGPARAM("\r\n\t \n\r trim \n this")); + rtl::OUString suStr("\r\n\t \n\r trim \n this"); sal_uInt32 nLength = suStr.getLength() * sizeof(sal_Unicode); sal_Unicode *pStr = (sal_Unicode*)malloc(nLength); @@ -865,7 +865,7 @@ namespace rtl_ustr void trim_WithLength_005() { - rtl::OUString suStr(RTL_CONSTASCII_USTRINGPARAM("\r\n\t \n\r trim \t this \n\r\t\t ")); + rtl::OUString suStr("\r\n\t \n\r trim \t this \n\r\t\t "); sal_uInt32 nLength = suStr.getLength() * sizeof(sal_Unicode); sal_Unicode *pStr = (sal_Unicode*)malloc(nLength); @@ -941,7 +941,7 @@ namespace rtl_ustr void equal_ascii_shorter() { - rtl::OUString refStr(RTL_CONSTASCII_USTRINGPARAM("referenceString")); + rtl::OUString refStr("referenceString"); char const * pAscii = "reference"; sal_Int32 value = rtl_ustr_ascii_compare_WithLength(refStr.pData->buffer, refStr.pData->length, pAscii); @@ -950,7 +950,7 @@ namespace rtl_ustr void equal_ascii_shorter_asciiLength() { - rtl::OUString refStr(RTL_CONSTASCII_USTRINGPARAM("referenceString")); + rtl::OUString refStr("referenceString"); char const * pAscii = "reference"; sal_Int32 value = rtl_ustr_ascii_compare_WithLength(refStr.pData->buffer, rtl_str_getLength(pAscii), pAscii); @@ -959,7 +959,7 @@ namespace rtl_ustr void equal_ref_shorter() { - rtl::OUString refStr(RTL_CONSTASCII_USTRINGPARAM("reference")); + rtl::OUString refStr("reference"); char const * pAscii = "referenceString"; sal_Int32 value = rtl_ustr_ascii_compare_WithLength(refStr.pData->buffer, refStr.pData->length, pAscii); @@ -968,7 +968,7 @@ namespace rtl_ustr void equal() { - rtl::OUString refStr(RTL_CONSTASCII_USTRINGPARAM("reference")); + rtl::OUString refStr("reference"); char const * pAscii = "reference"; sal_Int32 value = rtl_ustr_ascii_compare_WithLength(refStr.pData->buffer, refStr.pData->length, pAscii); @@ -977,7 +977,7 @@ namespace rtl_ustr void unequal_reference_bigger() { - rtl::OUString refStr(RTL_CONSTASCII_USTRINGPARAM("defghi")); + rtl::OUString refStr("defghi"); char const * pAscii = "abc"; sal_Int32 value = rtl_ustr_ascii_compare_WithLength(refStr.pData->buffer, refStr.pData->length, pAscii); @@ -986,7 +986,7 @@ namespace rtl_ustr void unequal_ascii_bigger() { - rtl::OUString refStr(RTL_CONSTASCII_USTRINGPARAM("abc")); + rtl::OUString refStr("abc"); char const * pAscii = "defghi"; sal_Int32 value = rtl_ustr_ascii_compare_WithLength(refStr.pData->buffer, refStr.pData->length, pAscii); @@ -1020,13 +1020,13 @@ namespace rtl_ustr void ascii_shortenedCompareIgnoreAsciiCase_WithLength_000_1() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString aStr1("Line must be equal."); rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), aStr1.getLength(), NULL, 0); // should not GPF } void ascii_shortenedCompareIgnoreAsciiCase_WithLength_000_2() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString aStr1("Line must be equal."); rtl::OString sStr2 = "Line is shorter."; rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( aStr1.getStr(), sStr2.getLength(), sStr2.getStr(), 0); // should not GPF @@ -1042,7 +1042,7 @@ namespace rtl_ustr void ascii_shortenedCompareIgnoreAsciiCase_WithLength_002() { - rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString suStr1("Line must be equal."); rtl::OString sStr2 = "Line must be equal."; sal_Int32 nValue = rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( suStr1.getStr(), suStr1.getLength(), sStr2.getStr(), sStr2.getLength()); @@ -1051,7 +1051,7 @@ namespace rtl_ustr void ascii_shortenedCompareIgnoreAsciiCase_WithLength_003() { - rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ.")); + rtl::OUString suStr1("Line must differ."); rtl::OString sStr2 = "Line must be differ and longer."; sal_Int32 nValue = rtl_ustr_ascii_shortenedCompareIgnoreAsciiCase_WithLength( suStr1.getStr(), suStr1.getLength(), sStr2.getStr(), sStr2.getLength()); @@ -1086,13 +1086,13 @@ namespace rtl_ustr void ascii_compareIgnoreAsciiCase_WithLength_000_1() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString aStr1("Line must be equal."); rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( aStr1.getStr(), 0, NULL); // should not GPF } void ascii_compareIgnoreAsciiCase_WithLength_000_2() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString aStr1("Line must be equal."); rtl::OString sStr2 = "Line is shorter."; rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( aStr1.getStr(), sStr2.getLength(), sStr2.getStr()); // should not GPF @@ -1108,7 +1108,7 @@ namespace rtl_ustr void ascii_compareIgnoreAsciiCase_WithLength_002() { - rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString suStr1("Line must be equal."); rtl::OString sStr2 = "Line must be equal."; sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( suStr1.getStr(), suStr1.getLength(), sStr2.getStr()); @@ -1117,7 +1117,7 @@ namespace rtl_ustr void ascii_compareIgnoreAsciiCase_WithLength_003() { - rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ.")); + rtl::OUString suStr1("Line must differ."); rtl::OString sStr2 = "Line must be differ and longer."; sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( suStr1.getStr(), suStr1.getLength(), sStr2.getStr()); @@ -1152,7 +1152,7 @@ namespace rtl_ustr void ascii_compare_000_1() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString aStr1("Line must be equal."); rtl_ustr_ascii_compare( aStr1.getStr(), NULL); // should not GPF } @@ -1167,7 +1167,7 @@ namespace rtl_ustr void ascii_compare_002() { - rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString suStr1("Line must be equal."); rtl::OString sStr2 = "Line must be equal."; sal_Int32 nValue = rtl_ustr_ascii_compare( suStr1.getStr(), sStr2.getStr()); @@ -1176,7 +1176,7 @@ namespace rtl_ustr void ascii_compare_003() { - rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ.")); + rtl::OUString suStr1("Line must differ."); rtl::OString sStr2 = "Line foo bar, ok, differ."; sal_Int32 nValue = rtl_ustr_ascii_compare( suStr1.getStr(), sStr2.getStr()); @@ -1210,7 +1210,7 @@ namespace rtl_ustr void ascii_compareIgnoreAsciiCase_000_1() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString aStr1("Line must be equal."); rtl_ustr_ascii_compareIgnoreAsciiCase( aStr1.getStr(), NULL); // should not GPF } @@ -1225,7 +1225,7 @@ namespace rtl_ustr void ascii_compareIgnoreAsciiCase_002() { - rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString suStr1("Line must be equal."); rtl::OString sStr2 = "Line must be equal."; sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase( suStr1.getStr(), sStr2.getStr()); @@ -1234,7 +1234,7 @@ namespace rtl_ustr void ascii_compareIgnoreAsciiCase_002_1() { - rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal, when ignore case.")); + rtl::OUString suStr1("Line must be equal, when ignore case."); rtl::OString sStr2 = "LINE MUST BE EQUAL, WHEN IGNORE CASE."; sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase( suStr1.getStr(), sStr2.getStr()); @@ -1243,7 +1243,7 @@ namespace rtl_ustr void ascii_compareIgnoreAsciiCase_003() { - rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ.")); + rtl::OUString suStr1("Line must differ."); rtl::OString sStr2 = "Line foo bar, ok, differ."; sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase( suStr1.getStr(), sStr2.getStr()); @@ -1254,8 +1254,8 @@ namespace rtl_ustr // void ascii_compareIgnoreAsciiCase_001() // { - // rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("change this to ascii upper case.")); - // rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("CHANGE THIS TO ASCII UPPER CASE.")); + // rtl::OUString suStr1("change this to ascii upper case."); + // rtl::OUString aShouldStr1("CHANGE THIS TO ASCII UPPER CASE."); // // sal_uInt32 nLength = suStr1.getLength() * sizeof(sal_Unicode); // sal_Unicode* pStr = (sal_Unicode*) malloc(nLength + sizeof(sal_Unicode)); // length + null terminator @@ -1308,7 +1308,7 @@ namespace rtl_ustr void ascii_compareIgnoreAsciiCase_000_1() { - rtl::OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString aStr1("Line must be equal."); rtl_ustr_ascii_compareIgnoreAsciiCase( aStr1.getStr(), NULL); // should not GPF } @@ -1323,7 +1323,7 @@ namespace rtl_ustr void ascii_compareIgnoreAsciiCase_002() { - rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal.")); + rtl::OUString suStr1("Line must be equal."); rtl::OString sStr2 = "Line must be equal."; sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase( suStr1.getStr(), sStr2.getStr()); @@ -1332,7 +1332,7 @@ namespace rtl_ustr void ascii_compareIgnoreAsciiCase_002_1() { - rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must be equal, when ignore case.")); + rtl::OUString suStr1("Line must be equal, when ignore case."); rtl::OString sStr2 = "LINE MUST BE EQUAL, WHEN IGNORE CASE."; sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase( suStr1.getStr(), sStr2.getStr()); @@ -1341,7 +1341,7 @@ namespace rtl_ustr void ascii_compareIgnoreAsciiCase_003() { - rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("Line must differ.")); + rtl::OUString suStr1("Line must differ."); rtl::OString sStr2 = "Line foo bar, ok, differ."; sal_Int32 nValue = rtl_ustr_ascii_compareIgnoreAsciiCase( suStr1.getStr(), sStr2.getStr()); @@ -1352,8 +1352,8 @@ namespace rtl_ustr // void ascii_compareIgnoreAsciiCase_001() // { - // rtl::OUString suStr1(RTL_CONSTASCII_USTRINGPARAM("change this to ascii upper case.")); - // rtl::OUString aShouldStr1(RTL_CONSTASCII_USTRINGPARAM("CHANGE THIS TO ASCII UPPER CASE.")); + // rtl::OUString suStr1("change this to ascii upper case."); + // rtl::OUString aShouldStr1("CHANGE THIS TO ASCII UPPER CASE."); // // sal_uInt32 nLength = suStr1.getLength() * sizeof(sal_Unicode); // sal_Unicode* pStr = (sal_Unicode*) malloc(nLength + sizeof(sal_Unicode)); // length + null terminator diff --git a/sal/qa/rtl/process/rtl_Process.cxx b/sal/qa/rtl/process/rtl_Process.cxx index 144dd8d0205a..4f91fa03731a 100644 --- a/sal/qa/rtl/process/rtl_Process.cxx +++ b/sal/qa/rtl/process/rtl_Process.cxx @@ -70,7 +70,7 @@ inline ::rtl::OUString getModulePath( void ) printUString(suDirPath, "modulePath:"); suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') ); suDirPath = suDirPath.copy( 0, suDirPath.lastIndexOf('/') + 1); - suDirPath += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bin")); + suDirPath += rtl::OUString("bin"); return suDirPath; } @@ -93,9 +93,9 @@ public: void getAppCommandArg_001() { #if defined(WNT) - const rtl::OUString EXECUTABLE_NAME(RTL_CONSTASCII_USTRINGPARAM("child_process.exe")); + const rtl::OUString EXECUTABLE_NAME("child_process.exe"); #else - const rtl::OUString EXECUTABLE_NAME(RTL_CONSTASCII_USTRINGPARAM("child_process")); + const rtl::OUString EXECUTABLE_NAME("child_process"); #endif rtl::OUString suCWD = getModulePath(); // rtl::OUString suCWD2 = getExecutableDirectory(); @@ -114,7 +114,7 @@ public: pParameters[3] = suParam3.pData; rtl::OUString suFileURL = suCWD; - suFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); + suFileURL += rtl::OUString("/"); suFileURL += EXECUTABLE_NAME; oslProcessError osl_error = osl_executeProcess( @@ -230,9 +230,9 @@ public: void getGlobalProcessId_002() { #if defined(WNT) - const rtl::OUString EXEC_NAME(RTL_CONSTASCII_USTRINGPARAM("child_process_id.exe")); + const rtl::OUString EXEC_NAME("child_process_id.exe"); #else - const rtl::OUString EXEC_NAME(RTL_CONSTASCII_USTRINGPARAM("child_process_id")); + const rtl::OUString EXEC_NAME("child_process_id"); #endif sal_uInt8 pTargetUUID1[16]; rtl_getGlobalProcessId( pTargetUUID1 ); @@ -244,7 +244,7 @@ public: rtl::OUString suCWD = getModulePath(); oslProcess hProcess = NULL; rtl::OUString suFileURL = suCWD; - suFileURL += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); + suFileURL += rtl::OUString("/"); suFileURL += EXEC_NAME; oslFileHandle* pChildOutputRead = new oslFileHandle(); oslProcessError osl_error = osl_executeProcess_WithRedirectedIO( diff --git a/sal/qa/rtl/uri/rtl_Uri.cxx b/sal/qa/rtl/uri/rtl_Uri.cxx index 7a17d85bffef..1799e6f3c79c 100644 --- a/sal/qa/rtl/uri/rtl_Uri.cxx +++ b/sal/qa/rtl/uri/rtl_Uri.cxx @@ -222,9 +222,9 @@ namespace Stringtest void test_UTF8_files() { #ifdef UNX - rtl::OUString suDirURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///tmp/atestdir"))); + rtl::OUString suDirURL(rtl::OUString("file:///tmp/atestdir")); #else /* Windows */ - rtl::OUString suDirURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///c:/temp/atestdir"))); + rtl::OUString suDirURL(rtl::OUString("file:///c:/temp/atestdir")); #endif osl::Directory aDir(suDirURL); aDir.open(); diff --git a/sal/qa/rtl_strings/rtl_old_testowstring.cxx b/sal/qa/rtl_strings/rtl_old_testowstring.cxx index 4d4eb686dda4..fa2f2ec827ed 100644 --- a/sal/qa/rtl_strings/rtl_old_testowstring.cxx +++ b/sal/qa/rtl_strings/rtl_old_testowstring.cxx @@ -72,14 +72,14 @@ void oldtests::test_OUString() // "Mein erster RTL OUString\n" // | | | | | // Index 0 5 10 15 20 - OUString s1(OUString(RTL_CONSTASCII_USTRINGPARAM("Mein erster RTL OUString\n"))); - TEST_ENSURE( s1 == OUString(RTL_CONSTASCII_USTRINGPARAM("Mein erster RTL OUString\n")), "test_OWString error 1"); + OUString s1(OUString("Mein erster RTL OUString\n")); + TEST_ENSURE( s1 == OUString("Mein erster RTL OUString\n"), "test_OWString error 1"); TEST_ENSURE( s1.getLength() == 25, "test_OWString error 2"); OUString s2 = s1; TEST_ENSURE( s2[16] == (sal_Unicode)'O', "test_OWString error 3"); TEST_ENSURE( s2.equals(s1), "test_OWString error 4"); - TEST_ENSURE( OUString( OUString(RTL_CONSTASCII_USTRINGPARAM("hallo"))) == OUString(RTL_CONSTASCII_USTRINGPARAM("hallo")), "test_OWString error 4"); + TEST_ENSURE( OUString( OUString("hallo")) == OUString("hallo"), "test_OWString error 4"); TEST_ENSURE( s2.indexOf((sal_Unicode)'O') == 16, "test_OWString error 5"); TEST_ENSURE( s2.indexOf((sal_Unicode)'O', 5) == 16, "test_OWString error 5a"); TEST_ENSURE( s2.lastIndexOf((sal_Unicode)'r') == 20, "test_OWString error 6"); @@ -94,24 +94,24 @@ void oldtests::test_OUString() // | | | | | | | | | | | | // Index 0 5 10 15 20 25 30 35 40 45 50 55 OUString s3 = s2.copy(0, s2.getLength() - 1); - OUString s4 = s3.concat( OUString(RTL_CONSTASCII_USTRINGPARAM(" ist ein String aus der RTL Library\n")) ); + OUString s4 = s3.concat( OUString(" ist ein String aus der RTL Library\n") ); TEST_ENSURE( s4.getLength() == 60, "test_OWString error 11"); s1 = s4.copy(0, 39); OUString s5; - s5 = s1 + OUString(RTL_CONSTASCII_USTRINGPARAM(" aus der RTL Library\n")); + s5 = s1 + OUString(" aus der RTL Library\n"); TEST_ENSURE( s5.compareTo(s4) == 0 , "test_OWString error 12"); - TEST_ENSURE( s5.indexOf(OUString(RTL_CONSTASCII_USTRINGPARAM("RTL"))) == 12, "test_OWString error 13"); - TEST_ENSURE( s5.lastIndexOf(OUString(RTL_CONSTASCII_USTRINGPARAM("RTL"))) == 48, "test_OWString error 13"); + TEST_ENSURE( s5.indexOf(OUString("RTL")) == 12, "test_OWString error 13"); + TEST_ENSURE( s5.lastIndexOf(OUString("RTL")) == 48, "test_OWString error 13"); sal_Bool b = sal_False; OUString s6 = s5.valueOf(b); -// TEST_ENSURE( s6.compareTo(OUString(RTL_CONSTASCII_USTRINGPARAM("False"))) == 0, "test_OWString error 14"); +// TEST_ENSURE( s6.compareTo(OUString("False")) == 0, "test_OWString error 14"); s6 = s5.valueOf((sal_Unicode)'H'); - TEST_ENSURE( s6.compareTo(OUString(RTL_CONSTASCII_USTRINGPARAM("H"))) == 0, "test_OWString error 15"); + TEST_ENSURE( s6.compareTo(OUString("H")) == 0, "test_OWString error 15"); sal_Int32 n = 123456789L; s6 = s5.valueOf(n); - TEST_ENSURE( s6.compareTo(OUString(RTL_CONSTASCII_USTRINGPARAM("123456789"))) == 0, "test_OWString error 16"); + TEST_ENSURE( s6.compareTo(OUString("123456789")) == 0, "test_OWString error 16"); #ifdef SAL_UNX sal_Int64 m = -3223372036854775807LL; @@ -119,64 +119,64 @@ void oldtests::test_OUString() sal_Int64 m = -3223372036854775807; #endif s6 = s5.valueOf(m); - TEST_ENSURE( s6.compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("-3223372036854775807")) ) == 0, "test_OWString error 17"); + TEST_ENSURE( s6.compareTo( OUString("-3223372036854775807") ) == 0, "test_OWString error 17"); OUString s7; - OUString s8(OUString(RTL_CONSTASCII_USTRINGPARAM("HALLO ICH BIN EIN SS"))); - s7 = OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); - s8 = s7 + s8 + OUString(RTL_CONSTASCII_USTRINGPARAM(" ")); - TEST_ENSURE( s8 == OUString(RTL_CONSTASCII_USTRINGPARAM(" HALLO ICH BIN EIN SS ")), + OUString s8(OUString("HALLO ICH BIN EIN SS")); + s7 = OUString(" "); + s8 = s7 + s8 + OUString(" "); + TEST_ENSURE( s8 == OUString(" HALLO ICH BIN EIN SS "), "test_OWString error 22"); s7 = s8.trim(); - TEST_ENSURE( s7 == OUString(RTL_CONSTASCII_USTRINGPARAM("HALLO ICH BIN EIN SS")), "test_OWString error 23"); + TEST_ENSURE( s7 == OUString("HALLO ICH BIN EIN SS"), "test_OWString error 23"); - s7 = OUString(RTL_CONSTASCII_USTRINGPARAM("Hallo")); - s8 = OUString(RTL_CONSTASCII_USTRINGPARAM("aber Hallo")); + s7 = OUString("Hallo"); + s8 = OUString("aber Hallo"); TEST_ENSURE( s7 < s8, "test_OWString error 25"); TEST_ENSURE( s8 > s7, "test_OWString error 26"); TEST_ENSURE( s7 != s8, "test_OWString error 27"); - TEST_ENSURE( s7 != OUString(RTL_CONSTASCII_USTRINGPARAM("blabla")), "test_OWString error 28"); - TEST_ENSURE( OUString(RTL_CONSTASCII_USTRINGPARAM("blabla")) != s7, "test_OWString error 29"); + TEST_ENSURE( s7 != OUString("blabla"), "test_OWString error 28"); + TEST_ENSURE( OUString("blabla") != s7, "test_OWString error 29"); - s8 = OUString(RTL_CONSTASCII_USTRINGPARAM("Hallo")); + s8 = OUString("Hallo"); TEST_ENSURE( s7 <= s8, "test_OWString error 30"); TEST_ENSURE( s7 >= s8, "test_OwString error 31"); s8 = s8.replace((sal_Unicode)'l', (sal_Unicode)'r'); - TEST_ENSURE( s8 == OUString(RTL_CONSTASCII_USTRINGPARAM("Harro")), "test_OWString error 32"); + TEST_ENSURE( s8 == OUString("Harro"), "test_OWString error 32"); // "Ich bin ein String mit einem A und C und vielen m, m, m, m" // | | | | | | | | | | | | //index 0 5 10 15 20 25 30 35 40 45 50 55 - s8 = OUString(RTL_CONSTASCII_USTRINGPARAM("Ich bin ein String mit einem A und C und vielen m, m, m, m")); - - TEST_ENSURE( OUString(RTL_CONSTASCII_USTRINGPARAM("aaa")).compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("bbb")) ) < 0, "test_OWString error 46" ); - TEST_ENSURE( OUString(RTL_CONSTASCII_USTRINGPARAM("aaa")).compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("aaa")) ) == 0, "test_OWString error 46" ); - TEST_ENSURE( OUString(RTL_CONSTASCII_USTRINGPARAM("bbb")).compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("aaa")) ) > 0, "test_OWString error 47" ); - TEST_ENSURE( OUString(RTL_CONSTASCII_USTRINGPARAM("aaaa")).compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("bbb")) ) < 0, "test_OWString error 48" ); - TEST_ENSURE( OUString(RTL_CONSTASCII_USTRINGPARAM("aaa")).compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("bbbb")) ) < 0, "test_OWString error 49" ); - TEST_ENSURE( OUString(RTL_CONSTASCII_USTRINGPARAM("aaa")).compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("aaaa")) ) < 0, "test_OWString error 50" ); - TEST_ENSURE( OUString(RTL_CONSTASCII_USTRINGPARAM("aaaa")).compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("aaa")) ) > 0, "test_OWString error 51" ); - TEST_ENSURE( OUString(RTL_CONSTASCII_USTRINGPARAM("bbbb")).compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("bbb")) ) > 0, "test_OWString error 52" ); - TEST_ENSURE( OUString(RTL_CONSTASCII_USTRINGPARAM("bbb")) == OUString(RTL_CONSTASCII_USTRINGPARAM("bbb")), "test_OWString error 53" ); - TEST_ENSURE( OUString(RTL_CONSTASCII_USTRINGPARAM("bbb")) == OUString(RTL_CONSTASCII_USTRINGPARAM("bbb")), "test_OWString error 54" ); + s8 = OUString("Ich bin ein String mit einem A und C und vielen m, m, m, m"); + + TEST_ENSURE( OUString("aaa").compareTo( OUString("bbb") ) < 0, "test_OWString error 46" ); + TEST_ENSURE( OUString("aaa").compareTo( OUString("aaa") ) == 0, "test_OWString error 46" ); + TEST_ENSURE( OUString("bbb").compareTo( OUString("aaa") ) > 0, "test_OWString error 47" ); + TEST_ENSURE( OUString("aaaa").compareTo( OUString("bbb") ) < 0, "test_OWString error 48" ); + TEST_ENSURE( OUString("aaa").compareTo( OUString("bbbb") ) < 0, "test_OWString error 49" ); + TEST_ENSURE( OUString("aaa").compareTo( OUString("aaaa") ) < 0, "test_OWString error 50" ); + TEST_ENSURE( OUString("aaaa").compareTo( OUString("aaa") ) > 0, "test_OWString error 51" ); + TEST_ENSURE( OUString("bbbb").compareTo( OUString("bbb") ) > 0, "test_OWString error 52" ); + TEST_ENSURE( OUString("bbb") == OUString("bbb"), "test_OWString error 53" ); + TEST_ENSURE( OUString("bbb") == OUString("bbb"), "test_OWString error 54" ); { - OUString uStr = OUString(RTL_CONSTASCII_USTRINGPARAM("Hallo")); - TEST_ENSURE( uStr.compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("Hallo")), 5 ) == 0, "test_OWString error 54.2.1" ); - TEST_ENSURE( uStr.compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("Halloa")), 6 ) < 0 , "test_OWString error 54.2.2" ); - TEST_ENSURE( uStr.compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("1Hallo")), 6 ) > 0, "test_OWString error 54.2.3" ); - TEST_ENSURE( uStr.compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("Aallo")), 5 ) > 0, "test_OWString error 54.2.4" ); - TEST_ENSURE( uStr.compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("Halla")), 5 ) > 0, "test_OWString error 54.2.5" ); - TEST_ENSURE( uStr.compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("Mallo")), 5 ) < 0, "test_OWString error 54.2.6" ); - TEST_ENSURE( uStr.compareTo( OUString(RTL_CONSTASCII_USTRINGPARAM("Hallp")), 5 ) < 0, "test_OWString error 54.2.7" ); + OUString uStr = OUString("Hallo"); + TEST_ENSURE( uStr.compareTo( OUString("Hallo"), 5 ) == 0, "test_OWString error 54.2.1" ); + TEST_ENSURE( uStr.compareTo( OUString("Halloa"), 6 ) < 0 , "test_OWString error 54.2.2" ); + TEST_ENSURE( uStr.compareTo( OUString("1Hallo"), 6 ) > 0, "test_OWString error 54.2.3" ); + TEST_ENSURE( uStr.compareTo( OUString("Aallo"), 5 ) > 0, "test_OWString error 54.2.4" ); + TEST_ENSURE( uStr.compareTo( OUString("Halla"), 5 ) > 0, "test_OWString error 54.2.5" ); + TEST_ENSURE( uStr.compareTo( OUString("Mallo"), 5 ) < 0, "test_OWString error 54.2.6" ); + TEST_ENSURE( uStr.compareTo( OUString("Hallp"), 5 ) < 0, "test_OWString error 54.2.7" ); } #if OSL_DEBUG_LEVEL == 0 //YD will fail copy assert on indexes, because ':' returns -1 - s7 = OUString(RTL_CONSTASCII_USTRINGPARAM("Hallo jetzt komm ich")); + s7 = OUString("Hallo jetzt komm ich"); s8 = s7.copy(0, s7.indexOf((sal_Unicode)':')); TEST_ENSURE( s8.getLength() == 0, "test_OWString error 55"); TEST_ENSURE( s8.compareTo(OUString()) == 0, "test_OWString error 56"); @@ -221,7 +221,7 @@ void oldtests::test_OUString() TEST_ENSURE( nCompareResult21_Len13 > 0, "test_OWString error 66" ); { - OUString uStr = OUString(RTL_CONSTASCII_USTRINGPARAM("Hallo")); + OUString uStr = OUString("Hallo"); TEST_ENSURE( uStr.equalsAsciiL( "Hallo", 5 ), "test_OWString error 66.1.1" ); TEST_ENSURE( !uStr.equalsAsciiL( "Hallo1", 6 ), "test_OWString error 66.1.2" ); TEST_ENSURE( !uStr.equalsAsciiL( "1Hallo", 6 ), "test_OWString error 66.1.3" ); @@ -238,14 +238,14 @@ void oldtests::test_OUString() } // toInt64 - OUString s9( OUString(RTL_CONSTASCII_USTRINGPARAM(" -3223372036854775807")) ); + OUString s9( OUString(" -3223372036854775807") ); sal_Int64 ln1 = s9.toInt64(); #if (defined UNX) TEST_ENSURE( ln1 == -3223372036854775807LL, "test_OWString error 67" ); #else TEST_ENSURE( ln1 == -3223372036854775807, "test_OWString error 67" ); #endif - OUString s10( OUString(RTL_CONSTASCII_USTRINGPARAM("13243A65f1H45")) ); + OUString s10( OUString("13243A65f1H45") ); sal_Int64 ln2 = s10.toInt64(); TEST_ENSURE( ln2 == 13243, "test_OWString error 68" ); @@ -256,16 +256,16 @@ void oldtests::test_OUString() TEST_ENSURE( ln3 == 0x13243A65F1, "test_OWString error 69" ); #endif // Exotic base - OUString s11( OUString(RTL_CONSTASCII_USTRINGPARAM("H4A")) ); + OUString s11( OUString("H4A") ); sal_Int64 ln4 = s11.toInt64( 23 ); TEST_ENSURE( ln4 == 23*23*17 + 4 * 23 + 10, "test_OWString error 70" ); // toInt32 - OUString s12( OUString(RTL_CONSTASCII_USTRINGPARAM(" -220368507")) ); + OUString s12( OUString(" -220368507") ); sal_Int32 n1 = s12.toInt32(); TEST_ENSURE( n1 == -220368507, "test_OWString error 71" ); - OUString s13( OUString(RTL_CONSTASCII_USTRINGPARAM("4423A61H45")) ); + OUString s13( OUString("4423A61H45") ); sal_Int64 n2 = s13.toInt32(); TEST_ENSURE( n2 == 4423, "test_OWString error 72" ); diff --git a/sal/qa/rtl_strings/rtl_old_teststrbuf.cxx b/sal/qa/rtl_strings/rtl_old_teststrbuf.cxx index 1e0c812a0144..2fc54cb2367d 100644 --- a/sal/qa/rtl_strings/rtl_old_teststrbuf.cxx +++ b/sal/qa/rtl_strings/rtl_old_teststrbuf.cxx @@ -152,29 +152,29 @@ void oldtests::test_OUStringBuffer() // "Mein erster RTL OUString\n" // | | | | | // Index 0 5 10 15 20 - OUString s1(OUString(RTL_CONSTASCII_USTRINGPARAM("Mein erster RTL OUString\n"))); + OUString s1(OUString("Mein erster RTL OUString\n")); OUStringBuffer b1(s1); TEST_ENSURE( b1.getCapacity() == 16 + s1.getLength(), "test_OWStringBuffer error 1"); - b1.insert(b1.getLength() - 1, OUString(RTL_CONSTASCII_USTRINGPARAM("Buffer"))); - s1 = OUString(RTL_CONSTASCII_USTRINGPARAM("Mein erster RTL OUStringBuffer\n")); + b1.insert(b1.getLength() - 1, OUString("Buffer")); + s1 = OUString("Mein erster RTL OUStringBuffer\n"); TEST_ENSURE( s1 == b1.getStr(), "test_OWStringBuffer error 2"); - b1.insert(b1.getLength() - 1, OUString(RTL_CONSTASCII_USTRINGPARAM(" ist viel zu gross fuer den alten Buffer"))); + b1.insert(b1.getLength() - 1, OUString(" ist viel zu gross fuer den alten Buffer")); //TEST_ENSURE( b1.getCapacity() == b1.getLength(), "test_OWStringBuffer error 3"); OUStringBuffer b2(30); - s1 = OUString(RTL_CONSTASCII_USTRINGPARAM("false")); + s1 = OUString("false"); sal_Bool b = sal_False; b2.append(b); TEST_ENSURE( s1 == b2.getStr(), "test_OWStringBuffer error 4"); sal_Int32 n = 123456789L; - s1 += OUString(RTL_CONSTASCII_USTRINGPARAM(" 123456789")); - b2.append(OUString(RTL_CONSTASCII_USTRINGPARAM(" "))); + s1 += OUString(" 123456789"); + b2.append(OUString(" ")); b2.append(n); TEST_ENSURE( s1 == b2.getStr(), "test_OWStringBuffer error 5"); @@ -183,8 +183,8 @@ void oldtests::test_OUStringBuffer() #else sal_Int64 m = -3223372036854775807; #endif - s1 += OUString(RTL_CONSTASCII_USTRINGPARAM(" -3223372036854775807")); - b2.append(OUString(RTL_CONSTASCII_USTRINGPARAM(" "))); + s1 += OUString(" -3223372036854775807"); + b2.append(OUString(" ")); b2.append(m); TEST_ENSURE( s1 == b2.getStr(), "test_OWStringBuffer error 6"); @@ -194,32 +194,32 @@ void oldtests::test_OUStringBuffer() b2.ensureCapacity(50); TEST_ENSURE( b2.getCapacity() == 50, "test_OWStringBuffer error 8"); - b2.append(OUString(RTL_CONSTASCII_USTRINGPARAM("Hier fuege ich jetzt ein > <\n"))); - b2.insert(26, OUString(RTL_CONSTASCII_USTRINGPARAM(" Hallo"))); - s2 = OUString(RTL_CONSTASCII_USTRINGPARAM("Hier fuege ich jetzt ein > Hallo <\n")); + b2.append(OUString("Hier fuege ich jetzt ein > <\n")); + b2.insert(26, OUString(" Hallo")); + s2 = OUString("Hier fuege ich jetzt ein > Hallo <\n"); TEST_ENSURE( s2 == b2.getStr(), "test_OWStringBuffer error 9"); b2.insert(26, b); - b2.insert(26, OUString(RTL_CONSTASCII_USTRINGPARAM(" "))); - s2 = OUString(RTL_CONSTASCII_USTRINGPARAM("Hier fuege ich jetzt ein > false Hallo <\n")); + b2.insert(26, OUString(" ")); + s2 = OUString("Hier fuege ich jetzt ein > false Hallo <\n"); TEST_ENSURE( s2 == b2.getStr(), "test_OWStringBuffer error 10"); b2.insert(26, n); - b2.insert(26, OUString(RTL_CONSTASCII_USTRINGPARAM(" "))); - s2 = OUString(RTL_CONSTASCII_USTRINGPARAM("Hier fuege ich jetzt ein > 123456789 false Hallo <\n")); + b2.insert(26, OUString(" ")); + s2 = OUString("Hier fuege ich jetzt ein > 123456789 false Hallo <\n"); TEST_ENSURE( s2 == b2.getStr(), "test_OWStringBuffer error 11"); b2.insert(26, m); - b2.insert(26, OUString(RTL_CONSTASCII_USTRINGPARAM(" "))); - s2 = OUString(RTL_CONSTASCII_USTRINGPARAM("Hier fuege ich jetzt ein > -3223372036854775807 123456789 false Hallo <\n")); + b2.insert(26, OUString(" ")); + s2 = OUString("Hier fuege ich jetzt ein > -3223372036854775807 123456789 false Hallo <\n"); TEST_ENSURE( s2 == b2.getStr(), "test_OWStringBuffer error 12"); // ASCII-Schnittstelle, AB 15.10.1999 - OUString s3(OUString(RTL_CONSTASCII_USTRINGPARAM("Noch'n RTL OUString"))); + OUString s3(OUString("Noch'n RTL OUString")); OUStringBuffer b3(s3); sal_Char aAsciiStr[] = " mit appendetem ASCII\n"; b3.appendAscii( aAsciiStr ); - s3 = OUString(RTL_CONSTASCII_USTRINGPARAM("Noch'n RTL OUString mit appendetem ASCII\n")); + s3 = OUString("Noch'n RTL OUString mit appendetem ASCII\n"); TEST_ENSURE( b3.getStr() == s3 , "test_OWStringBuffer error 13"); diff --git a/sal/qa/testHelperFunctions/testHelperFunctions.cxx b/sal/qa/testHelperFunctions/testHelperFunctions.cxx index 7cc6edef9dd4..b7781c33c49b 100644 --- a/sal/qa/testHelperFunctions/testHelperFunctions.cxx +++ b/sal/qa/testHelperFunctions/testHelperFunctions.cxx @@ -214,7 +214,7 @@ namespace testOfHelperFunctions rtl::OString sValue("foo bar"); t_print("a String '%s' (should be 'foo bar')\n", sValue.getStr()); - rtl::OUString suValue(RTL_CONSTASCII_USTRINGPARAM("a unicode string")); + rtl::OUString suValue("a unicode string"); sValue <<= suValue; t_print("a String '%s'\n", sValue.getStr()); } diff --git a/sal/qa/testHelperFunctions/testHelperFunctions2.cxx b/sal/qa/testHelperFunctions/testHelperFunctions2.cxx index c4db0883b1ac..b6610f632c09 100644 --- a/sal/qa/testHelperFunctions/testHelperFunctions2.cxx +++ b/sal/qa/testHelperFunctions/testHelperFunctions2.cxx @@ -45,7 +45,7 @@ namespace testOfHelperFunctions void test_valueequal::valueequal_001( ) { rtl::OString sValue; - rtl::OUString suValue(RTL_CONSTASCII_USTRINGPARAM("This is only a test of some helper functions")); + rtl::OUString suValue("This is only a test of some helper functions"); sValue <<= suValue; t_print("'%s'\n", sValue.getStr()); } diff --git a/sal/workben/getlocaleinfotest.cxx b/sal/workben/getlocaleinfotest.cxx index 1cb0f446ef4d..d6affcb7aac4 100644 --- a/sal/workben/getlocaleinfotest.cxx +++ b/sal/workben/getlocaleinfotest.cxx @@ -33,8 +33,8 @@ int _cdecl main( int argc, char * argv[] ) { - rtl::OUString lang(RTL_CONSTASCII_USTRINGPARAM("de")); - rtl::OUString country(RTL_CONSTASCII_USTRINGPARAM("DE")); + rtl::OUString lang("de"); + rtl::OUString country("DE"); rtl_TextEncoding rtlTextEnc; rtl_Locale* rtlLocale = diff --git a/sal/workben/testfile.cxx b/sal/workben/testfile.cxx index 9554c0fa6c9e..0ec2fe9600c3 100644 --- a/sal/workben/testfile.cxx +++ b/sal/workben/testfile.cxx @@ -161,7 +161,7 @@ sal_Bool Initialize( void ) iniFileURL=rtl::OUString( rtl_uString_getStr(strExeFileURL) ,(int) (pExeFileCount-rtl_uString_getStr(strExeFileURL)) ); // add "/testfile.ini" to iniFileURL - iniFileURL+=rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/testfile.ini")); + iniFileURL+=rtl::OUString("/testfile.ini"); // Open the ini-File pFile=new File( iniFileURL ); @@ -904,7 +904,7 @@ void FileCopyAndMoveTest( void ) // FileCopyTest //-------------------------------------------------- - destPath+=rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); + destPath+=rtl::OUString("/"); destPath+=file3; printf( "Copy the file "); @@ -938,7 +938,7 @@ void FileCopyAndMoveTest( void ) //-------------------------------------------------- destPath=rtl::OUString( dir_not_exist ); - destPath+=rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); + destPath+=rtl::OUString("/"); destPath+=file3; printf( "Copy a file to a not existing directory \n"); @@ -971,7 +971,7 @@ void FileCopyAndMoveTest( void ) //-------------------------------------------------- destPath=rtl::OUString( dir2 ); - destPath+=rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); + destPath+=rtl::OUString("/"); destPath+=file3; printf( "Move the file "); @@ -1020,7 +1020,7 @@ void FileCopyAndMoveTest( void ) //-------------------------------------------------- destPath=rtl::OUString( dir_not_exist ); - destPath+=rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); + destPath+=rtl::OUString("/"); destPath+=file3; printf( "Move a file to a not existing directory: \n"); @@ -2300,15 +2300,15 @@ void AbsolutePathTest(void) printf( "AbsolutePath-Test\n" ); printf( "--------------------------------------------\n\n" ); - DoAbsolutePathTest(dir1, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("."))); - DoAbsolutePathTest(dir1, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".."))); - DoAbsolutePathTest(dir1, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("../.."))); - DoAbsolutePathTest(dir1, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("../HUHU"))); + DoAbsolutePathTest(dir1, rtl::OUString(".")); + DoAbsolutePathTest(dir1, rtl::OUString("..")); + DoAbsolutePathTest(dir1, rtl::OUString("../..")); + DoAbsolutePathTest(dir1, rtl::OUString("../HUHU")); - DoAbsolutePathTest(dir_on_server, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("."))); - DoAbsolutePathTest(dir_on_server, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".."))); - DoAbsolutePathTest(dir_on_server, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("../.."))); - DoAbsolutePathTest(dir_on_server, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("../HUHU"))); + DoAbsolutePathTest(dir_on_server, rtl::OUString(".")); + DoAbsolutePathTest(dir_on_server, rtl::OUString("..")); + DoAbsolutePathTest(dir_on_server, rtl::OUString("../..")); + DoAbsolutePathTest(dir_on_server, rtl::OUString("../HUHU")); PressKey(); return; @@ -2418,7 +2418,7 @@ void SearchPathTest(void) printFileName( file3 ); printf( "\n" ); - rc=FileBase::searchFileURL( file3 , rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")) , strResultPath ); + rc=FileBase::searchFileURL( file3 , rtl::OUString("") , strResultPath ); if ( rc == FileBase::E_None ) { @@ -2455,7 +2455,7 @@ void SearchPathTest(void) //------------------------------------------------------------ rtl::OUString strSearchPath( dir_not_exist ); - strSearchPath+=rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(";")); + strSearchPath+=rtl::OUString(";"); strSearchPath+=dir_on_server; printf( "\nsearchFileURL: File : "); |