Commit 7f023701dd843749cf878baabeb3d33917fda62f

Authored by Jay Berkenbilt
1 parent 2878c186

Formatting: remove space in range-style for loops

Change .clang-format and commit automated changes from a fresh run of
format-code
.clang-format
@@ -44,4 +44,7 @@ KeepEmptyLinesAtTheStartOfBlocks: false @@ -44,4 +44,7 @@ KeepEmptyLinesAtTheStartOfBlocks: false
44 NamespaceIndentation: All 44 NamespaceIndentation: All
45 PointerAlignment: Left 45 PointerAlignment: Left
46 PPIndentWidth: 1 46 PPIndentWidth: 1
  47 +SpaceBeforeCaseColon: false
  48 +SpaceBeforeCtorInitializerColon: true
47 SpaceBeforeInheritanceColon: false 49 SpaceBeforeInheritanceColon: false
  50 +SpaceBeforeRangeBasedForLoopColon: false
examples/pdf-bookmarks.cc
@@ -53,7 +53,7 @@ generate_page_map(QPDF& qpdf) @@ -53,7 +53,7 @@ generate_page_map(QPDF& qpdf)
53 { 53 {
54 QPDFPageDocumentHelper dh(qpdf); 54 QPDFPageDocumentHelper dh(qpdf);
55 int n = 0; 55 int n = 0;
56 - for (auto const& page : dh.getAllPages()) { 56 + for (auto const& page: dh.getAllPages()) {
57 page_map[page.getObjectHandle().getObjGen()] = ++n; 57 page_map[page.getObjectHandle().getObjGen()] = ++n;
58 } 58 }
59 } 59 }
@@ -69,7 +69,7 @@ show_bookmark_details(QPDFOutlineObjectHelper outline, std::vector<int> numbers) @@ -69,7 +69,7 @@ show_bookmark_details(QPDFOutlineObjectHelper outline, std::vector<int> numbers)
69 69
70 case st_numbers: 70 case st_numbers:
71 QTC::TC("examples", "pdf-bookmarks numbers"); 71 QTC::TC("examples", "pdf-bookmarks numbers");
72 - for (auto const& number : numbers) { 72 + for (auto const& number: numbers) {
73 std::cout << number << "."; 73 std::cout << number << ".";
74 } 74 }
75 std::cout << " "; 75 std::cout << " ";
@@ -130,7 +130,7 @@ extract_bookmarks( @@ -130,7 +130,7 @@ extract_bookmarks(
130 // is, so we count up to zero. 130 // is, so we count up to zero.
131 numbers.push_back( 131 numbers.push_back(
132 (style == st_lines) ? -QIntC::to_int(outlines.size()) : 0); 132 (style == st_lines) ? -QIntC::to_int(outlines.size()) : 0);
133 - for (auto& outline : outlines) { 133 + for (auto& outline: outlines) {
134 ++(numbers.back()); 134 ++(numbers.back());
135 show_bookmark_details(outline, numbers); 135 show_bookmark_details(outline, numbers);
136 extract_bookmarks(outline.getKids(), numbers); 136 extract_bookmarks(outline.getKids(), numbers);
examples/pdf-count-strings.cc
@@ -82,7 +82,7 @@ main(int argc, char* argv[]) @@ -82,7 +82,7 @@ main(int argc, char* argv[])
82 QPDF pdf; 82 QPDF pdf;
83 pdf.processFile(infilename); 83 pdf.processFile(infilename);
84 int pageno = 0; 84 int pageno = 0;
85 - for (auto& page : QPDFPageDocumentHelper(pdf).getAllPages()) { 85 + for (auto& page: QPDFPageDocumentHelper(pdf).getAllPages()) {
86 ++pageno; 86 ++pageno;
87 // Pass the contents of a page through our string counter. 87 // Pass the contents of a page through our string counter.
88 // If it's an even page, capture the output. This 88 // If it's an even page, capture the output. This
examples/pdf-create.cc
@@ -253,7 +253,7 @@ check( @@ -253,7 +253,7 @@ check(
253 } 253 }
254 size_t pageno = 1; 254 size_t pageno = 1;
255 bool errors = false; 255 bool errors = false;
256 - for (auto& page : pages) { 256 + for (auto& page: pages) {
257 auto images = page.getImages(); 257 auto images = page.getImages();
258 if (images.size() != 1) { 258 if (images.size() != 1) {
259 throw std::logic_error("incorrect number of images on page"); 259 throw std::logic_error("incorrect number of images on page");
@@ -368,8 +368,8 @@ create_pdf(char const* filename) @@ -368,8 +368,8 @@ create_pdf(char const* filename)
368 filters.push_back("/DCTDecode"); 368 filters.push_back("/DCTDecode");
369 filters.push_back("/RunLengthDecode"); 369 filters.push_back("/RunLengthDecode");
370 QPDFPageDocumentHelper dh(pdf); 370 QPDFPageDocumentHelper dh(pdf);
371 - for (auto const& color_space : color_spaces) {  
372 - for (auto const& filter : filters) { 371 + for (auto const& color_space: color_spaces) {
  372 + for (auto const& filter: filters) {
373 add_page(dh, font, color_space, filter); 373 add_page(dh, font, color_space, filter);
374 } 374 }
375 } 375 }
examples/pdf-custom-filter.cc
@@ -357,7 +357,7 @@ StreamReplacer::registerStream( @@ -357,7 +357,7 @@ StreamReplacer::registerStream(
357 this->copied_streams[og] = stream.copyStream(); 357 this->copied_streams[og] = stream.copyStream();
358 // Update the stream dictionary with any changes. 358 // Update the stream dictionary with any changes.
359 auto dict = stream.getDict(); 359 auto dict = stream.getDict();
360 - for (auto const& k : dict_updates.getKeys()) { 360 + for (auto const& k: dict_updates.getKeys()) {
361 dict.replaceKey(k, dict_updates.getKey(k)); 361 dict.replaceKey(k, dict_updates.getKey(k));
362 } 362 }
363 // Create the key stream that will be referenced from 363 // Create the key stream that will be referenced from
@@ -414,7 +414,7 @@ process( @@ -414,7 +414,7 @@ process(
414 StreamReplacer* replacer = new StreamReplacer(&qpdf); 414 StreamReplacer* replacer = new StreamReplacer(&qpdf);
415 std::shared_ptr<QPDFObjectHandle::StreamDataProvider> p(replacer); 415 std::shared_ptr<QPDFObjectHandle::StreamDataProvider> p(replacer);
416 416
417 - for (auto& o : qpdf.getAllObjects()) { 417 + for (auto& o: qpdf.getAllObjects()) {
418 if (o.isStream()) { 418 if (o.isStream()) {
419 // Call registerStream for every stream. Only ones that 419 // Call registerStream for every stream. Only ones that
420 // registerStream decides to replace will actually be 420 // registerStream decides to replace will actually be
examples/pdf-double-page-size.cc
@@ -37,7 +37,7 @@ doubleBoxSize(QPDFPageObjectHelper&amp; page, char const* box_name) @@ -37,7 +37,7 @@ doubleBoxSize(QPDFPageObjectHelper&amp; page, char const* box_name)
37 " is not an array of four elements"); 37 " is not an array of four elements");
38 } 38 }
39 std::vector<QPDFObjectHandle> doubled; 39 std::vector<QPDFObjectHandle> doubled;
40 - for (auto& item : box.aitems()) { 40 + for (auto& item: box.aitems()) {
41 doubled.push_back( 41 doubled.push_back(
42 QPDFObjectHandle::newReal(item.getNumericValue() * 2.0, 2)); 42 QPDFObjectHandle::newReal(item.getNumericValue() * 2.0, 2));
43 } 43 }
@@ -73,7 +73,7 @@ main(int argc, char* argv[]) @@ -73,7 +73,7 @@ main(int argc, char* argv[])
73 QPDF qpdf; 73 QPDF qpdf;
74 qpdf.processFile(infilename, password); 74 qpdf.processFile(infilename, password);
75 75
76 - for (auto& page : QPDFPageDocumentHelper(qpdf).getAllPages()) { 76 + for (auto& page: QPDFPageDocumentHelper(qpdf).getAllPages()) {
77 // Prepend the buffer to the page's contents 77 // Prepend the buffer to the page's contents
78 page.addPageContents( 78 page.addPageContents(
79 QPDFObjectHandle::newStream(&qpdf, content), true); 79 QPDFObjectHandle::newStream(&qpdf, content), true);
examples/pdf-invert-images.cc
@@ -137,7 +137,7 @@ main(int argc, char* argv[]) @@ -137,7 +137,7 @@ main(int argc, char* argv[])
137 QPDFPageObjectHelper& page(*iter); 137 QPDFPageObjectHelper& page(*iter);
138 // Get all images on the page. 138 // Get all images on the page.
139 std::map<std::string, QPDFObjectHandle> images = page.getImages(); 139 std::map<std::string, QPDFObjectHandle> images = page.getImages();
140 - for (auto& iter2 : images) { 140 + for (auto& iter2: images) {
141 QPDFObjectHandle& image = iter2.second; 141 QPDFObjectHandle& image = iter2.second;
142 QPDFObjectHandle image_dict = image.getDict(); 142 QPDFObjectHandle image_dict = image.getDict();
143 QPDFObjectHandle color_space = image_dict.getKey("/ColorSpace"); 143 QPDFObjectHandle color_space = image_dict.getKey("/ColorSpace");
examples/pdf-mod-info.cc
@@ -31,7 +31,7 @@ dumpInfoDict( @@ -31,7 +31,7 @@ dumpInfoDict(
31 { 31 {
32 QPDFObjectHandle trailer = pdf.getTrailer(); 32 QPDFObjectHandle trailer = pdf.getTrailer();
33 if (trailer.hasKey("/Info")) { 33 if (trailer.hasKey("/Info")) {
34 - for (auto& it : trailer.getKey("/Info").ditems()) { 34 + for (auto& it: trailer.getKey("/Info").ditems()) {
35 std::string val; 35 std::string val;
36 if (it.second.isString()) { 36 if (it.second.isString()) {
37 val = it.second.getStringValue(); 37 val = it.second.getStringValue();
examples/pdf-name-number-tree.cc
@@ -77,7 +77,7 @@ main(int argc, char* argv[]) @@ -77,7 +77,7 @@ main(int argc, char* argv[])
77 77
78 // Use range-for iteration 78 // Use range-for iteration
79 std::cout << "Name tree items:" << std::endl; 79 std::cout << "Name tree items:" << std::endl;
80 - for (auto i : name_tree) { 80 + for (auto i: name_tree) {
81 std::cout << " " << i.first << " -> " << i.second.unparse() 81 std::cout << " " << i.first << " -> " << i.second.unparse()
82 << std::endl; 82 << std::endl;
83 } 83 }
@@ -86,7 +86,7 @@ main(int argc, char* argv[]) @@ -86,7 +86,7 @@ main(int argc, char* argv[])
86 // look at it using dictionary and array iterators. 86 // look at it using dictionary and array iterators.
87 std::cout << "Keys in name tree object:" << std::endl; 87 std::cout << "Keys in name tree object:" << std::endl;
88 QPDFObjectHandle names; 88 QPDFObjectHandle names;
89 - for (auto const& i : name_tree_oh.ditems()) { 89 + for (auto const& i: name_tree_oh.ditems()) {
90 std::cout << i.first << std::endl; 90 std::cout << i.first << std::endl;
91 if (i.first == "/Names") { 91 if (i.first == "/Names") {
92 names = i.second; 92 names = i.second;
@@ -94,7 +94,7 @@ main(int argc, char* argv[]) @@ -94,7 +94,7 @@ main(int argc, char* argv[])
94 } 94 }
95 // Values in names array: 95 // Values in names array:
96 std::cout << "Values in names:" << std::endl; 96 std::cout << "Values in names:" << std::endl;
97 - for (auto& i : names.aitems()) { 97 + for (auto& i: names.aitems()) {
98 std::cout << " " << i.unparse() << std::endl; 98 std::cout << " " << i.unparse() << std::endl;
99 } 99 }
100 100
@@ -149,7 +149,7 @@ main(int argc, char* argv[]) @@ -149,7 +149,7 @@ main(int argc, char* argv[])
149 } 149 }
150 std::cout << "Numbers:" << std::endl; 150 std::cout << "Numbers:" << std::endl;
151 int n = 1; 151 int n = 1;
152 - for (auto& i : number_tree) { 152 + for (auto& i: number_tree) {
153 std::cout << i.first << " -> " << i.second.getUTF8Value(); 153 std::cout << i.first << " -> " << i.second.getUTF8Value();
154 if (n % 5) { 154 if (n % 5) {
155 std::cout << ", "; 155 std::cout << ", ";
@@ -172,7 +172,7 @@ main(int argc, char* argv[]) @@ -172,7 +172,7 @@ main(int argc, char* argv[])
172 } 172 }
173 std::cout << "Numbers after filtering:" << std::endl; 173 std::cout << "Numbers after filtering:" << std::endl;
174 n = 1; 174 n = 1;
175 - for (auto& i : number_tree) { 175 + for (auto& i: number_tree) {
176 std::cout << i.first << " -> " << i.second.getUTF8Value(); 176 std::cout << i.first << " -> " << i.second.getUTF8Value();
177 if (n % 5) { 177 if (n % 5) {
178 std::cout << ", "; 178 std::cout << ", ";
libqpdf/JSON.cc
@@ -20,7 +20,7 @@ JSON::JSON_dictionary::unparse(size_t depth) const @@ -20,7 +20,7 @@ JSON::JSON_dictionary::unparse(size_t depth) const
20 { 20 {
21 std::string result = "{"; 21 std::string result = "{";
22 bool first = true; 22 bool first = true;
23 - for (auto const& iter : members) { 23 + for (auto const& iter: members) {
24 if (first) { 24 if (first) {
25 first = false; 25 first = false;
26 } else { 26 } else {
@@ -44,7 +44,7 @@ JSON::JSON_array::unparse(size_t depth) const @@ -44,7 +44,7 @@ JSON::JSON_array::unparse(size_t depth) const
44 { 44 {
45 std::string result = "["; 45 std::string result = "[";
46 bool first = true; 46 bool first = true;
47 - for (auto const& element : elements) { 47 + for (auto const& element: elements) {
48 if (first) { 48 if (first) {
49 first = false; 49 first = false;
50 } else { 50 } else {
@@ -304,7 +304,7 @@ JSON::forEachDictItem( @@ -304,7 +304,7 @@ JSON::forEachDictItem(
304 if (v == nullptr) { 304 if (v == nullptr) {
305 return false; 305 return false;
306 } 306 }
307 - for (auto const& k : v->members) { 307 + for (auto const& k: v->members) {
308 fn(k.first, JSON(k.second)); 308 fn(k.first, JSON(k.second));
309 } 309 }
310 return true; 310 return true;
@@ -317,7 +317,7 @@ JSON::forEachArrayItem(std::function&lt;void(JSON value)&gt; fn) const @@ -317,7 +317,7 @@ JSON::forEachArrayItem(std::function&lt;void(JSON value)&gt; fn) const
317 if (v == nullptr) { 317 if (v == nullptr) {
318 return false; 318 return false;
319 } 319 }
320 - for (auto const& i : v->elements) { 320 + for (auto const& i: v->elements) {
321 fn(JSON(i)); 321 fn(JSON(i));
322 } 322 }
323 return true; 323 return true;
@@ -379,7 +379,7 @@ JSON::checkSchemaInternal( @@ -379,7 +379,7 @@ JSON::checkSchemaInternal(
379 379
380 if (sch_dict && (!pattern_key.empty())) { 380 if (sch_dict && (!pattern_key.empty())) {
381 auto pattern_schema = sch_dict->members[pattern_key].get(); 381 auto pattern_schema = sch_dict->members[pattern_key].get();
382 - for (auto const& iter : this_dict->members) { 382 + for (auto const& iter: this_dict->members) {
383 std::string const& key = iter.first; 383 std::string const& key = iter.first;
384 checkSchemaInternal( 384 checkSchemaInternal(
385 this_dict->members[key].get(), 385 this_dict->members[key].get(),
@@ -389,7 +389,7 @@ JSON::checkSchemaInternal( @@ -389,7 +389,7 @@ JSON::checkSchemaInternal(
389 prefix + "." + key); 389 prefix + "." + key);
390 } 390 }
391 } else if (sch_dict) { 391 } else if (sch_dict) {
392 - for (auto& iter : sch_dict->members) { 392 + for (auto& iter: sch_dict->members) {
393 std::string const& key = iter.first; 393 std::string const& key = iter.first;
394 if (this_dict->members.count(key)) { 394 if (this_dict->members.count(key)) {
395 checkSchemaInternal( 395 checkSchemaInternal(
@@ -409,7 +409,7 @@ JSON::checkSchemaInternal( @@ -409,7 +409,7 @@ JSON::checkSchemaInternal(
409 } 409 }
410 } 410 }
411 } 411 }
412 - for (auto const& iter : this_dict->members) { 412 + for (auto const& iter: this_dict->members) {
413 std::string const& key = iter.first; 413 std::string const& key = iter.first;
414 if (sch_dict->members.count(key) == 0) { 414 if (sch_dict->members.count(key) == 0) {
415 QTC::TC("libtests", "JSON key extra in object"); 415 QTC::TC("libtests", "JSON key extra in object");
@@ -431,7 +431,7 @@ JSON::checkSchemaInternal( @@ -431,7 +431,7 @@ JSON::checkSchemaInternal(
431 return false; 431 return false;
432 } 432 }
433 int i = 0; 433 int i = 0;
434 - for (auto const& element : this_arr->elements) { 434 + for (auto const& element: this_arr->elements) {
435 checkSchemaInternal( 435 checkSchemaInternal(
436 element.get(), 436 element.get(),
437 sch_arr->elements.at(0).get(), 437 sch_arr->elements.at(0).get(),
libqpdf/NNTree.cc
@@ -640,7 +640,7 @@ NNTreeIterator::deepen(QPDFObjectHandle node, bool first, bool allow_empty) @@ -640,7 +640,7 @@ NNTreeIterator::deepen(QPDFObjectHandle node, bool first, bool allow_empty)
640 bool failed = false; 640 bool failed = false;
641 641
642 std::set<QPDFObjGen> seen; 642 std::set<QPDFObjGen> seen;
643 - for (auto i : this->path) { 643 + for (auto i: this->path) {
644 if (i.node.isIndirect()) { 644 if (i.node.isIndirect()) {
645 seen.insert(i.node.getObjGen()); 645 seen.insert(i.node.getObjGen());
646 } 646 }
@@ -881,7 +881,7 @@ NNTreeImpl::repair() @@ -881,7 +881,7 @@ NNTreeImpl::repair()
881 auto new_node = QPDFObjectHandle::newDictionary(); 881 auto new_node = QPDFObjectHandle::newDictionary();
882 new_node.replaceKey(details.itemsKey(), QPDFObjectHandle::newArray()); 882 new_node.replaceKey(details.itemsKey(), QPDFObjectHandle::newArray());
883 NNTreeImpl repl(details, qpdf, new_node, false); 883 NNTreeImpl repl(details, qpdf, new_node, false);
884 - for (auto const& i : *this) { 884 + for (auto const& i: *this) {
885 repl.insert(i.first, i.second); 885 repl.insert(i.first, i.second);
886 } 886 }
887 this->oh.replaceKey("/Kids", new_node.getKey("/Kids")) 887 this->oh.replaceKey("/Kids", new_node.getKey("/Kids"))
libqpdf/QPDF.cc
@@ -2436,7 +2436,7 @@ QPDF::replaceForeignIndirectObjects( @@ -2436,7 +2436,7 @@ QPDF::replaceForeignIndirectObjects(
2436 QTC::TC("qpdf", "QPDF replace dictionary"); 2436 QTC::TC("qpdf", "QPDF replace dictionary");
2437 result = QPDFObjectHandle::newDictionary(); 2437 result = QPDFObjectHandle::newDictionary();
2438 std::set<std::string> keys = foreign.getKeys(); 2438 std::set<std::string> keys = foreign.getKeys();
2439 - for (auto const& iter : keys) { 2439 + for (auto const& iter: keys) {
2440 result.replaceKey( 2440 result.replaceKey(
2441 iter, 2441 iter,
2442 replaceForeignIndirectObjects( 2442 replaceForeignIndirectObjects(
@@ -2450,7 +2450,7 @@ QPDF::replaceForeignIndirectObjects( @@ -2450,7 +2450,7 @@ QPDF::replaceForeignIndirectObjects(
2450 QPDFObjectHandle dict = result.getDict(); 2450 QPDFObjectHandle dict = result.getDict();
2451 QPDFObjectHandle old_dict = foreign.getDict(); 2451 QPDFObjectHandle old_dict = foreign.getDict();
2452 std::set<std::string> keys = old_dict.getKeys(); 2452 std::set<std::string> keys = old_dict.getKeys();
2453 - for (auto const& iter : keys) { 2453 + for (auto const& iter: keys) {
2454 dict.replaceKey( 2454 dict.replaceKey(
2455 iter, 2455 iter,
2456 replaceForeignIndirectObjects( 2456 replaceForeignIndirectObjects(
libqpdf/QPDFAcroFormDocumentHelper.cc
@@ -82,7 +82,7 @@ QPDFAcroFormDocumentHelper::addAndRenameFormFields( @@ -82,7 +82,7 @@ QPDFAcroFormDocumentHelper::addAndRenameFormFields(
82 seen.insert(og); 82 seen.insert(og);
83 auto kids = obj.getKey("/Kids"); 83 auto kids = obj.getKey("/Kids");
84 if (kids.isArray()) { 84 if (kids.isArray()) {
85 - for (auto kid : kids.aitems()) { 85 + for (auto kid: kids.aitems()) {
86 queue.push_back(kid); 86 queue.push_back(kid);
87 } 87 }
88 } 88 }
@@ -119,7 +119,7 @@ QPDFAcroFormDocumentHelper::addAndRenameFormFields( @@ -119,7 +119,7 @@ QPDFAcroFormDocumentHelper::addAndRenameFormFields(
119 } 119 }
120 } 120 }
121 121
122 - for (auto i : fields) { 122 + for (auto i: fields) {
123 addFormField(i); 123 addFormField(i);
124 } 124 }
125 } 125 }
@@ -137,10 +137,10 @@ QPDFAcroFormDocumentHelper::removeFormFields( @@ -137,10 +137,10 @@ QPDFAcroFormDocumentHelper::removeFormFields(
137 return; 137 return;
138 } 138 }
139 139
140 - for (auto const& og : to_remove) { 140 + for (auto const& og: to_remove) {
141 auto annotations = this->m->field_to_annotations.find(og); 141 auto annotations = this->m->field_to_annotations.find(og);
142 if (annotations != this->m->field_to_annotations.end()) { 142 if (annotations != this->m->field_to_annotations.end()) {
143 - for (auto aoh : annotations->second) { 143 + for (auto aoh: annotations->second) {
144 this->m->annotation_to_field.erase( 144 this->m->annotation_to_field.erase(
145 aoh.getObjectHandle().getObjGen()); 145 aoh.getObjectHandle().getObjGen());
146 } 146 }
@@ -229,7 +229,7 @@ QPDFAcroFormDocumentHelper::getFormFieldsForPage(QPDFPageObjectHelper ph) @@ -229,7 +229,7 @@ QPDFAcroFormDocumentHelper::getFormFieldsForPage(QPDFPageObjectHelper ph)
229 std::set<QPDFObjGen> added; 229 std::set<QPDFObjGen> added;
230 std::vector<QPDFFormFieldObjectHelper> result; 230 std::vector<QPDFFormFieldObjectHelper> result;
231 auto widget_annotations = getWidgetAnnotationsForPage(ph); 231 auto widget_annotations = getWidgetAnnotationsForPage(ph);
232 - for (auto annot : widget_annotations) { 232 + for (auto annot: widget_annotations) {
233 auto field = getFieldForAnnotation(annot); 233 auto field = getFieldForAnnotation(annot);
234 field = field.getTopLevelField(); 234 field = field.getTopLevelField();
235 auto og = field.getObjectHandle().getObjGen(); 235 auto og = field.getObjectHandle().getObjGen();
@@ -576,21 +576,21 @@ ResourceReplacer::ResourceReplacer( @@ -576,21 +576,21 @@ ResourceReplacer::ResourceReplacer(
576 // We want: 576 // We want:
577 // * to_replace[key][offset] = new_key 577 // * to_replace[key][offset] = new_key
578 578
579 - for (auto const& rn_iter : rnames) { 579 + for (auto const& rn_iter: rnames) {
580 std::string const& rtype = rn_iter.first; 580 std::string const& rtype = rn_iter.first;
581 auto dr_map_rtype = dr_map.find(rtype); 581 auto dr_map_rtype = dr_map.find(rtype);
582 if (dr_map_rtype == dr_map.end()) { 582 if (dr_map_rtype == dr_map.end()) {
583 continue; 583 continue;
584 } 584 }
585 auto const& key_offsets = rn_iter.second; 585 auto const& key_offsets = rn_iter.second;
586 - for (auto const& ko_iter : key_offsets) { 586 + for (auto const& ko_iter: key_offsets) {
587 std::string const& old_key = ko_iter.first; 587 std::string const& old_key = ko_iter.first;
588 auto dr_map_rtype_old = dr_map_rtype->second.find(old_key); 588 auto dr_map_rtype_old = dr_map_rtype->second.find(old_key);
589 if (dr_map_rtype_old == dr_map_rtype->second.end()) { 589 if (dr_map_rtype_old == dr_map_rtype->second.end()) {
590 continue; 590 continue;
591 } 591 }
592 auto const& offsets = ko_iter.second; 592 auto const& offsets = ko_iter.second;
593 - for (auto const& o_iter : offsets) { 593 + for (auto const& o_iter: offsets) {
594 to_replace[old_key][o_iter] = dr_map_rtype_old->second; 594 to_replace[old_key][o_iter] = dr_map_rtype_old->second;
595 } 595 }
596 } 596 }
@@ -719,19 +719,19 @@ QPDFAcroFormDocumentHelper::adjustAppearanceStream( @@ -719,19 +719,19 @@ QPDFAcroFormDocumentHelper::adjustAppearanceStream(
719 // this to resolve conflicts that may already be in the resource 719 // this to resolve conflicts that may already be in the resource
720 // dictionary. 720 // dictionary.
721 auto merge_with = QPDFObjectHandle::newDictionary(); 721 auto merge_with = QPDFObjectHandle::newDictionary();
722 - for (auto const& top_key : dr_map) { 722 + for (auto const& top_key: dr_map) {
723 merge_with.replaceKey(top_key.first, QPDFObjectHandle::newDictionary()); 723 merge_with.replaceKey(top_key.first, QPDFObjectHandle::newDictionary());
724 } 724 }
725 resources.mergeResources(merge_with); 725 resources.mergeResources(merge_with);
726 // Rename any keys in the resource dictionary that we 726 // Rename any keys in the resource dictionary that we
727 // remapped. 727 // remapped.
728 - for (auto const& i1 : dr_map) { 728 + for (auto const& i1: dr_map) {
729 std::string const& top_key = i1.first; 729 std::string const& top_key = i1.first;
730 auto subdict = resources.getKey(top_key); 730 auto subdict = resources.getKey(top_key);
731 if (!subdict.isDictionary()) { 731 if (!subdict.isDictionary()) {
732 continue; 732 continue;
733 } 733 }
734 - for (auto const& i2 : i1.second) { 734 + for (auto const& i2: i1.second) {
735 std::string const& old_key = i2.first; 735 std::string const& old_key = i2.first;
736 std::string const& new_key = i2.second; 736 std::string const& new_key = i2.second;
737 auto existing_new = subdict.getKey(new_key); 737 auto existing_new = subdict.getKey(new_key);
@@ -757,7 +757,7 @@ QPDFAcroFormDocumentHelper::adjustAppearanceStream( @@ -757,7 +757,7 @@ QPDFAcroFormDocumentHelper::adjustAppearanceStream(
757 // the stream contents. 757 // the stream contents.
758 resources.mergeResources(merge_with, &dr_map); 758 resources.mergeResources(merge_with, &dr_map);
759 // Remove empty subdictionaries 759 // Remove empty subdictionaries
760 - for (auto iter : resources.ditems()) { 760 + for (auto iter: resources.ditems()) {
761 if (iter.second.isDictionary() && (iter.second.getKeys().size() == 0)) { 761 if (iter.second.isDictionary() && (iter.second.getKeys().size() == 0)) {
762 resources.removeKey(iter.first); 762 resources.removeKey(iter.first);
763 } 763 }
@@ -911,7 +911,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations( @@ -911,7 +911,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations(
911 // Now do the actual copies. 911 // Now do the actual copies.
912 912
913 std::set<QPDFObjGen> added_new_fields; 913 std::set<QPDFObjGen> added_new_fields;
914 - for (auto annot : old_annots.aitems()) { 914 + for (auto annot: old_annots.aitems()) {
915 if (annot.isStream()) { 915 if (annot.isStream()) {
916 annot.warnIfPossible("ignoring annotation that's a stream"); 916 annot.warnIfPossible("ignoring annotation that's a stream");
917 continue; 917 continue;
@@ -1101,12 +1101,12 @@ QPDFAcroFormDocumentHelper::transformAnnotations( @@ -1101,12 +1101,12 @@ QPDFAcroFormDocumentHelper::transformAnnotations(
1101 return dict.replaceKeyAndGet(key, old.copyStream()); 1101 return dict.replaceKeyAndGet(key, old.copyStream());
1102 }; 1102 };
1103 if (apdict.isDictionary()) { 1103 if (apdict.isDictionary()) {
1104 - for (auto& ap : apdict.ditems()) { 1104 + for (auto& ap: apdict.ditems()) {
1105 if (ap.second.isStream()) { 1105 if (ap.second.isStream()) {
1106 streams.push_back( 1106 streams.push_back(
1107 replace_stream(apdict, ap.first, ap.second)); 1107 replace_stream(apdict, ap.first, ap.second));
1108 } else if (ap.second.isDictionary()) { 1108 } else if (ap.second.isDictionary()) {
1109 - for (auto& ap2 : ap.second.ditems()) { 1109 + for (auto& ap2: ap.second.ditems()) {
1110 if (ap2.second.isStream()) { 1110 if (ap2.second.isStream()) {
1111 streams.push_back( 1111 streams.push_back(
1112 // line-break 1112 // line-break
@@ -1120,7 +1120,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations( @@ -1120,7 +1120,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations(
1120 1120
1121 // Now we can safely mutate the annotation and its appearance 1121 // Now we can safely mutate the annotation and its appearance
1122 // streams. 1122 // streams.
1123 - for (auto& stream : streams) { 1123 + for (auto& stream: streams) {
1124 auto dict = stream.getDict(); 1124 auto dict = stream.getDict();
1125 auto omatrix = dict.getKey("/Matrix"); 1125 auto omatrix = dict.getKey("/Matrix");
1126 QPDFMatrix apcm; 1126 QPDFMatrix apcm;
@@ -1172,7 +1172,7 @@ QPDFAcroFormDocumentHelper::fixCopiedAnnotations( @@ -1172,7 +1172,7 @@ QPDFAcroFormDocumentHelper::fixCopiedAnnotations(
1172 to_page.replaceKey("/Annots", QPDFObjectHandle::newArray(new_annots)); 1172 to_page.replaceKey("/Annots", QPDFObjectHandle::newArray(new_annots));
1173 addAndRenameFormFields(new_fields); 1173 addAndRenameFormFields(new_fields);
1174 if (added_fields) { 1174 if (added_fields) {
1175 - for (auto f : new_fields) { 1175 + for (auto f: new_fields) {
1176 added_fields->insert(f.getObjGen()); 1176 added_fields->insert(f.getObjGen());
1177 } 1177 }
1178 } 1178 }
libqpdf/QPDFArgParser.cc
@@ -381,7 +381,7 @@ QPDFArgParser::readArgsFromFile(std::string const&amp; filename) @@ -381,7 +381,7 @@ QPDFArgParser::readArgsFromFile(std::string const&amp; filename)
381 QTC::TC("libtests", "QPDFArgParser read args from file"); 381 QTC::TC("libtests", "QPDFArgParser read args from file");
382 lines = QUtil::read_lines_from_file(filename.c_str()); 382 lines = QUtil::read_lines_from_file(filename.c_str());
383 } 383 }
384 - for (auto const& line : lines) { 384 + for (auto const& line: lines) {
385 this->m->new_argv.push_back(QUtil::make_shared_cstr(line)); 385 this->m->new_argv.push_back(QUtil::make_shared_cstr(line));
386 } 386 }
387 } 387 }
@@ -636,7 +636,7 @@ QPDFArgParser::addChoicesToCompletions( @@ -636,7 +636,7 @@ QPDFArgParser::addChoicesToCompletions(
636 void 636 void
637 QPDFArgParser::addOptionsToCompletions(option_table_t& option_table) 637 QPDFArgParser::addOptionsToCompletions(option_table_t& option_table)
638 { 638 {
639 - for (auto& iter : option_table) { 639 + for (auto& iter: option_table) {
640 std::string const& arg = iter.first; 640 std::string const& arg = iter.first;
641 if (arg == "--") { 641 if (arg == "--") {
642 continue; 642 continue;
@@ -797,7 +797,7 @@ QPDFArgParser::getTopHelp(std::ostringstream&amp; msg) @@ -797,7 +797,7 @@ QPDFArgParser::getTopHelp(std::ostringstream&amp; msg)
797 << " --help=all\" to see all available help." << std::endl 797 << " --help=all\" to see all available help." << std::endl
798 << std::endl 798 << std::endl
799 << "Topics:" << std::endl; 799 << "Topics:" << std::endl;
800 - for (auto const& i : this->m->help_topics) { 800 + for (auto const& i: this->m->help_topics) {
801 msg << " " << i.first << ": " << i.second.short_text << std::endl; 801 msg << " " << i.first << ": " << i.second.short_text << std::endl;
802 } 802 }
803 } 803 }
@@ -807,7 +807,7 @@ QPDFArgParser::getAllHelp(std::ostringstream&amp; msg) @@ -807,7 +807,7 @@ QPDFArgParser::getAllHelp(std::ostringstream&amp; msg)
807 { 807 {
808 getTopHelp(msg); 808 getTopHelp(msg);
809 auto show = [this, &msg](std::map<std::string, HelpTopic>& topics) { 809 auto show = [this, &msg](std::map<std::string, HelpTopic>& topics) {
810 - for (auto const& i : topics) { 810 + for (auto const& i: topics) {
811 auto const& topic = i.first; 811 auto const& topic = i.first;
812 msg << std::endl 812 msg << std::endl
813 << "== " << topic << " (" << i.second.short_text 813 << "== " << topic << " (" << i.second.short_text
@@ -832,7 +832,7 @@ QPDFArgParser::getTopicHelp( @@ -832,7 +832,7 @@ QPDFArgParser::getTopicHelp(
832 } 832 }
833 if (!ht.options.empty()) { 833 if (!ht.options.empty()) {
834 msg << std::endl << "Related options:" << std::endl; 834 msg << std::endl << "Related options:" << std::endl;
835 - for (auto const& i : ht.options) { 835 + for (auto const& i: ht.options) {
836 msg << " " << i << ": " << this->m->option_help[i].short_text 836 msg << " " << i << ": " << this->m->option_help[i].short_text
837 << std::endl; 837 << std::endl;
838 } 838 }
libqpdf/QPDFCryptoProvider.cc
@@ -106,7 +106,7 @@ QPDFCryptoProvider::getRegisteredImpls() @@ -106,7 +106,7 @@ QPDFCryptoProvider::getRegisteredImpls()
106 { 106 {
107 std::set<std::string> result; 107 std::set<std::string> result;
108 QPDFCryptoProvider& p = getInstance(); 108 QPDFCryptoProvider& p = getInstance();
109 - for (auto const& iter : p.m->providers) { 109 + for (auto const& iter: p.m->providers) {
110 result.insert(iter.first); 110 result.insert(iter.first);
111 } 111 }
112 return result; 112 return result;
libqpdf/QPDFEmbeddedFileDocumentHelper.cc
@@ -92,7 +92,7 @@ QPDFEmbeddedFileDocumentHelper::getEmbeddedFiles() @@ -92,7 +92,7 @@ QPDFEmbeddedFileDocumentHelper::getEmbeddedFiles()
92 { 92 {
93 std::map<std::string, std::shared_ptr<QPDFFileSpecObjectHelper>> result; 93 std::map<std::string, std::shared_ptr<QPDFFileSpecObjectHelper>> result;
94 if (this->m->embedded_files) { 94 if (this->m->embedded_files) {
95 - for (auto const& i : *(this->m->embedded_files)) { 95 + for (auto const& i: *(this->m->embedded_files)) {
96 result[i.first] = 96 result[i.first] =
97 std::make_shared<QPDFFileSpecObjectHelper>(i.second); 97 std::make_shared<QPDFFileSpecObjectHelper>(i.second);
98 } 98 }
libqpdf/QPDFFileSpecObjectHelper.cc
@@ -36,7 +36,7 @@ QPDFFileSpecObjectHelper::getDescription() @@ -36,7 +36,7 @@ QPDFFileSpecObjectHelper::getDescription()
36 std::string 36 std::string
37 QPDFFileSpecObjectHelper::getFilename() 37 QPDFFileSpecObjectHelper::getFilename()
38 { 38 {
39 - for (auto const& i : name_keys) { 39 + for (auto const& i: name_keys) {
40 auto k = this->oh.getKey(i); 40 auto k = this->oh.getKey(i);
41 if (k.isString()) { 41 if (k.isString()) {
42 return k.getUTF8Value(); 42 return k.getUTF8Value();
@@ -49,7 +49,7 @@ std::map&lt;std::string, std::string&gt; @@ -49,7 +49,7 @@ std::map&lt;std::string, std::string&gt;
49 QPDFFileSpecObjectHelper::getFilenames() 49 QPDFFileSpecObjectHelper::getFilenames()
50 { 50 {
51 std::map<std::string, std::string> result; 51 std::map<std::string, std::string> result;
52 - for (auto const& i : name_keys) { 52 + for (auto const& i: name_keys) {
53 auto k = this->oh.getKey(i); 53 auto k = this->oh.getKey(i);
54 if (k.isString()) { 54 if (k.isString()) {
55 result[i] = k.getUTF8Value(); 55 result[i] = k.getUTF8Value();
@@ -68,7 +68,7 @@ QPDFFileSpecObjectHelper::getEmbeddedFileStream(std::string const&amp; key) @@ -68,7 +68,7 @@ QPDFFileSpecObjectHelper::getEmbeddedFileStream(std::string const&amp; key)
68 if (!key.empty()) { 68 if (!key.empty()) {
69 return ef.getKey(key); 69 return ef.getKey(key);
70 } 70 }
71 - for (auto const& i : name_keys) { 71 + for (auto const& i: name_keys) {
72 auto k = ef.getKey(i); 72 auto k = ef.getKey(i);
73 if (k.isStream()) { 73 if (k.isStream()) {
74 return k; 74 return k;
libqpdf/QPDFJob.cc
@@ -940,7 +940,7 @@ QPDFJob::doShowPages(QPDF&amp; pdf) @@ -940,7 +940,7 @@ QPDFJob::doShowPages(QPDF&amp; pdf)
940 std::map<std::string, QPDFObjectHandle> images = ph.getImages(); 940 std::map<std::string, QPDFObjectHandle> images = ph.getImages();
941 if (!images.empty()) { 941 if (!images.empty()) {
942 cout << " images:" << std::endl; 942 cout << " images:" << std::endl;
943 - for (auto const& iter2 : images) { 943 + for (auto const& iter2: images) {
944 std::string const& name = iter2.first; 944 std::string const& name = iter2.first;
945 QPDFObjectHandle image = iter2.second; 945 QPDFObjectHandle image = iter2.second;
946 QPDFObjectHandle dict = image.getDict(); 946 QPDFObjectHandle dict = image.getDict();
@@ -954,7 +954,7 @@ QPDFJob::doShowPages(QPDF&amp; pdf) @@ -954,7 +954,7 @@ QPDFJob::doShowPages(QPDF&amp; pdf)
954 954
955 cout << " content:" << std::endl; 955 cout << " content:" << std::endl;
956 std::vector<QPDFObjectHandle> content = ph.getPageContents(); 956 std::vector<QPDFObjectHandle> content = ph.getPageContents();
957 - for (auto& iter2 : content) { 957 + for (auto& iter2: content) {
958 cout << " " << iter2.unparse() << std::endl; 958 cout << " " << iter2.unparse() << std::endl;
959 } 959 }
960 } 960 }
@@ -965,7 +965,7 @@ QPDFJob::doListAttachments(QPDF&amp; pdf) @@ -965,7 +965,7 @@ QPDFJob::doListAttachments(QPDF&amp; pdf)
965 { 965 {
966 QPDFEmbeddedFileDocumentHelper efdh(pdf); 966 QPDFEmbeddedFileDocumentHelper efdh(pdf);
967 if (efdh.hasEmbeddedFiles()) { 967 if (efdh.hasEmbeddedFiles()) {
968 - for (auto const& i : efdh.getEmbeddedFiles()) { 968 + for (auto const& i: efdh.getEmbeddedFiles()) {
969 std::string const& key = i.first; 969 std::string const& key = i.first;
970 auto efoh = i.second; 970 auto efoh = i.second;
971 *(this->m->cout) 971 *(this->m->cout)
@@ -979,12 +979,12 @@ QPDFJob::doListAttachments(QPDF&amp; pdf) @@ -979,12 +979,12 @@ QPDFJob::doListAttachments(QPDF&amp; pdf)
979 cout << " preferred name: " << efoh->getFilename() 979 cout << " preferred name: " << efoh->getFilename()
980 << std::endl; 980 << std::endl;
981 cout << " all names:" << std::endl; 981 cout << " all names:" << std::endl;
982 - for (auto const& i2 : efoh->getFilenames()) { 982 + for (auto const& i2: efoh->getFilenames()) {
983 cout << " " << i2.first << " -> " << i2.second 983 cout << " " << i2.first << " -> " << i2.second
984 << std::endl; 984 << std::endl;
985 } 985 }
986 cout << " all data streams:" << std::endl; 986 cout << " all data streams:" << std::endl;
987 - for (auto i2 : efoh->getEmbeddedFileStreams().ditems()) { 987 + for (auto i2: efoh->getEmbeddedFileStreams().ditems()) {
988 cout << " " << i2.first << " -> " 988 cout << " " << i2.first << " -> "
989 << i2.second.getObjGen() << std::endl; 989 << i2.second.getObjGen() << std::endl;
990 } 990 }
@@ -1032,7 +1032,7 @@ std::set&lt;QPDFObjGen&gt; @@ -1032,7 +1032,7 @@ std::set&lt;QPDFObjGen&gt;
1032 QPDFJob::getWantedJSONObjects() 1032 QPDFJob::getWantedJSONObjects()
1033 { 1033 {
1034 std::set<QPDFObjGen> wanted_og; 1034 std::set<QPDFObjGen> wanted_og;
1035 - for (auto const& iter : m->json_objects) { 1035 + for (auto const& iter: m->json_objects) {
1036 bool trailer; 1036 bool trailer;
1037 int obj = 0; 1037 int obj = 0;
1038 int gen = 0; 1038 int gen = 0;
@@ -1077,7 +1077,7 @@ QPDFJob::doJSONObjectinfo(QPDF&amp; pdf, JSON&amp; j) @@ -1077,7 +1077,7 @@ QPDFJob::doJSONObjectinfo(QPDF&amp; pdf, JSON&amp; j)
1077 std::set<QPDFObjGen> wanted_og = getWantedJSONObjects(); 1077 std::set<QPDFObjGen> wanted_og = getWantedJSONObjects();
1078 JSON j_objectinfo = 1078 JSON j_objectinfo =
1079 j.addDictionaryMember("objectinfo", JSON::makeDictionary()); 1079 j.addDictionaryMember("objectinfo", JSON::makeDictionary());
1080 - for (auto& obj : pdf.getAllObjects()) { 1080 + for (auto& obj: pdf.getAllObjects()) {
1081 if (all_objects || wanted_og.count(obj.getObjGen())) { 1081 if (all_objects || wanted_og.count(obj.getObjGen())) {
1082 auto j_details = j_objectinfo.addDictionaryMember( 1082 auto j_details = j_objectinfo.addDictionaryMember(
1083 obj.unparse(), JSON::makeDictionary()); 1083 obj.unparse(), JSON::makeDictionary());
@@ -1116,7 +1116,7 @@ QPDFJob::doJSONPages(QPDF&amp; pdf, JSON&amp; j) @@ -1116,7 +1116,7 @@ QPDFJob::doJSONPages(QPDF&amp; pdf, JSON&amp; j)
1116 j_page.addDictionaryMember("object", page.getJSON()); 1116 j_page.addDictionaryMember("object", page.getJSON());
1117 JSON j_images = j_page.addDictionaryMember("images", JSON::makeArray()); 1117 JSON j_images = j_page.addDictionaryMember("images", JSON::makeArray());
1118 std::map<std::string, QPDFObjectHandle> images = ph.getImages(); 1118 std::map<std::string, QPDFObjectHandle> images = ph.getImages();
1119 - for (auto const& iter2 : images) { 1119 + for (auto const& iter2: images) {
1120 JSON j_image = j_images.addArrayElement(JSON::makeDictionary()); 1120 JSON j_image = j_images.addArrayElement(JSON::makeDictionary());
1121 j_image.addDictionaryMember("name", JSON::makeString(iter2.first)); 1121 j_image.addDictionaryMember("name", JSON::makeString(iter2.first));
1122 QPDFObjectHandle image = iter2.second; 1122 QPDFObjectHandle image = iter2.second;
@@ -1152,7 +1152,7 @@ QPDFJob::doJSONPages(QPDF&amp; pdf, JSON&amp; j) @@ -1152,7 +1152,7 @@ QPDFJob::doJSONPages(QPDF&amp; pdf, JSON&amp; j)
1152 JSON j_contents = 1152 JSON j_contents =
1153 j_page.addDictionaryMember("contents", JSON::makeArray()); 1153 j_page.addDictionaryMember("contents", JSON::makeArray());
1154 std::vector<QPDFObjectHandle> content = ph.getPageContents(); 1154 std::vector<QPDFObjectHandle> content = ph.getPageContents();
1155 - for (auto& iter2 : content) { 1155 + for (auto& iter2: content) {
1156 j_contents.addArrayElement(iter2.getJSON()); 1156 j_contents.addArrayElement(iter2.getJSON());
1157 } 1157 }
1158 j_page.addDictionaryMember( 1158 j_page.addDictionaryMember(
@@ -1419,7 +1419,7 @@ QPDFJob::doJSONAttachments(QPDF&amp; pdf, JSON&amp; j) @@ -1419,7 +1419,7 @@ QPDFJob::doJSONAttachments(QPDF&amp; pdf, JSON&amp; j)
1419 JSON j_attachments = 1419 JSON j_attachments =
1420 j.addDictionaryMember("attachments", JSON::makeDictionary()); 1420 j.addDictionaryMember("attachments", JSON::makeDictionary());
1421 QPDFEmbeddedFileDocumentHelper efdh(pdf); 1421 QPDFEmbeddedFileDocumentHelper efdh(pdf);
1422 - for (auto const& iter : efdh.getEmbeddedFiles()) { 1422 + for (auto const& iter: efdh.getEmbeddedFiles()) {
1423 std::string const& key = iter.first; 1423 std::string const& key = iter.first;
1424 auto fsoh = iter.second; 1424 auto fsoh = iter.second;
1425 auto j_details = 1425 auto j_details =
@@ -2099,7 +2099,7 @@ QPDFJob::addAttachments(QPDF&amp; pdf) @@ -2099,7 +2099,7 @@ QPDFJob::addAttachments(QPDF&amp; pdf)
2099 maybe_set_pagemode(pdf, "/UseAttachments"); 2099 maybe_set_pagemode(pdf, "/UseAttachments");
2100 QPDFEmbeddedFileDocumentHelper efdh(pdf); 2100 QPDFEmbeddedFileDocumentHelper efdh(pdf);
2101 std::vector<std::string> duplicated_keys; 2101 std::vector<std::string> duplicated_keys;
2102 - for (auto const& to_add : m->attachments_to_add) { 2102 + for (auto const& to_add: m->attachments_to_add) {
2103 if ((!to_add.replace) && efdh.getEmbeddedFile(to_add.key)) { 2103 if ((!to_add.replace) && efdh.getEmbeddedFile(to_add.key)) {
2104 duplicated_keys.push_back(to_add.key); 2104 duplicated_keys.push_back(to_add.key);
2105 continue; 2105 continue;
@@ -2125,7 +2125,7 @@ QPDFJob::addAttachments(QPDF&amp; pdf) @@ -2125,7 +2125,7 @@ QPDFJob::addAttachments(QPDF&amp; pdf)
2125 2125
2126 if (!duplicated_keys.empty()) { 2126 if (!duplicated_keys.empty()) {
2127 std::string message; 2127 std::string message;
2128 - for (auto const& k : duplicated_keys) { 2128 + for (auto const& k: duplicated_keys) {
2129 if (!message.empty()) { 2129 if (!message.empty()) {
2130 message += ", "; 2130 message += ", ";
2131 } 2131 }
@@ -2144,7 +2144,7 @@ QPDFJob::copyAttachments(QPDF&amp; pdf) @@ -2144,7 +2144,7 @@ QPDFJob::copyAttachments(QPDF&amp; pdf)
2144 maybe_set_pagemode(pdf, "/UseAttachments"); 2144 maybe_set_pagemode(pdf, "/UseAttachments");
2145 QPDFEmbeddedFileDocumentHelper efdh(pdf); 2145 QPDFEmbeddedFileDocumentHelper efdh(pdf);
2146 std::vector<std::string> duplicates; 2146 std::vector<std::string> duplicates;
2147 - for (auto const& to_copy : m->attachments_to_copy) { 2147 + for (auto const& to_copy: m->attachments_to_copy) {
2148 doIfVerbose([&](std::ostream& cout, std::string const& prefix) { 2148 doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2149 cout << prefix << ": copying attachments from " << to_copy.path 2149 cout << prefix << ": copying attachments from " << to_copy.path
2150 << std::endl; 2150 << std::endl;
@@ -2153,7 +2153,7 @@ QPDFJob::copyAttachments(QPDF&amp; pdf) @@ -2153,7 +2153,7 @@ QPDFJob::copyAttachments(QPDF&amp; pdf)
2153 processFile(to_copy.path.c_str(), to_copy.password.c_str(), false); 2153 processFile(to_copy.path.c_str(), to_copy.password.c_str(), false);
2154 QPDFEmbeddedFileDocumentHelper other_efdh(*other); 2154 QPDFEmbeddedFileDocumentHelper other_efdh(*other);
2155 auto other_attachments = other_efdh.getEmbeddedFiles(); 2155 auto other_attachments = other_efdh.getEmbeddedFiles();
2156 - for (auto const& iter : other_attachments) { 2156 + for (auto const& iter: other_attachments) {
2157 std::string new_key = to_copy.prefix + iter.first; 2157 std::string new_key = to_copy.prefix + iter.first;
2158 if (efdh.getEmbeddedFile(new_key)) { 2158 if (efdh.getEmbeddedFile(new_key)) {
2159 duplicates.push_back( 2159 duplicates.push_back(
@@ -2177,7 +2177,7 @@ QPDFJob::copyAttachments(QPDF&amp; pdf) @@ -2177,7 +2177,7 @@ QPDFJob::copyAttachments(QPDF&amp; pdf)
2177 2177
2178 if (!duplicates.empty()) { 2178 if (!duplicates.empty()) {
2179 std::string message; 2179 std::string message;
2180 - for (auto const& i : duplicates) { 2180 + for (auto const& i: duplicates) {
2181 if (!message.empty()) { 2181 if (!message.empty()) {
2182 message += "; "; 2182 message += "; ";
2183 } 2183 }
@@ -2223,7 +2223,7 @@ QPDFJob::handleTransformations(QPDF&amp; pdf) @@ -2223,7 +2223,7 @@ QPDFJob::handleTransformations(QPDF&amp; pdf)
2223 QPDFPageObjectHelper& ph(*iter); 2223 QPDFPageObjectHelper& ph(*iter);
2224 QPDFObjectHandle page = ph.getObjectHandle(); 2224 QPDFObjectHandle page = ph.getObjectHandle();
2225 std::map<std::string, QPDFObjectHandle> images = ph.getImages(); 2225 std::map<std::string, QPDFObjectHandle> images = ph.getImages();
2226 - for (auto& iter2 : images) { 2226 + for (auto& iter2: images) {
2227 std::string name = iter2.first; 2227 std::string name = iter2.first;
2228 QPDFObjectHandle& image = iter2.second; 2228 QPDFObjectHandle& image = iter2.second;
2229 ImageOptimizer* io = new ImageOptimizer( 2229 ImageOptimizer* io = new ImageOptimizer(
@@ -2268,7 +2268,7 @@ QPDFJob::handleTransformations(QPDF&amp; pdf) @@ -2268,7 +2268,7 @@ QPDFJob::handleTransformations(QPDF&amp; pdf)
2268 } 2268 }
2269 if (m->flatten_rotation) { 2269 if (m->flatten_rotation) {
2270 make_afdh(); 2270 make_afdh();
2271 - for (auto& page : dh.getAllPages()) { 2271 + for (auto& page: dh.getAllPages()) {
2272 page.flattenRotation(afdh.get()); 2272 page.flattenRotation(afdh.get());
2273 } 2273 }
2274 } 2274 }
@@ -2277,7 +2277,7 @@ QPDFJob::handleTransformations(QPDF&amp; pdf) @@ -2277,7 +2277,7 @@ QPDFJob::handleTransformations(QPDF&amp; pdf)
2277 } 2277 }
2278 if (!m->attachments_to_remove.empty()) { 2278 if (!m->attachments_to_remove.empty()) {
2279 QPDFEmbeddedFileDocumentHelper efdh(pdf); 2279 QPDFEmbeddedFileDocumentHelper efdh(pdf);
2280 - for (auto const& key : m->attachments_to_remove) { 2280 + for (auto const& key: m->attachments_to_remove) {
2281 if (efdh.removeEmbeddedFile(key)) { 2281 if (efdh.removeEmbeddedFile(key)) {
2282 doIfVerbose([&](std::ostream& cout, std::string const& prefix) { 2282 doIfVerbose([&](std::ostream& cout, std::string const& prefix) {
2283 cout << prefix << ": removed attachment " << key 2283 cout << prefix << ": removed attachment " << key
@@ -2386,7 +2386,7 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF&amp; pdf) @@ -2386,7 +2386,7 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF&amp; pdf)
2386 resources_seen.insert(xobject_og); 2386 resources_seen.insert(xobject_og);
2387 } 2387 }
2388 if (xobject.isDictionary()) { 2388 if (xobject.isDictionary()) {
2389 - for (auto const& k : xobject.getKeys()) { 2389 + for (auto const& k: xobject.getKeys()) {
2390 QPDFObjectHandle xobj = xobject.getKey(k); 2390 QPDFObjectHandle xobj = xobject.getKey(k);
2391 if (xobj.isFormXObject()) { 2391 if (xobj.isFormXObject()) {
2392 queue.push_back(xobj); 2392 queue.push_back(xobj);
@@ -2443,7 +2443,7 @@ QPDFJob::handlePageSpecs( @@ -2443,7 +2443,7 @@ QPDFJob::handlePageSpecs(
2443 // some portable heuristic based on OS limits, just hard-code 2443 // some portable heuristic based on OS limits, just hard-code
2444 // this at a given number and allow users to override. 2444 // this at a given number and allow users to override.
2445 std::set<std::string> filenames; 2445 std::set<std::string> filenames;
2446 - for (auto& page_spec : m->page_specs) { 2446 + for (auto& page_spec: m->page_specs) {
2447 filenames.insert(page_spec.filename); 2447 filenames.insert(page_spec.filename);
2448 } 2448 }
2449 m->keep_files_open = (filenames.size() <= m->keep_files_open_threshold); 2449 m->keep_files_open = (filenames.size() <= m->keep_files_open_threshold);
@@ -2707,7 +2707,7 @@ QPDFJob::handlePageSpecs( @@ -2707,7 +2707,7 @@ QPDFJob::handlePageSpecs(
2707 for (size_t pageno = 0; pageno < orig_pages.size(); ++pageno) { 2707 for (size_t pageno = 0; pageno < orig_pages.size(); ++pageno) {
2708 auto page = orig_pages.at(pageno); 2708 auto page = orig_pages.at(pageno);
2709 if (selected_from_orig.count(QIntC::to_int(pageno))) { 2709 if (selected_from_orig.count(QIntC::to_int(pageno))) {
2710 - for (auto field : this_afdh->getFormFieldsForPage(page)) { 2710 + for (auto field: this_afdh->getFormFieldsForPage(page)) {
2711 QTC::TC("qpdf", "QPDFJob pages keeping field from original"); 2711 QTC::TC("qpdf", "QPDFJob pages keeping field from original");
2712 referenced_fields.insert(field.getObjectHandle().getObjGen()); 2712 referenced_fields.insert(field.getObjectHandle().getObjGen());
2713 } 2713 }
@@ -2726,7 +2726,7 @@ QPDFJob::handlePageSpecs( @@ -2726,7 +2726,7 @@ QPDFJob::handlePageSpecs(
2726 if (fields.isIndirect()) { 2726 if (fields.isIndirect()) {
2727 new_fields = pdf.makeIndirectObject(new_fields); 2727 new_fields = pdf.makeIndirectObject(new_fields);
2728 } 2728 }
2729 - for (auto const& field : fields.aitems()) { 2729 + for (auto const& field: fields.aitems()) {
2730 if (referenced_fields.count(field.getObjGen())) { 2730 if (referenced_fields.count(field.getObjGen())) {
2731 new_fields.appendItem(field); 2731 new_fields.appendItem(field);
2732 } 2732 }
libqpdf/QPDFJob_argv.cc
@@ -167,7 +167,7 @@ ArgParser::argShowCrypto() @@ -167,7 +167,7 @@ ArgParser::argShowCrypto()
167 auto crypto = QPDFCryptoProvider::getRegisteredImpls(); 167 auto crypto = QPDFCryptoProvider::getRegisteredImpls();
168 std::string default_crypto = QPDFCryptoProvider::getDefaultProvider(); 168 std::string default_crypto = QPDFCryptoProvider::getDefaultProvider();
169 std::cout << default_crypto << std::endl; 169 std::cout << default_crypto << std::endl;
170 - for (auto const& iter : crypto) { 170 + for (auto const& iter: crypto) {
171 if (iter != default_crypto) { 171 if (iter != default_crypto) {
172 std::cout << iter << std::endl; 172 std::cout << iter << std::endl;
173 } 173 }
libqpdf/QPDFJob_json.cc
@@ -583,7 +583,7 @@ QPDFJob::initializeFromJson(std::string const&amp; json, bool partial) @@ -583,7 +583,7 @@ QPDFJob::initializeFromJson(std::string const&amp; json, bool partial)
583 if (!j.checkSchema(JOB_SCHEMA, JSON::f_optional, errors)) { 583 if (!j.checkSchema(JOB_SCHEMA, JSON::f_optional, errors)) {
584 std::ostringstream msg; 584 std::ostringstream msg;
585 msg << this->m->message_prefix << ": job json has errors:"; 585 msg << this->m->message_prefix << ": job json has errors:";
586 - for (auto const& error : errors) { 586 + for (auto const& error: errors) {
587 msg << std::endl << " " << error; 587 msg << std::endl << " " << error;
588 } 588 }
589 throw std::runtime_error(msg.str()); 589 throw std::runtime_error(msg.str());
libqpdf/QPDFObjectHandle.cc
@@ -949,7 +949,7 @@ void @@ -949,7 +949,7 @@ void
949 QPDFObjectHandle::setArrayFromVector(std::vector<QPDFObjectHandle> const& items) 949 QPDFObjectHandle::setArrayFromVector(std::vector<QPDFObjectHandle> const& items)
950 { 950 {
951 if (isArray()) { 951 if (isArray()) {
952 - for (auto const& item : items) { 952 + for (auto const& item: items) {
953 checkOwnership(item); 953 checkOwnership(item);
954 } 954 }
955 dynamic_cast<QPDF_Array*>(obj.get())->setFromVector(items); 955 dynamic_cast<QPDF_Array*>(obj.get())->setFromVector(items);
@@ -1108,7 +1108,7 @@ QPDFObjectHandle::isOrHasName(std::string const&amp; value) @@ -1108,7 +1108,7 @@ QPDFObjectHandle::isOrHasName(std::string const&amp; value)
1108 if (isNameAndEquals(value)) { 1108 if (isNameAndEquals(value)) {
1109 return true; 1109 return true;
1110 } else if (isArray()) { 1110 } else if (isArray()) {
1111 - for (auto& item : aitems()) { 1111 + for (auto& item: aitems()) {
1112 if (item.isNameAndEquals(value)) { 1112 if (item.isNameAndEquals(value)) {
1113 return true; 1113 return true;
1114 } 1114 }
@@ -1123,12 +1123,12 @@ QPDFObjectHandle::makeResourcesIndirect(QPDF&amp; owning_qpdf) @@ -1123,12 +1123,12 @@ QPDFObjectHandle::makeResourcesIndirect(QPDF&amp; owning_qpdf)
1123 if (!isDictionary()) { 1123 if (!isDictionary()) {
1124 return; 1124 return;
1125 } 1125 }
1126 - for (auto const& i1 : ditems()) { 1126 + for (auto const& i1: ditems()) {
1127 QPDFObjectHandle sub = i1.second; 1127 QPDFObjectHandle sub = i1.second;
1128 if (!sub.isDictionary()) { 1128 if (!sub.isDictionary()) {
1129 continue; 1129 continue;
1130 } 1130 }
1131 - for (auto i2 : sub.ditems()) { 1131 + for (auto i2: sub.ditems()) {
1132 std::string const& key = i2.first; 1132 std::string const& key = i2.first;
1133 QPDFObjectHandle val = i2.second; 1133 QPDFObjectHandle val = i2.second;
1134 if (!val.isIndirect()) { 1134 if (!val.isIndirect()) {
@@ -1150,7 +1150,7 @@ QPDFObjectHandle::mergeResources( @@ -1150,7 +1150,7 @@ QPDFObjectHandle::mergeResources(
1150 1150
1151 auto make_og_to_name = [](QPDFObjectHandle& dict, 1151 auto make_og_to_name = [](QPDFObjectHandle& dict,
1152 std::map<QPDFObjGen, std::string>& og_to_name) { 1152 std::map<QPDFObjGen, std::string>& og_to_name) {
1153 - for (auto i : dict.ditems()) { 1153 + for (auto i: dict.ditems()) {
1154 if (i.second.isIndirect()) { 1154 if (i.second.isIndirect()) {
1155 og_to_name[i.second.getObjGen()] = i.first; 1155 og_to_name[i.second.getObjGen()] = i.first;
1156 } 1156 }
@@ -1159,7 +1159,7 @@ QPDFObjectHandle::mergeResources( @@ -1159,7 +1159,7 @@ QPDFObjectHandle::mergeResources(
1159 1159
1160 // This algorithm is described in comments in QPDFObjectHandle.hh 1160 // This algorithm is described in comments in QPDFObjectHandle.hh
1161 // above the declaration of mergeResources. 1161 // above the declaration of mergeResources.
1162 - for (auto o_top : other.ditems()) { 1162 + for (auto o_top: other.ditems()) {
1163 std::string const& rtype = o_top.first; 1163 std::string const& rtype = o_top.first;
1164 QPDFObjectHandle other_val = o_top.second; 1164 QPDFObjectHandle other_val = o_top.second;
1165 if (hasKey(rtype)) { 1165 if (hasKey(rtype)) {
@@ -1178,7 +1178,7 @@ QPDFObjectHandle::mergeResources( @@ -1178,7 +1178,7 @@ QPDFObjectHandle::mergeResources(
1178 std::set<std::string> rnames; 1178 std::set<std::string> rnames;
1179 int min_suffix = 1; 1179 int min_suffix = 1;
1180 bool initialized_maps = false; 1180 bool initialized_maps = false;
1181 - for (auto ov_iter : other_val.ditems()) { 1181 + for (auto ov_iter: other_val.ditems()) {
1182 std::string const& key = ov_iter.first; 1182 std::string const& key = ov_iter.first;
1183 QPDFObjectHandle rval = ov_iter.second; 1183 QPDFObjectHandle rval = ov_iter.second;
1184 if (!this_val.hasKey(key)) { 1184 if (!this_val.hasKey(key)) {
@@ -1212,12 +1212,12 @@ QPDFObjectHandle::mergeResources( @@ -1212,12 +1212,12 @@ QPDFObjectHandle::mergeResources(
1212 } 1212 }
1213 } else if (this_val.isArray() && other_val.isArray()) { 1213 } else if (this_val.isArray() && other_val.isArray()) {
1214 std::set<std::string> scalars; 1214 std::set<std::string> scalars;
1215 - for (auto this_item : this_val.aitems()) { 1215 + for (auto this_item: this_val.aitems()) {
1216 if (this_item.isScalar()) { 1216 if (this_item.isScalar()) {
1217 scalars.insert(this_item.unparse()); 1217 scalars.insert(this_item.unparse());
1218 } 1218 }
1219 } 1219 }
1220 - for (auto other_item : other_val.aitems()) { 1220 + for (auto other_item: other_val.aitems()) {
1221 if (other_item.isScalar()) { 1221 if (other_item.isScalar()) {
1222 if (scalars.count(other_item.unparse()) == 0) { 1222 if (scalars.count(other_item.unparse()) == 0) {
1223 QTC::TC("qpdf", "QPDFObjectHandle merge array"); 1223 QTC::TC("qpdf", "QPDFObjectHandle merge array");
@@ -2950,7 +2950,7 @@ QPDFObjectHandle::copyStream() @@ -2950,7 +2950,7 @@ QPDFObjectHandle::copyStream()
2950 QPDFObjectHandle result = newStream(this->getOwningQPDF()); 2950 QPDFObjectHandle result = newStream(this->getOwningQPDF());
2951 QPDFObjectHandle dict = result.getDict(); 2951 QPDFObjectHandle dict = result.getDict();
2952 QPDFObjectHandle old_dict = getDict(); 2952 QPDFObjectHandle old_dict = getDict();
2953 - for (auto& iter : QPDFDictItems(old_dict)) { 2953 + for (auto& iter: QPDFDictItems(old_dict)) {
2954 if (iter.second.isIndirect()) { 2954 if (iter.second.isIndirect()) {
2955 dict.replaceKey(iter.first, iter.second); 2955 dict.replaceKey(iter.first, iter.second);
2956 } else { 2956 } else {
libqpdf/QPDFPageObjectHelper.cc
@@ -81,7 +81,7 @@ InlineImageTracker::convertIIDict(QPDFObjectHandle odict) @@ -81,7 +81,7 @@ InlineImageTracker::convertIIDict(QPDFObjectHandle odict)
81 dict.replaceKey("/Type", QPDFObjectHandle::newName("/XObject")) 81 dict.replaceKey("/Type", QPDFObjectHandle::newName("/XObject"))
82 .replaceKey("/Subtype", QPDFObjectHandle::newName("/Image")); 82 .replaceKey("/Subtype", QPDFObjectHandle::newName("/Image"));
83 std::set<std::string> keys = odict.getKeys(); 83 std::set<std::string> keys = odict.getKeys();
84 - for (auto key : keys) { 84 + for (auto key: keys) {
85 QPDFObjectHandle value = odict.getKey(key); 85 QPDFObjectHandle value = odict.getKey(key);
86 if (key == "/BPC") { 86 if (key == "/BPC") {
87 key = "/BitsPerComponent"; 87 key = "/BitsPerComponent";
@@ -142,7 +142,7 @@ InlineImageTracker::convertIIDict(QPDFObjectHandle odict) @@ -142,7 +142,7 @@ InlineImageTracker::convertIIDict(QPDFObjectHandle odict)
142 } else if (value.isArray()) { 142 } else if (value.isArray()) {
143 filters = value.getArrayAsVector(); 143 filters = value.getArrayAsVector();
144 } 144 }
145 - for (auto& iter : filters) { 145 + for (auto& iter: filters) {
146 std::string name; 146 std::string name;
147 if (iter.isName()) { 147 if (iter.isName()) {
148 name = iter.getName(); 148 name = iter.getName();
@@ -334,7 +334,7 @@ QPDFPageObjectHelper::forEachXObject( @@ -334,7 +334,7 @@ QPDFPageObjectHelper::forEachXObject(
334 QPDFObjectHandle resources = ph.getAttribute("/Resources", false); 334 QPDFObjectHandle resources = ph.getAttribute("/Resources", false);
335 if (resources.isDictionary() && resources.hasKey("/XObject")) { 335 if (resources.isDictionary() && resources.hasKey("/XObject")) {
336 QPDFObjectHandle xobj_dict = resources.getKey("/XObject"); 336 QPDFObjectHandle xobj_dict = resources.getKey("/XObject");
337 - for (auto const& key : xobj_dict.getKeys()) { 337 + for (auto const& key: xobj_dict.getKeys()) {
338 QPDFObjectHandle obj = xobj_dict.getKey(key); 338 QPDFObjectHandle obj = xobj_dict.getKey(key);
339 if ((!selector) || selector(obj)) { 339 if ((!selector) || selector(obj)) {
340 action(obj, xobj_dict, key); 340 action(obj, xobj_dict, key);
@@ -594,7 +594,7 @@ QPDFPageObjectHelper::removeUnreferencedResourcesHelper( @@ -594,7 +594,7 @@ QPDFPageObjectHelper::removeUnreferencedResourcesHelper(
594 std::set<std::string> known_names; 594 std::set<std::string> known_names;
595 std::vector<std::string> to_filter = {"/Font", "/XObject"}; 595 std::vector<std::string> to_filter = {"/Font", "/XObject"};
596 if (resources.isDictionary()) { 596 if (resources.isDictionary()) {
597 - for (auto const& iter : to_filter) { 597 + for (auto const& iter: to_filter) {
598 QPDFObjectHandle dict = resources.getKey(iter); 598 QPDFObjectHandle dict = resources.getKey(iter);
599 if (dict.isDictionary()) { 599 if (dict.isDictionary()) {
600 dict = resources.replaceKeyAndGet(iter, dict.shallowCopy()); 600 dict = resources.replaceKeyAndGet(iter, dict.shallowCopy());
@@ -607,8 +607,8 @@ QPDFPageObjectHelper::removeUnreferencedResourcesHelper( @@ -607,8 +607,8 @@ QPDFPageObjectHelper::removeUnreferencedResourcesHelper(
607 607
608 std::set<std::string> local_unresolved; 608 std::set<std::string> local_unresolved;
609 auto names_by_rtype = rf.getNamesByResourceType(); 609 auto names_by_rtype = rf.getNamesByResourceType();
610 - for (auto const& i1 : to_filter) {  
611 - for (auto const& n_iter : names_by_rtype[i1]) { 610 + for (auto const& i1: to_filter) {
  611 + for (auto const& n_iter: names_by_rtype[i1]) {
612 std::string const& name = n_iter.first; 612 std::string const& name = n_iter.first;
613 if (!known_names.count(name)) { 613 if (!known_names.count(name)) {
614 unresolved.insert(name); 614 unresolved.insert(name);
@@ -647,8 +647,8 @@ QPDFPageObjectHelper::removeUnreferencedResourcesHelper( @@ -647,8 +647,8 @@ QPDFPageObjectHelper::removeUnreferencedResourcesHelper(
647 return false; 647 return false;
648 } 648 }
649 649
650 - for (auto& dict : rdicts) {  
651 - for (auto const& key : dict.getKeys()) { 650 + for (auto& dict: rdicts) {
  651 + for (auto const& key: dict.getKeys()) {
652 if (is_page && unresolved.count(key)) { 652 if (is_page && unresolved.count(key)) {
653 // This name is referenced by some nested form 653 // This name is referenced by some nested form
654 // xobject, so don't remove it. 654 // xobject, so don't remove it.
@@ -946,7 +946,7 @@ QPDFPageObjectHelper::flattenRotation(QPDFAcroFormDocumentHelper* afdh) @@ -946,7 +946,7 @@ QPDFPageObjectHelper::flattenRotation(QPDFAcroFormDocumentHelper* afdh)
946 "/TrimBox", 946 "/TrimBox",
947 "/ArtBox", 947 "/ArtBox",
948 }; 948 };
949 - for (auto const& boxkey : boxes) { 949 + for (auto const& boxkey: boxes) {
950 auto box = this->oh.getKey(boxkey); 950 auto box = this->oh.getKey(boxkey);
951 if (!box.isRectangle()) { 951 if (!box.isRectangle()) {
952 continue; 952 continue;
@@ -1049,7 +1049,7 @@ QPDFPageObjectHelper::flattenRotation(QPDFAcroFormDocumentHelper* afdh) @@ -1049,7 +1049,7 @@ QPDFPageObjectHelper::flattenRotation(QPDFAcroFormDocumentHelper* afdh)
1049 afdh->transformAnnotations( 1049 afdh->transformAnnotations(
1050 annots, new_annots, new_fields, old_fields, cm); 1050 annots, new_annots, new_fields, old_fields, cm);
1051 afdh->removeFormFields(old_fields); 1051 afdh->removeFormFields(old_fields);
1052 - for (auto const& f : new_fields) { 1052 + for (auto const& f: new_fields) {
1053 afdh->addFormField(QPDFFormFieldObjectHelper(f)); 1053 afdh->addFormField(QPDFFormFieldObjectHelper(f));
1054 } 1054 }
1055 this->oh.replaceKey("/Annots", QPDFObjectHandle::newArray(new_annots)); 1055 this->oh.replaceKey("/Annots", QPDFObjectHandle::newArray(new_annots));
@@ -1115,7 +1115,7 @@ QPDFPageObjectHelper::copyAnnotations( @@ -1115,7 +1115,7 @@ QPDFPageObjectHelper::copyAnnotations(
1115 annots = 1115 annots =
1116 this->oh.replaceKeyAndGet("/Annots", QPDFObjectHandle::newArray()); 1116 this->oh.replaceKeyAndGet("/Annots", QPDFObjectHandle::newArray());
1117 } 1117 }
1118 - for (auto const& annot : new_annots) { 1118 + for (auto const& annot: new_annots) {
1119 annots.appendItem(annot); 1119 annots.appendItem(annot);
1120 } 1120 }
1121 } 1121 }
libqpdf/QPDFWriter.cc
@@ -2252,7 +2252,7 @@ QPDFWriter::initializeSpecialStreams() @@ -2252,7 +2252,7 @@ QPDFWriter::initializeSpecialStreams()
2252 contents_objects.push_back(contents.getObjGen()); 2252 contents_objects.push_back(contents.getObjGen());
2253 } 2253 }
2254 2254
2255 - for (auto const& c : contents_objects) { 2255 + for (auto const& c: contents_objects) {
2256 this->m->contents_to_page_seq[c] = num; 2256 this->m->contents_to_page_seq[c] = num;
2257 this->m->normalized_streams.insert(c); 2257 this->m->normalized_streams.insert(c);
2258 } 2258 }
@@ -2287,7 +2287,7 @@ QPDFWriter::preserveObjectStreams() @@ -2287,7 +2287,7 @@ QPDFWriter::preserveObjectStreams()
2287 "qpdf", 2287 "qpdf",
2288 "QPDFWriter preserve object streams", 2288 "QPDFWriter preserve object streams",
2289 this->m->preserve_unreferenced_objects ? 0 : 1); 2289 this->m->preserve_unreferenced_objects ? 0 : 1);
2290 - for (auto iter : omap) { 2290 + for (auto iter: omap) {
2291 QPDFObjGen og(iter.first, 0); 2291 QPDFObjGen og(iter.first, 0);
2292 if (eligible.count(og) || this->m->preserve_unreferenced_objects) { 2292 if (eligible.count(og) || this->m->preserve_unreferenced_objects) {
2293 this->m->object_to_object_stream[og] = iter.second; 2293 this->m->object_to_object_stream[og] = iter.second;
@@ -2380,7 +2380,7 @@ QPDFWriter::prepareFileForWrite() @@ -2380,7 +2380,7 @@ QPDFWriter::prepareFileForWrite()
2380 2380
2381 this->m->pdf.fixDanglingReferences(true); 2381 this->m->pdf.fixDanglingReferences(true);
2382 QPDFObjectHandle root = this->m->pdf.getRoot(); 2382 QPDFObjectHandle root = this->m->pdf.getRoot();
2383 - for (auto const& key : root.getKeys()) { 2383 + for (auto const& key: root.getKeys()) {
2384 QPDFObjectHandle oh = root.getKey(key); 2384 QPDFObjectHandle oh = root.getKey(key);
2385 if ((key == "/Extensions") && (oh.isDictionary())) { 2385 if ((key == "/Extensions") && (oh.isDictionary())) {
2386 bool extensions_indirect = false; 2386 bool extensions_indirect = false;
libqpdf/QPDF_Array.cc
@@ -138,7 +138,7 @@ QPDF_Array::getElementsForShallowCopy() const @@ -138,7 +138,7 @@ QPDF_Array::getElementsForShallowCopy() const
138 void 138 void
139 QPDF_Array::addExplicitElementsToList(std::list<QPDFObjectHandle>& l) const 139 QPDF_Array::addExplicitElementsToList(std::list<QPDFObjectHandle>& l) const
140 { 140 {
141 - for (auto const& iter : this->elements) { 141 + for (auto const& iter: this->elements) {
142 l.push_back(iter.second); 142 l.push_back(iter.second);
143 } 143 }
144 } 144 }
libqpdf/QPDF_Dictionary.cc
@@ -24,7 +24,7 @@ std::string @@ -24,7 +24,7 @@ std::string
24 QPDF_Dictionary::unparse() 24 QPDF_Dictionary::unparse()
25 { 25 {
26 std::string result = "<< "; 26 std::string result = "<< ";
27 - for (auto& iter : this->items) { 27 + for (auto& iter: this->items) {
28 if (!iter.second.isNull()) { 28 if (!iter.second.isNull()) {
29 result += QPDF_Name::normalizeName(iter.first) + " " + 29 result += QPDF_Name::normalizeName(iter.first) + " " +
30 iter.second.unparse() + " "; 30 iter.second.unparse() + " ";
@@ -38,7 +38,7 @@ JSON @@ -38,7 +38,7 @@ JSON
38 QPDF_Dictionary::getJSON() 38 QPDF_Dictionary::getJSON()
39 { 39 {
40 JSON j = JSON::makeDictionary(); 40 JSON j = JSON::makeDictionary();
41 - for (auto& iter : this->items) { 41 + for (auto& iter: this->items) {
42 if (!iter.second.isNull()) { 42 if (!iter.second.isNull()) {
43 j.addDictionaryMember( 43 j.addDictionaryMember(
44 QPDF_Name::normalizeName(iter.first), iter.second.getJSON()); 44 QPDF_Name::normalizeName(iter.first), iter.second.getJSON());
@@ -96,7 +96,7 @@ std::set&lt;std::string&gt; @@ -96,7 +96,7 @@ std::set&lt;std::string&gt;
96 QPDF_Dictionary::getKeys() 96 QPDF_Dictionary::getKeys()
97 { 97 {
98 std::set<std::string> result; 98 std::set<std::string> result;
99 - for (auto& iter : this->items) { 99 + for (auto& iter: this->items) {
100 if (!iter.second.isNull()) { 100 if (!iter.second.isNull()) {
101 result.insert(iter.first); 101 result.insert(iter.first);
102 } 102 }
libqpdf/QPDF_Stream.cc
@@ -34,7 +34,7 @@ namespace @@ -34,7 +34,7 @@ namespace
34 return true; 34 return true;
35 } 35 }
36 bool filterable = true; 36 bool filterable = true;
37 - for (auto const& key : decode_parms.getKeys()) { 37 + for (auto const& key: decode_parms.getKeys()) {
38 if (((key == "/Type") || (key == "/Name")) && 38 if (((key == "/Type") || (key == "/Name")) &&
39 ((!decode_parms.hasKey("/Type")) || 39 ((!decode_parms.hasKey("/Type")) ||
40 decode_parms.isDictionaryOfType( 40 decode_parms.isDictionaryOfType(
@@ -311,7 +311,7 @@ QPDF_Stream::filterable( @@ -311,7 +311,7 @@ QPDF_Stream::filterable(
311 311
312 bool filterable = true; 312 bool filterable = true;
313 313
314 - for (auto& filter_name : filter_names) { 314 + for (auto& filter_name: filter_names) {
315 if (filter_abbreviations.count(filter_name)) { 315 if (filter_abbreviations.count(filter_name)) {
316 QTC::TC("qpdf", "QPDF_Stream expand filter abbreviation"); 316 QTC::TC("qpdf", "QPDF_Stream expand filter abbreviation");
317 filter_name = filter_abbreviations[filter_name]; 317 filter_name = filter_abbreviations[filter_name];
libqpdf/SF_FlateLzwDecode.cc
@@ -27,7 +27,7 @@ SF_FlateLzwDecode::setDecodeParms(QPDFObjectHandle decode_parms) @@ -27,7 +27,7 @@ SF_FlateLzwDecode::setDecodeParms(QPDFObjectHandle decode_parms)
27 27
28 bool filterable = true; 28 bool filterable = true;
29 std::set<std::string> keys = decode_parms.getKeys(); 29 std::set<std::string> keys = decode_parms.getKeys();
30 - for (auto const& key : keys) { 30 + for (auto const& key: keys) {
31 QPDFObjectHandle value = decode_parms.getKey(key); 31 QPDFObjectHandle value = decode_parms.getKey(key);
32 if (key == "/Predictor") { 32 if (key == "/Predictor") {
33 if (value.isInteger()) { 33 if (value.isInteger()) {
libqpdf/SparseOHArray.cc
@@ -51,7 +51,7 @@ SparseOHArray::remove_last() @@ -51,7 +51,7 @@ SparseOHArray::remove_last()
51 void 51 void
52 SparseOHArray::releaseResolved() 52 SparseOHArray::releaseResolved()
53 { 53 {
54 - for (auto& iter : this->elements) { 54 + for (auto& iter: this->elements) {
55 QPDFObjectHandle::ReleaseResolver::releaseResolved(iter.second); 55 QPDFObjectHandle::ReleaseResolver::releaseResolved(iter.second);
56 } 56 }
57 } 57 }
@@ -76,7 +76,7 @@ SparseOHArray::erase(size_t idx) @@ -76,7 +76,7 @@ SparseOHArray::erase(size_t idx)
76 throw std::logic_error("bounds error erasing item from SparseOHArray"); 76 throw std::logic_error("bounds error erasing item from SparseOHArray");
77 } 77 }
78 decltype(this->elements) dest; 78 decltype(this->elements) dest;
79 - for (auto const& iter : this->elements) { 79 + for (auto const& iter: this->elements) {
80 if (iter.first < idx) { 80 if (iter.first < idx) {
81 dest.insert(iter); 81 dest.insert(iter);
82 } else if (iter.first > idx) { 82 } else if (iter.first > idx) {
@@ -97,7 +97,7 @@ SparseOHArray::insert(size_t idx, QPDFObjectHandle oh) @@ -97,7 +97,7 @@ SparseOHArray::insert(size_t idx, QPDFObjectHandle oh)
97 append(oh); 97 append(oh);
98 } else { 98 } else {
99 decltype(this->elements) dest; 99 decltype(this->elements) dest;
100 - for (auto const& iter : this->elements) { 100 + for (auto const& iter: this->elements) {
101 if (iter.first < idx) { 101 if (iter.first < idx) {
102 dest.insert(iter); 102 dest.insert(iter);
103 } else { 103 } else {
libtests/cxx11.cc
@@ -122,7 +122,7 @@ do_iteration() @@ -122,7 +122,7 @@ do_iteration()
122 std::vector<int> v = {1, 2, 3, 4}; 122 std::vector<int> v = {1, 2, 3, 4};
123 assert(v.size() == 4); 123 assert(v.size() == 4);
124 int sum = 0; 124 int sum = 0;
125 - for (auto& i : v) { 125 + for (auto& i: v) {
126 sum += i; 126 sum += i;
127 } 127 }
128 assert(10 == sum); 128 assert(10 == sum);
@@ -299,7 +299,7 @@ do_smart_pointers() @@ -299,7 +299,7 @@ do_smart_pointers()
299 auto p1 = make_c(1); 299 auto p1 = make_c(1);
300 C::check(1, 1, 1); 300 C::check(1, 1, 1);
301 auto p2 = make_c_array({2, 3, 4, 5}); 301 auto p2 = make_c_array({2, 3, 4, 5});
302 - for (auto i : {1, 2, 3, 4, 5}) { 302 + for (auto i: {1, 2, 3, 4, 5}) {
303 C::check(5, i, 1); 303 C::check(5, i, 1);
304 } 304 }
305 { 305 {
libtests/nntree.cc
@@ -61,7 +61,7 @@ test_bsearch() @@ -61,7 +61,7 @@ test_bsearch()
61 61
62 auto mk = [&q](std::vector<int> const& v) { 62 auto mk = [&q](std::vector<int> const& v) {
63 auto nums = QPDFObjectHandle::newArray(); 63 auto nums = QPDFObjectHandle::newArray();
64 - for (auto i : v) { 64 + for (auto i: v) {
65 nums.appendItem(QPDFObjectHandle::newInteger(i)) 65 nums.appendItem(QPDFObjectHandle::newInteger(i))
66 .appendItem(QPDFObjectHandle::newString( 66 .appendItem(QPDFObjectHandle::newString(
67 "-" + QUtil::int_to_string(i) + "-")); 67 "-" + QUtil::int_to_string(i) + "-"));
@@ -199,7 +199,7 @@ test_depth() @@ -199,7 +199,7 @@ test_depth()
199 199
200 QPDFNameTreeObjectHelper nh(n0, q); 200 QPDFNameTreeObjectHelper nh(n0, q);
201 std::cout << "--- forward ---" << std::endl; 201 std::cout << "--- forward ---" << std::endl;
202 - for (auto i : nh) { 202 + for (auto i: nh) {
203 std::cout << i.first << " -> " << i.second.unparse() << std::endl; 203 std::cout << i.first << " -> " << i.second.unparse() << std::endl;
204 } 204 }
205 std::cout << "--- backward ---" << std::endl; 205 std::cout << "--- backward ---" << std::endl;
qpdf/fix-qdf.cc
@@ -112,7 +112,7 @@ QdfFixer::processLines(std::list&lt;std::string&gt;&amp; lines) @@ -112,7 +112,7 @@ QdfFixer::processLines(std::list&lt;std::string&gt;&amp; lines)
112 static std::regex re_dict_end("^>>\n$"); 112 static std::regex re_dict_end("^>>\n$");
113 113
114 lineno = 0; 114 lineno = 0;
115 - for (auto const& line : lines) { 115 + for (auto const& line: lines) {
116 ++lineno; 116 ++lineno;
117 last_offset = offset; 117 last_offset = offset;
118 offset += QIntC::to_offset(line.length()); 118 offset += QIntC::to_offset(line.length());
@@ -151,7 +151,7 @@ QdfFixer::processLines(std::list&lt;std::string&gt;&amp; lines) @@ -151,7 +151,7 @@ QdfFixer::processLines(std::list&lt;std::string&gt;&amp; lines)
151 // index. Make sure we get at least 1 byte even if 151 // index. Make sure we get at least 1 byte even if
152 // there are no object streams. 152 // there are no object streams.
153 int max_objects = 1; 153 int max_objects = 1;
154 - for (auto const& e : xref) { 154 + for (auto const& e: xref) {
155 if ((e.getType() == 2) && 155 if ((e.getType() == 2) &&
156 (e.getObjStreamIndex() > max_objects)) { 156 (e.getObjStreamIndex() > max_objects)) {
157 max_objects = e.getObjStreamIndex(); 157 max_objects = e.getObjStreamIndex();
@@ -218,7 +218,7 @@ QdfFixer::processLines(std::list&lt;std::string&gt;&amp; lines) @@ -218,7 +218,7 @@ QdfFixer::processLines(std::list&lt;std::string&gt;&amp; lines)
218 writeBinary(0, 1); 218 writeBinary(0, 1);
219 writeBinary(0, xref_f1_nbytes); 219 writeBinary(0, xref_f1_nbytes);
220 writeBinary(0, xref_f2_nbytes); 220 writeBinary(0, xref_f2_nbytes);
221 - for (auto const& x : xref) { 221 + for (auto const& x: xref) {
222 unsigned long long f1 = 0; 222 unsigned long long f1 = 0;
223 unsigned long long f2 = 0; 223 unsigned long long f2 = 0;
224 unsigned int type = QIntC::to_uint(x.getType()); 224 unsigned int type = QIntC::to_uint(x.getType());
@@ -268,7 +268,7 @@ QdfFixer::processLines(std::list&lt;std::string&gt;&amp; lines) @@ -268,7 +268,7 @@ QdfFixer::processLines(std::list&lt;std::string&gt;&amp; lines)
268 } else if (state == st_at_xref) { 268 } else if (state == st_at_xref) {
269 auto n = xref.size(); 269 auto n = xref.size();
270 std::cout << "0 " << 1 + n << "\n0000000000 65535 f \n"; 270 std::cout << "0 " << 1 + n << "\n0000000000 65535 f \n";
271 - for (auto const& e : xref) { 271 + for (auto const& e: xref) {
272 std::cout << QUtil::int_to_string(e.getOffset(), 10) 272 std::cout << QUtil::int_to_string(e.getOffset(), 10)
273 << " 00000 n \n"; 273 << " 00000 n \n";
274 } 274 }
@@ -322,7 +322,7 @@ QdfFixer::writeOstream() @@ -322,7 +322,7 @@ QdfFixer::writeOstream()
322 auto onum = ostream_id; 322 auto onum = ostream_id;
323 std::string offsets; 323 std::string offsets;
324 auto n = ostream_offsets.size(); 324 auto n = ostream_offsets.size();
325 - for (auto iter : ostream_offsets) { 325 + for (auto iter: ostream_offsets) {
326 iter -= QIntC::to_offset(first); 326 iter -= QIntC::to_offset(first);
327 ++onum; 327 ++onum;
328 offsets += QUtil::int_to_string(onum) + " " + 328 offsets += QUtil::int_to_string(onum) + " " +
@@ -341,11 +341,11 @@ QdfFixer::writeOstream() @@ -341,11 +341,11 @@ QdfFixer::writeOstream()
341 dict_data += ">>\n"; 341 dict_data += ">>\n";
342 offset_adjust += QIntC::to_offset(dict_data.length()); 342 offset_adjust += QIntC::to_offset(dict_data.length());
343 std::cout << dict_data << "stream\n" << offsets; 343 std::cout << dict_data << "stream\n" << offsets;
344 - for (auto const& o : ostream) { 344 + for (auto const& o: ostream) {
345 std::cout << o; 345 std::cout << o;
346 } 346 }
347 347
348 - for (auto const& o : ostream_discarded) { 348 + for (auto const& o: ostream_discarded) {
349 offset -= QIntC::to_offset(o.length()); 349 offset -= QIntC::to_offset(o.length());
350 } 350 }
351 offset += offset_adjust; 351 offset += offset_adjust;
qpdf/test_driver.cc
@@ -235,7 +235,7 @@ test_0_1(QPDF&amp; pdf, char const* arg2) @@ -235,7 +235,7 @@ test_0_1(QPDF&amp; pdf, char const* arg2)
235 std::cout << "/QTest is an array with " << qtest.getArrayNItems() 235 std::cout << "/QTest is an array with " << qtest.getArrayNItems()
236 << " items" << std::endl; 236 << " items" << std::endl;
237 int i = 0; 237 int i = 0;
238 - for (auto& iter : qtest.aitems()) { 238 + for (auto& iter: qtest.aitems()) {
239 QTC::TC( 239 QTC::TC(
240 "qpdf", "main QTest array indirect", iter.isIndirect() ? 1 : 0); 240 "qpdf", "main QTest array indirect", iter.isIndirect() ? 1 : 0);
241 std::cout << " item " << i << " is " 241 std::cout << " item " << i << " is "
@@ -246,7 +246,7 @@ test_0_1(QPDF&amp; pdf, char const* arg2) @@ -246,7 +246,7 @@ test_0_1(QPDF&amp; pdf, char const* arg2)
246 } else if (qtest.isDictionary()) { 246 } else if (qtest.isDictionary()) {
247 QTC::TC("qpdf", "main QTest dictionary"); 247 QTC::TC("qpdf", "main QTest dictionary");
248 std::cout << "/QTest is a dictionary" << std::endl; 248 std::cout << "/QTest is a dictionary" << std::endl;
249 - for (auto& iter : qtest.ditems()) { 249 + for (auto& iter: qtest.ditems()) {
250 QTC::TC( 250 QTC::TC(
251 "qpdf", 251 "qpdf",
252 "main QTest dictionary indirect", 252 "main QTest dictionary indirect",
@@ -393,7 +393,7 @@ test_5(QPDF&amp; pdf, char const* arg2) @@ -393,7 +393,7 @@ test_5(QPDF&amp; pdf, char const* arg2)
393 393
394 std::cout << " images:" << std::endl; 394 std::cout << " images:" << std::endl;
395 std::map<std::string, QPDFObjectHandle> images = page.getImages(); 395 std::map<std::string, QPDFObjectHandle> images = page.getImages();
396 - for (auto const& iter2 : images) { 396 + for (auto const& iter2: images) {
397 std::string const& name = iter2.first; 397 std::string const& name = iter2.first;
398 QPDFObjectHandle image = iter2.second; 398 QPDFObjectHandle image = iter2.second;
399 QPDFObjectHandle dict = image.getDict(); 399 QPDFObjectHandle dict = image.getDict();
@@ -405,7 +405,7 @@ test_5(QPDF&amp; pdf, char const* arg2) @@ -405,7 +405,7 @@ test_5(QPDF&amp; pdf, char const* arg2)
405 405
406 std::cout << " content:" << std::endl; 406 std::cout << " content:" << std::endl;
407 std::vector<QPDFObjectHandle> content = page.getPageContents(); 407 std::vector<QPDFObjectHandle> content = page.getPageContents();
408 - for (auto& iter2 : content) { 408 + for (auto& iter2: content) {
409 std::cout << " " << iter2.unparse() << std::endl; 409 std::cout << " " << iter2.unparse() << std::endl;
410 } 410 }
411 411
@@ -1663,12 +1663,12 @@ test_46(QPDF&amp; pdf, char const* arg2) @@ -1663,12 +1663,12 @@ test_46(QPDF&amp; pdf, char const* arg2)
1663 // number-tree.pdf 1663 // number-tree.pdf
1664 QPDFObjectHandle qtest = pdf.getTrailer().getKey("/QTest"); 1664 QPDFObjectHandle qtest = pdf.getTrailer().getKey("/QTest");
1665 QPDFNumberTreeObjectHelper ntoh(qtest, pdf); 1665 QPDFNumberTreeObjectHelper ntoh(qtest, pdf);
1666 - for (auto& iter : ntoh) { 1666 + for (auto& iter: ntoh) {
1667 std::cout << iter.first << " " << iter.second.getStringValue() 1667 std::cout << iter.first << " " << iter.second.getStringValue()
1668 << std::endl; 1668 << std::endl;
1669 } 1669 }
1670 QPDFNumberTreeObjectHelper::idx_map ntoh_map = ntoh.getAsMap(); 1670 QPDFNumberTreeObjectHelper::idx_map ntoh_map = ntoh.getAsMap();
1671 - for (auto& iter : ntoh_map) { 1671 + for (auto& iter: ntoh_map) {
1672 std::cout << iter.first << " " << iter.second.getStringValue() 1672 std::cout << iter.first << " " << iter.second.getStringValue()
1673 << std::endl; 1673 << std::endl;
1674 } 1674 }
@@ -1724,7 +1724,7 @@ test_46(QPDF&amp; pdf, char const* arg2) @@ -1724,7 +1724,7 @@ test_46(QPDF&amp; pdf, char const* arg2)
1724 assert(iter2->first == 3); 1724 assert(iter2->first == 3);
1725 iter2.insertAfter(4, QPDFObjectHandle::newString("4!")); 1725 iter2.insertAfter(4, QPDFObjectHandle::newString("4!"));
1726 assert(iter2->first == 4); 1726 assert(iter2->first == 4);
1727 - for (auto& i : new2) { 1727 + for (auto& i: new2) {
1728 std::cout << i.first << " " << i.second.unparse() << std::endl; 1728 std::cout << i.first << " " << i.second.unparse() << std::endl;
1729 } 1729 }
1730 1730
@@ -1737,12 +1737,12 @@ test_46(QPDF&amp; pdf, char const* arg2) @@ -1737,12 +1737,12 @@ test_46(QPDF&amp; pdf, char const* arg2)
1737 std::cout << "/Bad2" << std::endl; 1737 std::cout << "/Bad2" << std::endl;
1738 auto bad2 = 1738 auto bad2 =
1739 QPDFNumberTreeObjectHelper(pdf.getTrailer().getKey("/Bad2"), pdf); 1739 QPDFNumberTreeObjectHelper(pdf.getTrailer().getKey("/Bad2"), pdf);
1740 - for (auto& i : bad2) { 1740 + for (auto& i: bad2) {
1741 std::cout << i.first << " " << i.second.unparse() << std::endl; 1741 std::cout << i.first << " " << i.second.unparse() << std::endl;
1742 } 1742 }
1743 1743
1744 std::vector<std::string> empties = {"/Empty1", "/Empty2"}; 1744 std::vector<std::string> empties = {"/Empty1", "/Empty2"};
1745 - for (auto const& k : empties) { 1745 + for (auto const& k: empties) {
1746 std::cout << k << std::endl; 1746 std::cout << k << std::endl;
1747 auto empty = 1747 auto empty =
1748 QPDFNumberTreeObjectHelper(pdf.getTrailer().getKey(k), pdf); 1748 QPDFNumberTreeObjectHelper(pdf.getTrailer().getKey(k), pdf);
@@ -1777,14 +1777,14 @@ test_46(QPDF&amp; pdf, char const* arg2) @@ -1777,14 +1777,14 @@ test_46(QPDF&amp; pdf, char const* arg2)
1777 std::cout << "/Bad3, no repair" << std::endl; 1777 std::cout << "/Bad3, no repair" << std::endl;
1778 auto bad3_oh = pdf.getTrailer().getKey("/Bad3"); 1778 auto bad3_oh = pdf.getTrailer().getKey("/Bad3");
1779 auto bad3 = QPDFNumberTreeObjectHelper(bad3_oh, pdf, false); 1779 auto bad3 = QPDFNumberTreeObjectHelper(bad3_oh, pdf, false);
1780 - for (auto& i : bad3) { 1780 + for (auto& i: bad3) {
1781 std::cout << i.first << " " << i.second.unparse() << std::endl; 1781 std::cout << i.first << " " << i.second.unparse() << std::endl;
1782 } 1782 }
1783 assert(!bad3_oh.getKey("/Kids").getArrayItem(0).isIndirect()); 1783 assert(!bad3_oh.getKey("/Kids").getArrayItem(0).isIndirect());
1784 1784
1785 std::cout << "/Bad3, repair" << std::endl; 1785 std::cout << "/Bad3, repair" << std::endl;
1786 bad3 = QPDFNumberTreeObjectHelper(bad3_oh, pdf, true); 1786 bad3 = QPDFNumberTreeObjectHelper(bad3_oh, pdf, true);
1787 - for (auto& i : bad3) { 1787 + for (auto& i: bad3) {
1788 std::cout << i.first << " " << i.second.unparse() << std::endl; 1788 std::cout << i.first << " " << i.second.unparse() << std::endl;
1789 } 1789 }
1790 assert(bad3_oh.getKey("/Kids").getArrayItem(0).isIndirect()); 1790 assert(bad3_oh.getKey("/Kids").getArrayItem(0).isIndirect());
@@ -1793,7 +1793,7 @@ test_46(QPDF&amp; pdf, char const* arg2) @@ -1793,7 +1793,7 @@ test_46(QPDF&amp; pdf, char const* arg2)
1793 auto bad4 = 1793 auto bad4 =
1794 QPDFNumberTreeObjectHelper(pdf.getTrailer().getKey("/Bad4"), pdf); 1794 QPDFNumberTreeObjectHelper(pdf.getTrailer().getKey("/Bad4"), pdf);
1795 bad4.insert(5, QPDFObjectHandle::newString("5")); 1795 bad4.insert(5, QPDFObjectHandle::newString("5"));
1796 - for (auto& i : bad4) { 1796 + for (auto& i: bad4) {
1797 std::cout << i.first << " " << i.second.unparse() << std::endl; 1797 std::cout << i.first << " " << i.second.unparse() << std::endl;
1798 } 1798 }
1799 1799
@@ -1826,12 +1826,12 @@ test_48(QPDF&amp; pdf, char const* arg2) @@ -1826,12 +1826,12 @@ test_48(QPDF&amp; pdf, char const* arg2)
1826 // name-tree.pdf 1826 // name-tree.pdf
1827 QPDFObjectHandle qtest = pdf.getTrailer().getKey("/QTest"); 1827 QPDFObjectHandle qtest = pdf.getTrailer().getKey("/QTest");
1828 QPDFNameTreeObjectHelper ntoh(qtest, pdf); 1828 QPDFNameTreeObjectHelper ntoh(qtest, pdf);
1829 - for (auto& iter : ntoh) { 1829 + for (auto& iter: ntoh) {
1830 std::cout << iter.first << " -> " << iter.second.getStringValue() 1830 std::cout << iter.first << " -> " << iter.second.getStringValue()
1831 << std::endl; 1831 << std::endl;
1832 } 1832 }
1833 std::map<std::string, QPDFObjectHandle> ntoh_map = ntoh.getAsMap(); 1833 std::map<std::string, QPDFObjectHandle> ntoh_map = ntoh.getAsMap();
1834 - for (auto& iter : ntoh_map) { 1834 + for (auto& iter: ntoh_map) {
1835 std::cout << iter.first << " -> " << iter.second.getStringValue() 1835 std::cout << iter.first << " -> " << iter.second.getStringValue()
1836 << std::endl; 1836 << std::endl;
1837 } 1837 }
@@ -1884,12 +1884,12 @@ test_48(QPDF&amp; pdf, char const* arg2) @@ -1884,12 +1884,12 @@ test_48(QPDF&amp; pdf, char const* arg2)
1884 assert(iter2->first == "3"); 1884 assert(iter2->first == "3");
1885 iter2.insertAfter("4", QPDFObjectHandle::newString("4!")); 1885 iter2.insertAfter("4", QPDFObjectHandle::newString("4!"));
1886 assert(iter2->first == "4"); 1886 assert(iter2->first == "4");
1887 - for (auto& i : new2) { 1887 + for (auto& i: new2) {
1888 std::cout << i.first << " " << i.second.unparse() << std::endl; 1888 std::cout << i.first << " " << i.second.unparse() << std::endl;
1889 } 1889 }
1890 1890
1891 std::vector<std::string> empties = {"/Empty1", "/Empty2"}; 1891 std::vector<std::string> empties = {"/Empty1", "/Empty2"};
1892 - for (auto const& k : empties) { 1892 + for (auto const& k: empties) {
1893 std::cout << k << std::endl; 1893 std::cout << k << std::endl;
1894 auto empty = QPDFNameTreeObjectHelper(pdf.getTrailer().getKey(k), pdf); 1894 auto empty = QPDFNameTreeObjectHelper(pdf.getTrailer().getKey(k), pdf);
1895 assert(empty.begin() == empty.end()); 1895 assert(empty.begin() == empty.end());
@@ -1915,14 +1915,14 @@ test_48(QPDF&amp; pdf, char const* arg2) @@ -1915,14 +1915,14 @@ test_48(QPDF&amp; pdf, char const* arg2)
1915 std::cout << "/Bad1 -- wrong key type" << std::endl; 1915 std::cout << "/Bad1 -- wrong key type" << std::endl;
1916 auto bad1 = QPDFNameTreeObjectHelper(pdf.getTrailer().getKey("/Bad1"), pdf); 1916 auto bad1 = QPDFNameTreeObjectHelper(pdf.getTrailer().getKey("/Bad1"), pdf);
1917 assert(bad1.find("G", true)->first == "A"); 1917 assert(bad1.find("G", true)->first == "A");
1918 - for (auto const& i : bad1) { 1918 + for (auto const& i: bad1) {
1919 std::cout << i.first << std::endl; 1919 std::cout << i.first << std::endl;
1920 } 1920 }
1921 1921
1922 std::cout << "/Bad2 -- invalid kid" << std::endl; 1922 std::cout << "/Bad2 -- invalid kid" << std::endl;
1923 auto bad2 = QPDFNameTreeObjectHelper(pdf.getTrailer().getKey("/Bad2"), pdf); 1923 auto bad2 = QPDFNameTreeObjectHelper(pdf.getTrailer().getKey("/Bad2"), pdf);
1924 assert(bad2.find("G", true)->first == "B"); 1924 assert(bad2.find("G", true)->first == "B");
1925 - for (auto const& i : bad2) { 1925 + for (auto const& i: bad2) {
1926 std::cout << i.first << std::endl; 1926 std::cout << i.first << std::endl;
1927 } 1927 }
1928 1928
@@ -1933,7 +1933,7 @@ test_48(QPDF&amp; pdf, char const* arg2) @@ -1933,7 +1933,7 @@ test_48(QPDF&amp; pdf, char const* arg2)
1933 std::cout << "/Bad4 -- invalid kid" << std::endl; 1933 std::cout << "/Bad4 -- invalid kid" << std::endl;
1934 auto bad4 = QPDFNameTreeObjectHelper(pdf.getTrailer().getKey("/Bad4"), pdf); 1934 auto bad4 = QPDFNameTreeObjectHelper(pdf.getTrailer().getKey("/Bad4"), pdf);
1935 assert(bad4.find("F", true)->first == "C"); 1935 assert(bad4.find("F", true)->first == "C");
1936 - for (auto const& i : bad4) { 1936 + for (auto const& i: bad4) {
1937 std::cout << i.first << std::endl; 1937 std::cout << i.first << std::endl;
1938 } 1938 }
1939 1939
@@ -2230,9 +2230,9 @@ test_60(QPDF&amp; pdf, char const* arg2) @@ -2230,9 +2230,9 @@ test_60(QPDF&amp; pdf, char const* arg2)
2230 std::map<std::string, std::map<std::string, std::string>> conflicts; 2230 std::map<std::string, std::map<std::string, std::string>> conflicts;
2231 auto show_conflicts = [&](std::string const& msg) { 2231 auto show_conflicts = [&](std::string const& msg) {
2232 std::cout << msg << std::endl; 2232 std::cout << msg << std::endl;
2233 - for (auto const& i1 : conflicts) { 2233 + for (auto const& i1: conflicts) {
2234 std::cout << i1.first << ":" << std::endl; 2234 std::cout << i1.first << ":" << std::endl;
2235 - for (auto const& i2 : i1.second) { 2235 + for (auto const& i2: i1.second) {
2236 std::cout << " " << i2.first << " -> " << i2.second 2236 std::cout << " " << i2.first << " -> " << i2.second
2237 << std::endl; 2237 << std::endl;
2238 } 2238 }
@@ -2510,19 +2510,19 @@ test_71(QPDF&amp; pdf, char const* arg2) @@ -2510,19 +2510,19 @@ test_71(QPDF&amp; pdf, char const* arg2)
2510 std::cout << "--- non-recursive, all, from fx1 ---" << std::endl; 2510 std::cout << "--- non-recursive, all, from fx1 ---" << std::endl;
2511 fx1.forEachXObject(false, show); 2511 fx1.forEachXObject(false, show);
2512 std::cout << "--- get images, page ---" << std::endl; 2512 std::cout << "--- get images, page ---" << std::endl;
2513 - for (auto& i : page.getImages()) { 2513 + for (auto& i: page.getImages()) {
2514 std::cout << i.first << " -> " << i.second.unparse() << std::endl; 2514 std::cout << i.first << " -> " << i.second.unparse() << std::endl;
2515 } 2515 }
2516 std::cout << "--- get images, fx ---" << std::endl; 2516 std::cout << "--- get images, fx ---" << std::endl;
2517 - for (auto& i : fx1.getImages()) { 2517 + for (auto& i: fx1.getImages()) {
2518 std::cout << i.first << " -> " << i.second.unparse() << std::endl; 2518 std::cout << i.first << " -> " << i.second.unparse() << std::endl;
2519 } 2519 }
2520 std::cout << "--- get form XObjects, page ---" << std::endl; 2520 std::cout << "--- get form XObjects, page ---" << std::endl;
2521 - for (auto& i : page.getFormXObjects()) { 2521 + for (auto& i: page.getFormXObjects()) {
2522 std::cout << i.first << " -> " << i.second.unparse() << std::endl; 2522 std::cout << i.first << " -> " << i.second.unparse() << std::endl;
2523 } 2523 }
2524 std::cout << "--- get form XObjects, fx ---" << std::endl; 2524 std::cout << "--- get form XObjects, fx ---" << std::endl;
2525 - for (auto& i : fx1.getFormXObjects()) { 2525 + for (auto& i: fx1.getFormXObjects()) {
2526 std::cout << i.first << " -> " << i.second.unparse() << std::endl; 2526 std::cout << i.first << " -> " << i.second.unparse() << std::endl;
2527 } 2527 }
2528 } 2528 }
@@ -2591,7 +2591,7 @@ test_74(QPDF&amp; pdf, char const* arg2) @@ -2591,7 +2591,7 @@ test_74(QPDF&amp; pdf, char const* arg2)
2591 check_split1(15); 2591 check_split1(15);
2592 check_split1(35); 2592 check_split1(35);
2593 check_split1(125); 2593 check_split1(125);
2594 - for (auto const& i : split1) { 2594 + for (auto const& i: split1) {
2595 std::cout << i.first << std::endl; 2595 std::cout << i.first << std::endl;
2596 } 2596 }
2597 2597
@@ -2605,7 +2605,7 @@ test_74(QPDF&amp; pdf, char const* arg2) @@ -2605,7 +2605,7 @@ test_74(QPDF&amp; pdf, char const* arg2)
2605 assert(i->first == k); 2605 assert(i->first == k);
2606 }; 2606 };
2607 check_split2(split2, "C"); 2607 check_split2(split2, "C");
2608 - for (auto const& i : split2) { 2608 + for (auto const& i: split2) {
2609 std::cout << i.first << std::endl; 2609 std::cout << i.first << std::endl;
2610 } 2610 }
2611 2611
@@ -2615,7 +2615,7 @@ test_74(QPDF&amp; pdf, char const* arg2) @@ -2615,7 +2615,7 @@ test_74(QPDF&amp; pdf, char const* arg2)
2615 split3.setSplitThreshold(4); 2615 split3.setSplitThreshold(4);
2616 check_split2(split3, "P"); 2616 check_split2(split3, "P");
2617 check_split2(split3, "\xcf\x80"); 2617 check_split2(split3, "\xcf\x80");
2618 - for (auto& i : split3) { 2618 + for (auto& i: split3) {
2619 std::cout << i.first << " " << i.second.unparse() << std::endl; 2619 std::cout << i.first << " " << i.second.unparse() << std::endl;
2620 } 2620 }
2621 2621
@@ -2722,7 +2722,7 @@ test_76(QPDF&amp; pdf, char const* arg2) @@ -2722,7 +2722,7 @@ test_76(QPDF&amp; pdf, char const* arg2)
2722 QUtil::hex_encode(efs2.getChecksum()) == 2722 QUtil::hex_encode(efs2.getChecksum()) ==
2723 "2fce9c8228e360ba9b04a1bd1bf63d6b"); 2723 "2fce9c8228e360ba9b04a1bd1bf63d6b");
2724 2724
2725 - for (auto iter : efdh.getEmbeddedFiles()) { 2725 + for (auto iter: efdh.getEmbeddedFiles()) {
2726 std::cout << iter.first << " -> " << iter.second->getFilename() 2726 std::cout << iter.first << " -> " << iter.second->getFilename()
2727 << std::endl; 2727 << std::endl;
2728 } 2728 }
@@ -2831,7 +2831,7 @@ test_79(QPDF&amp; pdf, char const* arg2) @@ -2831,7 +2831,7 @@ test_79(QPDF&amp; pdf, char const* arg2)
2831 "/Originals", QPDFObjectHandle::newArray(streams)); 2831 "/Originals", QPDFObjectHandle::newArray(streams));
2832 2832
2833 int i = 0; 2833 int i = 0;
2834 - for (auto orig : streams) { 2834 + for (auto orig: streams) {
2835 ++i; 2835 ++i;
2836 auto istr = QUtil::int_to_string(i); 2836 auto istr = QUtil::int_to_string(i);
2837 auto orig_data = orig.getStreamData(); 2837 auto orig_data = orig.getStreamData();
@@ -2879,7 +2879,7 @@ test_80(QPDF&amp; pdf, char const* arg2) @@ -2879,7 +2879,7 @@ test_80(QPDF&amp; pdf, char const* arg2)
2879 // Use defaults for from_qpdf and from_afdh. 2879 // Use defaults for from_qpdf and from_afdh.
2880 afdh.transformAnnotations( 2880 afdh.transformAnnotations(
2881 old_annots, new_annots, new_fields, old_fields, m); 2881 old_annots, new_annots, new_fields, old_fields, m);
2882 - for (auto const& annot : new_annots) { 2882 + for (auto const& annot: new_annots) {
2883 old_annots.appendItem(annot); 2883 old_annots.appendItem(annot);
2884 } 2884 }
2885 afdh.addAndRenameFormFields(new_fields); 2885 afdh.addAndRenameFormFields(new_fields);