summaryrefslogtreecommitdiffstats
path: root/formula/source/core/api/token.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'formula/source/core/api/token.cxx')
-rw-r--r--formula/source/core/api/token.cxx21
1 files changed, 11 insertions, 10 deletions
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index a8fb0b42541d..fcd0c8b22970 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -105,17 +105,14 @@ sal_uInt8 FormulaToken::GetParamCount() const
return 0; // parameters and specials
// ocIf... jump commands not for FAP, have cByte then
//2do: bool parameter whether FAP or not?
- else if ( GetByte() )
+ else if (GetByte())
return GetByte(); // all functions, also ocExternal and ocMacro
- else if (SC_OPCODE_START_BIN_OP <= eOp && eOp < SC_OPCODE_STOP_BIN_OP)
- return 2; // binary
- else if ((SC_OPCODE_START_UN_OP <= eOp && eOp < SC_OPCODE_STOP_UN_OP)
- || eOp == ocPercentSign)
- return 1; // unary
+ else if (SC_OPCODE_START_BIN_OP <= eOp && eOp < SC_OPCODE_STOP_BIN_OP && eOp != ocAnd && eOp != ocOr)
+ return 2; // binary operators, compiler checked; OR and AND legacy but are functions
+ else if ((SC_OPCODE_START_UN_OP <= eOp && eOp < SC_OPCODE_STOP_UN_OP) || eOp == ocPercentSign)
+ return 1; // unary operators, compiler checked
else if (SC_OPCODE_START_NO_PAR <= eOp && eOp < SC_OPCODE_STOP_NO_PAR)
return 0; // no parameter
- else if (SC_OPCODE_START_1_PAR <= eOp && eOp < SC_OPCODE_STOP_1_PAR)
- return 1; // one parameter
else if (FormulaCompiler::IsOpCodeJumpCommand( eOp ))
return 1; // only the condition counts as parameter
else
@@ -1176,8 +1173,12 @@ bool FormulaMissingContext::AddMissingExternal( FormulaTokenArray *pNewArr ) con
const OUString &rName = mpFunc->GetExternal();
- // initial (fast) check:
- sal_Unicode nLastChar = rName[ rName.getLength() - 1];
+ // initial (fast) checks:
+ sal_Int32 nLength = rName.getLength();
+ if (!nLength)
+ return false;
+
+ sal_Unicode nLastChar = rName[ nLength - 1];
if ( nLastChar != 't' && nLastChar != 'm' )
return false;