]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: revert some clang-tidy related changes 13716/head
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Thu, 18 Jan 2024 10:44:36 +0000 (11:44 +0100)
committerCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Thu, 18 Jan 2024 10:44:36 +0000 (11:44 +0100)
pdns/dnsdist-lua-actions.cc
pdns/dnsdist-protobuf.hh
pdns/dnsname.cc
pdns/dnsname.hh

index 22229b6dcb75b0848b10f0408a6281ff75e4d8f3..22077fcf34a32fda6240c8855006cdea8bee2c18 100644 (file)
@@ -327,8 +327,10 @@ public:
   }
 
 private:
-  std::string d_pool;
-  bool d_stopProcessing;
+  // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
+  const std::string d_pool;
+  // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
+  const bool d_stopProcessing;
 };
 
 class QPSPoolAction : public DNSAction
@@ -355,8 +357,10 @@ public:
 
 private:
   mutable LockGuarded<QPSLimiter> d_qps;
-  std::string d_pool;
-  bool d_stopProcessing;
+  // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
+  const std::string d_pool;
+  // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
+  const bool d_stopProcessing;
 };
 
 class RCodeAction : public DNSAction
@@ -747,8 +751,10 @@ private:
   };
   static std::atomic<uint64_t> s_functionsCounter;
   static thread_local std::map<uint64_t, PerThreadState> t_perThreadStates;
-  std::string d_functionCode;
-  uint64_t d_functionID;
+  // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
+  const std::string d_functionCode;
+  // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
+  const uint64_t d_functionID;
 };
 
 std::atomic<uint64_t> LuaFFIPerThreadAction::s_functionsCounter = 0;
@@ -869,8 +875,10 @@ private:
 
   static std::atomic<uint64_t> s_functionsCounter;
   static thread_local std::map<uint64_t, PerThreadState> t_perThreadStates;
-  std::string d_functionCode;
-  uint64_t d_functionID;
+  // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
+  const std::string d_functionCode;
+  // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
+  const uint64_t d_functionID;
 };
 
 std::atomic<uint64_t> LuaFFIPerThreadResponseAction::s_functionsCounter = 0;
index 86ec100331fc377fbb8b8120e92a3ceae362fe7e..c2dee817daf37526ffc3358790adb204c49f4c7f 100644 (file)
@@ -87,7 +87,6 @@ private:
   };
   std::unordered_map<std::string, MetaValue> d_metaTags;
 
-  // FIXME wondering if the cost of moving to a shared_ptr would be that bad
   // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
   const DNSQuestion& d_dq;
   const DNSResponse* d_dr{nullptr};
@@ -127,9 +126,12 @@ class ProtoBufMetaKey
 
   struct KeyTypeDescription
   {
-    std::string d_name;
-    Type d_type;
-    std::function<std::vector<std::string>(const DNSQuestion&, const std::string&, uint8_t)> d_func;
+    // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
+    const std::string d_name;
+    // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
+    const Type d_type;
+    // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
+    const std::function<std::vector<std::string>(const DNSQuestion&, const std::string&, uint8_t)> d_func;
     bool d_prefix{false};
     bool d_caseSensitive{true};
     bool d_numeric{false};
index 21008f38fedda4435bbd9c83167c5152db084a38..25a90078a89081922ed3ca1458a358532db66faa 100644 (file)
@@ -100,7 +100,7 @@ DNSName::DNSName(const std::string_view sw)
 }
 
 
-DNSName::DNSName(const char* pos, size_t len, size_t offset, bool uncompress, uint16_t* qtype, uint16_t* qclass, unsigned int* consumed, uint16_t minOffset)
+DNSName::DNSName(const char* pos, int len, int offset, bool uncompress, uint16_t* qtype, uint16_t* qclass, unsigned int* consumed, uint16_t minOffset)
 {
   if (offset >= len)
     throw std::range_error("Trying to read past the end of the buffer ("+std::to_string(offset)+ " >= "+std::to_string(len)+")");
index dbdc2ac2c3c234cea94a642dc8b604e881cd6f64..9b9692f51e23bfd0cd23ff1790da86bedc05d86e 100644 (file)
@@ -100,7 +100,7 @@ public:
   DNSName(DNSName&& a) = default;
 
   explicit DNSName(std::string_view sw); //!< Constructs from a human formatted, escaped presentation
-  DNSName(const char* pos, size_t len, size_t offset, bool uncompress, uint16_t* qtype = nullptr, uint16_t* qclass = nullptr, unsigned int* consumed = nullptr, uint16_t minOffset = 0); //!< Construct from a DNS Packet, taking the first question if offset=12. If supplied, consumed is set to the number of bytes consumed from the packet, which will not be equal to the wire length of the resulting name in case of compression.
+  DNSName(const char* p, int len, int offset, bool uncompress, uint16_t* qtype = nullptr, uint16_t* qclass = nullptr, unsigned int* consumed = nullptr, uint16_t minOffset = 0); //!< Construct from a DNS Packet, taking the first question if offset=12. If supplied, consumed is set to the number of bytes consumed from the packet, which will not be equal to the wire length of the resulting name in case of compression.
 
   bool isPartOf(const DNSName& rhs) const;   //!< Are we part of the rhs name? Note that name.isPartOf(name).
   inline bool operator==(const DNSName& rhs) const; //!< DNS-native comparison (case insensitive) - empty compares to empty