2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-16 01:27:07 +00:00

Tune QPDFWriter::enqueueObject

This commit is contained in:
m-holger 2023-01-06 13:24:11 +00:00 committed by Jay Berkenbilt
parent 98dff46310
commit 9c216a06d9

View File

@ -1257,17 +1257,17 @@ QPDFWriter::enqueueObject(QPDFObjectHandle object)
// indicates that an object stream is inside itself. // indicates that an object stream is inside itself.
QTC::TC("qpdf", "QPDFWriter ignore self-referential object stream"); QTC::TC("qpdf", "QPDFWriter ignore self-referential object stream");
} }
} else if (object.isArray()) { return;
if (!this->m->linearized) { } else if (!this->m->linearized) {
int n = object.getArrayNItems(); if (object.isArray()) {
for (int i = 0; i < n; ++i) { for (auto& item: object.getArrayAsVector()) {
enqueueObject(object.getArrayItem(i)); enqueueObject(item);
} }
} } else if (object.isDictionary()) {
} else if (object.isDictionary()) { for (auto& item: object.getDictAsMap()) {
if (!this->m->linearized) { if (!item.second.isNull()) {
for (auto const& key: object.getKeys()) { enqueueObject(item.second);
enqueueObject(object.getKey(key)); }
} }
} }
} else { } else {