diff options
author | m-holger <m-holger@kubitscheck.org> | 2022-11-14 23:06:04 +0100 |
---|---|---|
committer | Jay Berkenbilt <jberkenbilt@users.noreply.github.com> | 2022-11-20 18:07:22 +0100 |
commit | b1eb1a958438025efbf90f7a7f45dbe33c746d91 (patch) | |
tree | f9ff3400204d1ca1e878c94b240eb0d1e1704e3f /libqpdf/QPDF_Dictionary.cc | |
parent | 3e3b79a774a294ca2020a7bad8ee6ddd2c0179de (diff) | |
download | qpdf-b1eb1a958438025efbf90f7a7f45dbe33c746d91.tar.zst |
Refactor QPDFObjectHandle::copyObject1
Diffstat (limited to 'libqpdf/QPDF_Dictionary.cc')
-rw-r--r-- | libqpdf/QPDF_Dictionary.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libqpdf/QPDF_Dictionary.cc b/libqpdf/QPDF_Dictionary.cc index 5b1e03d8..1df4f8f0 100644 --- a/libqpdf/QPDF_Dictionary.cc +++ b/libqpdf/QPDF_Dictionary.cc @@ -18,7 +18,17 @@ QPDF_Dictionary::create(std::map<std::string, QPDFObjectHandle> const& items) std::shared_ptr<QPDFObject> QPDF_Dictionary::copy(bool shallow) { - return create(items); + if (shallow) { + return create(items); + } else { + std::map<std::string, QPDFObjectHandle> new_items; + for (auto const& item: this->items) { + auto value = item.second; + new_items[item.first] = + value.isIndirect() ? value : value.shallowCopy(); + } + return create(new_items); + } } void |