[PATCH] Remove RTL_CONSTASCII_(U)STRINGPARAM in ucb(regexp)

Christina Roßmanith (via_Code_Review) gerrit at gerrit.libreoffice.org
Thu Mar 28 15:02:25 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3117

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/17/3117/1

Remove RTL_CONSTASCII_(U)STRINGPARAM in ucb(regexp)

changed matchString() to accept OString

Change-Id: Ib1985f0b8219af139c1cea918f9bf35eeceeb1e3
---
M ucb/source/regexp/regexp.cxx
1 file changed, 14 insertions(+), 12 deletions(-)



diff --git a/ucb/source/regexp/regexp.cxx b/ucb/source/regexp/regexp.cxx
index 58ba065..98ca42f 100644
--- a/ucb/source/regexp/regexp.cxx
+++ b/ucb/source/regexp/regexp.cxx
@@ -297,8 +297,11 @@
 namespace unnamed_ucb_regexp {
 
 bool matchString(sal_Unicode const ** pBegin, sal_Unicode const * pEnd,
-                 sal_Char const * pString, size_t nStringLength)
+                 OString const &rStr )
 {
+    sal_Char const *pString = rStr.getStr();
+    sal_Int32 nStringLength = rStr.getLength();
+
     sal_Unicode const * p = *pBegin;
 
     sal_uChar const * q = reinterpret_cast< sal_uChar const * >(pString);
@@ -374,7 +377,7 @@
     if (p == pEnd)
         throw lang::IllegalArgumentException();
 
-    if (matchString(&p, pEnd, RTL_CONSTASCII_STRINGPARAM(".*")))
+    if (matchString(&p, pEnd, ".*"))
     {
         if (p != pEnd)
             throw lang::IllegalArgumentException();
@@ -382,19 +385,19 @@
         return Regexp(Regexp::KIND_PREFIX, aPrefix, false, rtl::OUString(),
                       false, rtl::OUString());
     }
-    else if (matchString(&p, pEnd, RTL_CONSTASCII_STRINGPARAM("(.*)->")))
+    else if (matchString(&p, pEnd, "(.*)->"))
     {
         rtl::OUString aReversePrefix;
         scanStringLiteral(&p, pEnd, &aReversePrefix);
 
-        if (!matchString(&p, pEnd, RTL_CONSTASCII_STRINGPARAM("\\1"))
+        if (!matchString(&p, pEnd, "\\1")
             || p != pEnd)
             throw lang::IllegalArgumentException();
 
         return Regexp(Regexp::KIND_PREFIX, aPrefix, false, rtl::OUString(),
                       true, aReversePrefix);
     }
-    else if (matchString(&p, pEnd, RTL_CONSTASCII_STRINGPARAM("([/?#].*)?")))
+    else if (matchString(&p, pEnd, "([/?#].*)?"))
     {
         if (p != pEnd)
             throw lang::IllegalArgumentException();
@@ -402,12 +405,11 @@
         return Regexp(Regexp::KIND_AUTHORITY, aPrefix, false, rtl::OUString(),
                       false, rtl::OUString());
     }
-    else if (matchString(&p, pEnd,
-                         RTL_CONSTASCII_STRINGPARAM("(([/?#].*)?)->")))
+    else if (matchString(&p, pEnd, "(([/?#].*)?)->"))
     {
         rtl::OUString aReversePrefix;
         if (!(scanStringLiteral(&p, pEnd, &aReversePrefix)
-              && matchString(&p, pEnd, RTL_CONSTASCII_STRINGPARAM("\\1"))
+              && matchString(&p, pEnd, "\\1")
               && p == pEnd))
             throw lang::IllegalArgumentException();
 
@@ -423,7 +425,7 @@
             bOpen = true;
         }
 
-        if (!matchString(&p, pEnd, RTL_CONSTASCII_STRINGPARAM("[^/?#]")))
+        if (!matchString(&p, pEnd, "[^/?#]"))
             throw lang::IllegalArgumentException();
 
         if (p == pEnd || (*p != '*' && *p != '+'))
@@ -433,14 +435,14 @@
         rtl::OUString aInfix;
         scanStringLiteral(&p, pEnd, &aInfix);
 
-        if (!matchString(&p, pEnd, RTL_CONSTASCII_STRINGPARAM("([/?#].*)?")))
+        if (!matchString(&p, pEnd, "([/?#].*)?"))
             throw lang::IllegalArgumentException();
 
         rtl::OUString aReversePrefix;
         if (bOpen
-            && !(matchString(&p, pEnd, RTL_CONSTASCII_STRINGPARAM(")->"))
+            && !(matchString(&p, pEnd, ")->")
                  && scanStringLiteral(&p, pEnd, &aReversePrefix)
-                 && matchString(&p, pEnd, RTL_CONSTASCII_STRINGPARAM("\\1"))))
+                 && matchString(&p, pEnd, "\\1")))
             throw lang::IllegalArgumentException();
 
         if (p != pEnd)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1985f0b8219af139c1cea918f9bf35eeceeb1e3
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