]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: Fix 'loop variable [...] creates a copy' warnings
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 30 Apr 2020 08:30:22 +0000 (10:30 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 30 Apr 2020 08:30:22 +0000 (10:30 +0200)
Reported by clang++ 10.

pdns/dnsbackend.cc
pdns/pdnsutil.cc
pdns/receiver.cc
pdns/slavecommunicator.cc
pdns/test-signers.cc
pdns/ws-auth.cc

index 07fe9c6d42f4f443486437957658856395374334..5869df3be1ba45cb28a570e5b4c8de8df64646e2 100644 (file)
@@ -139,7 +139,7 @@ void BackendMakerClass::launch(const string &instr)
   vector<string> parts;
   stringtok(parts,instr,", ");
 
-  for (const auto part : parts)
+  for (const auto& part : parts)
     if (count(parts.begin(), parts.end(), part) > 1)
       throw ArgException("Refusing to launch multiple backends with the same name '" + part + "', verify all 'launch' statements in your configuration");
 
index 406f5b074df398429ba1febd1e9ea984af8d29ac..fd5bcccfe91e13065d3e3e6284bf17e3b7bd0be4 100644 (file)
@@ -782,7 +782,7 @@ static int listKeys(const string &zname, DNSSECKeeper& dk){
     vector<DomainInfo> domainInfo;
     B.getAllDomains(&domainInfo);
     bool printHeader = true;
-    for (auto const di : domainInfo) {
+    for (const auto& di : domainInfo) {
       listKey(di, dk, printHeader);
       printHeader = false;
     }
@@ -1595,7 +1595,7 @@ static bool showZone(DNSSECKeeper& dk, const DNSName& zone, bool exportDS = fals
       cout<<endl;
 
       for(const auto& m : metamap) {
-        for(const auto i : m.second)
+        for(const auto& i : m.second)
           cout << '\t' << m.first<<'\t' << i <<endl;
       }
     }
@@ -2133,7 +2133,7 @@ try
     cout<<"DNSKEY algorithms supported by this installation of PowerDNS:"<<endl;
 
     auto algosWithBackend = DNSCryptoKeyEngine::listAllAlgosWithBackend();
-    for (auto const algoWithBackend : algosWithBackend){
+    for (const auto& algoWithBackend : algosWithBackend){
       string algoName = DNSSECKeeper::algorithm2name(algoWithBackend.first);
       cout<<std::to_string(algoWithBackend.first)<<" - "<<algoName;
       if (cmds.size() == 2 && cmds[1] == "with-backend")
@@ -3089,7 +3089,7 @@ try
     if (cmds.size() > 2) {
       keys.assign(cmds.begin() + 2, cmds.end());
       std::cout << "Metadata for '" << zone << "'" << endl;
-      for(const string kind :  keys) {
+      for(const auto& kind :  keys) {
         vector<string> meta;
         meta.clear();
         if (B.getDomainMetadata(zone, kind, meta)) {
index 3e908d320947f4e855bf7cfc7bdedb0446c633eb..da65e8bf2591a9e3a5aaac613ec280a751b8c8a1 100644 (file)
@@ -494,7 +494,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 0638c51e1c5f319cb2f06d5e5f1360a4098a726e..4b0ade2113344aee19d851613a3da1f5a31b307a 100644 (file)
@@ -135,7 +135,7 @@ void CommunicatorClass::ixfrSuck(const DNSName &domain, const TSIGTriplet& tt, c
         grouped[{x.d_name, x.d_type}].second.push_back(x);
 
       di.backend->startTransaction(domain, -1);
-      for(const auto g : grouped) {
+      for(const auto& g : grouped) {
         vector<DNSRecord> rrset;
         {
           DNSZoneRecord zrr;
index da21db062a16d40576322225309f15da3f28f1b7..135dbf665a7119bb791ee0c83fbcacda6bfd00eb 100644 (file)
@@ -161,7 +161,7 @@ static void checkRR(const signerParams& signer)
 
 BOOST_AUTO_TEST_CASE(test_generic_signers)
 {
-  for (const auto signer : signers) {
+  for (const auto& signer : signers) {
     DNSKEYRecordContent drc;
     auto dcke = DNSCryptoKeyEngine::makeFromISCString(drc, signer.iscMap);
 
index 1d081e3a098d18ecd3ce2f4d687f84550b2ee249..f8a3280e64f372589ecc889348bf7875dbd038c8 100644 (file)
@@ -2184,7 +2184,7 @@ static void apiServerSearchData(HttpRequest* req, HttpResponse* resp) {
 
   B.getAllDomains(&domains, true);
 
-  for(const DomainInfo di: domains)
+  for(const DomainInfo& di: domains)
   {
     if ((objectType == ObjectType::ALL || objectType == ObjectType::ZONE) && ents < maxEnts && sm.match(di.zone)) {
       doc.push_back(Json::object {