diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2024-03-10 20:46:23 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-11 06:31:18 +0100 |
commit | ae351d9d5fc4fc3c0e02853e0a974791e41786fe (patch) | |
tree | c3fc7a42e17da1238971f26bfa300b93ce6a30fe | |
parent | 5c99838c1ab0ca34648256f47c8719eef00f088b (diff) |
tdf#158773 reduce cost of importing binary data
no need to pass it via the internal buffer of SequenceOutputStream when
we can read it directly
Change-Id: I832737d73309449a1f3a26a4b451977a2a580de3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164634
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | oox/source/core/filterbase.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx index 3f47283d0825..6a2a51e47577 100644 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx @@ -386,14 +386,13 @@ bool FilterBase::importBinaryData( StreamDataSequence & orDataSeq, const OUStrin return false; // try to open the stream (this may fail - do not assert) - BinaryXInputStream aInStrm( openInputStream( rStreamName ), true ); - if( aInStrm.isEof() ) + Reference<XInputStream> xInStream = openInputStream( rStreamName ); + if (!xInStream) return false; // copy the entire stream to the passed sequence - SequenceOutputStream aOutStrm( orDataSeq ); - aInStrm.copyToStream( aOutStrm ); - return true; + sal_Int32 nBytesRead = xInStream->readBytes( orDataSeq, SAL_MAX_INT32); + return nBytesRead != -1 && nBytesRead != 0; } // com.sun.star.lang.XServiceInfo interface |