summaryrefslogtreecommitdiff
path: root/epan/inet_pton.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/inet_pton.c')
-rw-r--r--epan/inet_pton.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/epan/inet_pton.c b/epan/inet_pton.c
index 07d7c1af7c..47df162d96 100644
--- a/epan/inet_pton.c
+++ b/epan/inet_pton.c
@@ -20,17 +20,13 @@
#endif
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$Id: inet_pton.c,v 1.2 2002/06/23 10:32:32 guy Exp $";
+static char rcsid[] = "$Id: inet_pton.c,v 1.3 2002/08/02 21:29:39 jmayer Exp $";
#endif /* LIBC_SCCS and not lint */
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#define EAFNOSUPPORT WSAEAFNOSUPPORT
@@ -40,10 +36,6 @@ static char rcsid[] = "$Id: inet_pton.c,v 1.2 2002/06/23 10:32:32 guy Exp $";
#include <sys/socket.h>
#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
@@ -73,10 +65,10 @@ static char rcsid[] = "$Id: inet_pton.c,v 1.2 2002/06/23 10:32:32 guy Exp $";
*/
#ifdef AF_INET
-static int inet_pton4 __P((const char *src, u_char *dst));
+static int inet_pton4 __P((const char *src, guchar *dst));
#endif
#ifdef AF_INET6
-static int inet_pton6 __P((const char *src, u_char *dst));
+static int inet_pton6 __P((const char *src, guchar *dst));
#endif
/* int
@@ -126,11 +118,11 @@ inet_pton(af, src, dst)
static int
inet_pton4(src, dst)
const char *src;
- u_char *dst;
+ guchar *dst;
{
static const char digits[] = "0123456789";
int saw_digit, octets, ch;
- u_char tmp[NS_INADDRSZ], *tp;
+ guchar tmp[NS_INADDRSZ], *tp;
saw_digit = 0;
octets = 0;
@@ -139,7 +131,7 @@ inet_pton4(src, dst)
const char *pch;
if ((pch = strchr(digits, ch)) != NULL) {
- u_int new = *tp * 10 + (pch - digits);
+ guint new = *tp * 10 + (pch - digits);
if (new > 255)
return (0);
@@ -181,14 +173,14 @@ inet_pton4(src, dst)
static int
inet_pton6(src, dst)
const char *src;
- u_char *dst;
+ guchar *dst;
{
static const char xdigits_l[] = "0123456789abcdef",
xdigits_u[] = "0123456789ABCDEF";
- u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
+ guchar tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
const char *xdigits, *curtok;
int ch, saw_xdigit;
- u_int val;
+ guint val;
memset((tp = tmp), '\0', NS_IN6ADDRSZ);
endp = tp + NS_IN6ADDRSZ;
@@ -225,8 +217,8 @@ inet_pton6(src, dst)
}
if (tp + NS_INT16SZ > endp)
return (0);
- *tp++ = (u_char) (val >> 8) & 0xff;
- *tp++ = (u_char) val & 0xff;
+ *tp++ = (guchar) (val >> 8) & 0xff;
+ *tp++ = (guchar) val & 0xff;
saw_xdigit = 0;
val = 0;
continue;
@@ -242,8 +234,8 @@ inet_pton6(src, dst)
if (saw_xdigit) {
if (tp + NS_INT16SZ > endp)
return (0);
- *tp++ = (u_char) (val >> 8) & 0xff;
- *tp++ = (u_char) val & 0xff;
+ *tp++ = (guchar) (val >> 8) & 0xff;
+ *tp++ = (guchar) val & 0xff;
}
if (colonp != NULL) {
/*