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
|
#define h_errno errno
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void my_inet_ntoa(struct in_addr in, char *buf);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -372,11 +372,9 @@ struct tm *localtime_r(const time_t *clock, struct tm *res);
|
|||||||
#define pthread_kill(A,B) pthread_dummy(0)
|
#define pthread_kill(A,B) pthread_dummy(0)
|
||||||
#undef pthread_detach_this_thread
|
#undef pthread_detach_this_thread
|
||||||
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
|
#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); }
|
||||||
#else /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */
|
+#elif !defined(HAVE_PTHREAD_KILL) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */
|
||||||
#if (!defined(HAVE_PTHREAD_KILL))
|
|
||||||
#define HAVE_PTHREAD_KILL
|
#define HAVE_PTHREAD_KILL
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* defined(_WIN32) */
|
#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);
|
unsigned long net_safe_read(MYSQL *mysql);
|
||||||
void mysql_init_ps_subsystem(void);
|
void mysql_init_ps_subsystem(void);
|
||||||
unsigned long net_field_length(unsigned char **packet);
|
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
|
* function prototypes
|
||||||
*/
|
*/
|
||||||
|
@@ -25,14 +25,14 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _global_h /* If not standard header */
|
|
||||||
#include <sys/types.h>
|
|
||||||
typedef char my_bool;
|
|
||||||
|
|
||||||
#ifndef LIBMARIADB
|
#ifndef LIBMARIADB
|
||||||
#define LIBMARIADB
|
#define LIBMARIADB
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _global_h /* If not standard header */
|
||||||
|
#include <sys/types.h>
|
||||||
|
typedef char my_bool;
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
#define STDCALL
|
#define STDCALL
|
||||||
#else
|
#else
|
||||||
|
@@ -175,7 +175,9 @@ add_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin, void *dlhandle,
|
|||||||
goto err2;
|
goto err2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef THREAD
|
||||||
safe_mutex_assert_owner(&LOCK_load_client_plugin);
|
safe_mutex_assert_owner(&LOCK_load_client_plugin);
|
||||||
|
#endif
|
||||||
|
|
||||||
p->next= plugin_list[plugin->type];
|
p->next= plugin_list[plugin->type];
|
||||||
plugin_list[plugin->type]= p;
|
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);
|
end= ma_send_connect_attr(mysql, end);
|
||||||
|
|
||||||
res= simple_command(mysql, MYSQL_COM_CHANGE_USER,
|
res= simple_command(mysql, MYSQL_COM_CHANGE_USER,
|
||||||
buff, (ulong)(end-buff), 1);
|
buff, (ulong)(end-buff), 1, NULL);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
my_afree(buff);
|
my_afree(buff);
|
||||||
|
@@ -39,7 +39,7 @@ my_bool my_compress(unsigned char *packet, size_t *len, size_t *complen)
|
|||||||
if (!compbuf)
|
if (!compbuf)
|
||||||
return *complen ? 0 : 1;
|
return *complen ? 0 : 1;
|
||||||
memcpy(packet,compbuf,*len);
|
memcpy(packet,compbuf,*len);
|
||||||
my_free(compbuf,MYF(MY_WME));
|
my_free((gptr)compbuf,MYF(MY_WME));
|
||||||
}
|
}
|
||||||
return 0;
|
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,
|
if (compress((Bytef*) compbuf,(ulong *) complen, (Bytef*) packet,
|
||||||
(uLong) *len ) != Z_OK)
|
(uLong) *len ) != Z_OK)
|
||||||
{
|
{
|
||||||
my_free(compbuf,MYF(MY_WME));
|
my_free((gptr)compbuf,MYF(MY_WME));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (*complen >= *len)
|
if (*complen >= *len)
|
||||||
{
|
{
|
||||||
*complen=0;
|
*complen=0;
|
||||||
my_free(compbuf,MYF(MY_WME));
|
my_free((gptr)compbuf,MYF(MY_WME));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
swap(ulong,*len,*complen); /* *len is now packet length */
|
swap(ulong,*len,*complen); /* *len is now packet length */
|
||||||
return compbuf;
|
return compbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
my_bool my_uncompress (unsigned char *packet, size_t *len, size_t *complen)
|
my_bool my_uncompress (unsigned char *packet, size_t *len, size_t *complen)
|
||||||
{
|
{
|
||||||
if (*complen) /* If compressed */
|
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));
|
unsigned char *compbuf = (unsigned char *) my_malloc (*complen,MYF(MY_WME));
|
||||||
if (!compbuf)
|
if (!compbuf)
|
||||||
return 1; /* Not enough memory */
|
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 */
|
{ /* Probably wrong packet */
|
||||||
my_free (compbuf,MYF(MY_WME));
|
my_free ((gptr)compbuf,MYF(MY_WME));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
*len = *complen;
|
*len = *complen;
|
||||||
memcpy(packet,compbuf,*len);
|
memcpy(packet,compbuf,*len);
|
||||||
my_free(compbuf,MYF(MY_WME));
|
my_free((gptr)compbuf,MYF(MY_WME));
|
||||||
}
|
}
|
||||||
return 0;
|
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)
|
my_bool mysql_handle_local_infile(MYSQL *conn, const char *filename)
|
||||||
{
|
{
|
||||||
unsigned int buflen= 4096;
|
unsigned int buflen= 4096;
|
||||||
unsigned int bufread;
|
int bufread;
|
||||||
unsigned char *buf= NULL;
|
unsigned char *buf= NULL;
|
||||||
void *info= NULL;
|
void *info= NULL;
|
||||||
my_bool result= 1;
|
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;
|
size_t offset= p - start;
|
||||||
length+= offset + null_count + 20;
|
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;
|
goto mem_error;
|
||||||
p= start + offset;
|
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;
|
size_t offset= p - start;
|
||||||
length= offset + stmt->param_count * 2 + 20;
|
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;
|
goto mem_error;
|
||||||
p= start + offset;
|
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;
|
size_t offset= p - start;
|
||||||
length= offset + data_size + 20;
|
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;
|
goto mem_error;
|
||||||
p= start + offset;
|
p= start + offset;
|
||||||
}
|
}
|
||||||
|
@@ -189,11 +189,11 @@ static int test_bug6081(MYSQL *mysql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc= simple_command(mysql, MYSQL_COM_DROP_DB, (char*) schema,
|
rc= simple_command(mysql, MYSQL_COM_DROP_DB, (char*) schema,
|
||||||
(ulong)strlen(schema), 0U);
|
(ulong)strlen(schema), 0U, NULL);
|
||||||
FAIL_IF(!rc, "Error expected");
|
FAIL_IF(!rc, "Error expected");
|
||||||
|
|
||||||
rc= simple_command(mysql, MYSQL_COM_CREATE_DB, (char*) schema,
|
rc= simple_command(mysql, MYSQL_COM_CREATE_DB, (char*) schema,
|
||||||
(ulong)strlen(schema), 0U);
|
(ulong)strlen(schema), 0U, NULL);
|
||||||
FAIL_IF(!rc, "Error expected");
|
FAIL_IF(!rc, "Error expected");
|
||||||
|
|
||||||
rc= mysql_select_db(mysql, schema);
|
rc= mysql_select_db(mysql, schema);
|
||||||
|
Reference in New Issue
Block a user