diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-04-30 02:21:07 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-04-30 02:28:02 +0200 |
commit | d8fdf632a979a7adb4a6423fd55ef1971fb06afd (patch) | |
tree | 5a736f66733a3b4fa52f5519e1877d4841d3a8a3 /libqpdf/QPDFPageObjectHelper.cc | |
parent | e80fad86e95af978ada2a6cc5c4b209a1f65f7c0 (diff) | |
download | qpdf-d8fdf632a979a7adb4a6423fd55ef1971fb06afd.tar.zst |
Use replaceKeyAndGet in a few places in existing code
Diffstat (limited to 'libqpdf/QPDFPageObjectHelper.cc')
-rw-r--r-- | libqpdf/QPDFPageObjectHelper.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libqpdf/QPDFPageObjectHelper.cc b/libqpdf/QPDFPageObjectHelper.cc index b4e6a13a..a6773e70 100644 --- a/libqpdf/QPDFPageObjectHelper.cc +++ b/libqpdf/QPDFPageObjectHelper.cc @@ -597,8 +597,7 @@ QPDFPageObjectHelper::removeUnreferencedResourcesHelper( for (auto const& iter : to_filter) { QPDFObjectHandle dict = resources.getKey(iter); if (dict.isDictionary()) { - dict = dict.shallowCopy(); - resources.replaceKey(iter, dict); + dict = resources.replaceKeyAndGet(iter, dict.shallowCopy()); rdicts.push_back(dict); auto keys = dict.getKeys(); known_names.insert(keys.begin(), keys.end()); @@ -1113,8 +1112,8 @@ QPDFPageObjectHelper::copyAnnotations( afdh->addAndRenameFormFields(new_fields); auto annots = this->oh.getKey("/Annots"); if (!annots.isArray()) { - annots = QPDFObjectHandle::newArray(); - this->oh.replaceKey("/Annots", annots); + annots = + this->oh.replaceKeyAndGet("/Annots", QPDFObjectHandle::newArray()); } for (auto const& annot : new_annots) { annots.appendItem(annot); |