Commit 0827b1096e9041ffef2b4867164ba21f990d6892

Authored by m-holger
Committed by Jay Berkenbilt
1 parent 63d1dcb4

Remove redundant parameters cross_indirect and stop_atstreams from QPDFObjectHandle::copyObject2

include/qpdf/QPDFObjectHandle.hh
... ... @@ -1634,11 +1634,7 @@ class QPDFObjectHandle
1634 1634 bool first_level_only,
1635 1635 bool stop_at_streams);
1636 1636 void shallowCopyInternal1(QPDFObjectHandle& oh, bool first_level_only);
1637   - void copyObject2(
1638   - std::set<QPDFObjGen>& visited,
1639   - bool cross_indirect,
1640   - bool first_level_only,
1641   - bool stop_at_streams);
  1637 + void copyObject2(std::set<QPDFObjGen>& visited, bool first_level_only);
1642 1638 void shallowCopyInternal2(QPDFObjectHandle& oh, bool first_level_only);
1643 1639 void copyObject(
1644 1640 std::set<QPDFObjGen>& visited,
... ...
libqpdf/QPDFObjectHandle.cc
... ... @@ -2315,22 +2315,16 @@ QPDFObjectHandle::shallowCopyInternal2(
2315 2315 new_obj = QPDFObjectHandle(obj->copy(true));
2316 2316  
2317 2317 std::set<QPDFObjGen> visited;
2318   - new_obj.copyObject2(visited, false, first_level_only, false);
  2318 + new_obj.copyObject2(visited, first_level_only);
2319 2319 }
2320 2320  
2321 2321 void
2322 2322 QPDFObjectHandle::copyObject2(
2323   - std::set<QPDFObjGen>& visited,
2324   - bool cross_indirect,
2325   - bool first_level_only,
2326   - bool stop_at_streams)
  2323 + std::set<QPDFObjGen>& visited, bool first_level_only)
2327 2324 {
2328 2325 assertInitialized();
2329 2326  
2330 2327 if (isStream()) {
2331   - if (stop_at_streams) {
2332   - return;
2333   - }
2334 2328 throw std::runtime_error(
2335 2329 "attempt to make a stream into a direct object");
2336 2330 }
... ... @@ -2361,11 +2355,10 @@ QPDFObjectHandle::copyObject2(
2361 2355 int n = array->getNItems();
2362 2356 for (int i = 0; i < n; ++i) {
2363 2357 items.push_back(array->getItem(i));
2364   - if ((!first_level_only) &&
2365   - (cross_indirect || (!items.back().isIndirect()))) {
2366   - items.back().copyObject2(
2367   - visited, cross_indirect, first_level_only, stop_at_streams);
2368   - }
  2358 + if ((!first_level_only) && !items.back().isIndirect())
  2359 + {
  2360 + items.back().copyObject2(visited, first_level_only);
  2361 + }
2369 2362 }
2370 2363 new_obj = QPDF_Array::create(items);
2371 2364 } else if (isDictionary()) {
... ... @@ -2373,11 +2366,10 @@ QPDFObjectHandle::copyObject2(
2373 2366 auto dict = asDictionary();
2374 2367 for (auto const& key: getKeys()) {
2375 2368 items[key] = dict->getKey(key);
2376   - if ((!first_level_only) &&
2377   - (cross_indirect || (!items[key].isIndirect()))) {
2378   - items[key].copyObject2(
2379   - visited, cross_indirect, first_level_only, stop_at_streams);
2380   - }
  2369 + if ((!first_level_only) && !items[key].isIndirect())
  2370 + {
  2371 + items[key].copyObject2(visited, first_level_only);
  2372 + }
2381 2373 }
2382 2374 new_obj = QPDF_Dictionary::create(items);
2383 2375 } else {
... ...