diff options
author | m-holger <m-holger@kubitscheck.org> | 2023-01-01 13:47:03 +0100 |
---|---|---|
committer | m-holger <m-holger@kubitscheck.org> | 2023-04-01 14:56:29 +0200 |
commit | 182c2480df3d2dee3e430e02afe6bbee3e45eadd (patch) | |
tree | 6c5c834617b09c1bf8628ae340068b5a96ad91b0 /libqpdf/QPDFObjectHandle.cc | |
parent | 4d37389befc705b671d8fa7a1da2b7117b50f454 (diff) | |
download | qpdf-182c2480df3d2dee3e430e02afe6bbee3e45eadd.tar.zst |
Refactor QPDF_Array::setItem and rename to setAt
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index e113089a..396e2063 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -904,16 +904,16 @@ QPDFObjectHandle::getArrayAsVector() void QPDFObjectHandle::setArrayItem(int n, QPDFObjectHandle const& item) { - auto array = asArray(); - if (array) { - checkOwnership(item); - array->setItem(n, item); + if (auto array = asArray()) { + if (!array->setAt(n, item)) { + objectWarning("ignoring attempt to set out of bounds array item"); + QTC::TC("qpdf", "QPDFObjectHandle set array bounds"); + } } else { typeWarning("array", "ignoring attempt to set item"); QTC::TC("qpdf", "QPDFObjectHandle array ignoring set item"); } } - void QPDFObjectHandle::setArrayFromVector(std::vector<QPDFObjectHandle> const& items) { |