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>
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index 3f47283..6a2a51e 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