summaryrefslogtreecommitdiff
path: root/formula/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-07-01 23:54:28 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-07-02 05:30:44 +0000
commit1698abe554b0a657899b17381822efa4c46a8ca3 (patch)
tree6e174bcbe8d0080e5b1b6ba08825418ff22634bb /formula/source
parent6ccc588a522f1068706fe05f5c819e488b6628eb (diff)
resolved fdo#35411 redefined MAXCODE 512 to FORMULA_MAXTOKENS 8192
Also renamed MAXJUMPCOUNT to FORMULA_MAXJUMPCOUNT but without changing the value as the runtime array size of ocChose depends on it, should be changed before. Eliminated the duplicated and error causing redefinition of both in sc/inc/compiler.hxx Change-Id: I0e87d1439c9564a4f475fcb2870ab51c3b586942 (cherry picked from commit 9c1ca6dca3b553c302a635357e33591605343b99) Reviewed-on: https://gerrit.libreoffice.org/4667 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'formula/source')
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx14
-rw-r--r--formula/source/core/api/token.cxx11
2 files changed, 12 insertions, 13 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 514d11caf14e..afd6746411df 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1195,7 +1195,7 @@ void FormulaCompiler::Factor()
pFacToken->GetJump()[ 0 ] = 3; // if, else, behind
break;
case ocChose:
- pFacToken->GetJump()[ 0 ] = MAXJUMPCOUNT+1;
+ pFacToken->GetJump()[ 0 ] = FORMULA_MAXJUMPCOUNT + 1;
break;
case ocIfError:
case ocIfNA:
@@ -1225,7 +1225,7 @@ void FormulaCompiler::Factor()
nJumpMax = 3;
break;
case ocChose:
- nJumpMax = MAXJUMPCOUNT;
+ nJumpMax = FORMULA_MAXJUMPCOUNT;
break;
case ocIfError:
case ocIfNA:
@@ -1236,7 +1236,7 @@ void FormulaCompiler::Factor()
SAL_WARN( "formula.core", "FormulaCompiler::Factor: forgot to add a jump max case?");
}
short nJumpCount = 0;
- while ( (nJumpCount < (MAXJUMPCOUNT - 1)) && (eOp == ocSep)
+ while ( (nJumpCount < (FORMULA_MAXJUMPCOUNT - 1)) && (eOp == ocSep)
&& (!pArr->GetCodeError() || bIgnoreErrors) )
{
if ( ++nJumpCount <= nJumpMax )
@@ -1262,7 +1262,7 @@ void FormulaCompiler::Factor()
bLimitOk = (nJumpCount <= 3);
break;
case ocChose:
- bLimitOk = (nJumpCount < MAXJUMPCOUNT); /* TODO: check, really <, not <=? */
+ bLimitOk = (nJumpCount < FORMULA_MAXJUMPCOUNT); /* TODO: check, really <, not <=? */
break;
case ocIfError:
case ocIfNA:
@@ -1546,7 +1546,7 @@ bool FormulaCompiler::CompileTokenArray()
pArr->nRefs = 0; // count from start
pArr->DelRPN();
pStack = NULL;
- FormulaToken* pData[ MAXCODE ];
+ FormulaToken* pData[ FORMULA_MAXTOKENS ];
pCode = pData;
bool bWasForced = pArr->IsRecalcModeForced();
if ( bWasForced )
@@ -1951,9 +1951,9 @@ OpCode FormulaCompiler::NextToken()
}
void FormulaCompiler::PutCode( FormulaTokenRef& p )
{
- if( pc >= MAXCODE-1 )
+ if( pc >= FORMULA_MAXTOKENS - 1 )
{
- if ( pc == MAXCODE-1 )
+ if ( pc == FORMULA_MAXTOKENS - 1 )
{
p = new FormulaByteToken( ocStop );
p->IncRef();
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index b341cdc19253..9ea036cd1f23 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -29,7 +29,6 @@
#include "formula/tokenarray.hxx"
#include "formula/FormulaCompiler.hxx"
#include <formula/compiler.hrc>
-#define MAXJUMPCOUNT 32 /* maximum number of jumps (ocChose) */
namespace formula
{
@@ -726,8 +725,8 @@ FormulaToken* FormulaTokenArray::MergeArray( )
FormulaToken* FormulaTokenArray::Add( FormulaToken* t )
{
if( !pCode )
- pCode = new FormulaToken*[ MAXCODE ];
- if( nLen < MAXCODE-1 )
+ pCode = new FormulaToken*[ FORMULA_MAXTOKENS ];
+ if( nLen < FORMULA_MAXTOKENS - 1 )
{
CheckToken(*t);
pCode[ nLen++ ] = t;
@@ -742,7 +741,7 @@ FormulaToken* FormulaTokenArray::Add( FormulaToken* t )
else
{
t->Delete();
- if ( nLen == MAXCODE-1 )
+ if ( nLen == FORMULA_MAXTOKENS - 1 )
{
t = new FormulaByteToken( ocStop );
pCode[ nLen++ ] = t;
@@ -1194,11 +1193,11 @@ FormulaToken* FormulaTokenArray::AddOpCode( OpCode eOp )
case ocIfNA:
case ocChose:
{
- short nJump[MAXJUMPCOUNT + 1];
+ short nJump[FORMULA_MAXJUMPCOUNT + 1];
if ( eOp == ocIf )
nJump[ 0 ] = 3;
else if ( eOp == ocChose )
- nJump[ 0 ] = MAXJUMPCOUNT + 1;
+ nJump[ 0 ] = FORMULA_MAXJUMPCOUNT + 1;
else
nJump[ 0 ] = 2;
pRet = new FormulaJumpToken( eOp, (short*)nJump );