diff options
-rw-r--r-- | sot/qa/cppunit/data/pass/next-page-1.compound | bin | 0 -> 763 bytes | |||
-rw-r--r-- | sot/source/sdstor/stgstrms.cxx | 22 |
2 files changed, 18 insertions, 4 deletions
diff --git a/sot/qa/cppunit/data/pass/next-page-1.compound b/sot/qa/cppunit/data/pass/next-page-1.compound Binary files differnew file mode 100644 index 000000000000..8a187a3bade8 --- /dev/null +++ b/sot/qa/cppunit/data/pass/next-page-1.compound diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index a60b13db55b7..1ecdc042f351 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -429,13 +429,27 @@ bool StgStrm::Pos2Page( sal_Int32 nBytePos ) sal_Int32 nBgn = m_aPagesCache.back(); // Start adding pages while we can - while( nToAdd > 0 && nBgn >= 0 ) + while (nToAdd > 0 && nBgn >= 0) { - nBgn = m_pFat->GetNextPage( nBgn ); + sal_Int32 nOldBgn = nBgn; + nBgn = m_pFat->GetNextPage(nOldBgn); if( nBgn >= 0 ) { - m_aPagesCache.push_back( nBgn ); - nToAdd--; + if (nOldBgn != nBgn) + { + //very much the normal case + m_aPagesCache.push_back(nBgn); + --nToAdd; + } + else + { + //unclear if this is something we should just immediately + //reject, or allow, for the moment support it but + //optimize that all the pages are the same + SAL_WARN("sot", "fat next page is the same as current page, autofilling " << nToAdd << " pages"); + m_aPagesCache.insert(m_aPagesCache.end(), nToAdd, nBgn); + nToAdd = 0; + } } } } |