diff --git a/include/my_net.h b/include/my_net.h index bce7e551..3c4cb8b1 100644 --- a/include/my_net.h +++ b/include/my_net.h @@ -41,6 +41,8 @@ extern "C" { #define h_errno errno #endif +void my_inet_ntoa(struct in_addr in, char *buf); + #ifdef __cplusplus } #endif diff --git a/include/my_pthread.h b/include/my_pthread.h index ed0ad115..54e4d2cf 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -372,11 +372,9 @@ struct tm *localtime_r(const time_t *clock, struct tm *res); #define pthread_kill(A,B) pthread_dummy(0) #undef pthread_detach_this_thread #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); } -#else /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ -#if (!defined(HAVE_PTHREAD_KILL)) ++#elif !defined(HAVE_PTHREAD_KILL) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ #define HAVE_PTHREAD_KILL #endif -#endif #endif /* defined(_WIN32) */ diff --git a/include/my_stmt.h b/include/my_stmt.h index 4b1e6b55..7601e25c 100644 --- a/include/my_stmt.h +++ b/include/my_stmt.h @@ -215,6 +215,8 @@ extern MYSQL_PS_CONVERSION mysql_ps_fetch_functions[MYSQL_TYPE_GEOMETRY + 1]; unsigned long net_safe_read(MYSQL *mysql); void mysql_init_ps_subsystem(void); unsigned long net_field_length(unsigned char **packet); +int simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg, + size_t length, my_bool skipp_check, void *opt_arg); /* * function prototypes */ diff --git a/include/mysql.h b/include/mysql.h index 0557a242..75e9062d 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -25,14 +25,14 @@ extern "C" { #endif -#ifndef _global_h /* If not standard header */ -#include -typedef char my_bool; - #ifndef LIBMARIADB #define LIBMARIADB #endif +#ifndef _global_h /* If not standard header */ +#include +typedef char my_bool; + #if !defined(_WIN32) #define STDCALL #else diff --git a/libmariadb/client_plugin.c b/libmariadb/client_plugin.c index a8e642b5..84d93eda 100644 --- a/libmariadb/client_plugin.c +++ b/libmariadb/client_plugin.c @@ -175,7 +175,9 @@ add_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin, void *dlhandle, goto err2; } +#ifdef THREAD safe_mutex_assert_owner(&LOCK_load_client_plugin); +#endif p->next= plugin_list[plugin->type]; plugin_list[plugin->type]= p; diff --git a/libmariadb/my_auth.c b/libmariadb/my_auth.c index fb7777f2..88ea0a5c 100644 --- a/libmariadb/my_auth.c +++ b/libmariadb/my_auth.c @@ -219,7 +219,7 @@ static int send_change_user_packet(MCPVIO_EXT *mpvio, end= ma_send_connect_attr(mysql, end); res= simple_command(mysql, MYSQL_COM_CHANGE_USER, - buff, (ulong)(end-buff), 1); + buff, (ulong)(end-buff), 1, NULL); error: my_afree(buff); diff --git a/libmariadb/my_compress.c b/libmariadb/my_compress.c index 23b39f2b..24d902ec 100644 --- a/libmariadb/my_compress.c +++ b/libmariadb/my_compress.c @@ -39,7 +39,7 @@ my_bool my_compress(unsigned char *packet, size_t *len, size_t *complen) if (!compbuf) return *complen ? 0 : 1; memcpy(packet,compbuf,*len); - my_free(compbuf,MYF(MY_WME)); + my_free((gptr)compbuf,MYF(MY_WME)); } return 0; } @@ -54,20 +54,19 @@ unsigned char *my_compress_alloc(const unsigned char *packet, size_t *len, size_ if (compress((Bytef*) compbuf,(ulong *) complen, (Bytef*) packet, (uLong) *len ) != Z_OK) { - my_free(compbuf,MYF(MY_WME)); + my_free((gptr)compbuf,MYF(MY_WME)); return 0; } if (*complen >= *len) { *complen=0; - my_free(compbuf,MYF(MY_WME)); + my_free((gptr)compbuf,MYF(MY_WME)); return 0; } swap(ulong,*len,*complen); /* *len is now packet length */ return compbuf; } - my_bool my_uncompress (unsigned char *packet, size_t *len, size_t *complen) { if (*complen) /* If compressed */ @@ -75,14 +74,14 @@ my_bool my_uncompress (unsigned char *packet, size_t *len, size_t *complen) unsigned char *compbuf = (unsigned char *) my_malloc (*complen,MYF(MY_WME)); if (!compbuf) return 1; /* Not enough memory */ - if (uncompress((Bytef*) compbuf, complen, (Bytef*) packet, *len) != Z_OK) + if (uncompress((Bytef*) compbuf, (uLongf *)complen, (Bytef*) packet, (uLongf)*len) != Z_OK) { /* Probably wrong packet */ - my_free (compbuf,MYF(MY_WME)); + my_free ((gptr)compbuf,MYF(MY_WME)); return 1; } *len = *complen; memcpy(packet,compbuf,*len); - my_free(compbuf,MYF(MY_WME)); + my_free((gptr)compbuf,MYF(MY_WME)); } return 0; } diff --git a/libmariadb/my_loaddata.c b/libmariadb/my_loaddata.c index 9174c8b0..5df7c01f 100644 --- a/libmariadb/my_loaddata.c +++ b/libmariadb/my_loaddata.c @@ -227,7 +227,7 @@ void STDCALL mysql_set_local_infile_handler(MYSQL *conn, my_bool mysql_handle_local_infile(MYSQL *conn, const char *filename) { unsigned int buflen= 4096; - unsigned int bufread; + int bufread; unsigned char *buf= NULL; void *info= NULL; my_bool result= 1; diff --git a/libmariadb/my_stmt.c b/libmariadb/my_stmt.c index 58600993..5b0fdf80 100644 --- a/libmariadb/my_stmt.c +++ b/libmariadb/my_stmt.c @@ -550,7 +550,7 @@ unsigned char* mysql_stmt_execute_generate_request(MYSQL_STMT *stmt, size_t *req { size_t offset= p - start; length+= offset + null_count + 20; - if (!(start= (uchar *)my_realloc(start, length, MYF(MY_WME | MY_ZEROFILL)))) + if (!(start= (uchar *)my_realloc((gptr)start, length, MYF(MY_WME | MY_ZEROFILL)))) goto mem_error; p= start + offset; } @@ -574,7 +574,7 @@ unsigned char* mysql_stmt_execute_generate_request(MYSQL_STMT *stmt, size_t *req { size_t offset= p - start; length= offset + stmt->param_count * 2 + 20; - if (!(start= (uchar *)my_realloc(start, length, MYF(MY_WME | MY_ZEROFILL)))) + if (!(start= (uchar *)my_realloc((gptr)start, length, MYF(MY_WME | MY_ZEROFILL)))) goto mem_error; p= start + offset; } @@ -628,7 +628,7 @@ unsigned char* mysql_stmt_execute_generate_request(MYSQL_STMT *stmt, size_t *req { size_t offset= p - start; length= offset + data_size + 20; - if (!(start= (uchar *)my_realloc(start, length, MYF(MY_WME | MY_ZEROFILL)))) + if (!(start= (uchar *)my_realloc((gptr)start, length, MYF(MY_WME | MY_ZEROFILL)))) goto mem_error; p= start + offset; } diff --git a/unittest/libmariadb/misc.c b/unittest/libmariadb/misc.c index 698bc81e..41a0d5dc 100644 --- a/unittest/libmariadb/misc.c +++ b/unittest/libmariadb/misc.c @@ -189,11 +189,11 @@ static int test_bug6081(MYSQL *mysql) } rc= simple_command(mysql, MYSQL_COM_DROP_DB, (char*) schema, - (ulong)strlen(schema), 0U); + (ulong)strlen(schema), 0U, NULL); FAIL_IF(!rc, "Error expected"); rc= simple_command(mysql, MYSQL_COM_CREATE_DB, (char*) schema, - (ulong)strlen(schema), 0U); + (ulong)strlen(schema), 0U, NULL); FAIL_IF(!rc, "Error expected"); rc= mysql_select_db(mysql, schema);