sonarcloud: clean up some minor codesmells

pull/733/head
Brad House 8 months ago
parent 5fd3fc3ab3
commit 9f0a970008
  1. 8
      src/lib/ares_getaddrinfo.c
  2. 6
      src/lib/ares_gethostbyaddr.c
  3. 4
      src/lib/ares_query.c
  4. 4
      src/lib/ares_search.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);
}
}

@ -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);
}

@ -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) {

@ -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;

Loading…
Cancel
Save