Commit 3e3b79a774a294ca2020a7bad8ee6ddd2c0179de
Committed by
Jay Berkenbilt
1 parent
3efd6657
Remove redundant parameter first_level_only from QPDFObjectHandle::shallowCopyIn…
…ternal2 and copyObject2
Showing
2 changed files
with
10 additions
and
12 deletions
include/qpdf/QPDFObjectHandle.hh
| @@ -1628,8 +1628,8 @@ class QPDFObjectHandle | @@ -1628,8 +1628,8 @@ 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(std::set<QPDFObjGen>& visited, bool first_level_only); | ||
| 1632 | - void shallowCopyInternal1(QPDFObjectHandle& oh, bool first_level_only); | 1631 | + void copyObject1(std::set<QPDFObjGen>& visited); |
| 1632 | + void shallowCopyInternal1(QPDFObjectHandle& oh); | ||
| 1633 | void copyObject( | 1633 | void copyObject( |
| 1634 | std::set<QPDFObjGen>& visited, | 1634 | std::set<QPDFObjGen>& visited, |
| 1635 | bool cross_indirect, | 1635 | bool cross_indirect, |
libqpdf/QPDFObjectHandle.cc
| @@ -2201,13 +2201,12 @@ QPDFObjectHandle | @@ -2201,13 +2201,12 @@ QPDFObjectHandle | ||
| 2201 | QPDFObjectHandle::shallowCopy() | 2201 | QPDFObjectHandle::shallowCopy() |
| 2202 | { | 2202 | { |
| 2203 | QPDFObjectHandle result; | 2203 | QPDFObjectHandle result; |
| 2204 | - shallowCopyInternal1(result, false); | 2204 | + shallowCopyInternal1(result); |
| 2205 | return result; | 2205 | return result; |
| 2206 | } | 2206 | } |
| 2207 | 2207 | ||
| 2208 | void | 2208 | void |
| 2209 | -QPDFObjectHandle::shallowCopyInternal1( | ||
| 2210 | - QPDFObjectHandle& new_obj, bool first_level_only) | 2209 | +QPDFObjectHandle::shallowCopyInternal1(QPDFObjectHandle& new_obj) |
| 2211 | { | 2210 | { |
| 2212 | assertInitialized(); | 2211 | assertInitialized(); |
| 2213 | 2212 | ||
| @@ -2218,12 +2217,11 @@ QPDFObjectHandle::shallowCopyInternal1( | @@ -2218,12 +2217,11 @@ QPDFObjectHandle::shallowCopyInternal1( | ||
| 2218 | new_obj = QPDFObjectHandle(obj->copy(true)); | 2217 | new_obj = QPDFObjectHandle(obj->copy(true)); |
| 2219 | 2218 | ||
| 2220 | std::set<QPDFObjGen> visited; | 2219 | std::set<QPDFObjGen> visited; |
| 2221 | - new_obj.copyObject1(visited, first_level_only); | 2220 | + new_obj.copyObject1(visited); |
| 2222 | } | 2221 | } |
| 2223 | 2222 | ||
| 2224 | void | 2223 | void |
| 2225 | -QPDFObjectHandle::copyObject1( | ||
| 2226 | - std::set<QPDFObjGen>& visited, bool first_level_only) | 2224 | +QPDFObjectHandle::copyObject1(std::set<QPDFObjGen>& visited) |
| 2227 | { | 2225 | { |
| 2228 | assertInitialized(); | 2226 | assertInitialized(); |
| 2229 | 2227 | ||
| @@ -2258,8 +2256,8 @@ QPDFObjectHandle::copyObject1( | @@ -2258,8 +2256,8 @@ QPDFObjectHandle::copyObject1( | ||
| 2258 | int n = array->getNItems(); | 2256 | int n = array->getNItems(); |
| 2259 | for (int i = 0; i < n; ++i) { | 2257 | for (int i = 0; i < n; ++i) { |
| 2260 | items.push_back(array->getItem(i)); | 2258 | items.push_back(array->getItem(i)); |
| 2261 | - if ((!first_level_only) && !items.back().isIndirect()) { | ||
| 2262 | - items.back().copyObject1(visited, first_level_only); | 2259 | + if (!items.back().isIndirect()) { |
| 2260 | + items.back().copyObject1(visited); | ||
| 2263 | } | 2261 | } |
| 2264 | } | 2262 | } |
| 2265 | new_obj = QPDF_Array::create(items); | 2263 | new_obj = QPDF_Array::create(items); |
| @@ -2268,8 +2266,8 @@ QPDFObjectHandle::copyObject1( | @@ -2268,8 +2266,8 @@ QPDFObjectHandle::copyObject1( | ||
| 2268 | auto dict = asDictionary(); | 2266 | auto dict = asDictionary(); |
| 2269 | for (auto const& key: getKeys()) { | 2267 | for (auto const& key: getKeys()) { |
| 2270 | items[key] = dict->getKey(key); | 2268 | items[key] = dict->getKey(key); |
| 2271 | - if ((!first_level_only) && !items[key].isIndirect()) { | ||
| 2272 | - items[key].copyObject1(visited, first_level_only); | 2269 | + if (!items[key].isIndirect()) { |
| 2270 | + items[key].copyObject1(visited); | ||
| 2273 | } | 2271 | } |
| 2274 | } | 2272 | } |
| 2275 | new_obj = QPDF_Dictionary::create(items); | 2273 | new_obj = QPDF_Dictionary::create(items); |