Commit 7cc1e08de95015b3dd460029a9e746cb6eeaf60f
1 parent
68d10931
In QPDFWriter::writeLinearized use Pl_String instead of Pl_Buffer
Showing
1 changed file
with
6 additions
and
6 deletions
libqpdf/QPDFWriter.cc
| @@ -2684,14 +2684,14 @@ QPDFWriter::writeLinearized() | @@ -2684,14 +2684,14 @@ QPDFWriter::writeLinearized() | ||
| 2684 | } | 2684 | } |
| 2685 | 2685 | ||
| 2686 | qpdf_offset_t hint_length = 0; | 2686 | qpdf_offset_t hint_length = 0; |
| 2687 | - std::shared_ptr<Buffer> hint_buffer; | 2687 | + std::string hint_buffer; |
| 2688 | 2688 | ||
| 2689 | // Write file in two passes. Part numbers refer to PDF spec 1.4. | 2689 | // Write file in two passes. Part numbers refer to PDF spec 1.4. |
| 2690 | 2690 | ||
| 2691 | FILE* lin_pass1_file = nullptr; | 2691 | FILE* lin_pass1_file = nullptr; |
| 2692 | auto pp_pass1 = std::make_shared<PipelinePopper>(this); | 2692 | auto pp_pass1 = std::make_shared<PipelinePopper>(this); |
| 2693 | auto pp_md5 = std::make_shared<PipelinePopper>(this); | 2693 | auto pp_md5 = std::make_shared<PipelinePopper>(this); |
| 2694 | - for (int pass = 1; pass <= 2; ++pass) { | 2694 | + for (int pass: {1, 2}) { |
| 2695 | if (pass == 1) { | 2695 | if (pass == 1) { |
| 2696 | if (!m->lin_pass1_filename.empty()) { | 2696 | if (!m->lin_pass1_filename.empty()) { |
| 2697 | lin_pass1_file = QUtil::safe_fopen(m->lin_pass1_filename.c_str(), "wb"); | 2697 | lin_pass1_file = QUtil::safe_fopen(m->lin_pass1_filename.c_str(), "wb"); |
| @@ -2828,7 +2828,7 @@ QPDFWriter::writeLinearized() | @@ -2828,7 +2828,7 @@ QPDFWriter::writeLinearized() | ||
| 2828 | m->new_obj[hint_id].xref = QPDFXRefEntry(m->pipeline->getCount()); | 2828 | m->new_obj[hint_id].xref = QPDFXRefEntry(m->pipeline->getCount()); |
| 2829 | } else { | 2829 | } else { |
| 2830 | // Part 5: hint stream | 2830 | // Part 5: hint stream |
| 2831 | - writeBuffer(hint_buffer); | 2831 | + writeString(hint_buffer); |
| 2832 | } | 2832 | } |
| 2833 | } | 2833 | } |
| 2834 | if (cur_object.getObjectID() == part6_end_marker) { | 2834 | if (cur_object.getObjectID() == part6_end_marker) { |
| @@ -2902,12 +2902,12 @@ QPDFWriter::writeLinearized() | @@ -2902,12 +2902,12 @@ QPDFWriter::writeLinearized() | ||
| 2902 | 2902 | ||
| 2903 | // Write hint stream to a buffer | 2903 | // Write hint stream to a buffer |
| 2904 | { | 2904 | { |
| 2905 | - pushPipeline(new Pl_Buffer("hint buffer")); | ||
| 2906 | - PipelinePopper pp_hint(this, &hint_buffer); | 2905 | + pushPipeline(new Pl_String("hint buffer", nullptr, hint_buffer)); |
| 2906 | + PipelinePopper pp_hint(this); | ||
| 2907 | activatePipelineStack(pp_hint); | 2907 | activatePipelineStack(pp_hint); |
| 2908 | writeHintStream(hint_id); | 2908 | writeHintStream(hint_id); |
| 2909 | } | 2909 | } |
| 2910 | - hint_length = QIntC::to_offset(hint_buffer->getSize()); | 2910 | + hint_length = QIntC::to_offset(hint_buffer.size()); |
| 2911 | 2911 | ||
| 2912 | // Restore hint offset | 2912 | // Restore hint offset |
| 2913 | m->new_obj[hint_id].xref = QPDFXRefEntry(hint_offset1); | 2913 | m->new_obj[hint_id].xref = QPDFXRefEntry(hint_offset1); |