]> granicus.if.org Git - php/commitdiff
Fixed compiler warnings in mysqli
authorKalle Sommer Nielsen <kalle@php.net>
Tue, 5 Oct 2010 09:40:36 +0000 (09:40 +0000)
committerKalle Sommer Nielsen <kalle@php.net>
Tue, 5 Oct 2010 09:40:36 +0000 (09:40 +0000)
 - 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
ext/mysqli/mysqli_prop.c
ext/mysqli/mysqli_result_iterator.c

index eabfa2f8691fe5e1ce34095a681ca3bd81512079..c226bc2f5f4e8bc3a1b2d7c9db58f68dda3fa2ee 100644 (file)
@@ -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();
        }
index 98b81ee04a1c056980e5280c8f206511bc7d1b09..b4535654fb7806e8a96e49b4e533cb21d66e539e 100644 (file)
@@ -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);
index 26323ce3d98e19ac2e1c637434d7ccb682265d25..688f6dac8dcf35cfe1d774b476d09965f84d9a09 100644 (file)
@@ -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;
 }
 /* }}} */