]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Appease clang-tidy 16467/head
authorMiod Vallat <miod.vallat@powerdns.com>
Wed, 12 Nov 2025 07:50:15 +0000 (08:50 +0100)
committerMiod Vallat <miod.vallat@powerdns.com>
Wed, 12 Nov 2025 08:29:43 +0000 (09:29 +0100)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
pdns/auth-main.cc
pdns/misc.hh

index 2ec03dea01a59c54edffdf671d967f62c5b7c9a6..517a0e311e24a295e35b2186aa1c824d6d580d82 100644 (file)
@@ -569,9 +569,10 @@ static void qthread(unsigned int num)
     AtomicCounter& numreceived6 = *S.getPointer("udp6-queries");
     AtomicCounter& overloadDrops = *S.getPointer("overload-drops");
 
-    int diff, start;
+    int diff{};
+    int start{};
     bool logDNSQueries = ::arg().mustDo("log-dns-queries");
-    shared_ptr<UDPNameserver> NS;
+    shared_ptr<UDPNameserver> NS; // NOLINT(readability-identifier-length)
     std::string buffer;
     ComboAddress accountremote;
 
@@ -633,8 +634,9 @@ static void qthread(unsigned int num)
         S.ringAccount("remotes", question.getInnerRemote());
         if (logDNSQueries) {
           g_log << Logger::Notice << "Remote " << question.getRemoteString() << " wants '" << question.qdomain << "|" << question.qtype << "', do = " << question.d_dnssecOk << ", bufsize = " << question.getMaxReplyLen();
-          if (question.d_ednsRawPacketSizeLimit > 0 && question.getMaxReplyLen() != (unsigned int)question.d_ednsRawPacketSizeLimit)
+          if (question.d_ednsRawPacketSizeLimit > 0 && question.getMaxReplyLen() != (unsigned int)question.d_ednsRawPacketSizeLimit) {
             g_log << " (" << question.d_ednsRawPacketSizeLimit << ")";
+          }
         }
 
         if (PC.enabled() && (question.d.opcode != Opcode::Notify && question.d.opcode != Opcode::Update) && question.couldBeCached()) {
@@ -653,7 +655,7 @@ static void qthread(unsigned int num)
             cached.d_inner_remote = question.d_inner_remote;
             cached.setSocket(question.getSocket()); // inlined
             cached.d_anyLocal = question.d_anyLocal;
-            cached.setMaxReplyLen(question.getMaxReplyLen());
+            cached.setMaxReplyLen(question.getMaxReplyLen()); // NOLINT(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) get returns unsigned, set takes signed...
             cached.d.rd = question.d.rd; // copy in recursion desired bit
             cached.d.id = question.d.id;
             cached.commitD(); // commit d to the packet                        inlined
index b5deb14fa0321f43c778728cd07e13ac28283dc9..33ee88bd818cf8feb6509e7e347998b38bce89f5 100644 (file)
@@ -858,7 +858,7 @@ struct FDWrapper
   int reset()
   {
     int ret = 0;
-    if (d_fd >= 0) {
+    if (d_fd >= 0) { // NOLINT(clang-analyzer-core.UndefinedBinaryOperatorResult): obvious false positive
       ret = close(d_fd);
     }
     d_fd = -1;