Commit 9c216a06d927bf6285dc48f22340d1f752452a6d

Authored by m-holger
Committed by Jay Berkenbilt
1 parent 98dff463

Tune QPDFWriter::enqueueObject

Showing 1 changed file with 10 additions and 10 deletions
libqpdf/QPDFWriter.cc
... ... @@ -1257,17 +1257,17 @@ QPDFWriter::enqueueObject(QPDFObjectHandle object)
1257 1257 // indicates that an object stream is inside itself.
1258 1258 QTC::TC("qpdf", "QPDFWriter ignore self-referential object stream");
1259 1259 }
1260   - } else if (object.isArray()) {
1261   - if (!this->m->linearized) {
1262   - int n = object.getArrayNItems();
1263   - for (int i = 0; i < n; ++i) {
1264   - enqueueObject(object.getArrayItem(i));
  1260 + return;
  1261 + } else if (!this->m->linearized) {
  1262 + if (object.isArray()) {
  1263 + for (auto& item: object.getArrayAsVector()) {
  1264 + enqueueObject(item);
1265 1265 }
1266   - }
1267   - } else if (object.isDictionary()) {
1268   - if (!this->m->linearized) {
1269   - for (auto const& key: object.getKeys()) {
1270   - enqueueObject(object.getKey(key));
  1266 + } else if (object.isDictionary()) {
  1267 + for (auto& item: object.getDictAsMap()) {
  1268 + if (!item.second.isNull()) {
  1269 + enqueueObject(item.second);
  1270 + }
1271 1271 }
1272 1272 }
1273 1273 } else {
... ...