From 18cd17813ebf19ac247d2d8003c3b96fb8582d28 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 25 Jun 2013 11:54:10 -0400 Subject: Move a common if statement into the function. Change-Id: Ic13c9e7bdfea97c4f7782181dc70d6965ba0b6b9 --- sc/source/core/data/dociter.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 08d7dbc2f6c2..60696df7e344 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) { -- cgit