Commit 68d1093158d0efd22786f69fbdd21cf32394f88a

Authored by m-holger
1 parent b20485e4

In QPDFWriter::writeXRefStream use Pl_String instead of Pl_Buffer

Showing 1 changed file with 5 additions and 5 deletions
libqpdf/QPDFWriter.cc
... ... @@ -2473,7 +2473,8 @@ QPDFWriter::writeXRefStream(
2473 2473 // openObject to do it.
2474 2474 m->new_obj[xref_id].xref = QPDFXRefEntry(m->pipeline->getCount());
2475 2475  
2476   - Pipeline* p = pushPipeline(new Pl_Buffer("xref stream"));
  2476 + std::string xref_data;
  2477 + Pipeline* p = pushPipeline(new Pl_String("xref stream", nullptr, xref_data));
2477 2478 bool compressed = false;
2478 2479 if (m->compress_streams && !m->qdf_mode) {
2479 2480 compressed = true;
... ... @@ -2484,9 +2485,8 @@ QPDFWriter::writeXRefStream(
2484 2485 }
2485 2486 p = pushPipeline(new Pl_PNGFilter("pngify xref", p, Pl_PNGFilter::a_encode, esize));
2486 2487 }
2487   - std::shared_ptr<Buffer> xref_data;
2488 2488 {
2489   - PipelinePopper pp_xref(this, &xref_data);
  2489 + PipelinePopper pp_xref(this);
2490 2490 activatePipelineStack(pp_xref);
2491 2491 for (int i = first; i <= last; ++i) {
2492 2492 QPDFXRefEntry& e = m->new_obj[i].xref;
... ... @@ -2527,7 +2527,7 @@ QPDFWriter::writeXRefStream(
2527 2527 writeStringQDF("\n ");
2528 2528 writeString(" /Type /XRef");
2529 2529 writeStringQDF("\n ");
2530   - writeString(" /Length " + std::to_string(xref_data->getSize()));
  2530 + writeString(" /Length " + std::to_string(xref_data.size()));
2531 2531 if (compressed) {
2532 2532 writeStringQDF("\n ");
2533 2533 writeString(" /Filter /FlateDecode");
... ... @@ -2542,7 +2542,7 @@ QPDFWriter::writeXRefStream(
2542 2542 }
2543 2543 writeTrailer(which, size, true, prev, linearization_pass);
2544 2544 writeString("\nstream\n");
2545   - writeBuffer(xref_data);
  2545 + writeString(xref_data);
2546 2546 writeString("\nendstream");
2547 2547 closeObject(xref_id);
2548 2548 return space_before_zero;
... ...