[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sc/source

Eike Rathke erack at redhat.com
Mon May 23 08:13:35 UTC 2016


 sc/source/core/tool/interpr1.cxx |   87 ++++++++++++++++++++++++++++++++++++---
 sc/source/core/tool/interpr4.cxx |    8 +++
 sc/source/core/tool/interpr5.cxx |   33 ++++++++++----
 3 files changed, 112 insertions(+), 16 deletions(-)

New commits:
commit 4c05c610661096342c0f826936aa3307a7ca78b3
Author: Eike Rathke <erack at redhat.com>
Date:   Fri May 20 15:29:16 2016 +0200

    Resolves: tdf#93101 handle external references and propagate error
    
    Cherry-picked 5 commits from master:
    
    tdf#93101 propagate external reference error from refcache token
    
    (cherry picked from commit 7de92ad48d8c4fe7a1f9fb24ef8afc7d8907788e)
    
    tdf#93101 correctly resolve svExternalSingleRef token in GetMatrix()
    
    ... including error propagation, and use GetNewMat() instead of a plain
    ScFullMatrix so the interpreter error handling is set up.
    
    (cherry picked from commit 2f94ff566f7827792175daedb92f12a7e61ad95d)
    
    tdf#93101 handle svExternalSingleRef in ISERROR()
    
    (cherry picked from commit 824cf015683383b553c744a746ac8e8ea65495cf)
    
    handle svExternalSingleRef in all IS*() functions, tdf#93101 related
    
    (cherry picked from commit f053086fbc625fca8ba7b956738d33ba78a80f9b)
    
    handle svExternalDoubleRef in all IS*() functions, tdf#93101 related
    
    (cherry picked from commit 365c4d8c60e89fd57a91f51ca51a8796fe91edd7)
    
    862c46f9afc2afd0bb2a23aa767158e0945583a5
    9e2a4aeb16d6777153d2f47a1c1af68fe2e97780
    14181dd2dbb5d412e3dd165dcbf7468cb8ea8b21
    48813de703ea926b8828f4e262393f7643216989
    
    Change-Id: I90491a7b18fddaddb3bbb4d7a3f8b9555b9b1198
    Reviewed-on: https://gerrit.libreoffice.org/25207
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 2d888a3..fa9d70a 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -1885,9 +1885,18 @@ bool ScInterpreter::IsString()
             }
         }
         break;
+        case svExternalSingleRef:
+        {
+            ScExternalRefCache::TokenRef pToken;
+            PopExternalSingleRef(pToken);
+            if (!nGlobalError && pToken->GetType() == svString)
+                bRes = true;
+        }
+        break;
+        case svExternalDoubleRef:
         case svMatrix:
         {
-            ScMatrixRef pMat = PopMatrix();
+            ScMatrixRef pMat = GetMatrix();
             if ( !pMat )
                 ;   // nothing
             else if ( !pJumpMatrix )
@@ -2452,6 +2461,22 @@ void ScInterpreter::ScIsRef()
                 bRes = !x.get()->GetRefList()->empty();
         }
         break;
+        case svExternalSingleRef:
+        {
+            ScExternalRefCache::TokenRef pToken;
+            PopExternalSingleRef(pToken);
+            if (!nGlobalError)
+                bRes = true;
+        }
+        break;
+        case svExternalDoubleRef:
+        {
+            ScExternalRefCache::TokenArrayRef pArray;
+            PopExternalDoubleRef(pArray);
+            if (!nGlobalError)
+                bRes = true;
+        }
+        break;
         default:
             Pop();
     }
@@ -2493,9 +2518,18 @@ void ScInterpreter::ScIsValue()
             }
         }
         break;
+        case svExternalSingleRef:
+        {
+            ScExternalRefCache::TokenRef pToken;
+            PopExternalSingleRef(pToken);
+            if (!nGlobalError && pToken->GetType() == svDouble)
+                bRes = true;
+        }
+        break;
+        case svExternalDoubleRef:
         case svMatrix:
         {
-            ScMatrixRef pMat = PopMatrix();
+            ScMatrixRef pMat = GetMatrix();
             if ( !pMat )
                 ;   // nothing
             else if ( !pJumpMatrix )
@@ -2643,9 +2677,19 @@ void ScInterpreter::ScIsNV()
             }
         }
         break;
+        case svExternalSingleRef:
+        {
+            ScExternalRefCache::TokenRef pToken;
+            PopExternalSingleRef(pToken);
+            if (nGlobalError == NOTAVAILABLE ||
+                    (pToken && pToken->GetType() == svError && pToken->GetError() == NOTAVAILABLE))
+                bRes = true;
+        }
+        break;
+        case svExternalDoubleRef:
         case svMatrix:
         {
-            ScMatrixRef pMat = PopMatrix();
+            ScMatrixRef pMat = GetMatrix();
             if ( !pMat )
                 ;   // nothing
             else if ( !pJumpMatrix )
@@ -2690,9 +2734,19 @@ void ScInterpreter::ScIsErr()
             }
         }
         break;
+        case svExternalSingleRef:
+        {
+            ScExternalRefCache::TokenRef pToken;
+            PopExternalSingleRef(pToken);
+            if ((nGlobalError && nGlobalError != NOTAVAILABLE) || !pToken ||
+                    (pToken->GetType() == svError && pToken->GetError() != NOTAVAILABLE))
+                bRes = true;
+        }
+        break;
+        case svExternalDoubleRef:
         case svMatrix:
         {
-            ScMatrixRef pMat = PopMatrix();
+            ScMatrixRef pMat = GetMatrix();
             if ( nGlobalError || !pMat )
                 bRes = ((nGlobalError && nGlobalError != NOTAVAILABLE) || !pMat);
             else if ( !pJumpMatrix )
@@ -2746,9 +2800,18 @@ void ScInterpreter::ScIsError()
             }
         }
         break;
+        case svExternalSingleRef:
+        {
+            ScExternalRefCache::TokenRef pToken;
+            PopExternalSingleRef(pToken);
+            if (nGlobalError || !pToken || pToken->GetType() == svError)
+                bRes = true;
+        }
+        break;
+        case svExternalDoubleRef:
         case svMatrix:
         {
-            ScMatrixRef pMat = PopMatrix();
+            ScMatrixRef pMat = GetMatrix();
             if ( nGlobalError || !pMat )
                 bRes = true;
             else if ( !pJumpMatrix )
@@ -2817,9 +2880,21 @@ bool ScInterpreter::IsEven()
             bRes = true;
         }
         break;
+        case svExternalSingleRef:
+        {
+            ScExternalRefCache::TokenRef pToken;
+            PopExternalSingleRef(pToken);
+            if (!nGlobalError && pToken->GetType() == svDouble)
+            {
+                fVal = pToken->GetDouble();
+                bRes = true;
+            }
+        }
+        break;
+        case svExternalDoubleRef:
         case svMatrix:
         {
-            ScMatrixRef pMat = PopMatrix();
+            ScMatrixRef pMat = GetMatrix();
             if ( !pMat )
                 ;   // nothing
             else if ( !pJumpMatrix )
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 92e1304..cbdc51e 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1190,6 +1190,9 @@ void ScInterpreter::PopExternalSingleRef(
         return;
     }
 
+    if (xNew->GetType() == svError)
+        SetError( xNew->GetError());
+
     rToken = xNew;
     if (pFmt)
         *pFmt = aFmt;
@@ -1288,6 +1291,11 @@ void ScInterpreter::GetExternalDoubleRef(
     }
 
     formula::FormulaToken* pToken = pArray->First();
+    if (pToken->GetType() == svError)
+    {
+        SetError( pToken->GetError());
+        return;
+    }
     if (pToken->GetType() != svMatrix)
     {
         SetError(errIllegalArgument);
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index a0933c0..b85a942 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -455,25 +455,38 @@ ScMatrixRef ScInterpreter::GetMatrix()
         {
             ScExternalRefCache::TokenRef pToken;
             PopExternalSingleRef(pToken);
-            if (!pToken)
+            pMat = GetNewMat( 1, 1, true);
+            if (!pMat)
             {
-                PopError();
                 SetError( errIllegalArgument);
                 break;
             }
-            if (pToken->GetType() == svDouble)
+            if (!pToken)
             {
-                pMat = new ScFullMatrix(1, 1, 0.0);
-                pMat->PutDouble(pToken->GetDouble(), 0, 0);
+                SetError( errIllegalArgument);
+                pMat->PutError( nGlobalError, 0, 0);
+                nGlobalError = 0;
+                break;
             }
-            else if (pToken->GetType() == svString)
+            if (nGlobalError)
             {
-                pMat = new ScFullMatrix(1, 1, 0.0);
-                pMat->PutString(pToken->GetString(), 0, 0);
+                pMat->PutError( nGlobalError, 0, 0);
+                nGlobalError = 0;
+                break;
             }
-            else
+            switch (pToken->GetType())
             {
-                pMat = new ScFullMatrix(1, 1);
+                case svError:
+                    pMat->PutError( pToken->GetError(), 0, 0);
+                break;
+                case svDouble:
+                    pMat->PutDouble( pToken->GetDouble(), 0, 0);
+                break;
+                case svString:
+                    pMat->PutString( pToken->GetString(), 0, 0);
+                break;
+                default:
+                    ;   // nothing, empty element matrix
             }
         }
         break;


More information about the Libreoffice-commits mailing list