formula/source/core/api/token.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 92b7acdf2a1159af8a31da22ce6227950f709040
Author: Tor Lillqvist <t...@collabora.com>
Date:   Wed Jun 14 15:27:55 2017 +0300

    Avoid use of FormulaTokenArray::First() and Next() in another place
    
    Change-Id: Ie542f62b910648ee494b908703083d28f92d9a33

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)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to