[Libreoffice-commits] .: sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Dec 13 11:56:48 PST 2010


 sc/source/core/tool/stringutil.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit c2c3dcbbbfcfe437d8cc3030b9b9cb3ee68bf598
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Mon Dec 13 14:55:13 2010 -0500

    When parsing numbers, ignore preceding spaces.
    
    Also, increment the char pointer and use it directly, which is
    faster than accessing char via [] in each iteration.

diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx
index ae73746..31efe6a 100644
--- a/sc/source/core/tool/stringutil.cxx
+++ b/sc/source/core/tool/stringutil.cxx
@@ -63,13 +63,17 @@ bool ScStringUtil::parseSimpleNumber(
     sal_Int32 nPosDSep = -1, nPosGSep = -1;
     sal_uInt32 nDigitCount = 0;
 
-    for (sal_Int32 i = 0; i < n; ++i)
+    for (sal_Int32 i = 0; i < n; ++i, ++p)
     {
-        sal_Unicode c = p[i];
+        sal_Unicode c = *p;
         if (c == 0x00A0)
             // unicode space to ascii space
             c = 0x0020;
 
+        if (c == 0x0020)
+            // Skip preceding spaces.
+            continue;
+
         if (sal_Unicode('0') <= c && c <= sal_Unicode('9'))
         {
             // this is a digit.


More information about the Libreoffice-commits mailing list