summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-09-19 18:49:03 +0200
committerEike Rathke <erack@redhat.com>2016-09-19 19:14:20 +0200
commitaa51bf1e17dfb4a0a95a24e7de7f55d2b44b9472 (patch)
tree84600da05ff733e72d82cafad5621354b5845998
parent388014fc19b2a785f887cdfee91100fc9ab8d58d (diff)
in GetInt...() check !isFinite() instead of isNan()
... and propagate coded double error instead of setting errIllegalArgument. Change-Id: I28456c3b0320181a80fe255e875a0bd78216c279
-rw-r--r--sc/source/core/tool/interpr4.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 09a4b8382d02..d94c74c1f0e7 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -2149,9 +2149,9 @@ double ScInterpreter::GetDoubleWithDefault(double nDefault)
sal_Int32 ScInterpreter::GetInt32()
{
double fVal = GetDouble();
- if (rtl::math::isNan(fVal))
+ if (!rtl::math::isFinite(fVal))
{
- SetError(errIllegalArgument);
+ SetError( GetDoubleErrorValue( fVal));
return SAL_MAX_INT32;
}
if (fVal > 0.0)
@@ -2178,9 +2178,9 @@ sal_Int32 ScInterpreter::GetInt32()
sal_Int32 ScInterpreter::GetInt32WithDefault( sal_Int32 nDefault )
{
double fVal = GetDoubleWithDefault( nDefault);
- if (rtl::math::isNan(fVal))
+ if (!rtl::math::isFinite(fVal))
{
- SetError(errIllegalArgument);
+ SetError( GetDoubleErrorValue( fVal));
return SAL_MAX_INT32;
}
if (fVal > 0.0)
@@ -2207,9 +2207,9 @@ sal_Int32 ScInterpreter::GetInt32WithDefault( sal_Int32 nDefault )
sal_Int16 ScInterpreter::GetInt16()
{
double fVal = GetDouble();
- if (rtl::math::isNan(fVal))
+ if (!rtl::math::isFinite(fVal))
{
- SetError(errIllegalArgument);
+ SetError( GetDoubleErrorValue( fVal));
return SAL_MAX_INT16;
}
if (fVal > 0.0)
@@ -2236,7 +2236,12 @@ sal_Int16 ScInterpreter::GetInt16()
sal_uInt32 ScInterpreter::GetUInt32()
{
double fVal = rtl::math::approxFloor( GetDouble());
- if (rtl::math::isNan(fVal) || fVal < 0.0 || fVal > SAL_MAX_UINT32)
+ if (!rtl::math::isFinite(fVal))
+ {
+ SetError( GetDoubleErrorValue( fVal));
+ return SAL_MAX_UINT32;
+ }
+ if (fVal < 0.0 || fVal > SAL_MAX_UINT32)
{
SetError( errIllegalArgument);
return SAL_MAX_UINT32;