sc/source/filter/excel/xetable.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
New commits: commit 31678ed7eb992586c42816ab96391bc3a921f176 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Wed Mar 2 14:51:17 2022 +0100 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Wed Mar 2 18:03:54 2022 +0100 fix incorrect search start A mistake from 05259e880db187f6698d6d545504775459d6e96a, the second if branch doesn't guarantee anything about where EXC_XF_NOTFOUND elements start. Change-Id: I942f87a7320c13a8f87ab3c9f1683a75d7a1e135 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130876 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index bf50dd647933..cf46590cebfc 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2051,9 +2051,10 @@ void XclExpRow::Finalize( const ScfUInt16Vec& rColXFIndexes, ScfUInt16Vec& aXFIn // *** Remove unused BLANK cell records *** ------------------------------- - size_t maxStartAllDefault = std::max( nStartAllDefault, nStartColAllDefault ); + size_t maxStartAllNotFound; if( bUseColDefXFs ) { + size_t maxStartAllDefault = std::max( nStartAllDefault, nStartColAllDefault ); // use column default XF indexes // #i194#: remove cell XF indexes equal to column default XF indexes for( size_t i = 0; i < maxStartAllDefault; ++i ) @@ -2064,6 +2065,7 @@ void XclExpRow::Finalize( const ScfUInt16Vec& rColXFIndexes, ScfUInt16Vec& aXFIn // They can differ only up to maxNonDefault, in the rest they are the same. for( size_t i = maxStartAllDefault; i < aXFIndexes.size(); ++i ) aXFIndexes[ i ] = EXC_XF_NOTFOUND; + maxStartAllNotFound = maxStartAllDefault; } else { @@ -2074,10 +2076,11 @@ void XclExpRow::Finalize( const ScfUInt16Vec& rColXFIndexes, ScfUInt16Vec& aXFIn for( auto& rXFIndex : aXFIndexes ) if( rXFIndex == nRowXFIndex ) rXFIndex = EXC_XF_NOTFOUND; + maxStartAllNotFound = aXFIndexes.size(); } // remove unused parts of BLANK/MULBLANK cell records - size_t nStartAllNotFound = findFirstAllSameUntilEnd( aXFIndexes, EXC_XF_NOTFOUND, maxStartAllDefault ); + size_t nStartAllNotFound = findFirstAllSameUntilEnd( aXFIndexes, EXC_XF_NOTFOUND, maxStartAllNotFound ); nPos = 0; while( nPos < maCellList.GetSize() ) // do not cache list size, may change in the loop {