diff --git a/libqpdf/SparseOHArray.cc b/libqpdf/SparseOHArray.cc index c8aaefa8..972376b1 100644 --- a/libqpdf/SparseOHArray.cc +++ b/libqpdf/SparseOHArray.cc @@ -57,7 +57,7 @@ SparseOHArray::remove_last() void SparseOHArray::releaseResolved() { - for (auto iter: this->elements) + for (auto& iter: this->elements) { QPDFObjectHandle::ReleaseResolver::releaseResolved(iter.second); } diff --git a/libtests/cxx11.cc b/libtests/cxx11.cc index 91ed7b15..ba4525ed 100644 --- a/libtests/cxx11.cc +++ b/libtests/cxx11.cc @@ -105,7 +105,7 @@ void do_iteration() std::vector v = { 1, 2, 3, 4 }; assert(v.size() == 4); int sum = 0; - for (auto i: v) + for (auto& i: v) { sum += i; } diff --git a/qpdf/fix-qdf.cc b/qpdf/fix-qdf.cc index c50f7b5a..c83b495a 100644 --- a/qpdf/fix-qdf.cc +++ b/qpdf/fix-qdf.cc @@ -110,7 +110,7 @@ QdfFixer::processLines(std::list& lines) static std::regex re_dict_end("^>>\n$"); lineno = 0; - for (auto line: lines) + for (auto const& line: lines) { ++lineno; last_offset = offset; @@ -163,7 +163,7 @@ QdfFixer::processLines(std::list& lines) // index. Make sure we get at least 1 byte even if // there are no object streams. int max_objects = 1; - for (auto e: xref) + for (auto const& e: xref) { if ((e.getType() == 2) && (e.getObjStreamIndex() > max_objects)) @@ -258,7 +258,7 @@ QdfFixer::processLines(std::list& lines) writeBinary(0, 1); writeBinary(0, xref_f1_nbytes); writeBinary(0, xref_f2_nbytes); - for (auto x: xref) + for (auto const& x: xref) { unsigned long long f1 = 0; unsigned long long f2 = 0; @@ -321,7 +321,7 @@ QdfFixer::processLines(std::list& lines) { auto n = xref.size(); std::cout << "0 " << 1 + n << "\n0000000000 65535 f \n"; - for (auto e: xref) + for (auto const& e: xref) { std::cout << QUtil::int_to_string(e.getOffset(), 10) << " 00000 n \n"; @@ -410,12 +410,12 @@ QdfFixer::writeOstream() std::cout << dict_data << "stream\n" << offsets; - for (auto o: ostream) + for (auto const& o: ostream) { std::cout << o; } - for (auto o: ostream_discarded) + for (auto const& o: ostream_discarded) { offset -= QIntC::to_offset(o.length()); } diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc index 35267e85..02a95c73 100644 --- a/qpdf/qpdf.cc +++ b/qpdf/qpdf.cc @@ -3693,7 +3693,7 @@ static void do_json_objectinfo(QPDF& pdf, Options& o, JSON& j) std::set wanted_og = get_wanted_json_objects(o); JSON j_objectinfo = j.addDictionaryMember( "objectinfo", JSON::makeDictionary()); - for (auto obj: pdf.getAllObjects()) + for (auto& obj: pdf.getAllObjects()) { if (all_objects || wanted_og.count(obj.getObjGen())) { @@ -4922,7 +4922,7 @@ static bool should_remove_unreferenced_resources(QPDF& pdf, Options& o) } if (xobject.isDictionary()) { - for (auto k: xobject.getKeys()) + for (auto const& k: xobject.getKeys()) { QPDFObjectHandle xobj = xobject.getKey(k); if (xobj.isStream() &&