From 9f0a97000861fbb0fb72e54ea55d7f7b31b9d7de Mon Sep 17 00:00:00 2001 From: Brad House Date: Tue, 26 Mar 2024 20:24:11 -0400 Subject: [PATCH] sonarcloud: clean up some minor codesmells --- src/lib/ares_getaddrinfo.c | 8 ++++---- src/lib/ares_gethostbyaddr.c | 6 +++--- src/lib/ares_query.c | 4 ++-- src/lib/ares_search.c | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/lib/ares_getaddrinfo.c b/src/lib/ares_getaddrinfo.c index df327aa4..38349857 100644 --- a/src/lib/ares_getaddrinfo.c +++ b/src/lib/ares_getaddrinfo.c @@ -492,7 +492,7 @@ static void host_callback(void *arg, ares_status_t status, size_t timeouts, { struct host_query *hquery = (struct host_query *)arg; ares_status_t addinfostatus = ARES_SUCCESS; - hquery->timeouts += (size_t)timeouts; + hquery->timeouts += timeouts; hquery->remaining--; if (status == ARES_SUCCESS) { @@ -512,7 +512,7 @@ static void host_callback(void *arg, ares_status_t status, size_t timeouts, /* must make sure we don't do next_lookup() on destroy or cancel, * and return the appropriate status. We won't return a partial * result in this case. */ - end_hquery(hquery, (ares_status_t)status); + end_hquery(hquery, status); } else if (addinfostatus != ARES_SUCCESS && addinfostatus != ARES_ENODATA) { /* error in parsing result e.g. no memory */ if (addinfostatus == ARES_EBADRESP && hquery->ai->nodes) { @@ -531,9 +531,9 @@ static void host_callback(void *arg, ares_status_t status, size_t timeouts, hquery->nodata_cnt++; } next_lookup(hquery, - hquery->nodata_cnt ? ARES_ENODATA : (ares_status_t)status); + hquery->nodata_cnt ? ARES_ENODATA : status); } else { - end_hquery(hquery, (ares_status_t)status); + end_hquery(hquery, status); } } diff --git a/src/lib/ares_gethostbyaddr.c b/src/lib/ares_gethostbyaddr.c index 72376994..1953c151 100644 --- a/src/lib/ares_gethostbyaddr.c +++ b/src/lib/ares_gethostbyaddr.c @@ -168,7 +168,7 @@ static void addr_callback(void *arg, ares_status_t status, size_t timeouts, struct hostent *host; size_t addrlen; - aquery->timeouts += (size_t)timeouts; + aquery->timeouts += timeouts; if (status == ARES_SUCCESS) { if (aquery->addr.family == AF_INET) { addrlen = sizeof(aquery->addr.addr.addr4); @@ -179,9 +179,9 @@ static void addr_callback(void *arg, ares_status_t status, size_t timeouts, status = ares_parse_ptr_reply_dnsrec(dnsrec, &aquery->addr.addr.addr6, (int)addrlen, AF_INET6, &host); } - end_aquery(aquery, (ares_status_t)status, host); + end_aquery(aquery, status, host); } else if (status == ARES_EDESTRUCTION || status == ARES_ECANCELLED) { - end_aquery(aquery, (ares_status_t)status, NULL); + end_aquery(aquery, status, NULL); } else { next_lookup(aquery); } diff --git a/src/lib/ares_query.c b/src/lib/ares_query.c index f56c2d9c..b51e7765 100644 --- a/src/lib/ares_query.c +++ b/src/lib/ares_query.c @@ -88,8 +88,8 @@ static ares_status_t ares_query_int(ares_channel_t *channel, const char *name, } status = ares_dns_record_create_query(&dnsrec, name, - (ares_dns_class_t)dnsclass, - (ares_dns_rec_type_t)type, + dnsclass, + type, 0, flags, (size_t)(channel->flags & ARES_FLAG_EDNS)?channel->ednspsz : 0); if (status != ARES_SUCCESS) { diff --git a/src/lib/ares_search.c b/src/lib/ares_search.c index e5fd709d..d40941a0 100644 --- a/src/lib/ares_search.c +++ b/src/lib/ares_search.c @@ -116,7 +116,7 @@ static void search_callback(void *arg, ares_status_t status, size_t timeouts, ares_status_t mystatus; ares_bool_t skip_cleanup = ARES_FALSE; - squery->timeouts += (size_t)timeouts; + squery->timeouts += timeouts; if (status != ARES_SUCCESS) { end_squery(squery, status, dnsrec); @@ -287,7 +287,7 @@ done: } static ares_status_t ares_search_int(ares_channel_t *channel, - ares_dns_record_t *dnsrec, + const ares_dns_record_t *dnsrec, ares_callback_dnsrec callback, void *arg) { struct search_query *squery = NULL;