From 9ec4c2390ec389a38319396804d244586f653a86 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Mon, 26 Sep 2022 11:37:56 +0200 Subject: [PATCH] Use naming convention: s/maxDNSNameLength/s_maxDNSNameLength --- pdns/dnsname.cc | 12 ++++++------ pdns/dnsname.hh | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pdns/dnsname.cc b/pdns/dnsname.cc index 5596620e1b..a44f6d09f6 100644 --- a/pdns/dnsname.cc +++ b/pdns/dnsname.cc @@ -44,8 +44,8 @@ std::ostream & operator<<(std::ostream &os, const DNSName& d) void DNSName::throwSafeRangeError(const std::string& msg, const char* buf, size_t length) { std::string dots; - if (length > maxDNSNameLength) { - length = maxDNSNameLength; + if (length > s_maxDNSNameLength) { + length = s_maxDNSNameLength; dots = "..."; } std::string label; @@ -80,7 +80,7 @@ DNSName::DNSName(const char* p, size_t length) if(labellen > 63) throwSafeRangeError("label too long to append: ", p, length); - if(iter-pbegin > static_cast(maxDNSNameLength - 1)) // reserve two bytes, one for length and one for the root label + if(iter-pbegin > static_cast(s_maxDNSNameLength - 1)) // reserve two bytes, one for length and one for the root label throwSafeRangeError("name too long to append: ", p, length); d_storage[lenpos]=labellen; @@ -89,7 +89,7 @@ DNSName::DNSName(const char* p, size_t length) } else { d_storage=segmentDNSNameRaw(p, length); - if(d_storage.size() > maxDNSNameLength) { + if(d_storage.size() > s_maxDNSNameLength) { throwSafeRangeError("name too long: ", p, length); } } @@ -340,7 +340,7 @@ void DNSName::appendRawLabel(const char* start, unsigned int length) throw std::range_error("no such thing as an empty label to append"); if(length > 63) throw std::range_error("label too long to append"); - if(d_storage.size() + length > maxDNSNameLength - 1) // reserve one byte for the label length + if(d_storage.size() + length > s_maxDNSNameLength - 1) // reserve one byte for the label length throw std::range_error("name too long to append"); if(d_storage.empty()) { @@ -359,7 +359,7 @@ void DNSName::prependRawLabel(const std::string& label) throw std::range_error("no such thing as an empty label to prepend"); if(label.size() > 63) throw std::range_error("label too long to prepend"); - if(d_storage.size() + label.size() > maxDNSNameLength - 1) // reserve one byte for the label length + if(d_storage.size() + label.size() > s_maxDNSNameLength - 1) // reserve one byte for the label length throw std::range_error("name too long to prepend"); if(d_storage.empty()) diff --git a/pdns/dnsname.hh b/pdns/dnsname.hh index a8c958da1b..a88c2586e0 100644 --- a/pdns/dnsname.hh +++ b/pdns/dnsname.hh @@ -77,7 +77,7 @@ inline unsigned char dns_tolower(unsigned char c) class DNSName { public: - static const size_t maxDNSNameLength = 255; + static const size_t s_maxDNSNameLength = 255; DNSName() {} //!< Constructs an *empty* DNSName, NOT the root! // Work around assertion in some boost versions that do not like self-assignment of boost::container::string @@ -150,7 +150,7 @@ public: } DNSName& operator+=(const DNSName& rhs) { - if(d_storage.size() + rhs.d_storage.size() > maxDNSNameLength + 1) // one extra byte for the second root label + if(d_storage.size() + rhs.d_storage.size() > s_maxDNSNameLength + 1) // one extra byte for the second root label throwSafeRangeError("resulting name too long", rhs.d_storage.data(), rhs.d_storage.size()); if(rhs.empty()) return *this; -- 2.47.2