mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-23 03:18:59 +00:00
Shallow copy arrays without removing sparseness
This commit is contained in:
parent
bf7c6a8070
commit
5187a3ec85
@ -2340,7 +2340,10 @@ QPDFObjectHandle::shallowCopy()
|
||||
if (isArray())
|
||||
{
|
||||
QTC::TC("qpdf", "QPDFObjectHandle shallow copy array");
|
||||
new_obj = newArray(getArrayAsVector());
|
||||
// No newArray for shallow copying the sparse array
|
||||
QPDF_Array* arr = dynamic_cast<QPDF_Array*>(m->obj.getPointer());
|
||||
new_obj = QPDFObjectHandle(
|
||||
new QPDF_Array(arr->getElementsForShallowCopy()));
|
||||
}
|
||||
else if (isDictionary())
|
||||
{
|
||||
|
@ -136,3 +136,9 @@ QPDF_Array::eraseItem(int at)
|
||||
{
|
||||
this->elements.erase(QIntC::to_size(at));
|
||||
}
|
||||
|
||||
SparseOHArray const&
|
||||
QPDF_Array::getElementsForShallowCopy() const
|
||||
{
|
||||
return this->elements;
|
||||
}
|
||||
|
@ -28,6 +28,8 @@ class QPDF_Array: public QPDFObject
|
||||
void appendItem(QPDFObjectHandle const& item);
|
||||
void eraseItem(int at);
|
||||
|
||||
SparseOHArray const& getElementsForShallowCopy() const;
|
||||
|
||||
protected:
|
||||
virtual void releaseResolved();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user