2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-01 18:00:52 +00:00

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 objectWarning(std::string const& warning);
void assertType(char const* type_name, bool istype); void assertType(char const* type_name, bool istype);
bool dereference(); bool dereference();
void copyObject1( void copyObject1(std::set<QPDFObjGen>& visited, bool first_level_only);
std::set<QPDFObjGen>& visited,
bool cross_indirect,
bool first_level_only,
bool stop_at_streams);
void shallowCopyInternal1(QPDFObjectHandle& oh, bool first_level_only); void shallowCopyInternal1(QPDFObjectHandle& oh, bool first_level_only);
void copyObject( void copyObject(
std::set<QPDFObjGen>& visited, std::set<QPDFObjGen>& visited,

View File

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