laruence Fri, 12 Aug 2011 07:47:03 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=314808
Log: Omitted GCC warning "comparison is always false" Changed paths: U php/php-src/branches/PHP_5_4/ext/ereg/ereg.c U php/php-src/branches/PHP_5_4/ext/ereg/regex/regerror.c U php/php-src/branches/PHP_5_4/ext/standard/var.c U php/php-src/branches/PHP_5_4/main/streams/cast.c U php/php-src/trunk/ext/ereg/ereg.c U php/php-src/trunk/ext/ereg/regex/regerror.c U php/php-src/trunk/ext/ereg/regex.patch U php/php-src/trunk/ext/standard/var.c U php/php-src/trunk/main/streams/cast.c
Modified: php/php-src/branches/PHP_5_4/ext/ereg/ereg.c =================================================================== --- php/php-src/branches/PHP_5_4/ext/ereg/ereg.c 2011-08-12 05:52:24 UTC (rev 314807) +++ php/php-src/branches/PHP_5_4/ext/ereg/ereg.c 2011-08-12 07:47:03 UTC (rev 314808) @@ -474,7 +474,8 @@ if (new_l + 1 > buf_len) { buf_len = 1 + buf_len + 2 * new_l; nbuf = emalloc(buf_len); - strncpy(nbuf, buf, buf_len-1); + strncpy(nbuf, buf, buf_len - 1); + nbuf[buf_len - 1] = '\0'; efree(buf); buf = nbuf; } @@ -486,7 +487,7 @@ walkbuf = &buf[tmp + subs[0].rm_so]; walk = replace; while (*walk) { - if ('\\' == *walk && isdigit(walk[1]) && walk[1] - '0' <= (int)re.re_nsub) { + if ('\\' == *walk && isdigit((unsigned char)walk[1]) && (unsigned char)walk[1] - '0' <= (int)re.re_nsub) { if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1 /* this next case shouldn't happen. it does. */ && subs[walk[1] - '0'].rm_so <= subs[walk[1] - '0'].rm_eo) { Modified: php/php-src/branches/PHP_5_4/ext/ereg/regex/regerror.c =================================================================== --- php/php-src/branches/PHP_5_4/ext/ereg/regex/regerror.c 2011-08-12 05:52:24 UTC (rev 314807) +++ php/php-src/branches/PHP_5_4/ext/ereg/regex/regerror.c 2011-08-12 07:47:03 UTC (rev 314808) @@ -82,10 +82,12 @@ break; if (errcode®_ITOA) { - if (r->code >= 0) - (void) strncpy(convbuf, r->name, 50); - else + if (r->code >= 0) { + (void) strncpy(convbuf, r->name, sizeof(convbuf) - 1); + convbuf[sizeof(convbuf) - 1] = '\0'; + } else { snprintf(convbuf, sizeof(convbuf), "REG_0x%x", target); + } assert(strlen(convbuf) < sizeof(convbuf)); s = convbuf; } else Modified: php/php-src/branches/PHP_5_4/ext/standard/var.c =================================================================== --- php/php-src/branches/PHP_5_4/ext/standard/var.c 2011-08-12 05:52:24 UTC (rev 314807) +++ php/php-src/branches/PHP_5_4/ext/standard/var.c 2011-08-12 07:47:03 UTC (rev 314808) @@ -601,7 +601,7 @@ PHP_SET_CLASS_ATTRIBUTES(struc); smart_str_appendl(buf, "O:", 2); - smart_str_append_long(buf, (long)name_len); + smart_str_append_long(buf, (int)name_len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, class_name, name_len); smart_str_appendl(buf, "\":", 2); @@ -767,12 +767,12 @@ if (ce->serialize(struc, &serialized_data, &serialized_length, (zend_serialize_data *)var_hash TSRMLS_CC) == SUCCESS) { smart_str_appendl(buf, "C:", 2); - smart_str_append_long(buf, (long)Z_OBJCE_P(struc)->name_length); + smart_str_append_long(buf, (int)Z_OBJCE_P(struc)->name_length); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, Z_OBJCE_P(struc)->name, Z_OBJCE_P(struc)->name_length); smart_str_appendl(buf, "\":", 2); - smart_str_append_long(buf, (long)serialized_length); + smart_str_append_long(buf, (int)serialized_length); smart_str_appendl(buf, ":{", 2); smart_str_appendl(buf, serialized_data, serialized_length); smart_str_appendc(buf, '}'); Modified: php/php-src/branches/PHP_5_4/main/streams/cast.c =================================================================== --- php/php-src/branches/PHP_5_4/main/streams/cast.c 2011-08-12 05:52:24 UTC (rev 314807) +++ php/php-src/branches/PHP_5_4/main/streams/cast.c 2011-08-12 07:47:03 UTC (rev 314808) @@ -271,7 +271,7 @@ newstream = php_stream_fopen_tmpfile(); if (newstream) { - int retval = php_stream_copy_to_stream_ex(stream, newstream, PHP_STREAM_COPY_ALL, NULL); + size_t retval = php_stream_copy_to_stream_ex(stream, newstream, PHP_STREAM_COPY_ALL, NULL); if (ret != SUCCESS) { php_stream_close(newstream); Modified: php/php-src/trunk/ext/ereg/ereg.c =================================================================== --- php/php-src/trunk/ext/ereg/ereg.c 2011-08-12 05:52:24 UTC (rev 314807) +++ php/php-src/trunk/ext/ereg/ereg.c 2011-08-12 07:47:03 UTC (rev 314808) @@ -474,7 +474,8 @@ if (new_l + 1 > buf_len) { buf_len = 1 + buf_len + 2 * new_l; nbuf = emalloc(buf_len); - strncpy(nbuf, buf, buf_len-1); + strncpy(nbuf, buf, buf_len - 1); + nbuf[buf_len - 1] = '\0'; efree(buf); buf = nbuf; } @@ -486,7 +487,7 @@ walkbuf = &buf[tmp + subs[0].rm_so]; walk = replace; while (*walk) { - if ('\\' == *walk && isdigit(walk[1]) && walk[1] - '0' <= (int)re.re_nsub) { + if ('\\' == *walk && isdigit((unsigned char)walk[1]) && (unsigned char)walk[1] - '0' <= (int)re.re_nsub) { if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1 /* this next case shouldn't happen. it does. */ && subs[walk[1] - '0'].rm_so <= subs[walk[1] - '0'].rm_eo) { Modified: php/php-src/trunk/ext/ereg/regex/regerror.c =================================================================== --- php/php-src/trunk/ext/ereg/regex/regerror.c 2011-08-12 05:52:24 UTC (rev 314807) +++ php/php-src/trunk/ext/ereg/regex/regerror.c 2011-08-12 07:47:03 UTC (rev 314808) @@ -82,10 +82,12 @@ break; if (errcode®_ITOA) { - if (r->code >= 0) - (void) strncpy(convbuf, r->name, 50); - else + if (r->code >= 0) { + (void) strncpy(convbuf, r->name, sizeof(convbuf) - 1); + convbuf[sizeof(convbuf) - 1] = '\0'; + } else { snprintf(convbuf, sizeof(convbuf), "REG_0x%x", target); + } assert(strlen(convbuf) < sizeof(convbuf)); s = convbuf; } else Modified: php/php-src/trunk/ext/ereg/regex.patch =================================================================== --- php/php-src/trunk/ext/ereg/regex.patch 2011-08-12 05:52:24 UTC (rev 314807) +++ php/php-src/trunk/ext/ereg/regex.patch 2011-08-12 07:47:03 UTC (rev 314808) @@ -1,6 +1,6 @@ diff -u regex.orig/regerror.c regex/regerror.c --- regex.orig/regerror.c 2011-08-09 19:49:30.000000000 +0800 -+++ regex/regerror.c 2011-08-11 15:13:42.000000000 +0800 ++++ regex/regerror.c 2011-08-12 10:45:57.000000000 +0800 @@ -8,6 +8,7 @@ #include "regex.h" #include "utils.h" @@ -9,7 +9,7 @@ /* = #define REG_OKAY 0 -@@ -74,7 +75,7 @@ +@@ -74,17 +75,19 @@ char convbuf[50]; if (errcode == REG_ATOI) @@ -18,19 +18,23 @@ else { for (r = rerrs; r->code >= 0; r++) if (r->code == target) -@@ -82,9 +83,9 @@ + break; if (errcode®_ITOA) { - if (r->code >= 0) +- if (r->code >= 0) - (void) strcpy(convbuf, r->name); -+ (void) strncpy(convbuf, r->name, 50); - else +- else - sprintf(convbuf, "REG_0x%x", target); ++ if (r->code >= 0) { ++ (void) strncpy(convbuf, r->name, sizeof(convbuf) - 1); ++ convbuf[sizeof(convbuf) - 1] = '\0'; ++ } else { + snprintf(convbuf, sizeof(convbuf), "REG_0x%x", target); ++ } assert(strlen(convbuf) < sizeof(convbuf)); s = convbuf; } else -@@ -106,12 +107,13 @@ +@@ -106,12 +109,13 @@ /* - regatoi - internal routine to implement REG_ATOI @@ -46,7 +50,7 @@ { register const struct rerr *r; -@@ -121,6 +123,6 @@ +@@ -121,6 +125,6 @@ if (r->code < 0) return("0"); Modified: php/php-src/trunk/ext/standard/var.c =================================================================== --- php/php-src/trunk/ext/standard/var.c 2011-08-12 05:52:24 UTC (rev 314807) +++ php/php-src/trunk/ext/standard/var.c 2011-08-12 07:47:03 UTC (rev 314808) @@ -601,7 +601,7 @@ PHP_SET_CLASS_ATTRIBUTES(struc); smart_str_appendl(buf, "O:", 2); - smart_str_append_long(buf, (long)name_len); + smart_str_append_long(buf, (int)name_len); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, class_name, name_len); smart_str_appendl(buf, "\":", 2); @@ -767,12 +767,12 @@ if (ce->serialize(struc, &serialized_data, &serialized_length, (zend_serialize_data *)var_hash TSRMLS_CC) == SUCCESS) { smart_str_appendl(buf, "C:", 2); - smart_str_append_long(buf, (long)Z_OBJCE_P(struc)->name_length); + smart_str_append_long(buf, (int)Z_OBJCE_P(struc)->name_length); smart_str_appendl(buf, ":\"", 2); smart_str_appendl(buf, Z_OBJCE_P(struc)->name, Z_OBJCE_P(struc)->name_length); smart_str_appendl(buf, "\":", 2); - smart_str_append_long(buf, (long)serialized_length); + smart_str_append_long(buf, (int)serialized_length); smart_str_appendl(buf, ":{", 2); smart_str_appendl(buf, serialized_data, serialized_length); smart_str_appendc(buf, '}'); Modified: php/php-src/trunk/main/streams/cast.c =================================================================== --- php/php-src/trunk/main/streams/cast.c 2011-08-12 05:52:24 UTC (rev 314807) +++ php/php-src/trunk/main/streams/cast.c 2011-08-12 07:47:03 UTC (rev 314808) @@ -271,7 +271,7 @@ newstream = php_stream_fopen_tmpfile(); if (newstream) { - int retval = php_stream_copy_to_stream_ex(stream, newstream, PHP_STREAM_COPY_ALL, NULL); + size_t retval = php_stream_copy_to_stream_ex(stream, newstream, PHP_STREAM_COPY_ALL, NULL); if (ret != SUCCESS) { php_stream_close(newstream);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php