summaryrefslogtreecommitdiff
path: root/lib/if2ip.c
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2015-09-26 17:24:34 +0900
committerDaniel Stenberg <daniel@haxx.se>2015-09-26 23:10:20 +0200
commit119037325de02579f5c58256ca2ed2a0aa592c86 (patch)
tree5cab499d5739de106ecb301aebb23dcbb2c65a6a /lib/if2ip.c
parent710bb89cf3f952e731b7bd0b7d301f8b1cd0015c (diff)
downloadcurl-119037325de02579f5c58256ca2ed2a0aa592c86.tar.gz
build: fix failures with -Wcast-align and -Werror
Closes #457
Diffstat (limited to 'lib/if2ip.c')
-rw-r--r--lib/if2ip.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/if2ip.c b/lib/if2ip.c
index 6e6f9692e..0e2d71dbe 100644
--- a/lib/if2ip.c
+++ b/lib/if2ip.c
@@ -68,7 +68,7 @@ unsigned int Curl_ipv6_scope(const struct sockaddr *sa)
(void) sa;
#else
if(sa->sa_family == AF_INET6) {
- const struct sockaddr_in6 * sa6 = (const struct sockaddr_in6 *) sa;
+ const struct sockaddr_in6 * sa6 = (const struct sockaddr_in6 *)(void *) sa;
const unsigned char * b = sa6->sin6_addr.s6_addr;
unsigned short w = (unsigned short) ((b[0] << 8) | b[1]);
@@ -152,11 +152,12 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
continue;
}
- addr = &((struct sockaddr_in6 *)iface->ifa_addr)->sin6_addr;
+ addr =
+ &((struct sockaddr_in6 *)(void *)iface->ifa_addr)->sin6_addr;
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
/* Include the scope of this interface as part of the address */
- scopeid =
- ((struct sockaddr_in6 *)iface->ifa_addr)->sin6_scope_id;
+ scopeid = ((struct sockaddr_in6 *)(void *)iface->ifa_addr)
+ ->sin6_scope_id;
/* If given, scope id should match. */
if(remote_scope_id && scopeid != remote_scope_id) {
@@ -171,7 +172,8 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope,
}
else
#endif
- addr = &((struct sockaddr_in *)iface->ifa_addr)->sin_addr;
+ addr =
+ &((struct sockaddr_in *)(void *)iface->ifa_addr)->sin_addr;
res = IF2IP_FOUND;
ip = (char *) Curl_inet_ntop(af, addr, ipstr, sizeof(ipstr));
snprintf(buf, buf_size, "%s%s", ip, scope);