* Structure of an IEEE EUI-64.
*/
struct eui64 {
- u_char octet[EUI64_LEN];
+ uint8_t octet[EUI64_LEN];
};
int eui64_aton(const char *a, struct eui64 *e);
#if HAVE_NETDB_H
#include <netdb.h>
#endif
-#if _SQUID_MSWIN_
-#undef IN_ADDR
-#include <ws2tcpip.h>
-#endif
static struct addrinfo *
dup_addrinfo (struct addrinfo *info, void *addr, size_t addrlen) {
return (*res == NULL) ? EAI_MEMORY : 0;
}
+#if HAVE_H_ERRNO
h_errno = 0;
+#endif
errno = 0;
hp = gethostbyname(nodename);
if (hp == NULL) {
/* Convert error return from getaddrinfo() to string */
SQUIDCEXTERN const char *xgai_strerror (int code);
+#if !defined(gai_strerror)
#define gai_strerror xgai_strerror
+#endif
#endif /* HAVE_GETADDRINFO */
#endif /* _getaddrinfo_h */
*
* 28-Oct-2007: drop some dead code. now tested working without.
*
+ * 04-Nov-2010: drop SPRINTF casting macro
+ *
* Squid CVS $Id$
*
* Original License and code follows.
#include <string.h>
#endif
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) ((size_t)sprintf x)
-#endif
-
#if ! defined(NS_INADDRSZ)
#define NS_INADDRSZ 4
#endif
static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"];
- if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) >= size) {
+ if (snprintf(tmp, min(sizeof("255.255.255.255"),size), fmt, src[0], src[1], src[2], src[3]) >= size) {
errno = ENOSPC;
return (NULL);
}
tp += strlen(tp);
break;
}
- tp += SPRINTF((tp, "%x", words[i]));
+ tp += snprintf(tp, (tmp + sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") - tp), "%x", words[i]);
}
/* Was it a trailing run of 0x00's? */
if (best.base != -1 && (best.base + best.len) ==