svn: /php/php-src/branches/PHP_5_3/ ext/ereg/ereg.c ext/ereg/regex/regerror.c ext/mysqlnd/mysqlnd_charset.c ext/standard/var.c main/streams/cast.c
| From: | Xinchen Hui | Date: | Tue, 23 Aug 2011 10:18:48 +0000 |
| Subject: | svn: /php/php-src/branches/PHP_5_3/ ext/ereg/ereg.c ext/ereg/regex/regerror.c ext/mysqlnd/mysqlnd_charset.c ext/standard/var.c main/streams/cast.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-65959@lists.php.net to get a copy of this message | ||
laruence Tue, 23 Aug 2011 10:18:48 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=315356
Log:
Sync r314808 to 5_3 branch
Eliminated compiler warnings "comparison is always false", "cast to pointer from
integer of different siz" and tail zero warnings
Changed paths:
U php/php-src/branches/PHP_5_3/ext/ereg/ereg.c
U php/php-src/branches/PHP_5_3/ext/ereg/regex/regerror.c
U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c
U php/php-src/branches/PHP_5_3/ext/standard/var.c
U php/php-src/branches/PHP_5_3/main/streams/cast.c
Modified: php/php-src/branches/PHP_5_3/ext/ereg/ereg.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/ereg/ereg.c 2011-08-23 10:18:16 UTC (rev 315355)
+++ php/php-src/branches/PHP_5_3/ext/ereg/ereg.c 2011-08-23 10:18:48 UTC (rev 315356)
@@ -475,6 +475,7 @@
buf_len = 1 + buf_len + 2 * new_l;
nbuf = emalloc(buf_len);
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_3/ext/ereg/regex/regerror.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/ereg/regex/regerror.c 2011-08-23 10:18:16 UTC (rev 315355)
+++ php/php-src/branches/PHP_5_3/ext/ereg/regex/regerror.c 2011-08-23 10:18:48 UTC (rev 315356)
@@ -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_3/ext/mysqlnd/mysqlnd_charset.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c 2011-08-23 10:18:16 UTC (rev 315355)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c 2011-08-23 10:18:48 UTC (rev 315356)
@@ -125,8 +125,8 @@
if (!((start[1] ^ 0x80) < 0x40 &&
(start[2] ^ 0x80) < 0x40 &&
(start[3] ^ 0x80) < 0x40 &&
- (c >= 0xf1 || start[1] >= 0x90) &&
- (c <= 0xf3 || start[1] <= 0x8F)))
+ (c >= 0xf1 || start[1] >= (char)0x90) &&
+ (c <= 0xf3 || start[1] <= (char)0x8F)))
{
return 0; /* invalid utf8 character */
}
Modified: php/php-src/branches/PHP_5_3/ext/standard/var.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/var.c 2011-08-23 10:18:16 UTC (rev 315355)
+++ php/php-src/branches/PHP_5_3/ext/standard/var.c 2011-08-23 10:18:48 UTC (rev 315356)
@@ -598,7 +598,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);
@@ -764,12 +764,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_3/main/streams/cast.c
===================================================================
--- php/php-src/branches/PHP_5_3/main/streams/cast.c 2011-08-23 10:18:16 UTC (rev 315355)
+++ php/php-src/branches/PHP_5_3/main/streams/cast.c 2011-08-23 10:18:48 UTC (rev 315356)
@@ -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);