diff options
author | Eike Rathke <erack@redhat.com> | 2016-06-29 23:36:35 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-06-30 12:58:14 +0200 |
commit | 7b2432a2b7fa7a7cc87160e7cc1823a0354988ff (patch) | |
tree | 6e303f6597a3d22ef88945d642e2df8749703e74 /sc | |
parent | 7dd093b283fa629e00958f6d91e6006d1e604fdf (diff) |
use GetInt16()
in the places changed by 2606915f0f480af30367a5d0f67adbf930c2c6b9 and
002697221215e009cdf20fd5c12b50350b8a2128
Change-Id: Iea056b3101c5c41ee932defe13edf4769cb9eab1
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index ebee443796b9..5888abfaa28d 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -190,17 +190,15 @@ void ScInterpreter::ScGetDayOfWeek() sal_uInt8 nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 1, 2 ) ) { - short nFlag; + sal_Int16 nFlag; if (nParamCount == 2) { - double x = rtl::math::approxFloor(GetDouble()); - if (x > double(std::numeric_limits<short>::min()) - 1 - && x < double(std::numeric_limits<short>::max()) + 1) + nFlag = GetInt16(); + if (nGlobalError) { - nFlag = static_cast<short>(x); + PushError( nGlobalError); + return; } - else - nFlag = -1; // cause error in switch below } else nFlag = 1; @@ -258,22 +256,18 @@ void ScInterpreter::ScGetWeekOfYear() sal_uInt8 nParamCount = GetByte(); if ( MustHaveParamCount( nParamCount, 1, 2 ) ) { - short nFlag; + sal_Int16 nFlag; if (nParamCount == 1) { nFlag = 1; } else { - double x = rtl::math::approxFloor(GetDouble()); - if (x > double(std::numeric_limits<short>::min()) - 1 - && x < double(std::numeric_limits<short>::max()) + 1) - { - nFlag = static_cast<short>(x); - } - else + nFlag = GetInt16(); + if (nGlobalError) { - nFlag = -1; // cause error in switch below + PushError( nGlobalError); + return; } } @@ -332,14 +326,12 @@ void ScInterpreter::ScEasterSunday() if ( MustHaveParamCount( GetByte(), 1 ) ) { sal_Int16 nDay, nMonth, nYear; - double x = rtl::math::approxFloor( GetDouble() ); - if (x <= sal_Int32(SAL_MIN_INT16) - 1 - || x >= sal_Int32(SAL_MAX_INT16) + 1) + nYear = GetInt16(); + if (nGlobalError) { - PushIllegalArgument(); + PushError( nGlobalError); return; } - nYear = static_cast<sal_Int16>(x); if ( nYear < 100 ) nYear = pFormatter->ExpandTwoDigitYear( nYear ); if (nYear < 1583 || nYear > 9956) |