[Libreoffice-commits] core.git: sc/source
Eike Rathke
erack at redhat.com
Mon Sep 19 17:16:42 UTC 2016
sc/source/core/tool/interpr4.cxx | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
New commits:
commit aa51bf1e17dfb4a0a95a24e7de7f55d2b44b9472
Author: Eike Rathke <erack at redhat.com>
Date: Mon Sep 19 18:49:03 2016 +0200
in GetInt...() check !isFinite() instead of isNan()
... and propagate coded double error instead of setting
errIllegalArgument.
Change-Id: I28456c3b0320181a80fe255e875a0bd78216c279
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 09a4b83..d94c74c 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;
More information about the Libreoffice-commits
mailing list