From 3e3b79a774a294ca2020a7bad8ee6ddd2c0179de Mon Sep 17 00:00:00 2001 From: m-holger Date: Sun, 20 Nov 2022 15:15:04 +0000 Subject: Remove redundant parameter first_level_only from QPDFObjectHandle::shallowCopyInternal2 and copyObject2 --- include/qpdf/QPDFObjectHandle.hh | 4 ++-- libqpdf/QPDFObjectHandle.cc | 18 ++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index e4e8d753..df6c0742 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -1628,8 +1628,8 @@ class QPDFObjectHandle void objectWarning(std::string const& warning); void assertType(char const* type_name, bool istype); bool dereference(); - void copyObject1(std::set& visited, bool first_level_only); - void shallowCopyInternal1(QPDFObjectHandle& oh, bool first_level_only); + void copyObject1(std::set& visited); + void shallowCopyInternal1(QPDFObjectHandle& oh); void copyObject( std::set& visited, bool cross_indirect, diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 6c5055a7..3e37a966 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -2201,13 +2201,12 @@ QPDFObjectHandle QPDFObjectHandle::shallowCopy() { QPDFObjectHandle result; - shallowCopyInternal1(result, false); + shallowCopyInternal1(result); return result; } void -QPDFObjectHandle::shallowCopyInternal1( - QPDFObjectHandle& new_obj, bool first_level_only) +QPDFObjectHandle::shallowCopyInternal1(QPDFObjectHandle& new_obj) { assertInitialized(); @@ -2218,12 +2217,11 @@ QPDFObjectHandle::shallowCopyInternal1( new_obj = QPDFObjectHandle(obj->copy(true)); std::set visited; - new_obj.copyObject1(visited, first_level_only); + new_obj.copyObject1(visited); } void -QPDFObjectHandle::copyObject1( - std::set& visited, bool first_level_only) +QPDFObjectHandle::copyObject1(std::set& visited) { assertInitialized(); @@ -2258,8 +2256,8 @@ QPDFObjectHandle::copyObject1( int n = array->getNItems(); for (int i = 0; i < n; ++i) { items.push_back(array->getItem(i)); - if ((!first_level_only) && !items.back().isIndirect()) { - items.back().copyObject1(visited, first_level_only); + if (!items.back().isIndirect()) { + items.back().copyObject1(visited); } } new_obj = QPDF_Array::create(items); @@ -2268,8 +2266,8 @@ QPDFObjectHandle::copyObject1( auto dict = asDictionary(); for (auto const& key: getKeys()) { items[key] = dict->getKey(key); - if ((!first_level_only) && !items[key].isIndirect()) { - items[key].copyObject1(visited, first_level_only); + if (!items[key].isIndirect()) { + items[key].copyObject1(visited); } } new_obj = QPDF_Dictionary::create(items); -- cgit v1.2.3-54-g00ecf