summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-07-20 11:58:43 +0200
committerEike Rathke <erack@redhat.com>2017-07-20 12:01:54 +0200
commitf8206849e8c437ec8eb74d044ba50be5f1622b70 (patch)
treeeaab4ad014cd29b2b27f2e54d57fe7ab95361ec7 /sc
parent6d829ae4f218b5d751cfc366f071fc6160c0787c (diff)
Obtain days using GetInt32() instead of casting floor
... so out of range arguments result in error. Change-Id: Iaea943719681019b7d5f4393540655243bcb2ca4
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr2.cxx20
1 files changed, 10 insertions, 10 deletions
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index ae9877e5a4fb..aa2daa821989 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -718,28 +718,28 @@ void ScInterpreter::ScGetDiffDate360()
bFlag = GetBool();
else
bFlag = false;
- double nDate2 = GetDouble();
- double nDate1 = GetDouble();
+ sal_Int32 nDate2 = GetInt32();
+ sal_Int32 nDate1 = GetInt32();
if (nGlobalError != FormulaError::NONE)
PushError( nGlobalError);
else
{
- double fSign;
+ sal_Int32 nSign;
// #i84934# only for non-US European algorithm swap dates. Else
// follow Excel's meaningless extrapolation for "interoperability".
if (bFlag && (nDate2 < nDate1))
{
- fSign = nDate1;
+ nSign = nDate1;
nDate1 = nDate2;
- nDate2 = fSign;
- fSign = -1.0;
+ nDate2 = nSign;
+ nSign = -1;
}
else
- fSign = 1.0;
+ nSign = 1;
Date aDate1 = pFormatter->GetNullDate();
- aDate1 += static_cast<sal_Int32>(::rtl::math::approxFloor(nDate1));
+ aDate1 += nDate1;
Date aDate2 = pFormatter->GetNullDate();
- aDate2 += static_cast<sal_Int32>(::rtl::math::approxFloor(nDate2));
+ aDate2 += nDate2;
if (aDate1.GetDay() == 31)
aDate1 -= (sal_uLong) 1;
else if (!bFlag)
@@ -768,7 +768,7 @@ void ScInterpreter::ScGetDiffDate360()
else
aDate2.SetDay(30);
}
- PushDouble( fSign *
+ PushDouble( (double) nSign *
( (double) aDate2.GetDay() + (double) aDate2.GetMonth() * 30.0 +
(double) aDate2.GetYear() * 360.0
- (double) aDate1.GetDay() - (double) aDate1.GetMonth() * 30.0