[Libreoffice-commits] core.git: 3 commits - formula/source sc/source

Eike Rathke erack at redhat.com
Mon May 2 18:40:26 UTC 2016


 formula/source/core/api/FormulaCompiler.cxx |    7 ++++---
 sc/source/core/data/formulacell.cxx         |   14 +++++++++++++-
 2 files changed, 17 insertions(+), 4 deletions(-)

New commits:
commit edd4370f5ba49a26a526995b6a28f623d68041ce
Author: Eike Rathke <erack at redhat.com>
Date:   Mon May 2 20:37:59 2016 +0200

    check presence of token, tdf#96426 follow-up
    
    Change-Id: I4c368dfd113b02d208013b4ba79dff606769a150

diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 96bb268..ffd0f89 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -305,6 +305,9 @@ bool isRangeResultOpCode( OpCode eOp )
 }
 
 /**
+    @param  pToken
+            MUST be a valid token, caller has to ensure.
+
     @param  bRight
             If bRPN==false, bRight==false means opcodes for left side are
             checked, bRight==true means opcodes for right side. If bRPN==true
@@ -1200,6 +1203,7 @@ bool FormulaCompiler::GetToken()
                 pArr->nIndex--;     // we advanced to the second ocColRowName, step back
             }
             else if (pSpacesToken && FormulaGrammar::isExcelSyntax( meGrammar) &&
+                    pCurrToken && mpToken &&
                     isPotentialRangeType( pCurrToken.get(), false, false) &&
                     isPotentialRangeType( mpToken.get(), false, true))
             {
commit b79d226017b1cb090838165f5a701f90fc278709
Author: Eike Rathke <erack at redhat.com>
Date:   Mon May 2 20:01:54 2016 +0200

    Revert "crashtesting: fix ooo123540-1.xlsx etc"
    
    This reverts commit bfca69eddd3d94e74d6b73f91476b79c8f72cce7.
    
    Rather let the caller check for a valid token instead of checking it
    twice for other places that already do, and we usually need two valid
    tokens before even one call makes sens.

diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 85037d4..96bb268 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -312,9 +312,6 @@ bool isRangeResultOpCode( OpCode eOp )
  */
 bool isPotentialRangeType( FormulaToken* pToken, bool bRPN, bool bRight )
 {
-    if (!pToken)
-        return false;
-
     switch (pToken->GetType())
     {
         case svByte:                // could be range result, but only a few
commit 8474c5f14966c9268f92499870feb3c3d21658b3
Author: Eike Rathke <erack at redhat.com>
Date:   Mon May 2 19:52:23 2016 +0200

    silence ScTableRefToken::GetSheet() SAL_WARN about unhandled
    
    Change-Id: I539bad573bfc459103acc0cb0227bad7681b79aa

diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 57a7e64..fefde27 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3908,8 +3908,20 @@ ScFormulaCell::CompareState ScFormulaCell::CompareByTokenArray( ScFormulaCell& r
             // different OpCode values.
             case formula::svIndex:
                 {
-                    if (pThisTok->GetIndex() != pOtherTok->GetIndex() || pThisTok->GetSheet() != pOtherTok->GetSheet())
+                    if (pThisTok->GetIndex() != pOtherTok->GetIndex())
                         return NotEqual;
+                    switch (pThisTok->GetOpCode())
+                    {
+                        case ocTableRef:
+                            // nothing, sheet value assumed as -1, silence
+                            // ScTableRefToken::GetSheet() SAL_WARN about
+                            // unhandled
+                            ;
+                            break;
+                        default:    // ocName, ocDBArea
+                            if (pThisTok->GetSheet() != pOtherTok->GetSheet())
+                                return NotEqual;
+                    }
                 }
                 break;
             default:


More information about the Libreoffice-commits mailing list