]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Coverity fixes: auto_causes_copy and sprinkle const as well 11986/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 21 Sep 2022 07:52:55 +0000 (09:52 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 21 Sep 2022 07:52:55 +0000 (09:52 +0200)
Coverity 14912751491274149127214912711491270149126914912641491263

pdns/dnswriter.cc
pdns/rec_channel_rec.cc
pdns/recursordist/rec-zonetocache.cc
pdns/ws-recursor.cc

index 0fd81b4d3d0b776953f3645683ef27a6534ebfff..ed239c80b162770876d957b4acaa1acf33110f70 100644 (file)
@@ -432,7 +432,7 @@ template <typename Container> void GenericDNSPacketWriter<Container>::xfrSvcPara
       break;
     case SvcParam::ipv4hint:
       xfr16BitInt(param.getIPHints().size() * 4); // size
-      for (auto a: param.getIPHints()) {
+      for (const auto& a: param.getIPHints()) {
         xfrCAWithoutPort(param.getKey(), a);
       }
       break;
index aa8449a7d3424db79978a7b980e27653d925c2a0..37dcc1e2b16ca2994c2292364433926059250ec6 100644 (file)
@@ -500,7 +500,7 @@ static string doWipeCache(T begin, T end, uint16_t qtype)
   }
 
   int count = 0, pcount = 0, countNeg = 0;
-  for (auto wipe : toWipe) {
+  for (const auto& wipe : toWipe) {
     try {
       auto res = wipeCaches(wipe.first, wipe.second, qtype);
       count += res.record_count;
@@ -697,7 +697,7 @@ static string getNTAs()
 
   string ret("Configured Negative Trust Anchors:\n");
   auto luaconf = g_luaconfs.getLocal();
-  for (auto negAnchor : luaconf->negAnchors)
+  for (const auto& negAnchor : luaconf->negAnchors)
     ret += negAnchor.first.toLogString() + "\t" + negAnchor.second + "\n";
   return ret;
 }
@@ -803,9 +803,9 @@ static string getTAs()
 
   string ret("Configured Trust Anchors:\n");
   auto luaconf = g_luaconfs.getLocal();
-  for (auto anchor : luaconf->dsAnchors) {
+  for (const auto& anchor : luaconf->dsAnchors) {
     ret += anchor.first.toLogString() + "\n";
-    for (auto e : anchor.second) {
+    for (const auto& e : anchor.second) {
       ret += "\t\t" + e.getZoneRepresentation() + "\n";
     }
   }
index 07374eef55b5be4c36bbbb773c5be07c88b1c400..a83dc43da87a2c85b7a5eba611c21f86d617f5b3 100644 (file)
@@ -430,7 +430,7 @@ void RecZoneToCache::maintainStates(const map<DNSName, Config>& configs, map<DNS
     }
   }
   // Reset states for which the config generation changed and create new states for new configs
-  for (auto config : configs) {
+  for (const auto& config : configs) {
     auto state = states.find(config.first);
     if (state != states.end()) {
       if (state->second.d_generation != mygeneration) {
index e34ffc228f5baa6ad5dbbcd266cf4a74ca2a5071..a1b0c57cad8a86e25347c86c765259844dfed128 100644 (file)
@@ -90,7 +90,7 @@ static void apiServerConfigACL(const std::string& aclType, HttpRequest* req, Htt
     }
 
     NetmaskGroup nmg;
-    for (auto value : jlist.array_items()) {
+    for (const auto& value : jlist.array_items()) {
       try {
         nmg.addMask(value.string_value());
       }
@@ -225,7 +225,7 @@ static void doCreateZone(const Json document)
   }
   else if (kind == "FORWARDED") {
     string serverlist;
-    for (auto value : document["servers"].array_items()) {
+    for (const auto& value : document["servers"].array_items()) {
       string server = value.string_value();
       if (server == "") {
         throw ApiException("Forwarded-to server must not be an empty string");