summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-05-23 01:28:13 +0200
committerEike Rathke <erack@redhat.com>2017-05-23 10:41:08 +0200
commit44a1f0c17d3c5b212ff60b2f24f50693b3da9eab (patch)
treefe3af40524ae3d89f0ee041b6bcde6d9670e3c58
parentb9ecc28533ed366bc6544303df763b6be29c2963 (diff)
Move pushing result token into IterateParametersIf(), tdf#58874
Change-Id: I98c52784992f5734480736ce4f8290490ca752f1
-rw-r--r--sc/source/core/inc/interpre.hxx2
-rw-r--r--sc/source/core/tool/interpr1.cxx39
2 files changed, 25 insertions, 16 deletions
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 9e5de664d0dc..8e6d89206c3a 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -596,7 +596,7 @@ void ScColumn();
void ScRow();
void ScSheet();
void ScMatch();
-double IterateParametersIf( ScIterFuncIf );
+void IterateParametersIf( ScIterFuncIf );
void ScCountIf();
void ScSumIf();
void ScAverageIf();
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 12aa11b97bbf..51ddade6e1e8 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -4967,11 +4967,14 @@ void ScInterpreter::ScCountEmptyCells()
}
}
-double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
+void ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
{
sal_uInt8 nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 2, 3 ) )
- return 0;
+ {
+ PushError( nGlobalError);
+ return;
+ }
SCCOL nCol3 = 0;
SCROW nRow3 = 0;
@@ -4994,8 +4997,8 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
PopDoubleRef( nCol3, nRow3, nTab3, nColJunk, nRowJunk, nTabJunk );
if ( nTabJunk != nTab3 )
{
- SetError( FormulaError::IllegalParameter);
- return 0;
+ PushError( FormulaError::IllegalParameter);
+ return;
}
}
break;
@@ -5012,7 +5015,10 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
ScExternalRefCache::TokenRef pToken;
PopExternalSingleRef(pToken);
if (nGlobalError != FormulaError::NONE)
- return 0;
+ {
+ PushError( nGlobalError);
+ return;
+ }
if (pToken->GetType() == svDouble)
pSumExtraMatrix->PutDouble(pToken->GetDouble(), 0, 0);
@@ -5024,8 +5030,8 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
PopExternalDoubleRef(pSumExtraMatrix);
break;
default:
- SetError( FormulaError::IllegalParameter);
- return 0;
+ PushError( FormulaError::IllegalParameter);
+ return;
}
}
@@ -5039,7 +5045,10 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
{
ScAddress aAdr;
if ( !PopDoubleRefOrSingleRef( aAdr ) )
- return 0;
+ {
+ PushError( nGlobalError);
+ return;
+ }
ScRefCellValue aCell(*pDok, aAdr);
switch (aCell.meType)
@@ -5146,8 +5155,8 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
pQueryMatrix = GetMatrix();
if (!pQueryMatrix)
{
- SetError( FormulaError::IllegalParameter);
- return 0;
+ PushError( FormulaError::IllegalParameter);
+ return;
}
nCol1 = 0;
nRow1 = 0;
@@ -5358,8 +5367,8 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
}
else
{
- SetError( FormulaError::IllegalParameter);
- return 0;
+ PushError( FormulaError::IllegalParameter);
+ return;
}
}
@@ -5368,17 +5377,17 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
case ifSUMIF: fRes = ::rtl::math::approxAdd( fSum, fMem ); break;
case ifAVERAGEIF: fRes = div( ::rtl::math::approxAdd( fSum, fMem ), fCount); break;
}
- return fRes;
+ PushDouble( fRes);
}
void ScInterpreter::ScSumIf()
{
- PushDouble( IterateParametersIf( ifSUMIF));
+ IterateParametersIf( ifSUMIF);
}
void ScInterpreter::ScAverageIf()
{
- PushDouble( IterateParametersIf( ifAVERAGEIF));
+ IterateParametersIf( ifAVERAGEIF);
}
void ScInterpreter::ScCountIf()