diff --git a/libmariadb/my_stmt_codec.c b/libmariadb/my_stmt_codec.c index 801df9b4..457ab7db 100644 --- a/libmariadb/my_stmt_codec.c +++ b/libmariadb/my_stmt_codec.c @@ -672,7 +672,7 @@ static void convert_to_datetime(MYSQL_TIME *t, unsigned char **row, uint len, en if (len) { unsigned char *to= *row; - int has_date= 0, has_time= 0; + int has_date= 0; uint offset= 7; if (type == MYSQL_TYPE_TIME) @@ -695,7 +695,6 @@ static void convert_to_datetime(MYSQL_TIME *t, unsigned char **row, uint len, en if (len > 4) { - has_time= 1; t->hour= (uint) to[4]; t->minute= (uint) to[5]; t->second= (uint) to[6]; diff --git a/libmariadb/my_thr_init.c b/libmariadb/my_thr_init.c index c0d546dc..3b5661dc 100644 --- a/libmariadb/my_thr_init.c +++ b/libmariadb/my_thr_init.c @@ -124,7 +124,6 @@ static long thread_id=0; my_bool my_thread_init(void) { struct st_my_thread_var *tmp; - my_bool rc= 0; if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys)) { DBUG_PRINT("info", ("my_thread_init was already called. Thread id: %lu", diff --git a/unittest/libmariadb/basic-t.c b/unittest/libmariadb/basic-t.c index 77077389..6bfb0972 100644 --- a/unittest/libmariadb/basic-t.c +++ b/unittest/libmariadb/basic-t.c @@ -495,7 +495,7 @@ static int test_reconnect_maxpackage(MYSQL *my) res= mysql_store_result(mysql); row= mysql_fetch_row(res); max_packet= atol(row[0]); - diag("max_allowed_packet=%d", max_packet); + diag("max_allowed_packet=%lu", max_packet); mysql_free_result(res); query= (char *)malloc(max_packet + 30); @@ -522,7 +522,7 @@ static int test_reconnect_maxpackage(MYSQL *my) res= mysql_store_result(mysql); row= mysql_fetch_row(res); max_packet= atol(row[0]); - diag("max_allowed_packet=%d", max_packet); + diag("max_allowed_packet=%lu", max_packet); mysql_free_result(res); @@ -535,7 +535,6 @@ static int test_compressed(MYSQL *my) int rc; MYSQL *mysql= mysql_init(NULL); MYSQL_RES *res; - char *query; mysql_options(mysql, MYSQL_OPT_COMPRESS, (void *)1); FAIL_IF(!mysql_real_connect(mysql, hostname, username, password, schema, diff --git a/unittest/libmariadb/connection.c b/unittest/libmariadb/connection.c index 7a27bca5..dc779f72 100644 --- a/unittest/libmariadb/connection.c +++ b/unittest/libmariadb/connection.c @@ -520,12 +520,12 @@ static int test_reconnect(MYSQL *mysql) FAIL_UNLESS(mysql1->reconnect == 1, "reconnect != 1"); - diag("Thread_id before kill: %d", mysql_thread_id(mysql1)); + diag("Thread_id before kill: %lu", mysql_thread_id(mysql1)); mysql_kill(mysql, mysql_thread_id(mysql1)); rc= mysql_query(mysql1, "SELECT 1 FROM DUAL LIMIT 0"); check_mysql_rc(rc, mysql1); - diag("Thread_id after kill: %d", mysql_thread_id(mysql1)); + diag("Thread_id after kill: %lu", mysql_thread_id(mysql1)); FAIL_UNLESS(mysql1->reconnect == 1, "reconnect != 1"); mysql_close(mysql1); diff --git a/unittest/libmariadb/my_test.h b/unittest/libmariadb/my_test.h index 561c2fbb..2ad3feaf 100644 --- a/unittest/libmariadb/my_test.h +++ b/unittest/libmariadb/my_test.h @@ -479,7 +479,7 @@ void run_tests(struct my_tests_st *test) { if (!mysql_default && (test[i].connection & TEST_CONNECTION_DEFAULT)) { diag("MySQL server not running"); - skip(1, test[i].name); + skip(1, "%s", test[i].name); } else if (!test[i].skipmsg) { mysql= mysql_default; if (test[i].connection & TEST_CONNECTION_NEW) @@ -491,9 +491,9 @@ void run_tests(struct my_tests_st *test) { rc= test[i].function(mysql); if (rc == SKIP) - skip(1, test[i].name); + skip(1, "%s", test[i].name); else - ok(rc == OK, test[i].name); + ok(rc == OK, "%s", test[i].name); /* if test failed, close and reopen default connection to prevent errors for further tests */ @@ -509,7 +509,7 @@ void run_tests(struct my_tests_st *test) { else if (mysql && !(test[i].connection & TEST_CONNECTION_DONT_CLOSE)) mysql_close(mysql); } else { - skip(1, test[i].skipmsg); + skip(1, "%s", test[i].skipmsg); } } if (mysql_default) { diff --git a/unittest/libmariadb/ps.c b/unittest/libmariadb/ps.c index e5c3bb81..ca446fed 100644 --- a/unittest/libmariadb/ps.c +++ b/unittest/libmariadb/ps.c @@ -4733,7 +4733,9 @@ int test_notrunc(MYSQL *mysql) my_bool trunc= 1; MYSQL_BIND bind[1]; char buffer[5]; - int rc, len= 1, error= 0; + int rc; + my_bool error= 0; + unsigned long len= 1; char *query= "SELECT '1234567890' FROM DUAL"; @@ -4759,7 +4761,7 @@ int test_notrunc(MYSQL *mysql) mysql_stmt_store_result(stmt); rc= mysql_stmt_fetch(stmt); - diag("rc= %d len=%d", rc, len); + diag("rc= %d len=%lu", rc, len); mysql_stmt_close(stmt); return OK; diff --git a/unittest/libmariadb/ps_new.c b/unittest/libmariadb/ps_new.c index 7f33bef0..764f273a 100644 --- a/unittest/libmariadb/ps_new.c +++ b/unittest/libmariadb/ps_new.c @@ -376,7 +376,7 @@ int test_sp_reset2(MYSQL *mysql) while (rc != MYSQL_NO_DATA) { rc= mysql_stmt_fetch(stmt); - diag("l=%d", l[0]); + diag("l=%ld", l[0]); } rc= mysql_stmt_next_result(stmt); @@ -389,7 +389,7 @@ int test_sp_reset2(MYSQL *mysql) while (rc != MYSQL_NO_DATA) { rc= mysql_stmt_fetch(stmt); - diag("l=%d l=%d", l[0], l[1]); + diag("l=%ld l=%ld", l[0], l[1]); } @@ -403,7 +403,7 @@ int test_sp_reset2(MYSQL *mysql) while (rc != MYSQL_NO_DATA) { rc= mysql_stmt_fetch(stmt); - diag("l=%d l=%d l=%d", l[0], l[1], l[2]); + diag("l=%ld l=%ld l=%ld", l[0], l[1], l[2]); } rc= mysql_stmt_close(stmt); diff --git a/unittest/libmariadb/sqlite3.c b/unittest/libmariadb/sqlite3.c index 843280d3..3d964807 100644 --- a/unittest/libmariadb/sqlite3.c +++ b/unittest/libmariadb/sqlite3.c @@ -4,6 +4,7 @@ #include "my_test.h" +#ifdef HAVE_SQLITE static int test1(MYSQL *mysql) { MYSQL_ROW row; @@ -20,7 +21,7 @@ static int test1(MYSQL *mysql) diag("Server name: %s", mysql_get_server_name(my)); - diag("Connected to: %s (%d)", mysql_get_server_info(my), mysql_get_server_version(my)); + diag("Connected to: %s (%lu)", mysql_get_server_info(my), mysql_get_server_version(my)); rc= mysql_query(my, "CREATE TABLE t1 (a int, b varchar(255))"); rc= mysql_query(my, "DELETE FROM t1"); @@ -168,6 +169,7 @@ static int test_simple_prepare(MYSQL *my) return OK; } +#endif struct my_tests_st my_tests[] = {