Commit 50992871 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-13384 Fix Windows warnings. thd_alloc functions now use size_t parameters

Fixes some warnings in popular headers.
parent eba44874
......@@ -167,9 +167,9 @@ int my_random_bytes(unsigned char* buf, int num);
unsigned int my_aes_get_size(enum my_aes_mode mode, unsigned int source_length);
unsigned int my_aes_ctx_size(enum my_aes_mode mode);
extern struct my_print_error_service_st {
void(*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void(*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
void(*my_printv_error_func)(unsigned int error, const char *format, unsigned long MyFlags, va_list ap);
void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void (*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
void (*my_printv_error_func)(unsigned int error, const char *format, unsigned long MyFlags, va_list ap);
} *my_print_error_service;
extern void my_error(unsigned int nr, unsigned long MyFlags, ...);
extern void my_printf_error(unsigned int my_err, const char *format, unsigned long MyFlags, ...);
......@@ -271,21 +271,21 @@ struct st_mysql_lex_string
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(void*, unsigned int);
void *(*thd_calloc_func)(void*, unsigned int);
void *(*thd_alloc_func)(void*, size_t);
void *(*thd_calloc_func)(void*, size_t);
char *(*thd_strdup_func)(void*, const char *);
char *(*thd_strmake_func)(void*, const char *, unsigned int);
void *(*thd_memdup_func)(void*, const void*, unsigned int);
char *(*thd_strmake_func)(void*, const char *, size_t);
void *(*thd_memdup_func)(void*, const void*, size_t);
MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
const char *, unsigned int, int);
const char *, size_t, int);
} *thd_alloc_service;
void *thd_alloc(void* thd, unsigned int size);
void *thd_calloc(void* thd, unsigned int size);
void *thd_alloc(void* thd, size_t size);
void *thd_calloc(void* thd, size_t size);
char *thd_strdup(void* thd, const char *str);
char *thd_strmake(void* thd, const char *str, unsigned int size);
void *thd_memdup(void* thd, const void* str, unsigned int size);
char *thd_strmake(void* thd, const char *str, size_t size);
void *thd_memdup(void* thd, const void* str, size_t size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
const char *str, size_t size,
int allocate_lex_string);
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
......
......@@ -167,9 +167,9 @@ int my_random_bytes(unsigned char* buf, int num);
unsigned int my_aes_get_size(enum my_aes_mode mode, unsigned int source_length);
unsigned int my_aes_ctx_size(enum my_aes_mode mode);
extern struct my_print_error_service_st {
void(*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void(*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
void(*my_printv_error_func)(unsigned int error, const char *format, unsigned long MyFlags, va_list ap);
void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void (*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
void (*my_printv_error_func)(unsigned int error, const char *format, unsigned long MyFlags, va_list ap);
} *my_print_error_service;
extern void my_error(unsigned int nr, unsigned long MyFlags, ...);
extern void my_printf_error(unsigned int my_err, const char *format, unsigned long MyFlags, ...);
......@@ -271,21 +271,21 @@ struct st_mysql_lex_string
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(void*, unsigned int);
void *(*thd_calloc_func)(void*, unsigned int);
void *(*thd_alloc_func)(void*, size_t);
void *(*thd_calloc_func)(void*, size_t);
char *(*thd_strdup_func)(void*, const char *);
char *(*thd_strmake_func)(void*, const char *, unsigned int);
void *(*thd_memdup_func)(void*, const void*, unsigned int);
char *(*thd_strmake_func)(void*, const char *, size_t);
void *(*thd_memdup_func)(void*, const void*, size_t);
MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
const char *, unsigned int, int);
const char *, size_t, int);
} *thd_alloc_service;
void *thd_alloc(void* thd, unsigned int size);
void *thd_calloc(void* thd, unsigned int size);
void *thd_alloc(void* thd, size_t size);
void *thd_calloc(void* thd, size_t size);
char *thd_strdup(void* thd, const char *str);
char *thd_strmake(void* thd, const char *str, unsigned int size);
void *thd_memdup(void* thd, const void* str, unsigned int size);
char *thd_strmake(void* thd, const char *str, size_t size);
void *thd_memdup(void* thd, const void* str, size_t size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
const char *str, size_t size,
int allocate_lex_string);
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
......
......@@ -167,9 +167,9 @@ int my_random_bytes(unsigned char* buf, int num);
unsigned int my_aes_get_size(enum my_aes_mode mode, unsigned int source_length);
unsigned int my_aes_ctx_size(enum my_aes_mode mode);
extern struct my_print_error_service_st {
void(*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void(*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
void(*my_printv_error_func)(unsigned int error, const char *format, unsigned long MyFlags, va_list ap);
void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void (*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
void (*my_printv_error_func)(unsigned int error, const char *format, unsigned long MyFlags, va_list ap);
} *my_print_error_service;
extern void my_error(unsigned int nr, unsigned long MyFlags, ...);
extern void my_printf_error(unsigned int my_err, const char *format, unsigned long MyFlags, ...);
......@@ -271,21 +271,21 @@ struct st_mysql_lex_string
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(void*, unsigned int);
void *(*thd_calloc_func)(void*, unsigned int);
void *(*thd_alloc_func)(void*, size_t);
void *(*thd_calloc_func)(void*, size_t);
char *(*thd_strdup_func)(void*, const char *);
char *(*thd_strmake_func)(void*, const char *, unsigned int);
void *(*thd_memdup_func)(void*, const void*, unsigned int);
char *(*thd_strmake_func)(void*, const char *, size_t);
void *(*thd_memdup_func)(void*, const void*, size_t);
MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
const char *, unsigned int, int);
const char *, size_t, int);
} *thd_alloc_service;
void *thd_alloc(void* thd, unsigned int size);
void *thd_calloc(void* thd, unsigned int size);
void *thd_alloc(void* thd, size_t size);
void *thd_calloc(void* thd, size_t size);
char *thd_strdup(void* thd, const char *str);
char *thd_strmake(void* thd, const char *str, unsigned int size);
void *thd_memdup(void* thd, const void* str, unsigned int size);
char *thd_strmake(void* thd, const char *str, size_t size);
void *thd_memdup(void* thd, const void* str, size_t size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
const char *str, size_t size,
int allocate_lex_string);
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
......
......@@ -167,9 +167,9 @@ int my_random_bytes(unsigned char* buf, int num);
unsigned int my_aes_get_size(enum my_aes_mode mode, unsigned int source_length);
unsigned int my_aes_ctx_size(enum my_aes_mode mode);
extern struct my_print_error_service_st {
void(*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void(*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
void(*my_printv_error_func)(unsigned int error, const char *format, unsigned long MyFlags, va_list ap);
void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void (*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
void (*my_printv_error_func)(unsigned int error, const char *format, unsigned long MyFlags, va_list ap);
} *my_print_error_service;
extern void my_error(unsigned int nr, unsigned long MyFlags, ...);
extern void my_printf_error(unsigned int my_err, const char *format, unsigned long MyFlags, ...);
......@@ -271,21 +271,21 @@ struct st_mysql_lex_string
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(void*, unsigned int);
void *(*thd_calloc_func)(void*, unsigned int);
void *(*thd_alloc_func)(void*, size_t);
void *(*thd_calloc_func)(void*, size_t);
char *(*thd_strdup_func)(void*, const char *);
char *(*thd_strmake_func)(void*, const char *, unsigned int);
void *(*thd_memdup_func)(void*, const void*, unsigned int);
char *(*thd_strmake_func)(void*, const char *, size_t);
void *(*thd_memdup_func)(void*, const void*, size_t);
MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
const char *, unsigned int, int);
const char *, size_t, int);
} *thd_alloc_service;
void *thd_alloc(void* thd, unsigned int size);
void *thd_calloc(void* thd, unsigned int size);
void *thd_alloc(void* thd, size_t size);
void *thd_calloc(void* thd, size_t size);
char *thd_strdup(void* thd, const char *str);
char *thd_strmake(void* thd, const char *str, unsigned int size);
void *thd_memdup(void* thd, const void* str, unsigned int size);
char *thd_strmake(void* thd, const char *str, size_t size);
void *thd_memdup(void* thd, const void* str, size_t size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
const char *str, size_t size,
int allocate_lex_string);
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
......
......@@ -167,9 +167,9 @@ int my_random_bytes(unsigned char* buf, int num);
unsigned int my_aes_get_size(enum my_aes_mode mode, unsigned int source_length);
unsigned int my_aes_ctx_size(enum my_aes_mode mode);
extern struct my_print_error_service_st {
void(*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void(*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
void(*my_printv_error_func)(unsigned int error, const char *format, unsigned long MyFlags, va_list ap);
void (*my_error_func)(unsigned int nr, unsigned long MyFlags, ...);
void (*my_printf_error_func)(unsigned int nr, const char *fmt, unsigned long MyFlags,...);
void (*my_printv_error_func)(unsigned int error, const char *format, unsigned long MyFlags, va_list ap);
} *my_print_error_service;
extern void my_error(unsigned int nr, unsigned long MyFlags, ...);
extern void my_printf_error(unsigned int my_err, const char *format, unsigned long MyFlags, ...);
......@@ -271,21 +271,21 @@ struct st_mysql_lex_string
};
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(void*, unsigned int);
void *(*thd_calloc_func)(void*, unsigned int);
void *(*thd_alloc_func)(void*, size_t);
void *(*thd_calloc_func)(void*, size_t);
char *(*thd_strdup_func)(void*, const char *);
char *(*thd_strmake_func)(void*, const char *, unsigned int);
void *(*thd_memdup_func)(void*, const void*, unsigned int);
char *(*thd_strmake_func)(void*, const char *, size_t);
void *(*thd_memdup_func)(void*, const void*, size_t);
MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
const char *, unsigned int, int);
const char *, size_t, int);
} *thd_alloc_service;
void *thd_alloc(void* thd, unsigned int size);
void *thd_calloc(void* thd, unsigned int size);
void *thd_alloc(void* thd, size_t size);
void *thd_calloc(void* thd, size_t size);
char *thd_strdup(void* thd, const char *str);
char *thd_strmake(void* thd, const char *str, unsigned int size);
void *thd_memdup(void* thd, const void* str, unsigned int size);
char *thd_strmake(void* thd, const char *str, size_t size);
void *thd_memdup(void* thd, const void* str, size_t size);
MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
const char *str, size_t size,
int allocate_lex_string);
extern struct thd_autoinc_service_st {
void (*thd_get_autoinc_func)(const void* thd,
......
......@@ -43,13 +43,13 @@ struct st_mysql_lex_string
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
extern struct thd_alloc_service_st {
void *(*thd_alloc_func)(MYSQL_THD, unsigned int);
void *(*thd_calloc_func)(MYSQL_THD, unsigned int);
void *(*thd_alloc_func)(MYSQL_THD, size_t);
void *(*thd_calloc_func)(MYSQL_THD, size_t);
char *(*thd_strdup_func)(MYSQL_THD, const char *);
char *(*thd_strmake_func)(MYSQL_THD, const char *, unsigned int);
void *(*thd_memdup_func)(MYSQL_THD, const void*, unsigned int);
char *(*thd_strmake_func)(MYSQL_THD, const char *, size_t);
void *(*thd_memdup_func)(MYSQL_THD, const void*, size_t);
MYSQL_LEX_STRING *(*thd_make_lex_string_func)(MYSQL_THD, MYSQL_LEX_STRING *,
const char *, unsigned int, int);
const char *, size_t, int);
} *thd_alloc_service;
#ifdef MYSQL_DYNAMIC_PLUGIN
......@@ -84,11 +84,11 @@ extern struct thd_alloc_service_st {
@see alloc_root()
*/
void *thd_alloc(MYSQL_THD thd, unsigned int size);
void *thd_alloc(MYSQL_THD thd, size_t size);
/**
@see thd_alloc()
*/
void *thd_calloc(MYSQL_THD thd, unsigned int size);
void *thd_calloc(MYSQL_THD thd, size_t size);
/**
@see thd_alloc()
*/
......@@ -96,11 +96,11 @@ char *thd_strdup(MYSQL_THD thd, const char *str);
/**
@see thd_alloc()
*/
char *thd_strmake(MYSQL_THD thd, const char *str, unsigned int size);
char *thd_strmake(MYSQL_THD thd, const char *str, size_t size);
/**
@see thd_alloc()
*/
void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size);
void *thd_memdup(MYSQL_THD thd, const void* str, size_t size);
/**
Create a LEX_STRING in this connection's local memory pool
......@@ -116,7 +116,7 @@ void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size);
@see thd_alloc()
*/
MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
const char *str, size_t size,
int allocate_lex_string);
#endif
......
......@@ -34,7 +34,7 @@
#define VERSION_my_sha2 0x0100
#define VERSION_my_snprintf 0x0100
#define VERSION_progress_report 0x0100
#define VERSION_thd_alloc 0x0100
#define VERSION_thd_alloc 0x0200
#define VERSION_thd_autoinc 0x0100
#define VERSION_thd_error_context 0x0200
#define VERSION_thd_rnd 0x0100
......
......@@ -1156,13 +1156,13 @@ Sql_condition* THD::raise_condition(uint sql_errno,
}
extern "C"
void *thd_alloc(MYSQL_THD thd, unsigned int size)
void *thd_alloc(MYSQL_THD thd, size_t size)
{
return thd->alloc(size);
}
extern "C"
void *thd_calloc(MYSQL_THD thd, unsigned int size)
void *thd_calloc(MYSQL_THD thd, size_t size)
{
return thd->calloc(size);
}
......@@ -1174,14 +1174,14 @@ char *thd_strdup(MYSQL_THD thd, const char *str)
}
extern "C"
char *thd_strmake(MYSQL_THD thd, const char *str, unsigned int size)
char *thd_strmake(MYSQL_THD thd, const char *str, size_t size)
{
return thd->strmake(str, size);
}
extern "C"
LEX_STRING *thd_make_lex_string(THD *thd, LEX_STRING *lex_str,
const char *str, unsigned int size,
const char *str, size_t size,
int allocate_lex_string)
{
return allocate_lex_string ? thd->make_lex_string(str, size)
......@@ -1189,7 +1189,7 @@ LEX_STRING *thd_make_lex_string(THD *thd, LEX_STRING *lex_str,
}
extern "C"
void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size)
void *thd_memdup(MYSQL_THD thd, const void* str, size_t size)
{
return thd->memdup(str, size);
}
......
......@@ -15591,7 +15591,7 @@ get_foreign_key_info(
ptr = dict_remove_db_name(foreign->id);
f_key_info.foreign_id = thd_make_lex_string(
thd, 0, ptr, (uint) strlen(ptr), 1);
thd, 0, ptr, strlen(ptr), 1);
/* Name format: database name, '/', table name, '\0' */
......@@ -15603,13 +15603,13 @@ get_foreign_key_info(
len = filename_to_tablename(tmp_buff, name_buff, sizeof(name_buff));
f_key_info.referenced_db = thd_make_lex_string(
thd, 0, name_buff, static_cast<unsigned int>(len), 1);
thd, 0, name_buff, len, 1);
/* Referenced (parent) table name */
ptr = dict_remove_db_name(foreign->referenced_table_name);
len = filename_to_tablename(ptr, name_buff, sizeof(name_buff));
f_key_info.referenced_table = thd_make_lex_string(
thd, 0, name_buff, static_cast<unsigned int>(len), 1);
thd, 0, name_buff, len, 1);
/* Dependent (child) database name */
len = dict_get_db_name_len(foreign->foreign_table_name);
......@@ -15619,22 +15619,22 @@ get_foreign_key_info(
len = filename_to_tablename(tmp_buff, name_buff, sizeof(name_buff));
f_key_info.foreign_db = thd_make_lex_string(
thd, 0, name_buff, static_cast<unsigned int>(len), 1);
thd, 0, name_buff, len, 1);
/* Dependent (child) table name */
ptr = dict_remove_db_name(foreign->foreign_table_name);
len = filename_to_tablename(ptr, name_buff, sizeof(name_buff));
f_key_info.foreign_table = thd_make_lex_string(
thd, 0, name_buff, static_cast<unsigned int>(len), 1);
thd, 0, name_buff, len, 1);
do {
ptr = foreign->foreign_col_names[i];
name = thd_make_lex_string(thd, name, ptr,
(uint) strlen(ptr), 1);
strlen(ptr), 1);
f_key_info.foreign_fields.push_back(name);
ptr = foreign->referenced_col_names[i];
name = thd_make_lex_string(thd, name, ptr,
(uint) strlen(ptr), 1);
strlen(ptr), 1);
f_key_info.referenced_fields.push_back(name);
} while (++i < foreign->n_fields);
......@@ -15691,7 +15691,7 @@ get_foreign_key_info(
thd,
f_key_info.referenced_key_name,
foreign->referenced_index->name,
(uint) strlen(foreign->referenced_index->name),
strlen(foreign->referenced_index->name),
1);
} else {
referenced_key_name = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment