summaryrefslogtreecommitdiff
path: root/sal/rtl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-10-14 14:55:23 +0200
committerMichael Stahl <mstahl@redhat.com>2013-10-15 16:02:56 +0000
commitd8b9d9e84ef2e18bda11d51f6c9eb1fe4f1fb791 (patch)
treedda63a153ce0b2623f66bba3a3fb3b8359b16fce /sal/rtl
parent22e58528fed41b15d242eb9e85dc25c51ec01e4d (diff)
resolved fdo#70319 exponent must be followed by at least one digit
(cherry picked from commit f20feba4c43c34fd2ee05b4658b0de0248c08eb9) work around crappy SbiScanner::NextSym(), fdo#70319 just to make test not fail that was wrong anyway (cherry picked from commit 472ad8ba7ef99982025b37aba562f2135ca8a999) Change-Id: Icdd22fa0f1efcdd18cfea7cb48e1cbf2cf8d3533 Reviewed-on: https://gerrit.libreoffice.org/6241 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sal/rtl')
-rw-r--r--sal/rtl/math.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 590ea0ee46b0..f66039a4a3ad 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -799,6 +799,7 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
// Exponent
if (p != p0 && p != pEnd && (*p == CharT('E') || *p == CharT('e')))
{
+ CharT const * const pExponent = p;
++p;
bool bExpSign;
if (p != pEnd && *p == CharT('-'))
@@ -812,6 +813,7 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
if (p != pEnd && *p == CharT('+'))
++p;
}
+ CharT const * const pFirstExpDigit = p;
if ( fVal == 0.0 )
{ // no matter what follows, zero stays zero, but carry on the
// offset
@@ -857,6 +859,10 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
else
fVal = rtl::math::pow10Exp( fVal, nExp ); // normal
}
+ else if (p == pFirstExpDigit)
+ { // no digits in exponent, reset end of scan
+ p = pExponent;
+ }
}
}
else if (p - p0 == 2 && p != pEnd && p[0] == CharT('#')