From dbe94dd3b64e74f661ea7193d8e06ac91f1dd7b0 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 7 Nov 2018 09:12:23 +0200 Subject: tdf#120657 Pie chart saved as DOC doesn't preview in MSO regression from commit 9ec8bf8f22fe74884185492ef2576ce79b41e4f1 add SvStream::TellEnd the problem is that in this stack trace sot/source/sdstor/stgelem.hxx:130 sot/source/sdstor/stgdir.cxx:300 sot/source/sdstor/stg.cxx:245 sot/source/sdstor/storage.cxx:187 tools/source/stream/stream.cxx:1908 sw/source/filter/ww8/ww8scan.cxx:6267 The StgEntry returns a size of 0. If we do something else to the SotStorageStream first, then it materialises a temporary stream, and that stream returns a valid size. Also implement suggestions from mike kaganski: IMO, it would be more robust to implement this new function as virtual (instead of the remainingSize()), and reimplement the latter as non-virtual one using the new one and doing the necessary correction. Change-Id: Id1462d918570a684ec67099c30181436a27d3c6a Reviewed-on: https://gerrit.libreoffice.org/62984 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-by: Noel Grandin --- include/tools/stream.hxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/tools/stream.hxx') diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx index 4da1d2e0adb7..c627ed494998 100644 --- a/include/tools/stream.hxx +++ b/include/tools/stream.hxx @@ -272,9 +272,9 @@ public: sal_uInt64 Seek( sal_uInt64 nPos ); sal_uInt64 SeekRel( sal_Int64 nPos ); sal_uInt64 Tell() const { return m_nBufFilePos + m_nBufActualPos; } - sal_uInt64 TellEnd(); + virtual sal_uInt64 TellEnd(); // length between current (Tell()) pos and end of stream - virtual sal_uInt64 remainingSize(); + sal_uInt64 remainingSize(); void Flush(); // next Tell() <= nSize bool SetStreamSize( sal_uInt64 nSize ); @@ -669,7 +669,7 @@ public: void ObjectOwnsMemory( bool bOwn ) { bOwnsData = bOwn; } void SetResizeOffset( std::size_t nNewResize ) { nResize = nNewResize; } - virtual sal_uInt64 remainingSize() override { FlushBuffer(true); return GetEndOfData() - Tell(); } + virtual sal_uInt64 TellEnd() override { FlushBuffer(true); return nEndOfData; } }; #endif -- cgit