diff options
author | Jay Berkenbilt <ejb@ql.org> | 2019-01-29 03:53:55 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-01-29 03:53:55 +0100 |
commit | 2d0885bc119af035ab2df4d8c19000408223ae7f (patch) | |
tree | 2801e45bcfbd58f42472c4b2212f828032e38992 /libqpdf | |
parent | 2712869cf96916bceeac7def35b6d0a54bd10316 (diff) | |
download | qpdf-2d0885bc119af035ab2df4d8c19000408223ae7f.tar.zst |
Clarify documentation for copyForeignObject regarding pages
Make explicit that copyForeignObject can be used on page objects and
will copy them properly but not update the pages tree.
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDF.cc | 10 | ||||
-rw-r--r-- | libqpdf/QPDF_pages.cc | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index 0dbce669..f49c0216 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -2141,14 +2141,18 @@ QPDF::replaceReserved(QPDFObjectHandle reserved, } QPDFObjectHandle -QPDF::copyForeignObject(QPDFObjectHandle foreign) +QPDF::copyForeignObject(QPDFObjectHandle foreign, bool) { - return copyForeignObject(foreign, false); + // This method will be removed next time the ABI is changed. + return copyForeignObject(foreign); } QPDFObjectHandle -QPDF::copyForeignObject(QPDFObjectHandle foreign, bool allow_page) +QPDF::copyForeignObject(QPDFObjectHandle foreign) { + // Do not preclude use of copyForeignObject on page objects. It is + // a documented use case to copy pages this way if the intention + // is to not update the pages tree. if (! foreign.isIndirect()) { QTC::TC("qpdf", "QPDF copyForeign direct"); diff --git a/libqpdf/QPDF_pages.cc b/libqpdf/QPDF_pages.cc index 7b6b369e..397c175a 100644 --- a/libqpdf/QPDF_pages.cc +++ b/libqpdf/QPDF_pages.cc @@ -221,7 +221,7 @@ QPDF::insertPage(QPDFObjectHandle newpage, int pos) { QTC::TC("qpdf", "QPDF insert foreign page"); newpage.getOwningQPDF()->pushInheritedAttributesToPage(); - newpage = copyForeignObject(newpage, true); + newpage = copyForeignObject(newpage); } else { |