Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1e707cf authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Resolv: Enable clang-tidy and fix all warnings"

parents 0a847bb4 99cbfd86
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -94,8 +94,7 @@ cc_library {
        "libnetd_client_headers",
        "libnetd_client_headers",
    ],
    ],
    export_include_dirs: ["include"],
    export_include_dirs: ["include"],
    // TODO: pie in the sky: make this code clang-tidy clean

    tidy: false,
    product_variables: {
    product_variables: {
        debuggable: {
        debuggable: {
            cppflags: [
            cppflags: [
+1 −2
Original line number Original line Diff line number Diff line
@@ -37,7 +37,6 @@
#include "netd_resolv/stats.h"
#include "netd_resolv/stats.h"
#include "resolv_cache.h"
#include "resolv_cache.h"


using namespace std::placeholders;
using aidl::android::net::ResolverParamsParcel;
using aidl::android::net::ResolverParamsParcel;


namespace android {
namespace android {
@@ -179,7 +178,7 @@ ResolverController::ResolverController()
              [](uint32_t netId, uint32_t uid, android_net_context* netcontext) {
              [](uint32_t netId, uint32_t uid, android_net_context* netcontext) {
                  gResNetdCallbacks.get_network_context(netId, uid, netcontext);
                  gResNetdCallbacks.get_network_context(netId, uid, netcontext);
              },
              },
              std::bind(sendNat64PrefixEvent, _1)) {}
              std::bind(sendNat64PrefixEvent, std::placeholders::_1)) {}


void ResolverController::destroyNetworkCache(unsigned netId) {
void ResolverController::destroyNetworkCache(unsigned netId) {
    LOG(VERBOSE) << __func__ << ": netId = " << netId;
    LOG(VERBOSE) << __func__ << ": netId = " << netId;
+4 −5
Original line number Original line Diff line number Diff line
@@ -110,8 +110,8 @@ typedef union {
static struct hostent* getanswer(const querybuf*, int, const char*, int, res_state, struct hostent*,
static struct hostent* getanswer(const querybuf*, int, const char*, int, res_state, struct hostent*,
                                 char*, size_t, int*);
                                 char*, size_t, int*);
static void convert_v4v6_hostent(struct hostent* hp, char** bpp, char* ep,
static void convert_v4v6_hostent(struct hostent* hp, char** bpp, char* ep,
                                 std::function<void(struct hostent* hp)> mapping_param,
                                 const std::function<void(struct hostent* hp)>& mapping_param,
                                 std::function<void(char* src, char* dst)> mapping_addr);
                                 const std::function<void(char* src, char* dst)>& mapping_addr);
static void pad_v4v6_hostent(struct hostent* hp, char** bpp, char* ep);
static void pad_v4v6_hostent(struct hostent* hp, char** bpp, char* ep);
static void addrsort(char**, int, res_state);
static void addrsort(char**, int, res_state);


@@ -656,10 +656,9 @@ nospc:
    return NULL;
    return NULL;
}
}



static void convert_v4v6_hostent(struct hostent* hp, char** bpp, char* ep,
static void convert_v4v6_hostent(struct hostent* hp, char** bpp, char* ep,
                                 std::function<void(struct hostent* hp)> map_param,
                                 const std::function<void(struct hostent* hp)>& map_param,
                                 std::function<void(char* src, char* dst)> map_addr) {
                                 const std::function<void(char* src, char* dst)>& map_addr) {
    _DIAGASSERT(hp != NULL);
    _DIAGASSERT(hp != NULL);
    _DIAGASSERT(bpp != NULL);
    _DIAGASSERT(bpp != NULL);
    _DIAGASSERT(ep != NULL);
    _DIAGASSERT(ep != NULL);
+1 −1
Original line number Original line Diff line number Diff line
@@ -906,7 +906,7 @@ struct resolv_cache_info {
// std::unique_lock.
// std::unique_lock.
class SCOPED_CAPABILITY ScopedAssumeLocked {
class SCOPED_CAPABILITY ScopedAssumeLocked {
  public:
  public:
    ScopedAssumeLocked(std::mutex& mutex) ACQUIRE(mutex) {}
    explicit ScopedAssumeLocked(std::mutex& mutex) ACQUIRE(mutex) {}
    ~ScopedAssumeLocked() RELEASE() {}
    ~ScopedAssumeLocked() RELEASE() {}
};
};


+19 −3
Original line number Original line Diff line number Diff line
@@ -113,8 +113,24 @@
#include "stats.pb.h"
#include "stats.pb.h"


// TODO: use the namespace something like android::netd_resolv for libnetd_resolv
// TODO: use the namespace something like android::netd_resolv for libnetd_resolv
using namespace android::net;
using android::net::CacheStatus;
using android::net::DnsQueryEvent;
using android::net::DnsTlsDispatcher;
using android::net::DnsTlsTransport;
using android::net::gPrivateDnsConfiguration;
using android::net::IpVersion;
using android::net::IV_IPV4;
using android::net::IV_IPV6;
using android::net::IV_UNKNOWN;
using android::net::NetworkDnsEventReported;
using android::net::NetworkDnsEventReported;
using android::net::NS_T_INVALID;
using android::net::NsRcode;
using android::net::NsType;
using android::net::PrivateDnsMode;
using android::net::PrivateDnsModes;
using android::net::PrivateDnsStatus;
using android::net::PROTO_TCP;
using android::net::PROTO_UDP;
using android::netdutils::Slice;
using android::netdutils::Slice;
using android::netdutils::Stopwatch;
using android::netdutils::Stopwatch;


@@ -285,7 +301,7 @@ static void res_set_usable_server(int selectedServer, int nscount, bool usable_s
 * author:
 * author:
 *	paul vixie, 29may94
 *	paul vixie, 29may94
 */
 */
static int res_ourserver_p(const res_state statp, const sockaddr* sa) {
static int res_ourserver_p(res_state statp, const sockaddr* sa) {
    const sockaddr_in *inp, *srv;
    const sockaddr_in *inp, *srv;
    const sockaddr_in6 *in6p, *srv6;
    const sockaddr_in6 *in6p, *srv6;
    int ns;
    int ns;
@@ -698,7 +714,7 @@ static struct sockaddr* get_nsaddr(res_state statp, size_t n) {
    }
    }
}
}


static struct timespec get_timeout(const res_state statp, const res_params* params, const int ns) {
static struct timespec get_timeout(res_state statp, const res_params* params, const int ns) {
    int msec;
    int msec;
    // Legacy algorithm which scales the timeout by nameserver number.
    // Legacy algorithm which scales the timeout by nameserver number.
    // For instance, with 4 nameservers: 5s, 2.5s, 5s, 10s
    // For instance, with 4 nameservers: 5s, 2.5s, 5s, 10s