From 481b1aeb5008fcd742710ab1caa98def6c0dbf84 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 1 Sep 2022 15:30:25 -0400 Subject: Add comments after merge of last pull request --- libqpdf/QPDF_optimization.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libqpdf') diff --git a/libqpdf/QPDF_optimization.cc b/libqpdf/QPDF_optimization.cc index 91f2c385..1fe0b74f 100644 --- a/libqpdf/QPDF_optimization.cc +++ b/libqpdf/QPDF_optimization.cc @@ -142,7 +142,9 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys) return; } - // Calling getAllPages() resolves any duplicated page objects. + // Calling getAllPages() resolves any duplicated page objects, + // repairs broken nodes, and detects loops, so we don't have to do + // those activities here. getAllPages(); // key_ancestors is a mapping of page attribute keys to a stack of @@ -234,7 +236,10 @@ QPDF::pushInheritedAttributesToPageInternal( } } - // Process descendant nodes. + // Process descendant nodes. This method does not perform loop + // detection because all code paths that lead here follow a call + // to getAllPages, which already throws an exception in the event + // of a loop in the pages tree. for (auto& kid: cur_pages.getKey("/Kids").aitems()) { if (kid.isDictionaryOfType("/Pages")) { pushInheritedAttributesToPageInternal( -- cgit v1.2.3-54-g00ecf