2
1
mirror of https://github.com/qpdf/qpdf.git synced 2025-01-03 07:12:28 +00:00

Remove redundant parameters cross_indirect and stop_atstreams from QPDFObjectHandle::copyObject2

This commit is contained in:
m-holger 2022-11-20 13:23:51 +00:00 committed by Jay Berkenbilt
parent 63d1dcb414
commit 0827b1096e
2 changed files with 11 additions and 23 deletions

View File

@ -1634,11 +1634,7 @@ class QPDFObjectHandle
bool first_level_only,
bool stop_at_streams);
void shallowCopyInternal1(QPDFObjectHandle& oh, bool first_level_only);
void copyObject2(
std::set<QPDFObjGen>& visited,
bool cross_indirect,
bool first_level_only,
bool stop_at_streams);
void copyObject2(std::set<QPDFObjGen>& visited, bool first_level_only);
void shallowCopyInternal2(QPDFObjectHandle& oh, bool first_level_only);
void copyObject(
std::set<QPDFObjGen>& visited,

View File

@ -2315,22 +2315,16 @@ QPDFObjectHandle::shallowCopyInternal2(
new_obj = QPDFObjectHandle(obj->copy(true));
std::set<QPDFObjGen> visited;
new_obj.copyObject2(visited, false, first_level_only, false);
new_obj.copyObject2(visited, first_level_only);
}
void
QPDFObjectHandle::copyObject2(
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");
}
@ -2361,11 +2355,10 @@ QPDFObjectHandle::copyObject2(
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().copyObject2(
visited, cross_indirect, first_level_only, stop_at_streams);
}
if ((!first_level_only) && !items.back().isIndirect())
{
items.back().copyObject2(visited, first_level_only);
}
}
new_obj = QPDF_Array::create(items);
} else if (isDictionary()) {
@ -2373,11 +2366,10 @@ QPDFObjectHandle::copyObject2(
auto dict = asDictionary();
for (auto const& key: getKeys()) {
items[key] = dict->getKey(key);
if ((!first_level_only) &&
(cross_indirect || (!items[key].isIndirect()))) {
items[key].copyObject2(
visited, cross_indirect, first_level_only, stop_at_streams);
}
if ((!first_level_only) && !items[key].isIndirect())
{
items[key].copyObject2(visited, first_level_only);
}
}
new_obj = QPDF_Dictionary::create(items);
} else {