Fix GCC 4 compiler warning 'dereferencing type-punned pointer might break strict-aliasing rules'.

pull/1/head
Yang Tse 14 years ago
parent 747981be8e
commit 494274e653
  1. 4
      ares_getnameinfo.c
  2. 4
      ares_process.c

@ -366,8 +366,8 @@ static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags,
tmpbuf[0] = '%'; tmpbuf[0] = '%';
#ifdef HAVE_IF_INDEXTONAME #ifdef HAVE_IF_INDEXTONAME
is_ll = IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr); is_ll = IN6_IS_ADDR_LINKLOCAL((void *)&addr6->sin6_addr);
is_mcll = IN6_IS_ADDR_MC_LINKLOCAL(&addr6->sin6_addr); is_mcll = IN6_IS_ADDR_MC_LINKLOCAL((void *)&addr6->sin6_addr);
if ((flags & ARES_NI_NUMERICSCOPE) || if ((flags & ARES_NI_NUMERICSCOPE) ||
(!is_ll && !is_mcll)) (!is_ll && !is_mcll))
{ {

@ -478,7 +478,7 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
else else
fromlen = sizeof(from.sa6); fromlen = sizeof(from.sa6);
count = (ssize_t)recvfrom(server->udp_socket, (void *)buf, sizeof(buf), count = (ssize_t)recvfrom(server->udp_socket, (void *)buf, sizeof(buf),
0, (struct sockaddr *)&from, &fromlen); 0, (void *)&from, &fromlen);
#else #else
count = sread(server->udp_socket, buf, sizeof(buf)); count = sread(server->udp_socket, buf, sizeof(buf));
#endif #endif
@ -487,7 +487,7 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
else if (count <= 0) else if (count <= 0)
handle_error(channel, i, now); handle_error(channel, i, now);
#ifdef HAVE_RECVFROM #ifdef HAVE_RECVFROM
else if (!same_address((struct sockaddr *)&from, &server->addr)) else if (!same_address((void *)&from, &server->addr))
/* The address the response comes from does not match /* The address the response comes from does not match
* the address we sent the request to. Someone may be * the address we sent the request to. Someone may be
* attempting to perform a cache poisoning attack. */ * attempting to perform a cache poisoning attack. */

Loading…
Cancel
Save