Kaydet (Commit) e8638ad5 authored tarafından Eike Rathke's avatar Eike Rathke

in Val() check status after stringToDouble()

instead of calling checkArithmeticOverflow()

Change-Id: I2e3307ee054db77bab0a106d886823dba9e56ea8
üst a8a3beda
...@@ -1782,9 +1782,20 @@ RTLFUNC(Val) ...@@ -1782,9 +1782,20 @@ RTLFUNC(Val)
} }
else else
{ {
// #57844 use localized function rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok;
nResult = ::rtl::math::stringToDouble( aStr, '.', ',', NULL, NULL ); sal_Int32 nParseEnd = 0;
checkArithmeticOverflow( nResult ); nResult = ::rtl::math::stringToDouble( aStr, '.', ',', &eStatus, &nParseEnd );
if ( eStatus != rtl_math_ConversionStatus_Ok )
StarBASIC::Error( SbERR_MATH_OVERFLOW );
/* TODO: we should check whether all characters were parsed here,
* but earlier code silently ignored trailing nonsense such as "1x"
* resulting in 1 with the side effect that any alpha-only-string
* like "x" resulted in 0. Not changing that now (2013-03-22) as
* user macros may rely on it. */
#if 0
else if ( nParseEnd != aStr.getLength() )
StarBASIC::Error( SbERR_CONVERSION );
#endif
} }
rPar.Get(0)->PutDouble( nResult ); rPar.Get(0)->PutDouble( nResult );
......
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