From 642bc31ed2aa6b2c3235d8419f54a5557a96369f Mon Sep 17 00:00:00 2001 From: Georg Richter Date: Sat, 21 Oct 2023 08:09:40 +0200 Subject: [PATCH 1/2] Follow up of PR-236 (update ma_context): Since there is no way in the ISO C standard to specify a non-obsolescent function prototype indicating that a function will be called with an arbitrary number (including zero) of arguments of arbitrary types, we have to cast the callback function in makecontext() call to avoid compiler warnings/errors. See also: https://pubs.opengroup.org/onlinepubs/009695399/functions/makecontext.html --- libmariadb/ma_context.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libmariadb/ma_context.c b/libmariadb/ma_context.c index 15e22240..afc8acb8 100644 --- a/libmariadb/ma_context.c +++ b/libmariadb/ma_context.c @@ -30,6 +30,9 @@ #endif #ifdef MY_CONTEXT_USE_UCONTEXT + +typedef void (*uc_func_t)(void); + /* The makecontext() only allows to pass integers into the created context :-( We want to pass pointers, so we do it this kinda hackish way. @@ -100,7 +103,7 @@ my_context_spawn(struct my_context *c, void (*f)(void *), void *d) c->user_data= d; c->active= 1; u.p= c; - makecontext(&c->spawned_context, my_context_spawn_internal, 2, + makecontext(&c->spawned_context, (uc_func_t)my_context_spawn_internal, 2, u.a[0], u.a[1]); return my_context_continue(c); From 8320f0d54d50635e82b723c151ac92c9528d0e79 Mon Sep 17 00:00:00 2001 From: Georg Richter Date: Sat, 21 Oct 2023 19:43:42 +0200 Subject: [PATCH 2/2] Fix error on 32-bit systems Problem was introduced with fix for CONC-668. --- libmariadb/ma_net.c | 2 +- plugins/auth/my_auth.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libmariadb/ma_net.c b/libmariadb/ma_net.c index 3451bf70..31e30352 100644 --- a/libmariadb/ma_net.c +++ b/libmariadb/ma_net.c @@ -292,7 +292,7 @@ static int ma_net_write_buff(NET *net,const char *packet, size_t len) return 0; } -unsigned char *mysql_net_store_length(unsigned char *packet, size_t length); +unsigned char *mysql_net_store_length(unsigned char *packet, ulonglong length); /* Read and write using timeouts */ diff --git a/plugins/auth/my_auth.c b/plugins/auth/my_auth.c index ce3bdd59..215f3136 100644 --- a/plugins/auth/my_auth.c +++ b/plugins/auth/my_auth.c @@ -12,7 +12,7 @@ static int dummy_fallback_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql __attr extern void read_user_name(char *name); extern char *ma_send_connect_attr(MYSQL *mysql, unsigned char *buffer); extern int ma_read_ok_packet(MYSQL *mysql, uchar *pos, ulong length); -extern unsigned char *mysql_net_store_length(unsigned char *packet, size_t length); +extern unsigned char *mysql_net_store_length(unsigned char *packet, ulonglong length); typedef struct { int (*read_packet)(struct st_plugin_vio *vio, uchar **buf);