From: Remi Gacogne Date: Fri, 25 Jul 2025 14:55:18 +0000 (+0200) Subject: dnsdist: Fix clang-tidy warnings X-Git-Tag: dnsdist-2.0.1~15^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a73faaca012de7ed5fd60419ae09ca978194b445;p=thirdparty%2Fpdns.git dnsdist: Fix clang-tidy warnings Signed-off-by: Remi Gacogne (cherry picked from commit 93e1cbbc014526ce4f39b54dd084cfa040980dbe) Signed-off-by: Remi Gacogne --- diff --git a/pdns/dnsname.cc b/pdns/dnsname.cc index 5eb6dd8bf..49ff7fea1 100644 --- a/pdns/dnsname.cc +++ b/pdns/dnsname.cc @@ -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) // [ diff --git a/pdns/test-dnsname_cc.cc b/pdns/test-dnsname_cc.cc index 3e7cab573..63207ad66 100644 --- a/pdns/test-dnsname_cc.cc +++ b/pdns/test-dnsname_cc.cc @@ -1038,6 +1038,7 @@ BOOST_AUTO_TEST_CASE(test_raw_data_comparison) { GenericDNSPacketWriter packetWriter(query, aroot, QType::A, QClass::IN, 0); { + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) const std::string_view raw(reinterpret_cast(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(query.data() + sizeof(dnsheader)), aroot.wirelength() - 1); BOOST_CHECK(!(aroot.matches(raw))); }