From: Rosen Penev Date: Thu, 5 Nov 2020 07:53:05 +0000 (-0800) Subject: clang-tidy: use bool literals X-Git-Tag: dnsdist-1.6.0-alpha2~55^2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d563b11a945dba60ea3b963174609c6580024384;p=thirdparty%2Fpdns.git clang-tidy: use bool literals Found with modernize-use-bool-literals Signed-off-by: Rosen Penev --- diff --git a/modules/pipebackend/pipebackend.cc b/modules/pipebackend/pipebackend.cc index 208ef2e5d4..c8e9a77c2b 100644 --- a/modules/pipebackend/pipebackend.cc +++ b/modules/pipebackend/pipebackend.cc @@ -307,7 +307,7 @@ bool PipeBackend::get(DNSResourceRecord &r) r.auth = (parts[2] == "1"); } else { r.scopeMask = 0; - r.auth = 1; + r.auth = true; } r.qname=DNSName(parts[1+extraFields]); r.qtype=parts[3+extraFields]; diff --git a/modules/randombackend/randombackend.cc b/modules/randombackend/randombackend.cc index 20b179b8d3..71028a0841 100644 --- a/modules/randombackend/randombackend.cc +++ b/modules/randombackend/randombackend.cc @@ -83,7 +83,7 @@ public: } rr.qclass=QClass::IN; // Internet class randomness. rr.ttl=5; // 5 seconds - rr.auth = 1; // it may be random.. but it is auth! + rr.auth = true; // it may be random.. but it is auth! rr.content = d_answer; d_answer.clear(); // this was the last answer diff --git a/pdns/backends/gsql/gsqlbackend.cc b/pdns/backends/gsql/gsqlbackend.cc index 315c64af46..776dd55a25 100644 --- a/pdns/backends/gsql/gsqlbackend.cc +++ b/pdns/backends/gsql/gsqlbackend.cc @@ -1881,7 +1881,7 @@ void GSQLBackend::extractRecord(SSqlStatement::row_t& row, DNSResourceRecord& r) if(d_dnssecQueries) r.auth = !row[7].empty() && row[7][0]=='1'; else - r.auth = 1; + r.auth = true; r.disabled = !row[5].empty() && row[5][0]=='1'; diff --git a/pdns/dnspacket.cc b/pdns/dnspacket.cc index 0d527ff4ba..15d5913307 100644 --- a/pdns/dnspacket.cc +++ b/pdns/dnspacket.cc @@ -358,7 +358,7 @@ std::unique_ptr DNSPacket::replyPacket() const r->setRemote(&d_remote); r->setAnswer(true); // this implies the allocation of the header r->setA(true); // and we are authoritative - r->setRA(0); // no recursion available + r->setRA(false); // no recursion available r->setRD(d.rd); // if you wanted to recurse, answer will say you wanted it r->setID(d.id); r->setOpcode(d.opcode); diff --git a/pdns/dnssecsigner.cc b/pdns/dnssecsigner.cc index 2a9eb764d7..88ebcf4d56 100644 --- a/pdns/dnssecsigner.cc +++ b/pdns/dnssecsigner.cc @@ -64,7 +64,7 @@ static void fillOutRRSIG(DNSSECPrivateKey& dpk, const DNSName& signQName, RRSIGR string msg=getMessageForRRSET(signQName, rrc, toSign); // this is what we will hash & sign pair lookup(rc->getPubKeyHash(), getLookupKey(msg)); // this hash is a memory saving exercise - bool doCache=1; + bool doCache=true; if(doCache) { ReadLock l(&g_signatures_lock); diff --git a/pdns/nameserver.cc b/pdns/nameserver.cc index 6d658155a3..5dff5148a4 100644 --- a/pdns/nameserver.cc +++ b/pdns/nameserver.cc @@ -278,7 +278,7 @@ bool UDPNameserver::receive(DNSPacket& packet, std::string& buffer) if((len=recvmsg(sock, &msgh, 0)) < 0 ) { if(errno != EAGAIN) g_log< PacketHandler::getBestDNAMESynth(DNSPacket& p, DNSName &ta rr.dr.d_type = QType::CNAME; rr.dr.d_name = prefix + rr.dr.d_name; rr.dr.d_content = std::make_shared(CNAMERecordContent(prefix + getRR(rr.dr)->getTarget())); - rr.auth = 0; // don't sign CNAME + rr.auth = false; // don't sign CNAME target= getRR(rr.dr)->getTarget(); ret.push_back(rr); } @@ -1180,7 +1180,7 @@ std::unique_ptr PacketHandler::doQuestion(DNSPacket& p) set authSet; vector rrset; - bool weDone=0, weRedirected=0, weHaveUnauth=0, doSigs=0; + bool weDone=false, weRedirected=false, weHaveUnauth=false, doSigs=false; DNSName haveAlias; uint8_t aliasScopeMask; @@ -1431,9 +1431,9 @@ std::unique_ptr PacketHandler::doQuestion(DNSPacket& p) rrset.push_back(rr); } if(rec->d_type == QType::CNAME && p.qtype.getCode() != QType::CNAME) - weRedirected = 1; + weRedirected = true; else - weDone = 1; + weDone = true; } } catch(std::exception &e) { @@ -1455,13 +1455,13 @@ std::unique_ptr PacketHandler::doQuestion(DNSPacket& p) // cerr<<"Auth: "<& cmds) { cerr<<"Domain '"< signatures; uint32_t rnd; @@ -1986,7 +1986,7 @@ static int testSchema(DNSSECKeeper& dk, const DNSName& zone) rr.qname=zone; rr.ttl=86400; rr.domain_id=di.id; - rr.auth=1; + rr.auth=true; rr.content="ns1.example.com. ahu.example.com. 2012081039 7200 3600 1209600 3600"; cout<<"Feeding SOA"<feedRecord(rr, DNSName()); @@ -2023,7 +2023,7 @@ static int testSchema(DNSSECKeeper& dk, const DNSName& zone) rr.qname=zone; rr.ttl=86400; rr.domain_id=di.id; - rr.auth=1; + rr.auth=true; rr.content="ns1.example.com. ahu.example.com. 2012081039 7200 3600 1209600 3600"; cout<<"Feeding SOA"<feedRecord(rr, DNSName()); @@ -3026,13 +3026,13 @@ try else if(pdns_iequals(cmds[n], "KSK")) dpk.d_flags = 257; else if(pdns_iequals(cmds[n], "active")) - active = 1; + active = true; else if(pdns_iequals(cmds[n], "passive") || pdns_iequals(cmds[n], "inactive")) // passive eventually needs to be removed - active = 0; + active = false; else if(pdns_iequals(cmds[n], "published")) - published = 1; + published = true; else if(pdns_iequals(cmds[n], "unpublished")) - published = 0; + published = false; else { cerr<<"Unknown key flag '"<getZoneRepresentation(true); rrout.qtype = QType::SOA; rrout.domain_id = sd.domain_id; - rrout.auth = 1; + rrout.auth = true; rrout.ttl = sd.ttl; return true; diff --git a/pdns/ueberbackend.cc b/pdns/ueberbackend.cc index ca4720c098..cc4d1d0ed9 100644 --- a/pdns/ueberbackend.cc +++ b/pdns/ueberbackend.cc @@ -479,8 +479,8 @@ UeberBackend::UeberBackend(const string &pname) instances.push_back(this); // report to the static list of ourself } - d_negcached=0; - d_cached=0; + d_negcached=false; + d_cached=false; d_cache_ttl = ::arg().asNum("query-cache-ttl"); d_negcache_ttl = ::arg().asNum("negquery-cache-ttl"); d_qtype = 0; diff --git a/pdns/ws-auth.cc b/pdns/ws-auth.cc index 32b3d37ac7..9a43f04480 100644 --- a/pdns/ws-auth.cc +++ b/pdns/ws-auth.cc @@ -520,7 +520,7 @@ static void gatherRecords(UeberBackend& B, const string& logprefix, const Json c DNSResourceRecord rr; rr.qname = qname; rr.qtype = qtype; - rr.auth = 1; + rr.auth = true; rr.ttl = ttl; validateGatheredRRType(rr); @@ -1640,7 +1640,7 @@ static void apiServerZones(HttpRequest* req, HttpResponse* resp) { // synthesize RRs as needed DNSResourceRecord autorr; autorr.qname = zonename; - autorr.auth = 1; + autorr.auth = true; autorr.ttl = ::arg().asNum("default-ttl"); if (!have_soa && zonekind != DomainInfo::Slave) { diff --git a/pdns/zone2sql.cc b/pdns/zone2sql.cc index 2683f09ed9..d52e5f38a7 100644 --- a/pdns/zone2sql.cc +++ b/pdns/zone2sql.cc @@ -103,7 +103,7 @@ static void startNewTransaction() cout<<"COMMIT;"<