cvs: php4(PHP_4_3) /ext/standard strnatcmp.c

From: Date: Wed, 16 Apr 2003 21:11:04 +0000
Subject: cvs: php4(PHP_4_3) /ext/standard strnatcmp.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-20339@lists.php.net to get a copy of this message
moriyoshi Wed Apr 16 17:11:04 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/standard strnatcmp.c Log: MFH(r-1.9): fixed bug #19795 Index: php4/ext/standard/strnatcmp.c diff -u php4/ext/standard/strnatcmp.c:1.8 php4/ext/standard/strnatcmp.c:1.8.4.1 --- php4/ext/standard/strnatcmp.c:1.8 Sat May 4 13:36:58 2002 +++ php4/ext/standard/strnatcmp.c Wed Apr 16 17:11:04 2003 @@ -38,7 +38,7 @@ #if 0 static char const *version UNUSED = - "$Id: strnatcmp.c,v 1.8 2002/05/04 17:36:58 sas Exp $"; + "$Id: strnatcmp.c,v 1.8.4.1 2003/04/16 21:11:04 moriyoshi Exp $"; #endif /* {{{ compare_right */ @@ -52,12 +52,12 @@ both numbers to know that they have the same magnitude, so we remember it in BIAS. */ for(;; (*a)++, (*b)++) { - if ((*a == aend || !isdigit((int)**a)) && - (*b == bend || !isdigit((int)**b))) + if ((*a == aend || !isdigit((int)(unsigned char)**a)) && + (*b == bend || !isdigit((int)(unsigned char)**b))) return bias; - else if (*a == aend || !isdigit((int)**a)) + else if (*a == aend || !isdigit((int)(unsigned char)**a)) return -1; - else if (*b == bend || !isdigit((int)**b)) + else if (*b == bend || !isdigit((int)(unsigned char)**b)) return +1; else if (**a < **b) { if (!bias) @@ -80,12 +80,12 @@ /* Compare two left-aligned numbers: the first to have a different value wins. */ for(;; (*a)++, (*b)++) { - if ((*a == aend || !isdigit((int)**a)) && - (*b == bend || !isdigit((int)**b))) + if ((*a == aend || !isdigit((int)(unsigned char)**a)) && + (*b == bend || !isdigit((int)(unsigned char)**b))) return 0; - else if (*a == aend || !isdigit((int)**a)) + else if (*a == aend || !isdigit((int)(unsigned char)**a)) return -1; - else if (*b == bend || !isdigit((int)**b)) + else if (*b == bend || !isdigit((int)(unsigned char)**b)) return +1; else if (**a < **b) return -1; @@ -116,14 +116,14 @@ ca = *ap; cb = *bp; /* skip over leading spaces or zeros */ - while (isspace((int)ca)) + while (isspace((int)(unsigned char)ca)) ca = *++ap; - while (isspace((int)cb)) + while (isspace((int)(unsigned char)cb)) cb = *++bp; /* process run of digits */ - if (isdigit((int)ca) && isdigit((int)cb)) { + if (isdigit((int)(unsigned char)ca) && isdigit((int)(unsigned char)cb)) { fractional = (ca == '0' || cb == '0'); if (fractional) @@ -143,8 +143,8 @@ } if (fold_case) { - ca = toupper(ca); - cb = toupper(cb); + ca = toupper((int)(unsigned char)ca); + cb = toupper((int)(unsigned char)cb); } if (ca < cb)

« previous php.cvs (#20339) next »