Commit 8363657cf34be7ac34b86ee32ec052cc4ed7e5e1
Committed by
Jay Berkenbilt
1 parent
9c216a06
Change QPDFWriter::object_queue to std::vector
Showing
2 changed files
with
5 additions
and
4 deletions
include/qpdf/QPDFWriter.hh
| @@ -751,7 +751,8 @@ class QPDFWriter | @@ -751,7 +751,8 @@ class QPDFWriter | ||
| 751 | std::string cur_data_key; | 751 | std::string cur_data_key; |
| 752 | std::list<std::shared_ptr<Pipeline>> to_delete; | 752 | std::list<std::shared_ptr<Pipeline>> to_delete; |
| 753 | Pl_Count* pipeline; | 753 | Pl_Count* pipeline; |
| 754 | - std::list<QPDFObjectHandle> object_queue; | 754 | + std::vector<QPDFObjectHandle> object_queue; |
| 755 | + size_t object_queue_front{0}; | ||
| 755 | std::map<QPDFObjGen, int> obj_renumber; | 756 | std::map<QPDFObjGen, int> obj_renumber; |
| 756 | std::map<int, QPDFXRefEntry> xref; | 757 | std::map<int, QPDFXRefEntry> xref; |
| 757 | std::map<int, qpdf_offset_t> lengths; | 758 | std::map<int, qpdf_offset_t> lengths; |
libqpdf/QPDFWriter.cc
| @@ -3363,9 +3363,9 @@ QPDFWriter::writeStandard() | @@ -3363,9 +3363,9 @@ QPDFWriter::writeStandard() | ||
| 3363 | } | 3363 | } |
| 3364 | 3364 | ||
| 3365 | // Now start walking queue, outputting each object. | 3365 | // Now start walking queue, outputting each object. |
| 3366 | - while (this->m->object_queue.size()) { | ||
| 3367 | - QPDFObjectHandle cur_object = this->m->object_queue.front(); | ||
| 3368 | - this->m->object_queue.pop_front(); | 3366 | + while (m->object_queue_front < m->object_queue.size()) { |
| 3367 | + QPDFObjectHandle cur_object = m->object_queue.at(m->object_queue_front); | ||
| 3368 | + ++m->object_queue_front; | ||
| 3369 | writeObject(cur_object); | 3369 | writeObject(cur_object); |
| 3370 | } | 3370 | } |
| 3371 | 3371 |