From: Otto Moerbeek Date: Tue, 14 Jan 2025 15:20:36 +0000 (+0100) Subject: Tidy X-Git-Tag: dnsdist-2.0.0-alpha1~162^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7d8b8aa6a0f43b848a2a6eabd04aae402ded8c8c;p=thirdparty%2Fpdns.git Tidy --- diff --git a/pdns/ednssubnet.cc b/pdns/ednssubnet.cc index a4c3e28d2a..279274cd9f 100644 --- a/pdns/ednssubnet.cc +++ b/pdns/ednssubnet.cc @@ -19,11 +19,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifdef HAVE_CONFIG_H + #include "config.h" -#endif + #include "ednssubnet.hh" -#include "dns.hh" namespace { @@ -36,11 +35,11 @@ struct EDNSSubnetOptsWire } -bool getEDNSSubnetOptsFromString(const string& options, EDNSSubnetOpts* eso) +bool getEDNSSubnetOptsFromString(const std::string& options, EDNSSubnetOpts* eso) { - // cerr<<"options.size:"< 0 ? (((esow.sourceMask - 1) >> 3) + 1) : 0; - // cerr<<"octetsin:"<(&esow), sizeof(esow)); int octetsout = ((esow.sourceMask - 1) >> 3) + 1; ComboAddress src = eso.source.getNetwork(); src.truncate(esow.sourceMask); if (family == htons(1)) { - ret.append((const char*)&src.sin4.sin_addr.s_addr, octetsout); // NOLINT(cppcoreguidelines-pro-type-cstyle-cast) + ret.append(reinterpret_cast(&src.sin4.sin_addr.s_addr), octetsout); } else { - ret.append((const char*)&src.sin6.sin6_addr.s6_addr, octetsout); // NOLINT(cppcoreguidelines-pro-type-cstyle-cast) + ret.append(reinterpret_cast(&src.sin6.sin6_addr.s6_addr), octetsout); } + // NOLINTEND(cppcoreguidelines-pro-type-reinterpret-cast) return ret; } diff --git a/pdns/ednssubnet.hh b/pdns/ednssubnet.hh index 19beb03186..7b85d302b2 100644 --- a/pdns/ednssubnet.hh +++ b/pdns/ednssubnet.hh @@ -20,9 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once -#include "namespaces.hh" + #include "iputils.hh" -#include "dnsname.hh" struct EDNSSubnetOpts { @@ -30,6 +29,6 @@ struct EDNSSubnetOpts Netmask scope; }; -bool getEDNSSubnetOptsFromString(const string& options, EDNSSubnetOpts* eso); +bool getEDNSSubnetOptsFromString(const std::string& options, EDNSSubnetOpts* eso); bool getEDNSSubnetOptsFromString(const char* options, unsigned int len, EDNSSubnetOpts* eso); -string makeEDNSSubnetOptsString(const EDNSSubnetOpts& eso); +std::string makeEDNSSubnetOptsString(const EDNSSubnetOpts& eso);