summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2017-06-14 15:27:55 +0300
committerTor Lillqvist <tml@collabora.com>2017-06-14 15:45:19 +0300
commit92b7acdf2a1159af8a31da22ce6227950f709040 (patch)
treeaa5ef108ff2a280ab6746e05315b1058b9f06291 /formula
parentbfe999b81de0aa5f547251b263e82f8db3b8ac50 (diff)
Avoid use of FormulaTokenArray::First() and Next() in another place
Change-Id: Ie542f62b910648ee494b908703083d28f92d9a33
Diffstat (limited to 'formula')
-rw-r--r--formula/source/core/api/token.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index a11cc1adf023..b43fd7fec80e 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -1473,7 +1473,8 @@ FormulaTokenArray * FormulaTokenArray::RewriteMissing( const MissingConvention &
// At least ScRecalcMode::ALWAYS needs to be set.
pNewArr->AddRecalcMode( GetRecalcMode());
- for ( FormulaToken *pCur = First(); pCur; pCur = Next() )
+ FormulaTokenArrayPlainIterator aIter(*this);
+ for ( FormulaToken *pCur = aIter.First(); pCur; pCur = aIter.Next() )
{
bool bAdd = true;
// Don't write the expression of the new inserted ADDRESS() parameter.
@@ -1503,10 +1504,10 @@ FormulaTokenArray * FormulaTokenArray::RewriteMissing( const MissingConvention &
pCur->GetDouble() == 0.0)
{
// No other expression, between separators.
- FormulaToken* p = PeekPrevNoSpaces();
+ FormulaToken* p = aIter.PeekPrevNoSpaces();
if (p && p->GetOpCode() == ocSep)
{
- p = PeekNextNoSpaces();
+ p = aIter.PeekNextNoSpaces();
if (p && p->GetOpCode() == ocSep)
bAdd = false;
}
@@ -1518,7 +1519,7 @@ FormulaTokenArray * FormulaTokenArray::RewriteMissing( const MissingConvention &
case ocOpen:
{
++nFn; // all following operations on _that_ function
- pCtx[ nFn ].mpFunc = PeekPrevNoSpaces();
+ pCtx[ nFn ].mpFunc = aIter.PeekPrevNoSpaces();
pCtx[ nFn ].mnCurArg = 0;
OpCode eOp;
if (rConv.isPODF() && pCtx[ nFn ].mpFunc && pCtx[ nFn ].mpFunc->GetOpCode() == ocAddress)