Commit 63e5cb533de0567612ef5ab373d02f90880a8653
1 parent
d61ffb65
Use new QPDF{Name,Number}TreeObjectHelper API
Showing
3 changed files
with
8 additions
and
8 deletions
libqpdf/QPDF.cc
| @@ -3010,7 +3010,7 @@ QPDF::findAttachmentStreams() | @@ -3010,7 +3010,7 @@ QPDF::findAttachmentStreams() | ||
| 3010 | { | 3010 | { |
| 3011 | return; | 3011 | return; |
| 3012 | } | 3012 | } |
| 3013 | - QPDFNameTreeObjectHelper ef_tree(embedded_files); | 3013 | + QPDFNameTreeObjectHelper ef_tree(embedded_files, *this); |
| 3014 | for (auto i: ef_tree) | 3014 | for (auto i: ef_tree) |
| 3015 | { | 3015 | { |
| 3016 | QPDFObjectHandle item = i.second; | 3016 | QPDFObjectHandle item = i.second; |
libtests/nntree.cc
| @@ -6,9 +6,9 @@ | @@ -6,9 +6,9 @@ | ||
| 6 | 6 | ||
| 7 | static bool any_failures = false; | 7 | static bool any_failures = false; |
| 8 | 8 | ||
| 9 | -bool report(QPDFObjectHandle oh, long long item, long long exp_item) | 9 | +bool report(QPDF& q, QPDFObjectHandle oh, long long item, long long exp_item) |
| 10 | { | 10 | { |
| 11 | - QPDFNumberTreeObjectHelper nh(oh); | 11 | + QPDFNumberTreeObjectHelper nh(oh, q); |
| 12 | QPDFObjectHandle o1; | 12 | QPDFObjectHandle o1; |
| 13 | long long offset = 0; | 13 | long long offset = 0; |
| 14 | bool f1 = nh.findObjectAtOrBelow(item, o1, offset); | 14 | bool f1 = nh.findObjectAtOrBelow(item, o1, offset); |
| @@ -81,8 +81,8 @@ void test_bsearch() | @@ -81,8 +81,8 @@ void test_bsearch() | ||
| 81 | return node; | 81 | return node; |
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | - auto r = [](QPDFObjectHandle& oh, int item, int exp) { | ||
| 85 | - if (report(oh, item, exp)) | 84 | + auto r = [&q](QPDFObjectHandle& oh, int item, int exp) { |
| 85 | + if (report(q, oh, item, exp)) | ||
| 86 | { | 86 | { |
| 87 | any_failures = true; | 87 | any_failures = true; |
| 88 | } | 88 | } |
| @@ -218,7 +218,7 @@ void test_depth() | @@ -218,7 +218,7 @@ void test_depth() | ||
| 218 | .getArrayItem(1)); | 218 | .getArrayItem(1)); |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | - QPDFNameTreeObjectHelper nh(n0); | 221 | + QPDFNameTreeObjectHelper nh(n0, q); |
| 222 | std::cout << "--- forward ---" << std::endl; | 222 | std::cout << "--- forward ---" << std::endl; |
| 223 | for (auto i: nh) | 223 | for (auto i: nh) |
| 224 | { | 224 | { |
qpdf/test_driver.cc
| @@ -1748,7 +1748,7 @@ void runtest(int n, char const* filename1, char const* arg2) | @@ -1748,7 +1748,7 @@ void runtest(int n, char const* filename1, char const* arg2) | ||
| 1748 | // Test number tree. This test is crafted to work with | 1748 | // Test number tree. This test is crafted to work with |
| 1749 | // number-tree.pdf | 1749 | // number-tree.pdf |
| 1750 | QPDFObjectHandle qtest = pdf.getTrailer().getKey("/QTest"); | 1750 | QPDFObjectHandle qtest = pdf.getTrailer().getKey("/QTest"); |
| 1751 | - QPDFNumberTreeObjectHelper ntoh(qtest); | 1751 | + QPDFNumberTreeObjectHelper ntoh(qtest, pdf); |
| 1752 | for (auto iter: ntoh) | 1752 | for (auto iter: ntoh) |
| 1753 | { | 1753 | { |
| 1754 | std::cout << iter.first << " " | 1754 | std::cout << iter.first << " " |
| @@ -1806,7 +1806,7 @@ void runtest(int n, char const* filename1, char const* arg2) | @@ -1806,7 +1806,7 @@ void runtest(int n, char const* filename1, char const* arg2) | ||
| 1806 | // Test name tree. This test is crafted to work with | 1806 | // Test name tree. This test is crafted to work with |
| 1807 | // name-tree.pdf | 1807 | // name-tree.pdf |
| 1808 | QPDFObjectHandle qtest = pdf.getTrailer().getKey("/QTest"); | 1808 | QPDFObjectHandle qtest = pdf.getTrailer().getKey("/QTest"); |
| 1809 | - QPDFNameTreeObjectHelper ntoh(qtest); | 1809 | + QPDFNameTreeObjectHelper ntoh(qtest, pdf); |
| 1810 | for (auto iter: ntoh) | 1810 | for (auto iter: ntoh) |
| 1811 | { | 1811 | { |
| 1812 | std::cout << iter.first << " -> " | 1812 | std::cout << iter.first << " -> " |