]> granicus.if.org Git - pdns/commitdiff
Some more shadowing going on
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 4 Oct 2019 15:13:19 +0000 (17:13 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 7 Oct 2019 07:36:27 +0000 (09:36 +0200)
ext/probds/murmur3.cc
modules/godbcbackend/sodbc.cc
modules/ldapbackend/ldapbackend.cc
modules/lmdbbackend/lmdbbackend.cc
pdns/ixfrdist.cc
pdns/rec-lua-conf.cc
pdns/recursordist/rec_metrics.hh
pdns/test-dnsname_cc.cc
pdns/webserver.hh
pdns/ws-recursor.cc

index 1e58c97fb482c735a89af2389934bbbaf4096dda..0c4e5d4a8c917aca2b94fb6997bca23660ab3386 100644 (file)
@@ -67,7 +67,9 @@ void MurmurHash3_x86_32( const void * key, int len, uint32_t seed, void * out )
     switch(len & 3)
     {
     case 3: k1 ^= tail[2] << 16;
+      /* fallthrough */
     case 2: k1 ^= tail[1] << 8;
+      /* fallthrough */
     case 1: k1 ^= tail[0];
             k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
     };
index 5b8e45843f3459228541c0d42c9ca3b47717330b..79de7aade688d061350ed3303836d5ae53aee26a 100644 (file)
@@ -344,13 +344,13 @@ SSqlStatement* SODBCStatement::nextRow(row_t& row)
     d_result = SQLFetch(d_statement);
     // cerr<<"subsequent SQLFetch done, d_result="<<d_result<<endl;
     if(d_result == SQL_NO_DATA) {
-      SQLRETURN result = SQLMoreResults(d_statement);
-      // cerr<<"SQLMoreResults done, result="<<d_result<<endl;
-      if (result == SQL_NO_DATA) {
-        d_result = result;
+      SQLRETURN result2 = SQLMoreResults(d_statement);
+      // cerr<<"SQLMoreResults done, result="<<d_result2<<endl;
+      if (result2 == SQL_NO_DATA) {
+        d_result = result2;
       }
       else {
-        testResult( result, SQL_HANDLE_STMT, d_statement, "Could not fetch next result set for ("+d_query+").");
+        testResult( result2, SQL_HANDLE_STMT, d_statement, "Could not fetch next result set for ("+d_query+").");
       d_result = SQLFetch(d_statement);
       }
     }
index 1a4374f5ad122c66a64d39b4124367cb000fdade..7078bf5513e48fa03426eb0300da7024e8b816f2 100644 (file)
@@ -208,13 +208,13 @@ void LdapBackend::extract_entry_results( const DNSName& domain, const DNSResult&
         // TTL
         if ( d_result.count( "PdnsRecordTTL" ) && !d_result["PdnsRecordTTL"].empty() ) {
           for ( const auto& rdata : d_result["PdnsRecordTTL"] ) {
-            std::string qtype;
+            std::string qtype2;
             std::size_t pos = rdata.find_first_of( '|', 0 );
             if ( pos == std::string::npos )
               continue;
 
-            qtype = rdata.substr( 0, pos );
-            if ( qtype != QType( local_result.qtype ).getName() )
+            qtype2 = rdata.substr( 0, pos );
+            if ( qtype2 != QType( local_result.qtype ).getName() )
               continue;
 
             local_result.ttl = pdns_stou( rdata.substr( pos + 1 ) );
@@ -234,7 +234,7 @@ void LdapBackend::extract_entry_results( const DNSName& domain, const DNSResult&
           std::string defaultOrdername;
 
           for ( const auto& rdata : d_result["PdnsRecordOrdername"] ) {
-            std::string qtype;
+            std::string qtype2;
             std::size_t pos = rdata.find_first_of( '|', 0 );
             if ( pos == std::string::npos ) {
               // This is the default ordername for all records in this entry
@@ -242,8 +242,8 @@ void LdapBackend::extract_entry_results( const DNSName& domain, const DNSResult&
               continue;
             }
 
-            qtype = rdata.substr( 0, pos );
-            if ( qtype != QType( local_result.qtype ).getName() )
+            qtype2 = rdata.substr( 0, pos );
+            if ( qtype2 != QType( local_result.qtype ).getName() )
               continue;
 
             local_result.ordername = rdata.substr( pos + 1 );
index d186fb716e08b49e161fd3856e9dcefb7eeed7a8..92499916db954930f62d8547d9fa88f153f2b7c8 100644 (file)
@@ -866,8 +866,8 @@ void LMDBBackend::getAllDomains(vector<DomainInfo> *domains, bool include_disabl
     DomainInfo di=*iter;
     di.id = iter.getID();
 
-    auto txn = getRecordsROTransaction(iter.getID());
-    if(!txn->txn.get(txn->db->dbi, co(di.id, g_rootdnsname, QType::SOA), val)) {
+    auto txn2 = getRecordsROTransaction(iter.getID());
+    if(!txn2->txn.get(txn2->db->dbi, co(di.id, g_rootdnsname, QType::SOA), val)) {
       DNSResourceRecord rr;
       serFromString(val.get<string_view>(), rr);
 
@@ -900,15 +900,8 @@ void LMDBBackend::getUnfreshSlaveInfos(vector<DomainInfo>* domains)
     if(!txn2->txn.get(txn2->db->dbi, co(iter.getID(), g_rootdnsname, QType::SOA), val)) {
       DNSResourceRecord rr;
       serFromString(val.get<string_view>(), rr);
-      struct soatimes 
-      {
-        uint32_t serial;
-        uint32_t refresh;
-        uint32_t retry;
-        uint32_t expire;
-        uint32_t minimum;
-      } st;
-
+      struct soatimes st;
       memcpy(&st, &rr.content[rr.content.size()-sizeof(soatimes)], sizeof(soatimes));
 
       if((time_t)(iter->last_check + ntohl(st.refresh)) >= now) { // still fresh
@@ -1005,9 +998,9 @@ bool LMDBBackend::activateDomainKey(const DNSName& name, unsigned int id)
   KeyDataDB kdb;
   if(txn.get(id, kdb)) {
     if(kdb.domain == name) {
-      txn.modify(id, [](KeyDataDB& kdb)
+      txn.modify(id, [](KeyDataDB& kdbarg)
                  {
-                   kdb.active = true;
+                   kdbarg.active = true;
                  });
       txn.commit();
       return true;
@@ -1024,9 +1017,9 @@ bool LMDBBackend::deactivateDomainKey(const DNSName& name, unsigned int id)
   KeyDataDB kdb;
   if(txn.get(id, kdb)) {
     if(kdb.domain == name) {
-      txn.modify(id, [](KeyDataDB& kdb)
+      txn.modify(id, [](KeyDataDB& kdbarg)
                  {
-                   kdb.active = false;
+                   kdbarg.active = false;
                  });
       txn.commit();
       return true;
index 9eeb58da044d2ccd9ee314ee84523680c5236854..ac02e0f9c49f5c9332726cec596db8bbd5330818 100644 (file)
@@ -428,27 +428,27 @@ void updateThread(const string& workdir, const uint16_t& keep, const uint16_t& a
         g_log<<Logger::Notice<<"Wrote zonedata for "<<domain<<" with serial "<<soa->d_st.serial<<" to "<<dir<<endl;
 
         const auto oldZoneInfo = getCurrentZoneInfo(domain);
-        auto zoneInfo = std::make_shared<ixfrinfo_t>();
+        auto ixfrInfo = std::make_shared<ixfrinfo_t>();
 
         if (oldZoneInfo && !oldZoneInfo->latestAXFR.empty()) {
           auto diff = std::make_shared<ixfrdiff_t>();
-          zoneInfo->ixfrDiffs = oldZoneInfo->ixfrDiffs;
+          ixfrInfo->ixfrDiffs = oldZoneInfo->ixfrDiffs;
           g_log<<Logger::Debug<<"Calculating diff for "<<domain<<endl;
           makeIXFRDiff(oldZoneInfo->latestAXFR, records, diff, oldZoneInfo->soa, oldZoneInfo->soaTTL, soa, soaTTL);
           g_log<<Logger::Debug<<"Calculated diff for "<<domain<<", we had "<<diff->removals.size()<<" removals and "<<diff->additions.size()<<" additions"<<endl;
-          zoneInfo->ixfrDiffs.push_back(std::move(diff));
+          ixfrInfo->ixfrDiffs.push_back(std::move(diff));
         }
 
         // Clean up the diffs
-        while (zoneInfo->ixfrDiffs.size() > keep) {
-          zoneInfo->ixfrDiffs.erase(zoneInfo->ixfrDiffs.begin());
+        while (ixfrInfo->ixfrDiffs.size() > keep) {
+          ixfrInfo->ixfrDiffs.erase(ixfrInfo->ixfrDiffs.begin());
         }
 
         g_log<<Logger::Debug<<"Zone "<<domain<<" previously contained "<<(oldZoneInfo ? oldZoneInfo->latestAXFR.size() : 0)<<" entries, "<<records.size()<<" now"<<endl;
-        zoneInfo->latestAXFR = std::move(records);
-        zoneInfo->soa = soa;
-        zoneInfo->soaTTL = soaTTL;
-        updateCurrentZoneInfo(domain, zoneInfo);
+        ixfrInfo->latestAXFR = std::move(records);
+        ixfrInfo->soa = soa;
+        ixfrInfo->soaTTL = soaTTL;
+        updateCurrentZoneInfo(domain, ixfrInfo);
       } catch (PDNSException &e) {
         g_stats.incrementAXFRFailures(domain);
         g_log<<Logger::Warning<<"Could not save zone '"<<domain<<"' to disk: "<<e.reason<<endl;
index 8b46c820b9bf4965374157f02d123bcfb361aec7..db9c02f7502edcc304c899be6cb32e4d6d934539 100644 (file)
@@ -450,15 +450,15 @@ void loadRecursorLuaConfig(const std::string& fname, luaConfigDelayedThreads& de
         lci.negAnchors.clear();
     });
 
-  Lua.writeFunction("readTrustAnchorsFromFile", [&lci](const std::string& fname, const boost::optional<uint32_t> interval) {
+  Lua.writeFunction("readTrustAnchorsFromFile", [&lci](const std::string& fnamearg, const boost::optional<uint32_t> interval) {
       uint32_t realInterval = 24;
       if (interval) {
         realInterval = static_cast<uint32_t>(*interval);
       }
       warnIfDNSSECDisabled("Warning: reading Trust Anchors from file (readTrustAnchorsFromFile), but dnssec is set to 'off'!");
-      lci.trustAnchorFileInfo.fname = fname;
+      lci.trustAnchorFileInfo.fname = fnamearg;
       lci.trustAnchorFileInfo.interval = realInterval;
-      updateTrustAnchorsFromFile(fname, lci.dsAnchors);
+      updateTrustAnchorsFromFile(fnamearg, lci.dsAnchors);
     });
 
 #if HAVE_PROTOBUF
index 69bae90f0671846f14dbe99b68cc353386697ce1..e5aa14cdeed2b71cbb43d35f219803d58dec0188 100644 (file)
@@ -37,9 +37,9 @@ enum class PrometheusMetricType: int {
 
 // Keeps additional information about metrics
 struct MetricDefinition {
-    MetricDefinition(const PrometheusMetricType& prometheusType, const std::string& description) {
-      this->prometheusType = prometheusType;
-      this->description = description;
+    MetricDefinition(const PrometheusMetricType& prometheusType_, const std::string& description_) {
+      prometheusType = prometheusType_;
+      description = description_;
     }
 
     MetricDefinition() = default;
index 61faa3353276a2b4ef2a15e6c31afe04d1d065e3..9c1890de8a2be1495511b4c030b0a5c974bfa01d 100644 (file)
@@ -615,9 +615,9 @@ BOOST_AUTO_TEST_CASE(test_suffixmatch_tree) {
   smt.remove(net);
 
   size_t count = 0;
-  smt.visit([apowerdnscom, &count](const SuffixMatchTree<DNSName>& smt) {
+  smt.visit([apowerdnscom, &count](const SuffixMatchTree<DNSName>& smtarg) {
       count++;
-      BOOST_CHECK_EQUAL(smt.d_value, apowerdnscom);
+      BOOST_CHECK_EQUAL(smtarg.d_value, apowerdnscom);
     });
   BOOST_CHECK_EQUAL(count, 1U);
 
@@ -626,7 +626,7 @@ BOOST_AUTO_TEST_CASE(test_suffixmatch_tree) {
   BOOST_CHECK(smt.lookup(apowerdnscom) == nullptr);
 
   count = 0;
-  smt.visit([&count](const SuffixMatchTree<DNSName>& smt) {
+  smt.visit([&count](const SuffixMatchTree<DNSName>&) {
       count++;
     });
   BOOST_CHECK_EQUAL(count, 0U);
index 40e37ded3dd4420719ba680499bb28f851147a4b..0855f7e41c37a413fe226cf5780ae1531e1493d5 100644 (file)
@@ -32,7 +32,7 @@
 
 class HttpRequest : public YaHTTP::Request {
 public:
-  HttpRequest(const string& logprefix="") : YaHTTP::Request(), accept_json(false), accept_html(false), complete(false), logprefix(logprefix) { };
+  HttpRequest(const string& logprefix_="") : YaHTTP::Request(), accept_json(false), accept_html(false), complete(false), logprefix(logprefix_) { };
 
   bool accept_json;
   bool accept_html;
index 82c8b755199b2bcdcfe6ce2b4f425fcf38dc14d2..81651ab88072b4d8582d2d6c12ffef2fc3ac3c2d 100644 (file)
@@ -423,7 +423,7 @@ static void apiServerRPZStats(HttpRequest* req, HttpResponse* resp) {
 
 
 static void prometheusMetrics(HttpRequest *req, HttpResponse *resp) {
-    static MetricDefinitionStorage g_metricDefinitions;
+    static MetricDefinitionStorage s_metricDefinitions;
 
     if (req->method != "GET")
         throw HttpMethodNotAllowedException();
@@ -443,8 +443,8 @@ static void prometheusMetrics(HttpRequest *req, HttpResponse *resp) {
 
         MetricDefinition metricDetails;
 
-        if (g_metricDefinitions.getMetricDetails(metricName, metricDetails)) {
-          std::string prometheusTypeName = g_metricDefinitions.getPrometheusStringMetricType(
+        if (s_metricDefinitions.getMetricDetails(metricName, metricDetails)) {
+          std::string prometheusTypeName = s_metricDefinitions.getPrometheusStringMetricType(
                   metricDetails.prometheusType);
 
           if (prometheusTypeName.empty()) {