diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-04-30 02:21:07 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-04-30 02:28:02 +0200 |
commit | d8fdf632a979a7adb4a6423fd55ef1971fb06afd (patch) | |
tree | 5a736f66733a3b4fa52f5519e1877d4841d3a8a3 /libqpdf/QPDFWriter.cc | |
parent | e80fad86e95af978ada2a6cc5c4b209a1f65f7c0 (diff) | |
download | qpdf-d8fdf632a979a7adb4a6423fd55ef1971fb06afd.tar.zst |
Use replaceKeyAndGet in a few places in existing code
Diffstat (limited to 'libqpdf/QPDFWriter.cc')
-rw-r--r-- | libqpdf/QPDFWriter.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index 9f3eacbe..d06a82b0 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -1662,8 +1662,8 @@ QPDFWriter::unparseObject( "qpdf", "QPDFWriter create Extensions", this->m->qdf_mode ? 0 : 1); - extensions = QPDFObjectHandle::newDictionary(); - object.replaceKey("/Extensions", extensions); + extensions = object.replaceKeyAndGet( + "/Extensions", QPDFObjectHandle::newDictionary()); } } else if (!have_extensions_other) { // We have Extensions dictionary and don't want one. @@ -2387,8 +2387,7 @@ QPDFWriter::prepareFileForWrite() if (oh.isIndirect()) { QTC::TC("qpdf", "QPDFWriter make Extensions direct"); extensions_indirect = true; - oh = oh.shallowCopy(); - root.replaceKey(key, oh); + oh = root.replaceKeyAndGet(key, oh.shallowCopy()); } if (oh.hasKey("/ADBE")) { QPDFObjectHandle adbe = oh.getKey("/ADBE"); |