summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-06-19 15:45:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-06-19 21:24:00 +0200
commit5c59e061c6271cfe2f8ec12ba21de50e71bd9ef4 (patch)
tree011da297c1eb73fe4e375b5f6b2b193cfb7aed79
parentb85491e40ccb83ff78c7c4b2c0d535eafa5d23ed (diff)
SvMemoryStream::GetSize can be more efficient
Change-Id: I6d60d6549089e049d730c1000ab7ec592924c685 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117499 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/tools/stream.hxx2
-rw-r--r--tools/source/stream/stream.cxx9
2 files changed, 1 insertions, 10 deletions
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index b55a45ff3022..f99b09955368 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -658,7 +658,7 @@ public:
virtual void ResetError() override;
- sal_uInt64 GetSize();
+ sal_uInt64 GetSize() { return TellEnd(); }
std::size_t GetEndOfData() const { return nEndOfData; }
const void* GetData() { Flush(); return pBuf; }
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 04ddd2cba111..515f3a1657ab 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1673,15 +1673,6 @@ SvMemoryStream::~SvMemoryStream()
}
}
-sal_uInt64 SvMemoryStream::GetSize()
-{
- Flush();
- sal_uInt64 const nTemp = Tell();
- sal_uInt64 const nLength = Seek( STREAM_SEEK_TO_END );
- Seek( nTemp );
- return nLength;
-}
-
void SvMemoryStream::SetBuffer( void* pNewBuf, std::size_t nCount,
std::size_t nEOF )
{