options->timeout = channel->timeout;
options->tries = channel->tries;
options->ndots = channel->ndots;
- options->udp_port = (unsigned short)ntohs(channel->udp_port);
- options->tcp_port = (unsigned short)ntohs(channel->tcp_port);
+ options->udp_port = ntohs(aresx_sitous(channel->udp_port));
+ options->tcp_port = ntohs(aresx_sitous(channel->tcp_port));
options->sock_state_cb = channel->sock_state_cb;
options->sock_state_cb_data = channel->sock_state_cb_data;
-/* Copyright (C) 2010-2011 by Daniel Stenberg
+/* Copyright (C) 2010-2012 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
#endif
}
+/*
+** signed int to unsigned short
+*/
+
+unsigned short aresx_sitous(int sinum)
+{
+#ifdef __INTEL_COMPILER
+# pragma warning(push)
+# pragma warning(disable:810) /* conversion may lose significant bits */
+#endif
+
+ DEBUGASSERT(sinum >= 0);
+ return (unsigned short)(sinum & (int) CARES_MASK_USHORT);
+
+#ifdef __INTEL_COMPILER
+# pragma warning(pop)
+#endif
+}
+
#if defined(__INTEL_COMPILER) && defined(__unix__)
int aresx_FD_ISSET(int fd, fd_set *fdset)
#define HEADER_CARES_NOWARN_H
-/* Copyright (C) 2010-2011 by Daniel Stenberg
+/* Copyright (C) 2010-2012 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
unsigned int aresx_sztoui(ssize_t sznum);
+unsigned short aresx_sitous(int sinum);
+
#if defined(__INTEL_COMPILER) && defined(__unix__)
int aresx_FD_ISSET(int fd, fd_set *fdset);
/* Copyright 1998 by the Massachusetts Institute of Technology.
- * Copyright (C) 2004-2011 by Daniel Stenberg
+ * Copyright (C) 2004-2012 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
salen = sizeof(saddr.sa4);
memset(sa, 0, salen);
saddr.sa4.sin_family = AF_INET;
- saddr.sa4.sin_port = (unsigned short)(channel->tcp_port & 0xffff);
+ saddr.sa4.sin_port = aresx_sitous(channel->tcp_port);
memcpy(&saddr.sa4.sin_addr, &server->addr.addrV4,
sizeof(server->addr.addrV4));
break;
salen = sizeof(saddr.sa6);
memset(sa, 0, salen);
saddr.sa6.sin6_family = AF_INET6;
- saddr.sa6.sin6_port = (unsigned short)(channel->tcp_port & 0xffff);
+ saddr.sa6.sin6_port = aresx_sitous(channel->tcp_port);
memcpy(&saddr.sa6.sin6_addr, &server->addr.addrV6,
sizeof(server->addr.addrV6));
break;
salen = sizeof(saddr.sa4);
memset(sa, 0, salen);
saddr.sa4.sin_family = AF_INET;
- saddr.sa4.sin_port = (unsigned short)(channel->udp_port & 0xffff);
+ saddr.sa4.sin_port = aresx_sitous(channel->udp_port);
memcpy(&saddr.sa4.sin_addr, &server->addr.addrV4,
sizeof(server->addr.addrV4));
break;
salen = sizeof(saddr.sa6);
memset(sa, 0, salen);
saddr.sa6.sin6_family = AF_INET6;
- saddr.sa6.sin6_port = (unsigned short)(channel->udp_port & 0xffff);
+ saddr.sa6.sin6_port = aresx_sitous(channel->udp_port);
memcpy(&saddr.sa6.sin6_addr, &server->addr.addrV6,
sizeof(server->addr.addrV6));
break;