2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 19:08:59 +00:00

Remove redundant parameter cross_indirect from QPDFObjectHandle::copyObject

This commit is contained in:
m-holger 2022-11-15 10:49:00 +00:00 committed by Jay Berkenbilt
parent ebc15f4dd0
commit 585ecf17c8
2 changed files with 5 additions and 13 deletions

View File

@ -1628,10 +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 copyObject( void copyObject(std::set<QPDFObjGen>& visited, bool stop_at_streams);
std::set<QPDFObjGen>& visited,
bool cross_indirect,
bool stop_at_streams);
void disconnect(); void disconnect();
void setParsedOffset(qpdf_offset_t offset); void setParsedOffset(qpdf_offset_t offset);
void parseContentStream_internal( void parseContentStream_internal(

View File

@ -2219,7 +2219,7 @@ QPDFObjectHandle::unsafeShallowCopy()
void void
QPDFObjectHandle::copyObject( QPDFObjectHandle::copyObject(
std::set<QPDFObjGen>& visited, bool cross_indirect, bool stop_at_streams) std::set<QPDFObjGen>& visited, bool stop_at_streams)
{ {
assertInitialized(); assertInitialized();
if (isStream()) { if (isStream()) {
@ -2259,10 +2259,7 @@ QPDFObjectHandle::copyObject(
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 ((cross_indirect || (!items.back().isIndirect()))) { items.back().copyObject(visited, stop_at_streams);
items.back().copyObject(
visited, cross_indirect, stop_at_streams);
}
} }
new_obj = QPDF_Array::create(items); new_obj = QPDF_Array::create(items);
} else if (isDictionary()) { } else if (isDictionary()) {
@ -2270,9 +2267,7 @@ QPDFObjectHandle::copyObject(
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 ((cross_indirect || (!items[key].isIndirect()))) { items[key].copyObject(visited, stop_at_streams);
items[key].copyObject(visited, cross_indirect, stop_at_streams);
}
} }
new_obj = QPDF_Dictionary::create(items); new_obj = QPDF_Dictionary::create(items);
} else { } else {
@ -2309,7 +2304,7 @@ void
QPDFObjectHandle::makeDirect(bool allow_streams) QPDFObjectHandle::makeDirect(bool allow_streams)
{ {
std::set<QPDFObjGen> visited; std::set<QPDFObjGen> visited;
copyObject(visited, true, allow_streams); copyObject(visited, allow_streams);
} }
void void