[PATCH] Remove STRINGPARAM in tools (qa)

Christina Roßmanith (via_Code_Review) gerrit at gerrit.libreoffice.org
Sat Mar 16 02:52:43 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2768

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/68/2768/1

Remove STRINGPARAM in tools (qa)

Change-Id: I1bff00d261c24e37f9ed41322c49c670850a940f
---
M tools/qa/cppunit/test_stream.cxx
M tools/qa/cppunit/test_urlobj.cxx
2 files changed, 28 insertions(+), 37 deletions(-)



diff --git a/tools/qa/cppunit/test_stream.cxx b/tools/qa/cppunit/test_stream.cxx
index b0aeb03..894ad7d 100644
--- a/tools/qa/cppunit/test_stream.cxx
+++ b/tools/qa/cppunit/test_stream.cxx
@@ -61,7 +61,7 @@
     {
         char foo[] = "foo";
         std::istringstream iss(foo, std::istringstream::in);
-        SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ);
+        SvMemoryStream aMemStream((void *) foo, strlen(foo), STREAM_READ);
 
         char std_a(78);
         iss >> std_a;
@@ -152,13 +152,13 @@
     void Test::test_fastostring()
     {
         char foo[] = "foobar";
-        SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ);
+        SvMemoryStream aMemStream((void *) foo, strlen(foo), STREAM_READ);
 
         rtl::OString aOne = read_uInt8s_ToOString(aMemStream, 3);
-        CPPUNIT_ASSERT(aOne.equalsL(RTL_CONSTASCII_STRINGPARAM("foo")));
+        CPPUNIT_ASSERT(aOne == "foo");
 
         rtl::OString aTwo = read_uInt8s_ToOString(aMemStream, 3);
-        CPPUNIT_ASSERT(aTwo.equalsL(RTL_CONSTASCII_STRINGPARAM("bar")));
+        CPPUNIT_ASSERT(aTwo == "bar");
 
         rtl::OString aThree = read_uInt8s_ToOString(aMemStream, 3);
         CPPUNIT_ASSERT(aThree.isEmpty());
@@ -166,16 +166,16 @@
         aMemStream.Seek(0);
 
         rtl::OString aFour = read_uInt8s_ToOString(aMemStream, 100);
-        CPPUNIT_ASSERT(aFour.equalsL(RTL_CONSTASCII_STRINGPARAM(foo)));
+        CPPUNIT_ASSERT(aFour == foo);
     }
 
     void Test::test_read_cstring()
     {
         char foo[] = "foobar";
-        SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ);
+        SvMemoryStream aMemStream((void *) foo, strlen(foo), STREAM_READ);
 
         rtl::OString aOne = read_zeroTerminated_uInt8s_ToOString(aMemStream);
-        CPPUNIT_ASSERT(aOne.equalsL(RTL_CONSTASCII_STRINGPARAM("foobar")));
+        CPPUNIT_ASSERT(aOne == "foobar");
         CPPUNIT_ASSERT(!aMemStream.good());
         CPPUNIT_ASSERT(!aMemStream.bad());
         CPPUNIT_ASSERT(aMemStream.eof());
@@ -183,17 +183,17 @@
         aMemStream.Seek(0);
         foo[3] = 0;
         rtl::OString aTwo = read_zeroTerminated_uInt8s_ToOString(aMemStream);
-        CPPUNIT_ASSERT(aTwo.equalsL(RTL_CONSTASCII_STRINGPARAM("foo")));
+        CPPUNIT_ASSERT(aTwo == "foo");
         CPPUNIT_ASSERT(aMemStream.good());
     }
 
     void Test::test_read_pstring()
     {
         char foo[] = "\3foobar";
-        SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ);
+        SvMemoryStream aMemStream((void *) foo, strlen(foo), STREAM_READ);
 
         rtl::OString aFoo = read_lenPrefixed_uInt8s_ToOString<sal_uInt8>(aMemStream);
-        CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("foo")));
+        CPPUNIT_ASSERT(aFoo == "foo");
         CPPUNIT_ASSERT(aMemStream.good());
         CPPUNIT_ASSERT(!aMemStream.bad());
         CPPUNIT_ASSERT(!aMemStream.eof());
@@ -201,7 +201,7 @@
         aMemStream.Seek(0);
         foo[0] = 10;
         aFoo = read_lenPrefixed_uInt8s_ToOString<sal_uInt8>(aMemStream);
-        CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("foobar")));
+        CPPUNIT_ASSERT(aFoo == "foobar");
         CPPUNIT_ASSERT(!aMemStream.good());
         CPPUNIT_ASSERT(!aMemStream.bad());
         CPPUNIT_ASSERT(aMemStream.eof());
@@ -211,7 +211,7 @@
         foo[0] = 0;
         foo[1] = 3;
         aFoo = read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(aMemStream);
-        CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("oob")));
+        CPPUNIT_ASSERT(aFoo == "oob");
         CPPUNIT_ASSERT(aMemStream.good());
         CPPUNIT_ASSERT(!aMemStream.bad());
         CPPUNIT_ASSERT(!aMemStream.eof());
@@ -223,7 +223,7 @@
         foo[2] = 0;
         foo[3] = 0;
         aFoo = read_lenPrefixed_uInt8s_ToOString<sal_uInt32>(aMemStream);
-        CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("bar")));
+        CPPUNIT_ASSERT(aFoo == "bar");
         CPPUNIT_ASSERT(aMemStream.good());
         CPPUNIT_ASSERT(!aMemStream.bad());
         CPPUNIT_ASSERT(!aMemStream.eof());
@@ -232,19 +232,19 @@
     void Test::test_readline()
     {
         char foo[] = "foo\nbar\n\n";
-        SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ);
+        SvMemoryStream aMemStream((void *) foo, strlen(foo), STREAM_READ);
 
         rtl::OString aFoo;
         sal_Bool bRet;
 
         bRet = aMemStream.ReadLine(aFoo);
         CPPUNIT_ASSERT(bRet);
-        CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("foo")));
+        CPPUNIT_ASSERT(aFoo == "foo");
         CPPUNIT_ASSERT(aMemStream.good());
 
         bRet = aMemStream.ReadLine(aFoo);
         CPPUNIT_ASSERT(bRet);
-        CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("bar")));
+        CPPUNIT_ASSERT(aFoo == "bar");
         CPPUNIT_ASSERT(aMemStream.good());
 
         bRet = aMemStream.ReadLine(aFoo);
@@ -265,7 +265,7 @@
         CPPUNIT_ASSERT(aFoo.getLength() == 7 && aFoo[3] == 0);
         CPPUNIT_ASSERT(aMemStream.good());
 
-        std::string sStr(RTL_CONSTASCII_STRINGPARAM(foo));
+        std::string sStr(foo, RTL_CONSTASCII_LENGTH(foo));
         std::istringstream iss(sStr, std::istringstream::in);
         std::getline(iss, sStr, '\n');
         //embedded null read as expected
@@ -291,10 +291,10 @@
         CPPUNIT_ASSERT(iss.eof() && !iss.bad());
 
         char bar[] = "foo";
-        SvMemoryStream aMemStreamB(RTL_CONSTASCII_STRINGPARAM(bar), STREAM_READ);
+        SvMemoryStream aMemStreamB((void *) bar, strlen(bar), STREAM_READ);
         bRet = aMemStreamB.ReadLine(aFoo);
         CPPUNIT_ASSERT(bRet);
-        CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("foo")));
+        CPPUNIT_ASSERT(aFoo == "foo");
         CPPUNIT_ASSERT(!aMemStreamB.eof()); //<-- diff A
 
         std::istringstream issB(bar, std::istringstream::in);
diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx
index 38120aa..c53f2b1 100644
--- a/tools/qa/cppunit/test_urlobj.cxx
+++ b/tools/qa/cppunit/test_urlobj.cxx
@@ -74,9 +74,7 @@
         // this is only demonstration code
         void urlobjTest_001(  )
         {
-            INetURLObject aUrl( rtl::
-                                OUString( RTL_CONSTASCII_USTRINGPARAM
-                                          ( "file://10.10.1.1/sampledir/sample.file" ) ) );
+            INetURLObject aUrl( OUString( "file://10.10.1.1/sampledir/sample.file" ) );
 #ifdef LINUX
             CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
                             compareToAscii
@@ -107,9 +105,7 @@
         {
             INetURLObject aUrl;
             aUrl.
-                setFSysPath( rtl::
-                             OUString( RTL_CONSTASCII_USTRINGPARAM
-                                       ( "\\\\137.65.170.24\\c$\\Img0001.jpg" ) ),
+                setFSysPath( OUString( "\\\\137.65.170.24\\c$\\Img0001.jpg" ),
                              INetURLObject::FSYS_DETECT );
 #ifdef LINUX
             CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
@@ -140,9 +136,7 @@
         {
             INetURLObject aUrl;
             aUrl.
-                setFSysPath( rtl::
-                             OUString( RTL_CONSTASCII_USTRINGPARAM
-                                       ( "\\\\hive-winxp-x86\\pmladek\\test2.odt" ) ),
+                setFSysPath( OUString( "\\\\hive-winxp-x86\\pmladek\\test2.odt" ),
                              INetURLObject::FSYS_DETECT );
 #ifdef LINUX
             CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
@@ -166,9 +160,7 @@
 
         void urlobjTest_004(  )
         {
-            INetURLObject aUrl( rtl::
-                                OUString( RTL_CONSTASCII_USTRINGPARAM
-                                          ( "smb://10.10.1.1/sampledir/sample.file" ) ) );
+            INetURLObject aUrl( OUString( "smb://10.10.1.1/sampledir/sample.file" ) );
 #ifdef LINUX
             CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
                             compareToAscii
@@ -198,7 +190,7 @@
         void urlobjTest_005(  )
         {
             INetURLObject aUrl;
-            aUrl.setFSysPath( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "//137.65.170.24/c$/Img0001.jpg" ) ),
+            aUrl.setFSysPath( OUString( "//137.65.170.24/c$/Img0001.jpg" ),
                               INetURLObject::FSYS_DETECT );
 #ifdef LINUX
             CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
@@ -223,7 +215,7 @@
         void urlobjTest_006(  )
         {
             INetURLObject aUrl;
-            aUrl.setFSysPath( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "//hive-winxp-x86/pmladek/test2.odt" ) ),
+            aUrl.setFSysPath( OUString( "//hive-winxp-x86/pmladek/test2.odt" ),
                               INetURLObject::FSYS_DETECT );
 #ifdef LINUX
             CPPUNIT_ASSERT( aUrl.GetMainURL( INetURLObject::NO_DECODE ).
@@ -245,8 +237,7 @@
         {
             // Test with a username part
             {
-                INetURLObject aUrl( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-                                "vnd.libreoffice.cmis://username@http:%2F%2Ffoo.bar.com:8080%2Fmy%2Fcmis%2Fatom%23repo-id-encoded/path/to/content" ) ) );
+                INetURLObject aUrl( OUString( "vnd.libreoffice.cmis://username@http:%2F%2Ffoo.bar.com:8080%2Fmy%2Fcmis%2Fatom%23repo-id-encoded/path/to/content" ) );
                 CPPUNIT_ASSERT_EQUAL( std::string( "http://foo.bar.com:8080/my/cmis/atom#repo-id-encoded" ),
                         OUSTR_TO_STDSTR( aUrl.GetHost( INetURLObject::DECODE_WITH_CHARSET ) ) );
                 CPPUNIT_ASSERT_EQUAL( std::string( "username" ), OUSTR_TO_STDSTR( aUrl.GetUser( ) ) );
@@ -257,8 +248,8 @@
 
             // Test without a username part
             {
-                INetURLObject aUrl( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-                                "vnd.libreoffice.cmis://http:%2F%2Ffoo.bar.com:8080%2Fmy%2Fcmis%2Fatom%23repo-id-encoded/path/to/content" ) ) );
+                INetURLObject aUrl( OUString(
+                                "vnd.libreoffice.cmis://http:%2F%2Ffoo.bar.com:8080%2Fmy%2Fcmis%2Fatom%23repo-id-encoded/path/to/content" ) );
                 CPPUNIT_ASSERT_EQUAL( std::string( "http://foo.bar.com:8080/my/cmis/atom#repo-id-encoded" ),
                         OUSTR_TO_STDSTR( aUrl.GetHost( INetURLObject::DECODE_WITH_CHARSET ) ) );
                 CPPUNIT_ASSERT( !aUrl.HasUserData() );

-- 
To view, visit https://gerrit.libreoffice.org/2768
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1bff00d261c24e37f9ed41322c49c670850a940f
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Christina Roßmanith <ChrRossmanith at web.de>



More information about the LibreOffice mailing list