You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Fixed compiler warnings
This commit is contained in:
@@ -276,6 +276,5 @@
|
|||||||
* various other defines
|
* various other defines
|
||||||
*/
|
*/
|
||||||
#cmakedefine HAVE_THREADS 1
|
#cmakedefine HAVE_THREADS 1
|
||||||
#cmakedefine SHAREDIR "@SHAREDIR@"
|
|
||||||
#cmakedefine DEFAULT_CHARSET_HOME "@DEFAULT_CHARSET_HOME@"
|
#cmakedefine DEFAULT_CHARSET_HOME "@DEFAULT_CHARSET_HOME@"
|
||||||
#cmakedefine DEFAULT_SYSCONFDIR "@DEFAULT_SYSCONFDIR@"
|
#cmakedefine DEFAULT_SYSCONFDIR "@DEFAULT_SYSCONFDIR@"
|
||||||
|
@@ -265,7 +265,7 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
|
|||||||
my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt);
|
my_bool STDCALL mysql_stmt_close(MYSQL_STMT * stmt);
|
||||||
my_bool STDCALL mysql_stmt_reset(MYSQL_STMT * stmt);
|
my_bool STDCALL mysql_stmt_reset(MYSQL_STMT * stmt);
|
||||||
my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt);
|
my_bool STDCALL mysql_stmt_free_result(MYSQL_STMT *stmt);
|
||||||
my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt, unsigned int param_number, const char *data, size_t length);
|
my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt, unsigned int param_number, const char *data, unsigned long length);
|
||||||
MYSQL_RES *STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt);
|
MYSQL_RES *STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt);
|
||||||
MYSQL_RES *STDCALL mysql_stmt_param_metadata(MYSQL_STMT *stmt);
|
MYSQL_RES *STDCALL mysql_stmt_param_metadata(MYSQL_STMT *stmt);
|
||||||
unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt);
|
unsigned int STDCALL mysql_stmt_errno(MYSQL_STMT * stmt);
|
||||||
|
@@ -569,10 +569,10 @@ MARIADB_CHARSET_INFO * STDCALL mariadb_get_charset_by_name(const char *csname);
|
|||||||
MARIADB_CHARSET_INFO * STDCALL mariadb_get_charset_by_nr(unsigned int csnr);
|
MARIADB_CHARSET_INFO * STDCALL mariadb_get_charset_by_nr(unsigned int csnr);
|
||||||
size_t STDCALL mariadb_convert_string(const char *from, size_t *from_len, MARIADB_CHARSET_INFO *from_cs,
|
size_t STDCALL mariadb_convert_string(const char *from, size_t *from_len, MARIADB_CHARSET_INFO *from_cs,
|
||||||
char *to, size_t *to_len, MARIADB_CHARSET_INFO *to_cs, int *errorcode);
|
char *to, size_t *to_len, MARIADB_CHARSET_INFO *to_cs, int *errorcode);
|
||||||
int STDCALL mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...);
|
int STDCALL mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...);
|
||||||
int STDCALL mysql_get_optionv(MYSQL *mysql, enum mysql_option option, void *arg, ...);
|
int STDCALL mysql_get_optionv(MYSQL *mysql, enum mysql_option option, void *arg, ...);
|
||||||
int STDCALL mysql_get_option(MYSQL *mysql, enum mysql_option option, void *arg);
|
int STDCALL mysql_get_option(MYSQL *mysql, enum mysql_option option, void *arg);
|
||||||
unsigned long STDCALL mysql_hex_string(char *to, const char *from, size_t len);
|
unsigned long STDCALL mysql_hex_string(char *to, const char *from, unsigned long len);
|
||||||
my_socket STDCALL mysql_get_socket(MYSQL *mysql);
|
my_socket STDCALL mysql_get_socket(MYSQL *mysql);
|
||||||
unsigned int STDCALL mysql_get_timeout_value(const MYSQL *mysql);
|
unsigned int STDCALL mysql_get_timeout_value(const MYSQL *mysql);
|
||||||
unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql);
|
unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql);
|
||||||
|
@@ -269,7 +269,7 @@ int mysql_client_plugin_init()
|
|||||||
MYSQL mysql;
|
MYSQL mysql;
|
||||||
struct st_mysql_client_plugin **builtin;
|
struct st_mysql_client_plugin **builtin;
|
||||||
va_list unused;
|
va_list unused;
|
||||||
LINT_INIT_STRUCT(unused);
|
LINT_INIT_STRUCT(unused);
|
||||||
|
|
||||||
if (initialized)
|
if (initialized)
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -291,8 +291,8 @@ my_bool hash_insert(HASH *info,const uchar *record)
|
|||||||
{
|
{
|
||||||
int flag;
|
int flag;
|
||||||
uint halfbuff,hash_nr,first_index,idx;
|
uint halfbuff,hash_nr,first_index,idx;
|
||||||
uchar *ptr_to_rec,*ptr_to_rec2;
|
uchar *ptr_to_rec= NULL,*ptr_to_rec2= NULL;
|
||||||
HASH_LINK *data,*empty,*gpos,*gpos2,*pos;
|
HASH_LINK *data,*empty,*gpos= NULL,*gpos2 = NULL,*pos;
|
||||||
|
|
||||||
LINT_INIT(gpos); LINT_INIT(gpos2);
|
LINT_INIT(gpos); LINT_INIT(gpos2);
|
||||||
LINT_INIT(ptr_to_rec); LINT_INIT(ptr_to_rec2);
|
LINT_INIT(ptr_to_rec); LINT_INIT(ptr_to_rec2);
|
||||||
|
@@ -182,7 +182,7 @@ my_bool ma_pvio_set_timeout(MARIADB_PVIO *pvio,
|
|||||||
/* {{{ size_t ma_pvio_read_async */
|
/* {{{ size_t ma_pvio_read_async */
|
||||||
static size_t ma_pvio_read_async(MARIADB_PVIO *pvio, uchar *buffer, size_t length)
|
static size_t ma_pvio_read_async(MARIADB_PVIO *pvio, uchar *buffer, size_t length)
|
||||||
{
|
{
|
||||||
ssize_t res;
|
ssize_t res= 0;
|
||||||
struct mysql_async_context *b= pvio->mysql->options.extension->async_context;
|
struct mysql_async_context *b= pvio->mysql->options.extension->async_context;
|
||||||
int timeout= pvio->timeout[PVIO_READ_TIMEOUT];
|
int timeout= pvio->timeout[PVIO_READ_TIMEOUT];
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ static ssize_t ma_pvio_write_async(MARIADB_PVIO *pvio, const uchar *buffer, size
|
|||||||
/* {{{ size_t ma_pvio_write */
|
/* {{{ size_t ma_pvio_write */
|
||||||
ssize_t ma_pvio_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length)
|
ssize_t ma_pvio_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length)
|
||||||
{
|
{
|
||||||
ssize_t r;
|
ssize_t r= 0;
|
||||||
|
|
||||||
if (!pvio)
|
if (!pvio)
|
||||||
return -1;
|
return -1;
|
||||||
|
@@ -1956,7 +1956,7 @@ mysql_close(MYSQL *mysql)
|
|||||||
int STDCALL
|
int STDCALL
|
||||||
mysql_query(MYSQL *mysql, const char *query)
|
mysql_query(MYSQL *mysql, const char *query)
|
||||||
{
|
{
|
||||||
return mysql_real_query(mysql,query, (uint) strlen(query));
|
return mysql_real_query(mysql,query, (unsigned long) strlen(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3301,12 +3301,12 @@ my_bool STDCALL mysql_autocommit(MYSQL *mysql, my_bool mode)
|
|||||||
|
|
||||||
my_bool STDCALL mysql_commit(MYSQL *mysql)
|
my_bool STDCALL mysql_commit(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
return((my_bool)mysql_real_query(mysql, "COMMIT", sizeof("COMMIT")));
|
return((my_bool)mysql_real_query(mysql, "COMMIT", (unsigned long) sizeof("COMMIT")));
|
||||||
}
|
}
|
||||||
|
|
||||||
my_bool STDCALL mysql_rollback(MYSQL *mysql)
|
my_bool STDCALL mysql_rollback(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
return((my_bool)mysql_real_query(mysql, "ROLLBACK", sizeof("ROLLBACK")));
|
return((my_bool)mysql_real_query(mysql, "ROLLBACK", (unsigned long)sizeof("ROLLBACK")));
|
||||||
}
|
}
|
||||||
|
|
||||||
my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql)
|
my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql)
|
||||||
@@ -3436,7 +3436,7 @@ int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname)
|
|||||||
char buff[64];
|
char buff[64];
|
||||||
|
|
||||||
snprintf(buff, 63, "SET NAMES %s", cs->csname);
|
snprintf(buff, 63, "SET NAMES %s", cs->csname);
|
||||||
if (!mysql_real_query(mysql, buff, (uint)strlen(buff)))
|
if (!mysql_real_query(mysql, buff, (unsigned long)strlen(buff)))
|
||||||
{
|
{
|
||||||
mysql->charset= cs;
|
mysql->charset= cs;
|
||||||
return(0);
|
return(0);
|
||||||
|
@@ -796,7 +796,7 @@ my_bool pvio_socket_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
{
|
{
|
||||||
unsigned int timeout= mysql->options.connect_timeout ?
|
unsigned int timeout= mysql->options.connect_timeout ?
|
||||||
mysql->options.connect_timeout : DNS_TIMEOUT;
|
mysql->options.connect_timeout : DNS_TIMEOUT;
|
||||||
if (time(NULL) - start_t > timeout)
|
if (time(NULL) - start_t > (time_t)timeout)
|
||||||
break;
|
break;
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
usleep(wait_gai);
|
usleep(wait_gai);
|
||||||
@@ -819,7 +819,7 @@ my_bool pvio_socket_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
{
|
{
|
||||||
unsigned int timeout= mysql->options.connect_timeout ?
|
unsigned int timeout= mysql->options.connect_timeout ?
|
||||||
mysql->options.connect_timeout : DNS_TIMEOUT;
|
mysql->options.connect_timeout : DNS_TIMEOUT;
|
||||||
if (time(NULL) - start_t > timeout)
|
if (time(NULL) - start_t > (time_t)timeout)
|
||||||
break;
|
break;
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
usleep(wait_gai);
|
usleep(wait_gai);
|
||||||
|
@@ -185,7 +185,7 @@ static int test_conc70(MYSQL *my)
|
|||||||
}
|
}
|
||||||
|
|
||||||
row= mysql_fetch_row(res);
|
row= mysql_fetch_row(res);
|
||||||
diag("Length: %ld", strlen(row[0]));
|
diag("Length: %ld", (long)strlen(row[0]));
|
||||||
FAIL_IF(strlen(row[0]) != 1024 * 1024 * 20, "Wrong length");
|
FAIL_IF(strlen(row[0]) != 1024 * 1024 * 20, "Wrong length");
|
||||||
|
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
@@ -243,7 +243,7 @@ static int test_conc68(MYSQL *my)
|
|||||||
}
|
}
|
||||||
|
|
||||||
row= mysql_fetch_row(res);
|
row= mysql_fetch_row(res);
|
||||||
diag("Length: %ld", strlen(row[0]));
|
diag("Length: %ld", (long)strlen(row[0]));
|
||||||
FAIL_IF(strlen(row[0]) != 1024 * 1024 * 20, "Wrong length");
|
FAIL_IF(strlen(row[0]) != 1024 * 1024 * 20, "Wrong length");
|
||||||
|
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
|
@@ -712,7 +712,7 @@ static int test_utf16_utf32_noboms(MYSQL *mysql __attribute__((unused)))
|
|||||||
rc= mariadb_convert_string((char *)in_string[UTF8], &in_len, csinfo[UTF8], buffer, &out_len, csinfo[i], &error);
|
rc= mariadb_convert_string((char *)in_string[UTF8], &in_len, csinfo[UTF8], buffer, &out_len, csinfo[i], &error);
|
||||||
|
|
||||||
FAIL_IF(rc == (size_t)-1, "Conversion failed");
|
FAIL_IF(rc == (size_t)-1, "Conversion failed");
|
||||||
diag("rc=%lu oct_len: %lu", rc, in_oct_len[i]);
|
diag("rc=%lu oct_len: %lu", (unsigned long)rc, (unsigned long)in_oct_len[i]);
|
||||||
FAIL_IF(rc != in_oct_len[i], "Incorrect number of written bytes");
|
FAIL_IF(rc != in_oct_len[i], "Incorrect number of written bytes");
|
||||||
|
|
||||||
if (memcmp(buffer, in_string[i], rc) != 0)
|
if (memcmp(buffer, in_string[i], rc) != 0)
|
||||||
|
@@ -1109,16 +1109,16 @@ static int test_get_info(MYSQL *mysql)
|
|||||||
|
|
||||||
rc= mariadb_get_infov(mysql, MARIADB_MAX_ALLOWED_PACKET, &sval);
|
rc= mariadb_get_infov(mysql, MARIADB_MAX_ALLOWED_PACKET, &sval);
|
||||||
FAIL_IF(rc, "mysql_get_info failed");
|
FAIL_IF(rc, "mysql_get_info failed");
|
||||||
diag("max_allowed_packet: %lu", sval);
|
diag("max_allowed_packet: %lu", (unsigned long)sval);
|
||||||
rc= mariadb_get_infov(mysql, MARIADB_NET_BUFFER_LENGTH, &sval);
|
rc= mariadb_get_infov(mysql, MARIADB_NET_BUFFER_LENGTH, &sval);
|
||||||
FAIL_IF(rc, "mysql_get_info failed");
|
FAIL_IF(rc, "mysql_get_info failed");
|
||||||
diag("net_buffer_length: %lu", sval);
|
diag("net_buffer_length: %lu", (unsigned long)sval);
|
||||||
rc= mariadb_get_infov(mysql, MARIADB_CLIENT_VERSION_ID, &sval);
|
rc= mariadb_get_infov(mysql, MARIADB_CLIENT_VERSION_ID, &sval);
|
||||||
FAIL_IF(rc, "mysql_get_info failed");
|
FAIL_IF(rc, "mysql_get_info failed");
|
||||||
diag("client_version_id: %lu", sval);
|
diag("client_version_id: %lu", (unsigned long)sval);
|
||||||
rc= mariadb_get_infov(mysql, MARIADB_CONNECTION_SERVER_VERSION_ID, &sval);
|
rc= mariadb_get_infov(mysql, MARIADB_CONNECTION_SERVER_VERSION_ID, &sval);
|
||||||
FAIL_IF(rc, "mysql_get_info failed");
|
FAIL_IF(rc, "mysql_get_info failed");
|
||||||
diag("server_version_id: %lu", sval);
|
diag("server_version_id: %lu", (unsigned long)sval);
|
||||||
rc= mariadb_get_infov(mysql, MARIADB_CONNECTION_MARIADB_CHARSET_INFO, &cs);
|
rc= mariadb_get_infov(mysql, MARIADB_CONNECTION_MARIADB_CHARSET_INFO, &cs);
|
||||||
FAIL_IF(rc, "mysql_get_info failed");
|
FAIL_IF(rc, "mysql_get_info failed");
|
||||||
diag("charset name: %s", cs.csname);
|
diag("charset name: %s", cs.csname);
|
||||||
|
@@ -1496,7 +1496,7 @@ static int test_long_data_str1(MYSQL *mysql)
|
|||||||
result= mysql_stmt_result_metadata(stmt);
|
result= mysql_stmt_result_metadata(stmt);
|
||||||
field= mysql_fetch_fields(result);
|
field= mysql_fetch_fields(result);
|
||||||
|
|
||||||
diag("max_length: %lu max_blob_length: %lu", field->max_length, max_blob_length);
|
diag("max_length: %lu max_blob_length: %lu", (unsigned long)field->max_length, (unsigned long)max_blob_length);
|
||||||
FAIL_UNLESS(field->max_length == max_blob_length, "field->max_length != max_blob_length");
|
FAIL_UNLESS(field->max_length == max_blob_length, "field->max_length != max_blob_length");
|
||||||
|
|
||||||
/* Fetch results into a data buffer that is smaller than data */
|
/* Fetch results into a data buffer that is smaller than data */
|
||||||
|
@@ -497,7 +497,7 @@ static int test_bug11183(MYSQL *mysql)
|
|||||||
FAIL_IF(!rc, "Error expected");
|
FAIL_IF(!rc, "Error expected");
|
||||||
|
|
||||||
mysql_stmt_reset(stmt);
|
mysql_stmt_reset(stmt);
|
||||||
FAIL_IF(!mysql_stmt_errno(stmt) == 0, "stmt->error != 0");
|
FAIL_IF(mysql_stmt_errno(stmt) != 0, "stmt->error != 0");
|
||||||
|
|
||||||
rc= mysql_query(mysql, "create table t1 (a int)");
|
rc= mysql_query(mysql, "create table t1 (a int)");
|
||||||
check_mysql_rc(rc, mysql);
|
check_mysql_rc(rc, mysql);
|
||||||
|
Reference in New Issue
Block a user