From 1d3fd5818a0f97832b69bb60ee1a49d5c1faea4c Mon Sep 17 00:00:00 2001 From: Georg Richter Date: Wed, 29 Jun 2022 13:27:28 +0200 Subject: [PATCH 1/2] Test fix for test_bug4236 --- client/ma_plugin_info.c | 2 +- unittest/libmariadb/ps_bugs.c | 18 +----------------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/client/ma_plugin_info.c b/client/ma_plugin_info.c index 15951318..73834e12 100644 --- a/client/ma_plugin_info.c +++ b/client/ma_plugin_info.c @@ -204,7 +204,7 @@ int main(int argc, char *argv[]) usage(); break; default: - printf("unrecocognized option: %s", argv[1]); + printf("unrecognized option: %s", argv[1]); exit(1); } exit(0); diff --git a/unittest/libmariadb/ps_bugs.c b/unittest/libmariadb/ps_bugs.c index b5173a76..8e0a102f 100644 --- a/unittest/libmariadb/ps_bugs.c +++ b/unittest/libmariadb/ps_bugs.c @@ -2474,12 +2474,10 @@ static int test_bug4231(MYSQL *mysql) static int test_bug4236(MYSQL *mysql) { - MYSQL_STMT *stmt, *stmt1; + MYSQL_STMT *stmt; const char *stmt_text; int rc; MYSQL_STMT backup; - MYSQL *mysql1; - stmt= mysql_stmt_init(mysql); @@ -2493,20 +2491,6 @@ static int test_bug4236(MYSQL *mysql) rc= mysql_stmt_execute(stmt); FAIL_IF(!rc, "Error expected"); - /* lets try to hack with a new connection */ - mysql1= test_connect(NULL); - stmt1= mysql_stmt_init(mysql1); - stmt_text= "SELECT 2"; - rc= mysql_stmt_prepare(stmt1, SL(stmt_text)); - check_stmt_rc(rc, stmt); - - stmt->stmt_id= stmt1->stmt_id; - rc= mysql_stmt_execute(stmt); - FAIL_IF(!rc, "Error expected"); - - mysql_stmt_close(stmt1); - mysql_close(mysql1); - /* Restore original statement id to be able to reprepare it */ stmt->stmt_id= backup.stmt_id; From dab59732d976f082101caea2501e21ae733da1a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 11 Apr 2024 14:47:28 +0300 Subject: [PATCH 2/2] Fix GCC 14 -Wcalloc-transposed-args --- unittest/libmariadb/bulk1.c | 4 ++-- unittest/libmariadb/ps_bugs.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/unittest/libmariadb/bulk1.c b/unittest/libmariadb/bulk1.c index e1c31eaa..62267cd7 100644 --- a/unittest/libmariadb/bulk1.c +++ b/unittest/libmariadb/bulk1.c @@ -74,8 +74,8 @@ static int bulk1(MYSQL *mysql) /* allocate memory */ buffer= calloc(TEST_ARRAY_SIZE, sizeof(char *)); - lengths= (unsigned long *)calloc(sizeof(long), TEST_ARRAY_SIZE); - vals= (unsigned int *)calloc(sizeof(int), TEST_ARRAY_SIZE); + lengths= calloc(TEST_ARRAY_SIZE, sizeof *lengths); + vals= calloc(TEST_ARRAY_SIZE, sizeof *vals); for (i=0; i < TEST_ARRAY_SIZE; i++) { diff --git a/unittest/libmariadb/ps_bugs.c b/unittest/libmariadb/ps_bugs.c index 8e0a102f..f73ce643 100644 --- a/unittest/libmariadb/ps_bugs.c +++ b/unittest/libmariadb/ps_bugs.c @@ -5115,7 +5115,7 @@ static int test_maxparam(MYSQL *mysql) MYSQL_STMT *stmt= mysql_stmt_init(mysql); MYSQL_BIND* bind; - bind = calloc(sizeof(MYSQL_BIND), 65535); + bind = calloc(65535, sizeof *bind); rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); check_mysql_rc(rc, mysql);