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

Noel Grandin noel.grandin at collabora.co.uk
Thu May 24 12:09:04 UTC 2018


 sc/source/core/data/document.cxx |   20 ++++++++++----------
 sc/source/ui/view/viewfun3.cxx   |   26 +++++++++++++-------------
 2 files changed, 23 insertions(+), 23 deletions(-)

New commits:
commit c10928e703366341ab912c42e8959a087a7fa9ff
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu May 24 12:33:53 2018 +0200

    tdf#117706 Multi-select copying rows between sheets broken
    
    regression from
    
       commit 6529cd54c29c5800340530a1b8182c341fbeeafb
       don't use heap for elements in ScRangeList
    
    where I converted some loop variables from pointers to refs, forgetting
    to assigning to a ref is quite different from assigning to a pointer
    
    Change-Id: I4a365006317d16a24cbb1b43994906a0d4b4d424
    Reviewed-on: https://gerrit.libreoffice.org/54756
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 2014f09b9e71..9335bb31957e 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3126,22 +3126,22 @@ void ScDocument::GetClipArea(SCCOL& nClipX, SCROW& nClipY, bool bIncludeFiltered
         // No clip range.  Bail out.
         return;
 
-    ScRange & rRange = rClipRanges.front();
+    ScRange const & rRange = rClipRanges.front();
     SCCOL nStartCol = rRange.aStart.Col();
     SCCOL nEndCol   = rRange.aEnd.Col();
     SCROW nStartRow = rRange.aStart.Row();
     SCROW nEndRow   = rRange.aEnd.Row();
     for ( size_t i = 1, n = rClipRanges.size(); i < n; ++i )
     {
-        rRange = rClipRanges[ i ];
-        if (rRange.aStart.Col() < nStartCol)
-            nStartCol = rRange.aStart.Col();
-        if (rRange.aStart.Row() < nStartRow)
-            nStartRow = rRange.aStart.Row();
-        if (rRange.aEnd.Col() > nEndCol)
-            nEndCol = rRange.aEnd.Col();
-        if (rRange.aEnd.Row() < nEndRow)
-            nEndRow = rRange.aEnd.Row();
+        ScRange const rRange2 = rClipRanges[ i ];
+        if (rRange2.aStart.Col() < nStartCol)
+            nStartCol = rRange2.aStart.Col();
+        if (rRange2.aStart.Row() < nStartRow)
+            nStartRow = rRange2.aStart.Row();
+        if (rRange2.aEnd.Col() > nEndCol)
+            nEndCol = rRange2.aEnd.Col();
+        if (rRange2.aEnd.Row() < nEndRow)
+            nEndRow = rRange2.aEnd.Row();
     }
 
     nClipX = nEndCol - nStartCol;
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 3cfccc50c760..6435f617ecaa 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -306,26 +306,26 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
 
             // Check for geometrical feasibility of the ranges.
             bool bValidRanges = true;
-            ScRange & r = aClipParam.maRanges.front();
+            ScRange const * p = &aClipParam.maRanges.front();
             SCCOL nPrevColDelta = 0;
             SCROW nPrevRowDelta = 0;
-            SCCOL nPrevCol = r.aStart.Col();
-            SCROW nPrevRow = r.aStart.Row();
-            SCCOL nPrevColSize = r.aEnd.Col() - r.aStart.Col() + 1;
-            SCROW nPrevRowSize = r.aEnd.Row() - r.aStart.Row() + 1;
+            SCCOL nPrevCol = p->aStart.Col();
+            SCROW nPrevRow = p->aStart.Row();
+            SCCOL nPrevColSize = p->aEnd.Col() - p->aStart.Col() + 1;
+            SCROW nPrevRowSize = p->aEnd.Row() - p->aStart.Row() + 1;
             for ( size_t i = 1; i < aClipParam.maRanges.size(); ++i )
             {
-                r = aClipParam.maRanges[i];
+                p = &aClipParam.maRanges[i];
                 if ( pDoc->HasSelectedBlockMatrixFragment(
-                    r.aStart.Col(), r.aStart.Row(), r.aEnd.Col(), r.aEnd.Row(), rMark) )
+                    p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), rMark) )
                 {
                     if (!bApi)
                         ErrorMessage(STR_MATRIXFRAGMENTERR);
                     return false;
                 }
 
-                SCCOL nColDelta = r.aStart.Col() - nPrevCol;
-                SCROW nRowDelta = r.aStart.Row() - nPrevRow;
+                SCCOL nColDelta = p->aStart.Col() - nPrevCol;
+                SCROW nRowDelta = p->aStart.Row() - nPrevRow;
 
                 if ((nColDelta && nRowDelta) || (nPrevColDelta && nRowDelta) || (nPrevRowDelta && nColDelta))
                 {
@@ -341,8 +341,8 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
                         aClipParam.meDirection = ScClipParam::Row;
                 }
 
-                SCCOL nColSize = r.aEnd.Col() - r.aStart.Col() + 1;
-                SCROW nRowSize = r.aEnd.Row() - r.aStart.Row() + 1;
+                SCCOL nColSize = p->aEnd.Col() - p->aStart.Col() + 1;
+                SCROW nRowSize = p->aEnd.Row() - p->aStart.Row() + 1;
 
                 if (aClipParam.meDirection == ScClipParam::Column && nRowSize != nPrevRowSize)
                 {
@@ -358,8 +358,8 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b
                     break;
                 }
 
-                nPrevCol = r.aStart.Col();
-                nPrevRow = r.aStart.Row();
+                nPrevCol = p->aStart.Col();
+                nPrevRow = p->aStart.Row();
                 nPrevColDelta = nColDelta;
                 nPrevRowDelta = nRowDelta;
                 nPrevColSize  = nColSize;


More information about the Libreoffice-commits mailing list