summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-10-17 18:01:47 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-10-17 18:39:32 +0000
commit23c7aeb5ec633674a51b41e936ad9708e502841b (patch)
treec2a9ab5b0d3b32d847d11763f0988c97d7c9c20d
parentbump product version to 4.0.6.2+, release number to 2 (diff)
downloadcore-libreoffice-4-0-6.tar.gz
core-libreoffice-4-0-6.zip
fdo#70319 "exponent followed by at least on digit" also for special case 0.0 libreoffice-4-0-6
(cherry picked from commit 7bbd58eafc3146abcefc73d2d1ca6869bb47ef5a) Conflicts: sal/rtl/math.cxx Change-Id: I07e7917417b8a22cf6d64f2b7a447f9084b9fa2d Reviewed-on: https://gerrit.libreoffice.org/6296 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sal/qa/rtl/math/test-rtl-math.cxx6
-rw-r--r--sal/rtl/source/math.cxx4
2 files changed, 10 insertions, 0 deletions
diff --git a/sal/qa/rtl/math/test-rtl-math.cxx b/sal/qa/rtl/math/test-rtl-math.cxx
index 8f6578cd791a..3929a53c2e6a 100644
--- a/sal/qa/rtl/math/test-rtl-math.cxx
+++ b/sal/qa/rtl/math/test-rtl-math.cxx
@@ -81,6 +81,12 @@ public:
CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status);
CPPUNIT_ASSERT_EQUAL(sal_Int32(RTL_CONSTASCII_LENGTH("1")), end);
CPPUNIT_ASSERT_EQUAL(1.0, res);
+ res = rtl::math::stringToDouble(
+ rtl::OUString("0e"),
+ sal_Unicode('.'), sal_Unicode(','), &status, &end);
+ CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(RTL_CONSTASCII_LENGTH("1")), end);
+ CPPUNIT_ASSERT_EQUAL(0.0, res);
}
CPPUNIT_TEST_SUITE(Test);
diff --git a/sal/rtl/source/math.cxx b/sal/rtl/source/math.cxx
index e5c44d561979..ec2bfc4cd280 100644
--- a/sal/rtl/source/math.cxx
+++ b/sal/rtl/source/math.cxx
@@ -825,6 +825,10 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
// offset
while (p != pEnd && isDigit(*p))
++p;
+ if (p == pFirstExpDigit)
+ { // no digits in exponent, reset end of scan
+ p = pExponent;
+ }
}
else
{