summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-05-19 22:48:24 +0200
committerEike Rathke <erack@redhat.com>2017-05-22 11:00:56 +0200
commitf6703ce85f9399b94958601ed6623865b205c5fb (patch)
treef5db30de7915dd1498f7caeb3b7f06d039674b5e
parentc9bff2c2e64823504baa8a4b5e20a88866ba0a71 (diff)
Change IterateParameters to push token instead of returning double, tdf#58874
Change-Id: Ib256d99126116379b27fc246dedf0fac2efb8c02
-rw-r--r--sc/source/core/inc/interpre.hxx2
-rw-r--r--sc/source/core/tool/interpr6.cxx31
2 files changed, 20 insertions, 13 deletions
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 902fde9e1376..9ddf9e2c1900 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -568,7 +568,7 @@ void ScUnicode();
void ScUnichar();
void ScMin( bool bTextAsZero = false );
void ScMax( bool bTextAsZero = false );
-double IterateParameters( ScIterFunc, bool bTextAsZero = false );
+void IterateParameters( ScIterFunc, bool bTextAsZero = false );
void ScSumSQ();
void ScSum();
void ScProduct();
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 31448ee48f6e..72c82e9474a7 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -459,7 +459,7 @@ void IterateMatrix(
}
}
-double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
+void ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
{
short nParamCount = GetByte();
double fRes = ( eFunc == ifPRODUCT ) ? 1.0 : 0.0;
@@ -614,7 +614,10 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
{
PopSingleRef( aAdr );
if (nGlobalError == FormulaError::NoRef)
- return 0.0;
+ {
+ PushError( FormulaError::NoRef);
+ return;
+ }
if ( nGlobalError != FormulaError::NONE && ( eFunc == ifCOUNT2 || eFunc == ifCOUNT ||
( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) ) )
@@ -680,7 +683,10 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
{
PopDoubleRef( aRange, nParamCount, nRefInList);
if (nGlobalError == FormulaError::NoRef)
- return 0.0;
+ {
+ PushError( FormulaError::NoRef);
+ return;
+ }
if ( nGlobalError != FormulaError::NONE && ( eFunc == ifCOUNT2 || eFunc == ifCOUNT ||
( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) ) )
@@ -717,8 +723,8 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
FormulaError nErr = aAction.getError();
if ( nErr != FormulaError::NONE )
{
- SetError( nErr );
- return fRes;
+ PushError( nErr );
+ return;
}
fRes += aAction.getSum();
@@ -881,37 +887,38 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
// Counts are always numbers.
if( nFuncFmtType == css::util::NumberFormat::LOGICAL || eFunc == ifCOUNT || eFunc == ifCOUNT2 )
nFuncFmtType = css::util::NumberFormat::NUMBER;
- return fRes;
+
+ PushDouble( fRes);
}
void ScInterpreter::ScSumSQ()
{
- PushDouble( IterateParameters( ifSUMSQ ) );
+ IterateParameters( ifSUMSQ );
}
void ScInterpreter::ScSum()
{
- PushDouble( IterateParameters( ifSUM ) );
+ IterateParameters( ifSUM );
}
void ScInterpreter::ScProduct()
{
- PushDouble( IterateParameters( ifPRODUCT ) );
+ IterateParameters( ifPRODUCT );
}
void ScInterpreter::ScAverage( bool bTextAsZero )
{
- PushDouble( IterateParameters( ifAVERAGE, bTextAsZero ) );
+ IterateParameters( ifAVERAGE, bTextAsZero );
}
void ScInterpreter::ScCount()
{
- PushDouble( IterateParameters( ifCOUNT ) );
+ IterateParameters( ifCOUNT );
}
void ScInterpreter::ScCount2()
{
- PushDouble( IterateParameters( ifCOUNT2 ) );
+ IterateParameters( ifCOUNT2 );
}
void ScInterpreter::ScRawSubtract()