Remove redundant parameters cross_indirect and stop_atstreams from QPDFObjectHandle::copyObject1

This commit is contained in:
m-holger 2022-11-20 15:06:34 +00:00 committed by Jay Berkenbilt
parent d7b8525235
commit 3efd665703
2 changed files with 7 additions and 21 deletions

View File

@ -1628,11 +1628,7 @@ 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 cross_indirect,
bool first_level_only,
bool stop_at_streams);
void copyObject1(std::set<QPDFObjGen>& visited, bool first_level_only);
void shallowCopyInternal1(QPDFObjectHandle& oh, bool first_level_only);
void copyObject(
std::set<QPDFObjGen>& visited,

View File

@ -2218,22 +2218,16 @@ QPDFObjectHandle::shallowCopyInternal1(
new_obj = QPDFObjectHandle(obj->copy(true));
std::set<QPDFObjGen> visited;
new_obj.copyObject1(visited, false, first_level_only, false);
new_obj.copyObject1(visited, first_level_only);
}
void
QPDFObjectHandle::copyObject1(
std::set<QPDFObjGen>& visited,
bool cross_indirect,
bool first_level_only,
bool stop_at_streams)
std::set<QPDFObjGen>& visited, bool first_level_only)
{
assertInitialized();
if (isStream()) {
if (stop_at_streams) {
return;
}
throw std::runtime_error(
"attempt to make a stream into a direct object");
}
@ -2264,10 +2258,8 @@ QPDFObjectHandle::copyObject1(
int n = array->getNItems();
for (int i = 0; i < n; ++i) {
items.push_back(array->getItem(i));
if ((!first_level_only) &&
(cross_indirect || (!items.back().isIndirect()))) {
items.back().copyObject1(
visited, cross_indirect, first_level_only, stop_at_streams);
if ((!first_level_only) && !items.back().isIndirect()) {
items.back().copyObject1(visited, first_level_only);
}
}
new_obj = QPDF_Array::create(items);
@ -2276,10 +2268,8 @@ QPDFObjectHandle::copyObject1(
auto dict = asDictionary();
for (auto const& key: getKeys()) {
items[key] = dict->getKey(key);
if ((!first_level_only) &&
(cross_indirect || (!items[key].isIndirect()))) {
items[key].copyObject1(
visited, cross_indirect, first_level_only, stop_at_streams);
if ((!first_level_only) && !items[key].isIndirect()) {
items[key].copyObject1(visited, first_level_only);
}
}
new_obj = QPDF_Dictionary::create(items);