diff options
author | m-holger <m-holger@kubitscheck.org> | 2022-12-11 17:13:19 +0100 |
---|---|---|
committer | m-holger <m-holger@kubitscheck.org> | 2023-04-01 14:57:35 +0200 |
commit | a171ebb9427e41559efbeb1f144a19b73bb3eca6 (patch) | |
tree | 659e86942f25cf18479ca15541a99eda99332cda /libqpdf | |
parent | 0aae54d3836107fdb9dc54faf0778bf262dd7e0a (diff) | |
download | qpdf-a171ebb9427e41559efbeb1f144a19b73bb3eca6.tar.zst |
Refactor QPDF_Array::disconnect
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDF_Array.cc | 13 | ||||
-rw-r--r-- | libqpdf/SparseOHArray.cc | 8 | ||||
-rw-r--r-- | libqpdf/qpdf/SparseOHArray.hh | 1 |
3 files changed, 9 insertions, 13 deletions
diff --git a/libqpdf/QPDF_Array.cc b/libqpdf/QPDF_Array.cc index afec05af..1f1ce55a 100644 --- a/libqpdf/QPDF_Array.cc +++ b/libqpdf/QPDF_Array.cc @@ -116,11 +116,16 @@ void QPDF_Array::disconnect() { if (sparse) { - sp_elements.disconnect(); + for (auto& item: sp_elements.elements) { + auto& obj = item.second; + if (!obj->getObjGen().isIndirect()) { + obj->disconnect(); + } + } } else { - for (auto const& iter: elements) { - if (iter) { - QPDFObjectHandle::DisconnectAccess::disconnect(iter); + for (auto& obj: elements) { + if (!obj->getObjGen().isIndirect()) { + obj->disconnect(); } } } diff --git a/libqpdf/SparseOHArray.cc b/libqpdf/SparseOHArray.cc index 6a1c976a..c830d035 100644 --- a/libqpdf/SparseOHArray.cc +++ b/libqpdf/SparseOHArray.cc @@ -1,13 +1,5 @@ #include <qpdf/SparseOHArray.hh> -void -SparseOHArray::disconnect() -{ - for (auto& iter: this->elements) { - QPDFObjectHandle::DisconnectAccess::disconnect(iter.second); - } -} - SparseOHArray SparseOHArray::copy() { diff --git a/libqpdf/qpdf/SparseOHArray.hh b/libqpdf/qpdf/SparseOHArray.hh index 1b31f266..e7733472 100644 --- a/libqpdf/qpdf/SparseOHArray.hh +++ b/libqpdf/qpdf/SparseOHArray.hh @@ -17,7 +17,6 @@ class SparseOHArray return n_elements; } SparseOHArray copy(); - void disconnect(); private: friend class QPDF_Array; |