You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Fixed warnings (Thanks to Evan Miller)
This commit is contained in:
@@ -41,6 +41,8 @@ extern "C" {
|
||||
#define h_errno errno
|
||||
#endif
|
||||
|
||||
void my_inet_ntoa(struct in_addr in, char *buf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -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) */
|
||||
|
||||
|
@@ -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
|
||||
*/
|
||||
|
@@ -25,14 +25,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _global_h /* If not standard header */
|
||||
#include <sys/types.h>
|
||||
typedef char my_bool;
|
||||
|
||||
#ifndef LIBMARIADB
|
||||
#define LIBMARIADB
|
||||
#endif
|
||||
|
||||
#ifndef _global_h /* If not standard header */
|
||||
#include <sys/types.h>
|
||||
typedef char my_bool;
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#define STDCALL
|
||||
#else
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user