1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

Windows 64-bit fixes:

changed type of length parameter in mysql_stmt_prepare,
mysql_real_query, mysql_stmt_send_long_data (incl. async _start
functions) from unsigned long to size_t.
Fixed warnings
This commit is contained in:
Georg Richter
2015-11-05 11:52:50 +01:00
parent 2f4061eadc
commit 72f7c4abf5
26 changed files with 87 additions and 89 deletions

View File

@@ -322,11 +322,11 @@ static int test_ps_i18n(MYSQL *mysql)
memset(bind_array, '\0', sizeof(bind_array));
bind_array[0].buffer_type= MYSQL_TYPE_STRING;
bind_array[0].buffer= (void *) koi8;
bind_array[0].buffer_length= strlen(koi8);
bind_array[0].buffer_length= (unsigned long)strlen(koi8);
bind_array[1].buffer_type= MYSQL_TYPE_STRING;
bind_array[1].buffer= (void *) koi8;
bind_array[1].buffer_length= strlen(koi8);
bind_array[1].buffer_length= (unsigned long)strlen(koi8);
stmt= mysql_stmt_init(mysql);
check_stmt_rc(rc, stmt);
@@ -393,11 +393,11 @@ static int test_ps_i18n(MYSQL *mysql)
/* this data must be converted */
bind_array[0].buffer_type= MYSQL_TYPE_STRING;
bind_array[0].buffer= (void *) koi8;
bind_array[0].buffer_length= strlen(koi8);
bind_array[0].buffer_length= (unsigned long)strlen(koi8);
bind_array[1].buffer_type= MYSQL_TYPE_STRING;
bind_array[1].buffer= (void *) koi8;
bind_array[1].buffer_length= strlen(koi8);
bind_array[1].buffer_length= (unsigned long)strlen(koi8);
mysql_stmt_bind_param(stmt, bind_array);
@@ -408,11 +408,11 @@ static int test_ps_i18n(MYSQL *mysql)
/* this data must not be converted */
bind_array[0].buffer_type= MYSQL_TYPE_BLOB;
bind_array[0].buffer= (void *) cp1251;
bind_array[0].buffer_length= strlen(cp1251);
bind_array[0].buffer_length= (unsigned long)strlen(cp1251);
bind_array[1].buffer_type= MYSQL_TYPE_BLOB;
bind_array[1].buffer= (void *) cp1251;
bind_array[1].buffer_length= strlen(cp1251);
bind_array[1].buffer_length= (unsigned long)strlen(cp1251);
mysql_stmt_bind_param(stmt, bind_array);

View File

@@ -478,7 +478,7 @@ static int test_bug10794(MYSQL *mysql)
{
id_val= (i+1)*10;
sprintf(a, "a%d", i);
a_len= strlen(a); /* safety against broken sprintf */
a_len= (unsigned long)strlen(a); /* safety against broken sprintf */
rc= mysql_stmt_execute(stmt);
check_stmt_rc(rc, stmt);
}
@@ -728,7 +728,7 @@ static int test_bug11656(MYSQL *mysql)
{
my_bind[i].buffer_type= MYSQL_TYPE_STRING;
my_bind[i].buffer= (uchar* *)&buf[i];
my_bind[i].buffer_length= strlen(buf[i]);
my_bind[i].buffer_length= (unsigned long)strlen(buf[i]);
}
rc= mysql_stmt_bind_param(stmt, my_bind);
check_stmt_rc(rc, stmt);

View File

@@ -61,7 +61,7 @@ static int test_logs(MYSQL *mysql)
MYSQL_STMT *stmt;
MYSQL_BIND my_bind[2];
char data[255];
ulong length;
size_t length;
int rc;
short id;

View File

@@ -630,7 +630,7 @@ static int test_wl4166_4(MYSQL *mysql)
bind_array[1].buffer_type= MYSQL_TYPE_STRING;
bind_array[1].buffer= (void *) koi8;
bind_array[1].buffer_length= strlen(koi8);
bind_array[1].buffer_length= (unsigned long)strlen(koi8);
stmt= mysql_stmt_init(mysql);
check_stmt_rc(rc, stmt);
@@ -933,7 +933,7 @@ static int test_connect_attrs(MYSQL *my)
mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_DELETE, "foo1");
mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_DELETE, "foo2");
len= mysql->options.extension->connect_attrs_len;
len= (int)mysql->options.extension->connect_attrs_len;
mysql_close(mysql);

View File

@@ -50,6 +50,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */
/* prevent warnings on Win64 by using STMT_LEN instead of strlen */
#define STMT_LEN(A) (unsigned long)strlen((A))
#define check_mysql_rc(rc, mysql) \
if (rc)\
{\
@@ -195,7 +198,7 @@ int my_stmt_result(MYSQL *mysql, const char *buff)
stmt= mysql_stmt_init(mysql);
rc= mysql_stmt_prepare(stmt, buff, strlen(buff));
rc= mysql_stmt_prepare(stmt, buff, (unsigned long)strlen(buff));
FAIL_IF(rc, mysql_stmt_error(stmt));
rc= mysql_stmt_execute(stmt);

View File

@@ -613,7 +613,7 @@ static int test_bug1500(MYSQL *mysql)
data= "Dogs";
my_bind[0].buffer_type= MYSQL_TYPE_STRING;
my_bind[0].buffer= (void *) data;
my_bind[0].buffer_length= strlen(data);
my_bind[0].buffer_length= (unsigned long)strlen(data);
my_bind[0].is_null= 0;
my_bind[0].length= 0;
@@ -842,7 +842,7 @@ static int test_bug1664(MYSQL *mysql)
my_bind[0].buffer_type= MYSQL_TYPE_STRING;
my_bind[0].buffer= (void *)str_data;
my_bind[0].buffer_length= strlen(str_data);
my_bind[0].buffer_length= (unsigned long)strlen(str_data);
my_bind[1].buffer= (void *)&int_data;
my_bind[1].buffer_type= MYSQL_TYPE_LONG;
@@ -1642,7 +1642,7 @@ static int test_ps_conj_select(MYSQL *mysql)
check_stmt_rc(rc, stmt);
int_data= 1;
strcpy(str_data, "hh");
str_length= strlen(str_data);
str_length= (unsigned long)strlen(str_data);
rc= mysql_stmt_execute(stmt);
check_stmt_rc(rc, stmt);
@@ -1882,7 +1882,7 @@ static int test_ps_query_cache(MYSQL *mysql)
check_stmt_rc(rc, stmt);
p_int_data= 1;
strcpy(p_str_data, "hh");
p_str_length= strlen(p_str_data);
p_str_length= (unsigned long)strlen(p_str_data);
memset(r_bind, '\0', sizeof(r_bind));
r_bind[0].buffer_type= MYSQL_TYPE_LONG;
@@ -1934,7 +1934,7 @@ static int test_ps_query_cache(MYSQL *mysql)
/* now modify parameter values and see qcache hits */
strcpy(p_str_data, "ii");
p_str_length= strlen(p_str_data);
p_str_length= (unsigned long)strlen(p_str_data);
rc= mysql_stmt_execute(stmt);
check_stmt_rc(rc, stmt);
test_ps_query_cache_result(1, "hh", 2, 1, "ii", 2, 2, "ii", 2);
@@ -2124,7 +2124,7 @@ static int test_bug3796(MYSQL *mysql)
memset(my_bind, '\0', sizeof(my_bind));
my_bind[0].buffer_type= MYSQL_TYPE_STRING;
my_bind[0].buffer= (void *) concat_arg0;
my_bind[0].buffer_length= strlen(concat_arg0);
my_bind[0].buffer_length= (unsigned long)strlen(concat_arg0);
mysql_stmt_bind_param(stmt, my_bind);