From 6c69a747b9f7a801be2ad58985f35886bd38239e Mon Sep 17 00:00:00 2001 From: m-holger Date: Sat, 21 May 2022 15:18:15 +0100 Subject: Code clean up: use range-style for loops wherever possible Remove variables obsoleted by commit 4f24617. --- libqpdf/QPDFObjectHandle.cc | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'libqpdf/QPDFObjectHandle.cc') 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 keys = getKeys(); - for (auto const& key: keys) { + for (auto const& key: getKeys()) { QPDFObjectHandle val = getKey(key); if (val.isDictionary()) { - std::set 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 orig_contents = getPageContents(); - std::vector 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(new QPDF_Array(items)); } else if (isDictionary()) { QTC::TC("qpdf", "QPDFObjectHandle clone dictionary"); - std::set keys = getKeys(); std::map items; - for (auto const& key: keys) { + for (auto const& key: getKeys()) { items[key] = getKey(key); if ((!first_level_only) && (cross_indirect || (!items[key].isIndirect()))) { -- cgit v1.2.3-70-g09d2