diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-05-03 00:05:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-05-03 00:06:33 +0100 |
commit | d726281e9020ebaddfdf6659ecfe7a0454014dff (patch) | |
tree | 439e6e848904ec034c8630444d5dbe3e6443ab06 /tools | |
parent | 80fdb3498c68f9e7f9bdd98674e762cb084fce57 (diff) |
Related: fdo#47644 compound storage backend is poor at knowing stream size
Change-Id: Ie4aa6939f9f37e04fda5425a6e28c5d846a9cb62
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inc/tools/stream.hxx | 3 | ||||
-rw-r--r-- | tools/source/stream/stream.cxx | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx index dc4505a06a35..d60f9e6ed904 100644 --- a/tools/inc/tools/stream.hxx +++ b/tools/inc/tools/stream.hxx @@ -374,7 +374,7 @@ public: sal_Size SeekRel( sal_sSize nPos ); sal_Size Tell() const { return nBufFilePos+nBufActualPos; } //length between current (Tell()) pos and end of stream - sal_Size remainingSize(); + virtual sal_Size remainingSize(); void Flush(); sal_Bool IsEof() const { return bIsEof; } // next Tell() <= nSize @@ -789,6 +789,7 @@ public: sal_Bool IsObjectMemoryOwner() { return bOwnsData; } void SetResizeOffset( sal_Size nNewResize ) { nResize = nNewResize; } sal_Size GetResizeOffset() const { return nResize; } + virtual sal_Size remainingSize() { return GetSize() - Tell(); } }; // -------------------- diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 96cabc266c34..c1f06a78d97f 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1703,9 +1703,9 @@ sal_Size SvStream::Seek( sal_Size nFilePos ) return nBufFilePos + nBufActualPos; } -//probably not as inefficient as it looks seeing as STREAM_SEEK_TO_END in the -//Seek backends is nomally special cased feel free to make this virtual and add -//good implementations for SvFileStream etc +//STREAM_SEEK_TO_END in the some of the Seek backends is special cased to be +//efficient, in others e.g. SotStorageStream it's really horribly slow, and in +//those this should be overridden sal_Size SvStream::remainingSize() { sal_Size nCurr = Tell(); |