andrey Mon, 04 Oct 2010 14:12:31 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=304023
Log:
add some safe casts - lower the number of warnings by 2
Changed paths:
U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
U php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c
Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c 2010-10-04
14:06:53 UTC (rev 304022)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c 2010-10-04
14:12:31 UTC (rev 304023)
@@ -84,7 +84,7 @@
#endif /* #if SIZEOF_LONG==4 */
{
if (byte_count < 8 || uval <= L64(9223372036854775807))
{
- ZVAL_LONG(zv, uval);
+ ZVAL_LONG(zv, (long) uval); /* the cast is
safe, we are in the range */
} else {
DBG_INF("stringify");
tmp_len = sprintf((char *)&tmp,
MYSQLND_LLU_SPEC, uval);
@@ -112,7 +112,7 @@
} else
#endif /* SIZEOF */
{
- ZVAL_LONG(zv, lval);
+ ZVAL_LONG(zv, (long) lval); /* the cast is safe, we are
in the range */
}
}
Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c 2010-10-04 14:06:53 UTC
(rev 304022)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c 2010-10-04 14:12:31 UTC
(rev 304023)
@@ -84,7 +84,7 @@
#endif /* #if SIZEOF_LONG==4 */
{
if (byte_count < 8 || uval <= L64(9223372036854775807))
{
- ZVAL_LONG(zv, uval);
+ ZVAL_LONG(zv, (long) uval); /* the cast is
safe, we are in the range */
} else {
DBG_INF("stringify");
tmp_len = sprintf((char *)&tmp,
MYSQLND_LLU_SPEC, uval);
@@ -112,7 +112,7 @@
} else
#endif /* SIZEOF */
{
- ZVAL_LONG(zv, lval);
+ ZVAL_LONG(zv, (long) lval); /* the cast is safe, we are
in the range */
}
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php