sot/source/sdstor/stgstrms.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
New commits: commit f35096b7f7f3ad168cd221a20823e25a56315948 Author: Armin Le Grand <[email protected]> Date: Wed Oct 16 16:47:38 2013 +0100 i123485 secured file import scanning existing pages (cherry picked from commit 04b38114b0ca4be9895d8f9fa842b6cb390c8036 and adapted to the rewritten scanBuildPageChainCache) Reviewed-on: https://gerrit.libreoffice.org/6272 Reviewed-by: Michael Meeks <[email protected]> Tested-by: Michael Meeks <[email protected]> (cherry picked from commit dfa1afd0e8b7ae9c706c4a3171a04752e24230b0) Conflicts: sot/source/sdstor/stgstrms.cxx Change-Id: Ib90d0563be5aeb69aa14c28b3304e42f3cc46162 Reviewed-on: https://gerrit.libreoffice.org/6314 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Miklos Vajna <[email protected]> diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index 1561204..1c9af60 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -23,6 +23,7 @@ #include <sal/log.hxx> #include <osl/file.hxx> #include <tools/tempfile.hxx> +#include <set> #include "sot/stg.hxx" #include "stgelem.hxx" @@ -339,16 +340,23 @@ void StgStrm::scanBuildPageChainCache(sal_Int32 *pOptionalCalcSize) bool bError = false; sal_Int32 nBgn = nStart; - sal_Int32 nOldBgn = -1; sal_Int32 nOptSize = 0; - while( nBgn >= 0 && nBgn != nOldBgn ) + + // Track already scanned PageNumbers here and use them to + // see if an already counted page is re-visited + std::set< sal_Int32 > nUsedPageNumbers; + + while( nBgn >= 0 && !bError ) { if( nBgn >= 0 ) m_aPagesCache.push_back(nBgn); - nOldBgn = nBgn; nBgn = pFat->GetNextPage( nBgn ); - if( nBgn == nOldBgn ) + + if( nUsedPageNumbers.find(nBgn) != nUsedPageNumbers.end() ) bError = true; + else + nUsedPageNumbers.insert(nBgn); + nOptSize += nPageSize; } if (bError) _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
