From: krionbsd Date: Sun, 5 Apr 2020 21:04:53 +0000 (+0200) Subject: Fix warnings with llvm10 and -Wrange-loop-construct X-Git-Tag: dnsdist-1.5.0-rc1~11^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7af99dff85116fa370a6bb6023327f8bd0dfbb45;p=thirdparty%2Fpdns.git Fix warnings with llvm10 and -Wrange-loop-construct --- diff --git a/pdns/dnssecinfra.cc b/pdns/dnssecinfra.cc index 426bf596a0..4a260f2194 100644 --- a/pdns/dnssecinfra.cc +++ b/pdns/dnssecinfra.cc @@ -137,7 +137,7 @@ std::string DNSCryptoKeyEngine::convertToISC() const storvector_t stormap = this->convertToISCVector(); ostringstream ret; ret<<"Private-key-format: v1.2\n"; - for(const stormap_t::value_type& value : stormap) { + for(const storvector_t::value_type& value : stormap) { if(value.first != "Algorithm" && value.first != "PIN" && value.first != "Slot" && value.first != "Engine" && value.first != "Label" && value.first != "PubLabel") diff --git a/pdns/filterpo.hh b/pdns/filterpo.hh index b42e47ea96..54bdda9c6e 100644 --- a/pdns/filterpo.hh +++ b/pdns/filterpo.hh @@ -301,7 +301,7 @@ public: } const std::shared_ptr getZone(const std::string& name) const { - for (const auto zone : d_zones) { + for (const auto& zone : d_zones) { const auto& zName = zone->getName(); if (zName == name) { return zone; diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index bfaf00ba43..722631a00b 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -4643,13 +4643,13 @@ try if (threadInfo.isListener) { if (g_reusePort) { /* then every listener has its own FDs */ - for(const auto deferred : threadInfo.deferredAdds) { + for(const auto& deferred : threadInfo.deferredAdds) { t_fdm->addReadFD(deferred.first, deferred.second); } } else { /* otherwise all listeners are listening on the same ones */ - for(const auto deferred : g_deferredAdds) { + for(const auto& deferred : g_deferredAdds) { t_fdm->addReadFD(deferred.first, deferred.second); } } @@ -4977,7 +4977,7 @@ int main(int argc, char **argv) } cerr<<" ("; bool first = true; - for (auto const c : ::arg().getCommands()) { + for (const auto& c : ::arg().getCommands()) { if (!first) { cerr<<", "; } diff --git a/pdns/recursor_cache.cc b/pdns/recursor_cache.cc index 37393efedb..7c813317be 100644 --- a/pdns/recursor_cache.cc +++ b/pdns/recursor_cache.cc @@ -353,7 +353,7 @@ void MemRecursorCache::replace(time_t now, const DNSName &qname, const QType& qt ce.d_records.clear(); ce.d_records.reserve(content.size()); - for(const auto i : content) { + for(const auto& i : content) { /* Yes, we have altered the d_ttl value by adding time(nullptr) to it prior to calling this function, so the TTL actually holds a TTD. */ ce.d_ttd=min(maxTTD, static_cast(i.d_ttl)); // XXX this does weird things if TTLs differ in the set @@ -511,8 +511,8 @@ uint64_t MemRecursorCache::doDump(int fd) const auto& sidx = map.d_map.get(); time_t now = time(0); - for (const auto i : sidx) { - for (const auto j : i.d_records) { + for (const auto& i : sidx) { + for (const auto& j : i.d_records) { count++; try { fprintf(fp.get(), "%s %" PRId64 " IN %s %s ; (%s) auth=%i %s\n", i.d_qname.toString().c_str(), static_cast(i.d_ttd - now), DNSRecordContent::NumberToType(i.d_qtype).c_str(), j->getZoneRepresentation().c_str(), vStates[i.d_state], i.d_auth, i.d_netmask.empty() ? "" : i.d_netmask.toString().c_str()); diff --git a/pdns/reczones.cc b/pdns/reczones.cc index fd64f6aee4..c7f48b206a 100644 --- a/pdns/reczones.cc +++ b/pdns/reczones.cc @@ -338,7 +338,7 @@ string reloadAuthAndForwards() } } - for(const auto i : oldAndNewDomains) { + for(const auto& i : oldAndNewDomains) { broadcastAccFunction(boost::bind(pleaseWipeCache, i, true, 0xffff)); broadcastAccFunction(boost::bind(pleaseWipePacketCache, i, true, 0xffff)); broadcastAccFunction(boost::bind(pleaseWipeAndCountNegCache, i, true)); diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 2d8e791b8e..93f97d3821 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -479,7 +479,7 @@ uint64_t SyncRes::doDumpThrottleMap(int fd) uint64_t count=0; const auto& throttleMap = t_sstorage.throttle.getThrottleMap(); - for(const auto i : throttleMap) + for(const auto& i : throttleMap) { count++; char tmp[26]; diff --git a/pdns/validate.cc b/pdns/validate.cc index b8ce53a8d2..8016651689 100644 --- a/pdns/validate.cc +++ b/pdns/validate.cc @@ -693,7 +693,7 @@ static const vector getZoneCuts(const DNSName& begin, const DNSName& en qname.prependRawLabel(labelsToAdd.back()); labelsToAdd.pop_back(); auto records = dro.get(qname, (uint16_t)QType::NS); - for (const auto record : records) { + for (const auto& record : records) { if(record.d_type != QType::NS || record.d_name != qname) continue; foundCut = true; @@ -1090,7 +1090,7 @@ bool isSupportedDS(const DSRecordContent& ds) DNSName getSigner(const std::vector >& signatures) { - for (const auto sig : signatures) { + for (const auto& sig : signatures) { if (sig) { return sig->d_signer; }