Commit b20e89b8369e9903a544aa2dfb35aaa68f204faa

Authored by m-holger
1 parent 9dd22125

Use QPDFObjectHandle::as_dictionary instead of getDictAsMap in library

Showing 1 changed file with 7 additions and 9 deletions
libqpdf/QPDFWriter.cc
... ... @@ -1132,9 +1132,9 @@ QPDFWriter::enqueueObject(QPDFObjectHandle object)
1132 1132 for (auto& item: object.getArrayAsVector()) {
1133 1133 enqueueObject(item);
1134 1134 }
1135   - } else if (object.isDictionary()) {
1136   - for (auto& item: object.getDictAsMap()) {
1137   - if (!item.second.isNull()) {
  1135 + } else if (auto d = object.as_dictionary()) {
  1136 + for (auto const& item: d) {
  1137 + if (!item.second.null()) {
1138 1138 enqueueObject(item.second);
1139 1139 }
1140 1140 }
... ... @@ -1498,9 +1498,8 @@ QPDFWriter::unparseObject(
1498 1498  
1499 1499 writeString("<<");
1500 1500  
1501   - for (auto& item: object.getDictAsMap()) {
1502   - if (!item.second.isNull()) {
1503   - auto const& key = item.first;
  1501 + for (auto const& [key, value]: object.as_dictionary()) {
  1502 + if (!value.null()) {
1504 1503 writeString(indent);
1505 1504 writeStringQDF(" ");
1506 1505 writeString(Name::normalize(key));
... ... @@ -1508,10 +1507,9 @@ QPDFWriter::unparseObject(
1508 1507 if (key == "/Contents" && object.isDictionaryOfType("/Sig") &&
1509 1508 object.hasKey("/ByteRange")) {
1510 1509 QTC::TC("qpdf", "QPDFWriter no encryption sig contents");
1511   - unparseChild(
1512   - item.second, level + 1, child_flags | f_hex_string | f_no_encryption);
  1510 + unparseChild(value, level + 1, child_flags | f_hex_string | f_no_encryption);
1513 1511 } else {
1514   - unparseChild(item.second, level + 1, child_flags);
  1512 + unparseChild(value, level + 1, child_flags);
1515 1513 }
1516 1514 }
1517 1515 }
... ...