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

Compiler warning fixes

This commit is contained in:
Georg Richter
2016-09-03 12:46:50 +02:00
parent 7615dc73a2
commit 9f88e25fd6
51 changed files with 361 additions and 293 deletions

View File

@@ -132,7 +132,7 @@ wait_for_mysql(MYSQL *mysql, int status)
#endif
}
static int async1(MYSQL *my)
static int async1(MYSQL *unused __attribute__((unused)))
{
int err= 0, rc;
MYSQL mysql, *ret;
@@ -211,7 +211,7 @@ static int async1(MYSQL *my)
return OK;
}
static int test_conc131(MYSQL *my)
static int test_conc131(MYSQL *unused __attribute__((unused)))
{
int rc;
/* this test needs to run under valgrind */
@@ -227,7 +227,7 @@ static int test_conc131(MYSQL *my)
return OK;
}
static int test_conc129(MYSQL *my)
static int test_conc129(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql;

View File

@@ -72,7 +72,7 @@ static int test_conc75(MYSQL *my)
}
static int test_conc74(MYSQL *my)
static int test_conc74(MYSQL *unused __attribute__((unused)))
{
int rc;
MYSQL *mysql;
@@ -247,7 +247,7 @@ static int test_conc68(MYSQL *my)
}
static int basic_connect(MYSQL *mysql)
static int basic_connect(MYSQL *unused __attribute__((unused)))
{
MYSQL_ROW row;
MYSQL_RES *res;
@@ -371,7 +371,7 @@ static int test_bug12001(MYSQL *mysql)
/* connection options */
struct my_option_st opt_utf8[] = {
{MYSQL_SET_CHARSET_NAME, "utf8"},
{MYSQL_SET_CHARSET_NAME, (char *)"utf8"},
{0, NULL}
};
@@ -655,7 +655,7 @@ static int bug_conc1(MYSQL *mysql)
return OK;
}
static int test_options_initcmd(MYSQL *my)
static int test_options_initcmd(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql= mysql_init(NULL);
MYSQL_RES *res;
@@ -678,7 +678,7 @@ static int test_options_initcmd(MYSQL *my)
return OK;
}
static int test_extended_init_values(MYSQL *my)
static int test_extended_init_values(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql= mysql_init(NULL);
@@ -692,7 +692,7 @@ static int test_extended_init_values(MYSQL *my)
return OK;
}
static int test_reconnect_maxpackage(MYSQL *my)
static int test_reconnect_maxpackage(MYSQL *unused __attribute__((unused)))
{
int rc;
ulong max_packet= 0;
@@ -752,7 +752,7 @@ static int test_reconnect_maxpackage(MYSQL *my)
return OK;
}
static int test_compressed(MYSQL *my)
static int test_compressed(MYSQL *unused __attribute__((unused)))
{
int rc;
MYSQL *mysql= mysql_init(NULL);

View File

@@ -20,7 +20,7 @@
#define TEST_ARRAY_SIZE 1024
char *rand_str(size_t length) {
char charset[] = "0123456789"
const char charset[] = "0123456789"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char *dest= (char *)malloc(length+1);
@@ -36,17 +36,17 @@ char *rand_str(size_t length) {
static int bulk1(MYSQL *mysql)
{
MYSQL_STMT *stmt= mysql_stmt_init(mysql);
char *stmt_str= "INSERT INTO bulk1 VALUES (?,?)";
unsigned long array_size= TEST_ARRAY_SIZE;
const char *stmt_str= "INSERT INTO bulk1 VALUES (?,?)";
unsigned int array_size= TEST_ARRAY_SIZE;
int rc;
int i;
unsigned int i;
char **buffer;
unsigned long *lengths;
unsigned int *vals;
MYSQL_BIND bind[2];
MYSQL_RES *res;
MYSQL_ROW row;
int intval;
unsigned int intval;
rc= mysql_query(mysql, "DROP TABLE IF EXISTS bulk1");
check_mysql_rc(rc, mysql);
@@ -60,7 +60,7 @@ static int bulk1(MYSQL *mysql)
/* allocate memory */
buffer= calloc(TEST_ARRAY_SIZE, sizeof(char *));
lengths= (unsigned long *)calloc(sizeof(long), TEST_ARRAY_SIZE);
vals= (int *)calloc(sizeof(int), TEST_ARRAY_SIZE);
vals= (unsigned int *)calloc(sizeof(int), TEST_ARRAY_SIZE);
for (i=0; i < TEST_ARRAY_SIZE; i++)
{
@@ -74,7 +74,7 @@ static int bulk1(MYSQL *mysql)
bind[0].buffer= (int *)&vals[0];
bind[1].buffer_type= MYSQL_TYPE_STRING;
bind[1].buffer= (void *)buffer;
bind[1].length= (long *)lengths;
bind[1].length= (unsigned long *)lengths;
rc= mysql_stmt_attr_set(stmt, STMT_ATTR_ARRAY_SIZE, &array_size);
check_stmt_rc(rc, stmt);
@@ -130,9 +130,9 @@ static int bulk2(MYSQL *mysql)
MYSQL_STMT *stmt= mysql_stmt_init(mysql);
int rc;
MYSQL_BIND bind;
int i;
unsigned long array_size=1024;
uchar indicator[1024];
unsigned int i;
unsigned int array_size=1024;
char indicator[1024];
rc= mysql_query(mysql, "DROP TABLE IF EXISTS bulk2");
check_mysql_rc(rc, mysql);

View File

@@ -37,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
/* set connection options */
struct my_option_st opt_bug8378[] = {
{MYSQL_SET_CHARSET_NAME, "gbk"},
{MYSQL_SET_CHARSET_NAME, (char *) "gbk"},
{0, NULL}
};
@@ -120,7 +120,7 @@ int test_escaping(MYSQL *mysql)
{
int i= 0, rc, len;
char out[20];
char *escape_chars[] = {"'", "\x0", "\n", "\r", "\\", "\0", NULL};
const char *escape_chars[] = {"'", "\x0", "\n", "\r", "\\", "\0", NULL};
/* reset sql_mode, mysql_change_user call doesn't reset it */
rc= mysql_query(mysql, "SET sql_mode=''");
@@ -659,9 +659,9 @@ static int test_bug_54100(MYSQL *mysql)
/* We need this internal function for the test */
static int test_utf16_utf32_noboms(MYSQL *mysql)
static int test_utf16_utf32_noboms(MYSQL *mysql __attribute__((unused)))
{
char *csname[]= {"utf16", "utf16le", "utf32", "utf8"};
const char *csname[]= {"utf16", "utf16le", "utf32", "utf8"};
MARIADB_CHARSET_INFO *csinfo[sizeof(csname)/sizeof(char*)];
const int UTF8= sizeof(csname)/sizeof(char*) - 1;
@@ -676,7 +676,7 @@ static int test_utf16_utf32_noboms(MYSQL *mysql)
int i, error;
size_t rc, in_len, out_len;
for (i= 0; i < sizeof(csname)/sizeof(char*); ++i)
for (i= 0; i < (int)(sizeof(csname)/sizeof(char*)); ++i)
{
csinfo[i]= mariadb_get_charset_by_name(csname[i]);
@@ -693,9 +693,9 @@ static int test_utf16_utf32_noboms(MYSQL *mysql)
out_len= sizeof(buffer);
diag("Converting %s->%s", csname[i], csname[UTF8]);
rc= mariadb_convert_string(in_string[i], &in_len, csinfo[i], buffer, &out_len, csinfo[UTF8], &error);
rc= mariadb_convert_string((char *)in_string[i], &in_len, csinfo[i], buffer, &out_len, csinfo[UTF8], &error);
FAIL_IF(rc == -1, "Conversion failed");
FAIL_IF(rc == (size_t)-1, "Conversion failed");
FAIL_IF(rc != in_oct_len[UTF8], "Incorrect number of written bytes");
if (memcmp(buffer, in_string[UTF8], rc) != 0)
@@ -709,9 +709,9 @@ static int test_utf16_utf32_noboms(MYSQL *mysql)
out_len= sizeof(buffer);
diag("Converting %s->%s", csname[UTF8], csname[i]);
rc= mariadb_convert_string(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==-1, "Conversion failed");
FAIL_IF(rc == (size_t)-1, "Conversion failed");
diag("rc=%lu oct_len: %lu", rc, in_oct_len[i]);
FAIL_IF(rc != in_oct_len[i], "Incorrect number of written bytes");
@@ -726,10 +726,10 @@ static int test_utf16_utf32_noboms(MYSQL *mysql)
return OK;
}
static int charset_auto(MYSQL *my)
static int charset_auto(MYSQL *my __attribute__((unused)))
{
const char *csname1, *csname2;
char *osname;
const char *osname;
MYSQL *mysql= mysql_init(NULL);
int rc;

View File

@@ -599,7 +599,7 @@ int test_conc21(MYSQL *mysql)
MYSQL_RES *res= NULL;
MYSQL_ROW row;
char tmp[256];
int check_server_version= 0;
unsigned int check_server_version= 0;
int major=0, minor= 0, patch=0;
rc= mysql_query(mysql, "SELECT @@version");
@@ -621,7 +621,7 @@ int test_conc21(MYSQL *mysql)
return OK;
}
int test_conc26(MYSQL *my)
int test_conc26(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql= mysql_init(NULL);
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, "utf8");
@@ -642,7 +642,7 @@ int test_conc26(MYSQL *my)
return OK;
}
int test_connection_timeout(MYSQL *my)
int test_connection_timeout(MYSQL *unused __attribute__((unused)))
{
unsigned int timeout= 5;
time_t start, elapsed;
@@ -661,7 +661,7 @@ int test_connection_timeout(MYSQL *my)
return OK;
}
int test_connection_timeout2(MYSQL *my)
int test_connection_timeout2(MYSQL *unused __attribute__((unused)))
{
unsigned int timeout= 5;
time_t start, elapsed;
@@ -681,7 +681,7 @@ int test_connection_timeout2(MYSQL *my)
return OK;
}
int test_connection_timeout3(MYSQL *my)
int test_connection_timeout3(MYSQL *unused __attribute__((unused)))
{
unsigned int timeout= 5;
unsigned int read_write_timeout= 10;
@@ -756,9 +756,9 @@ static int test_conc118(MYSQL *mysql)
return OK;
}
static int test_wrong_bind_address(MYSQL *my)
static int test_wrong_bind_address(MYSQL *unused __attribute__((unused)))
{
char *bind_addr= "100.188.111.112";
const char *bind_addr= "100.188.111.112";
MYSQL *mysql;
if (!hostname || !strcmp(hostname, "localhost"))
@@ -827,7 +827,7 @@ static int test_bind_address(MYSQL *my)
return OK;
}
static int test_get_options(MYSQL *my)
static int test_get_options(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql= mysql_init(NULL);
int options_int[]= {MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_LOCAL_INFILE,
@@ -843,18 +843,19 @@ static int test_get_options(MYSQL *my)
MYSQL_OPT_SSL_CIPHER, MYSQL_OPT_BIND, MARIADB_OPT_SSL_FP, MARIADB_OPT_SSL_FP_LIST,
MARIADB_OPT_TLS_PASSPHRASE, 0};
char *init_command[3]= {"SET @a:=1", "SET @b:=2", "SET @c:=3"};
const char *init_command[3]= {"SET @a:=1", "SET @b:=2", "SET @c:=3"};
int elements= 0;
char **command;
int intval[2]= {1, 0};
my_bool boolval[2]= {1, 0};
char *char1= "test", *char2;
const char *char1= "test";
char *char2;
int i;
MYSQL *userdata;
char *attr_key[] = {"foo1", "foo2", "foo3"};
char *attr_val[] = {"bar1", "bar2", "bar3"};
const char *attr_key[] = {"foo1", "foo2", "foo3"};
const char *attr_val[] = {"bar1", "bar2", "bar3"};
char **key, **val;
for (i=0; options_int[i]; i++)
@@ -906,7 +907,7 @@ static int test_get_options(MYSQL *my)
free(val);
mysql_optionsv(mysql, MARIADB_OPT_USERDATA, "my_app", (void *)mysql);
mysql_get_optionv(mysql, MARIADB_OPT_USERDATA, "my_app", &userdata);
mysql_get_optionv(mysql, MARIADB_OPT_USERDATA, (char *)"my_app", &userdata);
FAIL_IF(mysql != userdata, "wrong userdata");
mysql_close(mysql);
@@ -943,6 +944,7 @@ static int test_sess_track_db(MYSQL *mysql)
rc= mysql_query(mysql, "SET NAMES utf8");
check_mysql_rc(rc, mysql);
diag("charset: %s", mysql->charset->csname);
FAIL_IF(strcmp(mysql->charset->csname, "utf8"), "Expected charset 'utf8'");
if (!mysql_session_track_get_first(mysql, SESSION_TRACK_SYSTEM_VARIABLES, &data, &len))
do {

View File

@@ -24,11 +24,21 @@ static int create_dyncol_named(MYSQL *mysql)
DYNAMIC_COLUMN_VALUE *vals;
uint i, column_count= 6;
int rc;
char *strval[]= {"Val1", "Val2", "Val3", "Val4", "Val5", "Val6"};
MYSQL_LEX_STRING keys1[]= {{"key1", 4}, {"key2", 4}, {"key3", 4}, {"key4", 4}, {"key5", 4}, {"key6", 4}},
keys2[]= {{"key1", 4}, {"key1", 4}, {"key3", 4}, {"key4", 4}, {"key5", 4}, {"key6", 4}},
keys3[]= {{"\x70\x61\x72\x61\x00\x30", 6}, {"\x70\x61\x72\x61\x00\x31", 6}, {"\x70\x61\x72\x61\x00\x32", 6},
{"\x70\x61\x72\x61\x00\x33", 6}, {"\x70\x61\x72\x61\x00\x34", 6}, {"\x70\x61\x72\x61\x00\x35", 6}};
const char *strval[]= {"Val1", "Val2", "Val3", "Val4", "Val5", "Val6"};
MYSQL_LEX_STRING keys1[]= {{(char *)"key1", 4}, {(char *)"key2", 4},
{(char *)"key3", 4}, {(char *)"key4", 4},
{(char *)"key5", 4}, {(char *)"key6", 4}},
keys2[]= {{(char *)"key1", 4}, {(char *)"key1", 4},
{(char *)"key3", 4}, {(char *)"key4", 4},
{(char *)"key5", 4}, {(char *)"key6", 4}},
keys3[]= {{(char *)"\x70\x61\x72\x61\x00\x30", 6},
{(char *)"\x70\x61\x72\x61\x00\x31", 6},
{(char *)"\x70\x61\x72\x61\x00\x32", 6},
{(char *)"\x70\x61\x72\x61\x00\x33", 6},
{(char *)"\x70\x61\x72\x61\x00\x34", 6},
{(char *)"\x70\x61\x72\x61\x00\x35", 6}};
MYSQL_LEX_STRING *my_keys;
uint my_count;
@@ -37,7 +47,7 @@ static int create_dyncol_named(MYSQL *mysql)
for (i=0; i < column_count; i++)
{
vals[i].type= DYN_COL_STRING;
vals[i].x.string.value.str= strval[i];
vals[i].x.string.value.str= (char *)strval[i];
vals[i].x.string.value.length= strlen(strval[i]);
vals[i].x.string.charset= (MARIADB_CHARSET_INFO *)mysql->charset;
diag("%s", keys3[i].str);
@@ -87,7 +97,7 @@ static int create_dyncol_named(MYSQL *mysql)
FAIL_IF(rc < 0, "update failed");
mariadb_dyncol_free(&dyncol);
keys3[0].str= "test";
keys3[0].str= (char *)"test";
for (i=0; i < column_count; i++)
diag("%s", my_keys[i].str);
@@ -96,7 +106,7 @@ static int create_dyncol_named(MYSQL *mysql)
return OK;
}
static int mdev_4994(MYSQL *mysql)
static int mdev_4994(MYSQL *unused __attribute__((unused)))
{
DYNAMIC_COLUMN dyncol;
uint key= 1;
@@ -121,22 +131,22 @@ static int create_dyncol_num(MYSQL *mysql)
MYSQL_LEX_STRING *my_keys;
DYNAMIC_COLUMN_VALUE *my_vals;
int rc;
char *strval[]= {"Val1", "Val2", "Val3", "Val4", "Val5"};
const char *strval[]= {"Val1", "Val2", "Val3", "Val4", "Val5"};
uint keys1[5]= {1,2,3,4,5},
keys2[5]= {1,2,2,4,5};
MYSQL_LEX_STRING key1= {"1",1};
MYSQL_LEX_STRING key1= {(char *)"1",1};
for (i=0; i < column_count; i++)
{
vals[i].type= DYN_COL_STRING;
vals[i].x.string.value.str= strval[i];
vals[i].x.string.value.str= (char *)strval[i];
vals[i].x.string.value.length= strlen(strval[i]);
vals[i].x.string.charset= (MARIADB_CHARSET_INFO *)mysql->charset;
}
FAIL_IF(mariadb_dyncol_create_many_num(&dyncol, column_count, keys1, vals, 1) <0, "Error (keys1)");
vals[0].x.string.value.str= strval[1];
vals[0].x.string.value.str= (char *)strval[1];
rc= mariadb_dyncol_update_many_named(&dyncol,1, &key1, vals);
diag("update: %d", rc);
@@ -163,10 +173,10 @@ static int mdev_x1(MYSQL *mysql)
int rc;
uint i;
uint num_keys[5]= {1,2,3,4,5};
char *strval[]= {"Val1", "Val2", "Val3", "Val4", "Val5"};
const char *strval[]= {"Val1", "Val2", "Val3", "Val4", "Val5"};
DYNAMIC_COLUMN_VALUE vals[5];
DYNAMIC_COLUMN dynstr;
MYSQL_LEX_STRING my_key= {"1", 2};
MYSQL_LEX_STRING my_key= {(char *)"1", 2};
uint unpack_columns;
MYSQL_LEX_STRING *unpack_keys;
DYNAMIC_COLUMN_VALUE *unpack_vals;
@@ -174,7 +184,7 @@ static int mdev_x1(MYSQL *mysql)
for (i=0; i < 5; i++)
{
vals[i].type= DYN_COL_STRING;
vals[i].x.string.value.str= strval[i];
vals[i].x.string.value.str= (char *)strval[i];
vals[i].x.string.value.length= strlen(strval[i]);
vals[i].x.string.charset= (MARIADB_CHARSET_INFO *)mysql->charset;
}
@@ -233,7 +243,7 @@ static int mdev_x1(MYSQL *mysql)
return OK;
}
static int dyncol_column_count(MYSQL *mysql)
static int dyncol_column_count(MYSQL *unused __attribute__((unused)))
{
DYNAMIC_COLUMN dyncol;
uint column_count= 5;

View File

@@ -44,7 +44,7 @@ static int test_ps_client_warnings(MYSQL *mysql)
{
int rc;
MYSQL_STMT *stmt;
char *query= "DROP TABLE IF EXISTS test_non_exists";
const char *query= "DROP TABLE IF EXISTS test_non_exists";
rc= mysql_query(mysql, "DROP TABLE if exists test_non_exists");
check_mysql_rc(rc, mysql);
@@ -109,7 +109,7 @@ static int test_ps_client_errors(MYSQL *mysql)
{
int rc;
MYSQL_STMT *stmt;
char *query= "DROP TABLE test_non_exists";
const char *query= "DROP TABLE test_non_exists";
rc= mysql_query(mysql, "DROP TABLE if exists test_non_exists");
check_mysql_rc(rc, mysql);

View File

@@ -175,7 +175,7 @@ static int com_multi_ps2(MYSQL *mysql)
MYSQL_BIND bind[2];
int intval= 3, rc;
int i;
char *varval= "com_multi_ps2";
const char *varval= "com_multi_ps2";
unsigned int param_count= 2;
if (!have_com_multi)
@@ -189,7 +189,7 @@ static int com_multi_ps2(MYSQL *mysql)
bind[0].buffer_type= MYSQL_TYPE_SHORT;
bind[0].buffer= &intval;
bind[1].buffer_type= MYSQL_TYPE_STRING;
bind[1].buffer= varval;
bind[1].buffer= (char *)varval;
bind[1].buffer_length= strlen(varval);
stmt= mysql_stmt_init(mysql);
@@ -271,7 +271,7 @@ static int execute_direct_example(MYSQL *mysql)
MYSQL_BIND bind[2];
int intval= 1;
int param_count= 2;
char *strval= "execute_direct_example";
const char *strval= "execute_direct_example";
/* Direct execution without parameters */
if (mariadb_stmt_execute_direct(stmt, "DROP TABLE IF EXISTS execute_direct", -1))
@@ -283,7 +283,7 @@ static int execute_direct_example(MYSQL *mysql)
bind[0].buffer_type= MYSQL_TYPE_SHORT;
bind[0].buffer= &intval;
bind[1].buffer_type= MYSQL_TYPE_STRING;
bind[1].buffer= strval;
bind[1].buffer= (char *)strval;
bind[1].buffer_length= strlen(strval);
/* set number of parameters */

View File

@@ -187,7 +187,7 @@ static int test_fetch_seek(MYSQL *mysql)
int rc;
int32 c1;
char c2[11], c3[20];
char *query = "SELECT * FROM t1";
const char *query = "SELECT * FROM t1";
rc= mysql_query(mysql, "drop table if exists t1");
check_mysql_rc(rc, mysql);
@@ -273,7 +273,7 @@ static int test_fetch_offset(MYSQL *mysql)
ulong length[2];
int rc;
my_bool is_null[2];
char *query = "SELECT * FROM t1";
const char *query = "SELECT * FROM t1";
rc= mysql_query(mysql, "drop table if exists t1");
@@ -396,7 +396,7 @@ static int test_fetch_column(MYSQL *mysql)
char c2[20], bc2[20];
ulong l1, l2, bl1, bl2;
int rc, c1, bc1;
char *query= "SELECT * FROM t1 ORDER BY c2 DESC";
const char *query= "SELECT * FROM t1 ORDER BY c2 DESC";
rc= mysql_query(mysql, "drop table if exists t1");
check_mysql_rc(rc, mysql);
@@ -516,7 +516,7 @@ static int test_fetch_nobuffs(MYSQL *mysql)
MYSQL_BIND my_bind[4];
char str[4][50];
int rc;
char *query = "SELECT DATABASE(), CURRENT_USER(), \
const char *query = "SELECT DATABASE(), CURRENT_USER(), \
CURRENT_DATE(), CURRENT_TIME()";
stmt = mysql_stmt_init(mysql);
@@ -653,7 +653,7 @@ static int test_fetch_date(MYSQL *mysql)
MYSQL_BIND my_bind[8];
my_bool is_null[8];
ulong length[8];
char *query= "SELECT * FROM test_bind_result";
const char *query= "SELECT * FROM test_bind_result";
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bind_result");
check_mysql_rc(rc, mysql);

View File

@@ -164,7 +164,7 @@ static int bug31418_impl()
return OK;
}
static int test_bug31418(MYSQL *mysql)
static int test_bug31418(MYSQL *unused __attribute__((unused)))
{
int i;
/* Run test case for BUG#31418 for three different connections. */
@@ -312,7 +312,7 @@ static int test_wl4166_1(MYSQL *mysql)
ulong length[7];
my_bool is_null[7];
MYSQL_BIND my_bind[7];
static char *query;
const char *query;
int rc;
int i;
@@ -955,7 +955,7 @@ static int test_conc_114(MYSQL *mysql)
}
/* run with valgrind */
static int test_conc117(MYSQL *mysql)
static int test_conc117(MYSQL *unused __attribute__((unused)))
{
my_bool reconnect= 1;
MYSQL *my= mysql_init(NULL);
@@ -973,7 +973,7 @@ static int test_conc117(MYSQL *mysql)
return OK;
}
static int test_read_timeout(MYSQL *mysql)
static int test_read_timeout(MYSQL *unused __attribute__((unused)))
{
int timeout= 5, rc;
MYSQL *my= mysql_init(NULL);
@@ -1122,7 +1122,7 @@ static int test_zerofill(MYSQL *mysql)
rc= mysql_query(mysql, "SELECT a FROM t1");
check_mysql_rc(rc, mysql);
if (res= mysql_store_result(mysql))
if ((res= mysql_store_result(mysql)))
{
row= mysql_fetch_row(res);
diag("zerofill: %s", row[0]);

View File

@@ -113,10 +113,10 @@ struct my_tests_st
int connection;
ulong connect_flags;
struct my_option_st *options;
char *skipmsg;
const char *skipmsg;
};
static char *schema = 0;
static const char *schema = 0;
static char *hostname = 0;
static char *password = 0;
static unsigned int port = 0;
@@ -159,11 +159,13 @@ static struct my_option test_options[] =
int do_verify_prepare_field(MYSQL_RES *result,
unsigned int no, const char *name,
const char *org_name,
enum enum_field_types type,
enum enum_field_types type __attribute__((unused)),
const char *table,
const char *org_table, const char *db,
unsigned long length, const char *def,
const char *file, int line)
unsigned long length __attribute__((unused)),
const char *def __attribute__((unused)),
const char *file __attribute__((unused)),
int line __attribute__((unused)))
{
MYSQL_FIELD *field;
/* MARIADB_CHARSET_INFO *cs; */
@@ -353,7 +355,7 @@ void get_options(int argc, char **argv)
}
int check_variable(MYSQL *mysql, char *variable, char *value)
int check_variable(MYSQL *mysql, const char *variable, const char *value)
{
char query[MAX_TEST_QUERY_LENGTH];
MYSQL_RES *result;

View File

@@ -27,7 +27,7 @@ static int perf1(MYSQL *mysql)
{
int rc;
MYSQL_STMT *stmt;
char *stmtstr= "SELECT s.emp_no, s.salary, e.emp_no, e.first_name, e.last_name, e.gender FROM salaries s, employees e WHERE s.emp_no = e.emp_no";
const char *stmtstr= "SELECT s.emp_no, s.salary, e.emp_no, e.first_name, e.last_name, e.gender FROM salaries s, employees e WHERE s.emp_no = e.emp_no";
rc= mysql_select_db(mysql, "employees");
if (rc)

View File

@@ -47,14 +47,14 @@ static int test_conc97(MYSQL *mysql)
return OK;
}
static int test_conc83(MYSQL *my)
static int test_conc83(MYSQL *unused __attribute__((unused)))
{
MYSQL_STMT *stmt;
int rc;
MYSQL *mysql= mysql_init(NULL);
my_bool reconnect= 1;
char *query= "SELECT 1,2,3 FROM DUAL";
const char *query= "SELECT 1,2,3 FROM DUAL";
stmt= mysql_stmt_init(mysql);
@@ -91,7 +91,7 @@ static int test_conc60(MYSQL *mysql)
{
MYSQL_STMT *stmt;
int rc;
char *query= "SELECT * FROM agendas";
const char *query= "SELECT * FROM agendas";
my_bool x= 1;
stmt= mysql_stmt_init(mysql);
@@ -3558,7 +3558,7 @@ static int test_multi_stmt(MYSQL *mysql)
MYSQL_BIND my_bind[2];
ulong length[2];
my_bool is_null[2];
static char *query;
const char *query;
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_multi_table");
check_mysql_rc(rc, mysql);
@@ -3847,7 +3847,7 @@ static int test_order_param(MYSQL *mysql)
{
MYSQL_STMT *stmt;
int rc;
static char *query;
const char *query;
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
check_mysql_rc(rc, mysql);
@@ -4677,7 +4677,7 @@ static int test_long_data1(MYSQL *mysql)
int rc;
MYSQL_BIND bind[1];
char query[MAX_TEST_QUERY_LENGTH];
char *data= "12345";
const char *data= "12345";
rc= mysql_autocommit(mysql, TRUE);
check_mysql_rc(rc, mysql);
@@ -4715,7 +4715,7 @@ int test_blob_9000(MYSQL *mysql)
MYSQL_STMT *stmt;
int rc;
char buffer[9200];
char *query= "INSERT INTO tb9000 VALUES (?)";
const char *query= "INSERT INTO tb9000 VALUES (?)";
rc= mysql_query(mysql, "DROP TABLE IF EXISTS tb9000");
check_mysql_rc(rc, mysql);
@@ -4743,7 +4743,7 @@ int test_fracseconds(MYSQL *mysql)
{
MYSQL_STMT *stmt;
int rc;
char *str= "SELECT NOW(6)";
const char *str= "SELECT NOW(6)";
char buffer[60], buffer1[60];
MYSQL_BIND bind[2];
@@ -4818,7 +4818,7 @@ int test_notrunc(MYSQL *mysql)
my_bool error= 0;
unsigned long len= 1;
char *query= "SELECT '1234567890', 'foo' FROM DUAL";
const char *query= "SELECT '1234567890', 'foo' FROM DUAL";
mysql_options(mysql, MYSQL_REPORT_DATA_TRUNCATION, &trunc);
@@ -4863,7 +4863,7 @@ static int test_bit2tiny(MYSQL *mysql)
char data[11];
unsigned long length[2];
my_bool is_null[2], error[2];
char *query = "SELECT val FROM justbit";
const char *query = "SELECT val FROM justbit";
MYSQL_STMT *stmt;
int rc;

View File

@@ -39,7 +39,7 @@ static int cmp_double(double *a, double *b)
static int test_conc67(MYSQL *mysql)
{
MYSQL_STMT *stmt= mysql_stmt_init(mysql);
char *query= "SELECT a,b FROM conc67 WHERE a=?";
const char *query= "SELECT a,b FROM conc67 WHERE a=?";
int rc, i;
MYSQL_BIND bind[2];
char val[20];
@@ -545,8 +545,8 @@ static int test_bug1500(MYSQL *mysql)
MYSQL_BIND my_bind[3];
int rc= 0;
int32 int_data[3]= {2, 3, 4};
char *data;
char *query;
const char *data;
const char *query;
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bg1500");
@@ -3749,7 +3749,7 @@ static int test_bug53311(MYSQL *mysql)
int rc;
MYSQL_STMT *stmt;
int i;
char *query= "INSERT INTO bug53311 VALUES (1)";
const char *query= "INSERT INTO bug53311 VALUES (1)";
rc= mysql_options(mysql, MYSQL_OPT_RECONNECT, "1");
check_mysql_rc(rc, mysql);
@@ -3837,7 +3837,7 @@ end:
static int test_conc_5(MYSQL *mysql)
{
char *query= "SELECT a FROM t1";
const char *query= "SELECT a FROM t1";
MYSQL_RES *res;
MYSQL_STMT *stmt;
MYSQL_FIELD *fields;
@@ -3874,7 +3874,7 @@ static int test_conc_5(MYSQL *mysql)
static int test_conc141(MYSQL *mysql)
{
int rc;
char *query= "CALL p_conc141";
const char *query= "CALL p_conc141";
MYSQL_STMT *stmt= mysql_stmt_init(mysql);
rc= mysql_query(mysql, "DROP TABLE IF EXISTS conc141");
@@ -4108,7 +4108,7 @@ static int test_conc167(MYSQL *mysql)
char buffer[100];
int bit1=0, bit2=0;
int rc;
char *stmt_str= "SELECT a,b,c FROM conc168";
const char *stmt_str= "SELECT a,b,c FROM conc168";
rc= mysql_query(mysql, "DROP TABLE IF EXISTS conc168");
check_mysql_rc(rc, mysql);
@@ -4154,7 +4154,7 @@ static int test_conc177(MYSQL *mysql)
MYSQL_STMT *stmt;
int rc;
MYSQL_BIND bind[2];
char *stmt_str= "SELECT a,b FROM t1";
const char *stmt_str= "SELECT a,b FROM t1";
char buf1[128], buf2[128];
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
@@ -4229,7 +4229,7 @@ static int test_conc179(MYSQL *mysql)
{
MYSQL_STMT *stmt;
int rc;
char *stmtstr= "CREATE TABLE t1 (`blurb_id` int NOT NULL DEFAULT 0, `blurb` text default '', PRIMARY KEY (blurb_id)) ENGINE='FEDERATED' DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1'";
const char *stmtstr= "CREATE TABLE t1 (`blurb_id` int NOT NULL DEFAULT 0, `blurb` text default '', PRIMARY KEY (blurb_id)) ENGINE='FEDERATED' DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1'";
rc= mysql_query(mysql, "set sql_mode=''");
check_mysql_rc(rc, mysql);
@@ -4301,7 +4301,7 @@ static int test_conc181(MYSQL *mysql)
MYSQL_STMT *stmt;
int rc;
MYSQL_BIND bind;
char *stmt_str= "SELECT a FROM t1";
const char *stmt_str= "SELECT a FROM t1";
float f=1;
my_bool err= 0;

View File

@@ -135,7 +135,7 @@ int test_sp_params(MYSQL *mysql)
MYSQL_STMT *stmt;
int a[] = {10,20,30};
MYSQL_BIND bind[3];
char *stmtstr= "CALL P1(?,?,?)";
const char *stmtstr= "CALL P1(?,?,?)";
char res[3][20];
rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p1");
@@ -219,7 +219,7 @@ int test_sp_reset(MYSQL *mysql)
MYSQL_STMT *stmt;
int a[] = {10,20,30};
MYSQL_BIND bind[3];
char *stmtstr= "CALL P1(?,?,?)";
const char *stmtstr= "CALL P1(?,?,?)";
rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p1");
check_mysql_rc(rc, mysql);
@@ -274,7 +274,7 @@ int test_sp_reset1(MYSQL *mysql)
MYSQL_BIND bind[1];
char tmp[20];
char *stmtstr= "CALL P1(?)";
const char *stmtstr= "CALL P1(?)";
rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p1");
check_mysql_rc(rc, mysql);
@@ -332,7 +332,7 @@ int test_sp_reset2(MYSQL *mysql)
MYSQL_STMT *stmt;
MYSQL_BIND bind[4];
long l[4];
char *stmtstr= "CALL P1()";
const char *stmtstr= "CALL P1()";
memset(l, 0, sizeof(l));
@@ -425,7 +425,7 @@ int test_query(MYSQL *mysql)
MYSQL_BIND bind[1];
char tmp[20];
char *stmtstr= "CALL P1(?)";
const char *stmtstr= "CALL P1(?)";
rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p1");
check_mysql_rc(rc, mysql);

View File

@@ -123,7 +123,7 @@ static int test_ssl(MYSQL *mysql)
res= mysql_store_result(mysql);
row= mysql_fetch_row(res);
diag("user: %s", row[0]);
if (p= strchr(row[0], '@'))
if ((p= strchr(row[0], '@')))
strcpy(sslhost, p+1);
mysql_free_result(res);
}
@@ -131,7 +131,7 @@ static int test_ssl(MYSQL *mysql)
return OK;
}
static int test_ssl_cipher(MYSQL *unused)
static int test_ssl_cipher(MYSQL *unused __attribute__((unused)))
{
MYSQL *my;
MYSQL_RES *res;
@@ -162,7 +162,7 @@ static int test_ssl_cipher(MYSQL *unused)
return OK;
}
static int test_conc95(MYSQL *my)
static int test_conc95(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql;
@@ -190,7 +190,7 @@ static int test_conc95(MYSQL *my)
return OK;
}
static int test_multi_ssl_connections(MYSQL *unused)
static int test_multi_ssl_connections(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql[50], *my;
int i, rc;
@@ -255,7 +255,7 @@ static int test_multi_ssl_connections(MYSQL *unused)
}
#ifndef WIN32
static void ssl_thread(void *dummy)
static void ssl_thread(void *unused __attribute__((unused)))
#else
DWORD WINAPI ssl_thread(void *dummy)
#endif
@@ -343,7 +343,7 @@ static int test_ssl_threads(MYSQL *mysql)
return OK;
}
static int test_phpbug51647(MYSQL *my)
static int test_phpbug51647(MYSQL *unused __attribute__((unused)))
{
MYSQL* mysql;
@@ -365,7 +365,7 @@ static int test_phpbug51647(MYSQL *my)
return OK;
}
static int test_password_protected(MYSQL *my)
static int test_password_protected(MYSQL *unused __attribute__((unused)))
{
MYSQL* mysql;
@@ -390,7 +390,7 @@ static int test_password_protected(MYSQL *my)
}
static int test_conc50(MYSQL *my)
static int test_conc50(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql;
@@ -411,7 +411,7 @@ static int test_conc50(MYSQL *my)
return OK;
}
static int test_conc50_1(MYSQL *my)
static int test_conc50_1(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql;
@@ -433,7 +433,7 @@ static int test_conc50_1(MYSQL *my)
return OK;
}
static int test_conc50_2(MYSQL *my)
static int test_conc50_2(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql;
@@ -453,10 +453,13 @@ static int test_conc50_2(MYSQL *my)
return OK;
}
static int test_conc127(MYSQL *my)
static int test_conc127(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql;
diag("test disabled - for testing disable other tests or run this test as first test");
return SKIP;
if (check_skip_ssl())
return SKIP;
@@ -474,7 +477,7 @@ static int test_conc127(MYSQL *my)
return OK;
}
static int test_conc50_3(MYSQL *my)
static int test_conc50_3(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql;
@@ -507,7 +510,7 @@ static int test_conc50_3(MYSQL *my)
return OK;
}
static int test_conc50_4(MYSQL *my)
static int test_conc50_4(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql;
@@ -527,7 +530,7 @@ static int test_conc50_4(MYSQL *my)
return OK;
}
static int verify_ssl_server_cert(MYSQL *my)
static int verify_ssl_server_cert(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql;
uint verify= 1;
@@ -550,7 +553,7 @@ static int verify_ssl_server_cert(MYSQL *my)
return OK;
}
static int test_bug62743(MYSQL *my)
static int test_bug62743(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql;
@@ -638,7 +641,7 @@ DWORD WINAPI thread_conc102(void)
check_mysql_rc(rc, mysql);
pthread_mutex_unlock(&LOCK_test);
check_mysql_rc(rc, mysql);
if (res= mysql_store_result(mysql))
if ((res= mysql_store_result(mysql)))
mysql_free_result(res);
end:
mysql_close(mysql);
@@ -702,7 +705,7 @@ static int test_conc_102(MYSQL *mysql)
const char *ssl_cert_finger_print= "@SSL_CERT_FINGER_PRINT@";
static int test_ssl_fp(MYSQL *unused)
static int test_ssl_fp(MYSQL *unused __attribute__((unused)))
{
MYSQL *my;
MYSQL_RES *res;
@@ -741,7 +744,7 @@ static int test_ssl_fp(MYSQL *unused)
return OK;
}
static int test_ssl_fp_list(MYSQL *unused)
static int test_ssl_fp_list(MYSQL *unused __attribute__((unused)))
{
MYSQL *my;
@@ -763,7 +766,7 @@ static int test_ssl_fp_list(MYSQL *unused)
return OK;
}
static int test_ssl_version(MYSQL *mysql)
static int test_ssl_version(MYSQL *unused __attribute__((unused)))
{
unsigned int iversion;
const char *version, *library;
@@ -794,7 +797,7 @@ static int test_ssl_version(MYSQL *mysql)
}
#ifdef HAVE_SCHANNEL
static int test_schannel_cipher(MYSQL *mysql)
static int test_schannel_cipher(MYSQL *unused __attribute__((unused)))
{
MYSQL *my;
unsigned int cipher_strength= 256;
@@ -823,7 +826,7 @@ static int test_schannel_cipher(MYSQL *mysql)
struct my_tests_st my_tests[] = {
{"test_ssl", test_ssl, TEST_CONNECTION_NEW, 0, NULL, NULL},
// {"test_conc127", test_conc127, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_conc127", test_conc127, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_ssl_fp", test_ssl_fp, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_ssl_fp_list", test_ssl_fp_list, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_conc50", test_conc50, TEST_CONNECTION_NEW, 0, NULL, NULL},

View File

@@ -4,7 +4,7 @@
#include "my_test.h"
#include "ma_pvio.h"
static int aurora1(MYSQL *my)
static int aurora1(MYSQL *unused __attribute__((unused)))
{
int rc;
my_bool read_only= 1;
@@ -54,7 +54,7 @@ static int aurora1(MYSQL *my)
return OK;
}
static int test_wrong_user(MYSQL *my)
static int test_wrong_user(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql= mysql_init(NULL);
@@ -68,7 +68,7 @@ static int test_wrong_user(MYSQL *my)
return OK;
}
static int test_reconnect(MYSQL *my)
static int test_reconnect(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql= mysql_init(NULL);
MYSQL_RES *res;

View File

@@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "my_test.h"
static int test_conc_173(MYSQL *my)
static int test_conc_173(MYSQL *unused __attribute__((unused)))
{
MYSQL mysql;
int arg;

View File

@@ -4,7 +4,7 @@
#include "my_test.h"
#include <ma_pthread.h>
static int basic_connect(MYSQL *mysql)
static int basic_connect(MYSQL *unused __attribute__((unused)))
{
MYSQL_ROW row;
MYSQL_RES *res;