test: clean up some minor warnings

pull/794/head
Brad House 5 months ago
parent 8cded20f3a
commit 7ea18a83b3
  1. 2
      test/ares-test-internal.cc
  2. 1
      test/ares-test-mock-et.cc
  3. 10
      test/ares-test.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, ares_dns_section_tostr((ares_dns_section_t)i));
ares__buf_append_str(printmsg, " SECTION:\n"); 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++) { 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, ares_dns_rr_get_name(rr));
ares__buf_append_str(printmsg, ".\t\t\t"); ares__buf_append_str(printmsg, ".\t\t\t");
ares__buf_append_str(printmsg, ares_dns_class_tostr(ares_dns_rr_get_class(rr))); ares__buf_append_str(printmsg, ares_dns_class_tostr(ares_dns_rr_get_class(rr)));

@ -142,6 +142,7 @@ TEST_P(MockUDPEventThreadTest, TruncationRetry) {
static int sock_cb_count = 0; static int sock_cb_count = 0;
static int SocketConnectCallback(ares_socket_t fd, int type, void *data) { static int SocketConnectCallback(ares_socket_t fd, int type, void *data) {
int rc = *(int*)data; int rc = *(int*)data;
(void)type;
if (verbose) std::cerr << "SocketConnectCallback(" << fd << ") invoked" << std::endl; if (verbose) std::cerr << "SocketConnectCallback(" << fd << ") invoked" << std::endl;
sock_cb_count++; sock_cb_count++;
return rc; return rc;

10
test/ares-test.cc vendored

@ -600,7 +600,7 @@ void MockServer::ProcessFD(ares_socket_t fd) {
} }
if (fd == tcpfd_) { if (fd == tcpfd_) {
ares_socket_t connfd = accept(tcpfd_, NULL, NULL); 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; std::cerr << "Error accepting connection on fd " << fd << std::endl;
} else { } else {
connfds_.insert(connfd); connfds_.insert(connfd);
@ -1034,7 +1034,10 @@ std::ostream& operator<<(std::ostream& os, const AddrInfo& ai) {
if(next_cname->name) { if(next_cname->name) {
os << next_cname->name; os << next_cname->name;
} }
if((next_cname = next_cname->next))
next_cname = next_cname->next;
if (next_cname != NULL)
os << ", "; os << ", ";
else else
os << " "; os << " ";
@ -1063,7 +1066,8 @@ std::ostream& operator<<(std::ostream& os, const AddrInfo& ai) {
os << ":" << port; os << ":" << port;
} }
os << "]"; os << "]";
if((next = next->ai_next)) next = next->ai_next;
if (next != NULL)
os << ", "; os << ", ";
} }
os << '}'; os << '}';

Loading…
Cancel
Save