add some safe casts - lower the number of warnings by 2
authorAndrey Hristov <andrey@php.net>
Mon, 4 Oct 2010 14:12:31 +0000 (14:12 +0000)
committerAndrey Hristov <andrey@php.net>
Mon, 4 Oct 2010 14:12:31 +0000 (14:12 +0000)
ext/mysqlnd/mysqlnd_ps_codec.c

index e2fc9b62d7050aeac2bd55dfee279a4c52fb579a..b95d6f00dfe02f869f2ae569cf67bafc6e4040ec 100644 (file)
@@ -84,7 +84,7 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
 #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 @@ void ps_fetch_from_1_to_8_bytes(zval *zv, const MYSQLND_FIELD * const field,
                } else
 #endif /* SIZEOF */
                {
-                       ZVAL_LONG(zv, lval);
+                       ZVAL_LONG(zv, (long) lval); /* the cast is safe, we are in the range */
                }
        }