Skip to content

Commit

Permalink
Fixed compiler warnings in mysqli
Browse files Browse the repository at this point in the history
 - 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
  • Loading branch information
KalleZ committed Oct 5, 2010
1 parent df2261d commit 87edd14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions ext/mysqli/mysqli_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,11 +1047,11 @@ PHP_FUNCTION(mysqli_stmt_fetch)
/* {{{ php_add_field_properties */
static void php_add_field_properties(zval *value, const MYSQL_FIELD *field TSRMLS_DC)
{
add_property_string(value, "name",(field->name ? field->name : ""), 1);
add_property_string(value, "orgname",(field->org_name ? field->org_name : ""), 1);
add_property_string(value, "table",(field->table ? field->table : ""), 1);
add_property_string(value, "orgtable",(field->org_table ? field->org_table : ""), 1);
add_property_string(value, "def",(field->def ? field->def : ""), 1);
add_property_string(value, "name", (char *) (field->name ? field->name : ""), 1);
add_property_string(value, "orgname", (char *) (field->org_name ? field->org_name : ""), 1);
add_property_string(value, "table", (char *) (field->table ? field->table : ""), 1);
add_property_string(value, "orgtable", (char *) (field->org_table ? field->org_table : ""), 1);
add_property_string(value, "def", (field->def ? field->def : ""), 1);

add_property_long(value, "max_length", field->max_length);
add_property_long(value, "length", field->length);
Expand Down
6 changes: 3 additions & 3 deletions ext/mysqli/mysqli_prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 87edd14

Please sign in to comment.