Commit 5187a3ec85f1a83cbde9e77227e215a2dbcfccb0
1 parent
bf7c6a80
Shallow copy arrays without removing sparseness
Showing
3 changed files
with
12 additions
and
1 deletions
libqpdf/QPDFObjectHandle.cc
| ... | ... | @@ -2340,7 +2340,10 @@ QPDFObjectHandle::shallowCopy() |
| 2340 | 2340 | if (isArray()) |
| 2341 | 2341 | { |
| 2342 | 2342 | QTC::TC("qpdf", "QPDFObjectHandle shallow copy array"); |
| 2343 | - new_obj = newArray(getArrayAsVector()); | |
| 2343 | + // No newArray for shallow copying the sparse array | |
| 2344 | + QPDF_Array* arr = dynamic_cast<QPDF_Array*>(m->obj.getPointer()); | |
| 2345 | + new_obj = QPDFObjectHandle( | |
| 2346 | + new QPDF_Array(arr->getElementsForShallowCopy())); | |
| 2344 | 2347 | } |
| 2345 | 2348 | else if (isDictionary()) |
| 2346 | 2349 | { | ... | ... |
libqpdf/QPDF_Array.cc
libqpdf/qpdf/QPDF_Array.hh