From: Miod Vallat Date: Mon, 13 Jul 2026 10:19:22 +0000 (+0200) Subject: clang-tidize. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ceec3401f0d787832d6be9602ccff97f5d7e5fde;p=thirdparty%2Fpdns.git clang-tidize. Signed-off-by: Miod Vallat --- diff --git a/pdns/dnsparser.cc b/pdns/dnsparser.cc index 05c044dc76..9461a55cf5 100644 --- a/pdns/dnsparser.cc +++ b/pdns/dnsparser.cc @@ -786,6 +786,7 @@ string simpleCompress(const string& elabel, const string& root) string ret; ret.reserve(label.size()+4); for(const auto & part : parts) { + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) auto label_part = std::string_view(label.c_str() + part.first, 1 + label.length() - part.first); // also match trailing 0, hence '1 +' if(!root.empty() && pdns_ilexicographical_compare_three_way(root, label_part) == 0) { const unsigned char rootptr[2]={0xc0,0x11}; diff --git a/pdns/dnswriter.cc b/pdns/dnswriter.cc index 6660650a83..60786879f3 100644 --- a/pdns/dnswriter.cc +++ b/pdns/dnswriter.cc @@ -225,7 +225,7 @@ template void GenericDNSPacketWriter::xfrUnquote static constexpr bool l_verbose=false; static constexpr uint16_t maxCompressionOffset=16384; -template uint16_t GenericDNSPacketWriter::lookupName(const DNSName& name, uint16_t* matchLen) +template uint16_t GenericDNSPacketWriter::lookupName(const DNSName& name, uint16_t* matchLen) // NOLINT(readability-function-cognitive-complexity) { // iterate over the written labels, see if we find a match const auto& raw = name.getStorage(); @@ -364,8 +364,8 @@ template uint16_t GenericDNSPacketWriter::lookup break; } - auto rawpart = std::string_view(raw.c_str() + *positionInNameIter + 1, nlen); - auto pktpart = std::string_view((const char*)&d_content[*positionInPacketIter] + 1, nlen); + auto rawpart = std::string_view(raw.c_str() + *positionInNameIter + 1, nlen); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + auto pktpart = std::string_view((const char*)&d_content[*positionInPacketIter] + 1, nlen); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) if (pdns_ilexicographical_compare_three_way(rawpart, pktpart) != 0) { if (l_verbose) { cout << "Mismatch: " << rawpart << " != " << pktpart << endl; diff --git a/pdns/test-dnsname_cc.cc b/pdns/test-dnsname_cc.cc index 5b17e28dab..e197ec5488 100644 --- a/pdns/test-dnsname_cc.cc +++ b/pdns/test-dnsname_cc.cc @@ -1110,8 +1110,8 @@ BOOST_AUTO_TEST_CASE(test_variantnames) { #endif BOOST_AUTO_TEST_CASE(test_pdns_ilexicographical_compare) { - typedef boost::tuple case_t; - typedef std::list cases_t; + using case_t = boost::tuple; + using cases_t = std::list; cases_t cases = boost::assign::list_of (case_t(std::string(""), std::string(""), false)) @@ -1126,15 +1126,14 @@ BOOST_AUTO_TEST_CASE(test_pdns_ilexicographical_compare) { ; for(const case_t& val : cases) { - bool res; - res = pdns_ilexicographical_compare(val.get<0>(), val.get<1>()); + bool res = pdns_ilexicographical_compare(val.get<0>(), val.get<1>()); BOOST_CHECK_EQUAL(res, val.get<2>()); } } BOOST_AUTO_TEST_CASE(test_pdns_iequals) { - typedef boost::tuple case_t; - typedef std::list cases_t; + using case_t = boost::tuple; + using cases_t = std::list; cases_t cases = boost::assign::list_of (case_t(std::string(""), std::string(""), true)) @@ -1149,8 +1148,7 @@ BOOST_AUTO_TEST_CASE(test_pdns_iequals) { ; for(const case_t& val : cases) { - bool res; - res = pdns_iequals(val.get<0>(), val.get<1>()); + bool res = pdns_iequals(val.get<0>(), val.get<1>()); BOOST_CHECK_EQUAL(res, val.get<2>()); } }