diff options
author | m-holger <m-holger@kubitscheck.org> | 2022-11-14 19:03:03 +0100 |
---|---|---|
committer | Jay Berkenbilt <jberkenbilt@users.noreply.github.com> | 2022-11-20 18:07:22 +0100 |
commit | d7b85252356da91293d9c11428a5a1c797c5dd0d (patch) | |
tree | 3e6a62eeee00cf2b9bb320f3ee6878f4ca362316 /libqpdf/QPDFObjectHandle.cc | |
parent | 0289b21c3b4d4d32b665e793dbf354ea34a23818 (diff) | |
download | qpdf-d7b85252356da91293d9c11428a5a1c797c5dd0d.tar.zst |
Refactor QPDFObjectHandle::unsafeShallowCopy
Diffstat (limited to 'libqpdf/QPDFObjectHandle.cc')
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 242e0fb2..9153e33f 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -2298,20 +2298,11 @@ QPDFObjectHandle::copyObject1( QPDFObjectHandle QPDFObjectHandle::unsafeShallowCopy() { - QPDFObjectHandle result; - shallowCopyInternal2(result); - return result; -} - -void -QPDFObjectHandle::shallowCopyInternal2(QPDFObjectHandle& new_obj) -{ - assertInitialized(); - - if (isStream()) { - throw std::runtime_error("attempt to make a shallow copy of a stream"); + if (!dereference()) { + throw std::logic_error("operation attempted on uninitialized " + "QPDFObjectHandle"); } - new_obj = QPDFObjectHandle(obj->copy(true)); + return QPDFObjectHandle(obj->copy(true)); } void |