aboutsummaryrefslogtreecommitdiffstats
path: root/fuzz
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-04-30 19:23:18 +0200
committerJay Berkenbilt <ejb@ql.org>2022-04-30 19:27:18 +0200
commit4f24617e1ea4ba7a6627a9c44304c6e0a0114249 (patch)
tree65c02e9e31cac60bac6f6aec165e8397dcde70e2 /fuzz
parent7f023701dd843749cf878baabeb3d33917fda62f (diff)
downloadqpdf-4f24617e1ea4ba7a6627a9c44304c6e0a0114249.tar.zst
Code clean up: use range-style for loops wherever possible
Where not possible, use "auto" to get the iterator type. Editorial note: I have avoid this change for a long time because of not wanting to make gratuitous changes to version history, which can obscure when certain changes were made, but with having recently touched every single file to apply automatic code formatting and with making several broad changes to the API, I decided it was time to take the plunge and get rid of the older (pre-C++11) verbose iterator syntax. The new code is just easier to read and understand, and in many cases, it will be more effecient as fewer temporary copies are being made. m-holger, if you're reading, you can see that I've finally come around. :-)
Diffstat (limited to 'fuzz')
-rw-r--r--fuzz/qpdf_fuzzer.cc17
1 files changed, 3 insertions, 14 deletions
diff --git a/fuzz/qpdf_fuzzer.cc b/fuzz/qpdf_fuzzer.cc
index aba08c7f..8b192b51 100644
--- a/fuzz/qpdf_fuzzer.cc
+++ b/fuzz/qpdf_fuzzer.cc
@@ -134,10 +134,7 @@ FuzzHelper::testPages()
std::vector<QPDFPageObjectHelper> pages = pdh.getAllPages();
DiscardContents discard_contents;
int pageno = 0;
- for (std::vector<QPDFPageObjectHelper>::iterator iter = pages.begin();
- iter != pages.end();
- ++iter) {
- QPDFPageObjectHelper& page(*iter);
+ for (auto& page: pages) {
++pageno;
try {
page.coalesceContentStreams();
@@ -150,11 +147,7 @@ FuzzHelper::testPages()
std::vector<QPDFAnnotationObjectHelper> annotations =
afdh.getWidgetAnnotationsForPage(page);
- for (std::vector<QPDFAnnotationObjectHelper>::iterator annot_iter =
- annotations.begin();
- annot_iter != annotations.end();
- ++annot_iter) {
- QPDFAnnotationObjectHelper& aoh = *annot_iter;
+ for (auto& aoh: annotations) {
afdh.getFieldForAnnotation(aoh);
}
} catch (QPDFExc& e) {
@@ -172,11 +165,7 @@ FuzzHelper::testOutlines()
queue.push_back(odh.getTopLevelOutlines());
while (!queue.empty()) {
std::vector<QPDFOutlineObjectHelper>& outlines = *(queue.begin());
- for (std::vector<QPDFOutlineObjectHelper>::iterator iter =
- outlines.begin();
- iter != outlines.end();
- ++iter) {
- QPDFOutlineObjectHelper& ol = *iter;
+ for (auto& ol: outlines) {
ol.getDestPage();
queue.push_back(ol.getKids());
}