sc/source/core/tool/interpr4.cxx | 70 ++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 36 deletions(-)
New commits: commit f53fc22f04ccd799035acbec718c42176a4554c9 Author: Jochen Nitschke <j.nitschke+loger...@ok.de> Date: Tue Mar 15 09:25:14 2016 +0100 sc: replace define with helper Change-Id: I79915d5449e64c9eb46ff91ce3279ce27af12fec Reviewed-on: https://gerrit.libreoffice.org/23257 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noelgran...@gmail.com> diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 2869133..027a253 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -3565,8 +3565,37 @@ double applyImplicitIntersection(const sc::RangeMatrix& rMat, const ScAddress& r return fVal; } +// Test for Functions that evaluate an error code and directly set nGlobalError to 0 +bool IsErrFunc(OpCode oc) +{ + switch (oc) + { + case ocCount : + case ocCount2 : + case ocErrorType : + case ocIsEmpty : + case ocIsErr : + case ocIsError : + case ocIsFormula : + case ocIsLogical : + case ocIsNA : + case ocIsNonString : + case ocIsRef : + case ocIsString : + case ocIsValue : + case ocN : + case ocType : + case ocIfError : + case ocIfNA : + case ocErrorType_ODF : + return true; + default: + return false; + } } +} //namespace + StackVar ScInterpreter::Interpret() { short nRetTypeExpr = css::util::NumberFormat::UNDEFINED; @@ -4132,48 +4161,17 @@ StackVar ScInterpreter::Interpret() pJumpMatrix = nullptr; } while ( bGotResult ); -// Functions that evaluate an error code and directly set nGlobalError to 0, -// usage: switch( OpCode ) { CASE_OCERRFUNC statements; } -#define CASE_OCERRFUNC \ - case ocCount : \ - case ocCount2 : \ - case ocErrorType : \ - case ocIsEmpty : \ - case ocIsErr : \ - case ocIsError : \ - case ocIsFormula : \ - case ocIsLogical : \ - case ocIsNA : \ - case ocIsNonString : \ - case ocIsRef : \ - case ocIsString : \ - case ocIsValue : \ - case ocN : \ - case ocType : \ - case ocIfError : \ - case ocIfNA : \ - case ocErrorType_ODF : - - switch ( eOp ) - { - CASE_OCERRFUNC - ++ nErrorFunction; - default: - ; // nothing - } + if( IsErrFunc(eOp) ) + ++nErrorFunction; + if ( nGlobalError ) { if ( !nErrorFunctionCount ) { // count of errorcode functions in formula for ( FormulaToken* t = rArr.FirstRPN(); t; t = rArr.NextRPN() ) { - switch ( t->GetOpCode() ) - { - CASE_OCERRFUNC - ++nErrorFunctionCount; - default: - ; // nothing - } + if ( IsErrFunc(t->GetOpCode()) ) + ++nErrorFunctionCount; } } if ( nErrorFunction >= nErrorFunctionCount ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits