From a27b691e2903a886be640db801677f6f988d3793 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 3 Dec 2000 20:45:40 +0000 Subject: Ensure that all uses of functions are applied to unsigned-char values, whether the local char type is signed or not. This is necessary for portability. Per discussion on pghackers around 9/16/00. --- src/backend/port/inet_aton.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/backend/port/inet_aton.c') diff --git a/src/backend/port/inet_aton.c b/src/backend/port/inet_aton.c index 485772619c9..b6cd4974393 100644 --- a/src/backend/port/inet_aton.c +++ b/src/backend/port/inet_aton.c @@ -1,4 +1,4 @@ -/* $Id: inet_aton.c,v 1.17 1999/07/17 04:12:09 momjian Exp $ +/* $Id: inet_aton.c,v 1.18 2000/12/03 20:45:34 tgl Exp $ * * This inet_aton() function was taken from the GNU C library and * incorporated into Postgres for those systems which do not have this @@ -83,16 +83,16 @@ inet_aton(const char *cp, struct in_addr * addr) } while ((c = *cp) != '\0') { - if (isascii(c) && isdigit(c)) + if (isdigit((unsigned char) c)) { val = (val * base) + (c - '0'); cp++; continue; } - if (base == 16 && isascii(c) && isxdigit(c)) + if (base == 16 && isxdigit((unsigned char) c)) { val = (val << 4) + - (c + 10 - (islower(c) ? 'a' : 'A')); + (c + 10 - (islower((unsigned char) c) ? 'a' : 'A')); cp++; continue; } @@ -114,10 +114,11 @@ inet_aton(const char *cp, struct in_addr * addr) } /* - * Check for trailing characters. + * Check for trailing junk. */ - if (*cp && (!isascii(*cp) || !isspace(*cp))) - return 0; + while (*cp) + if (!isspace((unsigned char) *cp++)) + return 0; /* * Concoct the address according to the number of parts specified. -- cgit v1.2.3