[Libreoffice-commits] .: sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Mon Dec 13 12:17:55 PST 2010
sc/source/core/tool/stringutil.cxx | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
New commits:
commit 9d6aa5f98e201cc2aaa9b88641550833e61ecd74
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Mon Dec 13 15:17:30 2010 -0500
The previous commit would skip *all* spaces. This is the right fix.
diff --git a/sc/source/core/tool/stringutil.cxx b/sc/source/core/tool/stringutil.cxx
index 31efe6a..136b0be 100644
--- a/sc/source/core/tool/stringutil.cxx
+++ b/sc/source/core/tool/stringutil.cxx
@@ -63,17 +63,24 @@ bool ScStringUtil::parseSimpleNumber(
sal_Int32 nPosDSep = -1, nPosGSep = -1;
sal_uInt32 nDigitCount = 0;
- for (sal_Int32 i = 0; i < n; ++i, ++p)
+ sal_Int32 i = 0;
+
+ // Skip preceding spaces.
+ for (i = 0; i < n; ++i, ++p)
+ {
+ sal_Unicode c = *p;
+ if (c != 0x0020 && c != 0x00A0)
+ // first non-space character. Exit.
+ break;
+ }
+
+ for (; i < n; ++i, ++p)
{
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