Untabify.
[obnox/wireshark/wip.git] / inet_pton.c
index eb52c31c7c27d54b9baa52fadbdd26fd4515343d..bfa2535f3e0b74e8c6680ace446028a2a1bdb997 100644 (file)
@@ -1,6 +1,8 @@
 /*
  * Copyright (c) 1996,1999 by Internet Software Consortium.
  *
+ * $Id$
+ *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
 #include "config.h"
 #endif
 
-#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$Id$";
-#endif /* LIBC_SCCS and not lint */
-
 #ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
 #endif
@@ -36,9 +34,11 @@ static char rcsid[] = "$Id$";
 #endif
 
 #ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>          /* needed to define AF_ values on Windows */
+#include <winsock2.h>  /* needed to define AF_ values on Windows */
+#if _MSC_VER < 1600    /* errno.h defines EAFNOSUPPORT in Windows VC10 (and presumably eventually in VC11 ...) */
 #define EAFNOSUPPORT    WSAEAFNOSUPPORT
 #endif
+#endif
 
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
@@ -139,11 +139,11 @@ inet_pton4(src, dst)
                const char *pch;
 
                if ((pch = strchr(digits, ch)) != NULL) {
-                       u_int new = *tp * 10 + (pch - digits);
+                       size_t new = *tp * 10 + (pch - digits);
 
                        if (new > 255)
                                return (0);
-                       *tp = new;
+                       *tp = (u_char) new;
                        if (! saw_digit) {
                                if (++octets > 4)
                                        return (0);
@@ -250,7 +250,7 @@ inet_pton6(src, dst)
                 * Since some memmove()'s erroneously fail to handle
                 * overlapping regions, we'll do the shift by hand.
                 */
-               const int n = tp - colonp;
+               const int n = (int) (tp - colonp);
                int i;
 
                if (tp == endp)