[Libreoffice-commits] core.git: sc/source
Caolán McNamara
caolanm at redhat.com
Sat Nov 25 16:44:52 UTC 2017
sc/source/core/data/table2.cxx | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
New commits:
commit 77ef84ef7251004e0c581174929a1eb551112ec3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Nov 25 16:42:48 2017 +0000
Revert "ofz#4406: don't increment ScCompressedArray::Iterator past end"
that doesn't help of course
This reverts commit ab58e2e68f969e49b97b28b81225ed1e87df0855.
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index b7b169e418b8..a45d7af408c2 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2962,15 +2962,15 @@ sal_uLong ScTable::GetColWidth( SCCOL nStartCol, SCCOL nEndCol ) const
bool bHidden = false;
SCCOL nLastHiddenCol = -1;
auto colWidthIt = mpColWidth->begin() + nStartCol;
- for (SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol)
+ for (SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol, ++colWidthIt)
{
if (nCol > nLastHiddenCol)
bHidden = ColHidden(nCol, nullptr, &nLastHiddenCol);
- if (!bHidden)
- nW += *colWidthIt;
+ if (bHidden)
+ continue;
- ++colWidthIt;
+ nW += *colWidthIt;
}
return nW;
}
@@ -3406,12 +3406,9 @@ SCCOL ScTable::GetLastChangedCol() const
SCCOL nLastFound = 0;
auto colWidthIt = mpColWidth->begin() + 1;
- for (SCCOL nCol = 1; nCol < aCol.size(); ++nCol)
- {
+ for ( SCCOL nCol = 1; nCol < aCol.size(); nCol++, ++colWidthIt )
if ((mpColFlags->GetValue(nCol) & CRFlags::All) || (*colWidthIt != STD_COL_WIDTH))
nLastFound = nCol;
- ++colWidthIt;
- }
return nLastFound;
}
@@ -3825,13 +3822,11 @@ sal_uLong ScTable::GetColOffset( SCCOL nCol, bool bHiddenAsZero ) const
sal_uLong n = 0;
if ( mpColWidth )
{
+ SCCOL i;
auto colWidthIt = mpColWidth->begin();
- for (SCCOL i = 0; i < nCol; ++i)
- {
+ for( i = 0; i < nCol; i++, ++colWidthIt )
if (!( bHiddenAsZero && ColHidden(i) ))
n += *colWidthIt;
- ++colWidthIt;
- }
}
else
{
More information about the Libreoffice-commits
mailing list