]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix warnings with llvm10 and -Wrange-loop-construct
authorkrionbsd <krion@FreeBSD.org>
Sun, 5 Apr 2020 21:04:53 +0000 (23:04 +0200)
committerkrionbsd <krion@FreeBSD.org>
Sun, 5 Apr 2020 21:04:53 +0000 (23:04 +0200)
pdns/dnssecinfra.cc
pdns/filterpo.hh
pdns/pdns_recursor.cc
pdns/recursor_cache.cc
pdns/reczones.cc
pdns/syncres.cc
pdns/validate.cc

index 426bf596a03460896d96a2c8fc1f53f830946ff0..4a260f219402edf5668b03821cafa3c3195b3b73 100644 (file)
@@ -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")
index b42e47ea9699f0dcb6fbef48a043239ba765831d..54bdda9c6ee549333ef02c8ef939856b5e90dcee 100644 (file)
@@ -301,7 +301,7 @@ public:
   }
   const std::shared_ptr<Zone> 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;
index bfaf00ba43a7476b8caabd5c843811e22fed27d7..722631a00b737c6cf5b7908c9e526864ca5f8567 100644 (file)
@@ -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<<", ";
         }
index 37393efedb6e96c357a2bf206d8273668b97999a..7c813317be54d90cbed87cebca498bab4293882a 100644 (file)
@@ -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<time_t>(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<SequencedTag>();
 
     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<int64_t>(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());
index fd64f6aee406ac13a35278190ed96a857b8f71d3..c7f48b206afe0dc59158379941dcf3de13c549d7 100644 (file)
@@ -338,7 +338,7 @@ string reloadAuthAndForwards()
       }
     }
 
-    for(const auto i : oldAndNewDomains) {
+    for(const auto& i : oldAndNewDomains) {
       broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeCache, i, true, 0xffff));
       broadcastAccFunction<uint64_t>(boost::bind(pleaseWipePacketCache, i, true, 0xffff));
       broadcastAccFunction<uint64_t>(boost::bind(pleaseWipeAndCountNegCache, i, true));
index 2d8e791b8e267e2ca46961b46c9baecac88cd6a0..93f97d38217bc075bec418f2769f5263b3f17b7e 100644 (file)
@@ -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];
index b8ce53a8d277bb1ad4858939a56bec34ba8b627a..80166516895d008ff28ca33b66d81e89cc9733a1 100644 (file)
@@ -693,7 +693,7 @@ static const vector<DNSName> 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<std::shared_ptr<RRSIGRecordContent> >& signatures)
 {
-  for (const auto sig : signatures) {
+  for (const auto& sig : signatures) {
     if (sig) {
       return sig->d_signer;
     }