diff options
author | m-holger <m-holger@kubitscheck.org> | 2022-05-21 16:18:15 +0200 |
---|---|---|
committer | Jay Berkenbilt <jberkenbilt@users.noreply.github.com> | 2022-05-21 22:06:29 +0200 |
commit | 6c69a747b9f7a801be2ad58985f35886bd38239e (patch) | |
tree | a35f002d4564ad1811044335c34f1b510a6774b8 /libqpdf/QPDFObjectHandle.cc | |
parent | 70ccd807c45f477d6caf73b9390ba3acda53d1db (diff) | |
download | qpdf-6c69a747b9f7a801be2ad58985f35886bd38239e.tar.zst |
Code clean up: use range-style for loops wherever possible
Remove variables obsoleted by commit 4f24617.
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 6ac69ab1..56a545d6 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -1240,12 +1240,10 @@ QPDFObjectHandle::getResourceNames() if (!isDictionary()) { return result; } - std::set<std::string> keys = getKeys(); - for (auto const& key: keys) { + for (auto const& key: getKeys()) { QPDFObjectHandle val = getKey(key); if (val.isDictionary()) { - std::set<std::string> val_keys = val.getKeys(); - for (auto const& val_key: val_keys) { + for (auto const& val_key: val.getKeys()) { result.insert(val_key); } } @@ -1642,14 +1640,12 @@ QPDFObjectHandle::addPageContents(QPDFObjectHandle new_contents, bool first) { new_contents.assertStream(); - std::vector<QPDFObjectHandle> orig_contents = getPageContents(); - std::vector<QPDFObjectHandle> content_streams; if (first) { QTC::TC("qpdf", "QPDFObjectHandle prepend page contents"); content_streams.push_back(new_contents); } - for (auto const& iter: orig_contents) { + for (auto const& iter: getPageContents()) { QTC::TC("qpdf", "QPDFObjectHandle append page contents"); content_streams.push_back(iter); } @@ -1657,8 +1653,7 @@ QPDFObjectHandle::addPageContents(QPDFObjectHandle new_contents, bool first) content_streams.push_back(new_contents); } - QPDFObjectHandle contents = QPDFObjectHandle::newArray(content_streams); - this->replaceKey("/Contents", contents); + this->replaceKey("/Contents", newArray(content_streams)); } void @@ -2927,9 +2922,8 @@ QPDFObjectHandle::copyObject( new_obj = std::shared_ptr<QPDFObject>(new QPDF_Array(items)); } else if (isDictionary()) { QTC::TC("qpdf", "QPDFObjectHandle clone dictionary"); - std::set<std::string> keys = getKeys(); std::map<std::string, QPDFObjectHandle> items; - for (auto const& key: keys) { + for (auto const& key: getKeys()) { items[key] = getKey(key); if ((!first_level_only) && (cross_indirect || (!items[key].isIndirect()))) { |