From: Otto Moerbeek Date: Fri, 4 Oct 2019 15:13:19 +0000 (+0200) Subject: Some more shadowing going on X-Git-Tag: dnsdist-1.4.0-rc4~43^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e35f9e468a63a7dcc6c9774dfc9b193eff799e4d;p=pdns Some more shadowing going on --- diff --git a/ext/probds/murmur3.cc b/ext/probds/murmur3.cc index 1e58c97fb..0c4e5d4a8 100644 --- a/ext/probds/murmur3.cc +++ b/ext/probds/murmur3.cc @@ -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; }; diff --git a/modules/godbcbackend/sodbc.cc b/modules/godbcbackend/sodbc.cc index 5b8e45843..79de7aade 100644 --- a/modules/godbcbackend/sodbc.cc +++ b/modules/godbcbackend/sodbc.cc @@ -344,13 +344,13 @@ SSqlStatement* SODBCStatement::nextRow(row_t& row) d_result = SQLFetch(d_statement); // cerr<<"subsequent SQLFetch done, d_result="< *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(), rr); @@ -900,15 +900,8 @@ void LMDBBackend::getUnfreshSlaveInfos(vector* domains) if(!txn2->txn.get(txn2->db->dbi, co(iter.getID(), g_rootdnsname, QType::SOA), val)) { DNSResourceRecord rr; serFromString(val.get(), 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; diff --git a/pdns/ixfrdist.cc b/pdns/ixfrdist.cc index 9eeb58da0..ac02e0f9c 100644 --- a/pdns/ixfrdist.cc +++ b/pdns/ixfrdist.cc @@ -428,27 +428,27 @@ void updateThread(const string& workdir, const uint16_t& keep, const uint16_t& a g_log<d_st.serial<<" to "<(); + auto ixfrInfo = std::make_shared(); if (oldZoneInfo && !oldZoneInfo->latestAXFR.empty()) { auto diff = std::make_shared(); - zoneInfo->ixfrDiffs = oldZoneInfo->ixfrDiffs; + ixfrInfo->ixfrDiffs = oldZoneInfo->ixfrDiffs; g_log<latestAXFR, records, diff, oldZoneInfo->soa, oldZoneInfo->soaTTL, soa, soaTTL); g_log<removals.size()<<" removals and "<additions.size()<<" additions"<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<latestAXFR.size() : 0)<<" entries, "<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< interval) { + Lua.writeFunction("readTrustAnchorsFromFile", [&lci](const std::string& fnamearg, const boost::optional interval) { uint32_t realInterval = 24; if (interval) { realInterval = static_cast(*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 diff --git a/pdns/recursordist/rec_metrics.hh b/pdns/recursordist/rec_metrics.hh index 69bae90f0..e5aa14cde 100644 --- a/pdns/recursordist/rec_metrics.hh +++ b/pdns/recursordist/rec_metrics.hh @@ -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; diff --git a/pdns/test-dnsname_cc.cc b/pdns/test-dnsname_cc.cc index 61faa3353..9c1890de8 100644 --- a/pdns/test-dnsname_cc.cc +++ b/pdns/test-dnsname_cc.cc @@ -615,9 +615,9 @@ BOOST_AUTO_TEST_CASE(test_suffixmatch_tree) { smt.remove(net); size_t count = 0; - smt.visit([apowerdnscom, &count](const SuffixMatchTree& smt) { + smt.visit([apowerdnscom, &count](const SuffixMatchTree& 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& smt) { + smt.visit([&count](const SuffixMatchTree&) { count++; }); BOOST_CHECK_EQUAL(count, 0U); diff --git a/pdns/webserver.hh b/pdns/webserver.hh index 40e37ded3..0855f7e41 100644 --- a/pdns/webserver.hh +++ b/pdns/webserver.hh @@ -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; diff --git a/pdns/ws-recursor.cc b/pdns/ws-recursor.cc index 82c8b7551..81651ab88 100644 --- a/pdns/ws-recursor.cc +++ b/pdns/ws-recursor.cc @@ -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()) {