From: Axel Viala Date: Thu, 6 Oct 2022 11:33:02 +0000 (+0200) Subject: [clang-tidy:array] in dnsparser.cc use std::array. X-Git-Tag: dnsdist-1.8.0-rc1~140^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=533493b2b7d214bde30742e4f8218a6b0ff281f3;p=thirdparty%2Fpdns.git [clang-tidy:array] in dnsparser.cc use std::array. Review by @omoerbeek: Fix size inconsistancy. --- diff --git a/pdns/dnsparser.cc b/pdns/dnsparser.cc index 242c9aa48a..1da2232422 100644 --- a/pdns/dnsparser.cc +++ b/pdns/dnsparser.cc @@ -96,8 +96,8 @@ shared_ptr DNSRecordContent::deserialize(const DNSName& qname, memcpy(&packet[0], &dnsheader, sizeof(dnsheader)); pos+=sizeof(dnsheader); - char tmp[6]="\x0" "\x0\x1" "\x0\x1"; // root question for ns_t_a - memcpy(&packet[pos], &tmp, 5); pos+=5; + constexpr std::array tmp= {'\x0', '\x0', '\x1', '\x0', '\x1' }; // root question for ns_t_a + memcpy(&packet[pos], tmp.data(), tmp.size()); pos += tmp.size(); memcpy(&packet[pos], encoded.c_str(), encoded.size()); pos+=(uint16_t)encoded.size();