MFH: Fix compiler warnings in ext/mysql, ext/mysqli and ext/pdo_mysql

This commit is contained in:
Kalle Sommer Nielsen 2009-05-20 08:30:12 +00:00
parent 31a1dbe2df
commit f02ebe4a08
4 changed files with 28 additions and 27 deletions

View file

@ -1166,7 +1166,7 @@ PHP_FUNCTION(mysql_thread_id)
}
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id, "MySQL-Link", le_link, le_plink);
RETURN_LONG(mysql_thread_id(mysql->conn));
RETURN_LONG((long) mysql_thread_id(mysql->conn));
}
/* }}} */

View file

@ -158,7 +158,7 @@ static
int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned int num_vars,
zval ***args, unsigned int start, const char * const types TSRMLS_DC)
{
int i;
unsigned int i;
MYSQLND_PARAM_BIND *params;
enum_func_status ret = FAIL;
@ -1074,7 +1074,7 @@ PHP_FUNCTION(mysqli_fetch_field_direct)
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
if (offset < 0 || offset >= mysql_num_fields(result)) {
if (offset < 0 || offset >= (long) mysql_num_fields(result)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field offset is invalid for resultset");
RETURN_FALSE;
}
@ -2081,7 +2081,7 @@ PHP_FUNCTION(mysqli_refresh)
return;
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_INITIALIZED);
RETURN_BOOL(!mysql_refresh(mysql->mysql, options));
RETURN_BOOL(!mysql_refresh(mysql->mysql, (uint8_t) options));
}
/* }}} */
@ -2354,7 +2354,7 @@ PHP_FUNCTION(mysqli_thread_id)
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
RETURN_LONG(mysql_thread_id(mysql->mysql));
RETURN_LONG((long) mysql_thread_id(mysql->mysql));
}
/* }}} */

View file

@ -83,7 +83,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); \
@ -156,7 +156,7 @@ static int link_connect_error_read(mysqli_object *obj, zval **retval TSRMLS_DC)
static int link_affected_rows_read(mysqli_object *obj, zval **retval TSRMLS_DC)
{
MY_MYSQL *mysql;
my_ulonglong rc;
long rc;
MAKE_STD_ZVAL(*retval);
@ -169,9 +169,9 @@ static int link_affected_rows_read(mysqli_object *obj, zval **retval TSRMLS_DC)
} else {
CHECK_STATUS(MYSQLI_STATUS_VALID);
rc = mysql_affected_rows(mysql->mysql);
rc = (long) mysql_affected_rows(mysql->mysql);
if (rc == (my_ulonglong)-1) {
if (rc == (long)-1) {
ZVAL_LONG(*retval, -1);
return SUCCESS;
}
@ -277,7 +277,7 @@ static int stmt_id_read(mysqli_object *obj, zval **retval TSRMLS_DC)
static int stmt_affected_rows_read(mysqli_object *obj, zval **retval TSRMLS_DC)
{
MY_STMT *p;
my_ulonglong rc;
long rc;
MAKE_STD_ZVAL(*retval);
CHECK_STATUS(MYSQLI_STATUS_VALID);
@ -287,9 +287,9 @@ static int stmt_affected_rows_read(mysqli_object *obj, zval **retval TSRMLS_DC)
if (!p) {
ZVAL_NULL(*retval);
} else {
rc = mysql_stmt_affected_rows(p->stmt);
rc = (long) mysql_stmt_affected_rows(p->stmt);
if (rc == (my_ulonglong)-1) {
if (rc == (long)-1) {
ZVAL_LONG(*retval, -1);
return SUCCESS;
}

View file

@ -122,10 +122,10 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
static void pdo_mysql_stmt_set_row_count(pdo_stmt_t *stmt) /* {{{ */
{
my_ulonglong row_count;
long row_count;
pdo_mysql_stmt *S = stmt->driver_data;
row_count = mysql_stmt_affected_rows(S->stmt);
if (row_count != (my_ulonglong)-1) {
row_count = (long) mysql_stmt_affected_rows(S->stmt);
if (row_count != (long)-1) {
stmt->row_count = row_count;
}
}
@ -248,7 +248,7 @@ static int pdo_mysql_stmt_execute_prepared_mysqlnd(pdo_stmt_t *stmt TSRMLS_DC) /
{
pdo_mysql_stmt *S = stmt->driver_data;
pdo_mysql_db_handle *H = S->H;
unsigned int i;
int i;
PDO_DBG_ENTER("pdo_mysql_stmt_execute_prepared_mysqlnd");
@ -325,13 +325,13 @@ static int pdo_mysql_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
PDO_DBG_RETURN(0);
}
stmt->row_count = mysql_num_rows(S->result);
stmt->row_count = (long) mysql_num_rows(S->result);
stmt->column_count = (int) mysql_num_fields(S->result);
S->fields = mysql_fetch_fields(S->result);
} else {
/* this was a DML or DDL query (INSERT, UPDATE, DELETE, ... */
stmt->row_count = row_count;
stmt->row_count = (long) row_count;
}
PDO_DBG_RETURN(1);
@ -343,7 +343,7 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
#if HAVE_MYSQL_NEXT_RESULT || PDO_USE_MYSQLND
pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
pdo_mysql_db_handle *H = S->H;
my_ulonglong row_count;
long row_count;
int ret;
PDO_DBG_ENTER("pdo_mysql_stmt_next_rowset");
PDO_DBG_INF_FMT("stmt=%p", S->stmt);
@ -374,7 +374,7 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
}
{
/* for SHOW/DESCRIBE and others the column/field count is not available before execute */
unsigned int i;
int i;
stmt->column_count = S->stmt->field_count;
for (i = 0; i < stmt->column_count; i++) {
@ -388,12 +388,13 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
/* if buffered, pre-fetch all the data */
if (H->buffered) {
if (mysql_stmt_store_result(S->stmt))
if (mysql_stmt_store_result(S->stmt)) {
PDO_DBG_RETURN(1);
}
}
row_count = mysql_stmt_affected_rows(S->stmt);
if (row_count != (my_ulonglong)-1) {
}
row_count = (long) mysql_stmt_affected_rows(S->stmt);
if (row_count != (long)-1) {
stmt->row_count = row_count;
}
PDO_DBG_RETURN(1);
@ -426,7 +427,7 @@ static int pdo_mysql_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */
row_count = 0;
} else {
S->result = mysql_store_result(H->server);
if ((my_ulonglong)-1 == (row_count = mysql_affected_rows(H->server))) {
if ((long)-1 == (row_count = (long) mysql_affected_rows(H->server))) {
pdo_mysql_error_stmt(stmt);
PDO_DBG_RETURN(0);
}
@ -493,7 +494,7 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
PDO_DBG_RETURN(1);
case PDO_PARAM_EVT_EXEC_PRE:
if (S->params_given < S->num_params) {
if (S->params_given < (unsigned int) S->num_params) {
/* too few parameter bound */
PDO_DBG_ERR("too few parameters bound");
strcpy(stmt->error_code, "HY093");
@ -671,7 +672,7 @@ static int pdo_mysql_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{
{
pdo_mysql_stmt *S = (pdo_mysql_stmt*)stmt->driver_data;
struct pdo_column_data *cols = stmt->columns;
unsigned int i;
int i;
PDO_DBG_ENTER("pdo_mysql_stmt_describe");
PDO_DBG_INF_FMT("stmt=%p", S->stmt);
@ -690,7 +691,7 @@ static int pdo_mysql_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{
if (cols[0].name) {
PDO_DBG_RETURN(1);
}
for (i=0; i < stmt->column_count; i++) {
for (i = 0; i < stmt->column_count; i++) {
int namelen;
if (S->H->fetch_table_names) {