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

Tor Lillqvist tml at collabora.com
Tue Feb 9 13:59:21 UTC 2016


 sc/source/core/tool/scmatrix.cxx |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 8e0ed97101356ba537d0f85b2971bc22eabc633b
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Feb 5 15:01:48 2016 +0200

    tdf#97369: Fix SUMming in the software interpreter
    
    GetRefRowSize() is not what we want, but GetArrayLength(). I think. At
    least helps in the sample document. (Need a hard recalc after loading
    it, though, but I assume that is expected.)
    
    Also, fix the handling of multiple columns in the area being summed.
    
    Change-Id: I21477ca83042a40a300bc033e4a8b74ab5fc3015
    Reviewed-on: https://gerrit.libreoffice.org/22153
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    Tested-by: Tor Lillqvist <tml at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/22200
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index d3816b5..6018ca1 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -3397,13 +3397,13 @@ ScMatrix::IterateResult ScVectorRefMatrix::Sum(bool bTextAsZero) const
     const std::vector<formula::VectorRefArray>& rArrays = mpToken->GetArrays();
     size_t nDataSize = mnRowSize;
 
-    if (mnRowStart >= mpToken->GetRefRowSize())
+    if (mnRowStart >= mpToken->GetArrayLength())
     {
         return ScMatrix::IterateResult(0.0, 0.0, 0);
     }
-    else if (nDataSize > mpToken->GetRefRowSize() + mnRowStart)
+    else if (nDataSize > mpToken->GetArrayLength() + mnRowStart)
     {
-        nDataSize = mpToken->GetRefRowSize() - mnRowStart;
+        nDataSize = mpToken->GetArrayLength() - mnRowStart;
     }
 
     double mfFirst = 0.0;
@@ -3434,11 +3434,10 @@ ScMatrix::IterateResult ScVectorRefMatrix::Sum(bool bTextAsZero) const
                 }
             }
             p += i;
-            nDataSize -= i;
-            if (nDataSize == 0)
+            if (i == nDataSize)
                 continue;
 
-            sc::ArraySumFunctor functor(p, nDataSize);
+            sc::ArraySumFunctor functor(p, nDataSize-i);
 
             mfRest += functor();
         }


More information about the Libreoffice-commits mailing list