mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from 'size_t' to 'type', possible loss of data)
Handle string length as size_t, consistently (almost always:)) Change function prototypes to accept size_t, where in the past ulong or uint were used. change local/member variables to size_t when appropriate. This fix excludes rocksdb, spider,spider, sphinx and connect for now.
This commit is contained in:
parent
f271100836
commit
6c279ad6a7
257 changed files with 1514 additions and 1543 deletions
|
@ -1065,7 +1065,7 @@ static void fix_history(String *final_command);
|
|||
|
||||
static COMMANDS *find_command(char *name);
|
||||
static COMMANDS *find_command(char cmd_name);
|
||||
static bool add_line(String &, char *, ulong, char *, bool *, bool);
|
||||
static bool add_line(String &, char *, size_t line_length, char *, bool *, bool);
|
||||
static void remove_cntrl(String &buffer);
|
||||
static void print_table_data(MYSQL_RES *result);
|
||||
static void print_table_data_html(MYSQL_RES *result);
|
||||
|
@ -1987,7 +1987,7 @@ static int read_and_execute(bool interactive)
|
|||
ulong line_number=0;
|
||||
bool ml_comment= 0;
|
||||
COMMANDS *com;
|
||||
ulong line_length= 0;
|
||||
size_t line_length= 0;
|
||||
status.exit_status=1;
|
||||
|
||||
real_binary_mode= !interactive && opt_binary_mode;
|
||||
|
@ -2281,7 +2281,7 @@ static COMMANDS *find_command(char *name)
|
|||
}
|
||||
|
||||
|
||||
static bool add_line(String &buffer, char *line, ulong line_length,
|
||||
static bool add_line(String &buffer, char *line, size_t line_length,
|
||||
char *in_string, bool *ml_comment, bool truncated)
|
||||
{
|
||||
uchar inchar;
|
||||
|
@ -2989,12 +2989,12 @@ static void get_current_db()
|
|||
The different commands
|
||||
***************************************************************************/
|
||||
|
||||
int mysql_real_query_for_lazy(const char *buf, int length)
|
||||
int mysql_real_query_for_lazy(const char *buf, size_t length)
|
||||
{
|
||||
for (uint retry=0;; retry++)
|
||||
{
|
||||
int error;
|
||||
if (!mysql_real_query(&mysql,buf,length))
|
||||
if (!mysql_real_query(&mysql,buf,(ulong)length))
|
||||
return 0;
|
||||
error= put_error(&mysql);
|
||||
if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1 ||
|
||||
|
@ -3565,10 +3565,10 @@ is_binary_field(MYSQL_FIELD *field)
|
|||
/* Print binary value as hex literal (0x ...) */
|
||||
|
||||
static void
|
||||
print_as_hex(FILE *output_file, const char *str, ulong len, ulong total_bytes_to_send)
|
||||
print_as_hex(FILE *output_file, const char *str, size_t len, size_t total_bytes_to_send)
|
||||
{
|
||||
const char *ptr= str, *end= ptr+len;
|
||||
ulong i;
|
||||
size_t i;
|
||||
fprintf(output_file, "0x");
|
||||
for(; ptr < end; ptr++)
|
||||
fprintf(output_file, "%02X", *((uchar*)ptr));
|
||||
|
@ -3618,11 +3618,11 @@ print_table_data(MYSQL_RES *result)
|
|||
(void) tee_fputs("|", PAGER);
|
||||
for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
|
||||
{
|
||||
uint name_length= (uint) strlen(field->name);
|
||||
uint numcells= charset_info->cset->numcells(charset_info,
|
||||
size_t name_length= (uint) strlen(field->name);
|
||||
size_t numcells= charset_info->cset->numcells(charset_info,
|
||||
field->name,
|
||||
field->name + name_length);
|
||||
uint display_length= field->max_length + name_length - numcells;
|
||||
size_t display_length= field->max_length + name_length - numcells;
|
||||
tee_fprintf(PAGER, " %-*s |",(int) MY_MIN(display_length,
|
||||
MAX_COLUMN_LENGTH),
|
||||
field->name);
|
||||
|
@ -3643,7 +3643,6 @@ print_table_data(MYSQL_RES *result)
|
|||
const char *buffer;
|
||||
uint data_length;
|
||||
uint field_max_length;
|
||||
uint visible_length;
|
||||
uint extra_padding;
|
||||
|
||||
if (off)
|
||||
|
@ -3671,7 +3670,7 @@ print_table_data(MYSQL_RES *result)
|
|||
We need to find how much screen real-estate we will occupy to know how
|
||||
many extra padding-characters we should send with the printing function.
|
||||
*/
|
||||
visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
|
||||
size_t visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
|
||||
extra_padding= (uint) (data_length - visible_length);
|
||||
|
||||
if (opt_binhex && is_binary_field(field))
|
||||
|
|
|
@ -262,7 +262,7 @@ static char *convert_path(const char *argument)
|
|||
/* Convert / to \\ to make Windows paths */
|
||||
char *winfilename= my_strdup(argument, MYF(MY_FAE));
|
||||
char *pos, *end;
|
||||
int length= strlen(argument);
|
||||
size_t length= strlen(argument);
|
||||
|
||||
for (pos= winfilename, end= pos+length ; pos < end ; pos++)
|
||||
{
|
||||
|
@ -712,11 +712,11 @@ static int check_options(int argc, char **argv, char *operation)
|
|||
|
||||
/* Form prefix strings for the options. */
|
||||
const char *basedir_prefix = "--basedir=";
|
||||
int basedir_len= strlen(basedir_prefix);
|
||||
size_t basedir_len= strlen(basedir_prefix);
|
||||
const char *datadir_prefix = "--datadir=";
|
||||
int datadir_len= strlen(datadir_prefix);
|
||||
size_t datadir_len= strlen(datadir_prefix);
|
||||
const char *plugin_dir_prefix = "--plugin_dir=";
|
||||
int plugin_dir_len= strlen(plugin_dir_prefix);
|
||||
size_t plugin_dir_len= strlen(plugin_dir_prefix);
|
||||
|
||||
strcpy(plugin_name, "");
|
||||
for (i = 0; i < argc && num_found < 5; i++)
|
||||
|
|
|
@ -439,7 +439,7 @@ File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le,
|
|||
return -1;
|
||||
}
|
||||
|
||||
le->set_fname_outside_temp_buf(filename,len+(uint) strlen(tail));
|
||||
le->set_fname_outside_temp_buf(filename,len+strlen(tail));
|
||||
|
||||
return file;
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
|
|||
uint file_id,
|
||||
Create_file_log_event *ce)
|
||||
{
|
||||
uint full_len= target_dir_name_len + blen + 9 + 9 + 1;
|
||||
size_t full_len= target_dir_name_len + blen + 9 + 9 + 1;
|
||||
Exit_status retval= OK_CONTINUE;
|
||||
char *fname, *ptr;
|
||||
File file;
|
||||
|
@ -583,7 +583,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
|
|||
}
|
||||
|
||||
if (ce)
|
||||
ce->set_fname_outside_temp_buf(fname, (uint) strlen(fname));
|
||||
ce->set_fname_outside_temp_buf(fname, strlen(fname));
|
||||
|
||||
if (my_write(file, (uchar*)block, block_len, MYF(MY_WME|MY_NABP)))
|
||||
{
|
||||
|
|
|
@ -541,7 +541,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
|
|||
{
|
||||
int view;
|
||||
char *table;
|
||||
uint table_len;
|
||||
size_t table_len;
|
||||
DBUG_ENTER("process_selected_tables");
|
||||
|
||||
if (use_db(db))
|
||||
|
@ -669,7 +669,7 @@ static int process_all_tables_in_db(char *database)
|
|||
size_t tot_length = 0;
|
||||
|
||||
char *views, *views_end;
|
||||
uint tot_views_length = 0;
|
||||
size_t tot_views_length = 0;
|
||||
|
||||
while ((row = mysql_fetch_row(res)))
|
||||
{
|
||||
|
@ -966,7 +966,7 @@ static int handle_request_for_tables(char *tables, size_t length,
|
|||
}
|
||||
if (verbose >= 3)
|
||||
puts(query);
|
||||
if (mysql_real_query(sock, query, query_length))
|
||||
if (mysql_real_query(sock, query, (ulong)query_length))
|
||||
{
|
||||
sprintf(message, "when executing '%s%s... %s'", op, tab_view, options);
|
||||
DBerror(sock, message);
|
||||
|
@ -977,7 +977,7 @@ static int handle_request_for_tables(char *tables, size_t length,
|
|||
if (opt_flush_tables)
|
||||
{
|
||||
query_length= sprintf(query, "FLUSH TABLES %s", table_name);
|
||||
if (mysql_real_query(sock, query, query_length))
|
||||
if (mysql_real_query(sock, query, (ulong)query_length))
|
||||
{
|
||||
DBerror(sock, query);
|
||||
my_free(query);
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
static void add_load_option(DYNAMIC_STRING *str, const char *option,
|
||||
const char *option_value);
|
||||
static ulong find_set(TYPELIB *, const char *, size_t, char **, uint *);
|
||||
static char *alloc_query_str(ulong size);
|
||||
static char *alloc_query_str(size_t size);
|
||||
|
||||
static void field_escape(DYNAMIC_STRING* in, const char *from);
|
||||
static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_med= 1,
|
||||
|
@ -171,7 +171,7 @@ wrappers, they will terminate the process if there is
|
|||
an allocation failure.
|
||||
*/
|
||||
static void init_dynamic_string_checked(DYNAMIC_STRING *str, const char *init_str,
|
||||
uint init_alloc, uint alloc_increment);
|
||||
size_t init_alloc, size_t alloc_increment);
|
||||
static void dynstr_append_checked(DYNAMIC_STRING* dest, const char* src);
|
||||
static void dynstr_set_checked(DYNAMIC_STRING *str, const char *init_str);
|
||||
static void dynstr_append_mem_checked(DYNAMIC_STRING *str, const char *append,
|
||||
|
@ -1283,8 +1283,8 @@ get_binlog_gtid_pos(char *binlog_pos_file, char *binlog_pos_offset,
|
|||
|
||||
if (len_pos_file >= FN_REFLEN || len_pos_offset > LONGLONG_LEN)
|
||||
return 0;
|
||||
mysql_real_escape_string(mysql, file_buf, binlog_pos_file, len_pos_file);
|
||||
mysql_real_escape_string(mysql, offset_buf, binlog_pos_offset, len_pos_offset);
|
||||
mysql_real_escape_string(mysql, file_buf, binlog_pos_file, (ulong)len_pos_file);
|
||||
mysql_real_escape_string(mysql, offset_buf, binlog_pos_offset, (ulong)len_pos_offset);
|
||||
init_dynamic_string_checked(&query, "SELECT BINLOG_GTID_POS('", 256, 1024);
|
||||
dynstr_append_checked(&query, file_buf);
|
||||
dynstr_append_checked(&query, "', '");
|
||||
|
@ -1531,7 +1531,7 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
|
|||
"SET SESSION character_set_results = '%s'",
|
||||
(const char *) cs_name);
|
||||
|
||||
return mysql_real_query(mysql, query_buffer, query_length);
|
||||
return mysql_real_query(mysql, query_buffer, (ulong)query_length);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2715,7 +2715,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
|||
"FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE "
|
||||
"TABLE_SCHEMA = %s AND TABLE_NAME = %s";
|
||||
FILE *sql_file= md_result_file;
|
||||
int len;
|
||||
size_t len;
|
||||
my_bool is_log_table;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
@ -3618,7 +3618,7 @@ static void field_escape(DYNAMIC_STRING* in, const char *from)
|
|||
|
||||
|
||||
|
||||
static char *alloc_query_str(ulong size)
|
||||
static char *alloc_query_str(size_t size)
|
||||
{
|
||||
char *query;
|
||||
|
||||
|
@ -3653,8 +3653,10 @@ static void dump_table(char *table, char *db)
|
|||
char table_type[NAME_LEN];
|
||||
char *result_table, table_buff2[NAME_LEN*2+3], *opt_quoted_table;
|
||||
int error= 0;
|
||||
ulong rownr, row_break, total_length, init_length;
|
||||
ulong rownr, row_break;
|
||||
uint num_fields;
|
||||
size_t total_length, init_length;
|
||||
|
||||
MYSQL_RES *res;
|
||||
MYSQL_FIELD *field;
|
||||
MYSQL_ROW row;
|
||||
|
@ -3778,7 +3780,7 @@ static void dump_table(char *table, char *db)
|
|||
order_by= 0;
|
||||
}
|
||||
|
||||
if (mysql_real_query(mysql, query_string.str, query_string.length))
|
||||
if (mysql_real_query(mysql, query_string.str, (ulong)query_string.length))
|
||||
{
|
||||
dynstr_free(&query_string);
|
||||
DB_error(mysql, "when executing 'SELECT INTO OUTFILE'");
|
||||
|
@ -4066,7 +4068,7 @@ static void dump_table(char *table, char *db)
|
|||
|
||||
if (extended_insert)
|
||||
{
|
||||
ulong row_length;
|
||||
size_t row_length;
|
||||
dynstr_append_checked(&extended_row,")");
|
||||
row_length= 2 + extended_row.length;
|
||||
if (total_length + row_length < opt_net_buffer_length)
|
||||
|
@ -4645,7 +4647,7 @@ static int dump_all_tables_in_db(char *database)
|
|||
dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
|
||||
}
|
||||
}
|
||||
if (numrows && mysql_real_query(mysql, query.str, query.length-1))
|
||||
if (numrows && mysql_real_query(mysql, query.str, (ulong)query.length-1))
|
||||
{
|
||||
dynstr_free(&query);
|
||||
DB_error(mysql, "when using LOCK TABLES");
|
||||
|
@ -4828,7 +4830,7 @@ static my_bool dump_all_views_in_db(char *database)
|
|||
dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
|
||||
}
|
||||
}
|
||||
if (numrows && mysql_real_query(mysql, query.str, query.length-1))
|
||||
if (numrows && mysql_real_query(mysql, query.str, (ulong)query.length-1))
|
||||
DB_error(mysql, "when using LOCK TABLES");
|
||||
/* We shall continue here, if --force was given */
|
||||
dynstr_free(&query);
|
||||
|
@ -5024,7 +5026,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
|||
!my_strcasecmp(&my_charset_latin1, db, PERFORMANCE_SCHEMA_DB_NAME)))
|
||||
{
|
||||
if (mysql_real_query(mysql, lock_tables_query.str,
|
||||
lock_tables_query.length-1))
|
||||
(ulong)lock_tables_query.length-1))
|
||||
{
|
||||
if (!ignore_errors)
|
||||
{
|
||||
|
@ -5690,7 +5692,7 @@ static char *primary_key_fields(const char *table_name)
|
|||
MYSQL_ROW row;
|
||||
/* SHOW KEYS FROM + table name * 2 (escaped) + 2 quotes + \0 */
|
||||
char show_keys_buff[15 + NAME_LEN * 2 + 3];
|
||||
uint result_length= 0;
|
||||
size_t result_length= 0;
|
||||
char *result= 0;
|
||||
char buff[NAME_LEN * 2 + 3];
|
||||
char *quoted_field;
|
||||
|
@ -6008,7 +6010,7 @@ static my_bool get_view_structure(char *table, char* db)
|
|||
#define DYNAMIC_STR_ERROR_MSG "Couldn't perform DYNAMIC_STRING operation"
|
||||
|
||||
static void init_dynamic_string_checked(DYNAMIC_STRING *str, const char *init_str,
|
||||
uint init_alloc, uint alloc_increment)
|
||||
size_t init_alloc, size_t alloc_increment)
|
||||
{
|
||||
if (init_dynamic_string(str, init_str, init_alloc, alloc_increment))
|
||||
die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
|
||||
|
|
|
@ -413,7 +413,7 @@ static void lock_table(MYSQL *mysql, int tablecount, char **raw_tablename)
|
|||
dynstr_append(&query, tablename);
|
||||
dynstr_append(&query, " WRITE,");
|
||||
}
|
||||
if (mysql_real_query(mysql, query.str, query.length-1))
|
||||
if (mysql_real_query(mysql, query.str, (ulong)query.length-1))
|
||||
db_error(mysql); /* We shall countinue here, if --force was given */
|
||||
}
|
||||
|
||||
|
|
|
@ -661,7 +661,7 @@ static int
|
|||
list_table_status(MYSQL *mysql,const char *db,const char *wild)
|
||||
{
|
||||
char query[NAME_LEN + 100];
|
||||
int len;
|
||||
size_t len;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
|
@ -908,7 +908,7 @@ static void print_res_header(MYSQL_RES *result)
|
|||
|
||||
static void print_res_top(MYSQL_RES *result)
|
||||
{
|
||||
uint i,length;
|
||||
size_t i,length;
|
||||
MYSQL_FIELD *field;
|
||||
|
||||
putchar('+');
|
||||
|
@ -916,7 +916,7 @@ static void print_res_top(MYSQL_RES *result)
|
|||
while((field = mysql_fetch_field(result)))
|
||||
{
|
||||
if ((length= strlen(field->name)) > field->max_length)
|
||||
field->max_length=length;
|
||||
field->max_length=(ulong)length;
|
||||
else
|
||||
length=field->max_length;
|
||||
for (i=length+2 ; i--> 0 ; )
|
||||
|
|
|
@ -144,7 +144,7 @@ static unsigned long connect_flags= CLIENT_MULTI_RESULTS |
|
|||
CLIENT_MULTI_STATEMENTS |
|
||||
CLIENT_REMEMBER_OPTIONS;
|
||||
|
||||
static int verbose, delimiter_length;
|
||||
static int verbose;
|
||||
static uint commit_rate;
|
||||
static uint detach_rate;
|
||||
const char *num_int_cols_opt;
|
||||
|
@ -263,7 +263,7 @@ void option_cleanup(option_string *stmt);
|
|||
void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr);
|
||||
static int run_statements(MYSQL *mysql, statement *stmt);
|
||||
int slap_connect(MYSQL *mysql);
|
||||
static int run_query(MYSQL *mysql, const char *query, int len);
|
||||
static int run_query(MYSQL *mysql, const char *query, size_t len);
|
||||
|
||||
static const char ALPHANUMERICS[]=
|
||||
"0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
@ -343,9 +343,6 @@ int main(int argc, char **argv)
|
|||
if (auto_generate_sql)
|
||||
srandom((uint)time(NULL));
|
||||
|
||||
/* globals? Yes, so we only have to run strlen once */
|
||||
delimiter_length= strlen(delimiter);
|
||||
|
||||
if (argc > 2)
|
||||
{
|
||||
fprintf(stderr,"%s: Too many arguments\n",my_progname);
|
||||
|
@ -1552,18 +1549,18 @@ get_options(int *argc,char ***argv)
|
|||
}
|
||||
|
||||
|
||||
static int run_query(MYSQL *mysql, const char *query, int len)
|
||||
static int run_query(MYSQL *mysql, const char *query, size_t len)
|
||||
{
|
||||
if (opt_only_print)
|
||||
{
|
||||
printf("%.*s;\n", len, query);
|
||||
printf("%.*s;\n", (int)len, query);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (verbose >= 3)
|
||||
printf("%.*s;\n", len, query);
|
||||
printf("%.*s;\n", (int)len, query);
|
||||
|
||||
return mysql_real_query(mysql, query, len);
|
||||
return mysql_real_query(mysql, query, (ulong)len);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2131,7 +2128,7 @@ parse_delimiter(const char *script, statement **stmt, char delm)
|
|||
char *ptr= (char *)script;
|
||||
statement **sptr= stmt;
|
||||
statement *tmp;
|
||||
uint length= strlen(script);
|
||||
size_t length= strlen(script);
|
||||
uint count= 0; /* We know that there is always one */
|
||||
|
||||
for (tmp= *sptr= (statement *)my_malloc(sizeof(statement),
|
||||
|
|
|
@ -184,7 +184,7 @@ static uint opt_connect_timeout= 0;
|
|||
static uint opt_wait_for_pos_timeout= 0;
|
||||
|
||||
static char delimiter[MAX_DELIMITER_LENGTH]= ";";
|
||||
static uint delimiter_length= 1;
|
||||
static size_t delimiter_length= 1;
|
||||
|
||||
static char TMPDIR[FN_REFLEN];
|
||||
static char global_subst_from[200];
|
||||
|
@ -265,8 +265,8 @@ static void free_re(void);
|
|||
static char *get_string(char **to_ptr, char **from_ptr,
|
||||
struct st_command *command);
|
||||
static int replace(DYNAMIC_STRING *ds_str,
|
||||
const char *search_str, ulong search_len,
|
||||
const char *replace_str, ulong replace_len);
|
||||
const char *search_str, size_t search_len,
|
||||
const char *replace_str, size_t replace_len);
|
||||
|
||||
static uint opt_protocol=0;
|
||||
|
||||
|
@ -291,11 +291,11 @@ const char *result_file_name= 0;
|
|||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
int name_len;
|
||||
size_t name_len;
|
||||
char *str_val;
|
||||
int str_val_len;
|
||||
size_t str_val_len;
|
||||
int int_val;
|
||||
int alloced_len;
|
||||
size_t alloced_len;
|
||||
bool int_dirty; /* do not update string if int is updated until first read */
|
||||
bool is_int;
|
||||
bool alloced;
|
||||
|
@ -572,7 +572,7 @@ struct st_replace_regex *glob_replace_regex= 0;
|
|||
struct st_replace;
|
||||
struct st_replace *glob_replace= 0;
|
||||
void replace_strings_append(struct st_replace *rep, DYNAMIC_STRING* ds,
|
||||
const char *from, int len);
|
||||
const char *from);
|
||||
|
||||
ATTRIBUTE_NORETURN
|
||||
static void cleanup_and_exit(int exit_code);
|
||||
|
@ -589,20 +589,19 @@ void verbose_msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
|
|||
void log_msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
|
||||
|
||||
VAR* var_from_env(const char *, const char *);
|
||||
VAR* var_init(VAR* v, const char *name, int name_len, const char *val,
|
||||
int val_len);
|
||||
VAR* var_init(VAR* v, const char *name, size_t name_len, const char *val, size_t val_len);
|
||||
VAR* var_get(const char *var_name, const char** var_name_end,
|
||||
my_bool raw, my_bool ignore_not_existing);
|
||||
void eval_expr(VAR* v, const char *p, const char** p_end,
|
||||
bool open_end=false, bool do_eval=true);
|
||||
my_bool match_delimiter(int c, const char *delim, uint length);
|
||||
my_bool match_delimiter(int c, const char *delim, size_t length);
|
||||
void dump_result_to_reject_file(char *buf, int size);
|
||||
void dump_warning_messages();
|
||||
|
||||
void do_eval(DYNAMIC_STRING *query_eval, const char *query,
|
||||
const char *query_end, my_bool pass_through_escape_chars);
|
||||
void str_to_file(const char *fname, char *str, int size);
|
||||
void str_to_file2(const char *fname, char *str, int size, my_bool append);
|
||||
void str_to_file(const char *fname, char *str, size_t size);
|
||||
void str_to_file2(const char *fname, char *str, size_t size, my_bool append);
|
||||
|
||||
void fix_win_paths(char *val, size_t len);
|
||||
const char *get_errname_from_code (uint error_code);
|
||||
|
@ -1077,9 +1076,9 @@ static void init_connection_thd(struct st_connection *cn)
|
|||
#else /* ! EMBEDDED_LIBRARY*/
|
||||
|
||||
#define init_connection_thd(X) do { } while(0)
|
||||
#define do_send_query(cn,q,q_len) mysql_send_query(cn->mysql, q, q_len)
|
||||
#define do_send_query(cn,q,q_len) mysql_send_query(cn->mysql, q, (ulong)q_len)
|
||||
#define do_read_query_result(cn) mysql_read_query_result(cn->mysql)
|
||||
#define do_stmt_prepare(cn, q, q_len) mysql_stmt_prepare(cn->stmt, q, q_len)
|
||||
#define do_stmt_prepare(cn, q, q_len) mysql_stmt_prepare(cn->stmt, q, (ulong)q_len)
|
||||
#define do_stmt_execute(cn) mysql_stmt_execute(cn->stmt)
|
||||
#define do_stmt_close(cn) mysql_stmt_close(cn->stmt)
|
||||
|
||||
|
@ -2139,8 +2138,8 @@ int compare_files2(File fd1, const char* filename2)
|
|||
trees when Maria is merged into them.
|
||||
--global-subst should be removed.
|
||||
*/
|
||||
uint global_subst_from_len= strlen(global_subst_from);
|
||||
uint global_subst_to_len= strlen(global_subst_to);
|
||||
size_t global_subst_from_len= strlen(global_subst_from);
|
||||
size_t global_subst_to_len= strlen(global_subst_to);
|
||||
while (replace(&fd1_result,
|
||||
global_subst_from, global_subst_from_len,
|
||||
global_subst_to, global_subst_to_len) == 0)
|
||||
|
@ -2422,10 +2421,9 @@ void var_check_int(VAR *v)
|
|||
}
|
||||
|
||||
|
||||
VAR *var_init(VAR *v, const char *name, int name_len, const char *val,
|
||||
int val_len)
|
||||
VAR *var_init(VAR *v, const char *name, size_t name_len, const char *val, size_t val_len)
|
||||
{
|
||||
int val_alloc_len;
|
||||
size_t val_alloc_len;
|
||||
VAR *tmp_var;
|
||||
if (!name_len && name)
|
||||
name_len = strlen(name);
|
||||
|
@ -2726,7 +2724,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
|
|||
init_dynamic_string(&ds_query, 0, (end - query) + 32, 256);
|
||||
do_eval(&ds_query, query, end, FALSE);
|
||||
|
||||
if (mysql_real_query(mysql, ds_query.str, ds_query.length))
|
||||
if (mysql_real_query(mysql, ds_query.str, (ulong)ds_query.length))
|
||||
{
|
||||
handle_error(curr_command, mysql_errno(mysql), mysql_error(mysql),
|
||||
mysql_sqlstate(mysql), &ds_res);
|
||||
|
@ -2763,7 +2761,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
|
|||
{
|
||||
/* Add column to tab separated string */
|
||||
char *val= row[i];
|
||||
int len= lengths[i];
|
||||
size_t len= lengths[i];
|
||||
|
||||
if (glob_replace_regex)
|
||||
{
|
||||
|
@ -2776,7 +2774,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
|
|||
}
|
||||
|
||||
if (glob_replace)
|
||||
replace_strings_append(glob_replace, &result, val, len);
|
||||
replace_strings_append(glob_replace, &result, val);
|
||||
else
|
||||
dynstr_append_mem(&result, val, len);
|
||||
}
|
||||
|
@ -2914,7 +2912,7 @@ void var_set_query_get_value(struct st_command *command, VAR *var)
|
|||
die("Mismatched \"'s around query '%s'", ds_query.str);
|
||||
|
||||
/* Run the query */
|
||||
if (mysql_real_query(mysql, ds_query.str, ds_query.length))
|
||||
if (mysql_real_query(mysql, ds_query.str, (ulong)ds_query.length))
|
||||
{
|
||||
handle_error(curr_command, mysql_errno(mysql), mysql_error(mysql),
|
||||
mysql_sqlstate(mysql), &ds_res);
|
||||
|
@ -3061,7 +3059,7 @@ void eval_expr(VAR *v, const char *p, const char **p_end,
|
|||
struct st_command command;
|
||||
memset(&command, 0, sizeof(command));
|
||||
command.query= (char*)p;
|
||||
command.first_word_len= len;
|
||||
command.first_word_len= (int)len;
|
||||
command.first_argument= command.query + len;
|
||||
command.end= (char*)*p_end;
|
||||
command.abort_on_error= 1; /* avoid uninitialized variables */
|
||||
|
@ -3072,11 +3070,11 @@ void eval_expr(VAR *v, const char *p, const char **p_end,
|
|||
|
||||
NO_EVAL:
|
||||
{
|
||||
int new_val_len = (p_end && *p_end) ?
|
||||
(int) (*p_end - p) : (int) strlen(p);
|
||||
size_t new_val_len = (p_end && *p_end) ?
|
||||
(size_t)(*p_end - p) : strlen(p);
|
||||
if (new_val_len + 1 >= v->alloced_len)
|
||||
{
|
||||
static int MIN_VAR_ALLOC= 32;
|
||||
static size_t MIN_VAR_ALLOC= 32;
|
||||
v->alloced_len = (new_val_len < MIN_VAR_ALLOC - 1) ?
|
||||
MIN_VAR_ALLOC : new_val_len + 1;
|
||||
if (!(v->str_val =
|
||||
|
@ -3332,8 +3330,8 @@ static void init_builtin_echo(void)
|
|||
*/
|
||||
|
||||
static int replace(DYNAMIC_STRING *ds_str,
|
||||
const char *search_str, ulong search_len,
|
||||
const char *replace_str, ulong replace_len)
|
||||
const char *search_str, size_t search_len,
|
||||
const char *replace_str, size_t replace_len)
|
||||
{
|
||||
DYNAMIC_STRING ds_tmp;
|
||||
const char *start= strstr(ds_str->str, search_str);
|
||||
|
@ -6540,7 +6538,7 @@ void do_delimiter(struct st_command* command)
|
|||
}
|
||||
|
||||
|
||||
my_bool match_delimiter(int c, const char *delim, uint length)
|
||||
my_bool match_delimiter(int c, const char *delim, size_t length)
|
||||
{
|
||||
uint i;
|
||||
char tmp[MAX_DELIMITER_LENGTH];
|
||||
|
@ -7400,7 +7398,7 @@ int parse_args(int argc, char **argv)
|
|||
append - append to file instead of overwriting old file
|
||||
*/
|
||||
|
||||
void str_to_file2(const char *fname, char *str, int size, my_bool append)
|
||||
void str_to_file2(const char *fname, char *str, size_t size, my_bool append)
|
||||
{
|
||||
int fd;
|
||||
char buff[FN_REFLEN];
|
||||
|
@ -7434,7 +7432,7 @@ void str_to_file2(const char *fname, char *str, int size, my_bool append)
|
|||
size - size of content witten to file
|
||||
*/
|
||||
|
||||
void str_to_file(const char *fname, char *str, int size)
|
||||
void str_to_file(const char *fname, char *str, size_t size)
|
||||
{
|
||||
str_to_file2(fname, str, size, FALSE);
|
||||
}
|
||||
|
@ -7897,7 +7895,7 @@ static void handle_no_active_connection(struct st_command *command,
|
|||
*/
|
||||
|
||||
void run_query_normal(struct st_connection *cn, struct st_command *command,
|
||||
int flags, char *query, int query_len,
|
||||
int flags, char *query, size_t query_len,
|
||||
DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings)
|
||||
{
|
||||
MYSQL_RES *res= 0;
|
||||
|
@ -8239,7 +8237,7 @@ void handle_no_error(struct st_command *command)
|
|||
*/
|
||||
|
||||
void run_query_stmt(struct st_connection *cn, struct st_command *command,
|
||||
char *query, int query_len, DYNAMIC_STRING *ds,
|
||||
char *query, size_t query_len, DYNAMIC_STRING *ds,
|
||||
DYNAMIC_STRING *ds_warnings)
|
||||
{
|
||||
MYSQL_RES *res= NULL; /* Note that here 'res' is meta data result set */
|
||||
|
@ -8516,7 +8514,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
|||
DYNAMIC_STRING ds_sorted;
|
||||
DYNAMIC_STRING ds_warnings;
|
||||
char *query;
|
||||
int query_len;
|
||||
size_t query_len;
|
||||
my_bool view_created= 0, sp_created= 0;
|
||||
my_bool complete_query= ((flags & QUERY_SEND_FLAG) &&
|
||||
(flags & QUERY_REAP_FLAG));
|
||||
|
@ -8572,7 +8570,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
|
|||
if (!disable_query_log && (flags & QUERY_SEND_FLAG))
|
||||
{
|
||||
char *print_query= query;
|
||||
int print_len= query_len;
|
||||
size_t print_len= query_len;
|
||||
if (flags & QUERY_PRINT_ORIGINAL_FLAG)
|
||||
{
|
||||
print_query= command->query;
|
||||
|
@ -8769,7 +8767,7 @@ void init_re_comp(regex_t *re, const char* str)
|
|||
if (err)
|
||||
{
|
||||
char erbuf[100];
|
||||
int len= regerror(err, re, erbuf, sizeof(erbuf));
|
||||
size_t len= regerror(err, re, erbuf, sizeof(erbuf));
|
||||
die("error %s, %d/%d `%s'\n",
|
||||
re_eprint(err), (int)len, (int)sizeof(erbuf), erbuf);
|
||||
}
|
||||
|
@ -8835,7 +8833,7 @@ int match_re(regex_t *re, char *str)
|
|||
|
||||
{
|
||||
char erbuf[100];
|
||||
int len= regerror(err, re, erbuf, sizeof(erbuf));
|
||||
size_t len= regerror(err, re, erbuf, sizeof(erbuf));
|
||||
die("error %s, %d/%d `%s'\n",
|
||||
re_eprint(err), (int)len, (int)sizeof(erbuf), erbuf);
|
||||
}
|
||||
|
@ -9970,8 +9968,7 @@ typedef struct st_replace_found {
|
|||
|
||||
|
||||
void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds,
|
||||
const char *str,
|
||||
int len __attribute__((unused)))
|
||||
const char *str)
|
||||
{
|
||||
REPLACE *rep_pos;
|
||||
REPLACE_STRING *rep_str;
|
||||
|
@ -10014,7 +10011,6 @@ void replace_strings_append(REPLACE *rep, DYNAMIC_STRING* ds,
|
|||
DBUG_PRINT("exit", ("Found end of from string"));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
DBUG_ASSERT(from <= str+len);
|
||||
start= from;
|
||||
rep_pos=rep;
|
||||
}
|
||||
|
@ -10078,7 +10074,7 @@ struct st_replace_regex* init_replace_regex(char* expr)
|
|||
{
|
||||
char *expr_end, *buf_p;
|
||||
struct st_replace_regex* res;
|
||||
uint expr_len= strlen(expr);
|
||||
size_t expr_len= strlen(expr);
|
||||
|
||||
/* my_malloc() will die on fail with MY_FAE */
|
||||
res=(struct st_replace_regex*)my_malloc(
|
||||
|
@ -10461,7 +10457,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
|
|||
regfree(&r);
|
||||
*res_p= 0;
|
||||
*buf_p= buf;
|
||||
*buf_len_p= buf_len;
|
||||
*buf_len_p= (int)buf_len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -11104,7 +11100,7 @@ void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val, size_t len)
|
|||
if (glob_replace)
|
||||
{
|
||||
/* Normal replace */
|
||||
replace_strings_append(glob_replace, ds, val, len);
|
||||
replace_strings_append(glob_replace, ds, val);
|
||||
}
|
||||
else
|
||||
dynstr_append_mem(ds, val, len);
|
||||
|
|
|
@ -148,10 +148,6 @@ IF(MSVC)
|
|||
#TODO: update the code and remove the disabled warnings
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4805 /wd4996 /we4700 /we4311 /we4477 /we4302 /we4090")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4805 /wd4291 /wd4996 /we4099 /we4700 /we4311 /we4477 /we4302 /we4090")
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Temporarily disable size_t warnings, due to their amount
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267")
|
||||
ENDIF()
|
||||
IF(MYSQL_MAINTAINER_MODE MATCHES "ERR")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
|
||||
|
|
|
@ -95,8 +95,8 @@ static my_bool do_leaf;
|
|||
static my_bool per_page_details;
|
||||
static ulint n_merge;
|
||||
extern ulong srv_checksum_algorithm;
|
||||
static ulong physical_page_size; /* Page size in bytes on disk. */
|
||||
static ulong logical_page_size; /* Page size when uncompressed. */
|
||||
static ulint physical_page_size; /* Page size in bytes on disk. */
|
||||
static ulint logical_page_size; /* Page size when uncompressed. */
|
||||
ulong srv_page_size;
|
||||
page_size_t univ_page_size(0, 0, false);
|
||||
/* Current page number (0 based). */
|
||||
|
@ -431,13 +431,13 @@ open_file(
|
|||
tablespace.
|
||||
@retval no. of bytes read.
|
||||
*/
|
||||
ulong read_file(
|
||||
ulint read_file(
|
||||
byte* buf,
|
||||
bool partial_page_read,
|
||||
ulong physical_page_size,
|
||||
ulint physical_page_size,
|
||||
FILE* fil_in)
|
||||
{
|
||||
ulong bytes = 0;
|
||||
ulint bytes = 0;
|
||||
|
||||
DBUG_ASSERT(physical_page_size >= UNIV_ZIP_SIZE_MIN);
|
||||
|
||||
|
@ -447,7 +447,7 @@ ulong read_file(
|
|||
bytes = UNIV_ZIP_SIZE_MIN;
|
||||
}
|
||||
|
||||
bytes += ulong(fread(buf, 1, physical_page_size, fil_in));
|
||||
bytes += ulint(fread(buf, 1, physical_page_size, fil_in));
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
@ -792,7 +792,7 @@ parse_page(
|
|||
ulint right_page_no;
|
||||
ulint data_bytes;
|
||||
bool is_leaf;
|
||||
int size_range_id;
|
||||
ulint size_range_id;
|
||||
|
||||
/* Check whether page is doublewrite buffer. */
|
||||
if(skip_page) {
|
||||
|
@ -1703,13 +1703,12 @@ int main(
|
|||
ulint zip_size = page_size.is_compressed() ? page_size.logical() : 0;
|
||||
logical_page_size = page_size.is_compressed() ? zip_size : 0;
|
||||
physical_page_size = page_size.physical();
|
||||
srv_page_size = page_size.logical();
|
||||
srv_page_size = (ulong)page_size.logical();
|
||||
bool is_compressed = FSP_FLAGS_HAS_PAGE_COMPRESSION(flags);
|
||||
|
||||
if (page_size.physical() > UNIV_ZIP_SIZE_MIN) {
|
||||
/* Read rest of the page 0 to determine crypt_data */
|
||||
bytes = ulong(read_file(buf, partial_page_read, page_size.physical(), fil_in));
|
||||
|
||||
bytes = read_file(buf, partial_page_read, page_size.physical(), fil_in);
|
||||
if (bytes != page_size.physical()) {
|
||||
fprintf(stderr, "Error: Was not able to read the "
|
||||
"rest of the page ");
|
||||
|
|
|
@ -1386,7 +1386,7 @@ operator<<(std::ostream& s, const escape_and_quote& eq)
|
|||
s << '\'';
|
||||
size_t len = strlen(eq.str);
|
||||
char* escaped = (char *)alloca(2 * len + 1);
|
||||
len = mysql_real_escape_string(eq.mysql, escaped, eq.str, len);
|
||||
len = mysql_real_escape_string(eq.mysql, escaped, eq.str, (ulong)len);
|
||||
s << std::string(escaped, len);
|
||||
s << '\'';
|
||||
return s;
|
||||
|
|
|
@ -1591,7 +1591,7 @@ innodb_init_param(void)
|
|||
changes the value so that it becomes the number of database pages. */
|
||||
|
||||
srv_buf_pool_size = (ulint) xtrabackup_use_memory;
|
||||
srv_buf_pool_chunk_unit = srv_buf_pool_size;
|
||||
srv_buf_pool_chunk_unit = (ulong)srv_buf_pool_size;
|
||||
srv_buf_pool_instances = 1;
|
||||
|
||||
srv_n_file_io_threads = (ulint) innobase_file_io_threads;
|
||||
|
@ -5545,7 +5545,7 @@ static int main_low(char** argv)
|
|||
static int get_exepath(char *buf, size_t size, const char *argv0)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
DWORD ret = GetModuleFileNameA(NULL, buf, size);
|
||||
DWORD ret = GetModuleFileNameA(NULL, buf, (DWORD)size);
|
||||
if (ret > 0)
|
||||
return 0;
|
||||
#elif defined(__linux__)
|
||||
|
|
|
@ -299,10 +299,10 @@ int CertManager::Validate()
|
|||
ASN1_STRING beforeDate, afterDate;
|
||||
beforeDate.data= (unsigned char *) cert.GetBeforeDate();
|
||||
beforeDate.type= cert.GetBeforeDateType();
|
||||
beforeDate.length= strlen((char *) beforeDate.data) + 1;
|
||||
beforeDate.length= (int)strlen((char *) beforeDate.data) + 1;
|
||||
afterDate.data= (unsigned char *) cert.GetAfterDate();
|
||||
afterDate.type= cert.GetAfterDateType();
|
||||
afterDate.length= strlen((char *) afterDate.data) + 1;
|
||||
afterDate.length= (int)strlen((char *) afterDate.data) + 1;
|
||||
peerX509_ = NEW_YS X509(cert.GetIssuer(), iSz, cert.GetCommonName(),
|
||||
sSz, &beforeDate, &afterDate,
|
||||
cert.GetIssuerCnStart(), cert.GetIssuerCnLength(),
|
||||
|
@ -348,10 +348,10 @@ int CertManager::SetPrivateKey(const x509& key)
|
|||
ASN1_STRING beforeDate, afterDate;
|
||||
beforeDate.data= (unsigned char *) cd.GetBeforeDate();
|
||||
beforeDate.type= cd.GetBeforeDateType();
|
||||
beforeDate.length= strlen((char *) beforeDate.data) + 1;
|
||||
beforeDate.length= (int)strlen((char *) beforeDate.data) + 1;
|
||||
afterDate.data= (unsigned char *) cd.GetAfterDate();
|
||||
afterDate.type= cd.GetAfterDateType();
|
||||
afterDate.length= strlen((char *) afterDate.data) + 1;
|
||||
afterDate.length= (int)strlen((char *) afterDate.data) + 1;
|
||||
selfX509_ = NEW_YS X509(cd.GetIssuer(), iSz, cd.GetCommonName(),
|
||||
sSz, &beforeDate, &afterDate,
|
||||
cd.GetIssuerCnStart(), cd.GetIssuerCnLength(),
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace {
|
|||
extern "C" long system_recv(void *ptr, void *buf, size_t count, int flags)
|
||||
{
|
||||
yaSSL::socket_t *socket = (yaSSL::socket_t *) ptr;
|
||||
return ::recv(*socket, reinterpret_cast<char *>(buf), count, flags);
|
||||
return ::recv(*socket, reinterpret_cast<char *>(buf), (int)count, flags);
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,7 +66,7 @@ extern "C" long system_send(void *ptr, const void *buf, size_t count,
|
|||
int flags)
|
||||
{
|
||||
yaSSL::socket_t *socket = (yaSSL::socket_t *) ptr;
|
||||
return ::send(*socket, reinterpret_cast<const char *>(buf), count, flags);
|
||||
return ::send(*socket, reinterpret_cast<const char *>(buf), (int)count, flags);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -917,7 +917,7 @@ typedef struct
|
|||
|
||||
void my_string_metadata_get(MY_STRING_METADATA *metadata,
|
||||
CHARSET_INFO *cs, const char *str, size_t len);
|
||||
uint my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong len);
|
||||
uint my_string_repertoire(CHARSET_INFO *cs, const char *str, size_t len);
|
||||
my_bool my_charset_is_ascii_based(CHARSET_INFO *cs);
|
||||
uint my_charset_repertoire(CHARSET_INFO *cs);
|
||||
|
||||
|
@ -953,9 +953,9 @@ uint32 my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
|
|||
Protocol::store_warning() uses this to escape control
|
||||
and non-convertable characters.
|
||||
*/
|
||||
uint32 my_convert_using_func(char *to, uint32 to_length, CHARSET_INFO *to_cs,
|
||||
uint32 my_convert_using_func(char *to, size_t to_length, CHARSET_INFO *to_cs,
|
||||
my_charset_conv_wc_mb mb_wc,
|
||||
const char *from, uint32 from_length,
|
||||
const char *from, size_t from_length,
|
||||
CHARSET_INFO *from_cs,
|
||||
my_charset_conv_mb_wc wc_mb,
|
||||
uint *errors);
|
||||
|
|
|
@ -84,7 +84,7 @@ typedef struct st_HA_KEYSEG /* Key-portion */
|
|||
|
||||
#define store_key_length_inc(key,length) \
|
||||
{ if ((length) < 255) \
|
||||
{ *(key)++= (length); } \
|
||||
{ *(key)++= (uchar)(length); } \
|
||||
else \
|
||||
{ *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \
|
||||
}
|
||||
|
@ -107,8 +107,8 @@ typedef struct st_HA_KEYSEG /* Key-portion */
|
|||
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
|
||||
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
|
||||
|
||||
extern int ha_compare_text(CHARSET_INFO *, const uchar *, uint,
|
||||
const uchar *, uint , my_bool);
|
||||
extern int ha_compare_text(CHARSET_INFO *, const uchar *, size_t,
|
||||
const uchar *, size_t , my_bool);
|
||||
extern int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a,
|
||||
const uchar *b, uint key_length, uint nextflag,
|
||||
uint *diff_pos);
|
||||
|
|
|
@ -80,7 +80,7 @@ int pthread_cond_signal(pthread_cond_t *cond);
|
|||
int pthread_cond_broadcast(pthread_cond_t *cond);
|
||||
int pthread_cond_destroy(pthread_cond_t *cond);
|
||||
int pthread_attr_init(pthread_attr_t *connect_att);
|
||||
int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack);
|
||||
int pthread_attr_setstacksize(pthread_attr_t *connect_att,size_t stack);
|
||||
int pthread_attr_destroy(pthread_attr_t *connect_att);
|
||||
int my_pthread_once(my_pthread_once_t *once_control,void (*init_routine)(void));
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ C_MODE_START
|
|||
void my_init_stacktrace();
|
||||
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack,
|
||||
my_bool silent);
|
||||
int my_safe_print_str(const char* val, int max_len);
|
||||
int my_safe_print_str(const char* val, size_t max_len);
|
||||
void my_write_core(int sig);
|
||||
#if BACKTRACE_DEMANGLE
|
||||
char *my_demangle(const char *mangled_name, int *status);
|
||||
|
|
|
@ -1047,9 +1047,9 @@ extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
|
|||
char *to, size_t to_length,
|
||||
const char *from, size_t length);
|
||||
|
||||
extern void thd_increment_bytes_sent(void *thd, ulong length);
|
||||
extern void thd_increment_bytes_received(void *thd, ulong length);
|
||||
extern void thd_increment_net_big_packet_count(void *thd, ulong length);
|
||||
extern void thd_increment_bytes_sent(void *thd, size_t length);
|
||||
extern void thd_increment_bytes_received(void *thd, size_t length);
|
||||
extern void thd_increment_net_big_packet_count(void *thd, size_t length);
|
||||
|
||||
#ifdef __WIN__
|
||||
extern my_bool have_tcpip; /* Is set if tcpip is used */
|
||||
|
|
|
@ -109,9 +109,9 @@ static inline void my_time_status_init(MYSQL_TIME_STATUS *status)
|
|||
|
||||
my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
|
||||
ulonglong flags, int *was_cut);
|
||||
my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
my_bool str_to_time(const char *str, size_t length, MYSQL_TIME *l_time,
|
||||
ulonglong flag, MYSQL_TIME_STATUS *status);
|
||||
my_bool str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
my_bool str_to_datetime(const char *str, size_t length, MYSQL_TIME *l_time,
|
||||
ulonglong flags, MYSQL_TIME_STATUS *status);
|
||||
longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
|
||||
ulonglong flags, int *was_cut);
|
||||
|
|
|
@ -165,7 +165,7 @@ void scramble(char *to, const char *message, const char *password);
|
|||
my_bool check_scramble(const unsigned char *reply, const char *message,
|
||||
const unsigned char *hash_stage2);
|
||||
void get_salt_from_password(unsigned char *res, const char *password);
|
||||
char *octet2hex(char *to, const char *str, unsigned int len);
|
||||
char *octet2hex(char *to, const char *str, size_t len);
|
||||
char *get_tty_password(const char *opt_message);
|
||||
void get_tty_password_buff(const char *opt_message, char *to, size_t length);
|
||||
const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
|
||||
|
|
|
@ -572,7 +572,7 @@ inline_mysql_socket_bind
|
|||
#ifdef HAVE_PSI_SOCKET_INTERFACE
|
||||
const char *src_file, uint src_line,
|
||||
#endif
|
||||
MYSQL_SOCKET mysql_socket, const struct sockaddr *addr, socklen_t len)
|
||||
MYSQL_SOCKET mysql_socket, const struct sockaddr *addr, size_t len)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -586,11 +586,11 @@ inline_mysql_socket_bind
|
|||
(&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
|
||||
|
||||
/* Instrumented code */
|
||||
result= bind(mysql_socket.fd, addr, len);
|
||||
result= bind(mysql_socket.fd, addr, (int)len);
|
||||
|
||||
/* Instrumentation end */
|
||||
if (result == 0)
|
||||
PSI_SOCKET_CALL(set_socket_info)(mysql_socket.m_psi, NULL, addr, len);
|
||||
PSI_SOCKET_CALL(set_socket_info)(mysql_socket.m_psi, NULL, addr, (socklen_t)len);
|
||||
|
||||
if (locker != NULL)
|
||||
PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
|
||||
|
@ -600,7 +600,7 @@ inline_mysql_socket_bind
|
|||
#endif
|
||||
|
||||
/* Non instrumented code */
|
||||
result= bind(mysql_socket.fd, addr, len);
|
||||
result= bind(mysql_socket.fd, addr, (int)len);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -145,14 +145,14 @@ inline_mysql_digest_end(PSI_digest_locker *locker, const sql_digest_storage *dig
|
|||
static inline struct PSI_statement_locker *
|
||||
inline_mysql_start_statement(PSI_statement_locker_state *state,
|
||||
PSI_statement_key key,
|
||||
const char *db, uint db_len,
|
||||
const char *db, size_t db_len,
|
||||
const CHARSET_INFO *charset,
|
||||
const char *src_file, uint src_line)
|
||||
{
|
||||
PSI_statement_locker *locker;
|
||||
locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset);
|
||||
if (likely(locker != NULL))
|
||||
PSI_STATEMENT_CALL(start_statement)(locker, db, db_len, src_file, src_line);
|
||||
PSI_STATEMENT_CALL(start_statement)(locker, db, (uint)db_len, src_file, src_line);
|
||||
return locker;
|
||||
}
|
||||
|
||||
|
|
|
@ -709,7 +709,7 @@ void scramble(char *to, const char *message, const char *password);
|
|||
my_bool check_scramble(const unsigned char *reply, const char *message,
|
||||
const unsigned char *hash_stage2);
|
||||
void get_salt_from_password(unsigned char *res, const char *password);
|
||||
char *octet2hex(char *to, const char *str, unsigned int len);
|
||||
char *octet2hex(char *to, const char *str, size_t len);
|
||||
|
||||
/* end of password.c */
|
||||
|
||||
|
|
|
@ -121,9 +121,9 @@ extern void vio_set_wait_callback(void (*before_wait)(void),
|
|||
my_bool vio_socket_connect(Vio *vio, struct sockaddr *addr, socklen_t len,
|
||||
int timeout);
|
||||
|
||||
void vio_get_normalized_ip(const struct sockaddr *src, int src_length, struct sockaddr *dst, int *dst_length);
|
||||
void vio_get_normalized_ip(const struct sockaddr *src, size_t src_length, struct sockaddr *dst);
|
||||
|
||||
my_bool vio_get_normalized_ip_string(const struct sockaddr *addr, int addr_length,
|
||||
my_bool vio_get_normalized_ip_string(const struct sockaddr *addr, size_t addr_length,
|
||||
char *ip_string, size_t ip_string_size);
|
||||
|
||||
my_bool vio_is_no_name_error(int err_code);
|
||||
|
@ -232,7 +232,6 @@ struct st_vio
|
|||
int fcntl_mode; /* Buffered fcntl(sd,F_GETFL) */
|
||||
struct sockaddr_storage local; /* Local internet address */
|
||||
struct sockaddr_storage remote; /* Remote internet address */
|
||||
int addrLen; /* Length of remote address */
|
||||
enum enum_vio_type type; /* Type of connection */
|
||||
const char *desc; /* String description */
|
||||
char *read_buffer; /* buffer for vio_read_buff */
|
||||
|
|
|
@ -3151,8 +3151,7 @@ static void read_binary_date(MYSQL_TIME *tm, uchar **pos)
|
|||
length data length
|
||||
*/
|
||||
|
||||
static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
|
||||
uint length)
|
||||
static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, size_t length)
|
||||
{
|
||||
char *buffer= (char *)param->buffer;
|
||||
int err= 0;
|
||||
|
@ -3264,7 +3263,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
|
|||
param->length will always contain length of entire column;
|
||||
number of copied bytes may be way different:
|
||||
*/
|
||||
*param->length= length;
|
||||
*param->length= (ulong)length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -380,7 +380,7 @@ static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key,
|
|||
my_bool my_hash_insert(HASH *info, const uchar *record)
|
||||
{
|
||||
int flag;
|
||||
uint idx, halfbuff, first_index;
|
||||
size_t idx, halfbuff, first_index;
|
||||
size_t length;
|
||||
my_hash_value_type current_hash_nr, UNINIT_VAR(rec_hash_nr),
|
||||
UNINIT_VAR(rec2_hash_nr);
|
||||
|
|
|
@ -86,12 +86,12 @@ typedef struct {
|
|||
1 - error (callbck returned 1)
|
||||
*/
|
||||
static int l_find(LF_SLIST * volatile *head, CHARSET_INFO *cs, uint32 hashnr,
|
||||
const uchar *key, uint keylen, CURSOR *cursor, LF_PINS *pins,
|
||||
const uchar *key, size_t keylen, CURSOR *cursor, LF_PINS *pins,
|
||||
my_hash_walk_action callback)
|
||||
{
|
||||
uint32 cur_hashnr;
|
||||
const uchar *cur_key;
|
||||
uint cur_keylen;
|
||||
size_t cur_keylen;
|
||||
intptr link;
|
||||
|
||||
DBUG_ASSERT(!cs || !callback); /* should not be set both */
|
||||
|
|
|
@ -557,7 +557,7 @@ int _my_b_read(IO_CACHE *info, uchar *Buffer, size_t Count)
|
|||
}
|
||||
res= info->read_function(info, Buffer, Count);
|
||||
if (res && info->error >= 0)
|
||||
info->error+= left_length; /* update number or read bytes */
|
||||
info->error+= (int)left_length; /* update number or read bytes */
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -2429,7 +2429,7 @@ restart:
|
|||
The call is thread safe because only the current
|
||||
thread might change the block->hash_link value
|
||||
*/
|
||||
error= my_pwrite(block->hash_link->file,
|
||||
error= (int)my_pwrite(block->hash_link->file,
|
||||
block->buffer + block->offset,
|
||||
block->length - block->offset,
|
||||
block->hash_link->diskpos + block->offset,
|
||||
|
@ -2674,7 +2674,7 @@ static void read_block_primary(SIMPLE_KEY_CACHE_CB *keycache,
|
|||
else
|
||||
{
|
||||
block->status|= BLOCK_READ;
|
||||
block->length= got_length;
|
||||
block->length= (uint)got_length;
|
||||
/*
|
||||
Do not set block->offset here. If this block is marked
|
||||
BLOCK_CHANGED later, we want to flush only the modified part. So
|
||||
|
@ -3809,7 +3809,7 @@ static int flush_cached_blocks(SIMPLE_KEY_CACHE_CB *keycache,
|
|||
(BLOCK_READ | BLOCK_IN_FLUSH | BLOCK_CHANGED | BLOCK_IN_USE));
|
||||
block->status|= BLOCK_IN_FLUSHWRITE;
|
||||
keycache_pthread_mutex_unlock(&keycache->cache_lock);
|
||||
error= my_pwrite(file, block->buffer + block->offset,
|
||||
error= (int)my_pwrite(file, block->buffer + block->offset,
|
||||
block->length - block->offset,
|
||||
block->hash_link->diskpos + block->offset,
|
||||
MYF(MY_NABP | MY_WAIT_IF_FULL));
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include <my_compare.h>
|
||||
#include <my_sys.h>
|
||||
|
||||
int ha_compare_text(CHARSET_INFO *charset_info, const uchar *a, uint a_length,
|
||||
const uchar *b, uint b_length, my_bool part_key)
|
||||
int ha_compare_text(CHARSET_INFO *charset_info, const uchar *a, size_t a_length,
|
||||
const uchar *b, size_t b_length, my_bool part_key)
|
||||
{
|
||||
if (!part_key)
|
||||
return charset_info->coll->strnncollsp(charset_info, a, a_length,
|
||||
|
|
|
@ -826,7 +826,7 @@ static int setval(const struct my_option *opts, void *value, char *argument,
|
|||
*((ulonglong*)value)=
|
||||
find_set_from_flags(opts->typelib, opts->typelib->count,
|
||||
*(ulonglong *)value, opts->def_value,
|
||||
argument, strlen(argument),
|
||||
argument, (uint)strlen(argument),
|
||||
&error, &error_len);
|
||||
if (error)
|
||||
{
|
||||
|
@ -1621,7 +1621,7 @@ void my_print_variables(const struct my_option *options)
|
|||
|
||||
for (optp= options; optp->name; optp++)
|
||||
{
|
||||
length= strlen(optp->name)+1;
|
||||
length= (uint)strlen(optp->name)+1;
|
||||
if (length > name_space)
|
||||
name_space= length;
|
||||
}
|
||||
|
|
|
@ -98,9 +98,10 @@ int pthread_attr_init(pthread_attr_t *connect_att)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack)
|
||||
int pthread_attr_setstacksize(pthread_attr_t *connect_att,size_t stack)
|
||||
{
|
||||
connect_att->dwStackSize=stack;
|
||||
DBUG_ASSERT(stack < UINT_MAX);
|
||||
connect_att->dwStackSize=(DWORD)stack;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ static void print_buffer(char *buffer, size_t count)
|
|||
|
||||
@return Zero on success.
|
||||
*/
|
||||
static int safe_print_str(const char *addr, int max_len)
|
||||
static int safe_print_str(const char *addr, size_t max_len)
|
||||
{
|
||||
int fd;
|
||||
pid_t tid;
|
||||
|
@ -147,7 +147,7 @@ static int safe_print_str(const char *addr, int max_len)
|
|||
returns 1, it does not mean 100% that the pointer is corrupted.
|
||||
*/
|
||||
|
||||
int my_safe_print_str(const char* val, int max_len)
|
||||
int my_safe_print_str(const char* val, size_t max_len)
|
||||
{
|
||||
char *heap_end;
|
||||
|
||||
|
@ -763,7 +763,7 @@ void my_write_core(int unused)
|
|||
}
|
||||
|
||||
|
||||
int my_safe_print_str(const char *val, int len)
|
||||
int my_safe_print_str(const char *val, size_t len)
|
||||
{
|
||||
__try
|
||||
{
|
||||
|
@ -780,7 +780,7 @@ int my_safe_print_str(const char *val, int len)
|
|||
|
||||
size_t my_write_stderr(const void *buf, size_t count)
|
||||
{
|
||||
return (size_t) write(fileno(stderr), buf, count);
|
||||
return (size_t) write(fileno(stderr), buf, (uint)count);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -178,9 +178,9 @@ my_bool dynstr_append_quoted(DYNAMIC_STRING *str,
|
|||
const char *append, size_t len,
|
||||
char quote)
|
||||
{
|
||||
uint additional= (str->alloc_increment ? str->alloc_increment : 10);
|
||||
uint lim= additional;
|
||||
uint i;
|
||||
size_t additional= (str->alloc_increment ? str->alloc_increment : 10);
|
||||
size_t lim= additional;
|
||||
size_t i;
|
||||
if (dynstr_realloc(str, len + additional + 2))
|
||||
return TRUE;
|
||||
str->str[str->length++]= quote;
|
||||
|
|
|
@ -110,7 +110,7 @@ static int initialize_plugin(void *unused)
|
|||
|
||||
strcpy(first_packet, srv_principal_name);
|
||||
strcpy(first_packet + strlen(srv_principal_name) + 1,srv_mech_name);
|
||||
first_packet_len = strlen(srv_principal_name) + strlen(srv_mech_name) + 2;
|
||||
first_packet_len = (int)(strlen(srv_principal_name) + strlen(srv_mech_name) + 2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ void sspi_errmsg(int err, char *buf, size_t size)
|
|||
len = FormatMessageA(
|
||||
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
|
||||
err, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
|
||||
buf, size, NULL);
|
||||
buf, (DWORD)size, NULL);
|
||||
|
||||
if(len > 0)
|
||||
{
|
||||
|
|
|
@ -108,7 +108,7 @@ static int get_client_name_from_context(CtxtHandle *ctxt,
|
|||
sspi_ret= ImpersonateSecurityContext(ctxt);
|
||||
if (sspi_ret == SEC_E_OK)
|
||||
{
|
||||
ULONG len= name_len;
|
||||
ULONG len= (ULONG)name_len;
|
||||
if (!GetUserNameEx(NameSamCompatible, name, &len))
|
||||
{
|
||||
log_error(GetLastError(), "GetUserNameEx");
|
||||
|
|
|
@ -469,7 +469,7 @@ static int read_and_decrypt_key(const char *path, KEY_INFO *info)
|
|||
return(ENCRYPTION_KEY_BUFFER_TOO_SMALL);
|
||||
}
|
||||
memcpy(info->data, plaintext.GetUnderlyingData(), len);
|
||||
info->length= len;
|
||||
info->length= (unsigned int)len;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -527,7 +527,7 @@ static int generate_and_save_datakey(uint keyid, uint version)
|
|||
my_printf_error(ER_UNKNOWN_ERROR, "AWS KMS plugin: Can't create file %s", ME_ERROR_LOG, filename);
|
||||
return(-1);
|
||||
}
|
||||
size_t len= byteBuffer.GetLength();
|
||||
unsigned int len= (unsigned int)byteBuffer.GetLength();
|
||||
if (write(fd, byteBuffer.GetUnderlyingData(), len) != len)
|
||||
{
|
||||
my_printf_error(ER_UNKNOWN_ERROR, "AWS KMS plugin: can't write to %s", ME_ERROR_LOG, filename);
|
||||
|
|
|
@ -40,9 +40,9 @@ class Url_http: public Url {
|
|||
bool ssl;
|
||||
LEX_STRING proxy_host, proxy_port;
|
||||
|
||||
int use_proxy()
|
||||
bool use_proxy()
|
||||
{
|
||||
return proxy_host.length;
|
||||
return proxy_host.length != 0;
|
||||
}
|
||||
|
||||
Url_http(LEX_STRING &url_arg, LEX_STRING &host_arg,
|
||||
|
@ -166,7 +166,7 @@ int Url_http::send(const char* data, size_t data_length)
|
|||
{
|
||||
my_socket fd= INVALID_SOCKET;
|
||||
char buf[1024];
|
||||
uint len= 0;
|
||||
size_t len= 0;
|
||||
|
||||
addrinfo *addrs, *addr, filter= {0, AF_UNSPEC, SOCK_STREAM, 6, 0, 0, 0, 0};
|
||||
int res= use_proxy() ?
|
||||
|
@ -186,7 +186,7 @@ int Url_http::send(const char* data, size_t data_length)
|
|||
if (fd == INVALID_SOCKET)
|
||||
continue;
|
||||
|
||||
if (connect(fd, addr->ai_addr, addr->ai_addrlen) == 0)
|
||||
if (connect(fd, addr->ai_addr, (int) addr->ai_addrlen) == 0)
|
||||
break;
|
||||
|
||||
closesocket(fd);
|
||||
|
|
|
@ -69,7 +69,7 @@ Connection::Connection(MYSQL_PLUGIN_VIO *vio): m_vio(vio), m_error(0)
|
|||
|
||||
int Connection::write(const Blob &blob)
|
||||
{
|
||||
m_error= m_vio->write_packet(m_vio, blob.ptr(), blob.len());
|
||||
m_error= m_vio->write_packet(m_vio, blob.ptr(), (int)blob.len());
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
if (m_error)
|
||||
|
@ -392,8 +392,8 @@ char* wchar_to_utf8(const wchar_t *string, size_t *len)
|
|||
int res= WideCharToMultiByte(CP_UTF8, // convert to UTF-8
|
||||
0, // conversion flags
|
||||
string, // input buffer
|
||||
str_len, // its length
|
||||
buf, buf_len, // output buffer and its size
|
||||
(int)str_len, // its length
|
||||
buf, (int)buf_len, // output buffer and its size
|
||||
NULL, NULL); // default character (not used)
|
||||
|
||||
if (res)
|
||||
|
@ -460,8 +460,8 @@ wchar_t* utf8_to_wchar(const char *string, size_t *len)
|
|||
res= MultiByteToWideChar(CP_UTF8, // convert from UTF-8
|
||||
0, // conversion flags
|
||||
string, // input buffer
|
||||
buf_len, // its size
|
||||
buf, buf_len); // output buffer and its size
|
||||
(int)buf_len, // its size
|
||||
buf, (int)buf_len); // output buffer and its size
|
||||
if (res)
|
||||
{
|
||||
buf[res]= '\0';
|
||||
|
|
|
@ -49,7 +49,7 @@ class Security_buffer: public SecBufferDesc
|
|||
|
||||
m_buf.BufferType= SECBUFFER_TOKEN;
|
||||
m_buf.pvBuffer= ptr;
|
||||
m_buf.cbBuffer= len;
|
||||
m_buf.cbBuffer= (ULONG)len;
|
||||
}
|
||||
|
||||
/// If @c false, no deallocation will be done in the destructor.
|
||||
|
|
|
@ -160,7 +160,7 @@ int Handshake_client::write_packet(Blob &data)
|
|||
Store in byte 255 the number of 512b blocks that are needed to
|
||||
keep all the data.
|
||||
*/
|
||||
unsigned block_count= data.len()/512 + ((data.len() % 512) ? 1 : 0);
|
||||
unsigned block_count= (uint)(data.len()/512) + ((data.len() % 512) ? 1 : 0);
|
||||
|
||||
#if !defined(DBUG_OFF) && defined(WINAUTH_USE_DBUG_LIB)
|
||||
|
||||
|
|
|
@ -2972,7 +2972,7 @@ int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
|
|||
/* new "use different plugin" packet */
|
||||
uint len;
|
||||
auth_plugin_name= (char*)mysql->net.read_pos + 1;
|
||||
len= strlen(auth_plugin_name); /* safe as my_net_read always appends \0 */
|
||||
len= (uint)strlen(auth_plugin_name); /* safe as my_net_read always appends \0 */
|
||||
mpvio.cached_server_reply.pkt_len= pkt_length - len - 2;
|
||||
mpvio.cached_server_reply.pkt= mysql->net.read_pos + len + 2;
|
||||
DBUG_PRINT ("info", ("change plugin packet from server for plugin %s",
|
||||
|
@ -3361,7 +3361,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
|||
|
||||
DBUG_PRINT("info", ("Connect socket"));
|
||||
status= connect_sync_or_async(mysql, net, sock,
|
||||
t_res->ai_addr, t_res->ai_addrlen);
|
||||
t_res->ai_addr, (uint)t_res->ai_addrlen);
|
||||
/*
|
||||
Here we rely on my_connect() to return success only if the
|
||||
connect attempt was really successful. Otherwise we would stop
|
||||
|
|
|
@ -293,7 +293,7 @@ static void get_microseconds(ulong *val, MYSQL_TIME_STATUS *status,
|
|||
#define MAX_DATE_PARTS 8
|
||||
|
||||
my_bool
|
||||
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
str_to_datetime(const char *str, size_t length, MYSQL_TIME *l_time,
|
||||
ulonglong flags, MYSQL_TIME_STATUS *status)
|
||||
{
|
||||
const char *end=str+length, *pos;
|
||||
|
@ -457,7 +457,7 @@ err:
|
|||
TRUE on error
|
||||
*/
|
||||
|
||||
my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
my_bool str_to_time(const char *str, size_t length, MYSQL_TIME *l_time,
|
||||
ulonglong fuzzydate, MYSQL_TIME_STATUS *status)
|
||||
{
|
||||
ulong date[5];
|
||||
|
|
|
@ -135,7 +135,7 @@ my_recv_async(struct mysql_async_context *b, my_socket fd,
|
|||
|
||||
for (;;)
|
||||
{
|
||||
res= recv(fd, buf, size, IF_WIN(0, MSG_DONTWAIT));
|
||||
res= recv(fd, buf, (int)size, IF_WIN(0, MSG_DONTWAIT));
|
||||
if (res >= 0 || IS_BLOCKING_ERROR())
|
||||
return res;
|
||||
b->events_to_wait_for= MYSQL_WAIT_READ;
|
||||
|
@ -163,7 +163,7 @@ my_send_async(struct mysql_async_context *b, my_socket fd,
|
|||
|
||||
for (;;)
|
||||
{
|
||||
res= send(fd, buf, size, IF_WIN(0, MSG_DONTWAIT));
|
||||
res= send(fd, buf, (int)size, IF_WIN(0, MSG_DONTWAIT));
|
||||
if (res >= 0 || IS_BLOCKING_ERROR())
|
||||
return res;
|
||||
b->events_to_wait_for= MYSQL_WAIT_WRITE;
|
||||
|
|
|
@ -545,7 +545,7 @@ uint engine_option_value::frm_length()
|
|||
|
||||
if value.str is NULL, this option is not written to frm (=DEFAULT)
|
||||
*/
|
||||
return value.str ? 1 + name.length + 2 + value.length : 0;
|
||||
return value.str ? (uint)(1 + name.length + 2 + value.length) : 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -730,7 +730,7 @@ uchar *engine_option_value::frm_read(const uchar *buff, const uchar *buff_end,
|
|||
@retval FALSE OK
|
||||
*/
|
||||
|
||||
bool engine_table_options_frm_read(const uchar *buff, uint length,
|
||||
bool engine_table_options_frm_read(const uchar *buff, size_t length,
|
||||
TABLE_SHARE *share)
|
||||
{
|
||||
const uchar *buff_end= buff + length;
|
||||
|
|
|
@ -87,7 +87,7 @@ bool parse_option_list(THD* thd, handlerton *hton, void *option_struct,
|
|||
engine_option_value **option_list,
|
||||
ha_create_table_option *rules,
|
||||
bool suppress_warning, MEM_ROOT *root);
|
||||
bool engine_table_options_frm_read(const uchar *buff, uint length,
|
||||
bool engine_table_options_frm_read(const uchar *buff, size_t length,
|
||||
TABLE_SHARE *share);
|
||||
engine_option_value *merge_engine_table_options(engine_option_value *source,
|
||||
engine_option_value *changes,
|
||||
|
|
|
@ -465,13 +465,13 @@ static int debug_sync_qsort_cmp(const void* arg1, const void* arg2)
|
|||
static st_debug_sync_action *debug_sync_find(st_debug_sync_action *actionarr,
|
||||
int quantity,
|
||||
const char *dsp_name,
|
||||
uint name_len)
|
||||
size_t name_len)
|
||||
{
|
||||
st_debug_sync_action *action;
|
||||
int low ;
|
||||
int high ;
|
||||
int mid ;
|
||||
int diff ;
|
||||
ssize_t diff ;
|
||||
DBUG_ASSERT(actionarr);
|
||||
DBUG_ASSERT(dsp_name);
|
||||
DBUG_ASSERT(name_len);
|
||||
|
|
|
@ -59,7 +59,7 @@ load_des_key_file(const char *file_name)
|
|||
char *start, *end;
|
||||
char buf[1024], offset;
|
||||
st_des_keyblock keyblock;
|
||||
uint length;
|
||||
size_t length;
|
||||
|
||||
if (!(length=my_b_gets(&io,buf,sizeof(buf)-1)))
|
||||
break; // End of file
|
||||
|
|
|
@ -136,7 +136,7 @@ int writefrm(const char *path, const char *db, const char *table,
|
|||
}
|
||||
else
|
||||
{
|
||||
error= mysql_file_write(file, frmdata, len, MYF(MY_WME | MY_NABP));
|
||||
error= (int)mysql_file_write(file, frmdata, len, MYF(MY_WME | MY_NABP));
|
||||
|
||||
if (!error && !tmp_table && opt_sync_frm)
|
||||
error= mysql_file_sync(file, MYF(MY_WME)) ||
|
||||
|
|
150
sql/field.cc
150
sql/field.cc
|
@ -1228,7 +1228,7 @@ bool Field::can_optimize_range(const Item_bool_func *cond,
|
|||
}
|
||||
|
||||
|
||||
int Field::store_hex_hybrid(const char *str, uint length)
|
||||
int Field::store_hex_hybrid(const char *str, size_t length)
|
||||
{
|
||||
DBUG_ASSERT(result_type() != STRING_RESULT);
|
||||
ulonglong nr;
|
||||
|
@ -1467,8 +1467,7 @@ Value_source::Converter_string_to_number::check_edom_and_truncation(THD *thd,
|
|||
int Field_num::check_edom_and_important_data_truncation(const char *type,
|
||||
bool edom,
|
||||
CHARSET_INFO *cs,
|
||||
const char *str,
|
||||
uint length,
|
||||
const char *str, size_t length,
|
||||
const char *end)
|
||||
{
|
||||
/* Test if we get an empty string or garbage */
|
||||
|
@ -1490,7 +1489,7 @@ int Field_num::check_edom_and_important_data_truncation(const char *type,
|
|||
|
||||
int Field_num::check_edom_and_truncation(const char *type, bool edom,
|
||||
CHARSET_INFO *cs,
|
||||
const char *str, uint length,
|
||||
const char *str, size_t length,
|
||||
const char *end)
|
||||
{
|
||||
int rc= check_edom_and_important_data_truncation(type, edom,
|
||||
|
@ -1524,7 +1523,7 @@ int Field_num::check_edom_and_truncation(const char *type, bool edom,
|
|||
1 error
|
||||
*/
|
||||
|
||||
bool Field_num::get_int(CHARSET_INFO *cs, const char *from, uint len,
|
||||
bool Field_num::get_int(CHARSET_INFO *cs, const char *from, size_t len,
|
||||
longlong *rnd, ulonglong unsigned_max,
|
||||
longlong signed_min, longlong signed_max)
|
||||
{
|
||||
|
@ -1568,7 +1567,7 @@ out_of_range:
|
|||
}
|
||||
|
||||
|
||||
double Field_real::get_double(const char *str, uint length, CHARSET_INFO *cs,
|
||||
double Field_real::get_double(const char *str, size_t length, CHARSET_INFO *cs,
|
||||
int *error)
|
||||
{
|
||||
char *end;
|
||||
|
@ -1754,7 +1753,7 @@ bool Field::compatible_field_size(uint field_metadata,
|
|||
}
|
||||
|
||||
|
||||
int Field::store(const char *to, uint length, CHARSET_INFO *cs,
|
||||
int Field::store(const char *to, size_t length, CHARSET_INFO *cs,
|
||||
enum_check_fields check_level)
|
||||
{
|
||||
int res;
|
||||
|
@ -2466,7 +2465,7 @@ void Field_decimal::overflow(bool negative)
|
|||
}
|
||||
|
||||
|
||||
int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs)
|
||||
int Field_decimal::store(const char *from_arg, size_t len, CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
char buff[STRING_BUFFER_USUAL_SIZE];
|
||||
|
@ -2847,7 +2846,6 @@ int Field_decimal::store(double nr)
|
|||
return 1;
|
||||
}
|
||||
|
||||
reg4 uint i;
|
||||
size_t length;
|
||||
uchar fyllchar,*to;
|
||||
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
|
||||
|
@ -2863,7 +2861,7 @@ int Field_decimal::store(double nr)
|
|||
else
|
||||
{
|
||||
to=ptr;
|
||||
for (i=field_length-length ; i-- > 0 ;)
|
||||
for (size_t i=field_length-length ; i-- > 0 ;)
|
||||
*to++ = fyllchar;
|
||||
memcpy(to,buff,length);
|
||||
return 0;
|
||||
|
@ -3149,7 +3147,7 @@ bool Field_new_decimal::store_value(const my_decimal *decimal_value)
|
|||
}
|
||||
|
||||
|
||||
int Field_new_decimal::store(const char *from, uint length,
|
||||
int Field_new_decimal::store(const char *from, size_t length,
|
||||
CHARSET_INFO *charset_arg)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
|
@ -3356,7 +3354,7 @@ int Field_new_decimal::cmp(const uchar *a,const uchar*b)
|
|||
|
||||
|
||||
void Field_new_decimal::sort_string(uchar *buff,
|
||||
uint length __attribute__((unused)))
|
||||
uint)
|
||||
{
|
||||
memcpy(buff, ptr, bin_size);
|
||||
}
|
||||
|
@ -3540,7 +3538,7 @@ int Field_num::store_time_dec(const MYSQL_TIME *ltime, uint dec_arg)
|
|||
** tiny int
|
||||
****************************************************************************/
|
||||
|
||||
int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
int Field_tiny::store(const char *from,size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error;
|
||||
|
@ -3716,7 +3714,7 @@ void Field_tiny::sql_type(String &res) const
|
|||
Field type short int (2 byte)
|
||||
****************************************************************************/
|
||||
|
||||
int Field_short::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
int Field_short::store(const char *from,size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int store_tmp;
|
||||
|
@ -3905,7 +3903,7 @@ void Field_short::sql_type(String &res) const
|
|||
Field type medium int (3 byte)
|
||||
****************************************************************************/
|
||||
|
||||
int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
int Field_medium::store(const char *from,size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int store_tmp;
|
||||
|
@ -4096,7 +4094,7 @@ void Field_medium::sql_type(String &res) const
|
|||
** long int
|
||||
****************************************************************************/
|
||||
|
||||
int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
int Field_long::store(const char *from,size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
long store_tmp;
|
||||
|
@ -4224,17 +4222,17 @@ String *Field_long::val_str(String *val_buffer,
|
|||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||
CHARSET_INFO *cs= &my_charset_numeric;
|
||||
uint length;
|
||||
uint mlength=MY_MAX(field_length+1,12*cs->mbmaxlen);
|
||||
size_t length;
|
||||
size_t mlength=MY_MAX(field_length+1,12*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
char *to=(char*) val_buffer->ptr();
|
||||
int32 j;
|
||||
j=sint4korr(ptr);
|
||||
|
||||
if (unsigned_flag)
|
||||
length=cs->cset->long10_to_str(cs,to,mlength, 10,(long) (uint32)j);
|
||||
length=cs->cset->long10_to_str(cs,to,mlength, 10,(uint32) j);
|
||||
else
|
||||
length=cs->cset->long10_to_str(cs,to,mlength,-10,(long) j);
|
||||
length=cs->cset->long10_to_str(cs,to,mlength,-10,j);
|
||||
val_buffer->length(length);
|
||||
if (zerofill)
|
||||
prepend_zeros(val_buffer);
|
||||
|
@ -4283,7 +4281,7 @@ void Field_long::sql_type(String &res) const
|
|||
Field type longlong int (8 bytes)
|
||||
****************************************************************************/
|
||||
|
||||
int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
int Field_longlong::store(const char *from,size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int error= 0;
|
||||
|
@ -4459,7 +4457,7 @@ bool Field_longlong::is_max()
|
|||
single precision float
|
||||
****************************************************************************/
|
||||
|
||||
int Field_float::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
int Field_float::store(const char *from,size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
int error;
|
||||
Field_float::store(get_double(from, len, cs, &error));
|
||||
|
@ -4638,7 +4636,7 @@ void Field_float::sql_type(String &res) const
|
|||
double precision floating point numbers
|
||||
****************************************************************************/
|
||||
|
||||
int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
int Field_double::store(const char *from,size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
int error;
|
||||
Field_double::store(get_double(from, len, cs, &error));
|
||||
|
@ -5098,7 +5096,7 @@ int Field_timestamp::store_time_dec(const MYSQL_TIME *ltime, uint dec)
|
|||
}
|
||||
|
||||
|
||||
int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
int Field_timestamp::store(const char *from,size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
MYSQL_TIME l_time;
|
||||
MYSQL_TIME_STATUS status;
|
||||
|
@ -5600,7 +5598,7 @@ int Field_temporal_with_date::store_TIME_with_warning(MYSQL_TIME *ltime,
|
|||
}
|
||||
|
||||
|
||||
int Field_temporal_with_date::store(const char *from, uint len, CHARSET_INFO *cs)
|
||||
int Field_temporal_with_date::store(const char *from, size_t len, CHARSET_INFO *cs)
|
||||
{
|
||||
MYSQL_TIME ltime;
|
||||
MYSQL_TIME_STATUS status;
|
||||
|
@ -5796,7 +5794,7 @@ void Field_time::store_TIME(const MYSQL_TIME *ltime)
|
|||
int3store(ptr,tmp);
|
||||
}
|
||||
|
||||
int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
int Field_time::store(const char *from,size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
MYSQL_TIME ltime;
|
||||
MYSQL_TIME_STATUS status;
|
||||
|
@ -6228,7 +6226,7 @@ bool Field_timef::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
|
|||
** Can handle 2 byte or 4 byte years!
|
||||
****************************************************************************/
|
||||
|
||||
int Field_year::store(const char *from, uint len,CHARSET_INFO *cs)
|
||||
int Field_year::store(const char *from, size_t len,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
char *end;
|
||||
|
@ -6972,7 +6970,7 @@ Field_longstr::report_if_important_data(const char *pstr, const char *end,
|
|||
|
||||
/* Copy a string and fill with space */
|
||||
|
||||
int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
|
||||
int Field_string::store(const char *from, size_t length,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
uint copy_length;
|
||||
|
@ -7038,7 +7036,7 @@ int Field_str::store(double nr)
|
|||
else
|
||||
set_warning(WARN_DATA_TRUNCATED, 1);
|
||||
}
|
||||
return store(buff, length, &my_charset_numeric);
|
||||
return store(buff, (uint)length, &my_charset_numeric);
|
||||
}
|
||||
|
||||
uint Field::is_equal(Create_field *new_field)
|
||||
|
@ -7170,7 +7168,7 @@ String *Field_string::val_str(String *val_buffer __attribute__((unused)),
|
|||
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||
/* See the comment for Field_long::store(long long) */
|
||||
DBUG_ASSERT(!table || table->in_use == current_thd);
|
||||
uint length;
|
||||
size_t length;
|
||||
if (get_thd()->variables.sql_mode &
|
||||
MODE_PAD_CHAR_TO_FULL_LENGTH)
|
||||
length= my_charpos(field_charset, ptr, ptr + field_length,
|
||||
|
@ -7233,11 +7231,11 @@ Field_string::compatible_field_size(uint field_metadata,
|
|||
|
||||
int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr)
|
||||
{
|
||||
uint a_len, b_len;
|
||||
size_t a_len, b_len;
|
||||
|
||||
if (field_charset->mbmaxlen != 1)
|
||||
{
|
||||
uint char_len= field_length/field_charset->mbmaxlen;
|
||||
size_t char_len= field_length/field_charset->mbmaxlen;
|
||||
a_len= my_charpos(field_charset, a_ptr, a_ptr + field_length, char_len);
|
||||
b_len= my_charpos(field_charset, b_ptr, b_ptr + field_length, char_len);
|
||||
}
|
||||
|
@ -7255,7 +7253,7 @@ int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr)
|
|||
|
||||
void Field_string::sort_string(uchar *to,uint length)
|
||||
{
|
||||
uint tmp __attribute__((unused))=
|
||||
IF_DBUG(size_t tmp= ,)
|
||||
field_charset->coll->strnxfrm(field_charset,
|
||||
to, length,
|
||||
char_length() *
|
||||
|
@ -7271,7 +7269,7 @@ void Field_string::sql_type(String &res) const
|
|||
{
|
||||
THD *thd= table->in_use;
|
||||
CHARSET_INFO *cs=res.charset();
|
||||
ulong length;
|
||||
size_t length;
|
||||
|
||||
length= cs->cset->snprintf(cs,(char*) res.ptr(),
|
||||
res.alloced_length(), "%s(%d)",
|
||||
|
@ -7288,9 +7286,9 @@ void Field_string::sql_type(String &res) const
|
|||
|
||||
uchar *Field_string::pack(uchar *to, const uchar *from, uint max_length)
|
||||
{
|
||||
uint length= MY_MIN(field_length,max_length);
|
||||
uint local_char_length= max_length/field_charset->mbmaxlen;
|
||||
DBUG_PRINT("debug", ("Packing field '%s' - length: %u ", field_name.str,
|
||||
size_t length= MY_MIN(field_length,max_length);
|
||||
size_t local_char_length= max_length/field_charset->mbmaxlen;
|
||||
DBUG_PRINT("debug", ("Packing field '%s' - length: %zu ", field_name.str,
|
||||
length));
|
||||
|
||||
if (length > local_char_length)
|
||||
|
@ -7445,14 +7443,14 @@ uint Field_string::max_packed_col_length(uint max_length)
|
|||
|
||||
uint Field_string::get_key_image(uchar *buff, uint length, imagetype type_arg)
|
||||
{
|
||||
uint bytes = my_charpos(field_charset, (char*) ptr,
|
||||
size_t bytes = my_charpos(field_charset, (char*) ptr,
|
||||
(char*) ptr + field_length,
|
||||
length / field_charset->mbmaxlen);
|
||||
memcpy(buff, ptr, bytes);
|
||||
if (bytes < length)
|
||||
field_charset->cset->fill(field_charset, (char*) buff + bytes,
|
||||
length - bytes, field_charset->pad_char);
|
||||
return bytes;
|
||||
return (uint)bytes;
|
||||
}
|
||||
|
||||
|
||||
|
@ -7521,7 +7519,7 @@ int Field_varstring::save_field_metadata(uchar *metadata_ptr)
|
|||
return 2;
|
||||
}
|
||||
|
||||
int Field_varstring::store(const char *from,uint length,CHARSET_INFO *cs)
|
||||
int Field_varstring::store(const char *from,size_t length,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
uint copy_length;
|
||||
|
@ -7622,8 +7620,8 @@ int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
|
|||
|
||||
int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length)
|
||||
{
|
||||
uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
|
||||
uint local_char_length= max_key_length / field_charset->mbmaxlen;
|
||||
size_t length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
|
||||
size_t local_char_length= max_key_length / field_charset->mbmaxlen;
|
||||
|
||||
local_char_length= my_charpos(field_charset, ptr + length_bytes,
|
||||
ptr + length_bytes + length, local_char_length);
|
||||
|
@ -7672,7 +7670,7 @@ void Field_varstring::sort_string(uchar *to,uint length)
|
|||
}
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
uint rc=
|
||||
size_t rc=
|
||||
#endif
|
||||
field_charset->coll->strnxfrm(field_charset, to, length,
|
||||
char_length() * field_charset->strxfrm_multiply,
|
||||
|
@ -7704,7 +7702,7 @@ void Field_varstring::sql_type(String &res) const
|
|||
{
|
||||
THD *thd= table->in_use;
|
||||
CHARSET_INFO *cs=res.charset();
|
||||
ulong length;
|
||||
size_t length;
|
||||
|
||||
length= cs->cset->snprintf(cs,(char*) res.ptr(),
|
||||
res.alloced_length(), "%s(%d)",
|
||||
|
@ -8053,12 +8051,12 @@ String *Field_longstr::uncompress(String *val_buffer, String *val_ptr,
|
|||
}
|
||||
|
||||
|
||||
int Field_varstring_compressed::store(const char *from, uint length,
|
||||
int Field_varstring_compressed::store(const char *from, size_t length,
|
||||
CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
uint to_length= MY_MIN(field_length, field_charset->mbmaxlen * length + 1);
|
||||
int rc= compress((char*) get_data(), &to_length, from, length, cs);
|
||||
uint to_length= (uint)MY_MIN(field_length, field_charset->mbmaxlen * length + 1);
|
||||
int rc= compress((char*) get_data(), &to_length, from, (uint)length, cs);
|
||||
store_length(to_length);
|
||||
return rc;
|
||||
}
|
||||
|
@ -8183,10 +8181,10 @@ int Field_blob::copy_value(Field_blob *from)
|
|||
}
|
||||
|
||||
|
||||
int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
|
||||
int Field_blob::store(const char *from,size_t length,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
uint copy_length, new_length;
|
||||
size_t copy_length, new_length;
|
||||
String_copier copier;
|
||||
char *tmp;
|
||||
char buff[STRING_BUFFER_USUAL_SIZE];
|
||||
|
@ -8205,7 +8203,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||
DBUG_ASSERT(length <= max_data_length());
|
||||
|
||||
new_length= length;
|
||||
copy_length= (uint)MY_MIN(UINT_MAX,table->in_use->variables.group_concat_max_len);
|
||||
copy_length= (size_t)MY_MIN(UINT_MAX,table->in_use->variables.group_concat_max_len);
|
||||
if (new_length > copy_length)
|
||||
{
|
||||
new_length= Well_formed_prefix(cs,
|
||||
|
@ -8258,7 +8256,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||
return 0;
|
||||
}
|
||||
copy_length= copier.well_formed_copy(field_charset,
|
||||
(char*) value.ptr(), new_length,
|
||||
(char*) value.ptr(), (uint)new_length,
|
||||
cs, from, length);
|
||||
Field_blob::store_length(copy_length);
|
||||
bmove(ptr+packlength,(uchar*) &tmp,sizeof(char*));
|
||||
|
@ -8381,7 +8379,7 @@ int Field_blob::cmp_binary(const uchar *a_ptr, const uchar *b_ptr,
|
|||
|
||||
uint Field_blob::get_key_image(uchar *buff,uint length, imagetype type_arg)
|
||||
{
|
||||
uint32 blob_length= get_length(ptr);
|
||||
size_t blob_length= get_length(ptr);
|
||||
uchar *blob;
|
||||
|
||||
#ifdef HAVE_SPATIAL
|
||||
|
@ -8399,7 +8397,7 @@ uint Field_blob::get_key_image(uchar *buff,uint length, imagetype type_arg)
|
|||
return image_length;
|
||||
}
|
||||
blob= get_ptr();
|
||||
gobj= Geometry::construct(&buffer, (char*) blob, blob_length);
|
||||
gobj= Geometry::construct(&buffer, (char*) blob, (uint32)blob_length);
|
||||
if (!gobj || gobj->get_mbr(&mbr, &dummy))
|
||||
bzero(buff, image_length);
|
||||
else
|
||||
|
@ -8414,12 +8412,12 @@ uint Field_blob::get_key_image(uchar *buff,uint length, imagetype type_arg)
|
|||
#endif /*HAVE_SPATIAL*/
|
||||
|
||||
blob= get_ptr();
|
||||
uint local_char_length= length / field_charset->mbmaxlen;
|
||||
size_t local_char_length= length / field_charset->mbmaxlen;
|
||||
local_char_length= my_charpos(field_charset, blob, blob + blob_length,
|
||||
local_char_length);
|
||||
set_if_smaller(blob_length, local_char_length);
|
||||
|
||||
if ((uint32) length > blob_length)
|
||||
if (length > blob_length)
|
||||
{
|
||||
/*
|
||||
Must clear this as we do a memcmp in opt_range.cc to detect
|
||||
|
@ -8445,14 +8443,14 @@ void Field_blob::set_key_image(const uchar *buff,uint length)
|
|||
int Field_blob::key_cmp(const uchar *key_ptr, uint max_key_length)
|
||||
{
|
||||
uchar *blob1;
|
||||
uint blob_length=get_length(ptr);
|
||||
size_t blob_length=get_length(ptr);
|
||||
memcpy(&blob1, ptr+packlength, sizeof(char*));
|
||||
CHARSET_INFO *cs= charset();
|
||||
uint local_char_length= max_key_length / cs->mbmaxlen;
|
||||
size_t local_char_length= max_key_length / cs->mbmaxlen;
|
||||
local_char_length= my_charpos(cs, blob1, blob1+blob_length,
|
||||
local_char_length);
|
||||
set_if_smaller(blob_length, local_char_length);
|
||||
return Field_blob::cmp(blob1, blob_length,
|
||||
return Field_blob::cmp(blob1, (uint32)blob_length,
|
||||
key_ptr+HA_KEY_BLOB_LENGTH,
|
||||
uint2korr(key_ptr));
|
||||
}
|
||||
|
@ -8523,7 +8521,7 @@ void Field_blob::sort_string(uchar *to,uint length)
|
|||
}
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
uint rc=
|
||||
size_t rc=
|
||||
#endif
|
||||
field_charset->coll->strnxfrm(field_charset, to, length, length,
|
||||
(const uchar*) buf.ptr(), buf.length(),
|
||||
|
@ -8663,11 +8661,11 @@ uint Field_blob::is_equal(Create_field *new_field)
|
|||
}
|
||||
|
||||
|
||||
int Field_blob_compressed::store(const char *from, uint length,
|
||||
int Field_blob_compressed::store(const char *from, size_t length,
|
||||
CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
uint to_length= MY_MIN(max_data_length(), field_charset->mbmaxlen * length + 1);
|
||||
uint to_length= (uint)MY_MIN(max_data_length(), field_charset->mbmaxlen * length + 1);
|
||||
int rc;
|
||||
|
||||
if (value.alloc(to_length))
|
||||
|
@ -8676,7 +8674,7 @@ int Field_blob_compressed::store(const char *from, uint length,
|
|||
return -1;
|
||||
}
|
||||
|
||||
rc= compress((char*) value.ptr(), &to_length, from, length, cs);
|
||||
rc= compress((char*) value.ptr(), &to_length, from, (uint)length, cs);
|
||||
set_ptr(to_length, (uchar*) value.ptr());
|
||||
return rc;
|
||||
}
|
||||
|
@ -8761,7 +8759,7 @@ uint gis_field_options_image(uchar *buff, List<Create_field> &create_fields)
|
|||
}
|
||||
|
||||
|
||||
uint gis_field_options_read(const uchar *buf, uint buf_len,
|
||||
uint gis_field_options_read(const uchar *buf, size_t buf_len,
|
||||
Field_geom::storage_type *st_type,uint *precision, uint *scale, uint *srid)
|
||||
{
|
||||
const uchar *buf_end= buf + buf_len;
|
||||
|
@ -8867,7 +8865,7 @@ int Field_geom::store_decimal(const my_decimal *)
|
|||
}
|
||||
|
||||
|
||||
int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
|
||||
int Field_geom::store(const char *from, size_t length, CHARSET_INFO *cs)
|
||||
{
|
||||
if (!length)
|
||||
bzero(ptr, Field_blob::pack_length());
|
||||
|
@ -8992,7 +8990,7 @@ void Field_enum::store_type(ulonglong value)
|
|||
(if there isn't a empty value in the enum)
|
||||
*/
|
||||
|
||||
int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
|
||||
int Field_enum::store(const char *from,size_t length,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int err= 0;
|
||||
|
@ -9009,7 +9007,7 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
|
|||
}
|
||||
|
||||
/* Remove end space */
|
||||
length= field_charset->cset->lengthsp(field_charset, from, length);
|
||||
length= (uint)field_charset->cset->lengthsp(field_charset, from, length);
|
||||
uint tmp=find_type2(typelib, from, length, field_charset);
|
||||
if (!tmp)
|
||||
{
|
||||
|
@ -9175,7 +9173,7 @@ Field *Field_enum::make_new_field(MEM_ROOT *root, TABLE *new_table,
|
|||
*/
|
||||
|
||||
|
||||
int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
|
||||
int Field_set::store(const char *from,size_t length,CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
bool got_warning= 0;
|
||||
|
@ -9594,14 +9592,14 @@ uint Field_bit::is_equal(Create_field *new_field)
|
|||
}
|
||||
|
||||
|
||||
int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs)
|
||||
int Field_bit::store(const char *from, size_t length, CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int delta;
|
||||
|
||||
for (; length && !*from; from++, length--) // skip left 0's
|
||||
;
|
||||
delta= bytes_in_rec - length;
|
||||
delta= (int)(bytes_in_rec - length);
|
||||
|
||||
if (delta < -1 ||
|
||||
(delta == -1 && (uchar) *from > ((1 << bit_len) - 1)) ||
|
||||
|
@ -9877,9 +9875,9 @@ Field_bit::compatible_field_size(uint field_metadata,
|
|||
void Field_bit::sql_type(String &res) const
|
||||
{
|
||||
CHARSET_INFO *cs= res.charset();
|
||||
ulong length= cs->cset->snprintf(cs, (char*) res.ptr(), res.alloced_length(),
|
||||
size_t length= cs->cset->snprintf(cs, (char*) res.ptr(), res.alloced_length(),
|
||||
"bit(%d)", (int) field_length);
|
||||
res.length((uint) length);
|
||||
res.length(length);
|
||||
}
|
||||
|
||||
|
||||
|
@ -10030,7 +10028,7 @@ Field_bit_as_char::Field_bit_as_char(uchar *ptr_arg, uint32 len_arg,
|
|||
}
|
||||
|
||||
|
||||
int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
|
||||
int Field_bit_as_char::store(const char *from, size_t length, CHARSET_INFO *cs)
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED;
|
||||
int delta;
|
||||
|
@ -10038,7 +10036,7 @@ int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
|
|||
|
||||
for (; length && !*from; from++, length--) // skip left 0's
|
||||
;
|
||||
delta= bytes_in_rec - length;
|
||||
delta= (int)(bytes_in_rec - length);
|
||||
|
||||
if (delta < 0 ||
|
||||
(delta == 0 && bits && (uint) (uchar) *from >= (uint) (1 << bits)))
|
||||
|
@ -10061,9 +10059,9 @@ int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
|
|||
void Field_bit_as_char::sql_type(String &res) const
|
||||
{
|
||||
CHARSET_INFO *cs= res.charset();
|
||||
ulong length= cs->cset->snprintf(cs, (char*) res.ptr(), res.alloced_length(),
|
||||
size_t length= cs->cset->snprintf(cs, (char*) res.ptr(), res.alloced_length(),
|
||||
"bit(%d)", (int) field_length);
|
||||
res.length((uint) length);
|
||||
res.length(length);
|
||||
}
|
||||
|
||||
|
||||
|
@ -10139,7 +10137,7 @@ bool Column_definition::create_interval_from_interval_list(MEM_ROOT *mem_root,
|
|||
}
|
||||
}
|
||||
interval->type_names[i]= value.str;
|
||||
interval->type_lengths[i]= value.length;
|
||||
interval->type_lengths[i]= (uint)value.length;
|
||||
}
|
||||
interval->type_names[interval->count]= 0; // End marker
|
||||
interval->type_lengths[interval->count]= 0;
|
||||
|
|
81
sql/field.h
81
sql/field.h
|
@ -216,7 +216,7 @@ protected:
|
|||
my_decimal *buf)
|
||||
{
|
||||
DBUG_ASSERT(length < UINT_MAX32);
|
||||
m_error= str2my_decimal(mask, str, (uint) length, cs,
|
||||
m_error= str2my_decimal(mask, str, length, cs,
|
||||
buf, (const char **) &m_end_of_num);
|
||||
// E_DEC_TRUNCATED means a very minor truncation: '1e-100' -> 0
|
||||
m_edom= m_error && m_error != E_DEC_TRUNCATED;
|
||||
|
@ -314,7 +314,7 @@ protected:
|
|||
return decimal_value;
|
||||
}
|
||||
|
||||
longlong longlong_from_hex_hybrid(const char *str, uint32 length)
|
||||
longlong longlong_from_hex_hybrid(const char *str, size_t length)
|
||||
{
|
||||
const char *end= str + length;
|
||||
const char *ptr= end - MY_MIN(length, sizeof(longlong));
|
||||
|
@ -824,8 +824,8 @@ public:
|
|||
@retval false - conversion is needed
|
||||
*/
|
||||
virtual bool memcpy_field_possible(const Field *from) const= 0;
|
||||
virtual int store(const char *to, uint length,CHARSET_INFO *cs)=0;
|
||||
virtual int store_hex_hybrid(const char *str, uint length);
|
||||
virtual int store(const char *to, size_t length,CHARSET_INFO *cs)=0;
|
||||
virtual int store_hex_hybrid(const char *str, size_t length);
|
||||
virtual int store(double nr)=0;
|
||||
virtual int store(longlong nr, bool unsigned_val)=0;
|
||||
virtual int store_decimal(const my_decimal *d)=0;
|
||||
|
@ -833,7 +833,7 @@ public:
|
|||
virtual int store_timestamp(my_time_t timestamp, ulong sec_part);
|
||||
int store_time(const MYSQL_TIME *ltime)
|
||||
{ return store_time_dec(ltime, TIME_SECOND_PART_DIGITS); }
|
||||
int store(const char *to, uint length, CHARSET_INFO *cs,
|
||||
int store(const char *to, size_t length, CHARSET_INFO *cs,
|
||||
enum_check_fields check_level);
|
||||
int store(const LEX_STRING *ls, CHARSET_INFO *cs)
|
||||
{
|
||||
|
@ -1644,20 +1644,20 @@ class Field_num :public Field {
|
|||
protected:
|
||||
int check_edom_and_important_data_truncation(const char *type, bool edom,
|
||||
CHARSET_INFO *cs,
|
||||
const char *str, uint length,
|
||||
const char *str, size_t length,
|
||||
const char *end_of_num);
|
||||
int check_edom_and_truncation(const char *type, bool edom,
|
||||
CHARSET_INFO *cs,
|
||||
const char *str, uint length,
|
||||
const char *str, size_t length,
|
||||
const char *end_of_num);
|
||||
int check_int(CHARSET_INFO *cs, const char *str, uint length,
|
||||
int check_int(CHARSET_INFO *cs, const char *str, size_t length,
|
||||
const char *int_end, int error)
|
||||
{
|
||||
return check_edom_and_truncation("integer",
|
||||
error == MY_ERRNO_EDOM || str == int_end,
|
||||
cs, str, length, int_end);
|
||||
}
|
||||
bool get_int(CHARSET_INFO *cs, const char *from, uint len,
|
||||
bool get_int(CHARSET_INFO *cs, const char *from, size_t len,
|
||||
longlong *rnd, ulonglong unsigned_max,
|
||||
longlong signed_min, longlong signed_max);
|
||||
void prepend_zeros(String *value) const;
|
||||
|
@ -1744,8 +1744,8 @@ public:
|
|||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int store_decimal(const my_decimal *);
|
||||
int store(const char *to,uint length,CHARSET_INFO *cs)=0;
|
||||
int store_hex_hybrid(const char *str, uint length)
|
||||
int store(const char *to,size_t length,CHARSET_INFO *cs)=0;
|
||||
int store_hex_hybrid(const char *str, size_t length)
|
||||
{
|
||||
return store(str, length, &my_charset_bin);
|
||||
}
|
||||
|
@ -1828,7 +1828,7 @@ public:
|
|||
/* base class for float and double and decimal (old one) */
|
||||
class Field_real :public Field_num {
|
||||
protected:
|
||||
double get_double(const char *str, uint length, CHARSET_INFO *cs, int *err);
|
||||
double get_double(const char *str, size_t length, CHARSET_INFO *cs, int *err);
|
||||
public:
|
||||
bool not_fixed;
|
||||
|
||||
|
@ -1884,7 +1884,7 @@ public:
|
|||
return eq_def(from) ? get_identical_copy_func() : do_field_string;
|
||||
}
|
||||
int reset(void);
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
double val_real(void);
|
||||
|
@ -1943,7 +1943,7 @@ public:
|
|||
bool store_value(const my_decimal *decimal_value);
|
||||
bool store_value(const my_decimal *decimal_value, int *native_error);
|
||||
void set_value_on_overflow(my_decimal *decimal_value, bool sign);
|
||||
int store(const char *to, uint length, CHARSET_INFO *charset);
|
||||
int store(const char *to, size_t length, CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
|
||||
|
@ -1989,7 +1989,7 @@ public:
|
|||
const Type_handler *type_handler() const { return &type_handler_tiny; }
|
||||
enum ha_base_keytype key_type() const
|
||||
{ return unsigned_flag ? HA_KEYTYPE_BINARY : HA_KEYTYPE_INT8; }
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int reset(void) { ptr[0]=0; return 0; }
|
||||
|
@ -2039,7 +2039,7 @@ public:
|
|||
const Type_handler *type_handler() const { return &type_handler_short; }
|
||||
enum ha_base_keytype key_type() const
|
||||
{ return unsigned_flag ? HA_KEYTYPE_USHORT_INT : HA_KEYTYPE_SHORT_INT;}
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int reset(void) { ptr[0]=ptr[1]=0; return 0; }
|
||||
|
@ -2074,7 +2074,7 @@ public:
|
|||
const Type_handler *type_handler() const { return &type_handler_int24; }
|
||||
enum ha_base_keytype key_type() const
|
||||
{ return unsigned_flag ? HA_KEYTYPE_UINT24 : HA_KEYTYPE_INT24; }
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
|
||||
|
@ -2114,7 +2114,7 @@ public:
|
|||
const Type_handler *type_handler() const { return &type_handler_long; }
|
||||
enum ha_base_keytype key_type() const
|
||||
{ return unsigned_flag ? HA_KEYTYPE_ULONG_INT : HA_KEYTYPE_LONG_INT; }
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
|
||||
|
@ -2160,7 +2160,7 @@ public:
|
|||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
enum ha_base_keytype key_type() const
|
||||
{ return unsigned_flag ? HA_KEYTYPE_ULONGLONG : HA_KEYTYPE_LONGLONG; }
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int reset(void)
|
||||
|
@ -2264,7 +2264,7 @@ public:
|
|||
}
|
||||
const Type_handler *type_handler() const { return &type_handler_float; }
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_FLOAT; }
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int reset(void) { bzero(ptr,sizeof(float)); return 0; }
|
||||
|
@ -2316,7 +2316,7 @@ public:
|
|||
}
|
||||
const Type_handler *type_handler() const { return &type_handler_double; }
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_DOUBLE; }
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int reset(void) { bzero(ptr,sizeof(double)); return 0; }
|
||||
|
@ -2351,7 +2351,7 @@ public:
|
|||
{
|
||||
return do_field_string;
|
||||
}
|
||||
int store(const char *to, uint length, CHARSET_INFO *cs)
|
||||
int store(const char *to, size_t length, CHARSET_INFO *cs)
|
||||
{ null[0]=1; return 0; }
|
||||
int store(double nr) { null[0]=1; return 0; }
|
||||
int store(longlong nr, bool unsigned_val) { null[0]=1; return 0; }
|
||||
|
@ -2394,7 +2394,7 @@ public:
|
|||
:Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
|
||||
field_name_arg)
|
||||
{ flags|= BINARY_FLAG; }
|
||||
int store_hex_hybrid(const char *str, uint length)
|
||||
int store_hex_hybrid(const char *str, size_t length)
|
||||
{
|
||||
return store(str, length, &my_charset_bin);
|
||||
}
|
||||
|
@ -2471,7 +2471,7 @@ public:
|
|||
:Field_temporal(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
|
||||
unireg_check_arg, field_name_arg)
|
||||
{}
|
||||
int store(const char *to, uint length, CHARSET_INFO *charset);
|
||||
int store(const char *to, size_t length, CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
|
||||
|
@ -2493,7 +2493,7 @@ public:
|
|||
const Type_handler *type_handler() const { return &type_handler_timestamp; }
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
|
||||
Copy_func *get_copy_func(const Field *from) const;
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
|
||||
|
@ -2696,7 +2696,7 @@ public:
|
|||
}
|
||||
return do_field_int;
|
||||
}
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
|
||||
|
@ -2815,7 +2815,7 @@ public:
|
|||
decimals() == from->decimals();
|
||||
}
|
||||
int store_time_dec(const MYSQL_TIME *ltime, uint dec);
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int store_decimal(const my_decimal *);
|
||||
|
@ -3188,7 +3188,7 @@ public:
|
|||
(has_charset() ? ' ' : 0));
|
||||
return 0;
|
||||
}
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
using Field_str::store;
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
|
@ -3292,7 +3292,7 @@ public:
|
|||
!compression_method() == !from->compression_method() &&
|
||||
length_bytes == ((Field_varstring*) from)->length_bytes;
|
||||
}
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
using Field_str::store;
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
|
@ -3348,7 +3348,7 @@ public:
|
|||
{ return compression_method_ptr; }
|
||||
private:
|
||||
Compression_method *compression_method_ptr;
|
||||
int store(const char *to, uint length, CHARSET_INFO *charset);
|
||||
int store(const char *to, size_t length, CHARSET_INFO *charset);
|
||||
using Field_str::store;
|
||||
String *val_str(String *, String *);
|
||||
double val_real(void);
|
||||
|
@ -3508,7 +3508,7 @@ public:
|
|||
!compression_method() == !from->compression_method() &&
|
||||
!table->copy_blobs;
|
||||
}
|
||||
int store(const char *to, uint length, CHARSET_INFO *charset);
|
||||
int store(const char *to, size_t length, CHARSET_INFO *charset);
|
||||
using Field_str::store;
|
||||
double val_real(void);
|
||||
longlong val_int(void);
|
||||
|
@ -3551,9 +3551,10 @@ public:
|
|||
void reset_fields() { bzero((uchar*) &value,sizeof(value)); bzero((uchar*) &read_value,sizeof(read_value)); }
|
||||
uint32 get_field_buffer_size(void) { return value.alloced_length(); }
|
||||
void store_length(uchar *i_ptr, uint i_packlength, uint32 i_number);
|
||||
inline void store_length(uint32 number)
|
||||
inline void store_length(size_t number)
|
||||
{
|
||||
store_length(ptr, packlength, number);
|
||||
DBUG_ASSERT(number < UINT_MAX32);
|
||||
store_length(ptr, packlength, (uint32)number);
|
||||
}
|
||||
inline uint32 get_length(uint row_offset= 0) const
|
||||
{ return get_length(ptr+row_offset, this->packlength); }
|
||||
|
@ -3661,7 +3662,7 @@ public:
|
|||
{ return compression_method_ptr; }
|
||||
private:
|
||||
Compression_method *compression_method_ptr;
|
||||
int store(const char *to, uint length, CHARSET_INFO *charset);
|
||||
int store(const char *to, size_t length, CHARSET_INFO *charset);
|
||||
using Field_str::store;
|
||||
String *val_str(String *, String *);
|
||||
double val_real(void);
|
||||
|
@ -3728,7 +3729,7 @@ public:
|
|||
bool is_eq_func) const;
|
||||
void sql_type(String &str) const;
|
||||
uint is_equal(Create_field *new_field);
|
||||
int store(const char *to, uint length, CHARSET_INFO *charset);
|
||||
int store(const char *to, size_t length, CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int store_decimal(const my_decimal *);
|
||||
|
@ -3755,7 +3756,7 @@ public:
|
|||
};
|
||||
|
||||
uint gis_field_options_image(uchar *buff, List<Create_field> &create_fields);
|
||||
uint gis_field_options_read(const uchar *buf, uint buf_len,
|
||||
uint gis_field_options_read(const uchar *buf, size_t buf_len,
|
||||
Field_geom::storage_type *st_type,uint *precision, uint *scale, uint *srid);
|
||||
|
||||
#endif /*HAVE_SPATIAL*/
|
||||
|
@ -3809,7 +3810,7 @@ public:
|
|||
return save_in_field_str(to);
|
||||
}
|
||||
bool memcpy_field_possible(const Field *from) const { return false; }
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
double val_real(void);
|
||||
|
@ -3876,7 +3877,7 @@ public:
|
|||
flags=(flags & ~ENUM_FLAG) | SET_FLAG;
|
||||
}
|
||||
int store_field(Field *from) { return from->save_in_field(this); }
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(const char *to,size_t length,CHARSET_INFO *charset);
|
||||
int store(double nr) { return Field_set::store((longlong) nr, FALSE); }
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
|
||||
|
@ -3932,7 +3933,7 @@ public:
|
|||
}
|
||||
int save_in_field(Field *to) { return to->store(val_int(), true); }
|
||||
bool memcpy_field_possible(const Field *from) const { return false; }
|
||||
int store(const char *to, uint length, CHARSET_INFO *charset);
|
||||
int store(const char *to, size_t length, CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
int store_decimal(const my_decimal *);
|
||||
|
@ -4051,7 +4052,7 @@ public:
|
|||
enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg);
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
|
||||
uint size_of() const { return sizeof(*this); }
|
||||
int store(const char *to, uint length, CHARSET_INFO *charset);
|
||||
int store(const char *to, size_t length, CHARSET_INFO *charset);
|
||||
int store(double nr) { return Field_bit::store(nr); }
|
||||
int store(longlong nr, bool unsigned_val)
|
||||
{ return Field_bit::store(nr, unsigned_val); }
|
||||
|
|
|
@ -389,7 +389,7 @@ static void do_field_varbinary_pre50(Copy_field *copy)
|
|||
copy->from_field->val_str(©->tmp);
|
||||
|
||||
/* Use the same function as in 4.1 to trim trailing spaces */
|
||||
uint length= my_lengthsp_8bit(&my_charset_bin, copy->tmp.c_ptr_quick(),
|
||||
size_t length= my_lengthsp_8bit(&my_charset_bin, copy->tmp.c_ptr_quick(),
|
||||
copy->from_field->field_length);
|
||||
|
||||
copy->to_field->store(copy->tmp.c_ptr_quick(), length,
|
||||
|
@ -481,7 +481,7 @@ static void do_cut_string_complex(Copy_field *copy)
|
|||
(char*) copy->from_ptr,
|
||||
(char*) from_end,
|
||||
copy->to_length / cs->mbmaxlen);
|
||||
uint copy_length= prefix.length();
|
||||
size_t copy_length= prefix.length();
|
||||
if (copy->to_length < copy_length)
|
||||
copy_length= copy->to_length;
|
||||
memcpy(copy->to_ptr, copy->from_ptr, copy_length);
|
||||
|
|
|
@ -68,7 +68,7 @@ static void unpack_addon_fields(struct st_sort_addon_field *addon_field,
|
|||
uchar *buff, uchar *buff_end);
|
||||
static bool check_if_pq_applicable(Sort_param *param, SORT_INFO *info,
|
||||
TABLE *table,
|
||||
ha_rows records, ulong memory_available);
|
||||
ha_rows records, size_t memory_available);
|
||||
|
||||
void Sort_param::init_for_filesort(uint sortlen, TABLE *table,
|
||||
ulong max_length_for_sort_data,
|
||||
|
@ -89,7 +89,10 @@ void Sort_param::init_for_filesort(uint sortlen, TABLE *table,
|
|||
table->field, sort_length, &addon_buf);
|
||||
}
|
||||
if (addon_field)
|
||||
res_length= addon_buf.length;
|
||||
{
|
||||
DBUG_ASSERT(addon_buf.length < UINT_MAX32);
|
||||
res_length= (uint)addon_buf.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
res_length= ref_length;
|
||||
|
@ -99,7 +102,7 @@ void Sort_param::init_for_filesort(uint sortlen, TABLE *table,
|
|||
*/
|
||||
sort_length+= ref_length;
|
||||
}
|
||||
rec_length= sort_length + addon_buf.length;
|
||||
rec_length= sort_length + (uint)addon_buf.length;
|
||||
max_rows= maxrows;
|
||||
}
|
||||
|
||||
|
@ -1026,8 +1029,8 @@ Type_handler_string_result::make_sort_key(uchar *to, Item *item,
|
|||
|
||||
if (use_strnxfrm(cs))
|
||||
{
|
||||
uint tmp_length __attribute__((unused));
|
||||
tmp_length= cs->coll->strnxfrm(cs, to, sort_field->length,
|
||||
IF_DBUG(size_t tmp_length= ,)
|
||||
cs->coll->strnxfrm(cs, to, sort_field->length,
|
||||
item->max_char_length() *
|
||||
cs->strxfrm_multiply,
|
||||
(uchar*) res->ptr(), res->length(),
|
||||
|
@ -1346,10 +1349,10 @@ static bool save_index(Sort_param *param, uint count,
|
|||
false - PQ will be slower than merge-sort, or there is not enough memory.
|
||||
*/
|
||||
|
||||
bool check_if_pq_applicable(Sort_param *param,
|
||||
static bool check_if_pq_applicable(Sort_param *param,
|
||||
SORT_INFO *filesort_info,
|
||||
TABLE *table, ha_rows num_rows,
|
||||
ulong memory_available)
|
||||
size_t memory_available)
|
||||
{
|
||||
DBUG_ENTER("check_if_pq_applicable");
|
||||
|
||||
|
@ -1371,7 +1374,7 @@ bool check_if_pq_applicable(Sort_param *param,
|
|||
DBUG_RETURN(false);
|
||||
}
|
||||
|
||||
ulong num_available_keys=
|
||||
size_t num_available_keys=
|
||||
memory_available / (param->rec_length + sizeof(char*));
|
||||
// We need 1 extra record in the buffer, when using PQ.
|
||||
param->max_keys_per_buffer= (uint) param->max_rows + 1;
|
||||
|
@ -1401,7 +1404,7 @@ bool check_if_pq_applicable(Sort_param *param,
|
|||
// Try to strip off addon fields.
|
||||
if (param->addon_field)
|
||||
{
|
||||
const ulong row_length=
|
||||
const size_t row_length=
|
||||
param->sort_length + param->ref_length + sizeof(char*);
|
||||
num_available_keys= memory_available / row_length;
|
||||
|
||||
|
@ -1411,7 +1414,7 @@ bool check_if_pq_applicable(Sort_param *param,
|
|||
const double sort_merge_cost=
|
||||
get_merge_many_buffs_cost_fast(num_rows,
|
||||
num_available_keys,
|
||||
row_length);
|
||||
(uint)row_length);
|
||||
/*
|
||||
PQ has cost:
|
||||
(insert + qsort) * log(queue size) / TIME_FOR_COMPARE_ROWID +
|
||||
|
@ -1883,7 +1886,7 @@ Type_handler_string_result::sortlength(THD *thd,
|
|||
set_if_smaller(sortorder->length, thd->variables.max_sort_length);
|
||||
if (use_strnxfrm((cs= item->collation.collation)))
|
||||
{
|
||||
sortorder->length= cs->coll->strnxfrmlen(cs, sortorder->length);
|
||||
sortorder->length= (uint)cs->coll->strnxfrmlen(cs, sortorder->length);
|
||||
}
|
||||
else if (cs == &my_charset_bin)
|
||||
{
|
||||
|
@ -1966,7 +1969,7 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
|
|||
if (use_strnxfrm((cs=sortorder->field->sort_charset())))
|
||||
{
|
||||
*multi_byte_charset= true;
|
||||
sortorder->length= cs->coll->strnxfrmlen(cs, sortorder->length);
|
||||
sortorder->length= (uint)cs->coll->strnxfrmlen(cs, sortorder->length);
|
||||
}
|
||||
if (sortorder->field->maybe_null())
|
||||
length++; // Place for NULL marker
|
||||
|
|
|
@ -137,13 +137,13 @@ static void GCALC_DBUG_PRINT_PI(const Gcalc_heap::Info *pi)
|
|||
static void GCALC_DBUG_PRINT_SLICE(const char *header,
|
||||
const Gcalc_scan_iterator::point *slice)
|
||||
{
|
||||
int nbuf;
|
||||
size_t nbuf;
|
||||
char buf[1024];
|
||||
nbuf= strlen(header);
|
||||
strcpy(buf, header);
|
||||
for (; slice; slice= slice->get_next())
|
||||
{
|
||||
int lnbuf= nbuf;
|
||||
size_t lnbuf= nbuf;
|
||||
lnbuf+= sprintf(buf + lnbuf, "%d\t", slice->thread);
|
||||
lnbuf+= sprintf(buf + lnbuf, "%s\t", gcalc_ev_name(slice->event));
|
||||
|
||||
|
@ -170,7 +170,7 @@ static void GCALC_DBUG_PRINT_SLICE(const char *header,
|
|||
Gcalc_dyn_list::Gcalc_dyn_list(size_t blk_size, size_t sizeof_item):
|
||||
m_blk_size(blk_size - ALLOC_ROOT_MIN_BLOCK_SIZE),
|
||||
m_sizeof_item(ALIGN_SIZE(sizeof_item)),
|
||||
m_points_per_blk((m_blk_size - PH_DATA_OFFSET) / m_sizeof_item),
|
||||
m_points_per_blk((uint)((m_blk_size - PH_DATA_OFFSET) / m_sizeof_item)),
|
||||
m_blk_hook(&m_first_blk),
|
||||
m_free(NULL),
|
||||
m_keep(NULL)
|
||||
|
|
|
@ -1296,8 +1296,8 @@ bool print_admin_msg(THD* thd, uint len,
|
|||
{
|
||||
va_list args;
|
||||
Protocol *protocol= thd->protocol;
|
||||
uint length;
|
||||
uint msg_length;
|
||||
size_t length;
|
||||
size_t msg_length;
|
||||
char name[NAME_LEN*2+2];
|
||||
char *msgbuf;
|
||||
bool error= true;
|
||||
|
@ -1318,7 +1318,7 @@ bool print_admin_msg(THD* thd, uint len,
|
|||
goto err;
|
||||
}
|
||||
|
||||
length=(uint) (strxmov(name, db_name, ".", table_name.c_ptr_safe(), NullS) - name);
|
||||
length=(size_t)(strxmov(name, db_name, ".", table_name.c_ptr_safe(), NullS) - name);
|
||||
/*
|
||||
TODO: switch from protocol to push_warning here. The main reason we didn't
|
||||
it yet is parallel repair, which threads have no THD object accessible via
|
||||
|
@ -2438,7 +2438,7 @@ reg_query_cache_dependant_table(THD *thd,
|
|||
(++(*block_table))->n= ++(*n);
|
||||
if (!cache->insert_table(thd, cache_key_len,
|
||||
cache_key, (*block_table),
|
||||
table_share->db.length,
|
||||
(uint32) table_share->db.length,
|
||||
(uint8) (cache_key_len -
|
||||
table_share->table_cache_key.length),
|
||||
type,
|
||||
|
@ -2643,10 +2643,10 @@ static uint name_add(char *dest, const char *first_name, const char *sec_name)
|
|||
bool ha_partition::create_handler_file(const char *name)
|
||||
{
|
||||
partition_element *part_elem, *subpart_elem;
|
||||
uint i, j, part_name_len, subpart_name_len;
|
||||
uint tot_partition_words, tot_name_len, num_parts;
|
||||
uint tot_parts= 0;
|
||||
uint tot_len_words, tot_len_byte, chksum, tot_name_words;
|
||||
size_t i, j, part_name_len, subpart_name_len;
|
||||
size_t tot_partition_words, tot_name_len, num_parts;
|
||||
size_t tot_parts= 0;
|
||||
size_t tot_len_words, tot_len_byte, chksum, tot_name_words;
|
||||
char *name_buffer_ptr;
|
||||
uchar *file_buffer, *engine_array;
|
||||
bool result= TRUE;
|
||||
|
@ -2658,7 +2658,7 @@ bool ha_partition::create_handler_file(const char *name)
|
|||
DBUG_ENTER("create_handler_file");
|
||||
|
||||
num_parts= m_part_info->partitions.elements;
|
||||
DBUG_PRINT("enter", ("table name: %s num_parts: %u", name, num_parts));
|
||||
DBUG_PRINT("enter", ("table name: %s num_parts: %zu", name, num_parts));
|
||||
tot_name_len= 0;
|
||||
for (i= 0; i < num_parts; i++)
|
||||
{
|
||||
|
@ -2777,7 +2777,7 @@ bool ha_partition::create_handler_file(const char *name)
|
|||
{
|
||||
uchar buffer[4];
|
||||
part_elem= part_it++;
|
||||
uint length= part_elem->connect_string.length;
|
||||
size_t length= part_elem->connect_string.length;
|
||||
int4store(buffer, length);
|
||||
if (my_write(file, buffer, 4, MYF(MY_WME | MY_NABP)) ||
|
||||
my_write(file, (uchar *) part_elem->connect_string.str, length,
|
||||
|
@ -3168,7 +3168,7 @@ bool ha_partition::insert_partition_name_in_hash(const char *name, uint part_id,
|
|||
{
|
||||
PART_NAME_DEF *part_def;
|
||||
uchar *part_name;
|
||||
uint part_name_length;
|
||||
size_t part_name_length;
|
||||
DBUG_ENTER("ha_partition::insert_partition_name_in_hash");
|
||||
/*
|
||||
Calculate and store the length here, to avoid doing it when
|
||||
|
@ -3188,7 +3188,7 @@ bool ha_partition::insert_partition_name_in_hash(const char *name, uint part_id,
|
|||
DBUG_RETURN(true);
|
||||
memcpy(part_name, name, part_name_length + 1);
|
||||
part_def->partition_name= part_name;
|
||||
part_def->length= part_name_length;
|
||||
part_def->length= (uint)part_name_length;
|
||||
part_def->part_id= part_id;
|
||||
part_def->is_subpart= is_subpart;
|
||||
if (my_hash_insert(&part_share->partition_name_hash, (uchar *) part_def))
|
||||
|
@ -5102,7 +5102,7 @@ end_dont_reset_start_part:
|
|||
void ha_partition::position(const uchar *record)
|
||||
{
|
||||
handler *file= m_file[m_last_part];
|
||||
uint pad_length;
|
||||
size_t pad_length;
|
||||
DBUG_ASSERT(bitmap_is_set(&(m_part_info->read_partitions), m_last_part));
|
||||
DBUG_ENTER("ha_partition::position");
|
||||
|
||||
|
@ -5217,7 +5217,7 @@ bool ha_partition::init_record_priority_queue()
|
|||
*/
|
||||
if (!m_ordered_rec_buffer)
|
||||
{
|
||||
uint alloc_len;
|
||||
size_t alloc_len;
|
||||
uint used_parts= bitmap_bits_set(&m_part_info->read_partitions);
|
||||
DBUG_ASSERT(used_parts > 0);
|
||||
/* Allocate record buffer for each used partition. */
|
||||
|
|
|
@ -263,7 +263,7 @@ private:
|
|||
|
||||
underlying_table_rowid is only stored when the table has no extended keys.
|
||||
*/
|
||||
uint m_priority_queue_rec_len;
|
||||
size_t m_priority_queue_rec_len;
|
||||
|
||||
/*
|
||||
If true, then sorting records by key value also sorts them by their
|
||||
|
|
|
@ -2607,7 +2607,7 @@ double handler::keyread_time(uint index, uint ranges, ha_rows rows)
|
|||
engines that support that (e.g. InnoDB) may want to overwrite this method.
|
||||
The model counts in the time to read index entries from cache.
|
||||
*/
|
||||
ulong len= table->key_info[index].key_length + ref_length;
|
||||
size_t len= table->key_info[index].key_length + ref_length;
|
||||
if (index == table->s->primary_key && table->file->primary_key_is_clustered())
|
||||
len= table->s->stored_rec_length;
|
||||
double keys_per_block= (stats.block_size/2.0/len+1);
|
||||
|
@ -3989,7 +3989,7 @@ static bool update_frm_version(TABLE *table)
|
|||
|
||||
int4store(version, MYSQL_VERSION_ID);
|
||||
|
||||
if ((result= mysql_file_pwrite(file, (uchar*) version, 4, 51L, MYF_RW)))
|
||||
if ((result= (int)mysql_file_pwrite(file, (uchar*) version, 4, 51L, MYF_RW)))
|
||||
goto err;
|
||||
|
||||
table->s->mysql_version= MYSQL_VERSION_ID;
|
||||
|
@ -4770,7 +4770,7 @@ void handler::update_global_table_stats()
|
|||
}
|
||||
memcpy(table_stats->table, table->s->table_cache_key.str,
|
||||
table->s->table_cache_key.length);
|
||||
table_stats->table_name_length= table->s->table_cache_key.length;
|
||||
table_stats->table_name_length= (uint)table->s->table_cache_key.length;
|
||||
table_stats->engine_type= ht->db_type;
|
||||
/* No need to set variables to 0, as we use MY_ZEROFILL above */
|
||||
|
||||
|
@ -4813,7 +4813,7 @@ void handler::update_global_index_stats()
|
|||
if (index_rows_read[index])
|
||||
{
|
||||
INDEX_STATS* index_stats;
|
||||
uint key_length;
|
||||
size_t key_length;
|
||||
KEY *key_info = &table->key_info[index]; // Rows were read using this
|
||||
|
||||
DBUG_ASSERT(key_info->cache_name);
|
||||
|
@ -4914,8 +4914,8 @@ int ha_create_table(THD *thd, const char *path,
|
|||
if (!thd->is_error())
|
||||
my_error(ER_CANT_CREATE_TABLE, MYF(0), db, table_name, error);
|
||||
table.file->print_error(error, MYF(ME_JUST_WARNING));
|
||||
PSI_CALL_drop_table_share(temp_table, share.db.str, share.db.length,
|
||||
share.table_name.str, share.table_name.length);
|
||||
PSI_CALL_drop_table_share(temp_table, share.db.str, (uint)share.db.length,
|
||||
share.table_name.str, (uint)share.table_name.length);
|
||||
}
|
||||
|
||||
(void) closefrm(&table);
|
||||
|
@ -5426,7 +5426,7 @@ static my_bool discover_names(THD *thd, plugin_ref plugin,
|
|||
|
||||
if (ht->state == SHOW_OPTION_YES && ht->discover_table_names)
|
||||
{
|
||||
uint old_elements= args->result->tables->elements();
|
||||
size_t old_elements= args->result->tables->elements();
|
||||
if (ht->discover_table_names(ht, args->db, args->dirp, args->result))
|
||||
return 1;
|
||||
|
||||
|
@ -5435,7 +5435,7 @@ static my_bool discover_names(THD *thd, plugin_ref plugin,
|
|||
a corresponding .frm file; but custom engine discover methods might
|
||||
*/
|
||||
if (ht->discover_table_names != hton_ext_based_table_discovery)
|
||||
args->possible_duplicates+= args->result->tables->elements() - old_elements;
|
||||
args->possible_duplicates+= (uint)(args->result->tables->elements() - old_elements);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -6739,7 +6739,7 @@ bool HA_CREATE_INFO::check_conflicting_charset_declarations(CHARSET_INFO *cs)
|
|||
/* Remove all indexes for a given table from global index statistics */
|
||||
|
||||
static
|
||||
int del_global_index_stats_for_table(THD *thd, uchar* cache_key, uint cache_key_length)
|
||||
int del_global_index_stats_for_table(THD *thd, uchar* cache_key, size_t cache_key_length)
|
||||
{
|
||||
int res = 0;
|
||||
DBUG_ENTER("del_global_index_stats_for_table");
|
||||
|
@ -6780,7 +6780,7 @@ int del_global_table_stat(THD *thd, LEX_CSTRING *db, LEX_CSTRING *table)
|
|||
TABLE_STATS *table_stats;
|
||||
int res = 0;
|
||||
uchar *cache_key;
|
||||
uint cache_key_length;
|
||||
size_t cache_key_length;
|
||||
DBUG_ENTER("del_global_table_stat");
|
||||
|
||||
cache_key_length= db->length + 1 + table->length + 1;
|
||||
|
@ -6817,7 +6817,7 @@ end:
|
|||
int del_global_index_stat(THD *thd, TABLE* table, KEY* key_info)
|
||||
{
|
||||
INDEX_STATS *index_stats;
|
||||
uint key_length= table->s->table_cache_key.length + key_info->name.length + 1;
|
||||
size_t key_length= table->s->table_cache_key.length + key_info->name.length + 1;
|
||||
int res = 0;
|
||||
DBUG_ENTER("del_global_index_stat");
|
||||
mysql_mutex_lock(&LOCK_global_index_stats);
|
||||
|
|
|
@ -180,7 +180,7 @@ void hostname_cache_unlock()
|
|||
static void prepare_hostname_cache_key(const char *ip_string,
|
||||
char *ip_key)
|
||||
{
|
||||
int ip_string_length= strlen(ip_string);
|
||||
size_t ip_string_length= strlen(ip_string);
|
||||
DBUG_ASSERT(ip_string_length < HOST_ENTRY_KEY_SIZE);
|
||||
|
||||
memset(ip_key, 0, HOST_ENTRY_KEY_SIZE);
|
||||
|
@ -229,12 +229,12 @@ static void add_hostname_impl(const char *ip_key, const char *hostname,
|
|||
{
|
||||
if (hostname != NULL)
|
||||
{
|
||||
uint len= strlen(hostname);
|
||||
size_t len= strlen(hostname);
|
||||
if (len > sizeof(entry->m_hostname) - 1)
|
||||
len= sizeof(entry->m_hostname) - 1;
|
||||
memcpy(entry->m_hostname, hostname, len);
|
||||
entry->m_hostname[len]= '\0';
|
||||
entry->m_hostname_length= len;
|
||||
entry->m_hostname_length= (uint)len;
|
||||
|
||||
DBUG_PRINT("info",
|
||||
("Adding/Updating '%s' -> '%s' (validated) to the hostname cache...'",
|
||||
|
@ -946,7 +946,7 @@ int ip_to_hostname(struct sockaddr_storage *ip_storage,
|
|||
|
||||
{
|
||||
err_status=
|
||||
vio_get_normalized_ip_string(addr_info->ai_addr, addr_info->ai_addrlen,
|
||||
vio_get_normalized_ip_string(addr_info->ai_addr, (int)addr_info->ai_addrlen,
|
||||
ip_buffer, sizeof (ip_buffer));
|
||||
DBUG_ASSERT(!err_status);
|
||||
}
|
||||
|
@ -990,7 +990,7 @@ int ip_to_hostname(struct sockaddr_storage *ip_storage,
|
|||
char ip_buffer[HOST_ENTRY_KEY_SIZE];
|
||||
|
||||
err_status=
|
||||
vio_get_normalized_ip_string(addr_info->ai_addr, addr_info->ai_addrlen,
|
||||
vio_get_normalized_ip_string(addr_info->ai_addr, (int)addr_info->ai_addrlen,
|
||||
ip_buffer, sizeof (ip_buffer));
|
||||
DBUG_ASSERT(!err_status);
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
|
||||
class THD;
|
||||
|
||||
int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
|
||||
int get_quote_char_for_identifier(THD *thd, const char *name, size_t length);
|
||||
bool schema_table_store_record(THD *thd, TABLE *table);
|
||||
void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
|
||||
uint strconvert(CHARSET_INFO *from_cs, const char *from, uint from_length,
|
||||
CHARSET_INFO *to_cs, char *to, uint to_length,
|
||||
uint strconvert(CHARSET_INFO *from_cs, const char *from, size_t from_length,
|
||||
CHARSET_INFO *to_cs, char *to, size_t to_length,
|
||||
uint *errors);
|
||||
|
||||
void sql_print_error(const char *format, ...);
|
||||
|
|
25
sql/item.cc
25
sql/item.cc
|
@ -1172,7 +1172,7 @@ bool Item::check_type_scalar(const char *opname) const
|
|||
}
|
||||
|
||||
|
||||
void Item::set_name(THD *thd, const char *str, uint length, CHARSET_INFO *cs)
|
||||
void Item::set_name(THD *thd, const char *str, size_t length, CHARSET_INFO *cs)
|
||||
{
|
||||
if (!length)
|
||||
{
|
||||
|
@ -2757,7 +2757,7 @@ const char *
|
|||
Item_sp::func_name(THD *thd) const
|
||||
{
|
||||
/* Calculate length to avoid reallocation of string for sure */
|
||||
uint len= (((m_name->m_explicit_name ? m_name->m_db.length : 0) +
|
||||
size_t len= (((m_name->m_explicit_name ? m_name->m_db.length : 0) +
|
||||
m_name->m_name.length)*2 + //characters*quoting
|
||||
2 + // ` and `
|
||||
(m_name->m_explicit_name ?
|
||||
|
@ -3609,7 +3609,7 @@ longlong Item_field::val_int_endpoint(bool left_endp, bool *incl_endp)
|
|||
This is always 'signed'. Unsigned values are created with Item_uint()
|
||||
*/
|
||||
|
||||
Item_int::Item_int(THD *thd, const char *str_arg, uint length):
|
||||
Item_int::Item_int(THD *thd, const char *str_arg, size_t length):
|
||||
Item_num(thd)
|
||||
{
|
||||
char *end_ptr= (char*) str_arg + length;
|
||||
|
@ -3656,7 +3656,7 @@ Item *Item_bool::neg_transformer(THD *thd)
|
|||
}
|
||||
|
||||
|
||||
Item_uint::Item_uint(THD *thd, const char *str_arg, uint length):
|
||||
Item_uint::Item_uint(THD *thd, const char *str_arg, size_t length):
|
||||
Item_int(thd, str_arg, length)
|
||||
{
|
||||
unsigned_flag= 1;
|
||||
|
@ -3687,7 +3687,7 @@ void Item_uint::print(String *str, enum_query_type query_type)
|
|||
}
|
||||
|
||||
|
||||
Item_decimal::Item_decimal(THD *thd, const char *str_arg, uint length,
|
||||
Item_decimal::Item_decimal(THD *thd, const char *str_arg, size_t length,
|
||||
CHARSET_INFO *charset):
|
||||
Item_num(thd)
|
||||
{
|
||||
|
@ -7102,7 +7102,7 @@ static uint nr_of_decimals(const char *str, const char *end)
|
|||
Item->name should be fixed to use LEX_STRING eventually.
|
||||
*/
|
||||
|
||||
Item_float::Item_float(THD *thd, const char *str_arg, uint length):
|
||||
Item_float::Item_float(THD *thd, const char *str_arg, size_t length):
|
||||
Item_num(thd)
|
||||
{
|
||||
int error;
|
||||
|
@ -7112,13 +7112,13 @@ Item_float::Item_float(THD *thd, const char *str_arg, uint length):
|
|||
if (error)
|
||||
{
|
||||
char tmp[NAME_LEN + 1];
|
||||
my_snprintf(tmp, sizeof(tmp), "%.*s", length, str_arg);
|
||||
my_snprintf(tmp, sizeof(tmp), "%.*s", (int)length, str_arg);
|
||||
my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "double", tmp);
|
||||
}
|
||||
presentation= name.str= str_arg;
|
||||
name.length= strlen(str_arg);
|
||||
decimals=(uint8) nr_of_decimals(str_arg, str_arg+length);
|
||||
max_length=length;
|
||||
max_length=(uint32)length;
|
||||
fixed= 1;
|
||||
}
|
||||
|
||||
|
@ -7155,10 +7155,9 @@ inline uint char_val(char X)
|
|||
}
|
||||
|
||||
|
||||
void Item_hex_constant::hex_string_init(THD *thd, const char *str,
|
||||
uint str_length)
|
||||
void Item_hex_constant::hex_string_init(THD *thd, const char *str, size_t str_length)
|
||||
{
|
||||
max_length=(str_length+1)/2;
|
||||
max_length=(uint)((str_length+1)/2);
|
||||
char *ptr=(char*) thd->alloc(max_length+1);
|
||||
if (!ptr)
|
||||
{
|
||||
|
@ -7220,7 +7219,7 @@ void Item_hex_string::print(String *str, enum_query_type query_type)
|
|||
In number context this is a longlong value.
|
||||
*/
|
||||
|
||||
Item_bin_string::Item_bin_string(THD *thd, const char *str, uint str_length):
|
||||
Item_bin_string::Item_bin_string(THD *thd, const char *str, size_t str_length):
|
||||
Item_hex_hybrid(thd)
|
||||
{
|
||||
const char *end= str + str_length - 1;
|
||||
|
@ -7228,7 +7227,7 @@ Item_bin_string::Item_bin_string(THD *thd, const char *str, uint str_length):
|
|||
uchar bits= 0;
|
||||
uint power= 1;
|
||||
|
||||
max_length= (str_length + 7) >> 3;
|
||||
max_length= (uint)((str_length + 7) >> 3);
|
||||
if (!(ptr= (char*) thd->alloc(max_length + 1)))
|
||||
return;
|
||||
str_value.set(ptr, max_length, &my_charset_bin);
|
||||
|
|
50
sql/item.h
50
sql/item.h
|
@ -740,7 +740,7 @@ public:
|
|||
name.length= 0;
|
||||
#endif
|
||||
} /*lint -e1509 */
|
||||
void set_name(THD *thd, const char *str, uint length, CHARSET_INFO *cs);
|
||||
void set_name(THD *thd, const char *str, size_t length, CHARSET_INFO *cs);
|
||||
void set_name_no_truncate(THD *thd, const char *str, uint length,
|
||||
CHARSET_INFO *cs);
|
||||
void init_make_field(Send_field *tmp_field,enum enum_field_types type);
|
||||
|
@ -3476,31 +3476,31 @@ class Item_int :public Item_num
|
|||
{
|
||||
public:
|
||||
longlong value;
|
||||
Item_int(THD *thd, int32 i,uint length= MY_INT32_NUM_DECIMAL_DIGITS):
|
||||
Item_int(THD *thd, int32 i,size_t length= MY_INT32_NUM_DECIMAL_DIGITS):
|
||||
Item_num(thd), value((longlong) i)
|
||||
{ max_length=length; fixed= 1; }
|
||||
Item_int(THD *thd, longlong i,uint length= MY_INT64_NUM_DECIMAL_DIGITS):
|
||||
{ max_length=(uint32)length; fixed= 1; }
|
||||
Item_int(THD *thd, longlong i,size_t length= MY_INT64_NUM_DECIMAL_DIGITS):
|
||||
Item_num(thd), value(i)
|
||||
{ max_length=length; fixed= 1; }
|
||||
Item_int(THD *thd, ulonglong i, uint length= MY_INT64_NUM_DECIMAL_DIGITS):
|
||||
{ max_length=(uint32)length; fixed= 1; }
|
||||
Item_int(THD *thd, ulonglong i, size_t length= MY_INT64_NUM_DECIMAL_DIGITS):
|
||||
Item_num(thd), value((longlong)i)
|
||||
{ max_length=length; fixed= 1; unsigned_flag= 1; }
|
||||
Item_int(THD *thd, const char *str_arg,longlong i,uint length):
|
||||
{ max_length=(uint32)length; fixed= 1; unsigned_flag= 1; }
|
||||
Item_int(THD *thd, const char *str_arg,longlong i,size_t length):
|
||||
Item_num(thd), value(i)
|
||||
{
|
||||
max_length=length;
|
||||
max_length=(uint32)length;
|
||||
name.str= str_arg; name.length= safe_strlen(name.str);
|
||||
fixed= 1;
|
||||
}
|
||||
Item_int(THD *thd, const char *str_arg,longlong i,uint length, bool flag):
|
||||
Item_int(THD *thd, const char *str_arg,longlong i,size_t length, bool flag):
|
||||
Item_num(thd), value(i)
|
||||
{
|
||||
max_length=length;
|
||||
max_length=(uint32)length;
|
||||
name.str= str_arg; name.length= safe_strlen(name.str);
|
||||
fixed= 1;
|
||||
unsigned_flag= flag;
|
||||
}
|
||||
Item_int(THD *thd, const char *str_arg, uint length=64);
|
||||
Item_int(THD *thd, const char *str_arg, size_t length=64);
|
||||
enum Type type() const { return INT_ITEM; }
|
||||
const Type_handler *type_handler() const
|
||||
{ return type_handler_long_or_longlong(); }
|
||||
|
@ -3545,7 +3545,7 @@ public:
|
|||
class Item_uint :public Item_int
|
||||
{
|
||||
public:
|
||||
Item_uint(THD *thd, const char *str_arg, uint length);
|
||||
Item_uint(THD *thd, const char *str_arg, size_t length);
|
||||
Item_uint(THD *thd, ulonglong i): Item_int(thd, i, 10) {}
|
||||
Item_uint(THD *thd, const char *str_arg, longlong i, uint length);
|
||||
double val_real()
|
||||
|
@ -3579,7 +3579,7 @@ class Item_decimal :public Item_num
|
|||
protected:
|
||||
my_decimal decimal_value;
|
||||
public:
|
||||
Item_decimal(THD *thd, const char *str_arg, uint length,
|
||||
Item_decimal(THD *thd, const char *str_arg, size_t length,
|
||||
CHARSET_INFO *charset);
|
||||
Item_decimal(THD *thd, const char *str, const my_decimal *val_arg,
|
||||
uint decimal_par, uint length);
|
||||
|
@ -3612,7 +3612,7 @@ class Item_float :public Item_num
|
|||
const char *presentation;
|
||||
public:
|
||||
double value;
|
||||
Item_float(THD *thd, const char *str_arg, uint length);
|
||||
Item_float(THD *thd, const char *str_arg, size_t length);
|
||||
Item_float(THD *thd, const char *str, double val_arg, uint decimal_par,
|
||||
uint length): Item_num(thd), value(val_arg)
|
||||
{
|
||||
|
@ -3723,7 +3723,7 @@ public:
|
|||
str_value.set_or_copy_aligned(str, length, cs);
|
||||
fix_and_set_name_from_value(thd, dv, Metadata(&str_value, repertoire));
|
||||
}
|
||||
Item_string(THD *thd, const char *str, uint length,
|
||||
Item_string(THD *thd, const char *str, size_t length,
|
||||
CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE):
|
||||
Item_basic_constant(thd)
|
||||
{
|
||||
|
@ -3739,21 +3739,21 @@ public:
|
|||
fix_and_set_name_from_value(thd, dv, Metadata(&str_value, repertoire));
|
||||
}
|
||||
// Constructors with an externally provided item name
|
||||
Item_string(THD *thd, const char *name_par, const char *str, uint length,
|
||||
Item_string(THD *thd, const char *name_par, const char *str, size_t length,
|
||||
CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE):
|
||||
Item_basic_constant(thd)
|
||||
{
|
||||
str_value.set_or_copy_aligned(str, length, cs);
|
||||
fix_from_value(dv, Metadata(&str_value));
|
||||
set_name(thd, name_par, (uint) safe_strlen(name_par), system_charset_info);
|
||||
set_name(thd, name_par,safe_strlen(name_par), system_charset_info);
|
||||
}
|
||||
Item_string(THD *thd, const char *name_par, const char *str, uint length,
|
||||
Item_string(THD *thd, const char *name_par, const char *str, size_t length,
|
||||
CHARSET_INFO *cs, Derivation dv, uint repertoire):
|
||||
Item_basic_constant(thd)
|
||||
{
|
||||
str_value.set_or_copy_aligned(str, length, cs);
|
||||
fix_from_value(dv, Metadata(&str_value, repertoire));
|
||||
set_name(thd, name_par, (uint) safe_strlen(name_par), system_charset_info);
|
||||
set_name(thd, name_par, safe_strlen(name_par), system_charset_info);
|
||||
}
|
||||
void print_value(String *to) const
|
||||
{
|
||||
|
@ -4029,13 +4029,13 @@ public:
|
|||
class Item_hex_constant: public Item_basic_constant
|
||||
{
|
||||
private:
|
||||
void hex_string_init(THD *thd, const char *str, uint str_length);
|
||||
void hex_string_init(THD *thd, const char *str, size_t str_length);
|
||||
public:
|
||||
Item_hex_constant(THD *thd): Item_basic_constant(thd)
|
||||
{
|
||||
hex_string_init(thd, "", 0);
|
||||
}
|
||||
Item_hex_constant(THD *thd, const char *str, uint str_length):
|
||||
Item_hex_constant(THD *thd, const char *str, size_t str_length):
|
||||
Item_basic_constant(thd)
|
||||
{
|
||||
hex_string_init(thd, str, str_length);
|
||||
|
@ -4067,7 +4067,7 @@ class Item_hex_hybrid: public Item_hex_constant
|
|||
{
|
||||
public:
|
||||
Item_hex_hybrid(THD *thd): Item_hex_constant(thd) {}
|
||||
Item_hex_hybrid(THD *thd, const char *str, uint str_length):
|
||||
Item_hex_hybrid(THD *thd, const char *str, size_t str_length):
|
||||
Item_hex_constant(thd, str, str_length) {}
|
||||
uint decimal_precision() const;
|
||||
double val_real()
|
||||
|
@ -4117,7 +4117,7 @@ class Item_hex_string: public Item_hex_constant
|
|||
{
|
||||
public:
|
||||
Item_hex_string(THD *thd): Item_hex_constant(thd) {}
|
||||
Item_hex_string(THD *thd, const char *str, uint str_length):
|
||||
Item_hex_string(THD *thd, const char *str, size_t str_length):
|
||||
Item_hex_constant(thd, str, str_length) {}
|
||||
longlong val_int()
|
||||
{
|
||||
|
@ -4148,7 +4148,7 @@ public:
|
|||
class Item_bin_string: public Item_hex_hybrid
|
||||
{
|
||||
public:
|
||||
Item_bin_string(THD *thd, const char *str,uint str_length);
|
||||
Item_bin_string(THD *thd, const char *str, size_t str_length);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -5603,9 +5603,9 @@ int Regexp_processor_pcre::pcre_exec_with_warn(const pcre *code,
|
|||
}
|
||||
|
||||
|
||||
bool Regexp_processor_pcre::exec(const char *str, int length, int offset)
|
||||
bool Regexp_processor_pcre::exec(const char *str, size_t length, size_t offset)
|
||||
{
|
||||
m_pcre_exec_rc= pcre_exec_with_warn(m_pcre, &m_pcre_extra, str, length, offset, 0,
|
||||
m_pcre_exec_rc= pcre_exec_with_warn(m_pcre, &m_pcre_extra, str, (int)length, (int)offset, 0,
|
||||
m_SubStrVec, array_elements(m_SubStrVec));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2766,7 +2766,7 @@ public:
|
|||
{
|
||||
return !m_is_const && compile(item, false);
|
||||
}
|
||||
bool exec(const char *str, int length, int offset);
|
||||
bool exec(const char *str, size_t length, size_t offset);
|
||||
bool exec(String *str, int offset, uint n_result_offsets_to_convert);
|
||||
bool exec(Item *item, int offset, uint n_result_offsets_to_convert);
|
||||
bool match() const { return m_pcre_exec_rc < 0 ? 0 : 1; }
|
||||
|
|
|
@ -3284,7 +3284,7 @@ Create_udf_func Create_udf_func::s_singleton;
|
|||
Item*
|
||||
Create_udf_func::create_func(THD *thd, LEX_CSTRING *name, List<Item> *item_list)
|
||||
{
|
||||
udf_func *udf= find_udf(name->str, (uint) name->length);
|
||||
udf_func *udf= find_udf(name->str, name->length);
|
||||
DBUG_ASSERT(udf);
|
||||
return create(thd, udf, item_list);
|
||||
}
|
||||
|
@ -7276,7 +7276,7 @@ have_important_literal_warnings(const MYSQL_TIME_STATUS *status)
|
|||
*/
|
||||
|
||||
Item *create_temporal_literal(THD *thd,
|
||||
const char *str, uint length,
|
||||
const char *str, size_t length,
|
||||
CHARSET_INFO *cs,
|
||||
enum_field_types type,
|
||||
bool send_error)
|
||||
|
|
|
@ -192,7 +192,7 @@ protected:
|
|||
|
||||
|
||||
Item *create_temporal_literal(THD *thd,
|
||||
const char *str, uint length,
|
||||
const char *str, size_t length,
|
||||
CHARSET_INFO *cs,
|
||||
enum_field_types type,
|
||||
bool send_error);
|
||||
|
|
|
@ -3204,7 +3204,7 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func,
|
|||
if (check_stack_overrun(thd, STACK_MIN_SIZE, buff))
|
||||
DBUG_RETURN(TRUE); // Fatal error flag is set!
|
||||
|
||||
udf_func *tmp_udf=find_udf(u_d->name.str,(uint) u_d->name.length,1);
|
||||
udf_func *tmp_udf=find_udf(u_d->name.str,u_d->name.length,1);
|
||||
|
||||
if (!tmp_udf)
|
||||
{
|
||||
|
@ -3299,7 +3299,7 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func,
|
|||
f_args.lengths[i]= arguments[i]->max_length;
|
||||
f_args.maybe_null[i]= (char) arguments[i]->maybe_null;
|
||||
f_args.attributes[i]= arguments[i]->name.str;
|
||||
f_args.attribute_lengths[i]= arguments[i]->name.length;
|
||||
f_args.attribute_lengths[i]= (ulong)arguments[i]->name.length;
|
||||
|
||||
if (arguments[i]->const_item())
|
||||
{
|
||||
|
@ -4386,7 +4386,7 @@ user_var_entry *get_variable(HASH *hash, LEX_CSTRING *name,
|
|||
name->length)) &&
|
||||
create_if_not_exists)
|
||||
{
|
||||
uint size=ALIGN_SIZE(sizeof(user_var_entry))+name->length+1+extra_size;
|
||||
size_t size=ALIGN_SIZE(sizeof(user_var_entry))+name->length+1+extra_size;
|
||||
if (!my_hash_inited(hash))
|
||||
return 0;
|
||||
if (!(entry = (user_var_entry*) my_malloc(size,
|
||||
|
@ -4607,7 +4607,7 @@ bool Item_func_set_user_var::register_field_in_bitmap(void *arg)
|
|||
*/
|
||||
|
||||
static bool
|
||||
update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length,
|
||||
update_hash(user_var_entry *entry, bool set_null, void *ptr, size_t length,
|
||||
Item_result type, CHARSET_INFO *cs,
|
||||
bool unsigned_arg)
|
||||
{
|
||||
|
@ -4668,7 +4668,7 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length,
|
|||
|
||||
|
||||
bool
|
||||
Item_func_set_user_var::update_hash(void *ptr, uint length,
|
||||
Item_func_set_user_var::update_hash(void *ptr, size_t length,
|
||||
Item_result res_type,
|
||||
CHARSET_INFO *cs,
|
||||
bool unsigned_arg)
|
||||
|
@ -5332,7 +5332,7 @@ get_var_with_binlog(THD *thd, enum_sql_command sql_command,
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint size;
|
||||
size_t size;
|
||||
/*
|
||||
First we need to store value of var_entry, when the next situation
|
||||
appears:
|
||||
|
@ -5399,7 +5399,7 @@ void Item_func_get_user_var::fix_length_and_dec()
|
|||
if (!error && m_var_entry)
|
||||
{
|
||||
unsigned_flag= m_var_entry->unsigned_flag;
|
||||
max_length= m_var_entry->length;
|
||||
max_length= (uint32)m_var_entry->length;
|
||||
collation.set(m_var_entry->charset(), DERIVATION_IMPLICIT);
|
||||
set_handler_by_result_type(m_var_entry->type);
|
||||
switch (result_type()) {
|
||||
|
@ -5613,7 +5613,7 @@ void Item_func_get_system_var::fix_length_and_dec()
|
|||
(char*) var->value_ptr(current_thd, var_type, &component) :
|
||||
*(char**) var->value_ptr(current_thd, var_type, &component);
|
||||
if (cptr)
|
||||
max_length= system_charset_info->cset->numchars(system_charset_info,
|
||||
max_length= (uint32)system_charset_info->cset->numchars(system_charset_info,
|
||||
cptr,
|
||||
cptr + strlen(cptr));
|
||||
mysql_mutex_unlock(&LOCK_global_system_variables);
|
||||
|
@ -5625,7 +5625,7 @@ void Item_func_get_system_var::fix_length_and_dec()
|
|||
{
|
||||
mysql_mutex_lock(&LOCK_global_system_variables);
|
||||
LEX_STRING *ls= ((LEX_STRING*)var->value_ptr(current_thd, var_type, &component));
|
||||
max_length= system_charset_info->cset->numchars(system_charset_info,
|
||||
max_length= (uint32)system_charset_info->cset->numchars(system_charset_info,
|
||||
ls->str,
|
||||
ls->str + ls->length);
|
||||
mysql_mutex_unlock(&LOCK_global_system_variables);
|
||||
|
|
|
@ -2407,7 +2407,7 @@ public:
|
|||
String *str_result(String *str);
|
||||
my_decimal *val_decimal_result(my_decimal *);
|
||||
bool is_null_result();
|
||||
bool update_hash(void *ptr, uint length, enum Item_result type,
|
||||
bool update_hash(void *ptr, size_t length, enum Item_result type,
|
||||
CHARSET_INFO *cs, bool unsigned_arg);
|
||||
bool send(Protocol *protocol, st_value *buffer);
|
||||
void make_field(THD *thd, Send_field *tmp_field);
|
||||
|
@ -2493,7 +2493,7 @@ public:
|
|||
{
|
||||
DBUG_ASSERT(a->length < UINT_MAX32);
|
||||
org_name= *a;
|
||||
set_name(thd, a->str, (uint) a->length, system_charset_info);
|
||||
set_name(thd, a->str, a->length, system_charset_info);
|
||||
}
|
||||
/* We should return something different from FIELD_ITEM here */
|
||||
enum Type type() const { return STRING_ITEM;}
|
||||
|
|
|
@ -527,14 +527,14 @@ String *Item_func_decode_histogram::val_str(String *str)
|
|||
DBUG_ASSERT(0);
|
||||
}
|
||||
/* show delta with previous value */
|
||||
int size= my_snprintf(numbuf, sizeof(numbuf),
|
||||
size_t size= my_snprintf(numbuf, sizeof(numbuf),
|
||||
representation_by_type[type], val - prev);
|
||||
str->append(numbuf, size);
|
||||
str->append(",");
|
||||
prev= val;
|
||||
}
|
||||
/* show delta with max */
|
||||
int size= my_snprintf(numbuf, sizeof(numbuf),
|
||||
size_t size= my_snprintf(numbuf, sizeof(numbuf),
|
||||
representation_by_type[type], 1.0 - prev);
|
||||
str->append(numbuf, size);
|
||||
|
||||
|
@ -1651,7 +1651,7 @@ String *Item_str_conv::val_str(String *str)
|
|||
null_value=0;
|
||||
if (multiply == 1)
|
||||
{
|
||||
uint len;
|
||||
size_t len;
|
||||
res= copy_if_not_alloced(&tmp_value, res, res->length());
|
||||
len= converter(collation.collation, (char*) res->ptr(), res->length(),
|
||||
(char*) res->ptr(), res->length());
|
||||
|
@ -1660,7 +1660,7 @@ String *Item_str_conv::val_str(String *str)
|
|||
}
|
||||
else
|
||||
{
|
||||
uint len= res->length() * multiply;
|
||||
size_t len= res->length() * multiply;
|
||||
tmp_value.alloc(len);
|
||||
tmp_value.set_charset(collation.collation);
|
||||
len= converter(collation.collation, (char*) res->ptr(), res->length(),
|
||||
|
@ -3618,10 +3618,10 @@ void Item_func_weight_string::fix_length_and_dec()
|
|||
*/
|
||||
if (!(max_length= result_length))
|
||||
{
|
||||
uint char_length;
|
||||
size_t char_length;
|
||||
char_length= ((cs->state & MY_CS_STRNXFRM_BAD_NWEIGHTS) || !nweights) ?
|
||||
args[0]->max_char_length() : nweights * cs->levels_for_order;
|
||||
max_length= cs->coll->strnxfrmlen(cs, char_length * cs->mbmaxlen);
|
||||
max_length= (uint32)cs->coll->strnxfrmlen(cs, char_length * cs->mbmaxlen);
|
||||
}
|
||||
maybe_null= 1;
|
||||
}
|
||||
|
@ -3632,7 +3632,7 @@ String *Item_func_weight_string::val_str(String *str)
|
|||
{
|
||||
String *res;
|
||||
CHARSET_INFO *cs= args[0]->collation.collation;
|
||||
uint tmp_length, frm_length;
|
||||
size_t tmp_length, frm_length;
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
|
||||
if (args[0]->result_type() != STRING_RESULT ||
|
||||
|
@ -3646,7 +3646,7 @@ String *Item_func_weight_string::val_str(String *str)
|
|||
*/
|
||||
if (!(tmp_length= result_length))
|
||||
{
|
||||
uint char_length;
|
||||
size_t char_length;
|
||||
if (cs->state & MY_CS_STRNXFRM_BAD_NWEIGHTS)
|
||||
{
|
||||
/*
|
||||
|
@ -3692,7 +3692,7 @@ String *Item_func_weight_string::val_str(String *str)
|
|||
|
||||
frm_length= cs->coll->strnxfrm(cs,
|
||||
(uchar *) str->ptr(), tmp_length,
|
||||
nweights ? nweights : tmp_length,
|
||||
nweights ? nweights : (uint)tmp_length,
|
||||
(const uchar *) res->ptr(), res->length(),
|
||||
flags);
|
||||
DBUG_ASSERT(frm_length <= tmp_length);
|
||||
|
|
|
@ -3098,7 +3098,7 @@ bool Item_exists_subselect::exists2in_processor(void *opt_arg)
|
|||
new (thd->mem_root)
|
||||
Item_direct_ref(thd,
|
||||
&unit->outer_select()->context,
|
||||
optimizer->arguments()[0]->addr(i),
|
||||
optimizer->arguments()[0]->addr((int)i),
|
||||
(char *)"<no matter>",
|
||||
&exists_outer_expr_name)),
|
||||
thd->mem_root);
|
||||
|
|
|
@ -3597,7 +3597,7 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
|
|||
as this is never used to limit the length of the data.
|
||||
Cut is done with the third argument.
|
||||
*/
|
||||
uint add_length= Well_formed_prefix(cs,
|
||||
size_t add_length= Well_formed_prefix(cs,
|
||||
ptr + old_length,
|
||||
ptr + max_length,
|
||||
result->length()).length();
|
||||
|
|
|
@ -709,8 +709,7 @@ static bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time,
|
|||
For example, '1.1' -> '1.100000'
|
||||
*/
|
||||
|
||||
static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
|
||||
uint count, ulonglong *values,
|
||||
static bool get_interval_info(const char *str, size_t length,CHARSET_INFO *cs, size_t count, ulonglong *values,
|
||||
bool transform_msec)
|
||||
{
|
||||
const char *end=str+length;
|
||||
|
@ -2427,7 +2426,7 @@ void Item_char_typecast::print(String *str, enum_query_type query_type)
|
|||
}
|
||||
|
||||
|
||||
void Item_char_typecast::check_truncation_with_warn(String *src, uint dstlen)
|
||||
void Item_char_typecast::check_truncation_with_warn(String *src, size_t dstlen)
|
||||
{
|
||||
if (dstlen < src->length())
|
||||
{
|
||||
|
@ -2448,7 +2447,7 @@ void Item_char_typecast::check_truncation_with_warn(String *src, uint dstlen)
|
|||
}
|
||||
|
||||
|
||||
String *Item_char_typecast::reuse(String *src, uint32 length)
|
||||
String *Item_char_typecast::reuse(String *src, size_t length)
|
||||
{
|
||||
DBUG_ASSERT(length <= src->length());
|
||||
check_truncation_with_warn(src, length);
|
||||
|
|
|
@ -1091,10 +1091,10 @@ class Item_char_typecast :public Item_str_func
|
|||
String tmp_value;
|
||||
bool m_suppress_warning_to_error_escalation;
|
||||
bool has_explicit_length() const { return cast_length != ~0U; }
|
||||
String *reuse(String *src, uint32 length);
|
||||
String *reuse(String *src, size_t length);
|
||||
String *copy(String *src, CHARSET_INFO *cs);
|
||||
uint adjusted_length_with_warn(uint length);
|
||||
void check_truncation_with_warn(String *src, uint dstlen);
|
||||
void check_truncation_with_warn(String *src, size_t dstlen);
|
||||
void fix_length_and_dec_internal(CHARSET_INFO *fromcs);
|
||||
public:
|
||||
Item_char_typecast(THD *thd, Item *a, uint length_arg, CHARSET_INFO *cs_arg):
|
||||
|
|
16
sql/key.cc
16
sql/key.cc
|
@ -317,7 +317,7 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length)
|
|||
FIELDFLAG_PACK)))
|
||||
{
|
||||
CHARSET_INFO *cs= key_part->field->charset();
|
||||
uint char_length= key_part->length / cs->mbmaxlen;
|
||||
size_t char_length= key_part->length / cs->mbmaxlen;
|
||||
const uchar *pos= table->record[0] + key_part->offset;
|
||||
if (length > char_length)
|
||||
{
|
||||
|
@ -383,7 +383,7 @@ void field_unpack(String *to, Field *field, const uchar *rec, uint max_length,
|
|||
which can break a multi-byte characters in the middle.
|
||||
Align, returning not more than "char_length" characters.
|
||||
*/
|
||||
uint charpos, char_length= max_length / cs->mbmaxlen;
|
||||
size_t charpos, char_length= max_length / cs->mbmaxlen;
|
||||
if ((charpos= my_charpos(cs, tmp.ptr(),
|
||||
tmp.ptr() + tmp.length(),
|
||||
char_length)) < tmp.length())
|
||||
|
@ -695,7 +695,7 @@ ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key)
|
|||
{
|
||||
uchar *pos= (uchar*)key;
|
||||
CHARSET_INFO *UNINIT_VAR(cs);
|
||||
uint UNINIT_VAR(length), UNINIT_VAR(pack_length);
|
||||
size_t UNINIT_VAR(length), UNINIT_VAR(pack_length);
|
||||
bool is_string= TRUE;
|
||||
|
||||
key+= key_part->length;
|
||||
|
@ -752,7 +752,7 @@ ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key)
|
|||
{
|
||||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
uint char_length= my_charpos(cs, pos + pack_length,
|
||||
size_t char_length= my_charpos(cs, pos + pack_length,
|
||||
pos + pack_length + length,
|
||||
length / cs->mbmaxlen);
|
||||
set_if_smaller(length, char_length);
|
||||
|
@ -799,7 +799,7 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts,
|
|||
uchar *pos1= (uchar*)key1;
|
||||
uchar *pos2= (uchar*)key2;
|
||||
CHARSET_INFO *UNINIT_VAR(cs);
|
||||
uint UNINIT_VAR(length1), UNINIT_VAR(length2), UNINIT_VAR(pack_length);
|
||||
size_t UNINIT_VAR(length1), UNINIT_VAR(length2), UNINIT_VAR(pack_length);
|
||||
bool is_string= TRUE;
|
||||
|
||||
key1+= key_part->length;
|
||||
|
@ -863,13 +863,13 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts,
|
|||
Compare the strings taking into account length in characters
|
||||
and collation
|
||||
*/
|
||||
uint byte_len1= length1, byte_len2= length2;
|
||||
size_t byte_len1= length1, byte_len2= length2;
|
||||
if (cs->mbmaxlen > 1)
|
||||
{
|
||||
uint char_length1= my_charpos(cs, pos1 + pack_length,
|
||||
size_t char_length1= my_charpos(cs, pos1 + pack_length,
|
||||
pos1 + pack_length + length1,
|
||||
length1 / cs->mbmaxlen);
|
||||
uint char_length2= my_charpos(cs, pos2 + pack_length,
|
||||
size_t char_length2= my_charpos(cs, pos2 + pack_length,
|
||||
pos2 + pack_length + length2,
|
||||
length2 / cs->mbmaxlen);
|
||||
set_if_smaller(length1, char_length1);
|
||||
|
|
|
@ -30,17 +30,17 @@ class NAMED_ILINK :public ilink
|
|||
{
|
||||
public:
|
||||
const char *name;
|
||||
uint name_length;
|
||||
size_t name_length;
|
||||
uchar* data;
|
||||
|
||||
NAMED_ILINK(I_List<NAMED_ILINK> *links, const char *name_arg,
|
||||
uint name_length_arg, uchar* data_arg)
|
||||
size_t name_length_arg, uchar* data_arg)
|
||||
:name_length(name_length_arg), data(data_arg)
|
||||
{
|
||||
name= my_strndup(name_arg, name_length, MYF(MY_WME));
|
||||
links->push_back(this);
|
||||
}
|
||||
inline bool cmp(const char *name_cmp, uint length)
|
||||
inline bool cmp(const char *name_cmp, size_t length)
|
||||
{
|
||||
return length == name_length && !memcmp(name, name_cmp, length);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
uchar* find_named(I_List<NAMED_ILINK> *list, const char *name, uint length,
|
||||
uchar* find_named(I_List<NAMED_ILINK> *list, const char *name, size_t length,
|
||||
NAMED_ILINK **found)
|
||||
{
|
||||
I_List_iterator<NAMED_ILINK> it(*list);
|
||||
|
@ -68,7 +68,7 @@ uchar* find_named(I_List<NAMED_ILINK> *list, const char *name, uint length,
|
|||
}
|
||||
|
||||
|
||||
bool NAMED_ILIST::delete_element(const char *name, uint length, void (*free_element)(const char *name, uchar*))
|
||||
bool NAMED_ILIST::delete_element(const char *name, size_t length, void (*free_element)(const char *name, uchar*))
|
||||
{
|
||||
I_List_iterator<NAMED_ILINK> it(*this);
|
||||
NAMED_ILINK *element;
|
||||
|
@ -112,11 +112,11 @@ KEY_CACHE *get_key_cache(const LEX_CSTRING *cache_name)
|
|||
cache_name->str, cache_name->length, 0));
|
||||
}
|
||||
|
||||
KEY_CACHE *create_key_cache(const char *name, uint length)
|
||||
KEY_CACHE *create_key_cache(const char *name, size_t length)
|
||||
{
|
||||
KEY_CACHE *key_cache;
|
||||
DBUG_ENTER("create_key_cache");
|
||||
DBUG_PRINT("enter",("name: %.*s", length, name));
|
||||
DBUG_PRINT("enter",("name: %.*s", (int)length, name));
|
||||
|
||||
if ((key_cache= (KEY_CACHE*) my_malloc(sizeof(KEY_CACHE),
|
||||
MYF(MY_ZEROFILL | MY_WME))))
|
||||
|
@ -144,7 +144,7 @@ KEY_CACHE *create_key_cache(const char *name, uint length)
|
|||
}
|
||||
|
||||
|
||||
KEY_CACHE *get_or_create_key_cache(const char *name, uint length)
|
||||
KEY_CACHE *get_or_create_key_cache(const char *name, size_t length)
|
||||
{
|
||||
LEX_CSTRING key_cache_name;
|
||||
KEY_CACHE *key_cache;
|
||||
|
@ -190,11 +190,11 @@ Rpl_filter *get_rpl_filter(LEX_CSTRING *filter_name)
|
|||
filter_name->str, filter_name->length, 0));
|
||||
}
|
||||
|
||||
Rpl_filter *create_rpl_filter(const char *name, uint length)
|
||||
Rpl_filter *create_rpl_filter(const char *name, size_t length)
|
||||
{
|
||||
Rpl_filter *filter;
|
||||
DBUG_ENTER("create_rpl_filter");
|
||||
DBUG_PRINT("enter",("name: %.*s", length, name));
|
||||
DBUG_PRINT("enter",("name: %.*s", (int)length, name));
|
||||
|
||||
filter= new Rpl_filter;
|
||||
if (filter)
|
||||
|
@ -209,7 +209,7 @@ Rpl_filter *create_rpl_filter(const char *name, uint length)
|
|||
}
|
||||
|
||||
|
||||
Rpl_filter *get_or_create_rpl_filter(const char *name, uint length)
|
||||
Rpl_filter *get_or_create_rpl_filter(const char *name, size_t length)
|
||||
{
|
||||
LEX_CSTRING rpl_filter_name;
|
||||
Rpl_filter *filter;
|
||||
|
|
|
@ -31,7 +31,7 @@ class NAMED_ILIST: public I_List<NAMED_ILINK>
|
|||
{
|
||||
public:
|
||||
void delete_elements(void (*free_element)(const char*, uchar*));
|
||||
bool delete_element(const char *name, uint length, void (*free_element)(const char*, uchar*));
|
||||
bool delete_element(const char *name, size_t length, void (*free_element)(const char*, uchar*));
|
||||
};
|
||||
|
||||
/* For key cache */
|
||||
|
@ -39,9 +39,9 @@ extern LEX_CSTRING default_key_cache_base;
|
|||
extern KEY_CACHE zero_key_cache;
|
||||
extern NAMED_ILIST key_caches;
|
||||
|
||||
KEY_CACHE *create_key_cache(const char *name, uint length);
|
||||
KEY_CACHE *create_key_cache(const char *name, size_t length);
|
||||
KEY_CACHE *get_key_cache(const LEX_CSTRING *cache_name);
|
||||
KEY_CACHE *get_or_create_key_cache(const char *name, uint length);
|
||||
KEY_CACHE *get_or_create_key_cache(const char *name, size_t length);
|
||||
void free_key_cache(const char *name, KEY_CACHE *key_cache);
|
||||
bool process_key_caches(process_key_cache_t func, void *param);
|
||||
|
||||
|
@ -49,9 +49,9 @@ bool process_key_caches(process_key_cache_t func, void *param);
|
|||
extern LEX_CSTRING default_rpl_filter_base;
|
||||
extern NAMED_ILIST rpl_filters;
|
||||
|
||||
Rpl_filter *create_rpl_filter(const char *name, uint length);
|
||||
Rpl_filter *create_rpl_filter(const char *name, size_t length);
|
||||
Rpl_filter *get_rpl_filter(LEX_CSTRING *filter_name);
|
||||
Rpl_filter *get_or_create_rpl_filter(const char *name, uint length);
|
||||
Rpl_filter *get_or_create_rpl_filter(const char *name, size_t length);
|
||||
void free_rpl_filter(const char *name, Rpl_filter *filter);
|
||||
void free_all_rpl_filters(void);
|
||||
|
||||
|
|
90
sql/log.cc
90
sql/log.cc
|
@ -688,10 +688,9 @@ void Log_to_csv_event_handler::cleanup()
|
|||
*/
|
||||
|
||||
bool Log_to_csv_event_handler::
|
||||
log_general(THD *thd, my_hrtime_t event_time, const char *user_host,
|
||||
uint user_host_len, my_thread_id thread_id_arg,
|
||||
const char *command_type, uint command_type_len,
|
||||
const char *sql_text, uint sql_text_len,
|
||||
log_general(THD *thd, my_hrtime_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id_arg,
|
||||
const char *command_type, size_t command_type_len,
|
||||
const char *sql_text, size_t sql_text_len,
|
||||
CHARSET_INFO *client_cs)
|
||||
{
|
||||
TABLE_LIST table_list;
|
||||
|
@ -852,9 +851,9 @@ err:
|
|||
|
||||
bool Log_to_csv_event_handler::
|
||||
log_slow(THD *thd, my_hrtime_t current_time,
|
||||
const char *user_host, uint user_host_len,
|
||||
const char *user_host, size_t user_host_len,
|
||||
ulonglong query_utime, ulonglong lock_utime, bool is_command,
|
||||
const char *sql_text, uint sql_text_len)
|
||||
const char *sql_text, size_t sql_text_len)
|
||||
{
|
||||
TABLE_LIST table_list;
|
||||
TABLE *table;
|
||||
|
@ -1071,9 +1070,9 @@ void Log_to_file_event_handler::init_pthread_objects()
|
|||
|
||||
bool Log_to_file_event_handler::
|
||||
log_slow(THD *thd, my_hrtime_t current_time,
|
||||
const char *user_host, uint user_host_len,
|
||||
const char *user_host, size_t user_host_len,
|
||||
ulonglong query_utime, ulonglong lock_utime, bool is_command,
|
||||
const char *sql_text, uint sql_text_len)
|
||||
const char *sql_text, size_t sql_text_len)
|
||||
{
|
||||
Silence_log_table_errors error_handler;
|
||||
thd->push_internal_handler(&error_handler);
|
||||
|
@ -1092,10 +1091,9 @@ bool Log_to_file_event_handler::
|
|||
*/
|
||||
|
||||
bool Log_to_file_event_handler::
|
||||
log_general(THD *thd, my_hrtime_t event_time, const char *user_host,
|
||||
uint user_host_len, my_thread_id thread_id_arg,
|
||||
const char *command_type, uint command_type_len,
|
||||
const char *sql_text, uint sql_text_len,
|
||||
log_general(THD *thd, my_hrtime_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id_arg,
|
||||
const char *command_type, size_t command_type_len,
|
||||
const char *sql_text, size_t sql_text_len,
|
||||
CHARSET_INFO *client_cs)
|
||||
{
|
||||
Silence_log_table_errors error_handler;
|
||||
|
@ -1298,7 +1296,7 @@ bool LOGGER::flush_general_log()
|
|||
TRUE error occurred
|
||||
*/
|
||||
|
||||
bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length,
|
||||
bool LOGGER::slow_log_print(THD *thd, const char *query, size_t query_length,
|
||||
ulonglong current_utime)
|
||||
|
||||
{
|
||||
|
@ -1347,7 +1345,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length,
|
|||
{
|
||||
is_command= TRUE;
|
||||
query= command_name[thd->get_command()].str;
|
||||
query_length= command_name[thd->get_command()].length;
|
||||
query_length= (uint)command_name[thd->get_command()].length;
|
||||
}
|
||||
|
||||
for (current_handler= slow_log_handler_list; *current_handler ;)
|
||||
|
@ -1362,7 +1360,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length,
|
|||
}
|
||||
|
||||
bool LOGGER::general_log_write(THD *thd, enum enum_server_command command,
|
||||
const char *query, uint query_length)
|
||||
const char *query, size_t query_length)
|
||||
{
|
||||
bool error= FALSE;
|
||||
Log_event_handler **current_handler= general_log_handler_list;
|
||||
|
@ -1379,8 +1377,8 @@ bool LOGGER::general_log_write(THD *thd, enum enum_server_command command,
|
|||
mysql_audit_general_log(thd, hrtime_to_time(current_time),
|
||||
user_host_buff, user_host_len,
|
||||
command_name[(uint) command].str,
|
||||
command_name[(uint) command].length,
|
||||
query, query_length);
|
||||
(uint)command_name[(uint) command].length,
|
||||
query, (uint)query_length);
|
||||
|
||||
if (opt_log && log_command(thd, command))
|
||||
{
|
||||
|
@ -1402,7 +1400,7 @@ bool LOGGER::general_log_write(THD *thd, enum enum_server_command command,
|
|||
bool LOGGER::general_log_print(THD *thd, enum enum_server_command command,
|
||||
const char *format, va_list args)
|
||||
{
|
||||
uint message_buff_len= 0;
|
||||
size_t message_buff_len= 0;
|
||||
char message_buff[MAX_LOG_BUFFER_SIZE];
|
||||
|
||||
/* prepare message */
|
||||
|
@ -2664,7 +2662,7 @@ bool MYSQL_LOG::open(
|
|||
if (log_type == LOG_NORMAL)
|
||||
{
|
||||
char *end;
|
||||
int len=my_snprintf(buff, sizeof(buff), "%s, Version: %s (%s). "
|
||||
size_t len=my_snprintf(buff, sizeof(buff), "%s, Version: %s (%s). "
|
||||
#ifdef EMBEDDED_LIBRARY
|
||||
"embedded library\n",
|
||||
my_progname, server_version, MYSQL_COMPILATION_COMMENT
|
||||
|
@ -2871,15 +2869,14 @@ void MYSQL_QUERY_LOG::reopen_file()
|
|||
TRUE - error occurred
|
||||
*/
|
||||
|
||||
bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host,
|
||||
uint user_host_len, my_thread_id thread_id_arg,
|
||||
const char *command_type, uint command_type_len,
|
||||
const char *sql_text, uint sql_text_len)
|
||||
bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id_arg,
|
||||
const char *command_type, size_t command_type_len,
|
||||
const char *sql_text, size_t sql_text_len)
|
||||
{
|
||||
char buff[32];
|
||||
char local_time_buff[MAX_TIME_SIZE];
|
||||
struct tm start;
|
||||
uint time_buff_len= 0;
|
||||
size_t time_buff_len= 0;
|
||||
|
||||
mysql_mutex_lock(&LOCK_log);
|
||||
|
||||
|
@ -2973,10 +2970,9 @@ err:
|
|||
*/
|
||||
|
||||
bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
|
||||
const char *user_host,
|
||||
uint user_host_len, ulonglong query_utime,
|
||||
const char *user_host, size_t user_host_len, ulonglong query_utime,
|
||||
ulonglong lock_utime, bool is_command,
|
||||
const char *sql_text, uint sql_text_len)
|
||||
const char *sql_text, size_t sql_text_len)
|
||||
{
|
||||
bool error= 0;
|
||||
char llbuff[22];
|
||||
|
@ -3628,8 +3624,8 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
|
|||
Write the current binlog checkpoint into the log, so XA recovery will
|
||||
know from where to start recovery.
|
||||
*/
|
||||
uint off= dirname_length(log_file_name);
|
||||
uint len= strlen(log_file_name) - off;
|
||||
size_t off= dirname_length(log_file_name);
|
||||
size_t len= strlen(log_file_name) - off;
|
||||
char *entry_mem, *name_mem;
|
||||
if (!(new_xid_list_entry = (xid_count_per_binlog *)
|
||||
my_multi_malloc(MYF(MY_WME),
|
||||
|
@ -3639,7 +3635,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
|
|||
goto err;
|
||||
memcpy(name_mem, log_file_name+off, len);
|
||||
new_xid_list_entry->binlog_name= name_mem;
|
||||
new_xid_list_entry->binlog_name_len= len;
|
||||
new_xid_list_entry->binlog_name_len= (int)len;
|
||||
new_xid_list_entry->xid_count= 0;
|
||||
new_xid_list_entry->notify_count= 0;
|
||||
|
||||
|
@ -3659,7 +3655,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
|
|||
if (!b)
|
||||
b= new_xid_list_entry;
|
||||
strmake(buf, b->binlog_name, b->binlog_name_len);
|
||||
Binlog_checkpoint_log_event ev(buf, len);
|
||||
Binlog_checkpoint_log_event ev(buf, (uint)len);
|
||||
DBUG_EXECUTE_IF("crash_before_write_checkpoint_event",
|
||||
flush_io_cache(&log_file);
|
||||
mysql_file_sync(log_file.file, MYF(MY_WME));
|
||||
|
@ -3951,7 +3947,7 @@ int MYSQL_BIN_LOG::find_log_pos(LOG_INFO *linfo, const char *log_name,
|
|||
|
||||
for (;;)
|
||||
{
|
||||
uint length;
|
||||
size_t length;
|
||||
my_off_t offset= my_b_tell(&index_file);
|
||||
|
||||
DBUG_EXECUTE_IF("simulate_find_log_pos_error",
|
||||
|
@ -4021,7 +4017,7 @@ end:
|
|||
int MYSQL_BIN_LOG::find_next_log(LOG_INFO* linfo, bool need_lock)
|
||||
{
|
||||
int error= 0;
|
||||
uint length;
|
||||
size_t length;
|
||||
char fname[FN_REFLEN];
|
||||
char *full_fname= linfo->log_file_name;
|
||||
|
||||
|
@ -4711,7 +4707,7 @@ int MYSQL_BIN_LOG::purge_index_entry(THD *thd, ulonglong *reclaimed_space,
|
|||
|
||||
for (;;)
|
||||
{
|
||||
uint length;
|
||||
size_t length;
|
||||
|
||||
if ((length=my_b_gets(&purge_index_file, log_info.log_file_name,
|
||||
FN_REFLEN)) <= 1)
|
||||
|
@ -5058,7 +5054,7 @@ MYSQL_BIN_LOG::is_gtid_cached(THD *thd)
|
|||
|
||||
void MYSQL_BIN_LOG::make_log_name(char* buf, const char* log_ident)
|
||||
{
|
||||
uint dir_len = dirname_length(log_file_name);
|
||||
size_t dir_len = dirname_length(log_file_name);
|
||||
if (dir_len >= FN_REFLEN)
|
||||
dir_len=FN_REFLEN-1;
|
||||
strnmov(buf, log_file_name, dir_len);
|
||||
|
@ -6576,7 +6572,7 @@ bool general_log_print(THD *thd, enum enum_server_command command,
|
|||
}
|
||||
|
||||
bool general_log_write(THD *thd, enum enum_server_command command,
|
||||
const char *query, uint query_length)
|
||||
const char *query, size_t query_length)
|
||||
{
|
||||
/* Write the message to the log if we want to log this king of commands */
|
||||
if (logger.log_command(thd, command) || mysql_audit_general_enabled())
|
||||
|
@ -6923,7 +6919,7 @@ uint MYSQL_BIN_LOG::next_file_id()
|
|||
class CacheWriter: public Log_event_writer
|
||||
{
|
||||
public:
|
||||
ulong remains;
|
||||
size_t remains;
|
||||
|
||||
CacheWriter(THD *thd_arg, IO_CACHE *file_arg, bool do_checksum,
|
||||
Binlog_crypt_data *cr)
|
||||
|
@ -6976,9 +6972,9 @@ int MYSQL_BIN_LOG::write_cache(THD *thd, IO_CACHE *cache)
|
|||
mysql_mutex_assert_owner(&LOCK_log);
|
||||
if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
|
||||
DBUG_RETURN(ER_ERROR_ON_WRITE);
|
||||
uint length= my_b_bytes_in_cache(cache), group, carry, hdr_offs;
|
||||
long val;
|
||||
ulong end_log_pos_inc= 0; // each event processed adds BINLOG_CHECKSUM_LEN 2 t
|
||||
size_t length= my_b_bytes_in_cache(cache), group, carry, hdr_offs;
|
||||
size_t val;
|
||||
size_t end_log_pos_inc= 0; // each event processed adds BINLOG_CHECKSUM_LEN 2 t
|
||||
uchar header[LOG_EVENT_HEADER_LEN];
|
||||
CacheWriter writer(thd, &log_file, binlog_checksum_options, &crypto);
|
||||
|
||||
|
@ -7003,7 +6999,7 @@ int MYSQL_BIN_LOG::write_cache(THD *thd, IO_CACHE *cache)
|
|||
split.
|
||||
*/
|
||||
|
||||
group= (uint)my_b_tell(&log_file);
|
||||
group= (size_t)my_b_tell(&log_file);
|
||||
hdr_offs= carry= 0;
|
||||
|
||||
do
|
||||
|
@ -7015,12 +7011,12 @@ int MYSQL_BIN_LOG::write_cache(THD *thd, IO_CACHE *cache)
|
|||
if (unlikely(carry > 0))
|
||||
{
|
||||
DBUG_ASSERT(carry < LOG_EVENT_HEADER_LEN);
|
||||
uint tail= LOG_EVENT_HEADER_LEN - carry;
|
||||
size_t tail= LOG_EVENT_HEADER_LEN - carry;
|
||||
|
||||
/* assemble both halves */
|
||||
memcpy(&header[carry], (char *)cache->read_pos, tail);
|
||||
|
||||
ulong len= uint4korr(header + EVENT_LEN_OFFSET);
|
||||
uint32 len= uint4korr(header + EVENT_LEN_OFFSET);
|
||||
writer.remains= len;
|
||||
|
||||
/* fix end_log_pos */
|
||||
|
@ -8669,7 +8665,7 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer,
|
|||
struct tm tm_tmp;
|
||||
struct tm *start;
|
||||
THD *thd= 0;
|
||||
int tag_length= 0;
|
||||
size_t tag_length= 0;
|
||||
char tag[NAME_LEN];
|
||||
DBUG_ENTER("print_buffer_to_file");
|
||||
DBUG_PRINT("enter",("buffer: %s", buffer));
|
||||
|
@ -8705,7 +8701,7 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer,
|
|||
(unsigned long) (thd ? thd->thread_id : 0),
|
||||
(level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
|
||||
"Warning" : "Note"),
|
||||
tag_length, tag,
|
||||
(int) tag_length, tag,
|
||||
(int) length, buffer);
|
||||
|
||||
fflush(stderr);
|
||||
|
@ -10044,7 +10040,7 @@ int TC_LOG_BINLOG::recover(LOG_INFO *linfo, const char *last_log_name,
|
|||
case BINLOG_CHECKPOINT_EVENT:
|
||||
if (first_round && do_xa)
|
||||
{
|
||||
uint dir_len;
|
||||
size_t dir_len;
|
||||
Binlog_checkpoint_log_event *cev= (Binlog_checkpoint_log_event *)ev;
|
||||
if (cev->binlog_file_len >= FN_REFLEN)
|
||||
sql_print_warning("Incorrect binlog checkpoint event with too "
|
||||
|
@ -10441,7 +10437,7 @@ static struct st_mysql_sys_var *binlog_sys_vars[]=
|
|||
static void
|
||||
set_binlog_snapshot_file(const char *src)
|
||||
{
|
||||
int dir_len = dirname_length(src);
|
||||
size_t dir_len = dirname_length(src);
|
||||
strmake_buf(binlog_snapshot_file, src + dir_len);
|
||||
}
|
||||
|
||||
|
|
53
sql/log.h
53
sql/log.h
|
@ -359,14 +359,13 @@ class MYSQL_QUERY_LOG: public MYSQL_LOG
|
|||
public:
|
||||
MYSQL_QUERY_LOG() : last_time(0) {}
|
||||
void reopen_file();
|
||||
bool write(time_t event_time, const char *user_host,
|
||||
uint user_host_len, my_thread_id thread_id,
|
||||
const char *command_type, uint command_type_len,
|
||||
const char *sql_text, uint sql_text_len);
|
||||
bool write(time_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id,
|
||||
const char *command_type, size_t command_type_len,
|
||||
const char *sql_text, size_t sql_text_len);
|
||||
bool write(THD *thd, time_t current_time,
|
||||
const char *user_host, uint user_host_len,
|
||||
const char *user_host, size_t user_host_len,
|
||||
ulonglong query_utime, ulonglong lock_utime, bool is_command,
|
||||
const char *sql_text, uint sql_text_len);
|
||||
const char *sql_text, size_t sql_text_len);
|
||||
bool open_slow_log(const char *log_name)
|
||||
{
|
||||
char buf[FN_REFLEN];
|
||||
|
@ -950,16 +949,14 @@ public:
|
|||
virtual void cleanup()= 0;
|
||||
|
||||
virtual bool log_slow(THD *thd, my_hrtime_t current_time,
|
||||
const char *user_host,
|
||||
uint user_host_len, ulonglong query_utime,
|
||||
const char *user_host, size_t user_host_len, ulonglong query_utime,
|
||||
ulonglong lock_utime, bool is_command,
|
||||
const char *sql_text, uint sql_text_len)= 0;
|
||||
const char *sql_text, size_t sql_text_len)= 0;
|
||||
virtual bool log_error(enum loglevel level, const char *format,
|
||||
va_list args)= 0;
|
||||
virtual bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host,
|
||||
uint user_host_len, my_thread_id thread_id,
|
||||
const char *command_type, uint command_type_len,
|
||||
const char *sql_text, uint sql_text_len,
|
||||
virtual bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id,
|
||||
const char *command_type, size_t command_type_len,
|
||||
const char *sql_text, size_t sql_text_len,
|
||||
CHARSET_INFO *client_cs)= 0;
|
||||
virtual ~Log_event_handler() {}
|
||||
};
|
||||
|
@ -979,16 +976,14 @@ public:
|
|||
virtual void cleanup();
|
||||
|
||||
virtual bool log_slow(THD *thd, my_hrtime_t current_time,
|
||||
const char *user_host,
|
||||
uint user_host_len, ulonglong query_utime,
|
||||
const char *user_host, size_t user_host_len, ulonglong query_utime,
|
||||
ulonglong lock_utime, bool is_command,
|
||||
const char *sql_text, uint sql_text_len);
|
||||
const char *sql_text, size_t sql_text_len);
|
||||
virtual bool log_error(enum loglevel level, const char *format,
|
||||
va_list args);
|
||||
virtual bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host,
|
||||
uint user_host_len, my_thread_id thread_id,
|
||||
const char *command_type, uint command_type_len,
|
||||
const char *sql_text, uint sql_text_len,
|
||||
virtual bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id,
|
||||
const char *command_type, size_t command_type_len,
|
||||
const char *sql_text, size_t sql_text_len,
|
||||
CHARSET_INFO *client_cs);
|
||||
|
||||
int activate_log(THD *thd, uint log_type);
|
||||
|
@ -1011,16 +1006,14 @@ public:
|
|||
virtual void cleanup();
|
||||
|
||||
virtual bool log_slow(THD *thd, my_hrtime_t current_time,
|
||||
const char *user_host,
|
||||
uint user_host_len, ulonglong query_utime,
|
||||
const char *user_host, size_t user_host_len, ulonglong query_utime,
|
||||
ulonglong lock_utime, bool is_command,
|
||||
const char *sql_text, uint sql_text_len);
|
||||
const char *sql_text, size_t sql_text_len);
|
||||
virtual bool log_error(enum loglevel level, const char *format,
|
||||
va_list args);
|
||||
virtual bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host,
|
||||
uint user_host_len, my_thread_id thread_id,
|
||||
const char *command_type, uint command_type_len,
|
||||
const char *sql_text, uint sql_text_len,
|
||||
virtual bool log_general(THD *thd, my_hrtime_t event_time, const char *user_host, size_t user_host_len, my_thread_id thread_id,
|
||||
const char *command_type, size_t command_type_len,
|
||||
const char *sql_text, size_t sql_text_len,
|
||||
CHARSET_INFO *client_cs);
|
||||
void flush();
|
||||
void init_pthread_objects();
|
||||
|
@ -1074,12 +1067,12 @@ public:
|
|||
void cleanup_end();
|
||||
bool error_log_print(enum loglevel level, const char *format,
|
||||
va_list args);
|
||||
bool slow_log_print(THD *thd, const char *query, uint query_length,
|
||||
bool slow_log_print(THD *thd, const char *query, size_t query_length,
|
||||
ulonglong current_utime);
|
||||
bool general_log_print(THD *thd,enum enum_server_command command,
|
||||
const char *format, va_list args);
|
||||
bool general_log_write(THD *thd, enum enum_server_command command,
|
||||
const char *query, uint query_length);
|
||||
const char *query, size_t query_length);
|
||||
|
||||
/* we use this function to setup all enabled log event handlers */
|
||||
int set_handlers(ulonglong error_log_printer,
|
||||
|
@ -1131,7 +1124,7 @@ bool general_log_print(THD *thd, enum enum_server_command command,
|
|||
const char *format,...);
|
||||
|
||||
bool general_log_write(THD *thd, enum enum_server_command command,
|
||||
const char *query, uint query_length);
|
||||
const char *query, size_t query_length);
|
||||
|
||||
void binlog_report_wait_for(THD *thd, THD *other_thd);
|
||||
void sql_perror(const char *message);
|
||||
|
|
|
@ -221,7 +221,7 @@ static void inline slave_rows_error_report(enum loglevel level, int ha_error,
|
|||
const char *handler_error= (ha_error ? HA_ERR(ha_error) : NULL);
|
||||
char buff[MAX_SLAVE_ERRMSG], *slider;
|
||||
const char *buff_end= buff + sizeof(buff);
|
||||
uint len;
|
||||
size_t len;
|
||||
Diagnostics_area::Sql_condition_iterator it=
|
||||
thd->get_stmt_da()->sql_conditions();
|
||||
Relay_log_info const *rli= rgi->rli;
|
||||
|
@ -715,7 +715,7 @@ static inline int read_str(const char **buf, const char *buf_end,
|
|||
Transforms a string into "" or its expression in X'HHHH' form.
|
||||
*/
|
||||
|
||||
char *str_to_hex(char *to, const char *from, uint len)
|
||||
char *str_to_hex(char *to, const char *from, size_t len)
|
||||
{
|
||||
if (len)
|
||||
{
|
||||
|
@ -1605,13 +1605,13 @@ int Log_event_writer::encrypt_and_write(const uchar *pos, size_t len)
|
|||
|
||||
if (ctx)
|
||||
{
|
||||
dstsize= encryption_encrypted_length(len, ENCRYPTION_KEY_SYSTEM_DATA,
|
||||
dstsize= encryption_encrypted_length((uint)len, ENCRYPTION_KEY_SYSTEM_DATA,
|
||||
crypto->key_version);
|
||||
if (!(dst= (uchar*)my_safe_alloca(dstsize)))
|
||||
return 1;
|
||||
|
||||
uint dstlen;
|
||||
if (encryption_ctx_update(ctx, pos, len, dst, &dstlen))
|
||||
if (encryption_ctx_update(ctx, pos, (uint)len, dst, &dstlen))
|
||||
goto err;
|
||||
if (maybe_write_event_len(dst, dstlen))
|
||||
return 1;
|
||||
|
@ -1699,12 +1699,12 @@ int Log_event_writer::write_footer()
|
|||
Log_event::write_header()
|
||||
*/
|
||||
|
||||
bool Log_event::write_header(ulong event_data_length)
|
||||
bool Log_event::write_header(size_t event_data_length)
|
||||
{
|
||||
uchar header[LOG_EVENT_HEADER_LEN];
|
||||
ulong now;
|
||||
DBUG_ENTER("Log_event::write_header");
|
||||
DBUG_PRINT("enter", ("filepos: %lld length: %lu type: %d",
|
||||
DBUG_PRINT("enter", ("filepos: %lld length: %zu type: %d",
|
||||
(longlong) writer->pos(), event_data_length,
|
||||
(int) get_type_code()));
|
||||
|
||||
|
@ -3074,7 +3074,7 @@ Rows_log_event::print_verbose_one_row(IO_CACHE *file, table_def *td,
|
|||
if (my_b_printf(file, "%s", prefix))
|
||||
goto err;
|
||||
|
||||
for (size_t i= 0; i < td->size(); i ++)
|
||||
for (uint i= 0; i < (uint)td->size(); i ++)
|
||||
{
|
||||
size_t size;
|
||||
int is_null= (null_bits[null_bit_index / 8]
|
||||
|
@ -3435,7 +3435,7 @@ Rows_log_event::calc_row_event_length(table_def *td,
|
|||
|
||||
value+= (bitmap_bits_set(cols_bitmap) + 7) / 8;
|
||||
|
||||
for (size_t i= 0; i < td->size(); i ++)
|
||||
for (uint i= 0; i < (uint)td->size(); i ++)
|
||||
{
|
||||
int is_null;
|
||||
is_null= (null_bits[null_bit_index / 8] >> (null_bit_index % 8)) & 0x01;
|
||||
|
@ -4262,8 +4262,7 @@ Query_log_event::Query_log_event()
|
|||
Creates an event for binlogging
|
||||
The value for `errcode' should be supplied by caller.
|
||||
*/
|
||||
Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
|
||||
ulong query_length, bool using_trans,
|
||||
Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, size_t query_length, bool using_trans,
|
||||
bool direct, bool suppress_use, int errcode)
|
||||
|
||||
:Log_event(thd_arg,
|
||||
|
@ -4489,7 +4488,7 @@ get_str_len_and_pointer(const Log_event::Byte **src,
|
|||
|
||||
static void copy_str_and_move(const char **src,
|
||||
Log_event::Byte **dst,
|
||||
uint len)
|
||||
size_t len)
|
||||
{
|
||||
memcpy(*dst, *src, len);
|
||||
*src= (const char *)*dst;
|
||||
|
@ -4622,7 +4621,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
|
|||
event from the relay log.
|
||||
*/
|
||||
DBUG_ASSERT(description_event->binlog_version < 4);
|
||||
master_data_written= data_written;
|
||||
master_data_written= (uint32)data_written;
|
||||
}
|
||||
/*
|
||||
We have parsed everything we know in the post header for QUERY_EVENT,
|
||||
|
@ -4938,7 +4937,7 @@ Query_log_event::dummy_event(String *packet, ulong ev_offset,
|
|||
possibly just @`!`).
|
||||
*/
|
||||
static const char var_name[]= "!dummyvar";
|
||||
uint name_len= data_len - (min_user_var_event_len - 1);
|
||||
size_t name_len= data_len - (min_user_var_event_len - 1);
|
||||
|
||||
p[EVENT_TYPE_OFFSET]= USER_VAR_EVENT;
|
||||
int4store(p + LOG_EVENT_HEADER_LEN, name_len);
|
||||
|
@ -8394,7 +8393,7 @@ err:
|
|||
fully contruct the event object.
|
||||
*/
|
||||
bool
|
||||
Gtid_list_log_event::peek(const char *event_start, uint32 event_len,
|
||||
Gtid_list_log_event::peek(const char *event_start, size_t event_len,
|
||||
enum enum_binlog_checksum_alg checksum_alg,
|
||||
rpl_gtid **out_gtid_list, uint32 *out_list_len,
|
||||
const Format_description_log_event *fdev)
|
||||
|
@ -9125,7 +9124,7 @@ bool User_var_log_event::write()
|
|||
uchar buf2[MY_MAX(8, DECIMAL_MAX_FIELD_SIZE + 2)], *pos= buf2;
|
||||
uint unsigned_len= 0;
|
||||
uint buf1_length;
|
||||
ulong event_length;
|
||||
size_t event_length;
|
||||
|
||||
int4store(buf, name_len);
|
||||
|
||||
|
@ -9368,7 +9367,7 @@ int User_var_log_event::do_apply_event(rpl_group_info *rgi)
|
|||
break;
|
||||
}
|
||||
case STRING_RESULT:
|
||||
it= new (thd->mem_root) Item_string(thd, val, val_len, charset);
|
||||
it= new (thd->mem_root) Item_string(thd, val, (uint)val_len, charset);
|
||||
break;
|
||||
case ROW_RESULT:
|
||||
default:
|
||||
|
@ -10411,7 +10410,7 @@ bool Execute_load_query_log_event::print(FILE* file,
|
|||
{
|
||||
if (my_b_write(&cache, (uchar*) query, fn_pos_start) ||
|
||||
my_b_write_string(&cache, " LOCAL INFILE ") ||
|
||||
pretty_print_str(&cache, local_fname, strlen(local_fname)))
|
||||
pretty_print_str(&cache, local_fname, (int)strlen(local_fname)))
|
||||
goto err;
|
||||
|
||||
if (dup_handling == LOAD_DUP_REPLACE)
|
||||
|
@ -12284,7 +12283,7 @@ int Table_map_log_event::rewrite_db(const char* new_db, size_t new_len,
|
|||
LOG_EVENT_MINIMAL_HEADER_LEN) + TABLE_MAP_HEADER_LEN;
|
||||
int len_diff;
|
||||
|
||||
if (!(len_diff= new_len - m_dblen))
|
||||
if (!(len_diff= (int)(new_len - m_dblen)))
|
||||
{
|
||||
memcpy((void*) (temp_buf + header_len + 1), new_db, m_dblen + 1);
|
||||
memcpy((void*) m_dbnam, new_db, m_dblen + 1);
|
||||
|
@ -12306,7 +12305,7 @@ int Table_map_log_event::rewrite_db(const char* new_db, size_t new_len,
|
|||
|
||||
// Rewrite temp_buf
|
||||
char* ptr= new_temp_buf;
|
||||
ulong cnt= 0;
|
||||
size_t cnt= 0;
|
||||
|
||||
// Copy header and change event length
|
||||
memcpy(ptr, temp_buf, header_len);
|
||||
|
|
|
@ -1203,7 +1203,7 @@ public:
|
|||
/* The number of seconds the query took to run on the master. */
|
||||
ulong exec_time;
|
||||
/* Number of bytes written by write() function */
|
||||
ulong data_written;
|
||||
size_t data_written;
|
||||
|
||||
/*
|
||||
The master's server id (is preserved in the relay log; used to
|
||||
|
@ -1364,10 +1364,10 @@ public:
|
|||
static void operator delete(void*, void*) { }
|
||||
|
||||
#ifdef MYSQL_SERVER
|
||||
bool write_header(ulong data_length);
|
||||
bool write_data(const uchar *buf, ulong data_length)
|
||||
bool write_header(size_t event_data_length);
|
||||
bool write_data(const uchar *buf, size_t data_length)
|
||||
{ return writer->write_data(buf, data_length); }
|
||||
bool write_data(const char *buf, ulong data_length)
|
||||
bool write_data(const char *buf, size_t data_length)
|
||||
{ return write_data((uchar*)buf, data_length); }
|
||||
bool write_footer()
|
||||
{ return writer->write_footer(); }
|
||||
|
@ -2114,7 +2114,7 @@ public:
|
|||
|
||||
#ifdef MYSQL_SERVER
|
||||
|
||||
Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length,
|
||||
Query_log_event(THD* thd_arg, const char* query_arg, size_t query_length,
|
||||
bool using_trans, bool direct, bool suppress_use, int error);
|
||||
const char* get_db() { return db; }
|
||||
#ifdef HAVE_REPLICATION
|
||||
|
@ -2498,10 +2498,10 @@ public:
|
|||
bool is_concurrent;
|
||||
|
||||
/* fname doesn't point to memory inside Log_event::temp_buf */
|
||||
void set_fname_outside_temp_buf(const char *afname, uint alen)
|
||||
void set_fname_outside_temp_buf(const char *afname, size_t alen)
|
||||
{
|
||||
fname= afname;
|
||||
fname_len= alen;
|
||||
fname_len= (uint)alen;
|
||||
local_fname= TRUE;
|
||||
}
|
||||
/* fname doesn't point to memory inside Log_event::temp_buf */
|
||||
|
@ -3050,9 +3050,9 @@ public:
|
|||
UNSIGNED_F= 1
|
||||
};
|
||||
const char *name;
|
||||
uint name_len;
|
||||
size_t name_len;
|
||||
const char *val;
|
||||
ulong val_len;
|
||||
size_t val_len;
|
||||
Item_result type;
|
||||
uint charset_number;
|
||||
bool is_null;
|
||||
|
@ -3060,8 +3060,8 @@ public:
|
|||
#ifdef MYSQL_SERVER
|
||||
bool deferred;
|
||||
query_id_t query_id;
|
||||
User_var_log_event(THD* thd_arg, const char *name_arg, uint name_len_arg,
|
||||
const char *val_arg, ulong val_len_arg, Item_result type_arg,
|
||||
User_var_log_event(THD* thd_arg, const char *name_arg, size_t name_len_arg,
|
||||
const char *val_arg, size_t val_len_arg, Item_result type_arg,
|
||||
uint charset_number_arg, uchar flags_arg,
|
||||
bool using_trans, bool direct)
|
||||
:Log_event(thd_arg, 0, using_trans),
|
||||
|
@ -3519,7 +3519,7 @@ public:
|
|||
virtual int do_apply_event(rpl_group_info *rgi);
|
||||
enum_skip_reason do_shall_skip(rpl_group_info *rgi);
|
||||
#endif
|
||||
static bool peek(const char *event_start, uint32 event_len,
|
||||
static bool peek(const char *event_start, size_t event_len,
|
||||
enum enum_binlog_checksum_alg checksum_alg,
|
||||
rpl_gtid **out_gtid_list, uint32 *out_list_len,
|
||||
const Format_description_log_event *fdev);
|
||||
|
@ -3864,7 +3864,7 @@ public:
|
|||
bool is_valid() const { return 1; }
|
||||
};
|
||||
#endif
|
||||
char *str_to_hex(char *to, const char *from, uint len);
|
||||
char *str_to_hex(char *to, const char *from, size_t len);
|
||||
|
||||
/**
|
||||
@class Annotate_rows_log_event
|
||||
|
|
|
@ -176,9 +176,9 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
|
|||
crypt_data->inbuf_counter= crypt_data->counter;
|
||||
set_iv(iv, info->pos_in_file, crypt_data->inbuf_counter);
|
||||
|
||||
if (encryption_crypt(Buffer, length, ebuffer, &elength,
|
||||
crypt_data->key, sizeof(crypt_data->key),
|
||||
iv, sizeof(iv), ENCRYPTION_FLAG_ENCRYPT,
|
||||
if (encryption_crypt(Buffer, (uint)length, ebuffer, &elength,
|
||||
crypt_data->key, (uint) sizeof(crypt_data->key),
|
||||
iv, (uint) sizeof(iv), ENCRYPTION_FLAG_ENCRYPT,
|
||||
keyid, keyver))
|
||||
{
|
||||
my_errno= 1;
|
||||
|
@ -193,7 +193,7 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
|
|||
buffer_length bytes should *always* produce block_length bytes
|
||||
*/
|
||||
DBUG_ASSERT(crypt_data->block_length == 0 || crypt_data->block_length == wlength);
|
||||
DBUG_ASSERT(elength <= encryption_encrypted_length(length, keyid, keyver));
|
||||
DBUG_ASSERT(elength <= encryption_encrypted_length((uint)length, keyid, keyver));
|
||||
crypt_data->block_length= wlength;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1656,10 +1656,10 @@ int DsMrr_impl::dsmrr_explain_info(uint mrr_mode, char *str, size_t size)
|
|||
else if (mrr_mode & DSMRR_IMPL_SORT_ROWIDS)
|
||||
used_str= rowid_ordered;
|
||||
|
||||
uint used_str_len= strlen(used_str);
|
||||
uint copy_len= MY_MIN(used_str_len, size);
|
||||
size_t used_str_len= strlen(used_str);
|
||||
size_t copy_len= MY_MIN(used_str_len, size);
|
||||
memcpy(str, used_str, copy_len);
|
||||
return copy_len;
|
||||
return (int)copy_len;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1718,7 +1718,7 @@ bool DsMrr_impl::get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags,
|
|||
else
|
||||
{
|
||||
cost->reset();
|
||||
*buffer_size= MY_MAX(*buffer_size,
|
||||
*buffer_size= (uint)MY_MAX(*buffer_size,
|
||||
(size_t)(1.2*rows_in_last_step) * elem_size +
|
||||
primary_file->ref_length + table->key_info[keynr].key_length);
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ int my_decimal2binary(uint mask, const my_decimal *d, uchar *bin, int prec,
|
|||
E_DEC_OOM
|
||||
*/
|
||||
|
||||
int str2my_decimal(uint mask, const char *from, uint length,
|
||||
int str2my_decimal(uint mask, const char *from, size_t length,
|
||||
CHARSET_INFO *charset, my_decimal *decimal_value,
|
||||
const char **end_ptr)
|
||||
{
|
||||
|
|
|
@ -365,11 +365,11 @@ int str2my_decimal(uint mask, const char *str, my_decimal *d, char **end)
|
|||
}
|
||||
|
||||
|
||||
int str2my_decimal(uint mask, const char *from, uint length,
|
||||
int str2my_decimal(uint mask, const char *from, size_t length,
|
||||
CHARSET_INFO *charset, my_decimal *decimal_value,
|
||||
const char **end);
|
||||
|
||||
inline int str2my_decimal(uint mask, const char *from, uint length,
|
||||
inline int str2my_decimal(uint mask, const char *from, size_t length,
|
||||
CHARSET_INFO *charset, my_decimal *decimal_value)
|
||||
{
|
||||
const char *end;
|
||||
|
|
|
@ -221,7 +221,7 @@ bool Single_line_formatting_helper::on_add_member(const char *name)
|
|||
buf_ptr+=len;
|
||||
*(buf_ptr++)= 0;
|
||||
|
||||
line_len= owner->indent_level + len + 1;
|
||||
line_len= owner->indent_level + (uint)len + 1;
|
||||
state= ADD_MEMBER;
|
||||
return true; // handled
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ bool Single_line_formatting_helper::on_add_str(const char *str)
|
|||
memcpy(buf_ptr, str, len);
|
||||
buf_ptr+=len;
|
||||
*(buf_ptr++)= 0;
|
||||
line_len += len + 4;
|
||||
line_len += (uint)len + 4;
|
||||
return true; // handled
|
||||
}
|
||||
|
||||
|
|
|
@ -626,7 +626,7 @@ char mysql_real_data_home[FN_REFLEN],
|
|||
*opt_init_file, *opt_tc_log_file;
|
||||
char *lc_messages_dir_ptr= lc_messages_dir, *log_error_file_ptr;
|
||||
char mysql_unpacked_real_data_home[FN_REFLEN];
|
||||
int mysql_unpacked_real_data_home_len;
|
||||
size_t mysql_unpacked_real_data_home_len;
|
||||
uint mysql_real_data_home_len, mysql_data_home_len= 1;
|
||||
uint reg_ext_length;
|
||||
const key_map key_map_empty(0);
|
||||
|
@ -5681,8 +5681,8 @@ static void test_lc_time_sz()
|
|||
DBUG_ENTER("test_lc_time_sz");
|
||||
for (MY_LOCALE **loc= my_locales; *loc; loc++)
|
||||
{
|
||||
uint max_month_len= 0;
|
||||
uint max_day_len = 0;
|
||||
size_t max_month_len= 0;
|
||||
size_t max_day_len= 0;
|
||||
for (const char **month= (*loc)->month_names->type_names; *month; month++)
|
||||
{
|
||||
set_if_bigger(max_month_len,
|
||||
|
@ -8526,7 +8526,7 @@ SHOW_VAR status_vars[]= {
|
|||
{"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS},
|
||||
{"Handler_delete", (char*) offsetof(STATUS_VAR, ha_delete_count), SHOW_LONG_STATUS},
|
||||
{"Handler_discover", (char*) offsetof(STATUS_VAR, ha_discover_count), SHOW_LONG_STATUS},
|
||||
{"Handler_external_lock", (char*) offsetof(STATUS_VAR, ha_external_lock_count), SHOW_LONGLONG_STATUS},
|
||||
{"Handler_external_lock", (char*) offsetof(STATUS_VAR, ha_external_lock_count), SHOW_LONG_STATUS},
|
||||
{"Handler_icp_attempts", (char*) offsetof(STATUS_VAR, ha_icp_attempts), SHOW_LONG_STATUS},
|
||||
{"Handler_icp_match", (char*) offsetof(STATUS_VAR, ha_icp_match), SHOW_LONG_STATUS},
|
||||
{"Handler_mrr_init", (char*) offsetof(STATUS_VAR, ha_mrr_init_count), SHOW_LONG_STATUS},
|
||||
|
@ -10000,7 +10000,7 @@ static int fix_paths(void)
|
|||
|
||||
my_realpath(mysql_unpacked_real_data_home, mysql_real_data_home, MYF(0));
|
||||
mysql_unpacked_real_data_home_len=
|
||||
(int) strlen(mysql_unpacked_real_data_home);
|
||||
strlen(mysql_unpacked_real_data_home);
|
||||
if (mysql_unpacked_real_data_home[mysql_unpacked_real_data_home_len-1] == FN_LIBCHAR)
|
||||
--mysql_unpacked_real_data_home_len;
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ extern "C" MYSQL_PLUGIN_IMPORT ulong server_id;
|
|||
extern ulong concurrency;
|
||||
extern time_t server_start_time, flush_status_time;
|
||||
extern char *opt_mysql_tmpdir, mysql_charsets_dir[];
|
||||
extern int mysql_unpacked_real_data_home_len;
|
||||
extern size_t mysql_unpacked_real_data_home_len;
|
||||
extern MYSQL_PLUGIN_IMPORT MY_TMPDIR mysql_tmpdir_list;
|
||||
extern const char *first_keyword, *delayed_user, *binary_keyword;
|
||||
extern MYSQL_PLUGIN_IMPORT const char *my_localhost;
|
||||
|
|
|
@ -104,7 +104,7 @@ extern uint test_flags;
|
|||
extern ulong bytes_sent, bytes_received, net_big_packet_count;
|
||||
#ifdef HAVE_QUERY_CACHE
|
||||
#define USE_QUERY_CACHE
|
||||
extern void query_cache_insert(void *thd, const char *packet, ulong length,
|
||||
extern void query_cache_insert(void *thd, const char *packet, size_t length,
|
||||
unsigned pkt_nr);
|
||||
#endif // HAVE_QUERY_CACHE
|
||||
#define update_statistics(A) A
|
||||
|
@ -117,7 +117,7 @@ extern my_bool thd_net_is_killed();
|
|||
#endif
|
||||
|
||||
|
||||
static my_bool net_write_buff(NET *, const uchar *, ulong);
|
||||
static my_bool net_write_buff(NET *, const uchar *, size_t len);
|
||||
|
||||
my_bool net_allocate_new_packet(NET *net, void *thd, uint my_flags);
|
||||
|
||||
|
@ -542,13 +542,13 @@ net_write_command(NET *net,uchar command,
|
|||
*/
|
||||
|
||||
static my_bool
|
||||
net_write_buff(NET *net, const uchar *packet, ulong len)
|
||||
net_write_buff(NET *net, const uchar *packet, size_t len)
|
||||
{
|
||||
ulong left_length;
|
||||
size_t left_length;
|
||||
if (net->compress && net->max_packet > MAX_PACKET_LENGTH)
|
||||
left_length= (ulong) (MAX_PACKET_LENGTH - (net->write_pos - net->buff));
|
||||
left_length= (MAX_PACKET_LENGTH - (net->write_pos - net->buff));
|
||||
else
|
||||
left_length= (ulong) (net->buff_end - net->write_pos);
|
||||
left_length= (net->buff_end - net->write_pos);
|
||||
|
||||
#ifdef DEBUG_DATA_PACKETS
|
||||
DBUG_DUMP("data_written", packet, len);
|
||||
|
@ -1034,7 +1034,7 @@ retry:
|
|||
#endif
|
||||
if (i == 0)
|
||||
{ /* First parts is packet length */
|
||||
ulong helping;
|
||||
size_t helping;
|
||||
#ifndef DEBUG_DATA_PACKETS
|
||||
DBUG_DUMP("packet_header", net->buff+net->where_b,
|
||||
NET_HEADER_SIZE);
|
||||
|
@ -1238,7 +1238,7 @@ my_net_read_packet_reallen(NET *net, my_bool read_from_server, ulong* reallen)
|
|||
size_t total_length= 0;
|
||||
do
|
||||
{
|
||||
net->where_b += len;
|
||||
net->where_b += (ulong)len;
|
||||
total_length += len;
|
||||
len = my_real_read(net,&complen, 0);
|
||||
} while (len == MAX_PACKET_LENGTH);
|
||||
|
@ -1251,10 +1251,10 @@ my_net_read_packet_reallen(NET *net, my_bool read_from_server, ulong* reallen)
|
|||
if (len != packet_error)
|
||||
{
|
||||
net->read_pos[len]=0; /* Safeguard for mysql_use_result */
|
||||
*reallen = len;
|
||||
*reallen = (ulong)len;
|
||||
}
|
||||
MYSQL_NET_READ_DONE(0, len);
|
||||
return len;
|
||||
return (ulong)len;
|
||||
#ifdef HAVE_COMPRESS
|
||||
}
|
||||
else
|
||||
|
@ -1352,7 +1352,7 @@ my_net_read_packet_reallen(NET *net, my_bool read_from_server, ulong* reallen)
|
|||
MYSQL_NET_READ_DONE(1, 0);
|
||||
return packet_error;
|
||||
}
|
||||
buf_length+= complen;
|
||||
buf_length+= (ulong)complen;
|
||||
*reallen += packet_len;
|
||||
}
|
||||
|
||||
|
@ -1366,7 +1366,7 @@ my_net_read_packet_reallen(NET *net, my_bool read_from_server, ulong* reallen)
|
|||
}
|
||||
#endif /* HAVE_COMPRESS */
|
||||
MYSQL_NET_READ_DONE(0, len);
|
||||
return len;
|
||||
return (ulong)len;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6214,7 +6214,7 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info,
|
|||
&key_ptr, 0);
|
||||
keypart_map= (keypart_map << 1) | 1;
|
||||
}
|
||||
min_range.length= max_range.length= (size_t) (key_ptr - key_val);
|
||||
min_range.length= max_range.length= (uint) (key_ptr - key_val);
|
||||
min_range.keypart_map= max_range.keypart_map= keypart_map;
|
||||
records= (info->param->table->file->
|
||||
records_in_range(scan->keynr, &min_range, &max_range));
|
||||
|
@ -7966,7 +7966,7 @@ Item_func_like::get_mm_leaf(RANGE_OPT_PARAM *param,
|
|||
}
|
||||
|
||||
uint maybe_null= (uint) field->real_maybe_null();
|
||||
uint field_length= field->pack_length() + maybe_null;
|
||||
size_t field_length= field->pack_length() + maybe_null;
|
||||
size_t offset= maybe_null;
|
||||
size_t length= key_part->store_length;
|
||||
|
||||
|
|
|
@ -427,7 +427,7 @@ bool JOIN::check_for_splittable_materialized()
|
|||
}
|
||||
|
||||
/* Count the candidate fields that can be accessed by ref */
|
||||
uint spl_field_cnt= candidates.elements();
|
||||
uint spl_field_cnt= (uint)candidates.elements();
|
||||
for (cand= cand_start; cand < cand_end; cand++)
|
||||
{
|
||||
if (!cand->is_usable_for_ref_access)
|
||||
|
@ -694,7 +694,7 @@ void JOIN::add_keyuses_for_splitting()
|
|||
(void) add_ext_keyuses_for_splitting_field(ext_keyuses_for_splitting,
|
||||
added_key_field);
|
||||
}
|
||||
added_keyuse_count= ext_keyuses_for_splitting->elements();
|
||||
added_keyuse_count= (uint)ext_keyuses_for_splitting->elements();
|
||||
if (!added_keyuse_count)
|
||||
goto err;
|
||||
sort_ext_keyuses(ext_keyuses_for_splitting);
|
||||
|
|
|
@ -760,12 +760,12 @@ File_parser::parse(uchar* base, MEM_ROOT *mem_root,
|
|||
{
|
||||
File_option *parameter= parameters+first_param,
|
||||
*parameters_end= parameters+required;
|
||||
int len= 0;
|
||||
size_t len= 0;
|
||||
for (; parameter < parameters_end; parameter++)
|
||||
{
|
||||
len= parameter->name.length;
|
||||
// check length
|
||||
if (len < (end-ptr) && ptr[len] != '=')
|
||||
if (len < (size_t)(end-ptr) && ptr[len] != '=')
|
||||
continue;
|
||||
// check keyword
|
||||
if (memcmp(parameter->name.str, ptr, len) == 0)
|
||||
|
|
|
@ -145,8 +145,7 @@ partition_info *partition_info::get_clone(THD *thd)
|
|||
@retval false Partition not found
|
||||
*/
|
||||
|
||||
bool partition_info::add_named_partition(const char *part_name,
|
||||
uint length)
|
||||
bool partition_info::add_named_partition(const char *part_name, size_t length)
|
||||
{
|
||||
HASH *part_name_hash;
|
||||
PART_NAME_DEF *part_def;
|
||||
|
@ -197,8 +196,7 @@ bool partition_info::add_named_partition(const char *part_name,
|
|||
@param part_elem Partition element that matched.
|
||||
*/
|
||||
|
||||
bool partition_info::set_named_partition_bitmap(const char *part_name,
|
||||
uint length)
|
||||
bool partition_info::set_named_partition_bitmap(const char *part_name, size_t length)
|
||||
{
|
||||
DBUG_ENTER("partition_info::set_named_partition_bitmap");
|
||||
bitmap_clear_all(&read_partitions);
|
||||
|
@ -419,7 +417,7 @@ char *partition_info::create_default_partition_names(THD *thd, uint part_no,
|
|||
char *partition_info::create_default_subpartition_name(THD *thd, uint subpart_no,
|
||||
const char *part_name)
|
||||
{
|
||||
uint size_alloc= strlen(part_name) + MAX_PART_NAME_SIZE;
|
||||
size_t size_alloc= strlen(part_name) + MAX_PART_NAME_SIZE;
|
||||
char *ptr= (char*) thd->calloc(size_alloc);
|
||||
DBUG_ENTER("create_default_subpartition_name");
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ public:
|
|||
~partition_info() {}
|
||||
|
||||
partition_info *get_clone(THD *thd);
|
||||
bool set_named_partition_bitmap(const char *part_name, uint length);
|
||||
bool set_named_partition_bitmap(const char *part_name, size_t length);
|
||||
bool set_partition_bitmaps(List<String> *partition_names);
|
||||
bool set_partition_bitmaps_from_table(TABLE_LIST *table_list);
|
||||
/* Answers the question if subpartitioning is used for a certain table */
|
||||
|
@ -388,7 +388,7 @@ private:
|
|||
const char *part_name);
|
||||
// FIXME: prune_partition_bitmaps() is duplicate of set_read_partitions()
|
||||
bool prune_partition_bitmaps(List<String> *partition_names);
|
||||
bool add_named_partition(const char *part_name, uint length);
|
||||
bool add_named_partition(const char *part_name, size_t length);
|
||||
public:
|
||||
bool set_read_partitions(List<char> *partition_names);
|
||||
bool has_unique_name(partition_element *element);
|
||||
|
|
|
@ -296,7 +296,7 @@ void make_password_from_salt_323(char *to, const ulong *salt)
|
|||
buf+len*2
|
||||
*/
|
||||
|
||||
char *octet2hex(char *to, const char *str, uint len)
|
||||
char *octet2hex(char *to, const char *str, size_t len)
|
||||
{
|
||||
const char *str_end= str + len;
|
||||
for (; str != str_end; ++str)
|
||||
|
|
|
@ -86,7 +86,7 @@ bool Protocol_binary::net_store_data_cs(const uchar *from, size_t length,
|
|||
{
|
||||
uint dummy_errors;
|
||||
/* Calculate maxumum possible result length */
|
||||
uint conv_length= to_cs->mbmaxlen * length / from_cs->mbminlen;
|
||||
size_t conv_length= to_cs->mbmaxlen * length / from_cs->mbminlen;
|
||||
|
||||
if (conv_length > 250)
|
||||
{
|
||||
|
@ -106,8 +106,8 @@ bool Protocol_binary::net_store_data_cs(const uchar *from, size_t length,
|
|||
net_store_data((const uchar*) convert->ptr(), convert->length()));
|
||||
}
|
||||
|
||||
ulong packet_length= packet->length();
|
||||
ulong new_length= packet_length + conv_length + 1;
|
||||
size_t packet_length= packet->length();
|
||||
size_t new_length= packet_length + conv_length + 1;
|
||||
|
||||
if (new_length > packet->alloced_length() && packet->realloc(new_length))
|
||||
return 1;
|
||||
|
@ -480,8 +480,9 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
|
|||
- ulonglong for bigger numbers.
|
||||
*/
|
||||
|
||||
static uchar *net_store_length_fast(uchar *packet, uint length)
|
||||
static uchar *net_store_length_fast(uchar *packet, size_t length)
|
||||
{
|
||||
DBUG_ASSERT(length < UINT_MAX16);
|
||||
if (length < 251)
|
||||
{
|
||||
*packet=(uchar) length;
|
||||
|
@ -661,7 +662,7 @@ void net_send_progress_packet(THD *thd)
|
|||
{
|
||||
uchar buff[200], *pos;
|
||||
const char *proc_info= thd->proc_info ? thd->proc_info : "";
|
||||
uint length= strlen(proc_info);
|
||||
size_t length= strlen(proc_info);
|
||||
ulonglong progress;
|
||||
DBUG_ENTER("net_send_progress_packet");
|
||||
|
||||
|
@ -1015,7 +1016,7 @@ bool Protocol::store(const char *from, CHARSET_INFO *cs)
|
|||
{
|
||||
if (!from)
|
||||
return store_null();
|
||||
uint length= strlen(from);
|
||||
size_t length= strlen(from);
|
||||
return store(from, length, cs);
|
||||
}
|
||||
|
||||
|
|
|
@ -210,14 +210,19 @@ int parse_proxy_protocol_header(NET *net, proxy_peer_info *peer_info)
|
|||
{
|
||||
#define PROXY_V2_HEADER_LEN 16
|
||||
/* read off 16 bytes of the header.*/
|
||||
long len= vio_read(vio, hdr + pos, PROXY_V2_HEADER_LEN - pos);
|
||||
ssize_t len= vio_read(vio, hdr + pos, PROXY_V2_HEADER_LEN - pos);
|
||||
if (len < 0)
|
||||
return -1;
|
||||
// 2 last bytes are the length in network byte order of the part following header
|
||||
ushort trail_len= ((ushort)hdr[PROXY_V2_HEADER_LEN-2] >> 8) + hdr[PROXY_V2_HEADER_LEN-1];
|
||||
if (trail_len > sizeof(hdr) - PROXY_V2_HEADER_LEN)
|
||||
return -1;
|
||||
len= vio_read(vio, hdr + PROXY_V2_HEADER_LEN, trail_len);
|
||||
if (trail_len > 0)
|
||||
{
|
||||
len= vio_read(vio, hdr + PROXY_V2_HEADER_LEN, trail_len);
|
||||
if (len < 0)
|
||||
return -1;
|
||||
}
|
||||
pos= PROXY_V2_HEADER_LEN + trail_len;
|
||||
if (parse_v2_header(hdr, pos, peer_info))
|
||||
return -1;
|
||||
|
@ -230,11 +235,10 @@ int parse_proxy_protocol_header(NET *net, proxy_peer_info *peer_info)
|
|||
They will be treated as IPv4.
|
||||
*/
|
||||
sockaddr_storage tmp;
|
||||
int dst_len;
|
||||
memset(&tmp, 0, sizeof(tmp));
|
||||
vio_get_normalized_ip((const struct sockaddr *)&peer_info->peer_addr,
|
||||
sizeof(sockaddr_storage), (struct sockaddr *)&tmp, &dst_len);
|
||||
memcpy(&peer_info->peer_addr, &tmp, (size_t)dst_len);
|
||||
sizeof(sockaddr_storage), (struct sockaddr *)&tmp);
|
||||
memcpy(&peer_info->peer_addr, &tmp, sizeof(tmp));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -464,10 +468,9 @@ bool is_proxy_protocol_allowed(const sockaddr *addr)
|
|||
case AF_INET:
|
||||
case AF_INET6:
|
||||
{
|
||||
int len=
|
||||
size_t len=
|
||||
(addr->sa_family == AF_INET)?sizeof(sockaddr_in):sizeof (sockaddr_in6);
|
||||
int dst_len;
|
||||
vio_get_normalized_ip(addr, len,normalized_addr, &dst_len);
|
||||
vio_get_normalized_ip(addr, len,normalized_addr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -205,14 +205,14 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
|
|||
if (addon_field)
|
||||
{
|
||||
info->rec_buf= (uchar*) filesort->addon_buf.str;
|
||||
info->ref_length= filesort->addon_buf.length;
|
||||
info->ref_length= (uint)filesort->addon_buf.length;
|
||||
info->unpack= filesort->unpack;
|
||||
}
|
||||
else
|
||||
{
|
||||
empty_record(table);
|
||||
info->record= table->record[0];
|
||||
info->ref_length= table->file->ref_length;
|
||||
info->ref_length= (uint)table->file->ref_length;
|
||||
}
|
||||
info->select=select;
|
||||
info->print_error=print_error;
|
||||
|
|
|
@ -115,7 +115,7 @@ void unregister_slave(THD* thd, bool only_mine, bool need_mutex)
|
|||
1 Error. Error message sent to client
|
||||
*/
|
||||
|
||||
int register_slave(THD* thd, uchar* packet, uint packet_length)
|
||||
int register_slave(THD* thd, uchar* packet, size_t packet_length)
|
||||
{
|
||||
int res;
|
||||
SLAVE_INFO *si;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue