sc/source/core/data/table2.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
New commits: commit dbd71116ea19d33476d2619440cf3008402eaf72 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Nov 27 20:53:41 2017 +0000 ofz#4406: don't increment ScCompressedArray::Iterator past end Change-Id: I4975e0655b5ed3083244c63c86f29f3fcad48079 Reviewed-on: https://gerrit.libreoffice.org/45368 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 0fbd4abd6942..626f58747571 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2962,7 +2962,7 @@ 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 <= nEndCol) ? ++colWidthIt : (void)false) { if (nCol > nLastHiddenCol) bHidden = ColHidden(nCol, nullptr, &nLastHiddenCol); @@ -3405,8 +3405,9 @@ SCCOL ScTable::GetLastChangedCol() const return 0; SCCOL nLastFound = 0; + const auto nColSize = aCol.size(); auto colWidthIt = mpColWidth->begin() + 1; - for ( SCCOL nCol = 1; nCol < aCol.size(); nCol++, ++colWidthIt ) + for (SCCOL nCol = 1; nCol < nColSize; (++nCol < nColSize) ? ++colWidthIt : (void)false) if ((mpColFlags->GetValue(nCol) & CRFlags::All) || (*colWidthIt != STD_COL_WIDTH)) nLastFound = nCol; @@ -3822,9 +3823,8 @@ 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 < nCol) ? ++colWidthIt : (void)false) if (!( bHiddenAsZero && ColHidden(i) )) n += *colWidthIt; }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits