]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
clang-tidize.
authorMiod Vallat <miod.vallat@powerdns.com>
Mon, 13 Jul 2026 10:19:22 +0000 (12:19 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Mon, 13 Jul 2026 10:19:22 +0000 (12:19 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
pdns/dnsparser.cc
pdns/dnswriter.cc
pdns/test-dnsname_cc.cc

index 05c044dc76da0498867b1c179fb0c8b227558d83..9461a55cf52f5f293bed18cddc99ba6041f7acc8 100644 (file)
@@ -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};
index 6660650a833b627107c5a53b3b16939cbd6240b2..60786879f309c5a65a0e2dcd910bd19c503ca143 100644 (file)
@@ -225,7 +225,7 @@ template <typename Container> void GenericDNSPacketWriter<Container>::xfrUnquote
 
 static constexpr bool l_verbose=false;
 static constexpr uint16_t maxCompressionOffset=16384;
-template <typename Container> uint16_t GenericDNSPacketWriter<Container>::lookupName(const DNSName& name, uint16_t* matchLen)
+template <typename Container> uint16_t GenericDNSPacketWriter<Container>::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 <typename Container> uint16_t GenericDNSPacketWriter<Container>::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;
index 5b17e28dab81fc3eb5db9c47c208660e0ae7e78f..e197ec54883d46874c598ae0ce0a849128751cf0 100644 (file)
@@ -1110,8 +1110,8 @@ BOOST_AUTO_TEST_CASE(test_variantnames) {
 #endif
 
 BOOST_AUTO_TEST_CASE(test_pdns_ilexicographical_compare) {
-  typedef boost::tuple<const std::string, const std::string, bool> case_t;
-  typedef std::list<case_t> cases_t;
+  using case_t = boost::tuple<const std::string, const std::string, bool>;
+  using cases_t = std::list<case_t>;
 
   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<const std::string, const std::string, bool> case_t;
-  typedef std::list<case_t> cases_t;
+  using case_t = boost::tuple<const std::string, const std::string, bool>;
+  using cases_t = std::list<case_t>;
 
   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>());
   }
 }