oox/source/core/filterbase.cxx |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit ae351d9d5fc4fc3c0e02853e0a974791e41786fe
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Mar 10 20:46:23 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Mar 11 06:31:18 2024 +0100

    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.gran...@collabora.co.uk>

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

Reply via email to