From: Moriyoshi Koizumi Date: Mon, 24 Feb 2003 16:30:14 +0000 (+0000) Subject: MFH(r1.74): fixed an signed / unsigned issue X-Git-Tag: php-4.3.2RC1~124 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ea23f45b36c860230340438450bb0c711e387d40;p=php MFH(r1.74): fixed an signed / unsigned issue --- diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c index 79de4d577e..964fc6db3e 100644 --- a/ext/ereg/ereg.c +++ b/ext/ereg/ereg.c @@ -324,7 +324,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha new_l = strlen(buf) + subs[0].rm_so; /* part before the match */ walk = replace; while (*walk) { - if ('\\' == *walk && isdigit(walk[1]) && walk[1] - '0' <= ((char) re.re_nsub)) { + if ('\\' == *walk && isdigit(walk[1]) && ((unsigned char)walk[1]) - '0' <= re.re_nsub) { if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) { new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so; } diff --git a/ext/standard/reg.c b/ext/standard/reg.c index 79de4d577e..964fc6db3e 100644 --- a/ext/standard/reg.c +++ b/ext/standard/reg.c @@ -324,7 +324,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha new_l = strlen(buf) + subs[0].rm_so; /* part before the match */ walk = replace; while (*walk) { - if ('\\' == *walk && isdigit(walk[1]) && walk[1] - '0' <= ((char) re.re_nsub)) { + if ('\\' == *walk && isdigit(walk[1]) && ((unsigned char)walk[1]) - '0' <= re.re_nsub) { if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) { new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so; }