Commit 8a9015bdd0e4d26c7c14b415895badd6607ed16b

Authored by m-holger
1 parent 2336590f

Update `Stream::copy_data_to` to avoid unnecessary replacement filters and decod…

…e parameters with their existing values.
Showing 1 changed file with 3 additions and 3 deletions
libqpdf/QPDF_Stream.cc
@@ -311,9 +311,9 @@ Stream::copy_data_to(Stream& dest) @@ -311,9 +311,9 @@ Stream::copy_data_to(Stream& dest)
311 if (qpdf()->doc().config().immediate_copy_from() && !s->stream_data) { 311 if (qpdf()->doc().config().immediate_copy_from() && !s->stream_data) {
312 // Pull the stream data into a buffer before attempting the copy operation. Do it on the 312 // Pull the stream data into a buffer before attempting the copy operation. Do it on the
313 // source stream so that if the source stream is copied multiple times, we don't have to 313 // source stream so that if the source stream is copied multiple times, we don't have to
314 - // keep duplicating the memory.  
315 - replaceStreamData(  
316 - getRawStreamData(), s->stream_dict["/Filter"], s->stream_dict["/DecodeParms"]); 314 + // keep duplicating the memory. Passing uninitialised object handles will preserve the
  315 + // existing filters and decode parameters.
  316 + replaceStreamData(getRawStreamData(), {}, {});
317 } 317 }
318 if (s->stream_data) { 318 if (s->stream_data) {
319 dest.replaceStreamData(s->stream_data, dict["/Filter"], dict["/DecodeParms"]); 319 dest.replaceStreamData(s->stream_data, dict["/Filter"], dict["/DecodeParms"]);