Commit 05f8281f4624dd9eea2b5dd0671a6f721633302b

Authored by m-holger
1 parent 953ed4b8

In QPDFWriter::PipelinePopper remove special handling of Pl_Buffer

Also, remove redundant QPDFWriter::writeBuffer.
include/qpdf/QPDFWriter.hh
@@ -462,23 +462,20 @@ class QPDFWriter @@ -462,23 +462,20 @@ class QPDFWriter
462 friend class QPDFWriter; 462 friend class QPDFWriter;
463 463
464 public: 464 public:
465 - PipelinePopper(QPDFWriter* qw, std::shared_ptr<Buffer>* bp = nullptr) :  
466 - qw(qw),  
467 - bp(bp) 465 + PipelinePopper(QPDFWriter* qw) :
  466 + qw(qw)
468 { 467 {
469 } 468 }
470 ~PipelinePopper(); 469 ~PipelinePopper();
471 470
472 private: 471 private:
473 QPDFWriter* qw; 472 QPDFWriter* qw;
474 - std::shared_ptr<Buffer>* bp;  
475 std::string stack_id; 473 std::string stack_id;
476 }; 474 };
477 475
478 unsigned int bytesNeeded(long long n); 476 unsigned int bytesNeeded(long long n);
479 void writeBinary(unsigned long long val, unsigned int bytes); 477 void writeBinary(unsigned long long val, unsigned int bytes);
480 void writeString(std::string_view str); 478 void writeString(std::string_view str);
481 - void writeBuffer(std::shared_ptr<Buffer>&);  
482 void writeStringQDF(std::string_view str); 479 void writeStringQDF(std::string_view str);
483 void writeStringNoQDF(std::string_view str); 480 void writeStringNoQDF(std::string_view str);
484 void writePad(size_t nspaces); 481 void writePad(size_t nspaces);
libqpdf/QPDFWriter.cc
@@ -881,12 +881,6 @@ QPDFWriter::writeString(std::string_view str) @@ -881,12 +881,6 @@ QPDFWriter::writeString(std::string_view str)
881 } 881 }
882 882
883 void 883 void
884 -QPDFWriter::writeBuffer(std::shared_ptr<Buffer>& b)  
885 -{  
886 - m->pipeline->write(b->getBuffer(), b->getSize());  
887 -}  
888 -  
889 -void  
890 QPDFWriter::writeStringQDF(std::string_view str) 884 QPDFWriter::writeStringQDF(std::string_view str)
891 { 885 {
892 if (m->qdf_mode) { 886 if (m->qdf_mode) {
@@ -956,10 +950,6 @@ QPDFWriter::PipelinePopper::~PipelinePopper() @@ -956,10 +950,6 @@ QPDFWriter::PipelinePopper::~PipelinePopper()
956 qw->m->md5_pipeline = nullptr; 950 qw->m->md5_pipeline = nullptr;
957 } 951 }
958 qw->m->pipeline_stack.pop_back(); 952 qw->m->pipeline_stack.pop_back();
959 - auto* buf = dynamic_cast<Pl_Buffer*>(p);  
960 - if (bp && buf) {  
961 - *bp = buf->getBufferSharedPointer();  
962 - }  
963 delete p; 953 delete p;
964 } 954 }
965 qw->m->pipeline = dynamic_cast<Pl_Count*>(qw->m->pipeline_stack.back()); 955 qw->m->pipeline = dynamic_cast<Pl_Count*>(qw->m->pipeline_stack.back());