[Libreoffice-commits] core.git: 2 commits - svl/source

Eike Rathke erack at redhat.com
Mon Mar 18 11:01:40 PDT 2013


 svl/source/numbers/zformat.cxx |   22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 9a46e5614f5a0e0bdce3c497f81ca529da8fb5c0
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Mar 18 18:59:09 2013 +0100

    renamed method, it determines if symbol combines
    
    Change-Id: I60fec73900b861363c02ec51ecbf9dcfd7edb167

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 869b724..ee1a27d 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -1292,7 +1292,7 @@ sal_Unicode toUniChar(sal_uInt8 n)
     return sal_Unicode(c);
 }
 
-bool IsSingleSymbol( OUStringBuffer& rStringBuffer, sal_Int32 nPos )
+bool IsCombiningSymbol( OUStringBuffer& rStringBuffer, sal_Int32 nPos )
 {
     bool bRet = false;
     while (nPos >= 0)
@@ -1560,7 +1560,7 @@ short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString,
             }
             break;
         case SsGetString:
-            if (cToken == ';' && (nPos < 2 || !IsSingleSymbol( rString, nPos-2)))
+            if (cToken == ';' && (nPos < 2 || !IsCombiningSymbol( rString, nPos-2)))
             {
                 eState = SsStop;
             }
commit 9377aeb5fade9baee55fb3301b057f203a62124b
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Mar 18 18:57:05 2013 +0100

    use switch instead of multiple ifs
    
    Change-Id: Ib928f7e80aa185119c37b400e8a3e002619ffd41

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 87b7740..869b724 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -1292,20 +1292,24 @@ sal_Unicode toUniChar(sal_uInt8 n)
     return sal_Unicode(c);
 }
 
-bool IsSingleSymbol(OUStringBuffer& rStringBuffer, sal_Int32 nPos)
+bool IsSingleSymbol( OUStringBuffer& rStringBuffer, sal_Int32 nPos )
 {
-    bool ret = false;
+    bool bRet = false;
     while (nPos >= 0)
     {
-        if(rStringBuffer[nPos] == '*' || rStringBuffer[nPos] == '\\' || rStringBuffer[nPos] == '_')
+        switch (rStringBuffer[nPos])
         {
-            ret = !ret;
-            nPos--;
+            case '*':
+            case '\\':
+            case '_':
+                bRet = !bRet;
+                --nPos;
+                break;
+            default:
+                return bRet;
         }
-        else
-            return ret;
     }
-    return ret;
+    return bRet;
 }
 
 } // namespace
@@ -1556,7 +1560,7 @@ short SvNumberformat::ImpNextSymbol(OUStringBuffer& rString,
             }
             break;
         case SsGetString:
-            if (cToken == ';' && (nPos < 2 || !IsSingleSymbol(rString, nPos-2)))
+            if (cToken == ';' && (nPos < 2 || !IsSingleSymbol( rString, nPos-2)))
             {
                 eState = SsStop;
             }


More information about the Libreoffice-commits mailing list