From cc1eaba454145888b15be9537af5b9aea019af96 Mon Sep 17 00:00:00 2001 From: Kalle Sommer Nielsen Date: Tue, 5 Oct 2010 09:40:36 +0000 Subject: [PATCH] Fixed compiler warnings in mysqli - mysqli.c: Fix unused variables, they are only used in non-mysqlnd mode - mysqli_api.c (PHP_5_3 only): Fix constness, add_property_string expects a char *, not a const char * - mysqli_prop.c: Cast to long, as its below the LONG_MAX and therefore safe - mysqli_result_iterator.c: Cast to ulong as the iterator member expects that rather than a my_longlong # In trunk only warnings regarding the zend_property_info # structure is present and PHP_5_3 is warning free now --- ext/mysqli/mysqli.c | 4 ++-- ext/mysqli/mysqli_prop.c | 6 +++--- ext/mysqli/mysqli_result_iterator.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index eabfa2f869..c226bc2f5f 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -1087,12 +1087,12 @@ PHP_FUNCTION(mysqli_result_construct) */ void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, long fetchtype TSRMLS_DC) { +#if !defined(MYSQLI_USE_MYSQLND) MYSQL_ROW row; unsigned int i; MYSQL_FIELD *fields; unsigned long *field_len; - -#if !defined(MYSQLI_USE_MYSQLND) + if (!(row = mysql_fetch_row(result))) { RETURN_NULL(); } diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c index 98b81ee04a..b4535654fb 100644 --- a/ext/mysqli/mysqli_prop.c +++ b/ext/mysqli/mysqli_prop.c @@ -84,7 +84,7 @@ static int __func(mysqli_object *obj, zval **retval TSRMLS_DC) \ } else {\ l = (__ret_type)__int_func(p);\ if (l < LONG_MAX) {\ - ZVAL_LONG(*retval, l);\ + ZVAL_LONG(*retval, (long) l);\ } else { \ char *ret; \ int ret_len = spprintf(&ret, 0, __ret_type_sprint_mod, l); \ @@ -178,7 +178,7 @@ static int link_affected_rows_read(mysqli_object *obj, zval **retval TSRMLS_DC) } if (rc < LONG_MAX) { - ZVAL_LONG(*retval, rc); + ZVAL_LONG(*retval, (long) rc); } else { char *ret; int l = spprintf(&ret, 0, MYSQLI_LLU_SPEC, rc); @@ -295,7 +295,7 @@ static int stmt_affected_rows_read(mysqli_object *obj, zval **retval TSRMLS_DC) } if (rc < LONG_MAX) { - ZVAL_LONG(*retval, rc); + ZVAL_LONG(*retval, (long) rc); } else { char *ret; int l = spprintf(&ret, 0, MYSQLI_LLU_SPEC, rc); diff --git a/ext/mysqli/mysqli_result_iterator.c b/ext/mysqli/mysqli_result_iterator.c index 26323ce3d9..688f6dac8d 100644 --- a/ext/mysqli/mysqli_result_iterator.c +++ b/ext/mysqli/mysqli_result_iterator.c @@ -154,7 +154,7 @@ static int php_mysqli_result_iterator_current_key(zend_object_iterator *iter, ch { php_mysqli_result_iterator *iterator = (php_mysqli_result_iterator*) iter; - *int_key = iterator->row_num; + *int_key = (ulong) iterator->row_num; return HASH_KEY_IS_LONG; } /* }}} */ -- 2.50.1