diff options
author | m-holger <m-holger@kubitscheck.org> | 2022-12-12 14:29:52 +0100 |
---|---|---|
committer | m-holger <m-holger@kubitscheck.org> | 2023-04-01 14:56:16 +0200 |
commit | 4d37389befc705b671d8fa7a1da2b7117b50f454 (patch) | |
tree | 0fd25b3c7d60a75d5873b430fe801ac26e0f4a58 /libqpdf/QPDFObjectHandle.cc | |
parent | 1bb23d0545dfe2d651cb22b6135d99c1c9ef85d5 (diff) | |
download | qpdf-4d37389befc705b671d8fa7a1da2b7117b50f454.tar.zst |
Refactor QPDF_Array::eraseItem and rename to erase
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index fa8b9136..e113089a 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -972,17 +972,14 @@ QPDFObjectHandle::appendItemAndGetNew(QPDFObjectHandle const& item) void QPDFObjectHandle::eraseItem(int at) { - auto array = asArray(); - if (array && at < array->size() && at >= 0) { - array->eraseItem(at); - } else { - if (array) { + if (auto array = asArray()) { + if (!array->erase(at)) { objectWarning("ignoring attempt to erase out of bounds array item"); QTC::TC("qpdf", "QPDFObjectHandle erase array bounds"); - } else { - typeWarning("array", "ignoring attempt to erase item"); - QTC::TC("qpdf", "QPDFObjectHandle array ignoring erase item"); } + } else { + typeWarning("array", "ignoring attempt to erase item"); + QTC::TC("qpdf", "QPDFObjectHandle array ignoring erase item"); } } |