[Libreoffice-commits] core.git: sc/source
Caolán McNamara
caolanm at redhat.com
Fri Nov 24 12:17:41 UTC 2017
sc/source/core/data/table2.cxx | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
New commits:
commit ab58e2e68f969e49b97b28b81225ed1e87df0855
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Nov 23 21:21:20 2017 +0000
ofz#4406: don't increment ScCompressedArray::Iterator past end
Change-Id: I2adc204722a6143384bab8aecd16bed42cb5016a
Reviewed-on: https://gerrit.libreoffice.org/45192
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index a45d7af408c2..b7b169e418b8 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, ++colWidthIt)
+ for (SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol)
{
if (nCol > nLastHiddenCol)
bHidden = ColHidden(nCol, nullptr, &nLastHiddenCol);
- if (bHidden)
- continue;
+ if (!bHidden)
+ nW += *colWidthIt;
- nW += *colWidthIt;
+ ++colWidthIt;
}
return nW;
}
@@ -3406,9 +3406,12 @@ SCCOL ScTable::GetLastChangedCol() const
SCCOL nLastFound = 0;
auto colWidthIt = mpColWidth->begin() + 1;
- for ( SCCOL nCol = 1; nCol < aCol.size(); nCol++, ++colWidthIt )
+ for (SCCOL nCol = 1; nCol < aCol.size(); ++nCol)
+ {
if ((mpColFlags->GetValue(nCol) & CRFlags::All) || (*colWidthIt != STD_COL_WIDTH))
nLastFound = nCol;
+ ++colWidthIt;
+ }
return nLastFound;
}
@@ -3822,11 +3825,13 @@ sal_uLong ScTable::GetColOffset( SCCOL nCol, bool bHiddenAsZero ) const
sal_uLong n = 0;
if ( mpColWidth )
{
- SCCOL i;
auto colWidthIt = mpColWidth->begin();
- for( i = 0; i < nCol; i++, ++colWidthIt )
+ for (SCCOL i = 0; i < nCol; ++i)
+ {
if (!( bHiddenAsZero && ColHidden(i) ))
n += *colWidthIt;
+ ++colWidthIt;
+ }
}
else
{
More information about the Libreoffice-commits
mailing list