summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-06-14 15:25:48 +0200
committerEike Rathke <erack@redhat.com>2016-06-14 15:30:43 +0200
commitafe705be76ffb62d4f0845a40ac321917649288c (patch)
treeca86106105a720f76982903e00e7e3fe25cd6f9f /sc
parentd999069ec6ace6e43b054f26a48f99cbec621628 (diff)
PopExternalSingleRef() guarantees nGlobalError is set
... if token could not be obtained. So no need to check if(pToken) and we can simplify the error handling at some places. Change-Id: Ie741a46efd6f33b5be48e8e4ff9bca2bbbc95b04
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/inc/interpre.hxx6
-rw-r--r--sc/source/core/tool/interpr1.cxx19
-rw-r--r--sc/source/core/tool/interpr4.cxx19
-rw-r--r--sc/source/core/tool/interpr5.cxx7
4 files changed, 26 insertions, 25 deletions
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index bd0a2698cff2..3ed275ac11ba 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -344,10 +344,16 @@ void DoubleRefToVars( const formula::FormulaToken* p,
ScDBRangeBase* PopDBDoubleRef();
void PopDoubleRef(SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1,
SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2 );
+
void PopExternalSingleRef(sal_uInt16& rFileId, OUString& rTabName, ScSingleRefData& rRef);
+
+/** Guarantees that nGlobalError is set if rToken could not be obtained. */
void PopExternalSingleRef(ScExternalRefCache::TokenRef& rToken, ScExternalRefCache::CellFormat* pFmt = nullptr);
+
+/** Guarantees that nGlobalError is set if rToken could not be obtained. */
void PopExternalSingleRef(sal_uInt16& rFileId, OUString& rTabName, ScSingleRefData& rRef,
ScExternalRefCache::TokenRef& rToken, ScExternalRefCache::CellFormat* pFmt = nullptr);
+
void PopExternalDoubleRef(sal_uInt16& rFileId, OUString& rTabName, ScComplexRefData& rRef);
void PopExternalDoubleRef(ScExternalRefCache::TokenArrayRef& rArray);
void PopExternalDoubleRef(ScMatrixRef& rMat);
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 6e78b880c0c3..76f807d37173 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2312,14 +2312,14 @@ void ScInterpreter::ScCellExternal()
PopExternalSingleRef(nFileId, aTabName, aRef, pToken, &aFmt);
if (nGlobalError)
{
- PushIllegalParameter();
+ PushError( nGlobalError);
return;
}
OUString aInfoType = GetString().getString();
if (nGlobalError)
{
- PushIllegalParameter();
+ PushError( nGlobalError);
return;
}
@@ -2820,7 +2820,7 @@ void ScInterpreter::ScIsError()
{
ScExternalRefCache::TokenRef pToken;
PopExternalSingleRef(pToken);
- if (nGlobalError || !pToken || pToken->GetType() == svError)
+ if (nGlobalError || pToken->GetType() == svError)
bRes = true;
}
break;
@@ -4424,9 +4424,9 @@ void ScInterpreter::ScMatch()
{
ScExternalRefCache::TokenRef pToken;
PopExternalSingleRef(pToken);
- if (!pToken)
+ if (nGlobalError)
{
- PushInt(0);
+ PushError( nGlobalError);
return;
}
if (pToken->GetType() == svDouble)
@@ -4739,11 +4739,8 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
pSumExtraMatrix = GetNewMat(1,1);
ScExternalRefCache::TokenRef pToken;
PopExternalSingleRef(pToken);
- if (!pToken)
- {
- SetError( errIllegalParameter);
+ if (nGlobalError)
return 0;
- }
if (pToken->GetType() == svDouble)
pSumExtraMatrix->PutDouble(pToken->GetDouble(), 0, 0);
@@ -4812,7 +4809,7 @@ double ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc )
{
ScExternalRefCache::TokenRef pToken;
PopExternalSingleRef(pToken);
- if (pToken)
+ if (!nGlobalError)
{
if (pToken->GetType() == svDouble)
{
@@ -5389,7 +5386,7 @@ double ScInterpreter::IterateParametersIfs( ScIterFuncIfs eFunc )
{
ScExternalRefCache::TokenRef pToken;
PopExternalSingleRef(pToken);
- if (pToken)
+ if (!nGlobalError)
{
if (pToken->GetType() == svDouble)
{
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 2f6c4fa43bf0..f5138bb4ddfa 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -2039,7 +2039,7 @@ double ScInterpreter::GetDouble()
{
ScExternalRefCache::TokenRef pToken;
PopExternalSingleRef(pToken);
- if (!nGlobalError && pToken)
+ if (!nGlobalError)
{
if (pToken->GetType() == svDouble)
nVal = pToken->GetDouble();
@@ -3069,14 +3069,19 @@ void ScInterpreter::ScMacro()
{
ScExternalRefCache::TokenRef pToken;
PopExternalSingleRef(pToken);
- if ( pToken->GetType() == svString )
- pPar->PutString( pToken->GetString().getString() );
- else if ( pToken->GetType() == svDouble )
- pPar->PutDouble( pToken->GetDouble() );
+ if (nGlobalError)
+ bOk = false;
else
{
- SetError( errIllegalArgument );
- bOk = false;
+ if ( pToken->GetType() == svString )
+ pPar->PutString( pToken->GetString().getString() );
+ else if ( pToken->GetType() == svDouble )
+ pPar->PutDouble( pToken->GetDouble() );
+ else
+ {
+ SetError( errIllegalArgument );
+ bOk = false;
+ }
}
}
break;
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index e1ff66e2b642..3da084fe3c3c 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -461,13 +461,6 @@ ScMatrixRef ScInterpreter::GetMatrix()
SetError( errIllegalArgument);
break;
}
- if (!pToken)
- {
- SetError( errIllegalArgument);
- pMat->PutError( nGlobalError, 0, 0);
- nGlobalError = 0;
- break;
- }
if (nGlobalError)
{
pMat->PutError( nGlobalError, 0, 0);