Commit 3efd6657039eeb5a33b01b9bd07ba3d5875f5b64

Authored by m-holger
Committed by Jay Berkenbilt
1 parent d7b85252

Remove redundant parameters cross_indirect and stop_atstreams from QPDFObjectHandle::copyObject1

include/qpdf/QPDFObjectHandle.hh
@@ -1628,11 +1628,7 @@ class QPDFObjectHandle @@ -1628,11 +1628,7 @@ class QPDFObjectHandle
1628 void objectWarning(std::string const& warning); 1628 void objectWarning(std::string const& warning);
1629 void assertType(char const* type_name, bool istype); 1629 void assertType(char const* type_name, bool istype);
1630 bool dereference(); 1630 bool dereference();
1631 - void copyObject1(  
1632 - std::set<QPDFObjGen>& visited,  
1633 - bool cross_indirect,  
1634 - bool first_level_only,  
1635 - bool stop_at_streams); 1631 + void copyObject1(std::set<QPDFObjGen>& visited, bool first_level_only);
1636 void shallowCopyInternal1(QPDFObjectHandle& oh, bool first_level_only); 1632 void shallowCopyInternal1(QPDFObjectHandle& oh, bool first_level_only);
1637 void copyObject( 1633 void copyObject(
1638 std::set<QPDFObjGen>& visited, 1634 std::set<QPDFObjGen>& visited,
libqpdf/QPDFObjectHandle.cc
@@ -2218,22 +2218,16 @@ QPDFObjectHandle::shallowCopyInternal1( @@ -2218,22 +2218,16 @@ QPDFObjectHandle::shallowCopyInternal1(
2218 new_obj = QPDFObjectHandle(obj->copy(true)); 2218 new_obj = QPDFObjectHandle(obj->copy(true));
2219 2219
2220 std::set<QPDFObjGen> visited; 2220 std::set<QPDFObjGen> visited;
2221 - new_obj.copyObject1(visited, false, first_level_only, false); 2221 + new_obj.copyObject1(visited, first_level_only);
2222 } 2222 }
2223 2223
2224 void 2224 void
2225 QPDFObjectHandle::copyObject1( 2225 QPDFObjectHandle::copyObject1(
2226 - std::set<QPDFObjGen>& visited,  
2227 - bool cross_indirect,  
2228 - bool first_level_only,  
2229 - bool stop_at_streams) 2226 + std::set<QPDFObjGen>& visited, bool first_level_only)
2230 { 2227 {
2231 assertInitialized(); 2228 assertInitialized();
2232 2229
2233 if (isStream()) { 2230 if (isStream()) {
2234 - if (stop_at_streams) {  
2235 - return;  
2236 - }  
2237 throw std::runtime_error( 2231 throw std::runtime_error(
2238 "attempt to make a stream into a direct object"); 2232 "attempt to make a stream into a direct object");
2239 } 2233 }
@@ -2264,10 +2258,8 @@ QPDFObjectHandle::copyObject1( @@ -2264,10 +2258,8 @@ QPDFObjectHandle::copyObject1(
2264 int n = array->getNItems(); 2258 int n = array->getNItems();
2265 for (int i = 0; i < n; ++i) { 2259 for (int i = 0; i < n; ++i) {
2266 items.push_back(array->getItem(i)); 2260 items.push_back(array->getItem(i));
2267 - if ((!first_level_only) &&  
2268 - (cross_indirect || (!items.back().isIndirect()))) {  
2269 - items.back().copyObject1(  
2270 - visited, cross_indirect, first_level_only, stop_at_streams); 2261 + if ((!first_level_only) && !items.back().isIndirect()) {
  2262 + items.back().copyObject1(visited, first_level_only);
2271 } 2263 }
2272 } 2264 }
2273 new_obj = QPDF_Array::create(items); 2265 new_obj = QPDF_Array::create(items);
@@ -2276,10 +2268,8 @@ QPDFObjectHandle::copyObject1( @@ -2276,10 +2268,8 @@ QPDFObjectHandle::copyObject1(
2276 auto dict = asDictionary(); 2268 auto dict = asDictionary();
2277 for (auto const& key: getKeys()) { 2269 for (auto const& key: getKeys()) {
2278 items[key] = dict->getKey(key); 2270 items[key] = dict->getKey(key);
2279 - if ((!first_level_only) &&  
2280 - (cross_indirect || (!items[key].isIndirect()))) {  
2281 - items[key].copyObject1(  
2282 - visited, cross_indirect, first_level_only, stop_at_streams); 2271 + if ((!first_level_only) && !items[key].isIndirect()) {
  2272 + items[key].copyObject1(visited, first_level_only);
2283 } 2273 }
2284 } 2274 }
2285 new_obj = QPDF_Dictionary::create(items); 2275 new_obj = QPDF_Dictionary::create(items);