summaryrefslogtreecommitdiffstats
path: root/Source/CTest/Curl
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-10-11 14:40:12 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-10-11 14:40:12 (GMT)
commit4b7f37159314d80321025bc44950e6f623d9cdea (patch)
treefdb8c1737be8af3ea3262fa998bad52d25eb7f37 /Source/CTest/Curl
parent47333c91135e8b67674252748a19c9f3992d50b8 (diff)
downloadCMake-4b7f37159314d80321025bc44950e6f623d9cdea.zip
CMake-4b7f37159314d80321025bc44950e6f623d9cdea.tar.gz
CMake-4b7f37159314d80321025bc44950e6f623d9cdea.tar.bz2
COMP: Remove alignment warning
Diffstat (limited to 'Source/CTest/Curl')
-rw-r--r--Source/CTest/Curl/hostip.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/Source/CTest/Curl/hostip.c b/Source/CTest/Curl/hostip.c
index 118bdac..e09b565 100644
--- a/Source/CTest/Curl/hostip.c
+++ b/Source/CTest/Curl/hostip.c
@@ -178,6 +178,16 @@ int Curl_num_addresses(const Curl_addrinfo *addr)
return i;
}
+#define GET_SIN_ADDR_FROM_CURL_ADDRINFO(ai_addr, si, sin, sinaddr, ip) \
+ { \
+ union { \
+ struct si* vsi; \
+ struct sin* vsin;\
+ } vi; \
+ vi.vsi = ai_addr; \
+ ip = &(vi.vsin->sinaddr); \
+ }
+
/*
* Curl_printable_address() returns a printable version of the 1st address
* given in the 'ip' argument. The result will be stored in the buf that is
@@ -188,13 +198,17 @@ int Curl_num_addresses(const Curl_addrinfo *addr)
const char *Curl_printable_address(const Curl_addrinfo *ip,
char *buf, size_t bufsize)
{
- const void *ip4 = &((const struct sockaddr_in*)ip->ai_addr)->sin_addr;
int af = ip->ai_family;
+ const void *ip4;
#ifdef CURLRES_IPV6
- const void *ip6 = &((const struct sockaddr_in6*)ip->ai_addr)->sin6_addr;
+ const void *ip6;
+ GET_SIN_ADDR_FROM_CURL_ADDRINFO(ip->ai_addr, sockaddr, sockaddr_in6,
+ sin6_addr, ip6);
#else
const void *ip6 = NULL;
#endif
+ GET_SIN_ADDR_FROM_CURL_ADDRINFO(ip->ai_addr, sockaddr, sockaddr_in,
+ sin_addr, ip4);
return Curl_inet_ntop(af, af == AF_INET ? ip4 : ip6, buf, bufsize);
}