]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix clang-tidy warnings
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 25 Jul 2025 14:55:18 +0000 (16:55 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 22 Aug 2025 13:12:32 +0000 (15:12 +0200)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
(cherry picked from commit 93e1cbbc014526ce4f39b54dd084cfa040980dbe)
Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dnsname.cc
pdns/test-dnsname_cc.cc

index 5eb6dd8bf4e8d90234504b12839354fc8853e6a0..49ff7fea162d4c4b15f4d55830578e47a21245b3 100644 (file)
@@ -738,15 +738,15 @@ bool DNSName::matches(const std::string_view& wire_uncompressed) const
     return false;
   }
 
-  const auto* us = d_storage.cbegin();
-  const auto* p = wire_uncompressed.cbegin();
-  for (; us != d_storage.cend() && p != wire_uncompressed.cend(); ++us, ++p) {
-    if (dns_tolower(*p) != dns_tolower(*us)) {
+  const auto* our = d_storage.cbegin();
+  const auto* other = wire_uncompressed.cbegin();
+  for (; our != d_storage.cend() && other != wire_uncompressed.cend(); ++our, ++other) {
+    if (dns_tolower(*other) != dns_tolower(*our)) {
       return false;
     }
   }
 
-  return us == d_storage.cend();
+  return our == d_storage.cend();
 }
 
 #if defined(PDNS_AUTH) // [
index 3e7cab573f6cc11fe946cdf40a582c6a94a18747..63207ad66dac11f09f89a6eb926c082730c56a4c 100644 (file)
@@ -1038,6 +1038,7 @@ BOOST_AUTO_TEST_CASE(test_raw_data_comparison) {
   GenericDNSPacketWriter<PacketBuffer> packetWriter(query, aroot, QType::A, QClass::IN, 0);
 
   {
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
     const std::string_view raw(reinterpret_cast<const char*>(query.data()) + sizeof(dnsheader), query.size() - sizeof(dnsheader));
     BOOST_CHECK(aroot.matches(raw));
 
@@ -1054,6 +1055,7 @@ BOOST_AUTO_TEST_CASE(test_raw_data_comparison) {
 
   {
     /* too short */
+    // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast,cppcoreguidelines-pro-bounds-pointer-arithmetic)
     const std::string_view raw(reinterpret_cast<const char*>(query.data() + sizeof(dnsheader)), aroot.wirelength() - 1);
     BOOST_CHECK(!(aroot.matches(raw)));
   }