diff --git a/mx_mysql.c b/mx_mysql.c index ac066671..aff7bc02 100644 --- a/mx_mysql.c +++ b/mx_mysql.c @@ -699,11 +699,9 @@ static int _mx_mysql_bind_string(struct mx_mysql_bind *b, unsigned int index, ch static int _mx_mysql_bind_validate(struct mx_mysql_bind *b) { - int i; - mx_assert_return_minus_errno(b, EINVAL); - for (i=0; i < b->count; i++) { + for (unsigned long i=0; i < b->count; i++) { if (!(b->data[i].flags)) { return -(errno=EBADSLT); } @@ -1015,7 +1013,6 @@ int mx_mysql_statement_fetch(struct mx_mysql_stmt *stmt) { struct mx_mysql_bind *r; int res; - int col; char *str; int no_error = 1; @@ -1044,7 +1041,7 @@ int mx_mysql_statement_fetch(struct mx_mysql_stmt *stmt) } r = &stmt->result; - for (col = 0; col < r->count; col++) { + for (unsigned long col = 0; col < r->count; col++) { if (r->bind[col].buffer_type == MYSQL_TYPE_STRING) { str = mx_calloc_forever(r->data[col].length + 1, sizeof(*str)); @@ -1063,7 +1060,7 @@ int mx_mysql_statement_fetch(struct mx_mysql_stmt *stmt) if (!(r->data[col].is_error)) continue; - mx_log_debug("WARNING: result data returned in column with index %d was truncated. query was:", col); + mx_log_debug("WARNING: result data returned in column with index %lu was truncated. query was:", col); mx_log_debug(" \\ %s", stmt->statement); no_error = 0; } @@ -1165,7 +1162,6 @@ static int _mx_mysql_do_statement(struct mx_mysql *mysql, char *query, struct mx struct mx_mysql_stmt *stmt = NULL; unsigned long long num_rows = 0; int res; - int cnt = 0; char *tmpdata; assert(mysql); @@ -1196,7 +1192,7 @@ static int _mx_mysql_do_statement(struct mx_mysql *mysql, char *query, struct mx if (result && result->count && num_rows) { tmpdata = mx_calloc_forever(num_rows, size); - for (cnt = 0; cnt < num_rows; cnt++) { + for (unsigned long cnt = 0; cnt < num_rows; cnt++) { res = mx_mysql_statement_fetch(stmt); if (res < 0) { mx_log_err("mx_mysql_statement_fetch(): %m");