From 7ea18a83b37623611bb81b3d0efddd6d781644e0 Mon Sep 17 00:00:00 2001 From: Brad House Date: Thu, 20 Jun 2024 15:10:35 -0400 Subject: [PATCH] test: clean up some minor warnings --- test/ares-test-internal.cc | 2 +- test/ares-test-mock-et.cc | 1 + test/ares-test.cc | 10 +++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/test/ares-test-internal.cc b/test/ares-test-internal.cc index d0e7f282..438a4b14 100644 --- a/test/ares-test-internal.cc +++ b/test/ares-test-internal.cc @@ -736,7 +736,7 @@ TEST_F(LibraryTest, DNSRecord) { ares__buf_append_str(printmsg, ares_dns_section_tostr((ares_dns_section_t)i)); ares__buf_append_str(printmsg, " SECTION:\n"); for (size_t j = 0; j < ares_dns_record_rr_cnt(dnsrec, (ares_dns_section_t)i); j++) { - const ares_dns_rr_t *rr = ares_dns_record_rr_get(dnsrec, (ares_dns_section_t)i, j); + rr = ares_dns_record_rr_get(dnsrec, (ares_dns_section_t)i, j); ares__buf_append_str(printmsg, ares_dns_rr_get_name(rr)); ares__buf_append_str(printmsg, ".\t\t\t"); ares__buf_append_str(printmsg, ares_dns_class_tostr(ares_dns_rr_get_class(rr))); diff --git a/test/ares-test-mock-et.cc b/test/ares-test-mock-et.cc index 8a3690e5..32e1144a 100644 --- a/test/ares-test-mock-et.cc +++ b/test/ares-test-mock-et.cc @@ -142,6 +142,7 @@ TEST_P(MockUDPEventThreadTest, TruncationRetry) { static int sock_cb_count = 0; static int SocketConnectCallback(ares_socket_t fd, int type, void *data) { int rc = *(int*)data; + (void)type; if (verbose) std::cerr << "SocketConnectCallback(" << fd << ") invoked" << std::endl; sock_cb_count++; return rc; diff --git a/test/ares-test.cc b/test/ares-test.cc index c4498f05..c889a340 100644 --- a/test/ares-test.cc +++ b/test/ares-test.cc @@ -600,7 +600,7 @@ void MockServer::ProcessFD(ares_socket_t fd) { } if (fd == tcpfd_) { ares_socket_t connfd = accept(tcpfd_, NULL, NULL); - if (connfd < 0) { + if (connfd == ARES_SOCKET_BAD) { std::cerr << "Error accepting connection on fd " << fd << std::endl; } else { connfds_.insert(connfd); @@ -1034,7 +1034,10 @@ std::ostream& operator<<(std::ostream& os, const AddrInfo& ai) { if(next_cname->name) { os << next_cname->name; } - if((next_cname = next_cname->next)) + + next_cname = next_cname->next; + + if (next_cname != NULL) os << ", "; else os << " "; @@ -1063,7 +1066,8 @@ std::ostream& operator<<(std::ostream& os, const AddrInfo& ai) { os << ":" << port; } os << "]"; - if((next = next->ai_next)) + next = next->ai_next; + if (next != NULL) os << ", "; } os << '}';