Kaydet (Commit) 7bbd58ea authored tarafından Stephan Bergmann's avatar Stephan Bergmann

fdo#70319 "exponent followed by at least on digit" also for special case 0.0

Change-Id: I07e7917417b8a22cf6d64f2b7a447f9084b9fa2d
üst 2ed29702
...@@ -81,6 +81,12 @@ public: ...@@ -81,6 +81,12 @@ public:
CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status); CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status);
CPPUNIT_ASSERT_EQUAL(sal_Int32(RTL_CONSTASCII_LENGTH("1")), end); CPPUNIT_ASSERT_EQUAL(sal_Int32(RTL_CONSTASCII_LENGTH("1")), end);
CPPUNIT_ASSERT_EQUAL(1.0, res); 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); CPPUNIT_TEST_SUITE(Test);
......
...@@ -819,6 +819,10 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd, ...@@ -819,6 +819,10 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
// offset // offset
while (p != pEnd && rtl::isAsciiDigit(*p)) while (p != pEnd && rtl::isAsciiDigit(*p))
++p; ++p;
if (p == pFirstExpDigit)
{ // no digits in exponent, reset end of scan
p = pExponent;
}
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment