[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Tue Jun 25 08:52:03 PDT 2013


 sc/source/core/data/dociter.cxx |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit fbc67f736ba39c43d6a2320c074e1e96af896b29
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Tue Jun 25 11:54:10 2013 -0400

    Move a common if statement into the function.
    
    Change-Id: Ic13c9e7bdfea97c4f7782181dc70d6965ba0b6b9

diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 032362b..9c92fc8 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1762,6 +1762,10 @@ namespace {
 
 bool advanceBlock(size_t nRow, sc::CellStoreType::const_iterator& rPos, const sc::CellStoreType::const_iterator& rEnd)
 {
+    if (nRow < rPos->position + rPos->size)
+        // Block already contains the specified row. Nothing to do.
+        return true;
+
     // This block is behind the current row position. Advance the block.
     for (++rPos; rPos != rEnd; ++rPos)
     {
@@ -1789,9 +1793,8 @@ void ScHorizontalCellIterator::Advance()
         if (nRow < r.maPos->position)
             continue;
 
-        if (r.maPos->position + r.maPos->size <= nRow)
-            if (!advanceBlock(nRow, r.maPos, r.maEnd))
-                continue;
+        if (!advanceBlock(nRow, r.maPos, r.maEnd))
+            continue;
 
         if (r.maPos->type == sc::element_type_empty)
             continue;
@@ -1827,9 +1830,8 @@ void ScHorizontalCellIterator::Advance()
                 continue;
             }
 
-            if (r.maPos->position + r.maPos->size <= nRow)
-                if (!advanceBlock(nRow, r.maPos, r.maEnd))
-                    continue;
+            if (!advanceBlock(nRow, r.maPos, r.maEnd))
+                continue;
 
             if (r.maPos->type == sc::element_type_empty)
             {


More information about the Libreoffice-commits mailing list