aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-11-20 16:15:04 +0100
committerJay Berkenbilt <jberkenbilt@users.noreply.github.com>2022-11-20 18:07:22 +0100
commit3e3b79a774a294ca2020a7bad8ee6ddd2c0179de (patch)
tree3bfad2bfd652e80ef32dcaa91d33644cafb8b576
parent3efd6657039eeb5a33b01b9bd07ba3d5875f5b64 (diff)
downloadqpdf-3e3b79a774a294ca2020a7bad8ee6ddd2c0179de.tar.zst
Remove redundant parameter first_level_only from QPDFObjectHandle::shallowCopyInternal2 and copyObject2
-rw-r--r--include/qpdf/QPDFObjectHandle.hh4
-rw-r--r--libqpdf/QPDFObjectHandle.cc18
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<QPDFObjGen>& visited, bool first_level_only);
- void shallowCopyInternal1(QPDFObjectHandle& oh, bool first_level_only);
+ void copyObject1(std::set<QPDFObjGen>& visited);
+ void shallowCopyInternal1(QPDFObjectHandle& oh);
void copyObject(
std::set<QPDFObjGen>& 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<QPDFObjGen> visited;
- new_obj.copyObject1(visited, first_level_only);
+ new_obj.copyObject1(visited);
}
void
-QPDFObjectHandle::copyObject1(
- std::set<QPDFObjGen>& visited, bool first_level_only)
+QPDFObjectHandle::copyObject1(std::set<QPDFObjGen>& 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);