summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysql.cc23
-rw-r--r--client/mysql_plugin.c8
-rw-r--r--client/mysqlbinlog.cc6
-rw-r--r--client/mysqlcheck.c8
-rw-r--r--client/mysqldump.c32
-rw-r--r--client/mysqlimport.c2
-rw-r--r--client/mysqlshow.c6
-rw-r--r--client/mysqlslap.c17
-rw-r--r--client/mysqltest.cc84
-rw-r--r--cmake/os/Windows.cmake4
-rw-r--r--extra/innochecksum.cc19
-rw-r--r--extra/mariabackup/backup_mysql.cc2
-rw-r--r--extra/mariabackup/xtrabackup.cc4
-rw-r--r--extra/yassl/src/cert_wrapper.cpp8
-rw-r--r--extra/yassl/src/socket_wrapper.cpp4
-rw-r--r--include/m_ctype.h6
-rw-r--r--include/my_compare.h6
-rw-r--r--include/my_pthread.h2
-rw-r--r--include/my_stacktrace.h2
-rw-r--r--include/my_sys.h6
-rw-r--r--include/my_time.h4
-rw-r--r--include/mysql.h.pp2
-rw-r--r--include/mysql/psi/mysql_socket.h8
-rw-r--r--include/mysql/psi/mysql_statement.h4
-rw-r--r--include/mysql_com.h2
-rw-r--r--include/violite.h5
-rw-r--r--libmysqld/libmysql.c5
-rw-r--r--mysys/hash.c2
-rw-r--r--mysys/lf_hash.c4
-rw-r--r--mysys/mf_iocache.c2
-rw-r--r--mysys/mf_keycache.c6
-rw-r--r--mysys/my_compare.c4
-rw-r--r--mysys/my_getopt.c4
-rw-r--r--mysys/my_wincond.c5
-rw-r--r--mysys/stacktrace.c8
-rw-r--r--mysys/string.c6
-rw-r--r--plugin/auth_gssapi/server_plugin.cc2
-rw-r--r--plugin/auth_gssapi/sspi_errmsg.cc2
-rw-r--r--plugin/auth_gssapi/sspi_server.cc2
-rw-r--r--plugin/aws_key_management/aws_key_management_plugin.cc4
-rw-r--r--plugin/feedback/url_http.cc8
-rw-r--r--plugin/win_auth_client/common.cc10
-rw-r--r--plugin/win_auth_client/handshake.h2
-rw-r--r--plugin/win_auth_client/handshake_client.cc2
-rw-r--r--sql-common/client.c4
-rw-r--r--sql-common/my_time.c4
-rw-r--r--sql-common/mysql_async.c4
-rw-r--r--sql/create_options.cc4
-rw-r--r--sql/create_options.h2
-rw-r--r--sql/debug_sync.cc4
-rw-r--r--sql/des_key_file.cc2
-rw-r--r--sql/discover.cc2
-rw-r--r--sql/field.cc150
-rw-r--r--sql/field.h81
-rw-r--r--sql/field_conv.cc4
-rw-r--r--sql/filesort.cc27
-rw-r--r--sql/gcalc_slicescan.cc6
-rw-r--r--sql/ha_partition.cc28
-rw-r--r--sql/ha_partition.h2
-rw-r--r--sql/handler.cc22
-rw-r--r--sql/hostname.cc10
-rw-r--r--sql/innodb_priv.h6
-rw-r--r--sql/item.cc25
-rw-r--r--sql/item.h50
-rw-r--r--sql/item_cmpfunc.cc4
-rw-r--r--sql/item_cmpfunc.h2
-rw-r--r--sql/item_create.cc4
-rw-r--r--sql/item_create.h2
-rw-r--r--sql/item_func.cc18
-rw-r--r--sql/item_func.h4
-rw-r--r--sql/item_strfunc.cc18
-rw-r--r--sql/item_subselect.cc2
-rw-r--r--sql/item_sum.cc2
-rw-r--r--sql/item_timefunc.cc7
-rw-r--r--sql/item_timefunc.h4
-rw-r--r--sql/key.cc16
-rw-r--r--sql/keycaches.cc22
-rw-r--r--sql/keycaches.h10
-rw-r--r--sql/log.cc90
-rw-r--r--sql/log.h53
-rw-r--r--sql/log_event.cc37
-rw-r--r--sql/log_event.h26
-rw-r--r--sql/mf_iocache_encr.cc8
-rw-r--r--sql/multi_range_read.cc8
-rw-r--r--sql/my_decimal.cc2
-rw-r--r--sql/my_decimal.h4
-rw-r--r--sql/my_json_writer.cc4
-rw-r--r--sql/mysqld.cc10
-rw-r--r--sql/mysqld.h2
-rw-r--r--sql/net_serv.cc24
-rw-r--r--sql/opt_range.cc4
-rw-r--r--sql/opt_split.cc4
-rw-r--r--sql/parse_file.cc4
-rw-r--r--sql/partition_info.cc8
-rw-r--r--sql/partition_info.h4
-rw-r--r--sql/password.c2
-rw-r--r--sql/protocol.cc13
-rw-r--r--sql/proxy_protocol.cc19
-rw-r--r--sql/records.cc4
-rw-r--r--sql/repl_failsafe.cc2
-rw-r--r--sql/repl_failsafe.h2
-rw-r--r--sql/rpl_mi.cc4
-rw-r--r--sql/rpl_utility.cc10
-rw-r--r--sql/semisync_master.cc3
-rw-r--r--sql/semisync_master.h2
-rw-r--r--sql/semisync_master_ack_receiver.cc2
-rw-r--r--sql/semisync_slave.cc10
-rw-r--r--sql/session_tracker.cc6
-rw-r--r--sql/set_var.cc4
-rw-r--r--sql/slave.cc18
-rw-r--r--sql/sp_cache.cc2
-rw-r--r--sql/sp_head.cc37
-rw-r--r--sql/sp_head.h2
-rw-r--r--sql/sp_pcontext.cc14
-rw-r--r--sql/sp_pcontext.h2
-rw-r--r--sql/sp_rcontext.cc2
-rw-r--r--sql/sp_rcontext.h2
-rw-r--r--sql/spatial.cc2
-rw-r--r--sql/spatial.h2
-rw-r--r--sql/sql_acl.cc46
-rw-r--r--sql/sql_acl.h4
-rw-r--r--sql/sql_array.h11
-rw-r--r--sql/sql_base.cc21
-rw-r--r--sql/sql_base.h4
-rw-r--r--sql/sql_binlog.cc2
-rw-r--r--sql/sql_cache.cc257
-rw-r--r--sql/sql_cache.h98
-rw-r--r--sql/sql_class.cc48
-rw-r--r--sql/sql_class.h39
-rw-r--r--sql/sql_connect.cc6
-rw-r--r--sql/sql_cte.cc2
-rw-r--r--sql/sql_db.cc16
-rw-r--r--sql/sql_digest.cc2
-rw-r--r--sql/sql_digest.h4
-rw-r--r--sql/sql_error.cc15
-rw-r--r--sql/sql_error.h8
-rw-r--r--sql/sql_explain.cc4
-rw-r--r--sql/sql_help.cc6
-rw-r--r--sql/sql_join_cache.cc22
-rw-r--r--sql/sql_join_cache.h12
-rw-r--r--sql/sql_lex.cc23
-rw-r--r--sql/sql_lex.h23
-rw-r--r--sql/sql_parse.cc33
-rw-r--r--sql/sql_parse.h6
-rw-r--r--sql/sql_partition.cc2
-rw-r--r--sql/sql_plugin.cc29
-rw-r--r--sql/sql_prepare.h15
-rw-r--r--sql/sql_profile.cc5
-rw-r--r--sql/sql_profile.h4
-rw-r--r--sql/sql_repl.cc14
-rw-r--r--sql/sql_select.cc6
-rw-r--r--sql/sql_servers.cc6
-rw-r--r--sql/sql_servers.h2
-rw-r--r--sql/sql_show.cc30
-rw-r--r--sql/sql_show.h5
-rw-r--r--sql/sql_string.cc55
-rw-r--r--sql/sql_string.h93
-rw-r--r--sql/sql_table.cc34
-rw-r--r--sql/sql_table.h6
-rw-r--r--sql/sql_time.cc12
-rw-r--r--sql/sql_time.h10
-rw-r--r--sql/sql_trigger.cc4
-rw-r--r--sql/sql_udf.cc6
-rw-r--r--sql/sql_udf.h2
-rw-r--r--sql/sql_view.cc4
-rw-r--r--sql/sql_yacc.yy12
-rw-r--r--sql/sql_yacc_ora.yy12
-rw-r--r--sql/strfunc.cc10
-rw-r--r--sql/strfunc.h10
-rw-r--r--sql/structs.h4
-rw-r--r--sql/sys_vars.cc6
-rw-r--r--sql/sys_vars_shared.h2
-rw-r--r--sql/table.cc21
-rw-r--r--sql/table.h6
-rw-r--r--sql/table_cache.cc6
-rw-r--r--sql/temporary_tables.cc2
-rw-r--r--sql/transaction.cc2
-rw-r--r--sql/tztime.cc6
-rw-r--r--sql/uniques.cc8
-rw-r--r--sql/unireg.cc24
-rw-r--r--sql/vers_string.h6
-rw-r--r--sql/wsrep_mysqld.cc3
-rw-r--r--storage/archive/azio.c14
-rw-r--r--storage/archive/azlib.h4
-rw-r--r--storage/archive/ha_archive.cc2
-rw-r--r--storage/connect/CMakeLists.txt8
-rw-r--r--storage/federatedx/federatedx_io_mysql.cc19
-rw-r--r--storage/federatedx/federatedx_io_null.cc4
-rw-r--r--storage/federatedx/ha_federatedx.cc10
-rw-r--r--storage/federatedx/ha_federatedx.h6
-rw-r--r--storage/heap/hp_delete.c2
-rw-r--r--storage/heap/hp_hash.c68
-rw-r--r--storage/innobase/CMakeLists.txt5
-rw-r--r--storage/innobase/buf/buf0flu.cc4
-rw-r--r--storage/innobase/fil/fil0crypt.cc6
-rw-r--r--storage/innobase/handler/ha_innodb.cc14
-rw-r--r--storage/innobase/include/dict0mem.h2
-rw-r--r--storage/innobase/include/sync0policy.h2
-rw-r--r--storage/innobase/log/log0crypt.cc6
-rw-r--r--storage/innobase/rem/rem0rec.cc4
-rw-r--r--storage/innobase/row/row0ftsort.cc2
-rw-r--r--storage/innobase/srv/srv0start.cc2
-rw-r--r--storage/maria/ft_maria.c4
-rw-r--r--storage/maria/ma_check.c2
-rw-r--r--storage/maria/ma_checkpoint.c10
-rw-r--r--storage/maria/ma_delete.c6
-rw-r--r--storage/maria/ma_keycache.c2
-rw-r--r--storage/maria/ma_loghandler.c11
-rw-r--r--storage/maria/ma_page.c4
-rw-r--r--storage/maria/ma_pagecache.c4
-rw-r--r--storage/maria/ma_recovery.c2
-rw-r--r--storage/maria/ma_rename.c4
-rw-r--r--storage/maria/ma_search.c2
-rw-r--r--storage/maria/ma_test1.c10
-rw-r--r--storage/maria/unittest/ma_control_file-t.c2
-rw-r--r--storage/maria/unittest/ma_maria_log_cleanup.c2
-rw-r--r--storage/maria/unittest/ma_pagecache_consist.c7
-rw-r--r--storage/maria/unittest/ma_pagecache_rwconsist.c7
-rw-r--r--storage/maria/unittest/ma_pagecache_rwconsist2.c7
-rw-r--r--storage/maria/unittest/ma_pagecache_single.c7
-rw-r--r--storage/maria/unittest/ma_test_loghandler_purge-t.c2
-rw-r--r--storage/myisam/ft_boolean_search.c6
-rw-r--r--storage/myisam/ft_myisam.c4
-rw-r--r--storage/myisam/ft_parser.c2
-rw-r--r--storage/myisam/ft_stopwords.c6
-rw-r--r--storage/myisam/mi_cache.c12
-rw-r--r--storage/myisam/mi_key.c22
-rw-r--r--storage/myisam/mi_locking.c6
-rw-r--r--storage/myisam/mi_open.c6
-rw-r--r--storage/myisam/mi_preload.c4
-rw-r--r--storage/myisam/mi_test1.c10
-rw-r--r--storage/myisam/myisamdef.h2
-rw-r--r--storage/myisammrg/ha_myisammrg.cc8
-rw-r--r--storage/myisammrg/myrg_open.c5
-rw-r--r--storage/perfschema/pfs.cc18
-rw-r--r--storage/perfschema/pfs_digest.cc2
-rw-r--r--storage/perfschema/pfs_digest.h2
-rw-r--r--storage/perfschema/pfs_global.cc2
-rw-r--r--storage/perfschema/pfs_instr.cc2
-rw-r--r--storage/perfschema/pfs_instr_class.cc10
-rw-r--r--storage/perfschema/pfs_server.cc6
-rw-r--r--storage/perfschema/table_events_stages.cc2
-rw-r--r--storage/perfschema/table_events_statements.cc2
-rw-r--r--storage/perfschema/table_events_waits.cc4
-rw-r--r--storage/perfschema/table_host_cache.cc2
-rw-r--r--storage/perfschema/table_setup_consumers.cc2
-rw-r--r--storage/perfschema/table_setup_timers.cc2
-rw-r--r--storage/perfschema/table_threads.cc2
-rw-r--r--storage/perfschema/unittest/pfs-t.cc4
-rw-r--r--storage/rocksdb/CMakeLists.txt6
-rw-r--r--storage/sphinx/CMakeLists.txt7
-rw-r--r--storage/spider/CMakeLists.txt7
-rw-r--r--strings/ctype.c8
-rw-r--r--tests/mysql_client_test.c3
-rw-r--r--unittest/mysys/base64-t.c4
-rw-r--r--unittest/sql/mf_iocache-t.cc4
-rw-r--r--vio/viosocket.c26
257 files changed, 1514 insertions, 1543 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 4f7bd8ef7b6..a1e9d5db993 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -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))
diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c
index 9cf4cd957fd..81677ad551f 100644
--- a/client/mysql_plugin.c
+++ b/client/mysql_plugin.c
@@ -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++)
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index f025a618a70..7e5bb435eb4 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -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)))
{
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 61210d4022e..0854c890824 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -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);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 23af38cee2d..2c55fc381b1 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -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);
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 6da14aa1520..84bed92bbd4 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -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 */
}
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index 0a761edff4c..f1650a4b26a 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -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 ; )
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index f0ad2f40abc..83c5838f739 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -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),
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 52ff5a6ba5b..b19c7882183 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -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);
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake
index 48184947da5..afd56cd903a 100644
--- a/cmake/os/Windows.cmake
+++ b/cmake/os/Windows.cmake
@@ -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")
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc
index b937cc6fa1a..6fb4154c6ca 100644
--- a/extra/innochecksum.cc
+++ b/extra/innochecksum.cc
@@ -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 ");
diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc
index e8881b9604e..847ba4e60e0 100644
--- a/extra/mariabackup/backup_mysql.cc
+++ b/extra/mariabackup/backup_mysql.cc
@@ -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;
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 6b92931d2bc..144831e03d2 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -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__)
diff --git a/extra/yassl/src/cert_wrapper.cpp b/extra/yassl/src/cert_wrapper.cpp
index 1092e428351..3cfa87b0d80 100644
--- a/extra/yassl/src/cert_wrapper.cpp
+++ b/extra/yassl/src/cert_wrapper.cpp
@@ -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(),
diff --git a/extra/yassl/src/socket_wrapper.cpp b/extra/yassl/src/socket_wrapper.cpp
index 9b099973578..a539adab1da 100644
--- a/extra/yassl/src/socket_wrapper.cpp
+++ b/extra/yassl/src/socket_wrapper.cpp
@@ -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);
}
diff --git a/include/m_ctype.h b/include/m_ctype.h
index da52b4c15a0..565eab9168f 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -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);
diff --git a/include/my_compare.h b/include/my_compare.h
index 12f9971d49b..f53d00ec453 100644
--- a/include/my_compare.h
+++ b/include/my_compare.h
@@ -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);
diff --git a/include/my_pthread.h b/include/my_pthread.h
index ecb201a60da..d51951f3904 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -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));
diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h
index cb817fb43a6..da22be202ac 100644
--- a/include/my_stacktrace.h
+++ b/include/my_stacktrace.h
@@ -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);
diff --git a/include/my_sys.h b/include/my_sys.h
index 6c738d6c854..8ebc45bae95 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -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 */
diff --git a/include/my_time.h b/include/my_time.h
index 1e99b14421d..661e9fa8020 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -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);
diff --git a/include/mysql.h.pp b/include/mysql.h.pp
index 994c7e59fba..e36131b93d2 100644
--- a/include/mysql.h.pp
+++ b/include/mysql.h.pp
@@ -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);
diff --git a/include/mysql/psi/mysql_socket.h b/include/mysql/psi/mysql_socket.h
index 64531e5c35e..5eee4c1eae6 100644
--- a/include/mysql/psi/mysql_socket.h
+++ b/include/mysql/psi/mysql_socket.h
@@ -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;
}
diff --git a/include/mysql/psi/mysql_statement.h b/include/mysql/psi/mysql_statement.h
index 05016130af7..2c59b50aa63 100644
--- a/include/mysql/psi/mysql_statement.h
+++ b/include/mysql/psi/mysql_statement.h
@@ -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;
}
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 7d0190b1ca7..e8971e7b3cb 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -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 */
diff --git a/include/violite.h b/include/violite.h
index b6d0e130f0d..55f8328df47 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -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 */
diff --git a/libmysqld/libmysql.c b/libmysqld/libmysql.c
index db6fdaee206..b3ef96698ff 100644
--- a/libmysqld/libmysql.c
+++ b/libmysqld/libmysql.c
@@ -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;
}
}
diff --git a/mysys/hash.c b/mysys/hash.c
index 57242735d99..d9952afe318 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -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);
diff --git a/mysys/lf_hash.c b/mysys/lf_hash.c
index 6b3fa78475d..a7c07679993 100644
--- a/mysys/lf_hash.c
+++ b/mysys/lf_hash.c
@@ -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 */
diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c
index 4dd0f7500aa..62d2b0a210c 100644
--- a/mysys/mf_iocache.c
+++ b/mysys/mf_iocache.c
@@ -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;
}
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 2f0f2bf05c0..edf8cd3be8a 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -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));
diff --git a/mysys/my_compare.c b/mysys/my_compare.c
index 5ba1b409abb..4d384936a55 100644
--- a/mysys/my_compare.c
+++ b/mysys/my_compare.c
@@ -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,
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 9e617366ed5..830b7f42473 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -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;
}
diff --git a/mysys/my_wincond.c b/mysys/my_wincond.c
index 54b272d7025..514e9a92ecf 100644
--- a/mysys/my_wincond.c
+++ b/mysys/my_wincond.c
@@ -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;
}
diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c
index 398ade7ad59..cc759d38664 100644
--- a/mysys/stacktrace.c
+++ b/mysys/stacktrace.c
@@ -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);
}
diff --git a/mysys/string.c b/mysys/string.c
index a0fa3a02e17..18c5f4ec9af 100644
--- a/mysys/string.c
+++ b/mysys/string.c
@@ -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;
diff --git a/plugin/auth_gssapi/server_plugin.cc b/plugin/auth_gssapi/server_plugin.cc
index 6ffcf5c65c1..b991c764f05 100644
--- a/plugin/auth_gssapi/server_plugin.cc
+++ b/plugin/auth_gssapi/server_plugin.cc
@@ -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;
}
diff --git a/plugin/auth_gssapi/sspi_errmsg.cc b/plugin/auth_gssapi/sspi_errmsg.cc
index 961ef51f42e..8e59da6f1ed 100644
--- a/plugin/auth_gssapi/sspi_errmsg.cc
+++ b/plugin/auth_gssapi/sspi_errmsg.cc
@@ -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)
{
diff --git a/plugin/auth_gssapi/sspi_server.cc b/plugin/auth_gssapi/sspi_server.cc
index 73c74c2e200..140c6adf733 100644
--- a/plugin/auth_gssapi/sspi_server.cc
+++ b/plugin/auth_gssapi/sspi_server.cc
@@ -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");
diff --git a/plugin/aws_key_management/aws_key_management_plugin.cc b/plugin/aws_key_management/aws_key_management_plugin.cc
index 60ca6fd1ff3..b99beb0774d 100644
--- a/plugin/aws_key_management/aws_key_management_plugin.cc
+++ b/plugin/aws_key_management/aws_key_management_plugin.cc
@@ -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);
diff --git a/plugin/feedback/url_http.cc b/plugin/feedback/url_http.cc
index 4851097e63f..76aef909756 100644
--- a/plugin/feedback/url_http.cc
+++ b/plugin/feedback/url_http.cc
@@ -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);
diff --git a/plugin/win_auth_client/common.cc b/plugin/win_auth_client/common.cc
index 30a8e0b3b13..1c872c07e14 100644
--- a/plugin/win_auth_client/common.cc
+++ b/plugin/win_auth_client/common.cc
@@ -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';
diff --git a/plugin/win_auth_client/handshake.h b/plugin/win_auth_client/handshake.h
index adab4715c99..bbad5ca36bc 100644
--- a/plugin/win_auth_client/handshake.h
+++ b/plugin/win_auth_client/handshake.h
@@ -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.
diff --git a/plugin/win_auth_client/handshake_client.cc b/plugin/win_auth_client/handshake_client.cc
index 856dda76217..7969a6f3c49 100644
--- a/plugin/win_auth_client/handshake_client.cc
+++ b/plugin/win_auth_client/handshake_client.cc
@@ -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)
diff --git a/sql-common/client.c b/sql-common/client.c
index b7a23e722f4..70edff9b737 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -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
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index c8d8453b62f..eac02581f0d 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -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];
diff --git a/sql-common/mysql_async.c b/sql-common/mysql_async.c
index 1bac16edd1e..a19955c49de 100644
--- a/sql-common/mysql_async.c
+++ b/sql-common/mysql_async.c
@@ -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;
diff --git a/sql/create_options.cc b/sql/create_options.cc
index d0a155c097f..7837beb516f 100644
--- a/sql/create_options.cc
+++ b/sql/create_options.cc
@@ -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;
diff --git a/sql/create_options.h b/sql/create_options.h
index 41e8abcb232..c82cb875743 100644
--- a/sql/create_options.h
+++ b/sql/create_options.h
@@ -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,
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc
index d44b313ec24..58a01a77849 100644
--- a/sql/debug_sync.cc
+++ b/sql/debug_sync.cc
@@ -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);
diff --git a/sql/des_key_file.cc b/sql/des_key_file.cc
index e7785a0a223..1f81fb9fd3f 100644
--- a/sql/des_key_file.cc
+++ b/sql/des_key_file.cc
@@ -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
diff --git a/sql/discover.cc b/sql/discover.cc
index a683166fb7f..7184cde5e03 100644
--- a/sql/discover.cc
+++ b/sql/discover.cc
@@ -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)) ||
diff --git a/sql/field.cc b/sql/field.cc
index bba6d9ee1e5..d9534021a0d 100644
--- a/sql/field.cc
+++ b/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;
diff --git a/sql/field.h b/sql/field.h
index d2274aaf7e8..d5d49bed551 100644
--- a/sql/field.h
+++ b/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); }
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index db5c9429954..4ab0f330814 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -389,7 +389,7 @@ static void do_field_varbinary_pre50(Copy_field *copy)
copy->from_field->val_str(&copy->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);
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 4cf2a00dbc4..00dfa08bba8 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -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
diff --git a/sql/gcalc_slicescan.cc b/sql/gcalc_slicescan.cc
index da70daea4a8..ce1f4394ebd 100644
--- a/sql/gcalc_slicescan.cc
+++ b/sql/gcalc_slicescan.cc
@@ -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)
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 0df2c748ccc..12ec49f0e5a 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -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. */
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 66a70348cfd..9ee767d89d4 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -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
diff --git a/sql/handler.cc b/sql/handler.cc
index db5a7b53684..75bc1985483 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -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);
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 0e60dde893c..56bd407f1dd 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -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);
diff --git a/sql/innodb_priv.h b/sql/innodb_priv.h
index 27aa9ac8645..7fbaa7cfc2f 100644
--- a/sql/innodb_priv.h
+++ b/sql/innodb_priv.h
@@ -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, ...);
diff --git a/sql/item.cc b/sql/item.cc
index b36c1518eb8..d33903a3803 100644
--- a/sql/item.cc
+++ b/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);
diff --git a/sql/item.h b/sql/item.h
index 82dfa3f8930..9f1307da576 100644
--- a/sql/item.h
+++ b/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);
};
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 780c60e4eb3..26c021f96b5 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -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;
}
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 8b47f09497f..9392b51e69b 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -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; }
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 7a623c5d77b..548ce3bac94 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -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)
diff --git a/sql/item_create.h b/sql/item_create.h
index b27946cfa46..5983a092cdc 100644
--- a/sql/item_create.h
+++ b/sql/item_create.h
@@ -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);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 3583b6aed62..3796beebc13 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -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);
diff --git a/sql/item_func.h b/sql/item_func.h
index 1f942ab1b55..536fe1bd5a7 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -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;}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index c768f7d9d1a..e342b6d5fb7 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -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);
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 354fd4cbf1a..bcc75131d02 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -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);
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 692d6bf9697..25a0f68f575 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -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();
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index ed4b2839170..a048f4d933d 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -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);
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 878179105be..744cdb388b0 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -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):
diff --git a/sql/key.cc b/sql/key.cc
index ab93e8a0437..93500633d08 100644
--- a/sql/key.cc
+++ b/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);
diff --git a/sql/keycaches.cc b/sql/keycaches.cc
index 6bfdb34157e..9db51ee1801 100644
--- a/sql/keycaches.cc
+++ b/sql/keycaches.cc
@@ -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;
diff --git a/sql/keycaches.h b/sql/keycaches.h
index 669d8d2355d..ff0380ba09a 100644
--- a/sql/keycaches.h
+++ b/sql/keycaches.h
@@ -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);
diff --git a/sql/log.cc b/sql/log.cc
index dfbe2c33e2e..8ed53a60195 100644
--- a/sql/log.cc
+++ b/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);
}
diff --git a/sql/log.h b/sql/log.h
index 6305dd97355..098824d9ec8 100644
--- a/sql/log.h
+++ b/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);
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 4005390b3de..cb4336afd77 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -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);
diff --git a/sql/log_event.h b/sql/log_event.h
index 5de72c55040..97e06c165b9 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -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
diff --git a/sql/mf_iocache_encr.cc b/sql/mf_iocache_encr.cc
index 546e0fe03a0..8d7cea4b050 100644
--- a/sql/mf_iocache_encr.cc
+++ b/sql/mf_iocache_encr.cc
@@ -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
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc
index c532a489684..ec3c85b34c4 100644
--- a/sql/multi_range_read.cc
+++ b/sql/multi_range_read.cc
@@ -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);
}
diff --git a/sql/my_decimal.cc b/sql/my_decimal.cc
index 6d1c746fca8..338f78d8f08 100644
--- a/sql/my_decimal.cc
+++ b/sql/my_decimal.cc
@@ -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)
{
diff --git a/sql/my_decimal.h b/sql/my_decimal.h
index 918213568fc..775617dce0f 100644
--- a/sql/my_decimal.h
+++ b/sql/my_decimal.h
@@ -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;
diff --git a/sql/my_json_writer.cc b/sql/my_json_writer.cc
index 1d61986034a..d219e88b98b 100644
--- a/sql/my_json_writer.cc
+++ b/sql/my_json_writer.cc
@@ -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
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 073788370f1..15353e4729a 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -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;
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 3387ae7c458..bb22753bbf1 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -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;
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index fd0139c1e03..cab9b0ede69 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -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;
}
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 636e9bd496a..e783ee9bff4 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -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;
diff --git a/sql/opt_split.cc b/sql/opt_split.cc
index 8fb8b787299..0cb76f03917 100644
--- a/sql/opt_split.cc
+++ b/sql/opt_split.cc
@@ -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);
diff --git a/sql/parse_file.cc b/sql/parse_file.cc
index aedb7a4f0af..90d766f15d2 100644
--- a/sql/parse_file.cc
+++ b/sql/parse_file.cc
@@ -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)
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 636e0db437a..5939da09eae 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -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");
diff --git a/sql/partition_info.h b/sql/partition_info.h
index 4a37008811a..26955682dda 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -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);
diff --git a/sql/password.c b/sql/password.c
index 47f4fd1d422..5e9684acb25 100644
--- a/sql/password.c
+++ b/sql/password.c
@@ -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)
diff --git a/sql/protocol.cc b/sql/protocol.cc
index fae399e66e2..032e79c9289 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -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);
}
diff --git a/sql/proxy_protocol.cc b/sql/proxy_protocol.cc
index d77e6ca8d34..dbdb1566bc7 100644
--- a/sql/proxy_protocol.cc
+++ b/sql/proxy_protocol.cc
@@ -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:
diff --git a/sql/records.cc b/sql/records.cc
index 650a51f7f37..ac84ca84ab6 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -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;
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 20290e8bad8..68c7158e9e5 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -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;
diff --git a/sql/repl_failsafe.h b/sql/repl_failsafe.h
index c3584fb17f2..967d81bcf0d 100644
--- a/sql/repl_failsafe.h
+++ b/sql/repl_failsafe.h
@@ -41,7 +41,7 @@ extern HASH slave_list;
bool show_slave_hosts(THD* thd);
void init_slave_list();
void end_slave_list();
-int register_slave(THD* thd, uchar* packet, uint packet_length);
+int register_slave(THD* thd, uchar* packet, size_t packet_length);
void unregister_slave(THD* thd, bool only_mine, bool need_mutex);
#endif /* HAVE_REPLICATION */
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index 9661e0b0353..55a66719e56 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -1360,7 +1360,7 @@ Master_info_index::get_master_info(const LEX_CSTRING *connection_name,
{
Master_info *mi;
char buff[MAX_CONNECTION_NAME+1], *res;
- uint buff_length;
+ size_t buff_length;
DBUG_ENTER("get_master_info");
DBUG_PRINT("enter",
("connection_name: '%.*s'", (int) connection_name->length,
@@ -1914,7 +1914,7 @@ char *Domain_id_filter::as_string(enum_list_type type)
return NULL;
// Store the total number of elements followed by the individual elements.
- ulong cur_len= sprintf(buf, "%u", ids->elements);
+ size_t cur_len= sprintf(buf, "%u", ids->elements);
sz-= cur_len;
for (uint i= 0; i < ids->elements; i++)
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index 9c1892e0c6c..58711078db6 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -414,7 +414,7 @@ void show_sql_type(enum_field_types type, uint16 metadata, String *str, CHARSET_
case MYSQL_TYPE_VARCHAR_COMPRESSED:
{
CHARSET_INFO *cs= str->charset();
- uint32 length=
+ size_t length=
cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
"varchar(%u)%s", metadata,
type == MYSQL_TYPE_VARCHAR_COMPRESSED ? " compressed"
@@ -427,7 +427,7 @@ void show_sql_type(enum_field_types type, uint16 metadata, String *str, CHARSET_
{
CHARSET_INFO *cs= str->charset();
int bit_length= 8 * (metadata >> 8) + (metadata & 0xFF);
- uint32 length=
+ size_t length=
cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
"bit(%d)", bit_length);
str->length(length);
@@ -437,7 +437,7 @@ void show_sql_type(enum_field_types type, uint16 metadata, String *str, CHARSET_
case MYSQL_TYPE_DECIMAL:
{
CHARSET_INFO *cs= str->charset();
- uint32 length=
+ size_t length=
cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
"decimal(%d,?)/*old*/", metadata);
str->length(length);
@@ -447,7 +447,7 @@ void show_sql_type(enum_field_types type, uint16 metadata, String *str, CHARSET_
case MYSQL_TYPE_NEWDECIMAL:
{
CHARSET_INFO *cs= str->charset();
- uint32 length=
+ size_t length=
cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
"decimal(%d,%d)", metadata >> 8, metadata & 0xff);
str->length(length);
@@ -503,7 +503,7 @@ void show_sql_type(enum_field_types type, uint16 metadata, String *str, CHARSET_
*/
CHARSET_INFO *cs= str->charset();
uint bytes= (((metadata >> 4) & 0x300) ^ 0x300) + (metadata & 0x00ff);
- uint32 length=
+ size_t length=
cs->cset->snprintf(cs, (char*) str->ptr(), str->alloced_length(),
"char(%d)", bytes / field_cs->mbmaxlen);
str->length(length);
diff --git a/sql/semisync_master.cc b/sql/semisync_master.cc
index 5e83847edf9..3c88bdddad4 100644
--- a/sql/semisync_master.cc
+++ b/sql/semisync_master.cc
@@ -99,8 +99,7 @@ Active_tranx::~Active_tranx()
m_num_entries = 0;
}
-unsigned int Active_tranx::calc_hash(const unsigned char *key,
- unsigned int length)
+unsigned int Active_tranx::calc_hash(const unsigned char *key, size_t length)
{
unsigned int nr = 1, nr2 = 4;
diff --git a/sql/semisync_master.h b/sql/semisync_master.h
index a58c1a7ae6e..3b05d9e0348 100644
--- a/sql/semisync_master.h
+++ b/sql/semisync_master.h
@@ -310,7 +310,7 @@ private:
inline void assert_lock_owner();
- inline unsigned int calc_hash(const unsigned char *key,unsigned int length);
+ inline unsigned int calc_hash(const unsigned char *key, size_t length);
unsigned int get_hash_value(const char *log_file_name, my_off_t log_file_pos);
int compare(const char *log_file_name1, my_off_t log_file_pos1,
diff --git a/sql/semisync_master_ack_receiver.cc b/sql/semisync_master_ack_receiver.cc
index aa588a5f300..ac17c7de40b 100644
--- a/sql/semisync_master_ack_receiver.cc
+++ b/sql/semisync_master_ack_receiver.cc
@@ -252,7 +252,7 @@ void Ack_receiver::run()
max_fd= get_slave_sockets(&read_fds, &slave_count);
m_slaves_changed= false;
- DBUG_PRINT("info", ("fd count %u, max_fd %d", slave_count, max_fd));
+ DBUG_PRINT("info", ("fd count %u, max_fd %d", slave_count,(int) max_fd));
}
struct timeval tv= {1, 0};
diff --git a/sql/semisync_slave.cc b/sql/semisync_slave.cc
index 2d77ee7b10c..86d0176dac1 100644
--- a/sql/semisync_slave.cc
+++ b/sql/semisync_slave.cc
@@ -148,9 +148,9 @@ void Repl_semi_sync_slave::kill_connection(MYSQL *mysql)
mysql_close(kill_mysql);
return;
}
- uint kill_buffer_length = my_snprintf(kill_buffer, 30, "KILL %lu",
+ size_t kill_buffer_length = my_snprintf(kill_buffer, 30, "KILL %lu",
mysql->thread_id);
- mysql_real_query(kill_mysql, kill_buffer, kill_buffer_length);
+ mysql_real_query(kill_mysql, kill_buffer, (ulong)kill_buffer_length);
mysql_close(kill_mysql);
}
@@ -165,7 +165,7 @@ int Repl_semi_sync_slave::request_transmit(Master_info *mi)
return 0;
query= "SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled'";
- if (mysql_real_query(mysql, query, strlen(query)) ||
+ if (mysql_real_query(mysql, query, (ulong)strlen(query)) ||
!(res= mysql_store_result(mysql)))
{
sql_print_error("Execution failed on master: %s, error :%s", query, mysql_error(mysql));
@@ -190,7 +190,7 @@ int Repl_semi_sync_slave::request_transmit(Master_info *mi)
replication
*/
query= "SET @rpl_semi_sync_slave= 1";
- if (mysql_real_query(mysql, query, strlen(query)))
+ if (mysql_real_query(mysql, query, (ulong)strlen(query)))
{
sql_print_error("Set 'rpl_semi_sync_slave=1' on master failed");
return 1;
@@ -212,7 +212,7 @@ int Repl_semi_sync_slave::slave_reply(Master_info *mi)
+ REPLY_BINLOG_POS_LEN
+ REPLY_BINLOG_NAME_LEN];
int reply_res = 0;
- int name_len = strlen(binlog_filename);
+ size_t name_len = strlen(binlog_filename);
DBUG_ENTER("Repl_semi_sync_slave::slave_reply");
diff --git a/sql/session_tracker.cc b/sql/session_tracker.cc
index 51888913983..b59475645fa 100644
--- a/sql/session_tracker.cc
+++ b/sql/session_tracker.cc
@@ -419,7 +419,6 @@ bool Session_sysvars_tracker::vars_list::parse_var_list(THD *thd,
{
sys_var *svar;
LEX_CSTRING var;
- uint not_used;
lasts= (char *) memchr(token, separator, rest);
@@ -433,7 +432,7 @@ bool Session_sysvars_tracker::vars_list::parse_var_list(THD *thd,
var.length= rest;
/* Remove leading/trailing whitespace. */
- trim_whitespace(char_set, &var, &not_used);
+ trim_whitespace(char_set, &var);
if(!strcmp(var.str, "*"))
{
@@ -501,7 +500,6 @@ bool Session_sysvars_tracker::check_var_list(THD *thd,
for (;;)
{
LEX_CSTRING var;
- uint not_used;
lasts= (char *) memchr(token, separator, rest);
@@ -515,7 +513,7 @@ bool Session_sysvars_tracker::check_var_list(THD *thd,
var.length= rest;
/* Remove leading/trailing whitespace. */
- trim_whitespace(char_set, &var, &not_used);
+ trim_whitespace(char_set, &var);
if(!strcmp(var.str, "*") &&
!find_sys_var_ex(thd, var.str, var.length, throw_error, true))
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 91224421117..1bdbd4e1f6e 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -673,7 +673,7 @@ SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted, enum enum_var_type scope)
0 Unknown variable (error message is given)
*/
-sys_var *intern_find_sys_var(const char *str, uint length)
+sys_var *intern_find_sys_var(const char *str, size_t length)
{
sys_var *var;
@@ -853,7 +853,7 @@ set_var::set_var(THD *thd, enum_var_type type_arg, sys_var *var_arg,
// names are utf8
if (!(value= new (thd->mem_root) Item_string_sys(thd,
item->field_name.str,
- item->field_name.length)))
+ (uint)item->field_name.length)))
value=value_arg; /* Give error message later */
}
else
diff --git a/sql/slave.cc b/sql/slave.cc
index d969f1c20b8..86c9105e1a6 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1590,7 +1590,7 @@ const char *print_slave_db_safe(const char* db)
int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
const char *default_val)
{
- uint length;
+ size_t length;
DBUG_ENTER("init_strvar_from_file");
if ((length=my_b_gets(f,var, max_size)))
@@ -2200,7 +2200,7 @@ when it try to get the value of TIME_ZONE global variable from master.";
if (++dbug_count < 3)
goto heartbeat_network_error;
});
- if (mysql_real_query(mysql, query, strlen(query)))
+ if (mysql_real_query(mysql, query, (ulong)strlen(query)))
{
if (check_io_slave_killed(mi, NULL))
goto slave_killed_err;
@@ -2248,7 +2248,7 @@ when it try to get the value of TIME_ZONE global variable from master.";
Once the first FD will be received its alg descriptor will replace
the being queried one.
*/
- rc= mysql_real_query(mysql, query, strlen(query));
+ rc= mysql_real_query(mysql, query,(ulong)strlen(query));
if (rc != 0)
{
if (check_io_slave_killed(mi, NULL))
@@ -2826,7 +2826,7 @@ int register_slave_on_master(MYSQL* mysql, Master_info *mi,
bool *suppress_warnings)
{
uchar buf[1024], *pos= buf;
- uint report_host_len=0, report_user_len=0, report_password_len=0;
+ size_t report_host_len=0, report_user_len=0, report_password_len=0;
DBUG_ENTER("register_slave_on_master");
*suppress_warnings= FALSE;
@@ -2834,7 +2834,7 @@ int register_slave_on_master(MYSQL* mysql, Master_info *mi,
report_host_len= strlen(report_host);
if (report_host_len > HOSTNAME_LENGTH)
{
- sql_print_warning("The length of report_host is %d. "
+ sql_print_warning("The length of report_host is %zu. "
"It is larger than the max length(%d), so this "
"slave cannot be registered to the master.",
report_host_len, HOSTNAME_LENGTH);
@@ -2845,7 +2845,7 @@ int register_slave_on_master(MYSQL* mysql, Master_info *mi,
report_user_len= strlen(report_user);
if (report_user_len > USERNAME_LENGTH)
{
- sql_print_warning("The length of report_user is %d. "
+ sql_print_warning("The length of report_user is %zu. "
"It is larger than the max length(%d), so this "
"slave cannot be registered to the master.",
report_user_len, USERNAME_LENGTH);
@@ -2856,7 +2856,7 @@ int register_slave_on_master(MYSQL* mysql, Master_info *mi,
report_password_len= strlen(report_password);
if (report_password_len > MAX_PASSWORD_LENGTH)
{
- sql_print_warning("The length of report_password is %d. "
+ sql_print_warning("The length of report_password is %zu. "
"It is larger than the max length(%d), so this "
"slave cannot be registered to the master.",
report_password_len, MAX_PASSWORD_LENGTH);
@@ -2877,7 +2877,7 @@ int register_slave_on_master(MYSQL* mysql, Master_info *mi,
/* The master will fill in master_id */
int4store(pos, 0); pos+= 4;
- if (simple_command(mysql, COM_REGISTER_SLAVE, buf, (size_t) (pos- buf), 0))
+ if (simple_command(mysql, COM_REGISTER_SLAVE, buf, (ulong) (pos- buf), 0))
{
if (mysql_errno(mysql) == ER_NET_READ_INTERRUPTED)
{
@@ -3144,7 +3144,7 @@ void show_master_info_get_fields(THD *thd, List<Item> *field_list,
mem_root);
field_list->push_back(new (mem_root)
Item_empty_string(thd, "Gtid_Slave_Pos",
- gtid_pos_length),
+ (uint)gtid_pos_length),
mem_root);
}
DBUG_VOID_RETURN;
diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc
index 0fd6fe92d1f..4f7cf1557e4 100644
--- a/sql/sp_cache.cc
+++ b/sql/sp_cache.cc
@@ -48,7 +48,7 @@ public:
return my_hash_insert(&m_hashtable, (const uchar *)sp);
}
- inline sp_head *lookup(char *name, uint namelen)
+ inline sp_head *lookup(char *name, size_t namelen)
{
return (sp_head *) my_hash_search(&m_hashtable, (const uchar *)name,
namelen);
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index d451f25db8a..b405dadb9fe 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -604,7 +604,6 @@ sp_head::set_stmt_end(THD *thd)
{
Lex_input_stream *lip= & thd->m_parser_state->m_lip; /* shortcut */
const char *end_ptr= lip->get_cpp_ptr(); /* shortcut */
- uint not_used;
/* Make the string of parameters. */
@@ -622,7 +621,7 @@ sp_head::set_stmt_end(THD *thd)
m_body.length= end_ptr - m_body_begin;
m_body.str= thd->strmake(m_body_begin, m_body.length);
- trim_whitespace(thd->charset(), &m_body, &not_used);
+ trim_whitespace(thd->charset(), &m_body);
/* Make the string of UTF-body. */
@@ -630,7 +629,7 @@ sp_head::set_stmt_end(THD *thd)
m_body_utf8.length= lip->get_body_utf8_length();
m_body_utf8.str= thd->strmake(lip->get_body_utf8_str(), m_body_utf8.length);
- trim_whitespace(thd->charset(), &m_body_utf8, &not_used);
+ trim_whitespace(thd->charset(), &m_body_utf8);
/*
Make the string of whole stored-program-definition query (in the
@@ -639,7 +638,7 @@ sp_head::set_stmt_end(THD *thd)
m_defstr.length= end_ptr - lip->get_cpp_buf();
m_defstr.str= thd->strmake(lip->get_cpp_buf(), m_defstr.length);
- trim_whitespace(thd->charset(), &m_defstr, &not_used);
+ trim_whitespace(thd->charset(), &m_defstr);
}
@@ -875,7 +874,7 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
rewritables.sort(cmp_rqp_locations);
- thd->query_name_consts= rewritables.elements();
+ thd->query_name_consts= (uint)rewritables.elements();
for (Rewritable_query_parameter **rqp= rewritables.front();
rqp <= rewritables.back(); rqp++)
@@ -898,7 +897,7 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
<db_name> Name of current database
<flags> Flags struct
*/
- int buf_len= (qbuf.length() + 1 + QUERY_CACHE_DB_LENGTH_SIZE +
+ size_t buf_len= (qbuf.length() + 1 + QUERY_CACHE_DB_LENGTH_SIZE +
thd->db.length + QUERY_CACHE_FLAGS_SIZE + 1);
if ((pbuf= (char *) alloc_root(thd->mem_root, buf_len)))
{
@@ -2332,7 +2331,7 @@ sp_head::backpatch_goto(THD *thd, sp_label *lab,sp_label *lab_begin_block)
}
if (bp->instr_type == CPOP)
{
- int n= lab->ctx->diff_cursors(lab_begin_block->ctx, true);
+ uint n= lab->ctx->diff_cursors(lab_begin_block->ctx, true);
if (n == 0)
{
// Remove cpop instr
@@ -2349,7 +2348,7 @@ sp_head::backpatch_goto(THD *thd, sp_label *lab,sp_label *lab_begin_block)
}
if (bp->instr_type == HPOP)
{
- int n= lab->ctx->diff_handlers(lab_begin_block->ctx, true);
+ uint n= lab->ctx->diff_handlers(lab_begin_block->ctx, true);
if (n == 0)
{
// Remove hpop instr
@@ -2655,7 +2654,7 @@ sp_head::show_create_routine(THD *thd, const Sp_handler *sph)
Item_empty_string(thd, col1_caption, NAME_CHAR_LEN),
thd->mem_root);
fields.push_back(new (mem_root)
- Item_empty_string(thd, "sql_mode", sql_mode.length),
+ Item_empty_string(thd, "sql_mode", (uint)sql_mode.length),
thd->mem_root);
{
@@ -2666,7 +2665,7 @@ sp_head::show_create_routine(THD *thd, const Sp_handler *sph)
Item_empty_string *stmt_fld=
new (mem_root) Item_empty_string(thd, col3_caption,
- MY_MAX(m_defstr.length, 1024));
+ (uint)MY_MAX(m_defstr.length, 1024));
stmt_fld->maybe_null= TRUE;
@@ -3326,7 +3325,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
void
sp_instr_stmt::print(String *str)
{
- uint i, len;
+ size_t i, len;
/* stmt CMD "..." */
if (str->reserve(SP_STMT_PRINT_MAXLEN+SP_INSTR_UINT_MAXLEN+8))
@@ -3398,7 +3397,7 @@ void
sp_instr_set::print(String *str)
{
/* set name@offset ... */
- int rsrv = SP_INSTR_UINT_MAXLEN+6;
+ size_t rsrv = SP_INSTR_UINT_MAXLEN+6;
sp_variable *var = m_ctx->find_variable(m_offset);
/* 'var' should always be non-null, but just in case... */
@@ -3438,7 +3437,7 @@ void
sp_instr_set_row_field::print(String *str)
{
/* set name@offset[field_offset] ... */
- int rsrv= SP_INSTR_UINT_MAXLEN + 6 + 6 + 3;
+ size_t rsrv= SP_INSTR_UINT_MAXLEN + 6 + 6 + 3;
sp_variable *var= m_ctx->find_variable(m_offset);
DBUG_ASSERT(var);
DBUG_ASSERT(var->field_def.is_row());
@@ -3484,7 +3483,7 @@ void
sp_instr_set_row_field_by_name::print(String *str)
{
/* set name.field@offset["field"] ... */
- int rsrv= SP_INSTR_UINT_MAXLEN + 6 + 6 + 3 + 2;
+ size_t rsrv= SP_INSTR_UINT_MAXLEN + 6 + 6 + 3 + 2;
sp_variable *var= m_ctx->find_variable(m_offset);
DBUG_ASSERT(var);
DBUG_ASSERT(var->field_def.is_table_rowtype_ref() ||
@@ -3962,7 +3961,7 @@ sp_instr_cpush::print(String *str)
const LEX_CSTRING *cursor_name= m_ctx->find_cursor(m_cursor);
/* cpush name@offset */
- uint rsrv= SP_INSTR_UINT_MAXLEN+7;
+ size_t rsrv= SP_INSTR_UINT_MAXLEN+7;
if (cursor_name)
rsrv+= cursor_name->length;
@@ -4050,7 +4049,7 @@ sp_instr_copen::print(String *str)
const LEX_CSTRING *cursor_name= m_ctx->find_cursor(m_cursor);
/* copen name@offset */
- uint rsrv= SP_INSTR_UINT_MAXLEN+7;
+ size_t rsrv= SP_INSTR_UINT_MAXLEN+7;
if (cursor_name)
rsrv+= cursor_name->length;
@@ -4092,7 +4091,7 @@ sp_instr_cclose::print(String *str)
const LEX_CSTRING *cursor_name= m_ctx->find_cursor(m_cursor);
/* cclose name@offset */
- uint rsrv= SP_INSTR_UINT_MAXLEN+8;
+ size_t rsrv= SP_INSTR_UINT_MAXLEN+8;
if (cursor_name)
rsrv+= cursor_name->length;
@@ -4135,7 +4134,7 @@ sp_instr_cfetch::print(String *str)
const LEX_CSTRING *cursor_name= m_ctx->find_cursor(m_cursor);
/* cfetch name@offset vars... */
- uint rsrv= SP_INSTR_UINT_MAXLEN+8;
+ size_t rsrv= SP_INSTR_UINT_MAXLEN+8;
if (cursor_name)
rsrv+= cursor_name->length;
@@ -4390,7 +4389,7 @@ typedef struct st_sp_table
db_name\0table_name\0 - for temporary tables
*/
LEX_STRING qname;
- uint db_length, table_name_length;
+ size_t db_length, table_name_length;
bool temp; /* true if corresponds to a temporary table */
thr_lock_type lock_type; /* lock type used for prelocking */
uint lock_count;
diff --git a/sql/sp_head.h b/sql/sp_head.h
index e89d0d14a95..23717513af9 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -731,7 +731,7 @@ public:
void set_info(longlong created, longlong modified,
const st_sp_chistics &chistics, sql_mode_t sql_mode);
- void set_definer(const char *definer, uint definerlen)
+ void set_definer(const char *definer, size_t definerlen)
{
AUTHID tmp;
tmp.parse(definer, definerlen);
diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc
index d7bc26901b0..83d674e7500 100644
--- a/sql/sp_pcontext.cc
+++ b/sql/sp_pcontext.cc
@@ -171,12 +171,12 @@ uint sp_pcontext::diff_handlers(const sp_pcontext *ctx, bool exclusive) const
while (pctx && pctx != ctx)
{
- n+= pctx->m_handlers.elements();
+ n+= (uint)pctx->m_handlers.elements();
last_ctx= pctx;
pctx= pctx->parent_context();
}
if (pctx)
- return (exclusive && last_ctx ? n - last_ctx->m_handlers.elements() : n);
+ return (exclusive && last_ctx ? n -(uint) last_ctx->m_handlers.elements() : n);
return 0; // Didn't find ctx
}
@@ -189,12 +189,12 @@ uint sp_pcontext::diff_cursors(const sp_pcontext *ctx, bool exclusive) const
while (pctx && pctx != ctx)
{
- n+= pctx->m_cursors.elements();
+ n+= (uint)pctx->m_cursors.elements();
last_ctx= pctx;
pctx= pctx->parent_context();
}
if (pctx)
- return (exclusive && last_ctx ? n - last_ctx->m_cursors.elements() : n);
+ return (exclusive && last_ctx ? (uint)(n - last_ctx->m_cursors.elements()) : n);
return 0; // Didn't find ctx
}
@@ -202,7 +202,7 @@ uint sp_pcontext::diff_cursors(const sp_pcontext *ctx, bool exclusive) const
sp_variable *sp_pcontext::find_variable(const LEX_CSTRING *name,
bool current_scope_only) const
{
- uint i= m_vars.elements() - m_pboundary;
+ size_t i= m_vars.elements() - m_pboundary;
while (i--)
{
@@ -392,7 +392,7 @@ bool sp_pcontext::add_condition(THD *thd,
sp_condition_value *sp_pcontext::find_condition(const LEX_CSTRING *name,
bool current_scope_only) const
{
- uint i= m_conditions.elements();
+ size_t i= m_conditions.elements();
while (i--)
{
@@ -605,7 +605,7 @@ const sp_pcursor *sp_pcontext::find_cursor(const LEX_CSTRING *name,
uint *poff,
bool current_scope_only) const
{
- uint i= m_cursors.elements();
+ uint i= (uint)m_cursors.elements();
while (i--)
{
diff --git a/sql/sp_pcontext.h b/sql/sp_pcontext.h
index 990ad35cb57..6a6920d89e1 100644
--- a/sql/sp_pcontext.h
+++ b/sql/sp_pcontext.h
@@ -673,7 +673,7 @@ public:
{ return m_cursor_offset; }
uint frame_cursor_count() const
- { return m_cursors.elements(); }
+ { return (uint)m_cursors.elements(); }
uint max_cursor_index() const
{ return m_max_cursor_index + (uint)m_cursors.elements(); }
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index eab0e10a3f0..4009f8dce30 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -413,7 +413,7 @@ bool sp_rcontext::push_cursor(THD *thd, sp_lex_keeper *lex_keeper)
}
-void sp_rcontext::pop_cursors(uint count)
+void sp_rcontext::pop_cursors(size_t count)
{
DBUG_ASSERT(m_ccount >= count);
diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h
index 8a03dca435d..c4f4cf182da 100644
--- a/sql/sp_rcontext.h
+++ b/sql/sp_rcontext.h
@@ -305,7 +305,7 @@ public:
/// Pop and delete given number of sp_cursor instance from the cursor stack.
///
/// @param count Number of cursors to pop & delete.
- void pop_cursors(uint count);
+ void pop_cursors(size_t count);
void pop_all_cursors()
{ pop_cursors(m_ccount); }
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 2a07ef2ecbe..255ba3f0647 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -142,7 +142,7 @@ static void get_point(double *x, double *y, const char *data)
/***************************** Geometry *******************************/
-Geometry::Class_info *Geometry::find_class(const char *name, uint32 len)
+Geometry::Class_info *Geometry::find_class(const char *name, size_t len)
{
for (Class_info **cur_rt= ci_collection;
cur_rt < ci_collection_end; cur_rt++)
diff --git a/sql/spatial.h b/sql/spatial.h
index 901544b6916..5818607de26 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -347,7 +347,7 @@ protected:
return ((type_id < wkb_point) || (type_id > wkb_last)) ?
NULL : ci_collection[type_id];
}
- static Class_info *find_class(const char *name, uint32 len);
+ static Class_info *find_class(const char *name, size_t len);
const char *append_points(String *txt, uint32 n_points,
const char *data, uint32 offset) const;
bool create_point(String *result, const char *data) const;
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 3964424af62..b47dbef0dc5 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -258,7 +258,7 @@ class ACL_USER :public ACL_USER_BASE
{
public:
acl_host_and_ip host;
- uint hostname_length;
+ size_t hostname_length;
USER_RESOURCES user_resource;
uint8 salt[SCRAMBLE_LENGTH + 1]; // scrambled password in binary form
uint8 salt_len; // 0 - no password, 4 - 3.20, 8 - 4.0, 20 - 4.1.1
@@ -744,7 +744,7 @@ static ACL_ROLE *find_acl_role(const char *user);
static ROLE_GRANT_PAIR *find_role_grant_pair(const LEX_CSTRING *u, const LEX_CSTRING *h, const LEX_CSTRING *r);
static ACL_USER_BASE *find_acl_user_base(const char *user, const char *host);
static bool update_user_table(THD *, const User_table &, const char *, const char *, const
- char *, uint);
+ char *, size_t new_password_len);
static bool acl_load(THD *thd, const Grant_tables& grant_tables);
static inline void get_grantor(THD *thd, char* grantor);
static bool add_role_user_mapping(const char *uname, const char *hname, const char *rname);
@@ -1545,7 +1545,7 @@ static bool validate_password(LEX_USER *user, THD *thd)
*/
static void
-set_user_salt(ACL_USER *acl_user, const char *password, uint password_len)
+set_user_salt(ACL_USER *acl_user, const char *password, size_t password_len)
{
if (password_len == SCRAMBLED_PASSWORD_CHAR_LENGTH)
{
@@ -1768,7 +1768,7 @@ bool acl_init(bool dont_read_acl_tables)
Choose from either native or old password plugins when assigning a password
*/
-static bool set_user_plugin (ACL_USER *user, int password_len)
+static bool set_user_plugin (ACL_USER *user, size_t password_len)
{
switch (password_len)
{
@@ -1962,7 +1962,7 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
char *password= const_cast<char*>("");
if (user_table.password())
password= get_field(&acl_memroot, user_table.password());
- uint password_len= safe_strlen(password);
+ size_t password_len= safe_strlen(password);
user.auth_string.str= safe_str(password);
user.auth_string.length= password_len;
set_user_salt(&user, password, password_len);
@@ -2715,7 +2715,7 @@ static void acl_update_role(const char *rolename, ulong privileges)
static void acl_update_user(const char *user, const char *host,
- const char *password, uint password_len,
+ const char *password, size_t password_len,
enum SSL_type ssl_type,
const char *ssl_cipher,
const char *x509_issuer,
@@ -2793,7 +2793,7 @@ static void acl_insert_role(const char *rolename, ulong privileges)
static void acl_insert_user(const char *user, const char *host,
- const char *password, uint password_len,
+ const char *password, size_t password_len,
enum SSL_type ssl_type,
const char *ssl_cipher,
const char *x509_issuer,
@@ -3409,6 +3409,7 @@ bool change_password(THD *thd, LEX_USER *user)
acl_user->auth_string.str= strmake_root(&acl_memroot, user->pwhash.str, user->pwhash.length);
acl_user->auth_string.length= user->pwhash.length;
set_user_salt(acl_user, user->pwhash.str, user->pwhash.length);
+
set_user_plugin(acl_user, user->pwhash.length);
}
else
@@ -3869,8 +3870,7 @@ bool hostname_requires_resolving(const char *hostname)
void set_authentication_plugin_from_password(const User_table& user_table,
- const char* password,
- uint password_length)
+ const char* password, size_t password_length)
{
if (password_length == SCRAMBLED_PASSWORD_CHAR_LENGTH)
{
@@ -3904,7 +3904,7 @@ void set_authentication_plugin_from_password(const User_table& user_table,
static bool update_user_table(THD *thd, const User_table& user_table,
const char *host, const char *user,
- const char *new_password, uint new_password_len)
+ const char *new_password, size_t new_password_len)
{
char user_key[MAX_KEY_LENGTH];
int error;
@@ -5016,7 +5016,7 @@ table_hash_search(const char *host, const char *ip, const char *db,
static GRANT_COLUMN *
-column_hash_search(GRANT_TABLE *t, const char *cname, uint length)
+column_hash_search(GRANT_TABLE *t, const char *cname, size_t length)
{
if (!my_hash_inited(&t->hash_columns))
return (GRANT_COLUMN*) 0;
@@ -7775,7 +7775,7 @@ err:
bool check_grant_column(THD *thd, GRANT_INFO *grant,
const char *db_name, const char *table_name,
- const char *name, uint length, Security_context *sctx)
+ const char *name, size_t length, Security_context *sctx)
{
GRANT_TABLE *grant_table;
GRANT_TABLE *grant_table_role;
@@ -7870,7 +7870,7 @@ err:
*/
bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref,
- const char *name, uint length)
+ const char *name, size_t length)
{
GRANT_INFO *grant;
const char *db_name;
@@ -12414,7 +12414,7 @@ static bool find_mpvio_user(MPVIO_EXT *mpvio)
}
mpvio->auth_info.user_name= sctx->user;
- mpvio->auth_info.user_name_length= strlen(sctx->user);
+ mpvio->auth_info.user_name_length= (uint)strlen(sctx->user);
mpvio->auth_info.auth_string= mpvio->acl_user->auth_string.str;
mpvio->auth_info.auth_string_length= (unsigned long) mpvio->acl_user->auth_string.length;
strmake_buf(mpvio->auth_info.authenticated_as, safe_str(mpvio->acl_user->user.str));
@@ -12452,7 +12452,7 @@ read_client_connect_attrs(char **ptr, char *end, CHARSET_INFO *from_cs)
if (length > 65535)
return true;
- if (PSI_CALL_set_thread_connect_attrs(*ptr, (size_t)length, from_cs) &&
+ if (PSI_CALL_set_thread_connect_attrs(*ptr, (uint)length, from_cs) &&
current_thd->variables.log_warnings)
sql_print_warning("Connection attributes of length %llu were truncated",
length);
@@ -12497,7 +12497,7 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
*passwd > 127 and become 2**32-127+ after casting to uint.
*/
uint passwd_len= (thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
- (uchar) (*passwd++) : strlen(passwd));
+ (uchar) (*passwd++) : (uint)strlen(passwd));
db+= passwd_len + 1;
/*
@@ -12511,7 +12511,7 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
DBUG_RETURN (1);
}
- uint db_len= strlen(db);
+ size_t db_len= strlen(db);
char *next_field= db + db_len + 1;
@@ -12711,7 +12711,7 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
char *user= end;
char *passwd= strend(user)+1;
- uint user_len= (uint)(passwd - user - 1), db_len;
+ size_t user_len= (size_t)(passwd - user - 1), db_len;
char *db= passwd;
char user_buff[USERNAME_LENGTH + 1]; // buffer to store user in utf8
uint dummy_errors;
@@ -12854,7 +12854,7 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
plugin_name(mpvio->plugin)) != 0)
{
mpvio->cached_client_reply.pkt= passwd;
- mpvio->cached_client_reply.pkt_len= passwd_len;
+ mpvio->cached_client_reply.pkt_len= (uint)passwd_len;
mpvio->cached_client_reply.plugin= client_plugin;
mpvio->status= MPVIO_EXT::RESTART;
return packet_error;
@@ -12883,7 +12883,7 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
}
*buff= (uchar*) passwd;
- return passwd_len;
+ return (ulong)passwd_len;
#else
return 0;
#endif
@@ -13529,8 +13529,8 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
my_ok(thd);
PSI_CALL_set_thread_user_host
- (thd->main_security_ctx.user, strlen(thd->main_security_ctx.user),
- thd->main_security_ctx.host_or_ip, strlen(thd->main_security_ctx.host_or_ip));
+ (thd->main_security_ctx.user, (uint)strlen(thd->main_security_ctx.user),
+ thd->main_security_ctx.host_or_ip, (uint)strlen(thd->main_security_ctx.host_or_ip));
/* Ready to handle queries */
DBUG_RETURN(0);
@@ -13660,7 +13660,7 @@ static int old_password_authenticate(MYSQL_PLUGIN_VIO *vio,
We need to figure out the correct scramble length here.
*/
if (pkt_len == SCRAMBLE_LENGTH_323 + 1)
- pkt_len= strnlen((char*)pkt, pkt_len);
+ pkt_len= (int)strnlen((char*)pkt, pkt_len);
if (pkt_len == 0) /* no password */
return info->auth_string[0] ? CR_AUTH_USER_CREDENTIALS : CR_OK;
diff --git a/sql/sql_acl.h b/sql/sql_acl.h
index bafb9ca23d8..a608ef0dd77 100644
--- a/sql/sql_acl.h
+++ b/sql/sql_acl.h
@@ -237,9 +237,9 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
bool any_combination_will_do, uint number, bool no_errors);
bool check_grant_column (THD *thd, GRANT_INFO *grant,
const char *db_name, const char *table_name,
- const char *name, uint length, Security_context *sctx);
+ const char *name, size_t length, Security_context *sctx);
bool check_column_grant_in_table_ref(THD *thd, TABLE_LIST * table_ref,
- const char *name, uint length);
+ const char *name, size_t length);
bool check_grant_all_columns(THD *thd, ulong want_access,
Field_iterator_table_ref *fields);
bool check_grant_routine(THD *thd, ulong want_access,
diff --git a/sql/sql_array.h b/sql/sql_array.h
index 341ea9a651b..cad7b0e1c48 100644
--- a/sql/sql_array.h
+++ b/sql/sql_array.h
@@ -191,9 +191,10 @@ public:
return *((Elem*)pop_dynamic(&array));
}
- void del(uint idx)
+ void del(size_t idx)
{
- delete_dynamic_element(&array, idx);
+ DBUG_ASSERT(idx <= array.max_element);
+ delete_dynamic_element(&array, (uint)idx);
}
size_t elements() const
@@ -204,7 +205,7 @@ public:
void elements(size_t num_elements)
{
DBUG_ASSERT(num_elements <= array.max_element);
- array.elements= num_elements;
+ array.elements= (uint)num_elements;
}
void clear()
@@ -220,12 +221,12 @@ public:
bool resize(size_t new_size, Elem default_val)
{
size_t old_size= elements();
- if (allocate_dynamic(&array, new_size))
+ if (allocate_dynamic(&array, (uint)new_size))
return true;
if (new_size > old_size)
{
- set_dynamic(&array, (uchar*)&default_val, new_size - 1);
+ set_dynamic(&array, (uchar*)&default_val, (uint)(new_size - 1));
/*for (size_t i= old_size; i != new_size; i++)
{
at(i)= default_val;
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 5fbf4ba4c81..0d76e469a82 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -245,7 +245,7 @@ static my_bool list_open_tables_callback(TDC_element *element,
list_open_tables_arg *arg)
{
const char *db= (char*) element->m_key;
- uint db_length= strlen(db);
+ size_t db_length= strlen(db);
const char *table_name= db + db_length + 1;
if (arg->db && my_strcasecmp(system_charset_info, arg->db, db))
@@ -644,7 +644,7 @@ close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
DBUG_ASSERT(!share->tmp_table);
char key[MAX_DBKEY_LENGTH];
- uint key_length= share->table_cache_key.length;
+ size_t key_length= share->table_cache_key.length;
const char *db= key;
const char *table_name= db + share->db.length + 1;
@@ -2404,7 +2404,7 @@ bool
Locked_tables_list::reopen_tables(THD *thd)
{
Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
- size_t reopen_count= 0;
+ uint reopen_count= 0;
MYSQL_LOCK *lock;
MYSQL_LOCK *merged_lock;
DBUG_ENTER("Locked_tables_list::reopen_tables");
@@ -5424,7 +5424,7 @@ static void update_field_dependencies(THD *thd, Field *field, TABLE *table)
static Field *
find_field_in_view(THD *thd, TABLE_LIST *table_list,
- const char *name, uint length,
+ const char *name, size_t length,
const char *item_name, Item **ref,
bool register_tree_change)
{
@@ -5505,8 +5505,7 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
*/
static Field *
-find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
- uint length, Item **ref, bool register_tree_change,
+find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name, size_t length, Item **ref, bool register_tree_change,
TABLE_LIST **actual_table)
{
List_iterator_fast<Natural_join_column>
@@ -5626,7 +5625,7 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
*/
Field *
-find_field_in_table(THD *thd, TABLE *table, const char *name, uint length,
+find_field_in_table(THD *thd, TABLE *table, const char *name, size_t length,
bool allow_rowid, uint *cached_field_index_ptr)
{
Field **field_ptr, *field;
@@ -5734,7 +5733,7 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, uint length,
Field *
find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
- const char *name, uint length,
+ const char *name, size_t length,
const char *item_name, const char *db_name,
const char *table_name, Item **ref,
bool check_privileges, bool allow_rowid,
@@ -5987,7 +5986,7 @@ find_field_in_tables(THD *thd, Item_ident *item,
const char *db= item->db_name;
const char *table_name= item->table_name;
const char *name= item->field_name.str;
- uint length= item->field_name.length;
+ size_t length= item->field_name.length;
char name_buff[SAFE_NAME_LEN+1];
TABLE_LIST *cur_table= first_table;
TABLE_LIST *actual_table;
@@ -8530,8 +8529,8 @@ my_bool mysql_rm_tmp_tables(void)
tmp_file_prefix_length))
{
char *ext= fn_ext(file->name);
- uint ext_len= strlen(ext);
- uint filePath_len= my_snprintf(filePath, sizeof(filePath),
+ size_t ext_len= strlen(ext);
+ size_t filePath_len= my_snprintf(filePath, sizeof(filePath),
"%s%c%s", tmpdir, FN_LIBCHAR,
file->name);
if (!strcmp(reg_ext, ext))
diff --git a/sql/sql_base.h b/sql/sql_base.h
index f2411c8b7ea..014eee56960 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -175,14 +175,14 @@ find_field_in_tables(THD *thd, Item_ident *item,
bool check_privileges, bool register_tree_change);
Field *
find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
- const char *name, uint length,
+ const char *name, size_t length,
const char *item_name, const char *db_name,
const char *table_name, Item **ref,
bool check_privileges, bool allow_rowid,
uint *cached_field_index_ptr,
bool register_tree_change, TABLE_LIST **actual_table);
Field *
-find_field_in_table(THD *thd, TABLE *table, const char *name, uint length,
+find_field_in_table(THD *thd, TABLE *table, const char *name, size_t length,
bool allow_rowid, uint *cached_field_index_ptr);
Field *
find_field_in_table_sef(TABLE *table, const char *name);
diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc
index aa1a1cd6941..00270fb6f32 100644
--- a/sql/sql_binlog.cc
+++ b/sql/sql_binlog.cc
@@ -140,7 +140,7 @@ void mysql_client_binlog_statement(THD* thd)
my_error(ER_SYNTAX_ERROR, MYF(0));
DBUG_VOID_RETURN;
}
- size_t decoded_len= my_base64_needed_decoded_length(coded_len);
+ size_t decoded_len= my_base64_needed_decoded_length((int)coded_len);
/*
option_bits will be changed when applying the event. But we don't expect
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index c340f4afc8b..968cd9970f5 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -817,10 +817,10 @@ inline Query_cache_block * Query_cache_block_table::block()
Query_cache_block method(s)
*****************************************************************************/
-void Query_cache_block::init(ulong block_length)
+void Query_cache_block::init(size_t block_length)
{
DBUG_ENTER("Query_cache_block::init");
- DBUG_PRINT("qcache", ("init block: %p length: %lu", this,
+ DBUG_PRINT("qcache", ("init block: %p length: %zu", this,
block_length));
length = block_length;
used = 0;
@@ -1037,7 +1037,7 @@ uchar *query_cache_query_get_key(const uchar *record, size_t *length,
/**
libmysql convenience wrapper to insert data into query cache.
*/
-void query_cache_insert(void *thd_arg, const char *packet, ulong length,
+void query_cache_insert(void *thd_arg, const char *packet, size_t length,
unsigned pkt_nr)
{
THD *thd= (THD*) thd_arg;
@@ -1053,7 +1053,7 @@ void query_cache_insert(void *thd_arg, const char *packet, ulong length,
return;
query_cache.insert(thd, &thd->query_cache_tls,
- packet, length,
+ packet, (size_t)length,
pkt_nr);
}
@@ -1064,7 +1064,7 @@ void query_cache_insert(void *thd_arg, const char *packet, ulong length,
void
Query_cache::insert(THD *thd, Query_cache_tls *query_cache_tls,
- const char *packet, ulong length,
+ const char *packet, size_t length,
unsigned pkt_nr)
{
DBUG_ENTER("Query_cache::insert");
@@ -1097,7 +1097,7 @@ Query_cache::insert(THD *thd, Query_cache_tls *query_cache_tls,
Query_cache_block *result= header->result();
DUMP(this);
- DBUG_PRINT("qcache", ("insert packet %lu bytes long",length));
+ DBUG_PRINT("qcache", ("insert packet %zu bytes long",length));
/*
On success, STRUCT_UNLOCK is done by append_result_data. Otherwise, we
@@ -1202,8 +1202,8 @@ void Query_cache::end_of_result(THD *thd)
BLOCK_LOCK_WR(query_block);
Query_cache_query *header= query_block->query();
Query_cache_block *last_result_block;
- ulong allign_size;
- ulong len;
+ size_t allign_size;
+ size_t len;
if (header->result() == 0)
{
@@ -1263,9 +1263,9 @@ void mysql_query_cache_invalidate4(THD *thd,
Query_cache methods
*****************************************************************************/
-Query_cache::Query_cache(ulong query_cache_limit_arg,
- ulong min_allocation_unit_arg,
- ulong min_result_data_size_arg,
+Query_cache::Query_cache(size_t query_cache_limit_arg,
+ size_t min_allocation_unit_arg,
+ size_t min_result_data_size_arg,
uint def_query_hash_size_arg,
uint def_table_hash_size_arg)
:query_cache_size(0),
@@ -1279,7 +1279,7 @@ Query_cache::Query_cache(ulong query_cache_limit_arg,
def_table_hash_size(ALIGN_SIZE(def_table_hash_size_arg)),
initialized(0)
{
- ulong min_needed= (ALIGN_SIZE(sizeof(Query_cache_block)) +
+ size_t min_needed= (ALIGN_SIZE(sizeof(Query_cache_block)) +
ALIGN_SIZE(sizeof(Query_cache_block_table)) +
ALIGN_SIZE(sizeof(Query_cache_query)) + 3);
set_if_bigger(min_allocation_unit,min_needed);
@@ -1288,11 +1288,11 @@ Query_cache::Query_cache(ulong query_cache_limit_arg,
}
-ulong Query_cache::resize(ulong query_cache_size_arg)
+size_t Query_cache::resize(size_t query_cache_size_arg)
{
- ulong new_query_cache_size;
+ size_t new_query_cache_size;
DBUG_ENTER("Query_cache::resize");
- DBUG_PRINT("qcache", ("from %lu to %lu",query_cache_size,
+ DBUG_PRINT("qcache", ("from %zu to %zu",query_cache_size,
query_cache_size_arg));
DBUG_ASSERT(initialized);
@@ -1346,7 +1346,7 @@ ulong Query_cache::resize(ulong query_cache_size_arg)
}
-ulong Query_cache::set_min_res_unit(ulong size)
+size_t Query_cache::set_min_res_unit(size_t size)
{
DBUG_ASSERT(size % 8 == 0);
if (size < min_allocation_unit)
@@ -1358,7 +1358,7 @@ ulong Query_cache::set_min_res_unit(ulong size)
void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
{
TABLE_COUNTER_TYPE local_tables;
- ulong tot_length;
+ size_t tot_length;
const char *query;
size_t query_length;
uint8 tables_type;
@@ -1446,8 +1446,8 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
DBUG_PRINT("qcache", ("\
long %d, 4.1: %d, eof: %d, bin_proto: %d, more results %d, pkt_nr: %d, \
CS client: %u, CS result: %u, CS conn: %u, limit: %llu, TZ: %p, \
-sql mode: 0x%llx, sort len: %llu, conncat len: %llu, div_precision: %lu, \
-def_week_frmt: %lu, in_trans: %d, autocommit: %d",
+sql mode: 0x%llx, sort len: %llu, conncat len: %llu, div_precision: %zu, \
+def_week_frmt: %zu, in_trans: %d, autocommit: %d",
(int)flags.client_long_flag,
(int)flags.client_protocol_41,
(int)flags.client_depr_eof,
@@ -1531,7 +1531,7 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
Query_cache_block::QUERY, local_tables);
if (query_block != 0)
{
- DBUG_PRINT("qcache", ("query block %p allocated, %lu",
+ DBUG_PRINT("qcache", ("query block %p allocated, %zu",
query_block, query_block->used));
Query_cache_query *header = query_block->query();
@@ -1609,7 +1609,7 @@ end:
@retval TRUE On error
*/
static bool
-send_data_in_chunks(NET *net, const uchar *packet, ulong len)
+send_data_in_chunks(NET *net, const uchar *packet, size_t len)
{
/*
On the client we may require more memory than max_allowed_packet
@@ -1625,7 +1625,7 @@ send_data_in_chunks(NET *net, const uchar *packet, ulong len)
for max_allowed_packet, but large enough to ensure there is no
unnecessary overhead from too many syscalls per result set.
*/
- static const ulong MAX_CHUNK_LENGTH= 1024*1024;
+ static const size_t MAX_CHUNK_LENGTH= 1024*1024;
while (len > MAX_CHUNK_LENGTH)
{
@@ -1706,7 +1706,7 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length)
#endif
Query_cache_block *result_block;
Query_cache_block_table *block_table, *block_table_end;
- ulong tot_length;
+ size_t tot_length;
Query_cache_query_flags flags;
const char *sql, *sql_end, *found_brace= 0;
DBUG_ENTER("Query_cache::send_result_to_client");
@@ -1944,8 +1944,8 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length)
DBUG_PRINT("qcache", ("\
long %d, 4.1: %d, eof: %d, bin_proto: %d, more results %d, pkt_nr: %d, \
CS client: %u, CS result: %u, CS conn: %u, limit: %llu, TZ: %p, \
-sql mode: 0x%llx, sort len: %llu, conncat len: %llu, div_precision: %lu, \
-def_week_frmt: %lu, in_trans: %d, autocommit: %d",
+sql mode: 0x%llx, sort len: %llu, conncat len: %llu, div_precision: %zu, \
+def_week_frmt: %zu, in_trans: %d, autocommit: %d",
(int)flags.client_long_flag,
(int)flags.client_protocol_41,
(int)flags.client_depr_eof,
@@ -2092,7 +2092,7 @@ lookup:
if (table->callback())
{
char qcache_se_key_name[FN_REFLEN + 10];
- uint qcache_se_key_len, db_length= strlen(table->db());
+ size_t qcache_se_key_len, db_length= strlen(table->db());
engine_data= table->engine_data();
qcache_se_key_len= build_normalized_name(qcache_se_key_name,
@@ -2106,16 +2106,16 @@ lookup:
table->suffix_length());
if (!(*table->callback())(thd, qcache_se_key_name,
- qcache_se_key_len, &engine_data))
+ (uint)qcache_se_key_len, &engine_data))
{
DBUG_PRINT("qcache", ("Handler does not allow caching for %.*s",
- qcache_se_key_len, qcache_se_key_name));
+ (int)qcache_se_key_len, qcache_se_key_name));
BLOCK_UNLOCK_RD(query_block);
if (engine_data != table->engine_data())
{
DBUG_PRINT("qcache",
("Handler require invalidation queries of %.*s %llu-%llu",
- qcache_se_key_len, qcache_se_key_name,
+ (int)qcache_se_key_len, qcache_se_key_name,
engine_data, table->engine_data()));
invalidate_table_internal(thd,
(uchar *) table->db(),
@@ -2155,7 +2155,7 @@ lookup:
THD_STAGE_INFO(thd, stage_sending_cached_result_to_client);
do
{
- DBUG_PRINT("qcache", ("Results (len: %lu used: %lu headers: %u)",
+ DBUG_PRINT("qcache", ("Results (len: %zu used: %zu headers: %u)",
result_block->length, result_block->used,
(uint) (result_block->headers_len()+
ALIGN_SIZE(sizeof(Query_cache_result)))));
@@ -2317,7 +2317,7 @@ void Query_cache::invalidate(THD *thd, TABLE *table,
DBUG_VOID_RETURN;
}
-void Query_cache::invalidate(THD *thd, const char *key, uint32 key_length,
+void Query_cache::invalidate(THD *thd, const char *key, size_t key_length,
my_bool using_transactions)
{
DBUG_ENTER("Query_cache::invalidate (key)");
@@ -2461,7 +2461,7 @@ void Query_cache::flush()
*/
-void Query_cache::pack(THD *thd, ulong join_limit, uint iteration_limit)
+void Query_cache::pack(THD *thd, size_t join_limit, uint iteration_limit)
{
DBUG_ENTER("Query_cache::pack");
@@ -2580,11 +2580,11 @@ void Query_cache::init()
}
-ulong Query_cache::init_cache()
+size_t Query_cache::init_cache()
{
- uint mem_bin_count, num, step;
- ulong mem_bin_size, prev_size, inc;
- ulong additional_data_size, max_mem_bin_size, approx_additional_data_size;
+ size_t mem_bin_count, num, step;
+ size_t mem_bin_size, prev_size, inc;
+ size_t additional_data_size, max_mem_bin_size, approx_additional_data_size;
int align;
DBUG_ENTER("Query_cache::init_cache");
@@ -2650,7 +2650,7 @@ ulong Query_cache::init_cache()
my_malloc_lock(query_cache_size+additional_data_size, MYF(0))))
goto err;
- DBUG_PRINT("qcache", ("cache length %lu, min unit %lu, %u bins",
+ DBUG_PRINT("qcache", ("cache length %zu, min unit %zu, %zu bins",
query_cache_size, min_allocation_unit, mem_bin_num));
steps = (Query_cache_memory_bin_step *) cache;
@@ -2674,9 +2674,9 @@ ulong Query_cache::init_cache()
mem_bin_size = max_mem_bin_size >> QUERY_CACHE_MEM_BIN_STEP_PWR2;
while (mem_bin_size > min_allocation_unit)
{
- ulong incr = (steps[step-1].size - mem_bin_size) / mem_bin_count;
- unsigned long size = mem_bin_size;
- for (uint i= mem_bin_count; i > 0; i--)
+ size_t incr = (steps[step-1].size - mem_bin_size) / mem_bin_count;
+ size_t size = mem_bin_size;
+ for (size_t i= mem_bin_count; i > 0; i--)
{
bins[num+i-1].init(size);
size += incr;
@@ -2699,9 +2699,9 @@ ulong Query_cache::init_cache()
steps[step].init(mem_bin_size, num + mem_bin_count - 1, inc);
{
- uint skiped = (min_allocation_unit - mem_bin_size)/inc;
- ulong size = mem_bin_size + inc*skiped;
- uint i = mem_bin_count - skiped;
+ size_t skiped = (min_allocation_unit - mem_bin_size)/inc;
+ size_t size = mem_bin_size + inc*skiped;
+ size_t i = mem_bin_count - skiped;
while (i-- > 0)
{
bins[num+i].init(size);
@@ -2902,7 +2902,7 @@ my_bool Query_cache::free_old_query()
void Query_cache::free_query_internal(Query_cache_block *query_block)
{
DBUG_ENTER("Query_cache::free_query_internal");
- DBUG_PRINT("qcache", ("free query %p %lu bytes result",
+ DBUG_PRINT("qcache", ("free query %p %zu bytes result",
query_block,
query_block->query()->length() ));
@@ -2972,7 +2972,7 @@ void Query_cache::free_query_internal(Query_cache_block *query_block)
void Query_cache::free_query(Query_cache_block *query_block)
{
DBUG_ENTER("Query_cache::free_query");
- DBUG_PRINT("qcache", ("free query %p %lu bytes result",
+ DBUG_PRINT("qcache", ("free query %p %zu bytes result",
query_block,
query_block->query()->length() ));
@@ -2987,18 +2987,18 @@ void Query_cache::free_query(Query_cache_block *query_block)
*****************************************************************************/
Query_cache_block *
-Query_cache::write_block_data(ulong data_len, uchar* data,
- ulong header_len,
+Query_cache::write_block_data(size_t data_len, uchar* data,
+ size_t header_len,
Query_cache_block::block_type type,
TABLE_COUNTER_TYPE ntab)
{
- ulong all_headers_len = (ALIGN_SIZE(sizeof(Query_cache_block)) +
+ size_t all_headers_len = (ALIGN_SIZE(sizeof(Query_cache_block)) +
ALIGN_SIZE(ntab*sizeof(Query_cache_block_table)) +
header_len);
- ulong len = data_len + all_headers_len;
- ulong align_len= ALIGN_SIZE(len);
+ size_t len = data_len + all_headers_len;
+ size_t align_len= ALIGN_SIZE(len);
DBUG_ENTER("Query_cache::write_block_data");
- DBUG_PRINT("qcache", ("data: %ld, header: %ld, all header: %ld",
+ DBUG_PRINT("qcache", ("data: %zd, header: %zd, all header: %zd",
data_len, header_len, all_headers_len));
Query_cache_block *block= allocate_block(MY_MAX(align_len,
min_allocation_unit),1, 0);
@@ -3016,33 +3016,33 @@ Query_cache::write_block_data(ulong data_len, uchar* data,
my_bool
Query_cache::append_result_data(Query_cache_block **current_block,
- ulong data_len, uchar* data,
+ size_t data_len, uchar* data,
Query_cache_block *query_block)
{
DBUG_ENTER("Query_cache::append_result_data");
- DBUG_PRINT("qcache", ("append %lu bytes to %p query",
+ DBUG_PRINT("qcache", ("append %zu bytes to %p query",
data_len, query_block));
if (query_block->query()->add(data_len) > query_cache_limit)
{
- DBUG_PRINT("qcache", ("size limit reached %lu > %lu",
+ DBUG_PRINT("qcache", ("size limit reached %zu > %zu",
query_block->query()->length(),
query_cache_limit));
DBUG_RETURN(0);
}
if (*current_block == 0)
{
- DBUG_PRINT("qcache", ("allocated first result data block %lu", data_len));
+ DBUG_PRINT("qcache", ("allocated first result data block %zu", data_len));
DBUG_RETURN(write_result_data(current_block, data_len, data, query_block,
Query_cache_block::RES_BEG));
}
Query_cache_block *last_block = (*current_block)->prev;
- DBUG_PRINT("qcache", ("lastblock %p len %lu used %lu",
+ DBUG_PRINT("qcache", ("lastblock %p len %zu used %zu",
last_block, last_block->length,
last_block->used));
my_bool success = 1;
- ulong last_block_free_space= last_block->length - last_block->used;
+ size_t last_block_free_space= last_block->length - last_block->used;
/*
We will first allocate and write the 'tail' of data, that doesn't fit
@@ -3051,8 +3051,8 @@ Query_cache::append_result_data(Query_cache_block **current_block,
*/
// Try join blocks if physically next block is free...
- ulong tail = data_len - last_block_free_space;
- ulong append_min = get_min_append_result_data_size();
+ size_t tail = data_len - last_block_free_space;
+ size_t append_min = get_min_append_result_data_size();
if (last_block_free_space < data_len &&
append_next_free_block(last_block,
MY_MAX(tail, append_min)))
@@ -3060,7 +3060,7 @@ Query_cache::append_result_data(Query_cache_block **current_block,
// If no space in last block (even after join) allocate new block
if (last_block_free_space < data_len)
{
- DBUG_PRINT("qcache", ("allocate new block for %lu bytes",
+ DBUG_PRINT("qcache", ("allocate new block for %zu bytes",
data_len-last_block_free_space));
Query_cache_block *new_block = 0;
success = write_result_data(&new_block, data_len-last_block_free_space,
@@ -3083,8 +3083,8 @@ Query_cache::append_result_data(Query_cache_block **current_block,
// Now finally write data to the last block
if (success && last_block_free_space > 0)
{
- ulong to_copy = MY_MIN(data_len,last_block_free_space);
- DBUG_PRINT("qcache", ("use free space %lub at block %p to copy %lub",
+ size_t to_copy = MY_MIN(data_len,last_block_free_space);
+ DBUG_PRINT("qcache", ("use free space %zub at block %p to copy %zub",
last_block_free_space,last_block, to_copy));
memcpy((uchar*) last_block + last_block->used, data, to_copy);
last_block->used+=to_copy;
@@ -3094,12 +3094,12 @@ Query_cache::append_result_data(Query_cache_block **current_block,
my_bool Query_cache::write_result_data(Query_cache_block **result_block,
- ulong data_len, uchar* data,
+ size_t data_len, uchar* data,
Query_cache_block *query_block,
Query_cache_block::block_type type)
{
DBUG_ENTER("Query_cache::write_result_data");
- DBUG_PRINT("qcache", ("data_len %lu",data_len));
+ DBUG_PRINT("qcache", ("data_len %zu",data_len));
/*
Reserve block(s) for filling
@@ -3125,8 +3125,8 @@ my_bool Query_cache::write_result_data(Query_cache_block **result_block,
do
{
block->type = type;
- ulong length = block->used - headers_len;
- DBUG_PRINT("qcache", ("write %lu byte in block %p",length,
+ size_t length = block->used - headers_len;
+ DBUG_PRINT("qcache", ("write %zu byte in block %p",length,
block));
memcpy((uchar*) block+headers_len, rest, length);
rest += length;
@@ -3166,16 +3166,16 @@ my_bool Query_cache::write_result_data(Query_cache_block **result_block,
DBUG_RETURN(success);
}
-inline ulong Query_cache::get_min_first_result_data_size()
+inline size_t Query_cache::get_min_first_result_data_size()
{
if (queries_in_cache < QUERY_CACHE_MIN_ESTIMATED_QUERIES_NUMBER)
return min_result_data_size;
- ulong avg_result = (query_cache_size - free_memory) / queries_in_cache;
+ size_t avg_result = (query_cache_size - free_memory) / queries_in_cache;
avg_result = MY_MIN(avg_result, query_cache_limit);
return MY_MAX(min_result_data_size, avg_result);
}
-inline ulong Query_cache::get_min_append_result_data_size()
+inline size_t Query_cache::get_min_append_result_data_size()
{
return min_result_data_size;
}
@@ -3184,25 +3184,25 @@ inline ulong Query_cache::get_min_append_result_data_size()
Allocate one or more blocks to hold data
*/
my_bool Query_cache::allocate_data_chain(Query_cache_block **result_block,
- ulong data_len,
+ size_t data_len,
Query_cache_block *query_block,
my_bool first_block_arg)
{
- ulong all_headers_len = (ALIGN_SIZE(sizeof(Query_cache_block)) +
+ size_t all_headers_len = (ALIGN_SIZE(sizeof(Query_cache_block)) +
ALIGN_SIZE(sizeof(Query_cache_result)));
- ulong min_size = (first_block_arg ?
+ size_t min_size = (first_block_arg ?
get_min_first_result_data_size():
get_min_append_result_data_size());
Query_cache_block *prev_block= NULL;
Query_cache_block *new_block;
DBUG_ENTER("Query_cache::allocate_data_chain");
- DBUG_PRINT("qcache", ("data_len %lu, all_headers_len %lu",
+ DBUG_PRINT("qcache", ("data_len %zu, all_headers_len %zu",
data_len, all_headers_len));
do
{
- ulong len= data_len + all_headers_len;
- ulong align_len= ALIGN_SIZE(len);
+ size_t len= data_len + all_headers_len;
+ size_t align_len= ALIGN_SIZE(len);
if (!(new_block= allocate_block(MY_MAX(min_size, align_len),
min_result_data_size == 0,
@@ -3219,7 +3219,7 @@ my_bool Query_cache::allocate_data_chain(Query_cache_block **result_block,
Query_cache_result *header = new_block->result();
header->parent(query_block);
- DBUG_PRINT("qcache", ("Block len %lu used %lu",
+ DBUG_PRINT("qcache", ("Block len %zu used %zu",
new_block->length, new_block->used));
if (prev_block)
@@ -3269,7 +3269,7 @@ void Query_cache::invalidate_table(THD *thd, TABLE *table)
table->s->table_cache_key.length);
}
-void Query_cache::invalidate_table(THD *thd, uchar * key, uint32 key_length)
+void Query_cache::invalidate_table(THD *thd, uchar * key, size_t key_length)
{
DEBUG_SYNC(thd, "wait_in_query_cache_invalidate1");
@@ -3297,7 +3297,7 @@ void Query_cache::invalidate_table(THD *thd, uchar * key, uint32 key_length)
*/
void
-Query_cache::invalidate_table_internal(THD *thd, uchar *key, uint32 key_length)
+Query_cache::invalidate_table_internal(THD *thd, uchar *key, size_t key_length)
{
Query_cache_block *table_block=
(Query_cache_block*)my_hash_search(&tables, key, key_length);
@@ -3463,16 +3463,15 @@ my_bool Query_cache::register_all_tables(THD *thd,
*/
my_bool
-Query_cache::insert_table(THD *thd, uint key_len, const char *key,
- Query_cache_block_table *node,
- uint32 db_length, uint8 suffix_length_arg,
+Query_cache::insert_table(THD *thd, size_t key_len, const char *key,
+ Query_cache_block_table *node, size_t db_length, uint8 suffix_length_arg,
uint8 cache_type,
qc_engine_callback callback,
ulonglong engine_data,
my_bool hash)
{
DBUG_ENTER("Query_cache::insert_table");
- DBUG_PRINT("qcache", ("insert table node %p, len %d",
+ DBUG_PRINT("qcache", ("insert table node %p, len %zu",
node, key_len));
Query_cache_block *table_block=
@@ -3538,7 +3537,7 @@ Query_cache::insert_table(THD *thd, uint key_len, const char *key,
}
char *db= header->db();
header->table(db + db_length + 1);
- header->key_length(key_len);
+ header->key_length((uint32)key_len);
header->suffix_length(suffix_length_arg);
header->type(cache_type);
header->callback(callback);
@@ -3610,15 +3609,15 @@ void Query_cache::unlink_table(Query_cache_block_table *node)
*****************************************************************************/
Query_cache_block *
-Query_cache::allocate_block(ulong len, my_bool not_less, ulong min)
+Query_cache::allocate_block(size_t len, my_bool not_less, size_t min)
{
DBUG_ENTER("Query_cache::allocate_block");
- DBUG_PRINT("qcache", ("len %lu, not less %d, min %lu",
+ DBUG_PRINT("qcache", ("len %zu, not less %d, min %zu",
len, not_less,min));
if (len >= MY_MIN(query_cache_size, query_cache_limit))
{
- DBUG_PRINT("qcache", ("Query cache hase only %lu memory and limit %lu",
+ DBUG_PRINT("qcache", ("Query cache hase only %zu memory and limit %zu",
query_cache_size, query_cache_limit));
DBUG_RETURN(0); // in any case we don't have such piece of memory
}
@@ -3642,11 +3641,11 @@ Query_cache::allocate_block(ulong len, my_bool not_less, ulong min)
Query_cache_block *
-Query_cache::get_free_block(ulong len, my_bool not_less, ulong min)
+Query_cache::get_free_block(size_t len, my_bool not_less, size_t min)
{
Query_cache_block *block = 0, *first = 0;
DBUG_ENTER("Query_cache::get_free_block");
- DBUG_PRINT("qcache",("length %lu, not_less %d, min %lu", len,
+ DBUG_PRINT("qcache",("length %zu, not_less %d, min %zu", len,
(int)not_less, min));
/* Find block with minimal size > len */
@@ -3737,7 +3736,7 @@ void Query_cache::free_memory_block(Query_cache_block *block)
}
-void Query_cache::split_block(Query_cache_block *block, ulong len)
+void Query_cache::split_block(Query_cache_block *block, size_t len)
{
DBUG_ENTER("Query_cache::split_block");
Query_cache_block *new_block = (Query_cache_block*)(((uchar*) block)+len);
@@ -3758,7 +3757,7 @@ void Query_cache::split_block(Query_cache_block *block, ulong len)
else
free_memory_block(new_block);
- DBUG_PRINT("qcache", ("split %p (%lu) new %p",
+ DBUG_PRINT("qcache", ("split %p (%zu) new %p",
block, len, new_block));
DBUG_VOID_RETURN;
}
@@ -3791,16 +3790,16 @@ Query_cache::join_free_blocks(Query_cache_block *first_block_arg,
my_bool Query_cache::append_next_free_block(Query_cache_block *block,
- ulong add_size)
+ size_t add_size)
{
Query_cache_block *next_block = block->pnext;
DBUG_ENTER("Query_cache::append_next_free_block");
- DBUG_PRINT("enter", ("block %p, add_size %lu", block,
+ DBUG_PRINT("enter", ("block %p, add_size %zu", block,
add_size));
if (next_block != first_block && next_block->is_free())
{
- ulong old_len = block->length;
+ size_t old_len = block->length;
exclude_from_free_memory_list(next_block);
next_block->destroy();
total_blocks--;
@@ -3850,14 +3849,14 @@ void Query_cache::insert_into_free_memory_list(Query_cache_block *free_block)
DBUG_VOID_RETURN;
}
-uint Query_cache::find_bin(ulong size)
+uint Query_cache::find_bin(size_t size)
{
DBUG_ENTER("Query_cache::find_bin");
// Binary search
- int left = 0, right = mem_bin_steps;
+ size_t left = 0, right = mem_bin_steps;
do
{
- int middle = (left + right) / 2;
+ size_t middle = (left + right) / 2;
if (steps[middle].size > size)
left = middle+1;
else
@@ -3866,15 +3865,15 @@ uint Query_cache::find_bin(ulong size)
if (left == 0)
{
// first bin not subordinate of common rules
- DBUG_PRINT("qcache", ("first bin (# 0), size %lu",size));
+ DBUG_PRINT("qcache", ("first bin (# 0), size %zu",size));
DBUG_RETURN(0);
}
- uint bin = steps[left].idx -
- (uint)((size - steps[left].size)/steps[left].increment);
+ size_t bin = steps[left].idx -
+ ((size - steps[left].size)/steps[left].increment);
- DBUG_PRINT("qcache", ("bin %u step %u, size %lu step size %lu",
+ DBUG_PRINT("qcache", ("bin %zu step %zu, size %zu step size %zu",
bin, left, size, steps[left].size));
- DBUG_RETURN(bin);
+ DBUG_RETURN((uint)bin);
}
@@ -4172,7 +4171,7 @@ my_bool Query_cache::ask_handler_allowance(THD *thd,
handler= table->file;
if (!handler->register_query_cache_table(thd,
table->s->normalized_path.str,
- table->s->normalized_path.length,
+ (uint)table->s->normalized_path.length,
&tables_used->callback_func,
&tables_used->engine_data))
{
@@ -4198,7 +4197,7 @@ my_bool Query_cache::ask_handler_allowance(THD *thd,
/**
Rearrange all memory blocks so that free memory joins at the
'bottom' of the allocated memory block containing all cache data.
- @see Query_cache::pack(ulong join_limit, uint iteration_limit)
+ @see Query_cache::pack(size_t join_limit, uint iteration_limit)
*/
void Query_cache::pack_cache()
@@ -4209,7 +4208,7 @@ void Query_cache::pack_cache()
uchar *border = 0;
Query_cache_block *before = 0;
- ulong gap = 0;
+ size_t gap = 0;
my_bool ok = 1;
Query_cache_block *block = first_block;
DUMP(this);
@@ -4243,7 +4242,7 @@ void Query_cache::pack_cache()
my_bool Query_cache::move_by_type(uchar **border,
- Query_cache_block **before, ulong *gap,
+ Query_cache_block **before, size_t *gap,
Query_cache_block *block)
{
DBUG_ENTER("Query_cache::move_by_type");
@@ -4265,7 +4264,7 @@ my_bool Query_cache::move_by_type(uchar **border,
block->pnext->pprev=block->pprev;
block->destroy();
total_blocks--;
- DBUG_PRINT("qcache", ("added to gap (%lu)", *gap));
+ DBUG_PRINT("qcache", ("added to gap (%zu)", *gap));
break;
}
case Query_cache_block::TABLE:
@@ -4274,7 +4273,7 @@ my_bool Query_cache::move_by_type(uchar **border,
DBUG_PRINT("qcache", ("block %p TABLE", block));
if (*border == 0)
break;
- ulong len = block->length, used = block->used;
+ size_t len = block->length, used = block->used;
Query_cache_block_table *list_root = block->table(0);
Query_cache_block_table *tprev = list_root->prev,
*tnext = list_root->next;
@@ -4324,7 +4323,7 @@ my_bool Query_cache::move_by_type(uchar **border,
/* Fix hash to point at moved block */
my_hash_replace(&tables, &record_idx, (uchar*) new_block);
- DBUG_PRINT("qcache", ("moved %lu bytes to %p, new gap at %p",
+ DBUG_PRINT("qcache", ("moved %zu bytes to %p, new gap at %p",
len, new_block, *border));
break;
}
@@ -4335,7 +4334,7 @@ my_bool Query_cache::move_by_type(uchar **border,
if (*border == 0)
break;
BLOCK_LOCK_WR(block);
- ulong len = block->length, used = block->used;
+ size_t len = block->length, used = block->used;
TABLE_COUNTER_TYPE n_tables = block->n_tables;
Query_cache_block *prev = block->prev,
*next = block->next,
@@ -4417,7 +4416,7 @@ my_bool Query_cache::move_by_type(uchar **border,
}
/* Fix hash to point at moved block */
my_hash_replace(&queries, &record_idx, (uchar*) new_block);
- DBUG_PRINT("qcache", ("moved %lu bytes to %p, new gap at %p",
+ DBUG_PRINT("qcache", ("moved %zu bytes to %p, new gap at %p",
len, new_block, *border));
break;
}
@@ -4434,7 +4433,7 @@ my_bool Query_cache::move_by_type(uchar **border,
BLOCK_LOCK_WR(query_block);
Query_cache_block *next= block->next, *prev= block->prev;
Query_cache_block::block_type type= block->type;
- ulong len = block->length, used = block->used;
+ size_t len = block->length, used = block->used;
Query_cache_block *pprev = block->pprev,
*pnext = block->pnext,
*new_block =(Query_cache_block*) *border;
@@ -4452,7 +4451,7 @@ my_bool Query_cache::move_by_type(uchar **border,
*border += len;
*before = new_block;
/* If result writing complete && we have free space in block */
- ulong free_space= new_block->length - new_block->used;
+ size_t free_space= new_block->length - new_block->used;
free_space-= free_space % ALIGN_SIZE(1);
if (query->result()->type == Query_cache_block::RESULT &&
new_block->length > new_block->used &&
@@ -4462,11 +4461,11 @@ my_bool Query_cache::move_by_type(uchar **border,
*border-= free_space;
*gap+= free_space;
DBUG_PRINT("qcache",
- ("rest of result free space added to gap (%lu)", *gap));
+ ("rest of result free space added to gap (%zu)", *gap));
new_block->length -= free_space;
}
BLOCK_UNLOCK_WR(query_block);
- DBUG_PRINT("qcache", ("moved %lu bytes to %p, new gap at %p",
+ DBUG_PRINT("qcache", ("moved %zu bytes to %p, new gap at %p",
len, new_block, *border));
break;
}
@@ -4506,7 +4505,7 @@ void Query_cache::relink(Query_cache_block *oblock,
}
-my_bool Query_cache::join_results(ulong join_limit)
+my_bool Query_cache::join_results(size_t join_limit)
{
my_bool has_moving = 0;
DBUG_ENTER("Query_cache::join_results");
@@ -4530,7 +4529,7 @@ my_bool Query_cache::join_results(ulong join_limit)
{
has_moving = 1;
Query_cache_block *first_result = header->result();
- ulong new_len = (header->length() +
+ size_t new_len = (header->length() +
ALIGN_SIZE(sizeof(Query_cache_block)) +
ALIGN_SIZE(sizeof(Query_cache_result)));
if (new_result_block->length >
@@ -4543,7 +4542,7 @@ my_bool Query_cache::join_results(ulong join_limit)
new_result_block->used = new_len;
new_result_block->next = new_result_block->prev = new_result_block;
- DBUG_PRINT("qcache", ("new block %lu/%lu (%lu)",
+ DBUG_PRINT("qcache", ("new block %zu/%zu (%zu)",
new_result_block->length,
new_result_block->used,
header->length()));
@@ -4554,9 +4553,9 @@ my_bool Query_cache::join_results(ulong join_limit)
Query_cache_block *result_block = first_result;
do
{
- ulong len = (result_block->used - result_block->headers_len() -
+ size_t len = (result_block->used - result_block->headers_len() -
ALIGN_SIZE(sizeof(Query_cache_result)));
- DBUG_PRINT("loop", ("add block %lu/%lu (%lu)",
+ DBUG_PRINT("loop", ("add block %zu/%zu (%zu)",
result_block->length,
result_block->used,
len));
@@ -4658,14 +4657,14 @@ void Query_cache::bins_dump()
return;
}
- DBUG_PRINT("qcache", ("mem_bin_num=%u, mem_bin_steps=%u",
+ DBUG_PRINT("qcache", ("mem_bin_num=%zu, mem_bin_steps=%zu",
mem_bin_num, mem_bin_steps));
DBUG_PRINT("qcache", ("-------------------------"));
DBUG_PRINT("qcache", (" size idx step"));
DBUG_PRINT("qcache", ("-------------------------"));
for (i=0; i < mem_bin_steps; i++)
{
- DBUG_PRINT("qcache", ("%10lu %3d %10lu", steps[i].size, steps[i].idx,
+ DBUG_PRINT("qcache", ("%10zu %3zd %10zu", steps[i].size, steps[i].idx,
steps[i].increment));
}
DBUG_PRINT("qcache", ("-------------------------"));
@@ -4673,13 +4672,13 @@ void Query_cache::bins_dump()
DBUG_PRINT("qcache", ("-------------------------"));
for (i=0; i < mem_bin_num; i++)
{
- DBUG_PRINT("qcache", ("%10lu %3d %p", bins[i].size, bins[i].number,
+ DBUG_PRINT("qcache", ("%10zu %3d %p", bins[i].size, bins[i].number,
&(bins[i])));
if (bins[i].free_blocks)
{
Query_cache_block *block = bins[i].free_blocks;
do{
- DBUG_PRINT("qcache", ("\\-- %lu %p %p %p %p %p",
+ DBUG_PRINT("qcache", ("\\-- %zu %p %p %p %p %p",
block->length,block,
block->next,block->prev,
block->pnext,block->pprev));
@@ -4706,7 +4705,7 @@ void Query_cache::cache_dump()
do
{
DBUG_PRINT("qcache",
- ("%10lu %10lu %1d %2d %p %p %p %p %p",
+ ("%10zu %10zu %1d %2d %p %p %p %p %p",
i->length, i->used, (int)i->type,
i->n_tables,i,
i->next,i->prev,i->pnext,
@@ -4762,7 +4761,7 @@ void Query_cache::queries_dump()
Query_cache_block *result_beg = result_block;
do
{
- DBUG_PRINT("qcache", ("-r- %u %lu/%lu %p %p %p %p %p",
+ DBUG_PRINT("qcache", ("-r- %u %zu/%zu %p %p %p %p %p",
(uint) result_block->type,
result_block->length, result_block->used,
result_block,
@@ -4840,7 +4839,7 @@ my_bool Query_cache::check_integrity(bool locked)
}
DBUG_PRINT("qcache", ("physical address check ..."));
- ulong free=0, used=0;
+ size_t free=0, used=0;
Query_cache_block * block = first_block;
do
{
@@ -4905,7 +4904,7 @@ my_bool Query_cache::check_integrity(bool locked)
}
else
{
- int idx = (((uchar*)bin) - ((uchar*)bins)) /
+ size_t idx = (((uchar*)bin) - ((uchar*)bins)) /
sizeof(Query_cache_memory_bin);
if (in_list(bins[idx].free_blocks, block, "free memory"))
result = 1;
@@ -4978,7 +4977,7 @@ my_bool Query_cache::check_integrity(bool locked)
if (used + free != query_cache_size)
{
DBUG_PRINT("error",
- ("used memory (%lu) + free memory (%lu) != query_cache_size (%lu)",
+ ("used memory (%zu) + free memory (%zu) != query_cache_size (%zu)",
used, free, query_cache_size));
result = 1;
}
@@ -4986,7 +4985,7 @@ my_bool Query_cache::check_integrity(bool locked)
if (free != free_memory)
{
DBUG_PRINT("error",
- ("free memory (%lu) != free_memory (%lu)",
+ ("free memory (%zu) != free_memory (%zu)",
free, free_memory));
result = 1;
}
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index 6fc083ee331..eb046b4d167 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -126,8 +126,8 @@ struct Query_cache_block
enum block_type {FREE, QUERY, RESULT, RES_CONT, RES_BEG,
RES_INCOMPLETE, TABLE, INCOMPLETE};
- ulong length; // length of all block
- ulong used; // length of data
+ size_t length; // length of all block
+ size_t used; // length of data
/*
Not used **pprev, **prev because really needed access to pervious block:
*pprev to join free blocks
@@ -139,7 +139,7 @@ struct Query_cache_block
TABLE_COUNTER_TYPE n_tables; // number of tables in query
inline bool is_free(void) { return type == FREE; }
- void init(ulong length);
+ void init(size_t length);
void destroy();
uint headers_len();
uchar* data(void);
@@ -155,7 +155,7 @@ struct Query_cache_query
mysql_rwlock_t lock;
Query_cache_block *res;
Query_cache_tls *wri;
- ulong len;
+ size_t len;
unsigned int last_pkt_nr;
uint8 tbls_type;
uint8 ready;
@@ -172,9 +172,9 @@ struct Query_cache_query
inline void writer(Query_cache_tls *p) { wri= p; }
inline uint8 tables_type() { return tbls_type; }
inline void tables_type(uint8 type) { tbls_type= type; }
- inline ulong length() { return len; }
- inline ulong add(ulong packet_len) { return(len+= packet_len); }
- inline void length(ulong length_arg) { len= length_arg; }
+ inline size_t length() { return len; }
+ inline size_t add(size_t packet_len) { return(len+= packet_len); }
+ inline void length(size_t length_arg) { len= length_arg; }
inline uchar* query()
{
return (((uchar*)this) + ALIGN_SIZE(sizeof(Query_cache_query)));
@@ -268,12 +268,12 @@ struct Query_cache_memory_bin
{
Query_cache_memory_bin() {} /* Remove gcc warning */
#ifndef DBUG_OFF
- ulong size;
+ size_t size;
#endif
uint number;
Query_cache_block *free_blocks;
- inline void init(ulong size_arg)
+ inline void init(size_t size_arg)
{
#ifndef DBUG_OFF
size = size_arg;
@@ -286,10 +286,10 @@ struct Query_cache_memory_bin
struct Query_cache_memory_bin_step
{
Query_cache_memory_bin_step() {} /* Remove gcc warning */
- ulong size;
- ulong increment;
- uint idx;
- inline void init(ulong size_arg, uint idx_arg, ulong increment_arg)
+ size_t size;
+ size_t increment;
+ size_t idx;
+ inline void init(size_t size_arg, size_t idx_arg, size_t increment_arg)
{
size = size_arg;
idx = idx_arg;
@@ -301,9 +301,9 @@ class Query_cache
{
public:
/* Info */
- ulong query_cache_size, query_cache_limit;
+ size_t query_cache_size, query_cache_limit;
/* statistics */
- ulong free_memory, queries_in_cache, hits, inserts, refused,
+ size_t free_memory, queries_in_cache, hits, inserts, refused,
free_memory_blocks, total_blocks, lowmem_prunes;
@@ -319,7 +319,7 @@ private:
Cache_staus m_cache_status;
void free_query_internal(Query_cache_block *point);
- void invalidate_table_internal(THD *thd, uchar *key, uint32 key_length);
+ void invalidate_table_internal(THD *thd, uchar *key, size_t key_length);
protected:
/*
@@ -346,10 +346,10 @@ protected:
Query_cache_memory_bin_step *steps; // bins spacing info
HASH queries, tables;
/* options */
- ulong min_allocation_unit, min_result_data_size;
+ size_t min_allocation_unit, min_result_data_size;
uint def_query_hash_size, def_table_hash_size;
- uint mem_bin_num, mem_bin_steps; // See at init_cache & find_bin
+ size_t mem_bin_num, mem_bin_steps; // See at init_cache & find_bin
bool initialized;
@@ -367,12 +367,12 @@ protected:
my_bool free_old_query();
void free_query(Query_cache_block *point);
my_bool allocate_data_chain(Query_cache_block **result_block,
- ulong data_len,
+ size_t data_len,
Query_cache_block *query_block,
my_bool first_block);
void invalidate_table(THD *thd, TABLE_LIST *table);
void invalidate_table(THD *thd, TABLE *table);
- void invalidate_table(THD *thd, uchar *key, uint32 key_length);
+ void invalidate_table(THD *thd, uchar *key, size_t key_length);
void invalidate_table(THD *thd, Query_cache_block *table_block);
void invalidate_query_block_list(THD *thd,
Query_cache_block_table *list_root);
@@ -385,19 +385,19 @@ protected:
TABLE_LIST *tables_used,
TABLE_COUNTER_TYPE tables);
void unlink_table(Query_cache_block_table *node);
- Query_cache_block *get_free_block (ulong len, my_bool not_less,
- ulong min);
+ Query_cache_block *get_free_block (size_t len, my_bool not_less,
+ size_t min);
void free_memory_block(Query_cache_block *point);
- void split_block(Query_cache_block *block, ulong len);
+ void split_block(Query_cache_block *block, size_t len);
Query_cache_block *join_free_blocks(Query_cache_block *first_block,
Query_cache_block *block_in_list);
my_bool append_next_free_block(Query_cache_block *block,
- ulong add_size);
+ size_t add_size);
void exclude_from_free_memory_list(Query_cache_block *free_block);
void insert_into_free_memory_list(Query_cache_block *new_block);
my_bool move_by_type(uchar **border, Query_cache_block **before,
- ulong *gap, Query_cache_block *i);
- uint find_bin(ulong size);
+ size_t *gap, Query_cache_block *i);
+ uint find_bin(size_t size);
void move_to_query_list_end(Query_cache_block *block);
void insert_into_free_memory_sorted_list(Query_cache_block *new_block,
Query_cache_block **list);
@@ -408,31 +408,31 @@ protected:
Query_cache_block *prev,
Query_cache_block *pnext,
Query_cache_block *pprev);
- my_bool join_results(ulong join_limit);
+ my_bool join_results(size_t join_limit);
/*
Following function control structure_guard_mutex
by themself or don't need structure_guard_mutex
*/
- ulong init_cache();
+ size_t init_cache();
void make_disabled();
void free_cache();
- Query_cache_block *write_block_data(ulong data_len, uchar* data,
- ulong header_len,
+ Query_cache_block *write_block_data(size_t data_len, uchar* data,
+ size_t header_len,
Query_cache_block::block_type type,
TABLE_COUNTER_TYPE ntab = 0);
my_bool append_result_data(Query_cache_block **result,
- ulong data_len, uchar* data,
+ size_t data_len, uchar* data,
Query_cache_block *parent);
my_bool write_result_data(Query_cache_block **result,
- ulong data_len, uchar* data,
+ size_t data_len, uchar* data,
Query_cache_block *parent,
Query_cache_block::block_type
type=Query_cache_block::RESULT);
- inline ulong get_min_first_result_data_size();
- inline ulong get_min_append_result_data_size();
- Query_cache_block *allocate_block(ulong len, my_bool not_less,
- ulong min);
+ inline size_t get_min_first_result_data_size();
+ inline size_t get_min_append_result_data_size();
+ Query_cache_block *allocate_block(size_t len, my_bool not_less,
+ size_t min);
/*
If query is cacheable return number tables in query
(query without tables not cached)
@@ -447,9 +447,9 @@ protected:
static my_bool ask_handler_allowance(THD *thd, TABLE_LIST *tables_used);
public:
- Query_cache(ulong query_cache_limit = ULONG_MAX,
- ulong min_allocation_unit = QUERY_CACHE_MIN_ALLOCATION_UNIT,
- ulong min_result_data_size = QUERY_CACHE_MIN_RESULT_DATA_SIZE,
+ Query_cache(size_t query_cache_limit = ULONG_MAX,
+ size_t min_allocation_unit = QUERY_CACHE_MIN_ALLOCATION_UNIT,
+ size_t min_result_data_size = QUERY_CACHE_MIN_RESULT_DATA_SIZE,
uint def_query_hash_size = QUERY_CACHE_DEF_QUERY_HASH_SIZE,
uint def_table_hash_size = QUERY_CACHE_DEF_TABLE_HASH_SIZE);
@@ -460,11 +460,11 @@ protected:
/* initialize cache (mutex) */
void init();
/* resize query cache (return real query size, 0 if disabled) */
- ulong resize(ulong query_cache_size);
+ size_t resize(size_t query_cache_size);
/* set limit on result size */
- inline void result_size_limit(ulong limit){query_cache_limit=limit;}
+ inline void result_size_limit(size_t limit){query_cache_limit=limit;}
/* set minimal result data allocation unit size */
- ulong set_min_res_unit(ulong size);
+ size_t set_min_res_unit(size_t size);
/* register query in cache */
void store_query(THD *thd, TABLE_LIST *used_tables);
@@ -481,7 +481,7 @@ protected:
void invalidate(THD *thd, CHANGED_TABLE_LIST *tables_used);
void invalidate_locked_for_write(THD *thd, TABLE_LIST *tables_used);
void invalidate(THD *thd, TABLE *table, my_bool using_transactions);
- void invalidate(THD *thd, const char *key, uint32 key_length,
+ void invalidate(THD *thd, const char *key, size_t key_length,
my_bool using_transactions);
/* Remove all queries that uses any of the tables in following database */
@@ -492,18 +492,18 @@ protected:
void flush();
void pack(THD *thd,
- ulong join_limit = QUERY_CACHE_PACK_LIMIT,
+ size_t join_limit = QUERY_CACHE_PACK_LIMIT,
uint iteration_limit = QUERY_CACHE_PACK_ITERATION);
void destroy();
void insert(THD *thd, Query_cache_tls *query_cache_tls,
const char *packet,
- ulong length,
+ size_t length,
unsigned pkt_nr);
- my_bool insert_table(THD *thd, uint key_len, const char *key,
+ my_bool insert_table(THD *thd, size_t key_len, const char *key,
Query_cache_block_table *node,
- uint32 db_length, uint8 suffix_length_arg,
+ size_t db_length, uint8 suffix_length_arg,
uint8 cache_type,
qc_engine_callback callback,
ulonglong engine_data,
@@ -562,8 +562,8 @@ struct Query_cache_query_flags
sql_mode_t sql_mode;
ulonglong max_sort_length;
ulonglong group_concat_max_len;
- ulong default_week_format;
- ulong div_precision_increment;
+ size_t default_week_format;
+ size_t div_precision_increment;
MY_LOCALE *lc_time_names;
};
#define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags)
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 5cb6ad53b51..7ff54823da0 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -553,7 +553,7 @@ char *thd_get_error_context_description(THD *thd, char *buffer,
String str(buffer, length, &my_charset_latin1);
const Security_context *sctx= &thd->main_security_ctx;
char header[256];
- int len;
+ size_t len;
/*
The pointers thd->query and thd->proc_info might change since they are
@@ -567,8 +567,8 @@ char *thd_get_error_context_description(THD *thd, char *buffer,
const char *proc_info= thd->proc_info;
len= my_snprintf(header, sizeof(header),
- "MySQL thread id %lu, OS thread handle %lu, query id %lu",
- (ulong) thd->thread_id, (ulong) thd->real_id, (ulong) thd->query_id);
+ "MySQL thread id %u, OS thread handle %lu, query id %llu",
+ (uint)thd->thread_id, (ulong) thd->real_id, (ulonglong) thd->query_id);
str.length(0);
str.append(header, len);
@@ -2356,7 +2356,7 @@ void THD::cleanup_after_query()
*/
bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
- const char *from, uint from_length,
+ const char *from, size_t from_length,
CHARSET_INFO *from_cs)
{
DBUG_ENTER("THD::convert_string");
@@ -2383,7 +2383,7 @@ bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
dstcs and srccs cannot be &my_charset_bin.
*/
bool THD::convert_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
- CHARSET_INFO *srccs, const char *src, uint src_length,
+ CHARSET_INFO *srccs, const char *src, size_t src_length,
String_copier *status)
{
DBUG_ENTER("THD::convert_fix");
@@ -2401,7 +2401,7 @@ bool THD::convert_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
Copy or convert a string.
*/
bool THD::copy_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
- CHARSET_INFO *srccs, const char *src, uint src_length,
+ CHARSET_INFO *srccs, const char *src, size_t src_length,
String_copier *status)
{
DBUG_ENTER("THD::copy_fix");
@@ -2418,7 +2418,7 @@ bool THD::copy_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
class String_copier_with_error: public String_copier
{
public:
- bool check_errors(CHARSET_INFO *srccs, const char *src, uint src_length)
+ bool check_errors(CHARSET_INFO *srccs, const char *src, size_t src_length)
{
if (most_important_error_pos())
{
@@ -2433,7 +2433,7 @@ public:
bool THD::convert_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
CHARSET_INFO *srccs,
- const char *src, uint src_length)
+ const char *src, size_t src_length)
{
String_copier_with_error status;
return convert_fix(dstcs, dst, srccs, src, src_length, &status) ||
@@ -2443,7 +2443,7 @@ bool THD::convert_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
bool THD::copy_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
CHARSET_INFO *srccs,
- const char *src, uint src_length)
+ const char *src, size_t src_length)
{
String_copier_with_error status;
return copy_fix(dstcs, dst, srccs, src, src_length, &status) ||
@@ -2498,7 +2498,7 @@ Item *THD::make_string_literal(const char *str, size_t length,
str= to.str;
length= to.length;
}
- return new (mem_root) Item_string(this, str, length,
+ return new (mem_root) Item_string(this, str, (uint)length,
variables.collation_connection,
DERIVATION_COERCIBLE, repertoire);
}
@@ -2510,7 +2510,7 @@ Item *THD::make_string_literal_nchar(const Lex_string_with_metadata_st &str)
if (!str.length && (variables.sql_mode & MODE_EMPTY_STRING_IS_NULL))
return new (mem_root) Item_null(this, 0, national_charset_info);
- return new (mem_root) Item_string(this, str.str, str.length,
+ return new (mem_root) Item_string(this, str.str, (uint)str.length,
national_charset_info,
DERIVATION_COERCIBLE,
str.repertoire());
@@ -2523,7 +2523,7 @@ Item *THD::make_string_literal_charset(const Lex_string_with_metadata_st &str,
if (!str.length && (variables.sql_mode & MODE_EMPTY_STRING_IS_NULL))
return new (mem_root) Item_null(this, 0, cs);
return new (mem_root) Item_string_with_introducer(this,
- str.str, str.length, cs);
+ str.str, (uint)str.length, cs);
}
@@ -2536,7 +2536,7 @@ Item *THD::make_string_literal_concat(Item *item, const LEX_CSTRING &str)
{
CHARSET_INFO *cs= variables.collation_connection;
uint repertoire= my_string_repertoire(cs, str.str, str.length);
- return new (mem_root) Item_string(this, str.str, str.length, cs,
+ return new (mem_root) Item_string(this, str.str, (uint)str.length, cs,
DERIVATION_COERCIBLE, repertoire);
}
return item;
@@ -2544,7 +2544,7 @@ Item *THD::make_string_literal_concat(Item *item, const LEX_CSTRING &str)
DBUG_ASSERT(item->type() == Item::STRING_ITEM);
DBUG_ASSERT(item->basic_const_item());
- static_cast<Item_string*>(item)->append(str.str, str.length);
+ static_cast<Item_string*>(item)->append(str.str, (uint)str.length);
if (!(item->collation.repertoire & MY_REPERTOIRE_EXTENDED))
{
// If the string has been pure ASCII so far, check the new part.
@@ -2606,7 +2606,7 @@ void THD::add_changed_table(TABLE *table)
}
-void THD::add_changed_table(const char *key, long key_length)
+void THD::add_changed_table(const char *key, size_t key_length)
{
DBUG_ENTER("THD::add_changed_table(key)");
CHANGED_TABLE_LIST **prev_changed = &transaction.changed_tables;
@@ -2619,7 +2619,7 @@ void THD::add_changed_table(const char *key, long key_length)
{
list_include(prev_changed, curr, changed_table_dup(key, key_length));
DBUG_PRINT("info",
- ("key_length: %ld %u", key_length,
+ ("key_length: %zu %zu", key_length,
(*prev_changed)->key_length));
DBUG_VOID_RETURN;
}
@@ -2630,7 +2630,7 @@ void THD::add_changed_table(const char *key, long key_length)
{
list_include(prev_changed, curr, changed_table_dup(key, key_length));
DBUG_PRINT("info",
- ("key_length: %ld %u", key_length,
+ ("key_length: %zu %zu", key_length,
(*prev_changed)->key_length));
DBUG_VOID_RETURN;
}
@@ -2642,13 +2642,13 @@ void THD::add_changed_table(const char *key, long key_length)
}
}
*prev_changed = changed_table_dup(key, key_length);
- DBUG_PRINT("info", ("key_length: %ld %u", key_length,
+ DBUG_PRINT("info", ("key_length: %zu %zu", key_length,
(*prev_changed)->key_length));
DBUG_VOID_RETURN;
}
-CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, long key_length)
+CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, size_t key_length)
{
CHANGED_TABLE_LIST* new_table =
(CHANGED_TABLE_LIST*) trans_alloc(ALIGN_SIZE(sizeof(CHANGED_TABLE_LIST))+
@@ -4256,7 +4256,7 @@ void TMP_TABLE_PARAM::init()
}
-void thd_increment_bytes_sent(void *thd, ulong length)
+void thd_increment_bytes_sent(void *thd, size_t length)
{
/* thd == 0 when close_connection() calls net_send_error() */
if (likely(thd != 0))
@@ -4272,19 +4272,13 @@ my_bool thd_net_is_killed()
}
-void thd_increment_bytes_received(void *thd, ulong length)
+void thd_increment_bytes_received(void *thd, size_t length)
{
if (thd != NULL) // MDEV-13073 Ack collector having NULL
((THD*) thd)->status_var.bytes_received+= length;
}
-void thd_increment_net_big_packet_count(void *thd, ulong length)
-{
- ((THD*) thd)->status_var.net_big_packet_count+= length;
-}
-
-
void THD::set_status_var_init()
{
bzero((char*) &status_var, offsetof(STATUS_VAR,
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 9775aa71193..1c3d5f2bff5 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -194,7 +194,7 @@ typedef struct st_user_var_events
{
user_var_entry *user_var_event;
char *value;
- ulong length;
+ size_t length;
Item_result type;
uint charset_number;
bool unsigned_flag;
@@ -775,7 +775,6 @@ typedef struct system_status_var
ulong ha_savepoint_rollback_count;
ulong ha_external_lock_count;
- ulong net_big_packet_count;
ulong opened_tables;
ulong opened_shares;
ulong opened_views; /* +1 opening a view */
@@ -1002,7 +1001,7 @@ public:
{ return strmake_root(mem_root,str,size); }
inline void *memdup(const void *str, size_t size)
{ return memdup_root(mem_root,str,size); }
- inline void *memdup_w_gap(const void *str, size_t size, uint gap)
+ inline void *memdup_w_gap(const void *str, size_t size, size_t gap)
{
void *ptr;
if ((ptr= alloc_root(mem_root,size+gap)))
@@ -3547,12 +3546,12 @@ public:
{
return !stmt_arena->is_stmt_prepare();
}
- inline void* trans_alloc(unsigned int size)
+ inline void* trans_alloc(size_t size)
{
return alloc_root(&transaction.mem_root,size);
}
- LEX_STRING *make_lex_string(LEX_STRING *lex_str, const char* str, uint length)
+ LEX_STRING *make_lex_string(LEX_STRING *lex_str, const char* str, size_t length)
{
if (!(lex_str->str= strmake_root(mem_root, str, length)))
{
@@ -3562,7 +3561,7 @@ public:
lex_str->length= length;
return lex_str;
}
- LEX_CSTRING *make_lex_string(LEX_CSTRING *lex_str, const char* str, uint length)
+ LEX_CSTRING *make_lex_string(LEX_CSTRING *lex_str, const char* str, size_t length)
{
if (!(lex_str->str= strmake_root(mem_root, str, length)))
{
@@ -3573,7 +3572,7 @@ public:
return lex_str;
}
- LEX_CSTRING *make_clex_string(const char* str, uint length)
+ LEX_CSTRING *make_clex_string(const char* str, size_t length)
{
LEX_CSTRING *lex_str;
char *tmp;
@@ -3589,7 +3588,7 @@ public:
}
// Allocate LEX_STRING for character set conversion
- bool alloc_lex_string(LEX_STRING *dst, uint length)
+ bool alloc_lex_string(LEX_STRING *dst, size_t length)
{
if ((dst->str= (char*) alloc(length)))
return false;
@@ -3597,7 +3596,7 @@ public:
return true; // EOM
}
bool convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
- const char *from, uint from_length,
+ const char *from, size_t from_length,
CHARSET_INFO *from_cs);
/*
Convert a strings between character sets.
@@ -3605,7 +3604,7 @@ public:
dstcs and srccs cannot be &my_charset_bin.
*/
bool convert_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
- CHARSET_INFO *srccs, const char *src, uint src_length,
+ CHARSET_INFO *srccs, const char *src, size_t src_length,
String_copier *status);
/*
@@ -3614,7 +3613,7 @@ public:
*/
bool convert_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
CHARSET_INFO *srccs,
- const char *src, uint src_length);
+ const char *src, size_t src_length);
/*
If either "dstcs" or "srccs" is &my_charset_bin,
@@ -3622,7 +3621,7 @@ public:
Otherwise, performs Unicode conversion using convert_fix().
*/
bool copy_fix(CHARSET_INFO *dstcs, LEX_STRING *dst,
- CHARSET_INFO *srccs, const char *src, uint src_length,
+ CHARSET_INFO *srccs, const char *src, size_t src_length,
String_copier *status);
/*
@@ -3630,7 +3629,7 @@ public:
in case of bad byte sequences or Unicode conversion problems.
*/
bool copy_with_error(CHARSET_INFO *dstcs, LEX_STRING *dst,
- CHARSET_INFO *srccs, const char *src, uint src_length);
+ CHARSET_INFO *srccs, const char *src, size_t src_length);
bool convert_string(String *s, CHARSET_INFO *from_cs, CHARSET_INFO *to_cs);
@@ -3652,8 +3651,8 @@ public:
CHARSET_INFO *cs);
Item *make_string_literal_concat(Item *item1, const LEX_CSTRING &str);
void add_changed_table(TABLE *table);
- void add_changed_table(const char *key, long key_length);
- CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length);
+ void add_changed_table(const char *key, size_t key_length);
+ CHANGED_TABLE_LIST * changed_table_dup(const char *key, size_t key_length);
int send_explain_fields(select_result *result, uint8 explain_flags,
bool is_analyze);
void make_explain_field_list(List<Item> &field_list, uint8 explain_flags,
@@ -4233,12 +4232,12 @@ public:
Assign a new value to thd->query and thd->query_id and mysys_var.
Protected with LOCK_thd_data mutex.
*/
- void set_query(char *query_arg, uint32 query_length_arg,
+ void set_query(char *query_arg, size_t query_length_arg,
CHARSET_INFO *cs_arg)
{
set_query(CSET_STRING(query_arg, query_length_arg, cs_arg));
}
- void set_query(char *query_arg, uint32 query_length_arg) /*Mutex protected*/
+ void set_query(char *query_arg, size_t query_length_arg) /*Mutex protected*/
{
set_query(CSET_STRING(query_arg, query_length_arg, charset()));
}
@@ -4443,7 +4442,7 @@ public:
TMP_TABLE_SHARE *find_tmp_table_share(const char *db,
const char *table_name);
TMP_TABLE_SHARE *find_tmp_table_share(const TABLE_LIST *tl);
- TMP_TABLE_SHARE *find_tmp_table_share(const char *key, uint key_length);
+ TMP_TABLE_SHARE *find_tmp_table_share(const char *key, size_t key_length);
bool open_temporary_table(TABLE_LIST *tl);
bool open_temporary_tables(TABLE_LIST *tl);
@@ -5704,7 +5703,7 @@ class user_var_entry
user_var_entry() {} /* Remove gcc warning */
LEX_CSTRING name;
char *value;
- ulong length;
+ size_t length;
query_id_t update_query_id, used_query_id;
Item_result type;
bool unsigned_flag;
@@ -6187,7 +6186,7 @@ void thd_exit_cond(MYSQL_THD thd, const PSI_stage_info *stage,
#define THD_EXIT_COND(P1, P2) \
thd_exit_cond(P1, P2, __func__, __FILE__, __LINE__)
-inline bool binlog_should_compress(ulong len)
+inline bool binlog_should_compress(size_t len)
{
return opt_bin_log_compress &&
len >= opt_bin_log_compress_min_len;
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index af9e2ad8b24..7ac8bc7cadd 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -86,7 +86,7 @@ int get_or_create_user_conn(THD *thd, const char *user,
uc->user=(char*) (uc+1);
memcpy(uc->user,temp_user,temp_len+1);
uc->host= uc->user + user_len + 1;
- uc->len= temp_len;
+ uc->len= (uint)temp_len;
uc->connections= uc->questions= uc->updates= uc->conn_per_hour= 0;
uc->user_resources= *mqh;
uc->reset_utime= thd->thr_create_utime;
@@ -339,7 +339,7 @@ void reset_mqh(LEX_USER *lu, bool get_them= 0)
if (lu) // for GRANT
{
USER_CONN *uc;
- uint temp_len=lu->user.length+lu->host.length+2;
+ size_t temp_len=lu->user.length+lu->host.length+2;
char temp_user[USER_HOST_BUFF_SIZE];
memcpy(temp_user,lu->user.str,lu->user.length);
@@ -445,7 +445,7 @@ void init_user_stats(USER_STATS *user_stats,
user_length= MY_MIN(user_length, sizeof(user_stats->user)-1);
memcpy(user_stats->user, user, user_length);
user_stats->user[user_length]= 0;
- user_stats->user_name_length= user_length;
+ user_stats->user_name_length= (uint)user_length;
strmake_buf(user_stats->priv_user, priv_user);
user_stats->total_connections= total_connections;
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index a53e6b07813..ea7ff138f10 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -826,7 +826,7 @@ st_select_lex_unit *With_element::clone_parsed_spec(THD *thd,
TABLE_LIST *spec_tables_tail;
st_select_lex *with_select;
- if (parser_state.init(thd, (char*) unparsed_spec.str, unparsed_spec.length))
+ if (parser_state.init(thd, (char*) unparsed_spec.str, (unsigned int)unparsed_spec.length))
goto err;
lex_start(thd);
with_select= &lex->select_lex;
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 417e3959e85..114c06fdf2e 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -122,12 +122,12 @@ uchar* dboptions_get_key(my_dbopt_t *opt, size_t *length,
Helper function to write a query to binlog used by mysql_rm_db()
*/
-static inline int write_to_binlog(THD *thd, const char *query, uint q_len,
- const char *db, uint db_len)
+static inline int write_to_binlog(THD *thd, const char *query, size_t q_len,
+ const char *db, size_t db_len)
{
Query_log_event qinfo(thd, query, q_len, FALSE, TRUE, FALSE, 0);
qinfo.db= db;
- qinfo.db_len= db_len;
+ qinfo.db_len= (uint32)db_len;
return mysql_bin_log.write(&qinfo);
}
@@ -388,7 +388,7 @@ bool load_db_opt(THD *thd, const char *path, Schema_specification_st *create)
char buf[256];
DBUG_ENTER("load_db_opt");
bool error=1;
- uint nbytes;
+ size_t nbytes;
bzero((char*) create,sizeof(*create));
create->default_table_charset= thd->variables.collation_server;
@@ -688,7 +688,7 @@ not_silent:
# database does not exist.
*/
qinfo.db = db->str;
- qinfo.db_len = db->length;
+ qinfo.db_len = (uint32)db->length;
/*
These DDL methods and logging are protected with the exclusive
@@ -748,7 +748,7 @@ mysql_alter_db_internal(THD *thd, const LEX_CSTRING *db,
default.
*/
qinfo.db= db->str;
- qinfo.db_len= db->length;
+ qinfo.db_len= (uint)db->length;
/*
These DDL methods and logging are protected with the exclusive
@@ -958,7 +958,7 @@ update_binlog:
default.
*/
qinfo.db = db->str;
- qinfo.db_len = db->length;
+ qinfo.db_len = (uint32)db->length;
/*
These DDL methods and logging are protected with the exclusive
@@ -986,7 +986,7 @@ update_binlog:
for (tbl= tables; tbl; tbl= tbl->next_local)
{
- uint tbl_name_len;
+ size_t tbl_name_len;
char quoted_name[FN_REFLEN+3];
// Only write drop table to the binlog for tables that no longer exist.
diff --git a/sql/sql_digest.cc b/sql/sql_digest.cc
index 2f88d62fbbb..54ed1c3f225 100644
--- a/sql/sql_digest.cc
+++ b/sql/sql_digest.cc
@@ -149,7 +149,7 @@ inline void store_token_identifier(sql_digest_storage* digest_storage,
/* Write the string data */
if (id_length > 0)
memcpy((char *)(dest + 4), id_name, id_length);
- digest_storage->m_byte_count+= bytes_needed;
+ digest_storage->m_byte_count+= (uint)bytes_needed;
}
else
{
diff --git a/sql/sql_digest.h b/sql/sql_digest.h
index eaf74b9542e..81fe809b59d 100644
--- a/sql/sql_digest.h
+++ b/sql/sql_digest.h
@@ -54,10 +54,10 @@ struct sql_digest_storage
reset(NULL, 0);
}
- inline void reset(unsigned char *token_array, uint length)
+ inline void reset(unsigned char *token_array, size_t length)
{
m_token_array= token_array;
- m_token_array_length= length;
+ m_token_array_length= (uint)length;
reset();
}
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index 24fb934c279..67440aeed33 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -523,8 +523,7 @@ Warning_info::~Warning_info()
}
-bool Warning_info::has_sql_condition(const char *message_str,
- ulong message_length) const
+bool Warning_info::has_sql_condition(const char *message_str, size_t message_length) const
{
Diagnostics_area::Sql_condition_iterator it(m_warn_list);
const Sql_condition *err;
@@ -918,11 +917,11 @@ char *err_conv(char *buff, uint to_length, const char *from,
length of converted string
*/
-uint32 convert_error_message(char *to, uint32 to_length, CHARSET_INFO *to_cs,
- const char *from, uint32 from_length,
+size_t convert_error_message(char *to, size_t to_length, CHARSET_INFO *to_cs,
+ const char *from, size_t from_length,
CHARSET_INFO *from_cs, uint *errors)
{
- int cnvres;
+ int cnvres;
my_wc_t wc;
const uchar *from_end= (const uchar*) from+from_length;
char *to_start= to;
@@ -930,7 +929,7 @@ uint32 convert_error_message(char *to, uint32 to_length, CHARSET_INFO *to_cs,
my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc;
my_charset_conv_wc_mb wc_mb;
uint error_count= 0;
- uint length;
+ size_t length;
DBUG_ASSERT(to_length > 0);
/* Make room for the null terminator. */
@@ -969,7 +968,7 @@ uint32 convert_error_message(char *to, uint32 to_length, CHARSET_INFO *to_cs,
length= (wc <= 0xFFFF) ? 6/* '\1234' format*/ : 9 /* '\+123456' format*/;
if ((uchar*)(to + length) >= to_end)
break;
- cnvres= my_snprintf(to, 9,
+ cnvres= (int)my_snprintf(to, 9,
(wc <= 0xFFFF) ? "\\%04X" : "\\+%06X", (uint) wc);
to+= cnvres;
}
@@ -979,7 +978,7 @@ uint32 convert_error_message(char *to, uint32 to_length, CHARSET_INFO *to_cs,
*to= 0;
*errors= error_count;
- return (uint32) (to - to_start);
+ return (size_t) (to - to_start);
}
diff --git a/sql/sql_error.h b/sql/sql_error.h
index c74f6519129..67c6e50d283 100644
--- a/sql/sql_error.h
+++ b/sql/sql_error.h
@@ -591,7 +591,7 @@ private:
@return true if the Warning_info contains an SQL-condition with the given
message.
*/
- bool has_sql_condition(const char *message_str, ulong message_length) const;
+ bool has_sql_condition(const char *message_str, size_t message_length) const;
/**
Reset the warning information. Clear all warnings,
@@ -1089,7 +1089,7 @@ public:
ulong current_statement_warn_count() const
{ return get_warning_info()->current_statement_warn_count(); }
- bool has_sql_condition(const char *message_str, ulong message_length) const
+ bool has_sql_condition(const char *message_str, size_t message_length) const
{ return get_warning_info()->has_sql_condition(message_str, message_length); }
void reset_for_next_command()
@@ -1240,9 +1240,9 @@ void push_warning_printf(THD *thd, Sql_condition::enum_warning_level level,
bool mysqld_show_warnings(THD *thd, ulong levels_to_show);
-uint32 convert_error_message(char *to, uint32 to_length,
+size_t convert_error_message(char *to, size_t to_length,
CHARSET_INFO *to_cs,
- const char *from, uint32 from_length,
+ const char *from, size_t from_length,
CHARSET_INFO *from_cs, uint *errors);
extern const LEX_CSTRING warning_level_names[];
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index ad80303e1b3..5d977c6d5c2 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -445,13 +445,13 @@ uint Explain_union::make_union_table_name(char *buf)
default:
DBUG_ASSERT(0);
}
- memcpy(buf, type.str, (len= type.length));
+ memcpy(buf, type.str, (len= (uint)type.length));
for (; childno < union_members.elements() && len + lastop + 5 < NAME_LEN;
childno++)
{
len+= lastop;
- lastop= my_snprintf(buf + len, NAME_LEN - len,
+ lastop= (uint)my_snprintf(buf + len, NAME_LEN - len,
"%u,", union_members.at(childno));
}
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index 80ed12b5652..da38a2caf94 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -645,7 +645,7 @@ SQL_SELECT *prepare_simple_select(THD *thd, Item *cond,
# created SQL_SELECT
*/
-SQL_SELECT *prepare_select_for_name(THD *thd, const char *mask, uint mlen,
+SQL_SELECT *prepare_select_for_name(THD *thd, const char *mask, size_t mlen,
TABLE_LIST *tables, TABLE *table,
Field *pfname, int *error)
{
@@ -654,7 +654,7 @@ SQL_SELECT *prepare_select_for_name(THD *thd, const char *mask, uint mlen,
Item_func_like(thd,
new (mem_root)
Item_field(thd, pfname),
- new (mem_root) Item_string(thd, mask, mlen,
+ new (mem_root) Item_string(thd, mask, (uint)mlen,
pfname->charset()),
new (mem_root) Item_string_ascii(thd, "\\"),
FALSE);
@@ -686,7 +686,7 @@ static bool mysqld_help_internal(THD *thd, const char *mask)
List<String> topics_list, categories_list, subcategories_list;
String name, description, example;
int count_topics, count_categories, error;
- uint mlen= strlen(mask);
+ size_t mlen= strlen(mask);
size_t i;
MEM_ROOT *mem_root= thd->mem_root;
LEX_CSTRING MYSQL_HELP_TOPIC_NAME= {STRING_WITH_LEN("help_topic") };
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index 6df92f13585..dadd419ade5 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -765,7 +765,7 @@ uint JOIN_CACHE::get_record_max_affix_length()
The minimal possible size of the join buffer of this cache
*/
-ulong JOIN_CACHE::get_min_join_buffer_size()
+size_t JOIN_CACHE::get_min_join_buffer_size()
{
if (!min_buff_size)
{
@@ -824,7 +824,7 @@ ulong JOIN_CACHE::get_min_join_buffer_size()
The maximum possible size of the join buffer of this cache
*/
-ulong JOIN_CACHE::get_max_join_buffer_size(bool optimize_buff_size)
+size_t JOIN_CACHE::get_max_join_buffer_size(bool optimize_buff_size)
{
if (!max_buff_size)
{
@@ -933,9 +933,9 @@ int JOIN_CACHE::alloc_buffer()
if (for_explain_only)
return 0;
- for (ulong buff_size_decr= (buff_size-min_buff_size)/4 + 1; ; )
+ for (size_t buff_size_decr= (buff_size-min_buff_size)/4 + 1; ; )
{
- ulong next_buff_size;
+ size_t next_buff_size;
if ((buff= (uchar*) my_malloc(buff_size, MYF(MY_THREAD_SPECIFIC))))
break;
@@ -1701,7 +1701,7 @@ enum JOIN_CACHE::Match_flag JOIN_CACHE::get_match_flag_by_pos(uchar *rec_ptr)
the number of bytes in the increment
*/
-uint JOIN_CACHE::aux_buffer_incr(ulong recno)
+uint JOIN_CACHE::aux_buffer_incr(size_t recno)
{
return join_tab_scan->aux_buffer_incr(recno);
}
@@ -2759,22 +2759,22 @@ int JOIN_CACHE_HASHED::init_hash_table()
size_of_key_ofs + // reference to the next key
(use_emb_key ? get_size_of_rec_offset() : key_length);
- ulong space_per_rec= avg_record_length +
+ size_t space_per_rec= avg_record_length +
avg_aux_buffer_incr +
key_entry_length+size_of_key_ofs;
- uint n= buff_size / space_per_rec;
+ size_t n= buff_size / space_per_rec;
/*
TODO: Make a better estimate for this upper bound of
the number of records in in the join buffer.
*/
- uint max_n= buff_size / (pack_length-length+
+ size_t max_n= buff_size / (pack_length-length+
key_entry_length+size_of_key_ofs);
hash_entries= (uint) (n / 0.7);
set_if_bigger(hash_entries, 1);
- if (offset_size(max_n*key_entry_length) <=
+ if (offset_size((uint)(max_n*key_entry_length)) <=
size_of_key_ofs)
break;
}
@@ -3501,7 +3501,7 @@ bool JOIN_CACHE_BNL::prepare_look_for_matches(bool skip_last)
if (!records)
return TRUE;
reset(FALSE);
- rem_records= records - MY_TEST(skip_last);
+ rem_records= (uint)records - MY_TEST(skip_last);
return rem_records == 0;
}
@@ -3829,7 +3829,7 @@ int JOIN_CACHE_BNLH::init(bool for_explain)
the increment of the size of the MRR buffer for the next record
*/
-uint JOIN_TAB_SCAN_MRR::aux_buffer_incr(ulong recno)
+uint JOIN_TAB_SCAN_MRR::aux_buffer_incr(size_t recno)
{
uint incr= 0;
TABLE_REF *ref= &join_tab->ref;
diff --git a/sql/sql_join_cache.h b/sql/sql_join_cache.h
index 12c278dae85..c4ba08496d0 100644
--- a/sql/sql_join_cache.h
+++ b/sql/sql_join_cache.h
@@ -107,7 +107,7 @@ protected:
/* 3 functions below actually do not use the hidden parameter 'this' */
/* Calculate the number of bytes used to store an offset value */
- uint offset_size(uint len)
+ uint offset_size(size_t len)
{ return (len < 256 ? 1 : len < 256*256 ? 2 : 4); }
/* Get the offset value that takes ofs_sz bytes at the position ptr */
@@ -420,7 +420,7 @@ protected:
incremented when a new record is added to the join buffer.
If no auxiliary buffer is needed the function should return 0.
*/
- virtual uint aux_buffer_incr(ulong recno);
+ virtual uint aux_buffer_incr(size_t recno);
/* Shall calculate how much space is remaining in the join buffer */
virtual size_t rem_space()
@@ -606,9 +606,9 @@ public:
void set_join_buffer_size(size_t sz) { buff_size= sz; }
/* Get the minimum possible size of the cache join buffer */
- virtual ulong get_min_join_buffer_size();
+ virtual size_t get_min_join_buffer_size();
/* Get the maximum possible size of the cache join buffer */
- virtual ulong get_max_join_buffer_size(bool optimize_buff_size);
+ virtual size_t get_max_join_buffer_size(bool optimize_buff_size);
/* Shrink the size if the cache join buffer in a given ratio */
bool shrink_join_buffer_in_ratio(ulonglong n, ulonglong d);
@@ -1069,7 +1069,7 @@ public:
Shall calculate the increment of the auxiliary buffer for a record
write if such a buffer is used by the table scan object
*/
- virtual uint aux_buffer_incr(ulong recno) { return 0; }
+ virtual uint aux_buffer_incr(size_t recno) { return 0; }
/* Initiate the process of iteration over the joined table */
virtual int open();
@@ -1244,7 +1244,7 @@ public:
JOIN_TAB_SCAN_MRR(JOIN *j, JOIN_TAB *tab, uint flags, RANGE_SEQ_IF rs_funcs)
:JOIN_TAB_SCAN(j, tab), range_seq_funcs(rs_funcs), mrr_mode(flags) {}
- uint aux_buffer_incr(ulong recno);
+ uint aux_buffer_incr(size_t recno);
int open();
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 0106f189ca8..0899082ca98 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -258,7 +258,7 @@ st_parsing_options::reset()
bool Lex_input_stream::init(THD *thd,
char* buff,
- unsigned int length)
+ size_t length)
{
DBUG_EXECUTE_IF("bug42064_simulate_oom",
DBUG_SET("+d,simulate_out_of_memory"););
@@ -269,12 +269,12 @@ bool Lex_input_stream::init(THD *thd,
DBUG_SET("-d,bug42064_simulate_oom"););
if (m_cpp_buf == NULL)
- return TRUE;
+ return true;
m_thd= thd;
reset(buff, length);
- return FALSE;
+ return false;
}
@@ -287,7 +287,7 @@ bool Lex_input_stream::init(THD *thd,
*/
void
-Lex_input_stream::reset(char *buffer, unsigned int length)
+Lex_input_stream::reset(char *buffer, size_t length)
{
yylineno= 1;
yylval= NULL;
@@ -334,7 +334,7 @@ void Lex_input_stream::body_utf8_start(THD *thd, const char *begin_ptr)
DBUG_ASSERT(begin_ptr);
DBUG_ASSERT(m_cpp_buf <= begin_ptr && begin_ptr <= m_cpp_buf + m_buf_length);
- uint body_utf8_length= get_body_utf8_maximum_length(thd);
+ size_t body_utf8_length= get_body_utf8_maximum_length(thd);
m_body_utf8= (char *) thd->alloc(body_utf8_length + 1);
m_body_utf8_ptr= m_body_utf8;
@@ -344,7 +344,7 @@ void Lex_input_stream::body_utf8_start(THD *thd, const char *begin_ptr)
}
-uint Lex_input_stream::get_body_utf8_maximum_length(THD *thd)
+size_t Lex_input_stream::get_body_utf8_maximum_length(THD *thd)
{
/*
String literals can grow during escaping:
@@ -2151,7 +2151,7 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd)
}
-void trim_whitespace(CHARSET_INFO *cs, LEX_CSTRING *str, uint *prefix_length)
+void trim_whitespace(CHARSET_INFO *cs, LEX_CSTRING *str, size_t * prefix_length)
{
/*
TODO:
@@ -2159,14 +2159,15 @@ void trim_whitespace(CHARSET_INFO *cs, LEX_CSTRING *str, uint *prefix_length)
that can be considered white-space.
*/
- *prefix_length= 0;
+ size_t plen= 0;
while ((str->length > 0) && (my_isspace(cs, str->str[0])))
{
- (*prefix_length)++;
+ plen++;
str->length --;
str->str ++;
}
-
+ if (prefix_length)
+ *prefix_length= plen;
/*
FIXME:
Also, parsing backward is not safe with multi bytes characters
@@ -3871,7 +3872,7 @@ void st_select_lex::alloc_index_hints (THD *thd)
RETURN VALUE
0 on success, non-zero otherwise
*/
-bool st_select_lex::add_index_hint (THD *thd, const char *str, uint length)
+bool st_select_lex::add_index_hint (THD *thd, const char *str, size_t length)
{
return index_hints->push_front(new (thd->mem_root)
Index_hint(current_index_hint_type,
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 058bd639e44..3505165196f 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -420,7 +420,7 @@ public:
LEX_CSTRING key_name;
Index_hint (enum index_hint_type type_arg, index_clause_map clause_arg,
- const char *str, uint length) :
+ const char *str, size_t length) :
type(type_arg), clause(clause_arg)
{
key_name.str= str;
@@ -1169,7 +1169,7 @@ public:
Add a index hint to the tagged list of hints. The type and clause of the
hint will be the current ones (set by set_index_hint())
*/
- bool add_index_hint (THD *thd, const char *str, uint length);
+ bool add_index_hint (THD *thd, const char *str, size_t length);
/* make a list to hold index hints */
void alloc_index_hints (THD *thd);
@@ -2069,9 +2069,9 @@ public:
@retval FALSE OK
@retval TRUE Error
*/
- bool init(THD *thd, char *buff, unsigned int length);
+ bool init(THD *thd, char *buff, size_t length);
- void reset(char *buff, unsigned int length);
+ void reset(char *buff, size_t length);
/**
Set the echo mode.
@@ -2344,16 +2344,16 @@ public:
}
/** Get the utf8-body length. */
- uint get_body_utf8_length()
+ size_t get_body_utf8_length()
{
- return (uint) (m_body_utf8_ptr - m_body_utf8);
+ return (size_t) (m_body_utf8_ptr - m_body_utf8);
}
/**
Get the maximum length of the utf8-body buffer.
The utf8 body can grow because of the character set conversion and escaping.
*/
- uint get_body_utf8_maximum_length(THD *thd);
+ size_t get_body_utf8_maximum_length(THD *thd);
void body_utf8_start(THD *thd, const char *begin_ptr);
void body_utf8_append(const char *ptr);
@@ -2413,7 +2413,7 @@ private:
const char *m_buf;
/** Length of the raw buffer. */
- uint m_buf_length;
+ size_t m_buf_length;
/** Echo the parsed stream to the pre-processed buffer. */
bool m_echo;
@@ -3865,7 +3865,7 @@ public:
@retval FALSE OK
@retval TRUE Error
*/
- bool init(THD *thd, char *buff, unsigned int length)
+ bool init(THD *thd, char *buff, size_t length)
{
return m_lip.init(thd, buff, length);
}
@@ -3997,10 +3997,9 @@ int init_lex_with_single_table(THD *thd, TABLE *table, LEX *lex);
extern int MYSQLlex(union YYSTYPE *yylval, THD *thd);
extern int ORAlex(union YYSTYPE *yylval, THD *thd);
-extern void trim_whitespace(CHARSET_INFO *cs, LEX_CSTRING *str,
- uint *prefix_removed);
+extern void trim_whitespace(CHARSET_INFO *cs, LEX_CSTRING *str, size_t * prefix_length = 0);
-extern bool is_lex_native_function(const LEX_CSTRING *name);
+extern bool is_lex_native_function(const LEX_CSTRING *name);
extern bool is_native_function(THD *thd, const LEX_CSTRING *name);
extern bool is_native_function_with_warn(THD *thd, const LEX_CSTRING *name);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 19889dbf1c5..0eb1fed9eff 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -923,7 +923,7 @@ void execute_init_command(THD *thd, LEX_STRING *init_command,
save_vio= thd->net.vio;
thd->net.vio= 0;
thd->clear_error(1);
- dispatch_command(COM_QUERY, thd, buf, len, FALSE, FALSE);
+ dispatch_command(COM_QUERY, thd, buf, (uint)len, FALSE, FALSE);
thd->client_capabilities= save_client_capabilities;
thd->net.vio= save_vio;
@@ -936,7 +936,7 @@ void execute_init_command(THD *thd, LEX_STRING *init_command,
static char *fgets_fn(char *buffer, size_t size, fgets_input_t input, int *error)
{
MYSQL_FILE *in= static_cast<MYSQL_FILE*> (input);
- char *line= mysql_file_fgets(buffer, size, in);
+ char *line= mysql_file_fgets(buffer, (int)size, in);
if (error)
*error= (line == NULL) ? ferror(in->m_file) : 0;
return line;
@@ -1483,7 +1483,7 @@ static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables)
@retval # - Number of commands in the batch
*/
-uint maria_multi_check(THD *thd, char *packet, uint packet_length)
+uint maria_multi_check(THD *thd, char *packet, size_t packet_length)
{
uint counter= 0;
DBUG_ENTER("maria_multi_check");
@@ -2166,7 +2166,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
{
STATUS_VAR *current_global_status_var; // Big; Don't allocate on stack
ulong uptime;
- uint length __attribute__((unused));
ulonglong queries_per_second1000;
char buff[250];
uint buff_len= sizeof(buff);
@@ -2181,8 +2180,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
queries_per_second1000= 0;
else
queries_per_second1000= thd->query_id * 1000 / uptime;
-
- length= my_snprintf(buff, buff_len - 1,
+#ifndef EMBEDDED_LIBRARY
+ size_t length=
+#endif
+ my_snprintf(buff, buff_len - 1,
"Uptime: %lu Threads: %d Questions: %lu "
"Slow queries: %lu Opens: %lu Flush tables: %lld "
"Open tables: %u Queries per second avg: %u.%03u",
@@ -2309,7 +2310,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
if (dispatch_command(subcommand, thd, packet + (1 + length_length),
- subpacket_length - (1 + length_length), TRUE,
+ (uint)(subpacket_length - (1 + length_length)), TRUE,
(current_com != counter)))
{
DBUG_ASSERT(thd->is_error());
@@ -2318,7 +2319,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
DBUG_ASSERT(subpacket_length <= packet_length);
packet+= subpacket_length;
- packet_length-= subpacket_length;
+ packet_length-= (uint)subpacket_length;
}
com_multi_end:
@@ -2627,7 +2628,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
TRUE error; In this case thd->fatal_error is set
*/
-bool alloc_query(THD *thd, const char *packet, uint packet_length)
+bool alloc_query(THD *thd, const char *packet, size_t packet_length)
{
char *query;
/* Remove garbage at start and end of query */
@@ -7455,16 +7456,16 @@ bool check_stack_overrun(THD *thd, long margin,
#define MY_YACC_INIT 1000 // Start with big alloc
#define MY_YACC_MAX 32000 // Because of 'short'
-bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, ulong *yystacksize)
+bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, size_t *yystacksize)
{
Yacc_state *state= & current_thd->m_parser_state->m_yacc;
- ulong old_info=0;
+ size_t old_info=0;
DBUG_ASSERT(state);
- if ((uint) *yystacksize >= MY_YACC_MAX)
+ if ( *yystacksize >= MY_YACC_MAX)
return 1;
if (!state->yacc_yyvs)
old_info= *yystacksize;
- *yystacksize= set_zone((*yystacksize)*2,MY_YACC_INIT,MY_YACC_MAX);
+ *yystacksize= set_zone((int)(*yystacksize)*2,MY_YACC_INIT,MY_YACC_MAX);
if (!(state->yacc_yyvs= (uchar*)
my_realloc(state->yacc_yyvs,
*yystacksize*sizeof(**yyvs),
@@ -9760,7 +9761,7 @@ LEX_USER *create_definer(THD *thd, LEX_CSTRING *user_name,
*/
bool check_string_byte_length(const LEX_CSTRING *str, uint err_msg,
- uint max_byte_length)
+ size_t max_byte_length)
{
if (str->length <= max_byte_length)
return FALSE;
@@ -9790,7 +9791,7 @@ bool check_string_byte_length(const LEX_CSTRING *str, uint err_msg,
bool check_string_char_length(const LEX_CSTRING *str, uint err_msg,
- uint max_char_length, CHARSET_INFO *cs,
+ size_t max_char_length, CHARSET_INFO *cs,
bool no_error)
{
Well_formed_prefix prefix(cs, str->str, str->length, max_char_length);
@@ -9834,7 +9835,7 @@ extern "C" {
int path_starts_from_data_home_dir(const char *path)
{
- int dir_len= strlen(path);
+ size_t dir_len= strlen(path);
DBUG_ENTER("path_starts_from_data_home_dir");
if (mysql_unpacked_real_data_home_len<= dir_len)
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index 7c980823fc2..d23da6f1b68 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -73,9 +73,9 @@ LEX_USER *create_definer(THD *thd, LEX_CSTRING *user_name, LEX_CSTRING *host_nam
LEX_USER *get_current_user(THD *thd, LEX_USER *user, bool lock=true);
bool sp_process_definer(THD *thd);
bool check_string_byte_length(const LEX_CSTRING *str, uint err_msg,
- uint max_byte_length);
+ size_t max_byte_length);
bool check_string_char_length(const LEX_CSTRING *str, uint err_msg,
- uint max_char_length, CHARSET_INFO *cs,
+ size_t max_char_length, CHARSET_INFO *cs,
bool no_error);
bool check_ident_length(const LEX_CSTRING *ident);
CHARSET_INFO* merge_charset_and_collation(CHARSET_INFO *cs, CHARSET_INFO *cl);
@@ -87,7 +87,7 @@ bool mysql_test_parse_for_slave(THD *thd,char *inBuf,uint length);
bool sqlcom_can_generate_row_events(const THD *thd);
bool is_update_query(enum enum_sql_command command);
bool is_log_table_write_query(enum enum_sql_command command);
-bool alloc_query(THD *thd, const char *packet, uint packet_length);
+bool alloc_query(THD *thd, const char *packet, size_t packet_length);
void mysql_init_select(LEX *lex);
void mysql_parse(THD *thd, char *rawbuf, uint length,
Parser_state *parser_state, bool is_com_multi,
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 9b5f6ebc7df..a4d940670e5 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -1863,7 +1863,7 @@ static int add_keyword_path(String *str, const char *keyword,
#ifdef __WIN__
/* Convert \ to / to be able to create table on unix */
char *pos, *end;
- uint length= strlen(temp_path);
+ size_t length= strlen(temp_path);
for (pos= temp_path, end= pos+length ; pos < end ; pos++)
{
if (*pos == '\\')
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index d5f1e88bc11..d733e6c3684 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -240,7 +240,7 @@ ulong dlopen_count;
the following variables/structures
*/
static MEM_ROOT plugin_vars_mem_root;
-static uint global_variables_dynamic_size= 0;
+static size_t global_variables_dynamic_size= 0;
static HASH bookmark_hash;
@@ -730,7 +730,8 @@ static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, int report)
{
#ifdef HAVE_DLOPEN
char dlpath[FN_REFLEN];
- uint plugin_dir_len, dummy_errors, i;
+ size_t plugin_dir_len,i;
+ uint dummy_errors;
struct st_plugin_dl *tmp= 0, plugin_dl;
void *sym;
st_ptr_backup tmp_backup[array_elements(list_of_services)];
@@ -1518,14 +1519,14 @@ uchar *get_bookmark_hash_key(const uchar *buff, size_t *length,
return (uchar*) var->key;
}
-static inline void convert_dash_to_underscore(char *str, int len)
+static inline void convert_dash_to_underscore(char *str, size_t len)
{
for (char *p= str; p <= str+len; p++)
if (*p == '-')
*p= '_';
}
-static inline void convert_underscore_to_dash(char *str, int len)
+static inline void convert_underscore_to_dash(char *str, size_t len)
{
for (char *p= str; p <= str+len; p++)
if (*p == '_')
@@ -2885,7 +2886,7 @@ static st_bookmark *find_bookmark(const char *plugin, const char *name,
int flags)
{
st_bookmark *result= NULL;
- uint namelen, length, pluginlen= 0;
+ size_t namelen, length, pluginlen= 0;
char *varname, *p;
if (!(flags & PLUGIN_VAR_THDLOCAL))
@@ -2941,7 +2942,7 @@ static size_t var_storage_size(int flags)
static st_bookmark *register_var(const char *plugin, const char *name,
int flags)
{
- uint length= strlen(plugin) + strlen(name) + 3, size, offset, new_size;
+ size_t length= strlen(plugin) + strlen(name) + 3, size, offset, new_size;
st_bookmark *result;
char *varname, *p;
@@ -2960,7 +2961,7 @@ static st_bookmark *register_var(const char *plugin, const char *name,
sizeof(struct st_bookmark) + length-1);
varname[0]= plugin_var_bookmark_key(flags);
memcpy(result->key, varname, length);
- result->name_len= length - 2;
+ result->name_len= (uint)(length - 2);
result->offset= -1;
DBUG_ASSERT(size && !(size & (size-1))); /* must be power of 2 */
@@ -2993,10 +2994,10 @@ static st_bookmark *register_var(const char *plugin, const char *name,
global_variables_dynamic_size= new_size;
}
- global_system_variables.dynamic_variables_head= offset;
- max_system_variables.dynamic_variables_head= offset;
- global_system_variables.dynamic_variables_size= offset + size;
- max_system_variables.dynamic_variables_size= offset + size;
+ global_system_variables.dynamic_variables_head= (uint)offset;
+ max_system_variables.dynamic_variables_head= (uint)offset;
+ global_system_variables.dynamic_variables_size= (uint)(offset + size);
+ max_system_variables.dynamic_variables_size= (uint)(offset + size);
global_system_variables.dynamic_variables_version++;
max_system_variables.dynamic_variables_version++;
@@ -3694,8 +3695,8 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
{
const char *plugin_name= tmp->plugin->name;
const LEX_CSTRING plugin_dash = { STRING_WITH_LEN("plugin-") };
- uint plugin_name_len= strlen(plugin_name);
- uint optnamelen;
+ size_t plugin_name_len= strlen(plugin_name);
+ size_t optnamelen;
const int max_comment_len= 180;
char *comment= (char *) alloc_root(mem_root, max_comment_len + 1);
char *optname;
@@ -4020,7 +4021,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
my_option *opts= NULL;
int error= 1;
struct st_bookmark *var;
- uint len=0, count= EXTRA_OPTIONS;
+ size_t len=0, count= EXTRA_OPTIONS;
st_ptr_backup *tmp_backup= 0;
DBUG_ENTER("test_plugin_options");
DBUG_ASSERT(tmp->plugin && tmp->name.str);
diff --git a/sql/sql_prepare.h b/sql/sql_prepare.h
index 203b37b3b26..4eb50b9b9d8 100644
--- a/sql/sql_prepare.h
+++ b/sql/sql_prepare.h
@@ -215,21 +215,6 @@ public:
bool execute_direct(Server_runnable *server_runnable);
/**
- Get the number of result set fields.
-
- This method is valid only if we have a result:
- execute_direct() has been called. Otherwise
- the returned value is undefined.
-
- @sa Documentation for C API function
- mysql_field_count()
- */
- ulong get_field_count() const
- {
- return m_current_rset ? m_current_rset->get_field_count() : 0;
- }
-
- /**
Get the number of affected (deleted, updated)
rows for the current statement. Can be
used for statements with get_field_count() == 0.
diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc
index c1a13ebd210..13f03fed5f3 100644
--- a/sql/sql_profile.cc
+++ b/sql/sql_profile.cc
@@ -284,11 +284,10 @@ QUERY_PROFILE::~QUERY_PROFILE()
/**
@todo Provide a way to include the full text, as in SHOW PROCESSLIST.
*/
-void QUERY_PROFILE::set_query_source(char *query_source_arg,
- uint query_length_arg)
+void QUERY_PROFILE::set_query_source(char *query_source_arg, size_t query_length_arg)
{
/* Truncate to avoid DoS attacks. */
- uint length= MY_MIN(MAX_QUERY_LENGTH, query_length_arg);
+ size_t length= MY_MIN(MAX_QUERY_LENGTH, query_length_arg);
DBUG_ASSERT(query_source == NULL); /* we don't leak memory */
if (query_source_arg != NULL)
diff --git a/sql/sql_profile.h b/sql/sql_profile.h
index c96828fc678..cb553d2f757 100644
--- a/sql/sql_profile.h
+++ b/sql/sql_profile.h
@@ -227,7 +227,7 @@ private:
QUERY_PROFILE(PROFILING *profiling_arg, const char *status_arg);
~QUERY_PROFILE();
- void set_query_source(char *query_source_arg, uint query_length_arg);
+ void set_query_source(char *query_source_arg, size_t query_length_arg);
/* Add a profile status change to the current profile. */
void new_status(const char *status_arg,
@@ -275,7 +275,7 @@ public:
This must be called exactly once per descrete statement.
*/
- void set_query_source(char *query_source_arg, uint query_length_arg)
+ void set_query_source(char *query_source_arg, size_t query_length_arg)
{
if (unlikely(current))
current->set_query_source(query_source_arg, query_length_arg);
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 2bca32ddcda..e1d1190e58f 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -828,8 +828,8 @@ static int send_heartbeat_event(binlog_send_info *info,
char* p= coord->file_name + dirname_length(coord->file_name);
- uint ident_len = strlen(p);
- ulong event_len = ident_len + LOG_EVENT_HEADER_LEN +
+ size_t ident_len = strlen(p);
+ size_t event_len = ident_len + LOG_EVENT_HEADER_LEN +
(do_checksum ? BINLOG_CHECKSUM_LEN : 0);
int4store(header + SERVER_ID_OFFSET, global_system_variables.server_id);
int4store(header + EVENT_LEN_OFFSET, event_len);
@@ -3409,7 +3409,7 @@ static bool get_string_parameter(char *to, const char *from, size_t length,
if (from) // Empty paramaters allowed
{
size_t from_length= strlen(from);
- uint from_numchars= cs->cset->numchars(cs, from, from + from_length);
+ size_t from_numchars= cs->cset->numchars(cs, from, from + from_length);
if (from_numchars > length / cs->mbmaxlen)
{
my_error(ER_WRONG_STRING_LENGTH, MYF(0), from, name,
@@ -4124,7 +4124,7 @@ bool show_binlog_info(THD* thd)
{
LOG_INFO li;
mysql_bin_log.get_current_log(&li);
- int dir_len = dirname_length(li.log_file_name);
+ size_t dir_len = dirname_length(li.log_file_name);
protocol->store(li.log_file_name + dir_len, &my_charset_bin);
protocol->store((ulonglong) li.pos);
protocol->store(binlog_filter->get_do_db());
@@ -4166,8 +4166,8 @@ bool show_binlogs(THD* thd)
File file;
char fname[FN_REFLEN];
List<Item> field_list;
- uint length;
- int cur_dir_len;
+ size_t length;
+ size_t cur_dir_len;
Protocol *protocol= thd->protocol;
DBUG_ENTER("show_binlogs");
@@ -4197,7 +4197,7 @@ bool show_binlogs(THD* thd)
/* The file ends with EOF or empty line */
while ((length=my_b_gets(index_file, fname, sizeof(fname))) > 1)
{
- int dir_len;
+ size_t dir_len;
ulonglong file_length= 0; // Length if open fails
fname[--length] = '\0'; // remove the newline
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 2c1452e8096..9cef3027e78 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -24972,7 +24972,7 @@ bool JOIN_TAB::save_explain_data(Explain_table_access *eta,
if (table->derived_select_number)
{
/* Derived table name generation */
- int len= my_snprintf(table_name_buffer, sizeof(table_name_buffer)-1,
+ size_t len= my_snprintf(table_name_buffer, sizeof(table_name_buffer)-1,
"<derived%u>",
table->derived_select_number);
eta->table_name.copy(table_name_buffer, len, cs);
@@ -24981,7 +24981,7 @@ bool JOIN_TAB::save_explain_data(Explain_table_access *eta,
{
JOIN_TAB *ctab= bush_children->start;
/* table */
- int len= my_snprintf(table_name_buffer,
+ size_t len= my_snprintf(table_name_buffer,
sizeof(table_name_buffer)-1,
"<subquery%d>",
ctab->emb_sj_nest->sj_subq_pred->get_identifier());
@@ -25330,7 +25330,7 @@ bool JOIN_TAB::save_explain_data(Explain_table_access *eta,
{
char namebuf[NAME_LEN];
/* Derived table name generation */
- int len= my_snprintf(namebuf, sizeof(namebuf)-1,
+ size_t len= my_snprintf(namebuf, sizeof(namebuf)-1,
"<derived%u>",
prev_table->derived_select_number);
eta->firstmatch_table_name.append(namebuf, len);
diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc
index 4a0addc7b07..353d1f551a5 100644
--- a/sql/sql_servers.cc
+++ b/sql/sql_servers.cc
@@ -85,7 +85,7 @@ static uchar *servers_cache_get_key(FOREIGN_SERVER *server, size_t *length,
my_bool not_used __attribute__((unused)))
{
DBUG_ENTER("servers_cache_get_key");
- DBUG_PRINT("info", ("server_name_length %d server_name %s",
+ DBUG_PRINT("info", ("server_name_length %zd server_name %s",
server->server_name_length,
server->server_name));
@@ -433,7 +433,7 @@ insert_server_record_into_cache(FOREIGN_SERVER *server)
We succeded in insertion of the server to the table, now insert
the server to the cache
*/
- DBUG_PRINT("info", ("inserting server %s at %p, length %d",
+ DBUG_PRINT("info", ("inserting server %s at %p, length %zd",
server->server_name, server,
server->server_name_length));
if (my_hash_insert(&servers_cache, (uchar*) server))
@@ -689,7 +689,7 @@ delete_server_record_in_cache(LEX_SERVER_OPTIONS *server_options)
We succeded in deletion of the server to the table, now delete
the server from the cache
*/
- DBUG_PRINT("info",("deleting server %s length %d",
+ DBUG_PRINT("info",("deleting server %s length %zd",
server->server_name,
server->server_name_length));
diff --git a/sql/sql_servers.h b/sql/sql_servers.h
index 1cb05416c63..b2fa40cef27 100644
--- a/sql/sql_servers.h
+++ b/sql/sql_servers.h
@@ -27,7 +27,7 @@ typedef struct st_federated_server
{
const char *server_name;
long port;
- uint server_name_length;
+ size_t server_name_length;
const char *db, *scheme, *username, *password, *socket, *owner, *host, *sport;
} FOREIGN_SERVER;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 4fc0b65b774..2e06b912891 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -174,7 +174,7 @@ static bool is_show_command(THD *thd)
static int make_version_string(char *buf, int buf_length, uint version)
{
- return my_snprintf(buf, buf_length, "%d.%d", version>>8,version&0xff);
+ return (int)my_snprintf(buf, buf_length, "%d.%d", version>>8,version&0xff);
}
@@ -1627,7 +1627,7 @@ static const char *require_quotes(const char *name, uint name_length)
*/
bool
-append_identifier(THD *thd, String *packet, const char *name, uint length)
+append_identifier(THD *thd, String *packet, const char *name, size_t length)
{
const char *name_end;
char quote_char;
@@ -1706,11 +1706,11 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
# Quote character
*/
-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)
{
if (length &&
- !is_keyword(name,length) &&
- !require_quotes(name, length) &&
+ !is_keyword(name,(uint)length) &&
+ !require_quotes(name, (uint)length) &&
!(thd->variables.option_bits & OPTION_QUOTE_SHOW_CREATE))
return EOF;
if (thd->variables.sql_mode & MODE_ANSI_QUOTES)
@@ -1726,7 +1726,7 @@ static void append_directory(THD *thd, String *packet, const char *dir_type,
{
if (filename && !(thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE))
{
- uint length= dirname_length(filename);
+ size_t length= dirname_length(filename);
packet->append(' ');
packet->append(dir_type);
packet->append(STRING_WITH_LEN(" DIRECTORY='"));
@@ -6736,7 +6736,7 @@ static int get_schema_views_record(THD *thd, TABLE_LIST *tables,
static bool
store_constraints(THD *thd, TABLE *table, const LEX_CSTRING *db_name,
const LEX_CSTRING *table_name, const char *key_name,
- uint key_len, const char *con_type, uint con_len)
+ size_t key_len, const char *con_type, size_t con_len)
{
CHARSET_INFO *cs= system_charset_info;
restore_record(table, s->default_values);
@@ -6932,7 +6932,7 @@ ret:
static void
store_key_column_usage(TABLE *table, const LEX_CSTRING *db_name,
const LEX_CSTRING *table_name, const char *key_name,
- uint key_len, const char *con_type, uint con_len,
+ size_t key_len, const char *con_type, size_t con_len,
longlong idx)
{
CHARSET_INFO *cs= system_charset_info;
@@ -7965,7 +7965,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
for (; fields_info->field_name; fields_info++)
{
- uint field_name_length= strlen(fields_info->field_name);
+ size_t field_name_length= strlen(fields_info->field_name);
switch (fields_info->field_type) {
case MYSQL_TYPE_TINY:
case MYSQL_TYPE_LONG:
@@ -7985,14 +7985,14 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
case MYSQL_TYPE_DATE:
if (!(item=new (mem_root)
Item_return_date_time(thd, fields_info->field_name,
- field_name_length,
+ (uint)field_name_length,
fields_info->field_type)))
DBUG_RETURN(0);
break;
case MYSQL_TYPE_TIME:
if (!(item=new (mem_root)
Item_return_date_time(thd, fields_info->field_name,
- field_name_length,
+ (uint)field_name_length,
fields_info->field_type)))
DBUG_RETURN(0);
break;
@@ -8000,7 +8000,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
case MYSQL_TYPE_DATETIME:
if (!(item=new (mem_root)
Item_return_date_time(thd, fields_info->field_name,
- field_name_length,
+ (uint)field_name_length,
fields_info->field_type,
fields_info->field_length)))
DBUG_RETURN(0);
@@ -8721,7 +8721,7 @@ int hton_fill_schema_table(THD *thd, TABLE_LIST *tables, COND *cond)
static
int store_key_cache_table_record(THD *thd, TABLE *table,
- const char *name, uint name_length,
+ const char *name, size_t name_length,
KEY_CACHE *key_cache,
uint partitions, uint partition_no)
{
@@ -9816,7 +9816,7 @@ static bool show_create_trigger_impl(THD *thd, Trigger *trigger)
fields.push_back(new (mem_root) Item_empty_string(thd, "Trigger", NAME_LEN),
mem_root);
fields.push_back(new (mem_root)
- Item_empty_string(thd, "sql_mode", trg_sql_mode_str.length),
+ Item_empty_string(thd, "sql_mode", (uint)trg_sql_mode_str.length),
mem_root);
{
@@ -9827,7 +9827,7 @@ static bool show_create_trigger_impl(THD *thd, Trigger *trigger)
Item_empty_string *stmt_fld=
new (mem_root) Item_empty_string(thd, "SQL Original Statement",
- MY_MAX(trg_sql_original_stmt.length,
+ (uint)MY_MAX(trg_sql_original_stmt.length,
1024));
stmt_fld->maybe_null= TRUE;
diff --git a/sql/sql_show.h b/sql/sql_show.h
index 2715e0405bd..f6d5d4d2c3c 100644
--- a/sql/sql_show.h
+++ b/sql/sql_show.h
@@ -82,8 +82,7 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
int copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table);
-bool append_identifier(THD *thd, String *packet, const char *name,
- uint length);
+bool append_identifier(THD *thd, String *packet, const char *name, size_t length);
static inline bool append_identifier(THD *thd, String *packet, const LEX_CSTRING *name)
{
return append_identifier(thd, packet, name->str, name->length);
@@ -143,7 +142,7 @@ const char* get_one_variable(THD *thd, const SHOW_VAR *variable,
size_t *length);
/* These functions were under INNODB_COMPATIBILITY_HOOKS */
-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);
THD *find_thread_by_id(longlong id, bool query_id= false);
class select_result_explain_buffer;
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index d0d0e35000d..390abe36b6c 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -240,8 +240,8 @@ bool String::copy(const char *str,size_t arg_length, CHARSET_INFO *cs)
{
if (alloc(arg_length))
return TRUE;
- DBUG_ASSERT(arg_length < UINT_MAX32);
- if ((str_length=arg_length))
+ DBUG_ASSERT(arg_length <= UINT_MAX32);
+ if ((str_length=(uint32)arg_length))
memcpy(Ptr,str,arg_length);
Ptr[arg_length]=0;
str_charset=cs;
@@ -271,7 +271,7 @@ bool String::copy(const char *str,size_t arg_length, CHARSET_INFO *cs)
character_set_results is NULL.
*/
-bool String::needs_conversion(uint32 arg_length,
+bool String::needs_conversion(size_t arg_length,
CHARSET_INFO *from_cs,
CHARSET_INFO *to_cs,
uint32 *offset)
@@ -282,7 +282,7 @@ bool String::needs_conversion(uint32 arg_length,
(to_cs == from_cs) ||
my_charset_same(from_cs, to_cs) ||
((from_cs == &my_charset_bin) &&
- (!(*offset=(arg_length % to_cs->mbminlen)))))
+ (!(*offset=(uint32)(arg_length % to_cs->mbminlen)))))
return FALSE;
return TRUE;
}
@@ -300,7 +300,7 @@ bool String::needs_conversion(uint32 arg_length,
@return conversion needed
*/
-bool String::needs_conversion_on_storage(uint32 arg_length,
+bool String::needs_conversion_on_storage(size_t arg_length,
CHARSET_INFO *cs_from,
CHARSET_INFO *cs_to)
{
@@ -349,14 +349,14 @@ bool String::needs_conversion_on_storage(uint32 arg_length,
1 error
*/
-bool String::copy_aligned(const char *str,uint32 arg_length, uint32 offset,
+bool String::copy_aligned(const char *str, size_t arg_length, size_t offset,
CHARSET_INFO *cs)
{
/* How many bytes are in incomplete character */
offset= cs->mbminlen - offset; /* How many zeros we should prepend */
DBUG_ASSERT(offset && offset != cs->mbminlen);
- uint32 aligned_length= arg_length + offset;
+ size_t aligned_length= arg_length + offset;
if (alloc(aligned_length))
return TRUE;
@@ -369,17 +369,17 @@ bool String::copy_aligned(const char *str,uint32 arg_length, uint32 offset,
memcpy(Ptr + offset, str, arg_length);
Ptr[aligned_length]=0;
/* str_length is always >= 0 as arg_length is != 0 */
- str_length= aligned_length;
+ str_length= (uint32)aligned_length;
str_charset= cs;
return FALSE;
}
-bool String::set_or_copy_aligned(const char *str,uint32 arg_length,
+bool String::set_or_copy_aligned(const char *str, size_t arg_length,
CHARSET_INFO *cs)
{
/* How many bytes are in incomplete character */
- uint32 offset= (arg_length % cs->mbminlen);
+ size_t offset= (arg_length % cs->mbminlen);
if (!offset) /* All characters are complete, just copy */
{
@@ -400,7 +400,7 @@ bool String::set_or_copy_aligned(const char *str,uint32 arg_length,
*/
-bool String::copy(const char *str, uint32 arg_length,
+bool String::copy(const char *str, size_t arg_length,
CHARSET_INFO *from_cs, CHARSET_INFO *to_cs, uint *errors)
{
uint32 offset;
@@ -417,7 +417,7 @@ bool String::copy(const char *str, uint32 arg_length,
*errors= 0;
return copy_aligned(str, arg_length, offset, to_cs);
}
- uint32 new_length= to_cs->mbmaxlen*arg_length;
+ size_t new_length= to_cs->mbmaxlen*arg_length;
if (alloc(new_length))
return TRUE;
str_length=copy_and_convert((char*) Ptr, new_length, to_cs,
@@ -446,7 +446,7 @@ bool String::copy(const char *str, uint32 arg_length,
*/
-bool String::set_ascii(const char *str, uint32 arg_length)
+bool String::set_ascii(const char *str, size_t arg_length)
{
if (str_charset->mbminlen == 1)
{
@@ -454,7 +454,7 @@ bool String::set_ascii(const char *str, uint32 arg_length)
return 0;
}
uint dummy_errors;
- return copy(str, arg_length, &my_charset_latin1, str_charset, &dummy_errors);
+ return copy(str, (uint32)arg_length, &my_charset_latin1, str_charset, &dummy_errors);
}
@@ -563,13 +563,13 @@ bool String::append_ulonglong(ulonglong val)
with character set recoding
*/
-bool String::append(const char *s, uint arg_length, CHARSET_INFO *cs)
+bool String::append(const char *s, size_t arg_length, CHARSET_INFO *cs)
{
uint32 offset;
- if (needs_conversion(arg_length, cs, str_charset, &offset))
+ if (needs_conversion((uint32)arg_length, cs, str_charset, &offset))
{
- uint32 add_length;
+ size_t add_length;
if ((cs == &my_charset_bin) && offset)
{
DBUG_ASSERT(str_charset->mbminlen > offset);
@@ -579,7 +579,7 @@ bool String::append(const char *s, uint arg_length, CHARSET_INFO *cs)
return TRUE;
bzero((char*) Ptr + str_length, offset);
memcpy(Ptr + str_length + offset, s, arg_length);
- str_length+= add_length;
+ str_length+= (uint32)add_length;
return FALSE;
}
@@ -587,15 +587,15 @@ bool String::append(const char *s, uint arg_length, CHARSET_INFO *cs)
uint dummy_errors;
if (realloc_with_extra_if_needed(str_length + add_length))
return TRUE;
- str_length+= copy_and_convert(Ptr+str_length, add_length, str_charset,
- s, arg_length, cs, &dummy_errors);
+ str_length+= copy_and_convert(Ptr+str_length, (uint32)add_length, str_charset,
+ s, (uint32)arg_length, cs, &dummy_errors);
}
else
{
if (realloc_with_extra_if_needed(str_length + arg_length))
return TRUE;
memcpy(Ptr + str_length, s, arg_length);
- str_length+= arg_length;
+ str_length+= (uint32)arg_length;
}
return FALSE;
}
@@ -760,7 +760,7 @@ bool String::replace(uint32 offset,uint32 arg_length,
// added by Holyfoot for "geometry" needs
-int String::reserve(uint32 space_needed, uint32 grow_by)
+int String::reserve(size_t space_needed, size_t grow_by)
{
if (Alloced_length < str_length + space_needed)
{
@@ -770,10 +770,10 @@ int String::reserve(uint32 space_needed, uint32 grow_by)
return FALSE;
}
-void String::qs_append(const char *str, uint32 len)
+void String::qs_append(const char *str, size_t len)
{
memcpy(Ptr + str_length, str, len + 1);
- str_length += len;
+ str_length += (uint32)len;
}
void String::qs_append(double d)
@@ -1072,10 +1072,9 @@ my_copy_with_hex_escaping(CHARSET_INFO *cs,
*/
uint
String_copier::well_formed_copy(CHARSET_INFO *to_cs,
- char *to, uint to_length,
+ char *to, size_t to_length,
CHARSET_INFO *from_cs,
- const char *from, uint from_length,
- uint nchars)
+ const char *from, size_t from_length, size_t nchars)
{
if ((to_cs == &my_charset_bin) ||
(from_cs == &my_charset_bin) ||
@@ -1098,7 +1097,7 @@ String_copier::well_formed_copy(CHARSET_INFO *to_cs,
Does not add the enclosing quotes, this is left up to caller.
*/
#define APPEND(X) if (append(X)) return 1; else break
-bool String::append_for_single_quote(const char *st, uint len)
+bool String::append_for_single_quote(const char *st, size_t len)
{
const char *end= st+len;
for (; st < end; st++)
diff --git a/sql/sql_string.h b/sql/sql_string.h
index fda90f9543e..25940196fda 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -35,12 +35,12 @@ typedef struct st_mem_root MEM_ROOT;
#include "pack.h"
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
-inline uint32 copy_and_convert(char *to, uint32 to_length,
+inline uint32 copy_and_convert(char *to, size_t to_length,
CHARSET_INFO *to_cs,
- const char *from, uint32 from_length,
+ const char *from, size_t from_length,
CHARSET_INFO *from_cs, uint *errors)
{
- return my_convert(to, to_length, to_cs, from, from_length, from_cs, errors);
+ return my_convert(to, (uint)to_length, to_cs, from, (uint)from_length, from_cs, errors);
}
@@ -97,9 +97,8 @@ public:
Convert a string between character sets.
"dstcs" and "srccs" cannot be &my_charset_bin.
*/
- size_t convert_fix(CHARSET_INFO *dstcs, char *dst, uint dst_length,
- CHARSET_INFO *srccs, const char *src, uint src_length,
- uint nchars)
+ size_t convert_fix(CHARSET_INFO *dstcs, char *dst, size_t dst_length,
+ CHARSET_INFO *srccs, const char *src, size_t src_length, size_t nchars)
{
return my_convert_fix(dstcs, dst, dst_length,
srccs, src, src_length, nchars, this, this);
@@ -107,13 +106,11 @@ public:
/*
Copy a string. Fix bad bytes/characters to '?'.
*/
- uint well_formed_copy(CHARSET_INFO *to_cs, char *to, uint to_length,
- CHARSET_INFO *from_cs, const char *from,
- uint from_length, uint nchars);
+ uint well_formed_copy(CHARSET_INFO *to_cs, char *to, size_t to_length,
+ CHARSET_INFO *from_cs, const char *from, size_t from_length, size_t nchars);
// Same as above, but without the "nchars" limit.
- uint well_formed_copy(CHARSET_INFO *to_cs, char *to, uint to_length,
- CHARSET_INFO *from_cs, const char *from,
- uint from_length)
+ uint well_formed_copy(CHARSET_INFO *to_cs, char *to, size_t to_length,
+ CHARSET_INFO *from_cs, const char *from, size_t from_length)
{
return well_formed_copy(to_cs, to, to_length,
from_cs, from, from_length,
@@ -142,7 +139,7 @@ public:
alloced= thread_specific= 0;
str_charset= &my_charset_bin;
}
- String(uint32 length_arg)
+ String(size_t length_arg)
{
alloced= thread_specific= 0;
Alloced_length= extra_alloc= 0; (void) real_alloc(length_arg);
@@ -160,15 +157,15 @@ public:
contructors need the size of memory for STR to be at least LEN+1 (to make
room for zero termination).
*/
- String(const char *str,uint32 len, CHARSET_INFO *cs)
+ String(const char *str,size_t len, CHARSET_INFO *cs)
{
- Ptr=(char*) str; str_length=len; Alloced_length= extra_alloc=0;
+ Ptr=(char*) str; str_length=(uint32)len; Alloced_length= extra_alloc=0;
alloced= thread_specific= 0;
str_charset=cs;
}
- String(char *str,uint32 len, CHARSET_INFO *cs)
+ String(char *str,size_t len, CHARSET_INFO *cs)
{
- Ptr=(char*) str; Alloced_length=str_length=len; extra_alloc= 0;
+ Ptr=(char*) str; Alloced_length=str_length=(uint32)len; extra_alloc= 0;
alloced= thread_specific= 0;
str_charset=cs;
}
@@ -180,7 +177,7 @@ public:
str_charset=str.str_charset;
}
static void *operator new(size_t size, MEM_ROOT *mem_root) throw ()
- { return (void*) alloc_root(mem_root, (uint) size); }
+ { return (void*) alloc_root(mem_root, size); }
static void *operator new[](size_t size, MEM_ROOT *mem_root) throw ()
{ return alloc_root(mem_root, size); }
static void operator delete(void *ptr_arg, size_t size)
@@ -209,9 +206,9 @@ public:
inline uint32 length() const { return str_length;}
inline uint32 alloced_length() const { return Alloced_length;}
inline uint32 extra_allocation() const { return extra_alloc;}
- inline char& operator [] (uint32 i) const { return Ptr[i]; }
- inline void length(uint32 len) { str_length=len ; }
- inline void extra_allocation(uint32 len) { extra_alloc= len; }
+ inline char& operator [] (size_t i) const { return Ptr[i]; }
+ inline void length(size_t len) { str_length=(uint32)len ; }
+ inline void extra_allocation(size_t len) { extra_alloc= (uint32)len; }
inline bool is_empty() const { return (str_length == 0); }
inline void mark_as_const() { Alloced_length= 0;}
inline const char *ptr() const { return Ptr; }
@@ -250,13 +247,13 @@ public:
return skr;
}
- void set(String &str,uint32 offset,uint32 arg_length)
+ void set(String &str,size_t offset,size_t arg_length)
{
DBUG_ASSERT(&str != this);
free();
- Ptr=(char*) str.ptr()+offset; str_length=arg_length;
+ Ptr=(char*) str.ptr()+offset; str_length=(uint32)arg_length;
if (str.Alloced_length)
- Alloced_length=str.Alloced_length-offset;
+ Alloced_length=(uint32)(str.Alloced_length-offset);
str_charset=str.str_charset;
}
@@ -269,24 +266,24 @@ public:
@param cs Character set to use for interpreting string data.
@note The new buffer will not be null terminated.
*/
- inline void set(char *str,uint32 arg_length, CHARSET_INFO *cs)
+ inline void set(char *str,size_t arg_length, CHARSET_INFO *cs)
{
free();
- Ptr=(char*) str; str_length=Alloced_length=arg_length;
+ Ptr=(char*) str; str_length=Alloced_length=(uint32)arg_length;
str_charset=cs;
}
- inline void set(const char *str,uint32 arg_length, CHARSET_INFO *cs)
+ inline void set(const char *str,size_t arg_length, CHARSET_INFO *cs)
{
free();
- Ptr=(char*) str; str_length=arg_length;
+ Ptr=(char*) str; str_length=(uint32)arg_length;
str_charset=cs;
}
- bool set_ascii(const char *str, uint32 arg_length);
- inline void set_quick(char *str,uint32 arg_length, CHARSET_INFO *cs)
+ bool set_ascii(const char *str, size_t arg_length);
+ inline void set_quick(char *str,size_t arg_length, CHARSET_INFO *cs)
{
if (!alloced)
{
- Ptr=(char*) str; str_length=Alloced_length=arg_length;
+ Ptr=(char*) str; str_length=Alloced_length=(uint32)arg_length;
}
str_charset=cs;
}
@@ -303,13 +300,13 @@ public:
bool set_hex(const char *str, uint32 len);
/* Take over handling of buffer from some other object */
- void reset(char *ptr_arg, uint32 length_arg, uint32 alloced_length_arg,
+ void reset(char *ptr_arg, size_t length_arg, size_t alloced_length_arg,
CHARSET_INFO *cs)
{
free();
Ptr= ptr_arg;
- str_length= length_arg;
- Alloced_length= alloced_length_arg;
+ str_length= (uint32)length_arg;
+ Alloced_length= (uint32)alloced_length_arg;
str_charset= cs;
alloced= ptr_arg != 0;
}
@@ -438,29 +435,29 @@ public:
bool copy(); // Alloc string if not alloced
bool copy(const String &s); // Allocate new string
bool copy(const char *s,size_t arg_length, CHARSET_INFO *cs); // Allocate new string
- static bool needs_conversion(uint32 arg_length,
+ static bool needs_conversion(size_t arg_length,
CHARSET_INFO *cs_from, CHARSET_INFO *cs_to,
uint32 *offset);
- static bool needs_conversion_on_storage(uint32 arg_length,
+ static bool needs_conversion_on_storage(size_t arg_length,
CHARSET_INFO *cs_from,
CHARSET_INFO *cs_to);
- bool copy_aligned(const char *s, uint32 arg_length, uint32 offset,
+ bool copy_aligned(const char *s, size_t arg_length, size_t offset,
CHARSET_INFO *cs);
- bool set_or_copy_aligned(const char *s, uint32 arg_length, CHARSET_INFO *cs);
- bool copy(const char*s,uint32 arg_length, CHARSET_INFO *csfrom,
+ bool set_or_copy_aligned(const char *s, size_t arg_length, CHARSET_INFO *cs);
+ bool copy(const char*s, size_t arg_length, CHARSET_INFO *csfrom,
CHARSET_INFO *csto, uint *errors);
bool copy(const String *str, CHARSET_INFO *tocs, uint *errors)
{
return copy(str->ptr(), str->length(), str->charset(), tocs, errors);
}
bool copy(CHARSET_INFO *tocs,
- CHARSET_INFO *fromcs, const char *src, uint32 src_length,
- uint32 nchars, String_copier *copier)
+ CHARSET_INFO *fromcs, const char *src, size_t src_length,
+ size_t nchars, String_copier *copier)
{
if (alloc(tocs->mbmaxlen * src_length))
return true;
str_length= copier->well_formed_copy(tocs, Ptr, Alloced_length,
- fromcs, src, src_length, nchars);
+ fromcs, src, (uint)src_length, (uint)nchars);
str_charset= tocs;
return false;
}
@@ -490,7 +487,7 @@ public:
return append(ls->str, (uint32) ls->length);
}
bool append(const char *s, size_t size);
- bool append(const char *s, uint arg_length, CHARSET_INFO *cs);
+ bool append(const char *s, size_t arg_length, CHARSET_INFO *cs);
bool append_ulonglong(ulonglong val);
bool append_longlong(longlong val);
bool append(IO_CACHE* file, uint32 arg_length);
@@ -538,11 +535,11 @@ public:
uint32 numchars() const;
int charpos(longlong i,uint32 offset=0);
- int reserve(uint32 space_needed)
+ int reserve(size_t space_needed)
{
return realloc(str_length + space_needed);
}
- int reserve(uint32 space_needed, uint32 grow_by);
+ int reserve(size_t space_needed, size_t grow_by);
/*
The following append operations do NOT check alloced memory
@@ -601,9 +598,9 @@ public:
DBUG_ASSERT(ls->length < UINT_MAX32 &&
((ls->length == 0 && !ls->str) ||
ls->length == strlen(ls->str)));
- qs_append(ls->str, ls->length);
+ qs_append(ls->str, (uint32)ls->length);
}
- void qs_append(const char *str, uint32 len);
+ void qs_append(const char *str, size_t len);
void qs_append_hex(const char *str, uint32 len);
void qs_append(double d);
void qs_append(double *d);
@@ -664,7 +661,7 @@ public:
print_with_conversion(to, cs);
}
- bool append_for_single_quote(const char *st, uint len);
+ bool append_for_single_quote(const char *st, size_t len);
bool append_for_single_quote(const String *s)
{
return append_for_single_quote(s->ptr(), s->length());
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index f96b9c40930..fb1f3cfb792 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -95,7 +95,7 @@ static uint blob_length_by_type(enum_field_types type);
@param name_len Length of the name, in bytes
*/
static char* add_identifier(THD* thd, char *to_p, const char * end_p,
- const char* name, uint name_len)
+ const char* name, size_t name_len)
{
uint res;
uint errors;
@@ -215,13 +215,13 @@ uint explain_filename(THD* thd,
char *to_p= to;
char *end_p= to_p + to_length;
const char *db_name= NULL;
- int db_name_len= 0;
+ size_t db_name_len= 0;
const char *table_name;
- int table_name_len= 0;
+ size_t table_name_len= 0;
const char *part_name= NULL;
- int part_name_len= 0;
+ size_t part_name_len= 0;
const char *subpart_name= NULL;
- int subpart_name_len= 0;
+ size_t subpart_name_len= 0;
uint part_type= NORMAL_PART_NAME;
const char *tmp_p;
@@ -381,7 +381,7 @@ uint explain_filename(THD* thd,
Table name length.
*/
-uint filename_to_tablename(const char *from, char *to, uint to_length,
+uint filename_to_tablename(const char *from, char *to, size_t to_length,
bool stay_quiet)
{
uint errors;
@@ -400,7 +400,7 @@ uint filename_to_tablename(const char *from, char *to, uint to_length,
}
DBUG_PRINT("exit", ("to '%s'", to));
- DBUG_RETURN(res);
+ DBUG_RETURN((uint)res);
}
@@ -436,7 +436,7 @@ bool check_mysql50_prefix(const char *name)
non-0 result string length
*/
-uint check_n_cut_mysql50_prefix(const char *from, char *to, uint to_length)
+uint check_n_cut_mysql50_prefix(const char *from, char *to, size_t to_length)
{
if (check_mysql50_prefix(from))
return (uint) (strmake(to, from + MYSQL50_TABLE_NAME_PREFIX_LENGTH,
@@ -465,7 +465,7 @@ static bool check_if_frm_exists(char *path, const char *db, const char *table)
File name length.
*/
-uint tablename_to_filename(const char *from, char *to, uint to_length)
+uint tablename_to_filename(const char *from, char *to, size_t to_length)
{
uint errors, length;
DBUG_ENTER("tablename_to_filename");
@@ -608,7 +608,7 @@ uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen)
size_t length= unpack_filename(buff, buff);
DBUG_PRINT("exit", ("buff: '%s'", buff));
- DBUG_RETURN(length);
+ DBUG_RETURN((uint)length);
}
/*
@@ -2603,8 +2603,8 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
}
else
{
- PSI_CALL_drop_table_share(false, table->db.str, table->db.length,
- table->table_name.str, table->table_name.length);
+ PSI_CALL_drop_table_share(false, table->db.str, (uint)table->db.length,
+ table->table_name.str, (uint)table->table_name.length);
mysql_audit_drop_table(thd, table);
}
@@ -2825,8 +2825,8 @@ bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db,
if (likely(error == 0))
{
- PSI_CALL_drop_table_share(flags & FN_IS_TMP, db->str, db->length,
- table_name->str, table_name->length);
+ PSI_CALL_drop_table_share(flags & FN_IS_TMP, db->str, (uint)db->length,
+ table_name->str, (uint)table_name->length);
}
DBUG_RETURN(error);
@@ -4329,7 +4329,7 @@ bool validate_comment_length(THD *thd, LEX_CSTRING *comment, size_t max_len,
uint err_code, const char *name)
{
DBUG_ENTER("validate_comment_length");
- uint tmp_len= my_charpos(system_charset_info, comment->str,
+ size_t tmp_len= my_charpos(system_charset_info, comment->str,
comment->str + comment->length, max_len);
if (tmp_len < comment->length)
{
@@ -5563,8 +5563,8 @@ mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db,
if (likely(error == 0))
{
PSI_CALL_drop_table_share(flags & FN_FROM_IS_TMP,
- old_db->str, old_db->length,
- old_name->str, old_name->length);
+ old_db->str, (uint)old_db->length,
+ old_name->str, (uint)old_name->length);
}
// Restore options bits to the original value
diff --git a/sql/sql_table.h b/sql/sql_table.h
index 27f649e6dc7..9958a56958e 100644
--- a/sql/sql_table.h
+++ b/sql/sql_table.h
@@ -141,10 +141,10 @@ static const uint SKIP_SYMDIR_ACCESS= 1 << 5;
/** Don't check foreign key constraints while renaming table */
static const uint NO_FK_CHECKS= 1 << 6;
-uint filename_to_tablename(const char *from, char *to, uint to_length,
+uint filename_to_tablename(const char *from, char *to, size_t to_length,
bool stay_quiet = false);
-uint tablename_to_filename(const char *from, char *to, uint to_length);
-uint check_n_cut_mysql50_prefix(const char *from, char *to, uint to_length);
+uint tablename_to_filename(const char *from, char *to, size_t to_length);
+uint check_n_cut_mysql50_prefix(const char *from, char *to, size_t to_length);
bool check_mysql50_prefix(const char *name);
uint build_table_filename(char *buff, size_t bufflen, const char *db,
const char *table, const char *ext, uint flags);
diff --git a/sql/sql_time.cc b/sql/sql_time.cc
index 567739243ff..0dfb1c4d88b 100644
--- a/sql/sql_time.cc
+++ b/sql/sql_time.cc
@@ -256,8 +256,8 @@ adjust_time_range_with_warn(MYSQL_TIME *ltime, uint dec)
*/
static uint
to_ascii(CHARSET_INFO *cs,
- const char *src, uint src_length,
- char *dst, uint dst_length)
+ const char *src, size_t src_length,
+ char *dst, size_t dst_length)
{
int cnvres;
@@ -280,7 +280,7 @@ to_ascii(CHARSET_INFO *cs,
/* Character set-aware version of str_to_time() */
bool
-str_to_time(CHARSET_INFO *cs, const char *str,uint length,
+str_to_time(CHARSET_INFO *cs, const char *str, size_t length,
MYSQL_TIME *l_time, ulonglong fuzzydate, MYSQL_TIME_STATUS *status)
{
char cnv[32];
@@ -294,7 +294,7 @@ str_to_time(CHARSET_INFO *cs, const char *str,uint length,
/* Character set-aware version of str_to_datetime() */
-bool str_to_datetime(CHARSET_INFO *cs, const char *str, uint length,
+bool str_to_datetime(CHARSET_INFO *cs, const char *str, size_t length,
MYSQL_TIME *l_time, ulonglong flags,
MYSQL_TIME_STATUS *status)
{
@@ -318,7 +318,7 @@ bool str_to_datetime(CHARSET_INFO *cs, const char *str, uint length,
bool
str_to_datetime_with_warn(CHARSET_INFO *cs,
- const char *str, uint length, MYSQL_TIME *l_time,
+ const char *str, size_t length, MYSQL_TIME *l_time,
ulonglong flags)
{
MYSQL_TIME_STATUS status;
@@ -786,7 +786,7 @@ DATE_TIME_FORMAT
DATE_TIME_FORMAT *date_time_format_copy(THD *thd, DATE_TIME_FORMAT *format)
{
DATE_TIME_FORMAT *new_format;
- ulong length= sizeof(*format) + format->format.length + 1;
+ size_t length= sizeof(*format) + format->format.length + 1;
char *format_pos;
if (thd)
diff --git a/sql/sql_time.h b/sql/sql_time.h
index 28a2e2f50d2..94f24be3748 100644
--- a/sql/sql_time.h
+++ b/sql/sql_time.h
@@ -38,8 +38,7 @@ bool time_to_datetime(MYSQL_TIME *ltime);
void time_to_daytime_interval(MYSQL_TIME *l_time);
bool get_date_from_daynr(long daynr,uint *year, uint *month, uint *day);
my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, uint *error_code);
-bool str_to_datetime_with_warn(CHARSET_INFO *cs, const char *str,
- uint length, MYSQL_TIME *l_time,
+bool str_to_datetime_with_warn(CHARSET_INFO *cs, const char *str, size_t length, MYSQL_TIME *l_time,
ulonglong flags);
bool double_to_datetime_with_warn(double value, MYSQL_TIME *ltime,
ulonglong fuzzydate,
@@ -122,8 +121,7 @@ void make_truncated_value_warning(THD *thd,
const char *field_name);
static inline void make_truncated_value_warning(THD *thd,
- Sql_condition::enum_warning_level level, const char *str_val,
- uint str_length, timestamp_type time_type,
+ Sql_condition::enum_warning_level level, const char *str_val, size_t str_length, timestamp_type time_type,
const char *field_name)
{
const ErrConvString str(str_val, str_length, &my_charset_bin);
@@ -179,12 +177,12 @@ bool parse_date_time_format(timestamp_type format_type,
const char *format, uint format_length,
DATE_TIME_FORMAT *date_time_format);
/* Character set-aware version of str_to_time() */
-bool str_to_time(CHARSET_INFO *cs, const char *str,uint length,
+bool str_to_time(CHARSET_INFO *cs, const char *str,size_t length,
MYSQL_TIME *l_time, ulonglong fuzzydate,
MYSQL_TIME_STATUS *status);
/* Character set-aware version of str_to_datetime() */
bool str_to_datetime(CHARSET_INFO *cs,
- const char *str, uint length,
+ const char *str, size_t length,
MYSQL_TIME *l_time, ulonglong flags,
MYSQL_TIME_STATUS *status);
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index cf772ca9ccc..3b40ba52b3d 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -35,7 +35,7 @@
#include <mysys_err.h>
LEX_CSTRING *make_lex_string(LEX_CSTRING *lex_str,
- const char* str, uint length,
+ const char* str, size_t length,
MEM_ROOT *mem_root)
{
if (!(lex_str->str= strmake_root(mem_root, str, length)))
@@ -654,7 +654,7 @@ static void build_trig_stmt_query(THD *thd, TABLE_LIST *tables,
{
LEX_CSTRING stmt_definition;
LEX *lex= thd->lex;
- uint prefix_trimmed, suffix_trimmed;
+ size_t prefix_trimmed, suffix_trimmed;
size_t original_length;
/*
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc
index 0f4310fdec1..3eb50d45b42 100644
--- a/sql/sql_udf.cc
+++ b/sql/sql_udf.cc
@@ -312,7 +312,7 @@ static void del_udf(udf_func *udf)
doesn't use it anymore
*/
const char *name= udf->name.str;
- uint name_length=udf->name.length;
+ size_t name_length=udf->name.length;
udf->name.str= "*";
udf->name.length=1;
my_hash_update(&udf_hash,(uchar*) udf,(uchar*) name,name_length);
@@ -347,7 +347,7 @@ void free_udf(udf_func *udf)
/* This is only called if using_udf_functions != 0 */
-udf_func *find_udf(const char *name,uint length,bool mark_used)
+udf_func *find_udf(const char *name,size_t length,bool mark_used)
{
udf_func *udf=0;
DBUG_ENTER("find_udf");
@@ -432,7 +432,7 @@ static int mysql_drop_function_internal(THD *thd, udf_func *udf, TABLE *table)
DBUG_ENTER("mysql_drop_function_internal");
const char *exact_name_str= udf->name.str;
- uint exact_name_len= udf->name.length;
+ size_t exact_name_len= udf->name.length;
del_udf(udf);
/*
diff --git a/sql/sql_udf.h b/sql/sql_udf.h
index 1c805227f97..6e6fed2a81a 100644
--- a/sql/sql_udf.h
+++ b/sql/sql_udf.h
@@ -137,7 +137,7 @@ class udf_handler :public Sql_alloc
#ifdef HAVE_DLOPEN
void udf_init(void),udf_free(void);
-udf_func *find_udf(const char *name, uint len, bool mark_used=0);
+udf_func *find_udf(const char *name, size_t size, bool mark_used=0);
void free_udf(udf_func *udf);
int mysql_create_function(THD *thd,udf_func *udf);
int mysql_drop_function(THD *thd, const LEX_CSTRING *name);
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index f6e0e4dc013..22f90808fdc 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -171,7 +171,7 @@ err:
void make_valid_column_names(THD *thd, List<Item> &item_list)
{
Item *item;
- uint name_len;
+ size_t name_len;
List_iterator_fast<Item> it(item_list);
char buff[NAME_LEN];
DBUG_ENTER("make_valid_column_names");
@@ -1348,7 +1348,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
bool dbchanged;
Parser_state parser_state;
if (parser_state.init(thd, table->select_stmt.str,
- table->select_stmt.length))
+ (uint)table->select_stmt.length))
goto err;
/*
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 792968d7c44..9cb52ffd432 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -80,7 +80,7 @@ int yylex(void *yylval, void *yythd);
#define yyoverflow(A,B,C,D,E,F) \
{ \
- ulong val= *(F); \
+ size_t val= *(F); \
if (my_yyoverflow((B), (D), &val)) \
{ \
yyerror(thd, (char*) (A)); \
@@ -897,7 +897,7 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr)
}
%{
-bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
+bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%}
%pure-parser /* We have threads */
@@ -4981,7 +4981,7 @@ size_number:
uint text_shift_number= 0;
longlong prefix_number;
const char *start_ptr= $1.str;
- uint str_len= $1.length;
+ size_t str_len= $1.length;
const char *end_ptr= start_ptr + str_len;
int error;
prefix_number= my_strtoll10(start_ptr, (char**) &end_ptr, &error);
@@ -15082,7 +15082,7 @@ IDENT_sys:
if (thd->charset_is_system_charset)
{
CHARSET_INFO *cs= system_charset_info;
- uint wlen= Well_formed_prefix(cs, $1.str, $1.length).length();
+ size_t wlen= Well_formed_prefix(cs, $1.str, $1.length).length();
if (wlen < $1.length)
{
ErrConvString err($1.str, $1.length, &my_charset_bin);
@@ -17248,13 +17248,11 @@ view_select:
{
LEX *lex= Lex;
size_t len= YYLIP->get_cpp_ptr() - lex->create_view->select.str;
- uint not_used;
void *create_view_select= thd->memdup(lex->create_view->select.str, len);
lex->create_view->select.length= len;
lex->create_view->select.str= (char *) create_view_select;
trim_whitespace(thd->charset(),
- &lex->create_view->select,
- &not_used);
+ &lex->create_view->select);
lex->create_view->check= $4;
lex->parsing_options.allows_variable= TRUE;
lex->current_select->set_with_clause($2);
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index 63d9e381c37..48e778f1661 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -78,7 +78,7 @@ int yylex(void *yylval, void *yythd);
#define yyoverflow(A,B,C,D,E,F) \
{ \
- ulong val= *(F); \
+ size_t val= *(F); \
if (my_yyoverflow((B), (D), &val)) \
{ \
yyerror(thd, (char*) (A)); \
@@ -268,7 +268,7 @@ void ORAerror(THD *thd, const char *s)
}
%{
-bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
+bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%}
%pure-parser /* We have threads */
@@ -4631,7 +4631,7 @@ size_number:
uint text_shift_number= 0;
longlong prefix_number;
const char *start_ptr= $1.str;
- uint str_len= $1.length;
+ size_t str_len= $1.length;
const char *end_ptr= start_ptr + str_len;
int error;
prefix_number= my_strtoll10(start_ptr, (char**) &end_ptr, &error);
@@ -14547,7 +14547,7 @@ IDENT_sys:
if (thd->charset_is_system_charset)
{
CHARSET_INFO *cs= system_charset_info;
- uint wlen= Well_formed_prefix(cs, $1.str, $1.length).length();
+ size_t wlen= Well_formed_prefix(cs, $1.str, $1.length).length();
if (wlen < $1.length)
{
ErrConvString err($1.str, $1.length, &my_charset_bin);
@@ -16789,13 +16789,11 @@ view_select:
{
LEX *lex= Lex;
size_t len= YYLIP->get_cpp_ptr() - lex->create_view->select.str;
- uint not_used;
void *create_view_select= thd->memdup(lex->create_view->select.str, len);
lex->create_view->select.length= len;
lex->create_view->select.str= (char *) create_view_select;
trim_whitespace(thd->charset(),
- &lex->create_view->select,
- &not_used);
+ &lex->create_view->select);
lex->create_view->check= $4;
lex->parsing_options.allows_variable= TRUE;
lex->current_select->set_with_clause($2);
diff --git a/sql/strfunc.cc b/sql/strfunc.cc
index 45a0f8f6558..43089684061 100644
--- a/sql/strfunc.cc
+++ b/sql/strfunc.cc
@@ -45,7 +45,7 @@
static const char field_separator=',';
-ulonglong find_set(TYPELIB *lib, const char *str, uint length, CHARSET_INFO *cs,
+ulonglong find_set(TYPELIB *lib, const char *str, size_t length, CHARSET_INFO *cs,
char **err_pos, uint *err_len, bool *set_warning)
{
CHARSET_INFO *strip= cs ? cs : &my_charset_latin1;
@@ -111,7 +111,7 @@ ulonglong find_set(TYPELIB *lib, const char *str, uint length, CHARSET_INFO *cs,
> 0 position in TYPELIB->type_names +1
*/
-uint find_type(const TYPELIB *lib, const char *find, uint length,
+uint find_type(const TYPELIB *lib, const char *find, size_t length,
bool part_match)
{
uint found_count=0, found_pos=0;
@@ -152,7 +152,7 @@ uint find_type(const TYPELIB *lib, const char *find, uint length,
>0 Offset+1 in typelib for matched string
*/
-uint find_type2(const TYPELIB *typelib, const char *x, uint length,
+uint find_type2(const TYPELIB *typelib, const char *x, size_t length,
CHARSET_INFO *cs)
{
int pos;
@@ -265,8 +265,8 @@ uint check_word(TYPELIB *lib, const char *val, const char *end,
*/
-uint strconvert(CHARSET_INFO *from_cs, const char *from, uint from_length,
- CHARSET_INFO *to_cs, char *to, uint to_length, uint *errors)
+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)
{
int cnvres;
my_wc_t wc;
diff --git a/sql/strfunc.h b/sql/strfunc.h
index 1aba0bff422..1bf3cbf47b3 100644
--- a/sql/strfunc.h
+++ b/sql/strfunc.h
@@ -18,15 +18,15 @@
typedef struct st_typelib TYPELIB;
-ulonglong find_set(TYPELIB *lib, const char *x, uint length, CHARSET_INFO *cs,
+ulonglong find_set(TYPELIB *lib, const char *x, size_t length, CHARSET_INFO *cs,
char **err_pos, uint *err_len, bool *set_warning);
ulonglong find_set_from_flags(TYPELIB *lib, uint default_name,
ulonglong cur_set, ulonglong default_set,
const char *str, uint length, CHARSET_INFO *cs,
char **err_pos, uint *err_len, bool *set_warning);
-uint find_type(const TYPELIB *lib, const char *find, uint length,
+uint find_type(const TYPELIB *lib, const char *find, size_t length,
bool part_match);
-uint find_type2(const TYPELIB *lib, const char *find, uint length,
+uint find_type2(const TYPELIB *lib, const char *find, size_t length,
CHARSET_INFO *cs);
void unhex_type2(TYPELIB *lib);
uint check_word(TYPELIB *lib, const char *val, const char *end,
@@ -42,7 +42,7 @@ const char *set_to_string(THD *thd, LEX_CSTRING *result, ulonglong set,
/*
These functions were protected by INNODB_COMPATIBILITY_HOOKS
*/
-uint strconvert(CHARSET_INFO *from_cs, const char *from, uint from_length,
- CHARSET_INFO *to_cs, char *to, uint to_length, uint *errors);
+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);
#endif /* STRFUNC_INCLUDED */
diff --git a/sql/structs.h b/sql/structs.h
index 4a66ac63d23..4d05a2433cc 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -330,7 +330,7 @@ typedef struct st_user_stats
typedef struct st_table_stats
{
char table[NAME_LEN * 2 + 2]; // [db] + '\0' + [table] + '\0'
- uint table_name_length;
+ size_t table_name_length;
ulonglong rows_read, rows_changed;
ulonglong rows_changed_x_indexes;
/* Stores enum db_type, but forward declarations cannot be done */
@@ -341,7 +341,7 @@ typedef struct st_index_stats
{
// [db] + '\0' + [table] + '\0' + [index] + '\0'
char index[NAME_LEN * 3 + 3];
- uint index_name_length; /* Length of 'index' */
+ size_t index_name_length; /* Length of 'index' */
ulonglong rows_read;
} INDEX_STATS;
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 94c77136993..4e49d524ce5 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -2819,7 +2819,7 @@ static Sys_var_enum Sys_thread_handling(
#ifdef HAVE_QUERY_CACHE
static bool fix_query_cache_size(sys_var *self, THD *thd, enum_var_type type)
{
- ulong new_cache_size= query_cache.resize((ulong)query_cache_size);
+ size_t new_cache_size= query_cache.resize((size_t)query_cache_size);
/*
Note: query_cache_size is a global variable reflecting the
requested cache size. See also query_cache_size_arg
@@ -2827,7 +2827,7 @@ static bool fix_query_cache_size(sys_var *self, THD *thd, enum_var_type type)
if (query_cache_size != new_cache_size)
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
ER_WARN_QC_RESIZE, ER_THD(thd, ER_WARN_QC_RESIZE),
- query_cache_size, new_cache_size);
+ query_cache_size, (ulong)new_cache_size);
query_cache_size= new_cache_size;
@@ -2858,7 +2858,7 @@ static Sys_var_ulong Sys_query_cache_limit(
static bool fix_qcache_min_res_unit(sys_var *self, THD *thd, enum_var_type type)
{
query_cache_min_res_unit=
- query_cache.set_min_res_unit(query_cache_min_res_unit);
+ (ulong)query_cache.set_min_res_unit(query_cache_min_res_unit);
return false;
}
static Sys_var_ulong Sys_query_cache_min_res_unit(
diff --git a/sql/sys_vars_shared.h b/sql/sys_vars_shared.h
index ff050f63064..48154c95a72 100644
--- a/sql/sys_vars_shared.h
+++ b/sql/sys_vars_shared.h
@@ -32,7 +32,7 @@ extern bool throw_bounds_warning(THD *thd, const char *name,
bool fixed, bool is_unsigned, longlong v);
extern bool throw_bounds_warning(THD *thd, const char *name, bool fixed,
double v);
-extern sys_var *intern_find_sys_var(const char *str, uint length);
+extern sys_var *intern_find_sys_var(const char *str, size_t length);
extern sys_var_chain all_sys_vars;
diff --git a/sql/table.cc b/sql/table.cc
index f220e21920d..5546c5b497f 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -87,7 +87,7 @@ static void fix_type_pointers(const char ***array, TYPELIB *point_to_type,
uint types, char **names);
static uint find_field(Field **fields, uchar *record, uint start, uint length);
-inline bool is_system_table_name(const char *name, uint length);
+inline bool is_system_table_name(const char *name, size_t length);
/**************************************************************************
Object_creation_ctx implementation.
@@ -509,7 +509,7 @@ void free_table_share(TABLE_SHARE *share)
and should not contain user tables.
*/
-inline bool is_system_table_name(const char *name, uint length)
+inline bool is_system_table_name(const char *name, size_t length)
{
CHARSET_INFO *ci= system_charset_info;
@@ -1190,10 +1190,11 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
enum legacy_db_type legacy_db_type;
my_bitmap_map *bitmaps;
bool null_bits_are_used;
- uint vcol_screen_length, UNINIT_VAR(options_len);
+ uint vcol_screen_length;
+ size_t UNINIT_VAR(options_len);
uchar *vcol_screen_pos;
const uchar *options= 0;
- uint UNINIT_VAR(gis_options_len);
+ size_t UNINIT_VAR(gis_options_len);
const uchar *gis_options= 0;
KEY first_keyinfo;
uint len;
@@ -1711,7 +1712,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
for (count= 0; count < interval->count; count++)
{
char *val= (char*) interval->type_names[count];
- interval->type_lengths[count]= strlen(val);
+ interval->type_lengths[count]= (uint)strlen(val);
}
interval->type_lengths[count]= 0;
}
@@ -3804,7 +3805,7 @@ static uint find_field(Field **fields, uchar *record, uint start, uint length)
May fail with some multibyte charsets though.
*/
-void append_unescaped(String *res, const char *pos, uint length)
+void append_unescaped(String *res, const char *pos, size_t length)
{
const char *end= pos+length;
res->append('\'');
@@ -3855,7 +3856,7 @@ void append_unescaped(String *res, const char *pos, uint length)
void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
HA_CREATE_INFO *create_info, uint keys, KEY *key_info)
{
- ulong key_comment_total_bytes= 0;
+ size_t key_comment_total_bytes= 0;
uint i;
DBUG_ENTER("prepare_frm_header");
@@ -3865,7 +3866,7 @@ void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
if (create_info->min_rows > UINT_MAX32)
create_info->min_rows= UINT_MAX32;
- uint key_length, tmp_key_length, tmp, csid;
+ size_t key_length, tmp_key_length, tmp, csid;
bzero((char*) fileinfo, FRM_HEADER_SIZE);
/* header */
fileinfo[0]=(uchar) 254;
@@ -4091,7 +4092,7 @@ bool ok_for_lower_case_names(const char *name)
bool check_db_name(LEX_STRING *org_name)
{
char *name= org_name->str;
- uint name_length= org_name->length;
+ size_t name_length= org_name->length;
bool check_for_path_chars;
if ((check_for_path_chars= check_mysql50_prefix(name)))
@@ -8937,7 +8938,7 @@ void vers_select_conds_t::resolve_units(bool timestamps_only)
Field *TABLE::find_field_by_name(LEX_CSTRING *str) const
{
- uint length= str->length;
+ size_t length= str->length;
for (Field **tmp= field; *tmp; tmp++)
{
if ((*tmp)->field_name.length == length &&
diff --git a/sql/table.h b/sql/table.h
index 79742ff7111..b6adbfc6188 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1074,7 +1074,7 @@ public:
@retval Pointer to the copied string.
@retval 0 if an error occurred.
*/
- char *store(const char *from, uint length)
+ char *store(const char *from, size_t length)
{
return (char*) memdup_root(&storage, from, length);
}
@@ -2791,7 +2791,7 @@ typedef struct st_changed_table_list
{
struct st_changed_table_list *next;
char *key;
- uint32 key_length;
+ size_t key_length;
} CHANGED_TABLE_LIST;
@@ -2916,7 +2916,7 @@ int closefrm(TABLE *table);
void free_blobs(TABLE *table);
void free_field_buffers_larger_than(TABLE *table, uint32 size);
ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
-void append_unescaped(String *res, const char *pos, uint length);
+void append_unescaped(String *res, const char *pos, size_t length);
void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
HA_CREATE_INFO *create_info, uint keys, KEY *key_info);
const char *fn_frm_ext(const char *name);
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index 5ca4dd9f175..18ea7f83964 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -587,17 +587,17 @@ static void lf_alloc_destructor(uchar *arg)
}
-static void tdc_hash_initializer(LF_HASH *hash __attribute__((unused)),
+static void tdc_hash_initializer(LF_HASH *,
TDC_element *element, LEX_STRING *key)
{
memcpy(element->m_key, key->str, key->length);
- element->m_key_length= key->length;
+ element->m_key_length= (uint)key->length;
tdc_assert_clean_share(element);
}
static uchar *tdc_hash_key(const TDC_element *element, size_t *length,
- my_bool not_used __attribute__((unused)))
+ my_bool)
{
*length= element->m_key_length;
return (uchar*) element->m_key;
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc
index 9be9468fd74..4c6671cc2ae 100644
--- a/sql/temporary_tables.cc
+++ b/sql/temporary_tables.cc
@@ -263,7 +263,7 @@ TMP_TABLE_SHARE *THD::find_tmp_table_share(const TABLE_LIST *tl)
@return Success A pointer to table share object
Failure NULL
*/
-TMP_TABLE_SHARE *THD::find_tmp_table_share(const char *key, uint key_length)
+TMP_TABLE_SHARE *THD::find_tmp_table_share(const char *key, size_t key_length)
{
DBUG_ENTER("THD::find_tmp_table_share");
diff --git a/sql/transaction.cc b/sql/transaction.cc
index ec277e9c9c4..a11ad13a7dc 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -653,7 +653,7 @@ bool trans_savepoint(THD *thd, LEX_CSTRING name)
}
newsv->name= strmake_root(&thd->transaction.mem_root, name.str, name.length);
- newsv->length= name.length;
+ newsv->length= (uint)name.length;
/*
if we'll get an error here, don't add new savepoint to the list.
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 7af218b3cb6..f7e2dcbefb8 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -166,7 +166,7 @@ static my_bool
tz_load(const char *name, TIME_ZONE_INFO *sp, MEM_ROOT *storage)
{
uchar *p;
- int read_from_file;
+ ssize_t read_from_file;
uint i;
MYSQL_FILE *file;
@@ -187,7 +187,7 @@ tz_load(const char *name, TIME_ZONE_INFO *sp, MEM_ROOT *storage)
uint ttisgmtcnt;
char *tzinfo_buf;
- read_from_file= mysql_file_fread(file, u.buf, sizeof(u.buf), MYF(MY_WME));
+ read_from_file= (ssize_t)mysql_file_fread(file, u.buf, sizeof(u.buf), MYF(MY_WME));
if (mysql_file_fclose(file, MYF(MY_WME)) != 0)
return 1;
@@ -1333,7 +1333,7 @@ Time_zone_offset::Time_zone_offset(long tz_offset_arg):
{
uint hours= abs((int)(offset / SECS_PER_HOUR));
uint minutes= abs((int)(offset % SECS_PER_HOUR / SECS_PER_MIN));
- ulong length= my_snprintf(name_buff, sizeof(name_buff), "%s%02d:%02d",
+ size_t length= my_snprintf(name_buff, sizeof(name_buff), "%s%02d:%02d",
(offset>=0) ? "+" : "-", hours, minutes);
name.set(name_buff, length, &my_charset_latin1);
}
diff --git a/sql/uniques.cc b/sql/uniques.cc
index 894e959cace..8ed1ceda6a1 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -312,7 +312,7 @@ double Unique::get_use_cost(uint *buffer, size_t nkeys, uint key_size,
{
size_t max_elements_in_tree;
size_t last_tree_elems;
- int n_full_trees; /* number of trees in unique - 1 */
+ size_t n_full_trees; /* number of trees in unique - 1 */
double result;
max_elements_in_tree= ((size_t) max_in_memory_size /
@@ -350,9 +350,9 @@ double Unique::get_use_cost(uint *buffer, size_t nkeys, uint key_size,
/* Cost of merge */
if (intersect_fl)
key_size+= sizeof(element_count);
- double merge_cost= get_merge_many_buffs_cost(buffer, n_full_trees,
- max_elements_in_tree,
- last_tree_elems, key_size,
+ double merge_cost= get_merge_many_buffs_cost(buffer, (uint)n_full_trees,
+ (uint)max_elements_in_tree,
+ (uint)last_tree_elems, key_size,
compare_factor);
result += merge_cost;
/*
diff --git a/sql/unireg.cc b/sql/unireg.cc
index cbab0b3533b..50094ceed47 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -172,12 +172,13 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table,
LEX_CSTRING str_db_type;
uint reclength, key_info_length, i;
ulong key_buff_length;
- ulong filepos, data_offset;
+ size_t filepos;
+ ulong data_offset;
uint options_len;
uint gis_extra2_len= 0;
uchar fileinfo[FRM_HEADER_SIZE],forminfo[FRM_FORMINFO_SIZE];
const partition_info *part_info= IF_PARTITIONING(thd->work_part_info, 0);
- int error;
+ bool error;
uchar *frm_ptr, *pos;
LEX_CUSTRING frm= {0,0};
StringBuffer<MAX_FIELD_WIDTH> vcols;
@@ -200,7 +201,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table,
create_info->expression_length= vcols.length() + FRM_VCOL_NEW_BASE_SIZE;
error= pack_header(thd, forminfo, create_fields, create_info,
- data_offset, db_file);
+ (ulong)data_offset, db_file);
if (error)
DBUG_RETURN(frm);
@@ -209,7 +210,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table,
/* Calculate extra data segment length */
str_db_type= *hton_name(create_info->db_type);
/* str_db_type */
- create_info->extra_size= (2 + str_db_type.length +
+ create_info->extra_size= (uint)(2 + str_db_type.length +
2 + create_info->connect_string.length);
/*
Partition:
@@ -220,12 +221,12 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table,
*/
create_info->extra_size+= 6;
if (part_info)
- create_info->extra_size+= part_info->part_info_len;
+ create_info->extra_size+= (uint)part_info->part_info_len;
for (i= 0; i < keys; i++)
{
if (key_info[i].parser_name)
- create_info->extra_size+= key_info[i].parser_name->length + 1;
+ create_info->extra_size+= (uint)key_info[i].parser_name->length + 1;
}
options_len= engine_table_options_frm_length(create_info->option_list,
@@ -247,7 +248,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table,
if (create_info->comment.length > TABLE_COMMENT_INLINE_MAXLEN)
{
forminfo[46]=255;
- create_info->extra_size+= 2 + create_info->comment.length;
+ create_info->extra_size+= 2 + (uint)create_info->comment.length;
}
else
{
@@ -271,7 +272,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING *table,
prepare_frm_header(thd, reclength, fileinfo, create_info, keys, key_info);
/* one byte for a type, one or three for a length */
- uint extra2_size= 1 + 1 + create_info->tabledef_version.length;
+ size_t extra2_size= 1 + 1 + create_info->tabledef_version.length;
if (options_len)
extra2_size+= 1 + (options_len > 255 ? 3 : 1) + options_len;
@@ -762,10 +763,10 @@ static bool pack_header(THD *thd, uchar *forminfo,
{
char *dst;
const char *src= field->save_interval->type_names[pos];
- uint hex_length;
+ size_t hex_length;
length= field->save_interval->type_lengths[pos];
hex_length= length * 2;
- field->interval->type_lengths[pos]= hex_length;
+ field->interval->type_lengths[pos]= (uint)hex_length;
field->interval->type_names[pos]= dst=
(char*) thd->alloc(hex_length + 1);
octet2hex(dst, src, length);
@@ -889,7 +890,8 @@ static bool pack_fields(uchar **buff_arg, List<Create_field> &create_fields,
ulong data_offset)
{
uchar *buff= *buff_arg;
- uint int_count, comment_length= 0;
+ uint int_count;
+ size_t comment_length= 0;
Create_field *field;
DBUG_ENTER("pack_fields");
diff --git a/sql/vers_string.h b/sql/vers_string.h
index 756aea82794..0760613cd89 100644
--- a/sql/vers_string.h
+++ b/sql/vers_string.h
@@ -54,20 +54,20 @@ struct LEX_STRING_u : public Storage
Storage::str= NULL;
Storage::length= 0;
}
- LEX_STRING_u(const char *_str, uint32 _len, CHARSET_INFO *)
+ LEX_STRING_u(const char *_str, size_t _len, CHARSET_INFO *)
{
Storage::str= _str;
Storage::length= _len;
}
uint32 length() const
{
- return Storage::length;
+ return (uint32)Storage::length;
}
const char *ptr() const
{
return Storage::str;
}
- void set(const char *_str, uint32 _len, CHARSET_INFO *)
+ void set(const char *_str, size_t _len, CHARSET_INFO *)
{
Storage::str= _str;
Storage::length= _len;
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 299f40fff3d..91a77c65604 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -2660,11 +2660,10 @@ static int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len)
append_definer(thd, &stmt_query, &definer_user, &definer_host);
LEX_CSTRING stmt_definition;
- uint not_used;
stmt_definition.str= (char*) thd->lex->stmt_definition_begin;
stmt_definition.length= thd->lex->stmt_definition_end
- thd->lex->stmt_definition_begin;
- trim_whitespace(thd->charset(), &stmt_definition, &not_used);
+ trim_whitespace(thd->charset(), &stmt_definition);
stmt_query.append(stmt_definition.str, stmt_definition.length);
diff --git a/storage/archive/azio.c b/storage/archive/azio.c
index 8bf90e700d4..0f66b999c94 100644
--- a/storage/archive/azio.c
+++ b/storage/archive/azio.c
@@ -479,7 +479,7 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, size_t len, int *error)
next_out = (Byte*)buf;
s->stream.next_out = (Bytef*)buf;
- s->stream.avail_out = len;
+ s->stream.avail_out = (uInt)len;
if (s->stream.avail_out && s->back != EOF) {
*next_out++ = s->back;
@@ -521,7 +521,7 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, size_t len, int *error)
s->out += len;
if (len == 0) s->z_eof = 1;
{
- return len;
+ return (uint)len;
}
}
if (s->stream.avail_in == 0 && !s->z_eof) {
@@ -574,7 +574,7 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, size_t len, int *error)
return 0;
}
- return (len - s->stream.avail_out);
+ return (uint)(len - s->stream.avail_out);
}
@@ -882,7 +882,7 @@ int azclose (azio_stream *s)
Though this was added to support MySQL's FRM file, anything can be
stored in this location.
*/
-int azwrite_frm(azio_stream *s, const uchar *blob, unsigned int length)
+int azwrite_frm(azio_stream *s, const uchar *blob, size_t length)
{
if (s->mode == 'r')
return 1;
@@ -891,7 +891,7 @@ int azwrite_frm(azio_stream *s, const uchar *blob, unsigned int length)
return 1;
s->frm_start_pos= (uint) s->start;
- s->frm_length= length;
+ s->frm_length= (uint)length;
s->start+= length;
if (my_pwrite(s->file, blob, s->frm_length,
@@ -913,7 +913,7 @@ int azread_frm(azio_stream *s, uchar *blob)
/*
Simple comment field
*/
-int azwrite_comment(azio_stream *s, const char *blob, unsigned int length)
+int azwrite_comment(azio_stream *s, const char *blob, size_t length)
{
if (s->mode == 'r')
return 1;
@@ -922,7 +922,7 @@ int azwrite_comment(azio_stream *s, const char *blob, unsigned int length)
return 1;
s->comment_start_pos= (uint) s->start;
- s->comment_length= length;
+ s->comment_length= (uint)length;
s->start+= length;
my_pwrite(s->file, (uchar*) blob, s->comment_length, s->comment_start_pos,
diff --git a/storage/archive/azlib.h b/storage/archive/azlib.h
index d9318002901..20725aac304 100644
--- a/storage/archive/azlib.h
+++ b/storage/archive/azlib.h
@@ -334,10 +334,10 @@ extern int azclose(azio_stream *file);
error number (see function gzerror below).
*/
-extern int azwrite_frm (azio_stream *s, const uchar *blob, unsigned int length);
+extern int azwrite_frm (azio_stream *s, const uchar *blob,size_t length);
extern int azread_frm (azio_stream *s, uchar *blob);
extern int azwrite_comment (azio_stream *s, const char *blob,
- unsigned int length);
+ size_t length);
extern int azread_comment (azio_stream *s, char *blob);
#ifdef __cplusplus
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index e478058c7fd..08d5220cfca 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -1361,7 +1361,7 @@ int ha_archive::get_row_version2(azio_stream *file_to_read, uchar *buf)
if ((size_t) read != size)
DBUG_RETURN(HA_ERR_END_OF_FILE);
- ((Field_blob*) table->field[*ptr])->set_ptr(size, (uchar*) last);
+ ((Field_blob*) table->field[*ptr])->set_ptr(read, (uchar*) last);
last += size;
}
else
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index 88bdcfca565..7e900e55368 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -326,6 +326,14 @@ IF(NOT TARGET connect)
RETURN()
ENDIF()
+
+IF(MSVC)
+ # Temporarily disable "conversion from size_t .."
+ IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267")
+ ENDIF()
+ENDIF()
+
# Install some extra files that belong to connect engine
IF(WIN32)
# install ha_connect.lib
diff --git a/storage/federatedx/federatedx_io_mysql.cc b/storage/federatedx/federatedx_io_mysql.cc
index 2068716eeba..a83e54513d3 100644
--- a/storage/federatedx/federatedx_io_mysql.cc
+++ b/storage/federatedx/federatedx_io_mysql.cc
@@ -69,14 +69,14 @@ class federatedx_io_mysql :public federatedx_io
bool requested_autocommit;
bool actual_autocommit;
- int actual_query(const char *buffer, uint length);
+ int actual_query(const char *buffer, size_t length);
bool test_all_restrict() const;
public:
federatedx_io_mysql(FEDERATEDX_SERVER *);
~federatedx_io_mysql();
int simple_query(const char *fmt, ...);
- int query(const char *buffer, uint length);
+ int query(const char *buffer, size_t length);
virtual FEDERATEDX_IO_RESULT *store_result();
virtual size_t max_query_size() const;
@@ -273,7 +273,7 @@ ulong federatedx_io_mysql::savepoint_release(ulong sp)
if (last)
{
char buffer[STRING_BUFFER_USUAL_SIZE];
- int length= my_snprintf(buffer, sizeof(buffer),
+ size_t length= my_snprintf(buffer, sizeof(buffer),
"RELEASE SAVEPOINT save%lu", last->level);
actual_query(buffer, length);
}
@@ -308,7 +308,7 @@ ulong federatedx_io_mysql::savepoint_rollback(ulong sp)
if (savept && !(savept->flags & SAVEPOINT_RESTRICT))
{
char buffer[STRING_BUFFER_USUAL_SIZE];
- int length= my_snprintf(buffer, sizeof(buffer),
+ size_t length= my_snprintf(buffer, sizeof(buffer),
"ROLLBACK TO SAVEPOINT save%lu", savept->level);
actual_query(buffer, length);
}
@@ -341,7 +341,8 @@ void federatedx_io_mysql::savepoint_restrict(ulong sp)
int federatedx_io_mysql::simple_query(const char *fmt, ...)
{
char buffer[STRING_BUFFER_USUAL_SIZE];
- int length, error;
+ size_t length;
+ int error;
va_list arg;
DBUG_ENTER("federatedx_io_mysql::simple_query");
@@ -377,7 +378,7 @@ bool federatedx_io_mysql::test_all_restrict() const
}
-int federatedx_io_mysql::query(const char *buffer, uint length)
+int federatedx_io_mysql::query(const char *buffer, size_t length)
{
int error;
bool wants_autocommit= requested_autocommit | is_readonly();
@@ -402,7 +403,7 @@ int federatedx_io_mysql::query(const char *buffer, uint length)
if (!(savept->flags & SAVEPOINT_RESTRICT))
{
char buf[STRING_BUFFER_USUAL_SIZE];
- int len= my_snprintf(buf, sizeof(buf),
+ size_t len= my_snprintf(buf, sizeof(buf),
"SAVEPOINT save%lu", savept->level);
if ((error= actual_query(buf, len)))
DBUG_RETURN(error);
@@ -419,7 +420,7 @@ int federatedx_io_mysql::query(const char *buffer, uint length)
}
-int federatedx_io_mysql::actual_query(const char *buffer, uint length)
+int federatedx_io_mysql::actual_query(const char *buffer, size_t length)
{
int error;
DBUG_ENTER("federatedx_io_mysql::actual_query");
@@ -452,7 +453,7 @@ int federatedx_io_mysql::actual_query(const char *buffer, uint length)
mysql.reconnect= 1;
}
- error= mysql_real_query(&mysql, buffer, length);
+ error= mysql_real_query(&mysql, buffer, (ulong)length);
DBUG_RETURN(error);
}
diff --git a/storage/federatedx/federatedx_io_null.cc b/storage/federatedx/federatedx_io_null.cc
index aa35d4bdecc..1976f22124a 100644
--- a/storage/federatedx/federatedx_io_null.cc
+++ b/storage/federatedx/federatedx_io_null.cc
@@ -58,7 +58,7 @@ public:
federatedx_io_null(FEDERATEDX_SERVER *);
~federatedx_io_null();
- int query(const char *buffer, uint length);
+ int query(const char *buffer, size_t length);
virtual FEDERATEDX_IO_RESULT *store_result();
virtual size_t max_query_size() const;
@@ -178,7 +178,7 @@ void federatedx_io_null::savepoint_restrict(ulong sp)
}
-int federatedx_io_null::query(const char *buffer, uint length)
+int federatedx_io_null::query(const char *buffer, size_t length)
{
return 0;
}
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index 8d5eee99476..8c21906fe84 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -482,7 +482,7 @@ int federatedx_done(void *p)
in sql_show.cc except that quoting always occurs.
*/
-bool append_ident(String *string, const char *name, uint length,
+bool append_ident(String *string, const char *name, size_t length,
const char quote_char)
{
bool result;
@@ -520,7 +520,7 @@ static int parse_url_error(FEDERATEDX_SHARE *share, TABLE_SHARE *table_s,
int error_num)
{
char buf[FEDERATEDX_QUERY_BUFFER_SIZE];
- int buf_len;
+ size_t buf_len;
DBUG_ENTER("ha_federatedx parse_url_error");
buf_len= MY_MIN(table_s->connect_string.length,
@@ -1583,7 +1583,7 @@ static FEDERATEDX_SHARE *get_share(const char *table_name, TABLE *table)
mysql_mutex_lock(&federatedx_mutex);
tmp_share.share_key= table_name;
- tmp_share.share_key_length= strlen(table_name);
+ tmp_share.share_key_length= (int)strlen(table_name);
if (parse_url(&mem_root, &tmp_share, table->s, 0))
goto error;
@@ -1768,7 +1768,7 @@ int ha_federatedx::open(const char *name, int mode, uint test_if_locked)
DBUG_RETURN(error);
}
- ref_length= io->get_ref_length();
+ ref_length= (uint)io->get_ref_length();
txn->release(&io);
@@ -3066,7 +3066,7 @@ int ha_federatedx::info(uint flag)
stats.block_size= 4096;
if ((*iop)->table_metadata(&stats, share->table_name,
- share->table_name_length, flag))
+ (uint)share->table_name_length, flag))
goto error;
}
diff --git a/storage/federatedx/ha_federatedx.h b/storage/federatedx/ha_federatedx.h
index 02b622b15af..f5affebc426 100644
--- a/storage/federatedx/ha_federatedx.h
+++ b/storage/federatedx/ha_federatedx.h
@@ -120,7 +120,7 @@ typedef struct st_federatedx_share {
int share_key_length;
ushort port;
- uint table_name_length, server_name_length, connect_string_length;
+ size_t table_name_length, server_name_length, connect_string_length;
uint use_count;
THR_LOCK lock;
FEDERATEDX_SERVER *s;
@@ -171,7 +171,7 @@ public:
static void operator delete(void *ptr, size_t size)
{ TRASH(ptr, size); }
- virtual int query(const char *buffer, uint length)=0;
+ virtual int query(const char *buffer, size_t length)=0;
virtual FEDERATEDX_IO_RESULT *store_result()=0;
virtual size_t max_query_size() const=0;
@@ -450,7 +450,7 @@ extern const char ident_quote_char; // Character for quoting
extern const char value_quote_char; // Character for quoting
// literals
-extern bool append_ident(String *string, const char *name, uint length,
+extern bool append_ident(String *string, const char *name, size_t length,
const char quote_char);
diff --git a/storage/heap/hp_delete.c b/storage/heap/hp_delete.c
index 12f2c65f00b..301606af397 100644
--- a/storage/heap/hp_delete.c
+++ b/storage/heap/hp_delete.c
@@ -68,7 +68,7 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
const uchar *record, uchar *recpos, int flag)
{
heap_rb_param custom_arg;
- ulong old_allocated;
+ size_t old_allocated;
int res;
if (flag)
diff --git a/storage/heap/hp_hash.c b/storage/heap/hp_hash.c
index eca8f71458b..35a3cd20ee8 100644
--- a/storage/heap/hp_hash.c
+++ b/storage/heap/hp_hash.c
@@ -239,10 +239,10 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const uchar *key)
if (seg->type == HA_KEYTYPE_TEXT)
{
CHARSET_INFO *cs= seg->charset;
- uint length= seg->length;
+ size_t length= seg->length;
if (cs->mbmaxlen > 1)
{
- uint char_length;
+ size_t char_length;
char_length= my_charpos(cs, pos, pos + length, length/cs->mbmaxlen);
set_if_smaller(length, char_length);
}
@@ -251,11 +251,11 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const uchar *key)
else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */
{
CHARSET_INFO *cs= seg->charset;
- uint pack_length= 2; /* Key packing is constant */
- uint length= uint2korr(pos);
+ size_t pack_length= 2; /* Key packing is constant */
+ size_t length= uint2korr(pos);
if (cs->mbmaxlen > 1)
{
- uint char_length;
+ size_t char_length;
char_length= my_charpos(cs, pos +pack_length,
pos +pack_length + length,
seg->length/cs->mbmaxlen);
@@ -300,7 +300,7 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec)
if (seg->type == HA_KEYTYPE_TEXT)
{
CHARSET_INFO *cs= seg->charset;
- uint char_length= seg->length;
+ size_t char_length= seg->length;
if (cs->mbmaxlen > 1)
{
char_length= my_charpos(cs, pos, pos + char_length,
@@ -312,11 +312,11 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const uchar *rec)
else if (seg->type == HA_KEYTYPE_VARTEXT1) /* Any VARCHAR segments */
{
CHARSET_INFO *cs= seg->charset;
- uint pack_length= seg->bit_start;
- uint length= (pack_length == 1 ? (uint) *(uchar*) pos : uint2korr(pos));
+ size_t pack_length= seg->bit_start;
+ size_t length= (pack_length == 1 ? (size_t) *(uchar*) pos : uint2korr(pos));
if (cs->mbmaxlen > 1)
{
- uint char_length;
+ size_t char_length;
char_length= my_charpos(cs, pos + pack_length,
pos + pack_length + length,
seg->length/cs->mbmaxlen);
@@ -516,13 +516,13 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2)
if (seg->type == HA_KEYTYPE_TEXT)
{
CHARSET_INFO *cs= seg->charset;
- uint char_length1;
- uint char_length2;
+ size_t char_length1;
+ size_t char_length2;
uchar *pos1= (uchar*)rec1 + seg->start;
uchar *pos2= (uchar*)rec2 + seg->start;
if (cs->mbmaxlen > 1)
{
- uint char_length= seg->length / cs->mbmaxlen;
+ size_t char_length= seg->length / cs->mbmaxlen;
char_length1= my_charpos(cs, pos1, pos1 + seg->length, char_length);
set_if_smaller(char_length1, seg->length);
char_length2= my_charpos(cs, pos2, pos2 + seg->length, char_length);
@@ -541,13 +541,13 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2)
{
uchar *pos1= (uchar*) rec1 + seg->start;
uchar *pos2= (uchar*) rec2 + seg->start;
- uint char_length1, char_length2;
- uint pack_length= seg->bit_start;
+ size_t char_length1, char_length2;
+ size_t pack_length= seg->bit_start;
CHARSET_INFO *cs= seg->charset;
if (pack_length == 1)
{
- char_length1= (uint) *(uchar*) pos1++;
- char_length2= (uint) *(uchar*) pos2++;
+ char_length1= (size_t) *(uchar*) pos1++;
+ char_length2= (size_t) *(uchar*) pos2++;
}
else
{
@@ -558,9 +558,9 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2)
}
if (cs->mbmaxlen > 1)
{
- uint safe_length1= char_length1;
- uint safe_length2= char_length2;
- uint char_length= seg->length / cs->mbmaxlen;
+ size_t safe_length1= char_length1;
+ size_t safe_length2= char_length2;
+ size_t char_length= seg->length / cs->mbmaxlen;
char_length1= my_charpos(cs, pos1, pos1 + char_length1, char_length);
set_if_smaller(char_length1, safe_length1);
char_length2= my_charpos(cs, pos2, pos2 + char_length2, char_length);
@@ -623,12 +623,12 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key)
if (seg->type == HA_KEYTYPE_TEXT)
{
CHARSET_INFO *cs= seg->charset;
- uint char_length_key;
- uint char_length_rec;
+ size_t char_length_key;
+ size_t char_length_rec;
uchar *pos= (uchar*) rec + seg->start;
if (cs->mbmaxlen > 1)
{
- uint char_length= seg->length / cs->mbmaxlen;
+ size_t char_length= seg->length / cs->mbmaxlen;
char_length_key= my_charpos(cs, key, key + seg->length, char_length);
set_if_smaller(char_length_key, seg->length);
char_length_rec= my_charpos(cs, pos, pos + seg->length, char_length);
@@ -649,16 +649,16 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key)
{
uchar *pos= (uchar*) rec + seg->start;
CHARSET_INFO *cs= seg->charset;
- uint pack_length= seg->bit_start;
- uint char_length_rec= (pack_length == 1 ? (uint) *(uchar*) pos :
+ size_t pack_length= seg->bit_start;
+ size_t char_length_rec= (pack_length == 1 ? (size_t) *(uchar*) pos :
uint2korr(pos));
/* Key segments are always packed with 2 bytes */
- uint char_length_key= uint2korr(key);
+ size_t char_length_key= uint2korr(key);
pos+= pack_length;
key+= 2; /* skip key pack length */
if (cs->mbmaxlen > 1)
{
- uint char_length1, char_length2;
+ size_t char_length1, char_length2;
char_length1= char_length2= seg->length / cs->mbmaxlen;
char_length1= my_charpos(cs, key, key + char_length_key, char_length1);
set_if_smaller(char_length_key, char_length1);
@@ -703,7 +703,7 @@ void hp_make_key(HP_KEYDEF *keydef, uchar *key, const uchar *rec)
for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{
CHARSET_INFO *cs= seg->charset;
- uint char_length= seg->length;
+ size_t char_length= seg->length;
uchar *pos= (uchar*) rec + seg->start;
if (seg->null_bit)
*key++= MY_TEST(rec[seg->null_pos] & seg->null_bit);
@@ -742,7 +742,7 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, uchar *key,
for (seg= keydef->seg, endseg= seg + keydef->keysegs; seg < endseg; seg++)
{
- uint char_length;
+ size_t char_length;
if (seg->null_bit)
{
if (!(*key++= 1 - MY_TEST(rec[seg->null_pos] & seg->null_bit)))
@@ -790,9 +790,9 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, uchar *key,
if (seg->flag & HA_VAR_LENGTH_PART)
{
uchar *pos= (uchar*) rec + seg->start;
- uint length= seg->length;
- uint pack_length= seg->bit_start;
- uint tmp_length= (pack_length == 1 ? (uint) *(uchar*) pos :
+ size_t length= seg->length;
+ size_t pack_length= seg->bit_start;
+ size_t tmp_length= (pack_length == 1 ? (uint) *(uchar*) pos :
uint2korr(pos));
CHARSET_INFO *cs= seg->charset;
char_length= length/cs->mbmaxlen;
@@ -840,7 +840,7 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
for (seg= keydef->seg, endseg= seg + keydef->keysegs;
seg < endseg && keypart_map; old+= seg->length, seg++)
{
- uint char_length;
+ size_t char_length;
keypart_map>>= 1;
if (seg->null_bit)
{
@@ -867,8 +867,8 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old,
if (seg->flag & (HA_VAR_LENGTH_PART | HA_BLOB_PART))
{
/* Length of key-part used with heap_rkey() always 2 */
- uint tmp_length=uint2korr(old);
- uint length= seg->length;
+ size_t tmp_length=uint2korr(old);
+ size_t length= seg->length;
CHARSET_INFO *cs= seg->charset;
char_length= length/cs->mbmaxlen;
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index 0a9a1a68458..64bf09f1342 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -180,6 +180,11 @@ IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
ENDIF()
ENDIF()
IF(MSVC)
+ IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ ADD_COMPILE_FLAGS(
+ pars/lexyy.cc
+ COMPILE_FLAGS "/wd4267")
+ ENDIF()
# silence "switch statement contains 'default' but no 'case' label
# on generated file.
TARGET_COMPILE_OPTIONS(innobase PRIVATE "/wd4065")
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 5c96096a8dd..76431fd67f6 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -3480,8 +3480,8 @@ buf_flush_set_page_cleaner_thread_cnt(ulong new_cnt)
if (new_cnt > page_cleaner.n_workers) {
/* User has increased the number of page
cleaner threads. */
- uint add = new_cnt - page_cleaner.n_workers;
- for (uint i = 0; i < add; i++) {
+ ulint add = new_cnt - page_cleaner.n_workers;
+ for (ulint i = 0; i < add; i++) {
os_thread_id_t cleaner_thread_id;
os_thread_create(buf_flush_page_cleaner_worker, NULL, &cleaner_thread_id);
}
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 08a832a4cd5..63f48613896 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -589,7 +589,7 @@ fil_encrypt_buf(
int rc = encryption_scheme_encrypt(src, srclen, dst, &dstlen,
crypt_data, key_version,
- space, offset, lsn);
+ (uint32)space, (uint32)offset, lsn);
ut_a(rc == MY_AES_OK);
ut_a(dstlen == srclen);
@@ -1715,7 +1715,7 @@ btr_scrub_get_block_and_allocation_status(
mtr_start(&local_mtr);
- *allocation_status = fseg_page_is_free(space, offset) ?
+ *allocation_status = fseg_page_is_free(space, (uint32_t)offset) ?
BTR_SCRUB_PAGE_FREE :
BTR_SCRUB_PAGE_ALLOCATED;
@@ -1779,7 +1779,7 @@ fil_crypt_rotate_page(
return;
}
- ut_d(const bool was_free = fseg_page_is_free(space, offset));
+ ut_d(const bool was_free = fseg_page_is_free(space, (uint32_t)offset));
mtr_t mtr;
mtr.start();
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index f2e71564945..e46cf823900 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -3260,7 +3260,7 @@ innobase_invalidate_query_cache(
/* Argument TRUE below means we are using transactions */
mysql_query_cache_invalidate4(trx->mysql_thd,
qcache_key_name,
- (dbname_len + tabname_len + 2),
+ uint(dbname_len + tabname_len + 2),
TRUE);
#endif
}
@@ -6254,8 +6254,8 @@ no_such_table:
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
}
- uint n_fields = mysql_fields(table);
- uint n_cols = dict_table_get_n_user_cols(ib_table)
+ size_t n_fields = mysql_fields(table);
+ size_t n_cols = dict_table_get_n_user_cols(ib_table)
+ dict_table_get_n_v_cols(ib_table)
- !!DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID);
@@ -10098,7 +10098,7 @@ ha_innobase::rnd_pos(
/* Note that we assume the length of the row reference is fixed
for the table, and it is == ref_length */
- int error = index_read(buf, pos, ref_length, HA_READ_KEY_EXACT);
+ int error = index_read(buf, pos, (uint)ref_length, HA_READ_KEY_EXACT);
if (error != 0) {
DBUG_PRINT("error", ("Got error: %d", error));
@@ -14351,7 +14351,7 @@ ha_innobase::info_low(
}
stats.check_time = 0;
- stats.mrr_length_per_rec= ref_length + 8; // 8 = max(sizeof(void *));
+ stats.mrr_length_per_rec= (uint)ref_length + 8; // 8 = max(sizeof(void *));
if (stats.records == 0) {
stats.mean_rec_length = 0;
@@ -21851,7 +21851,7 @@ innobase_convert_to_filename_charset(
CHARSET_INFO* cs_from = system_charset_info;
return(static_cast<uint>(strconvert(
- cs_from, from, strlen(from),
+ cs_from, from, uint(strlen(from)),
cs_to, to, static_cast<uint>(len), &errors)));
}
@@ -21870,7 +21870,7 @@ innobase_convert_to_system_charset(
CHARSET_INFO* cs2 = system_charset_info;
return(static_cast<uint>(strconvert(
- cs1, from, strlen(from),
+ cs1, from, static_cast<uint>(strlen(from)),
cs2, to, static_cast<uint>(len), errors)));
}
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index 01840379a71..749a5e38ec8 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -1107,7 +1107,7 @@ struct dict_index_t{
@param[out] len value length (in bytes), or UNIV_SQL_NULL
@return default value
@retval NULL if the default value is SQL NULL (len=UNIV_SQL_NULL) */
- const byte* instant_field_value(uint n, ulint* len) const
+ const byte* instant_field_value(ulint n, ulint* len) const
{
DBUG_ASSERT(is_instant() || id == DICT_INDEXES_ID);
DBUG_ASSERT(n + (id == DICT_INDEXES_ID) >= n_core_fields);
diff --git a/storage/innobase/include/sync0policy.h b/storage/innobase/include/sync0policy.h
index cd51c0cb90f..78e77f93269 100644
--- a/storage/innobase/include/sync0policy.h
+++ b/storage/innobase/include/sync0policy.h
@@ -105,7 +105,7 @@ public:
msg << m_mutex->policy().to_string();
- if (os_thread_pf(m_thread_id) != ULINT_UNDEFINED) {
+ if (m_thread_id != ULINT_UNDEFINED) {
msg << " addr: " << m_mutex
<< " acquired: " << locked_from().c_str();
diff --git a/storage/innobase/log/log0crypt.cc b/storage/innobase/log/log0crypt.cc
index e7d8e69a9c7..9cd06bc0c6f 100644
--- a/storage/innobase/log/log0crypt.cc
+++ b/storage/innobase/log/log0crypt.cc
@@ -393,9 +393,9 @@ log_tmp_block_encrypt(
aes_ctr_iv[1] = offs;
int rc = encryption_crypt(
- src, size, dst, &dst_len,
- const_cast<byte*>(info.crypt_key.bytes), sizeof info.crypt_key,
- reinterpret_cast<byte*>(aes_ctr_iv), sizeof aes_ctr_iv,
+ src, (uint)size, dst, &dst_len,
+ const_cast<byte*>(info.crypt_key.bytes), (uint)(sizeof info.crypt_key),
+ reinterpret_cast<byte*>(aes_ctr_iv), (uint)(sizeof aes_ctr_iv),
encrypt
? ENCRYPTION_FLAG_ENCRYPT|ENCRYPTION_FLAG_NOPAD
: ENCRYPTION_FLAG_DECRYPT|ENCRYPTION_FLAG_NOPAD,
diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc
index e3bea55d8ff..142aff4270c 100644
--- a/storage/innobase/rem/rem0rec.cc
+++ b/storage/innobase/rem/rem0rec.cc
@@ -240,7 +240,7 @@ rec_get_n_extern_new(
/** Get the length of added field count in a REC_STATUS_COLUMNS_ADDED record.
@param[in] n_add_field number of added fields, minus one
@return storage size of the field count, in bytes */
-static inline unsigned rec_get_n_add_field_len(unsigned n_add_field)
+static inline unsigned rec_get_n_add_field_len(ulint n_add_field)
{
ut_ad(n_add_field < REC_MAX_N_FIELDS);
return n_add_field < 0x80 ? 1 : 2;
@@ -268,7 +268,7 @@ static inline unsigned rec_get_n_add_field(const byte*& header)
@param[in,out] header variable header of a REC_STATUS_COLUMNS_ADDED record
@param[in] n_add number of added fields, minus 1
@return record header before the number of added fields */
-static inline void rec_set_n_add_field(byte*& header, unsigned n_add)
+static inline void rec_set_n_add_field(byte*& header, ulint n_add)
{
ut_ad(n_add < REC_MAX_N_FIELDS);
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index 5d4824f0aae..7ebf7af5dbf 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -669,7 +669,7 @@ row_merge_fts_doc_tokenize(
MySQL 5.7 changed the fulltext parser plugin interface
by adding MYSQL_FTPARSER_BOOLEAN_INFO::position.
Below we assume that the field is always 0. */
- unsigned pos = t_ctx->init_pos;
+ ulint pos = t_ctx->init_pos;
byte position[4];
if (parser == NULL) {
pos += t_ctx->processed_len + inc - str.f_len;
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index e45032955d7..02a1519914b 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -2348,7 +2348,7 @@ files_checked:
== SRV_OPERATION_RESTORE;
/* Delete subsequent log files. */
delete_log_files(logfilename, dirnamelen,
- srv_n_log_files_found, trunc);
+ (uint)srv_n_log_files_found, trunc);
if (trunc) {
/* Truncate the first log file. */
strcpy(logfilename + dirnamelen,
diff --git a/storage/maria/ft_maria.c b/storage/maria/ft_maria.c
index 4a5c660af6d..b85a2ea797a 100644
--- a/storage/maria/ft_maria.c
+++ b/storage/maria/ft_maria.c
@@ -28,9 +28,9 @@ FT_INFO *maria_ft_init_search(uint flags, void *info, uint keynr,
FT_INFO *res;
if (flags & FT_BOOL)
res= maria_ft_init_boolean_search((MARIA_HA *) info, keynr, query,
- query_len, cs);
+ (uint)query_len, cs);
else
- res= maria_ft_init_nlq_search((MARIA_HA *) info, keynr, query, query_len,
+ res= maria_ft_init_nlq_search((MARIA_HA *) info, keynr, query, (uint)query_len,
flags, record);
return res;
}
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 970391a2c70..316a1a06ccc 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -3202,7 +3202,7 @@ static int write_page(MARIA_SHARE *share, File file,
args.pageno= (pgcache_page_no_t) (pos / share->block_size);
args.data= (uchar*) share;
(* share->kfile.pre_write_hook)(&args);
- res= my_pwrite(file, args.page, block_size, pos, myf_rw);
+ res= (int)my_pwrite(file, args.page, block_size, pos, myf_rw);
(* share->kfile.post_write_hook)(res, &args);
return res;
}
diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c
index 06d48569b2a..7d70f6970e4 100644
--- a/storage/maria/ma_checkpoint.c
+++ b/storage/maria/ma_checkpoint.c
@@ -48,7 +48,7 @@ static mysql_cond_t COND_checkpoint;
static MA_SERVICE_THREAD_CONTROL checkpoint_control=
{0, FALSE, FALSE, &LOCK_checkpoint, &COND_checkpoint};
/* is ulong like pagecache->blocks_changed */
-static ulong pages_to_flush_before_next_checkpoint;
+static uint pages_to_flush_before_next_checkpoint;
static PAGECACHE_FILE *dfiles, /**< data files to flush in background */
*dfiles_end; /**< list of data files ends here */
static PAGECACHE_FILE *kfiles, /**< index files to flush in background */
@@ -265,7 +265,7 @@ static int really_execute_checkpoint(void)
ptr= record_pieces[3].str;
pages_to_flush_before_next_checkpoint= uint4korr(ptr);
DBUG_PRINT("checkpoint",("%u pages to flush before next checkpoint",
- (uint)pages_to_flush_before_next_checkpoint));
+ pages_to_flush_before_next_checkpoint));
/* compute log's low-water mark */
{
@@ -638,7 +638,7 @@ pthread_handler_t ma_checkpoint_background(void *arg)
case 1:
/* set up parameters for background page flushing */
filter_param.up_to_lsn= last_checkpoint_lsn;
- pages_bunch_size= pages_to_flush_before_next_checkpoint / interval;
+ pages_bunch_size= pages_to_flush_before_next_checkpoint / (uint)interval;
dfile= dfiles;
kfile= kfiles;
/* fall through */
@@ -750,7 +750,7 @@ static int collect_tables(LEX_STRING *str, LSN checkpoint_start_log_horizon)
char *ptr;
uint error= 1, sync_error= 0, nb, nb_stored, i;
my_bool unmark_tables= TRUE;
- uint total_names_length;
+ size_t total_names_length;
LIST *pos; /**< to iterate over open tables */
struct st_state_copy {
uint index;
@@ -981,7 +981,7 @@ static int collect_tables(LEX_STRING *str, LSN checkpoint_start_log_horizon)
DBUG_PRINT("info", ("ignore_share: %d", ignore_share));
if (!ignore_share)
{
- uint open_file_name_len= share->open_file_name.length + 1;
+ size_t open_file_name_len= share->open_file_name.length + 1;
/* remember the descriptors for background flush */
*(dfiles_end++)= dfile;
*(kfiles_end++)= kfile;
diff --git a/storage/maria/ma_delete.c b/storage/maria/ma_delete.c
index c5a2378dc2b..b4b02212a16 100644
--- a/storage/maria/ma_delete.c
+++ b/storage/maria/ma_delete.c
@@ -801,7 +801,7 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
if ((keypos < anc_buff + anc_length && (info->state->records & 1)) ||
first_key)
{
- size_t tmp_length;
+ uint tmp_length;
uint next_page_flag;
/* Use page right of anc-page */
DBUG_PRINT("test",("use right page"));
@@ -968,7 +968,7 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
(uchar*) 0, (uchar*) 0,
&key_inserted);
/* t_length will always be > 0 for a new page !*/
- tmp_length= (size_t) ((next_page.buff + buff_length) - half_pos);
+ tmp_length= (uint) ((next_page.buff + buff_length) - half_pos);
bmove(next_page.buff + p_length + t_length, half_pos, tmp_length);
(*keyinfo->store_key)(keyinfo, next_page.buff + p_length, &key_inserted);
new_buff_length= tmp_length + t_length + p_length;
@@ -1207,7 +1207,7 @@ static int underflow(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
DBUG_PRINT("info",("t_length: %d length: %d",t_length, (int) tmp_length));
bmove(leaf_buff+p_length+t_length, half_pos, tmp_length);
(*keyinfo->store_key)(keyinfo,leaf_buff+p_length, &key_inserted);
- new_leaf_length= tmp_length + t_length + p_length;
+ new_leaf_length= (uint)(tmp_length + t_length + p_length);
DBUG_ASSERT(new_leaf_length <= share->max_index_block_size);
leaf_page->size= new_leaf_length;
diff --git a/storage/maria/ma_keycache.c b/storage/maria/ma_keycache.c
index 39459c486fd..b63535a0897 100644
--- a/storage/maria/ma_keycache.c
+++ b/storage/maria/ma_keycache.c
@@ -106,7 +106,7 @@ int maria_assign_to_pagecache(MARIA_HA *info,
/* store the key cache in the global hash structure for future opens */
if (multi_pagecache_set((uchar*) share->unique_file_name.str,
- share->unique_file_name.length,
+ (uint)share->unique_file_name.length,
share->pagecache))
error= my_errno;
mysql_mutex_unlock(&share->intern_lock);
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 778a98f7cc9..c81c7735df5 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -5373,7 +5373,7 @@ static void translog_relative_LSN_encode(struct st_translog_parts *parts,
/* collect all LSN(s) in one chunk if it (they) is (are) divided */
if (part->length < lsns_len)
{
- uint copied= part->length;
+ size_t copied= part->length;
LEX_CUSTRING *next_part;
DBUG_PRINT("info", ("Using buffer:%p", compressed_LSNs));
memcpy(buffer, part->str, part->length);
@@ -5394,7 +5394,7 @@ static void translog_relative_LSN_encode(struct st_translog_parts *parts,
}
else
{
- uint len= lsns_len - copied;
+ size_t len= lsns_len - copied;
memcpy(buffer + copied, next_part->str, len);
copied= lsns_len;
next_part->str+= len;
@@ -5430,11 +5430,12 @@ static void translog_relative_LSN_encode(struct st_translog_parts *parts,
ref= lsn_korr(src_ptr);
dst_ptr= translog_put_LSN_diff(base_lsn, ref, dst_ptr);
}
- part->length= (uint)((compressed_LSNs +
+ part->length= (size_t)((compressed_LSNs +
(MAX_NUMBER_OF_LSNS_PER_RECORD *
COMPRESSED_LSN_MAX_STORE_SIZE)) -
dst_ptr);
- parts->record_length-= (economy= lsns_len - part->length);
+ economy= lsns_len - (uint)part->length;
+ parts->record_length-= economy;
DBUG_PRINT("info", ("new length of LSNs: %lu economy: %d",
(ulong)part->length, economy));
parts->total_record_length-= economy;
@@ -6302,7 +6303,7 @@ my_bool translog_write_record(LSN *lsn,
#ifndef DBUG_OFF
{
uint i;
- uint len= 0;
+ size_t len= 0;
#ifdef HAVE_valgrind
ha_checksum checksum= 0;
#endif
diff --git a/storage/maria/ma_page.c b/storage/maria/ma_page.c
index ccaba3b7a33..ebf9beab10f 100644
--- a/storage/maria/ma_page.c
+++ b/storage/maria/ma_page.c
@@ -493,8 +493,8 @@ static my_bool _ma_log_compact_keypage(MARIA_PAGE *ma_page,
if (translog_write_record(&lsn, LOGREC_REDO_INDEX,
info->trn, info,
- log_array[TRANSLOG_INTERNAL_PARTS +
- 0].length + extra_length,
+ (translog_size_t)(log_array[TRANSLOG_INTERNAL_PARTS +
+ 0].length + extra_length),
TRANSLOG_INTERNAL_PARTS + translog_parts,
log_array, log_data, NULL))
DBUG_RETURN(1);
diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c
index 8ed97d6eae4..6922326da19 100644
--- a/storage/maria/ma_pagecache.c
+++ b/storage/maria/ma_pagecache.c
@@ -667,7 +667,7 @@ static my_bool pagecache_fwrite(PAGECACHE *pagecache,
DBUG_PRINT("error", ("write callback problem"));
DBUG_RETURN(1);
}
- res= my_pwrite(filedesc->file, args.page, pagecache->block_size,
+ res= (int)my_pwrite(filedesc->file, args.page, pagecache->block_size,
((my_off_t) pageno << pagecache->shift), flags);
(*filedesc->post_write_hook)(res, &args);
DBUG_RETURN(res);
@@ -810,7 +810,7 @@ size_t init_pagecache(PAGECACHE *pagecache, size_t use_mem,
goto err;
}
/* Set my_hash_entries to the next bigger 2 power */
- if ((pagecache->hash_entries= next_power(blocks)) <
+ if ((pagecache->hash_entries= next_power((uint)blocks)) <
(blocks) * 5/4)
pagecache->hash_entries<<= 1;
hash_links= 2 * blocks;
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index ad1df75f19e..9f436f3d8e5 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -3295,7 +3295,7 @@ static LSN parse_checkpoint_record(LSN lsn)
{
char name[FN_REFLEN];
LSN first_log_write_lsn;
- uint name_len;
+ size_t name_len;
uint16 sid= uint2korr(ptr);
ptr+= 2;
DBUG_ASSERT(sid > 0);
diff --git a/storage/maria/ma_rename.c b/storage/maria/ma_rename.c
index 71e2dea9d7e..0650d9f6a56 100644
--- a/storage/maria/ma_rename.c
+++ b/storage/maria/ma_rename.c
@@ -68,7 +68,7 @@ int maria_rename(const char *old_name, const char *new_name)
{
LSN lsn;
LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 2];
- uint old_name_len= strlen(old_name)+1, new_name_len= strlen(new_name)+1;
+ size_t old_name_len= strlen(old_name)+1, new_name_len= strlen(new_name)+1;
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= (uchar*)old_name;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= old_name_len;
log_array[TRANSLOG_INTERNAL_PARTS + 1].str= (uchar*)new_name;
@@ -83,7 +83,7 @@ int maria_rename(const char *old_name, const char *new_name)
*/
if (unlikely(translog_write_record(&lsn, LOGREC_REDO_RENAME_TABLE,
&dummy_transaction_object, NULL,
- old_name_len + new_name_len,
+ (translog_size_t)(old_name_len + new_name_len),
sizeof(log_array)/sizeof(log_array[0]),
log_array, NULL, NULL) ||
translog_flush(lsn)))
diff --git a/storage/maria/ma_search.c b/storage/maria/ma_search.c
index 39d9322d903..31e1d0cb302 100644
--- a/storage/maria/ma_search.c
+++ b/storage/maria/ma_search.c
@@ -949,7 +949,7 @@ uint _ma_get_static_key(MARIA_KEY *key, uint page_flag, uint nod_flag,
register uchar **page)
{
register MARIA_KEYDEF *keyinfo= key->keyinfo;
- size_t key_length= keyinfo->keylength;
+ uint key_length= keyinfo->keylength;
key->ref_length= keyinfo->share->rec_reflength;
key->data_length= key_length - key->ref_length;
diff --git a/storage/maria/ma_test1.c b/storage/maria/ma_test1.c
index 07da313db8a..d7ee7136fb2 100644
--- a/storage/maria/ma_test1.c
+++ b/storage/maria/ma_test1.c
@@ -577,7 +577,7 @@ static void create_key(uchar *key,uint rownr)
}
if (keyinfo[0].seg[0].flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART))
{
- uint tmp;
+ size_t tmp;
create_key_part(key+2,rownr);
tmp=strlen((char*) key+2);
int2store(key,tmp);
@@ -602,7 +602,7 @@ static void create_record(uchar *record,uint rownr)
pos=record+1;
if (recinfo[0].type == FIELD_BLOB)
{
- uint tmp;
+ size_t tmp;
uchar *ptr;
create_key_part(blob_key,rownr);
tmp=strlen((char*) blob_key);
@@ -613,7 +613,7 @@ static void create_record(uchar *record,uint rownr)
}
else if (recinfo[0].type == FIELD_VARCHAR)
{
- uint tmp, pack_length= HA_VARCHAR_PACKLENGTH(recinfo[0].length-1);
+ size_t tmp, pack_length= HA_VARCHAR_PACKLENGTH(recinfo[0].length-1);
create_key_part(pos+pack_length,rownr);
tmp= strlen((char*) pos+pack_length);
if (pack_length == 1)
@@ -629,7 +629,7 @@ static void create_record(uchar *record,uint rownr)
}
if (recinfo[1].type == FIELD_BLOB)
{
- uint tmp;
+ size_t tmp;
uchar *ptr;;
sprintf((char*) blob_record,"... row: %d", rownr);
strappend((char*) blob_record,MY_MAX(MAX_REC_LENGTH-rownr,10),' ');
@@ -640,7 +640,7 @@ static void create_record(uchar *record,uint rownr)
}
else if (recinfo[1].type == FIELD_VARCHAR)
{
- uint tmp, pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
+ size_t tmp, pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
sprintf((char*) pos+pack_length, "... row: %d", rownr);
tmp= strlen((char*) pos+pack_length);
if (pack_length == 1)
diff --git a/storage/maria/unittest/ma_control_file-t.c b/storage/maria/unittest/ma_control_file-t.c
index 25ec982133a..e68078d5230 100644
--- a/storage/maria/unittest/ma_control_file-t.c
+++ b/storage/maria/unittest/ma_control_file-t.c
@@ -123,7 +123,7 @@ static char *create_tmpdir(const char *progname)
{
static char test_dirname[FN_REFLEN];
char tmp_name[FN_REFLEN];
- uint length;
+ size_t length;
/* Create a temporary directory of name TMP-'executable', but without the -t extension */
fn_format(tmp_name, progname, "", "", MY_REPLACE_DIR | MY_REPLACE_EXT);
diff --git a/storage/maria/unittest/ma_maria_log_cleanup.c b/storage/maria/unittest/ma_maria_log_cleanup.c
index 23e5be739d1..9c1c916224b 100644
--- a/storage/maria/unittest/ma_maria_log_cleanup.c
+++ b/storage/maria/unittest/ma_maria_log_cleanup.c
@@ -70,7 +70,7 @@ char *create_tmpdir(const char *progname)
{
static char test_dirname[FN_REFLEN];
char tmp_name[FN_REFLEN];
- uint length;
+ size_t length;
/* Create a temporary directory of name TMP-'executable', but without the -t extension */
fn_format(tmp_name, progname, "", "", MY_REPLACE_DIR | MY_REPLACE_EXT);
diff --git a/storage/maria/unittest/ma_pagecache_consist.c b/storage/maria/unittest/ma_pagecache_consist.c
index a9223ca9f6f..5e51c3f29b5 100644
--- a/storage/maria/unittest/ma_pagecache_consist.c
+++ b/storage/maria/unittest/ma_pagecache_consist.c
@@ -311,7 +311,7 @@ static char *create_tmpdir(const char *progname)
{
static char test_dirname[FN_REFLEN];
char tmp_name[FN_REFLEN];
- uint length;
+ size_t length;
/* Create a temporary directory of name TMP-'executable', but without the -t extension */
fn_format(tmp_name, progname, "", "", MY_REPLACE_DIR | MY_REPLACE_EXT);
@@ -334,7 +334,8 @@ int main(int argc __attribute__((unused)),
{
pthread_t tid;
pthread_attr_t thr_attr;
- int *param, error, pagen;
+ int *param, error;
+ size_t pagen;
MY_INIT(argv[0]);
#ifndef DBUG_OFF
@@ -413,7 +414,7 @@ int main(int argc __attribute__((unused)),
errno);
exit(1);
}
- DBUG_PRINT("info", ("Page cache %d pages", pagen));
+ DBUG_PRINT("info", ("Page cache %zd pages", pagen));
{
unsigned char *buffr= malloc(TEST_PAGE_SIZE);
uint i;
diff --git a/storage/maria/unittest/ma_pagecache_rwconsist.c b/storage/maria/unittest/ma_pagecache_rwconsist.c
index 0b05d976516..985140091f9 100644
--- a/storage/maria/unittest/ma_pagecache_rwconsist.c
+++ b/storage/maria/unittest/ma_pagecache_rwconsist.c
@@ -181,7 +181,7 @@ char *create_tmpdir(const char *progname)
{
static char test_dirname[FN_REFLEN];
char tmp_name[FN_REFLEN];
- uint length;
+ size_t length;
/* Create a temporary directory of name TMP-'executable', but without the -t extension */
fn_format(tmp_name, progname, "", "", MY_REPLACE_DIR | MY_REPLACE_EXT);
@@ -204,7 +204,8 @@ int main(int argc __attribute__((unused)),
{
pthread_t tid;
pthread_attr_t thr_attr;
- int *param, error, pagen;
+ int *param, error;
+ size_t pagen;
MY_INIT(argv[0]);
@@ -282,7 +283,7 @@ int main(int argc __attribute__((unused)),
errno);
exit(1);
}
- DBUG_PRINT("info", ("Page cache %d pages", pagen));
+ DBUG_PRINT("info", ("Page cache %zu pages", pagen));
{
unsigned char *buffr= malloc(TEST_PAGE_SIZE);
memset(buffr, '\0', TEST_PAGE_SIZE);
diff --git a/storage/maria/unittest/ma_pagecache_rwconsist2.c b/storage/maria/unittest/ma_pagecache_rwconsist2.c
index cfc877d5556..9cc2ced2042 100644
--- a/storage/maria/unittest/ma_pagecache_rwconsist2.c
+++ b/storage/maria/unittest/ma_pagecache_rwconsist2.c
@@ -177,7 +177,7 @@ static char *create_tmpdir(const char *progname)
{
static char test_dirname[FN_REFLEN];
char tmp_name[FN_REFLEN];
- uint length;
+ size_t length;
/* Create a temporary directory of name TMP-'executable', but without the -t extension */
fn_format(tmp_name, progname, "", "", MY_REPLACE_DIR | MY_REPLACE_EXT);
@@ -200,7 +200,8 @@ int main(int argc __attribute__((unused)),
{
pthread_t tid;
pthread_attr_t thr_attr;
- int *param, error, pagen;
+ int *param, error;
+ size_t pagen;
MY_INIT(argv[0]);
@@ -278,7 +279,7 @@ int main(int argc __attribute__((unused)),
errno);
exit(1);
}
- DBUG_PRINT("info", ("Page cache %d pages", pagen));
+ DBUG_PRINT("info", ("Page cache %zd pages", pagen));
{
unsigned char *buffr= malloc(TEST_PAGE_SIZE);
memset(buffr, '\0', TEST_PAGE_SIZE);
diff --git a/storage/maria/unittest/ma_pagecache_single.c b/storage/maria/unittest/ma_pagecache_single.c
index e149af7cf5e..8de52ccf481 100644
--- a/storage/maria/unittest/ma_pagecache_single.c
+++ b/storage/maria/unittest/ma_pagecache_single.c
@@ -701,7 +701,7 @@ static char *create_tmpdir(const char *progname)
{
static char test_dirname[FN_REFLEN];
char tmp_name[FN_REFLEN];
- uint length;
+ size_t length;
/* Create a temporary directory of name TMP-'executable', but without the -t extension */
fn_format(tmp_name, progname, "", "", MY_REPLACE_DIR | MY_REPLACE_EXT);
@@ -724,7 +724,8 @@ int main(int argc __attribute__((unused)),
{
pthread_t tid;
pthread_attr_t thr_attr;
- int *param, error, pagen;
+ int *param, error;
+ size_t pagen;
File tmp_file;
MY_INIT(argv[0]);
@@ -809,7 +810,7 @@ int main(int argc __attribute__((unused)),
errno);
exit(1);
}
- DBUG_PRINT("info", ("Page cache %d pages", pagen));
+ DBUG_PRINT("info", ("Page cache %zd pages", pagen));
pthread_mutex_lock(&LOCK_thread_count);
param=(int*) malloc(sizeof(int));
diff --git a/storage/maria/unittest/ma_test_loghandler_purge-t.c b/storage/maria/unittest/ma_test_loghandler_purge-t.c
index ef31b47c9c5..a4eecd6bfdc 100644
--- a/storage/maria/unittest/ma_test_loghandler_purge-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_purge-t.c
@@ -36,7 +36,7 @@ static const char *default_dbug_option;
int main(int argc __attribute__((unused)), char *argv[])
{
ulong i;
- uint pagen;
+ size_t pagen;
uchar long_tr_id[6];
PAGECACHE pagecache;
LSN lsn;
diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c
index 0649d02b73f..8065bb696a1 100644
--- a/storage/myisam/ft_boolean_search.c
+++ b/storage/myisam/ft_boolean_search.c
@@ -290,7 +290,7 @@ static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
info.prev= ' ';
info.quot= 0;
while (ft_get_word(cs, start, end, &w, &info))
- param->mysql_add_word(param, (char*) w.pos, w.len, &info);
+ param->mysql_add_word(param, (char*) w.pos, (int)w.len, &info);
return(0);
}
@@ -675,7 +675,7 @@ static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
while (ft_simple_get_word(phrase_param->cs, (uchar**) &document, docend,
&word, FALSE))
{
- param->mysql_add_word(param, (char*) word.pos, word.len, 0);
+ param->mysql_add_word(param, (char*) word.pos, (int)word.len, 0);
if (phrase_param->match)
break;
}
@@ -961,7 +961,7 @@ static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
uchar *end= (uchar*) doc + len;
FT_WORD w;
while (ft_simple_get_word(ftb->charset, (uchar**) &doc, end, &w, TRUE))
- param->mysql_add_word(param, (char*) w.pos, w.len, 0);
+ param->mysql_add_word(param, (char*) w.pos, (int)w.len, 0);
return(0);
}
diff --git a/storage/myisam/ft_myisam.c b/storage/myisam/ft_myisam.c
index 4e1879fa8ce..4cbf67ba30f 100644
--- a/storage/myisam/ft_myisam.c
+++ b/storage/myisam/ft_myisam.c
@@ -28,9 +28,9 @@ FT_INFO *ft_init_search(uint flags, void *info, uint keynr,
{
FT_INFO *res;
if (flags & FT_BOOL)
- res= ft_init_boolean_search((MI_INFO *)info, keynr, query, query_len,cs);
+ res= ft_init_boolean_search((MI_INFO *)info, keynr, query, (uint)query_len,cs);
else
- res= ft_init_nlq_search((MI_INFO *)info, keynr, query, query_len, flags,
+ res= ft_init_nlq_search((MI_INFO *)info, keynr, query, (uint)query_len, flags,
record);
return res;
}
diff --git a/storage/myisam/ft_parser.c b/storage/myisam/ft_parser.c
index c36a3e3f5c8..aec7bd338ac 100644
--- a/storage/myisam/ft_parser.c
+++ b/storage/myisam/ft_parser.c
@@ -295,7 +295,7 @@ static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
DBUG_ENTER("ft_parse_internal");
while (ft_simple_get_word(wtree->custom_arg, &doc, end, &w, TRUE))
- if (param->mysql_add_word(param, (char*) w.pos, w.len, 0))
+ if (param->mysql_add_word(param, (char*) w.pos, (int)w.len, 0))
DBUG_RETURN(1);
DBUG_RETURN(0);
}
diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c
index 7c743743adc..7294106b569 100644
--- a/storage/myisam/ft_stopwords.c
+++ b/storage/myisam/ft_stopwords.c
@@ -77,7 +77,7 @@ int ft_init_stopwords()
if (ft_stopword_file)
{
File fd;
- uint len;
+ size_t len;
uchar *buffer, *start, *end;
FT_WORD w;
int error=-1;
@@ -87,7 +87,7 @@ int ft_init_stopwords()
if ((fd=my_open(ft_stopword_file, O_RDONLY, MYF(MY_WME))) == -1)
DBUG_RETURN(-1);
- len=(uint)my_seek(fd, 0L, MY_SEEK_END, MYF(0));
+ len=(size_t)my_seek(fd, 0L, MY_SEEK_END, MYF(0));
my_seek(fd, 0L, MY_SEEK_SET, MYF(0));
if (!(start=buffer=my_malloc(len+1, MYF(MY_WME))))
goto err0;
@@ -124,7 +124,7 @@ int is_stopword(const char *word, size_t len)
{
FT_STOPWORD sw;
sw.pos=word;
- sw.len=len;
+ sw.len=(uint)len;
return tree_search(stopwords3,&sw, stopwords3->custom_arg) != NULL;
}
diff --git a/storage/myisam/mi_cache.c b/storage/myisam/mi_cache.c
index 6fa599ff981..012d410c793 100644
--- a/storage/myisam/mi_cache.c
+++ b/storage/myisam/mi_cache.c
@@ -35,10 +35,10 @@
#include "myisamdef.h"
-int _mi_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos, uint length,
+int _mi_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos, size_t length,
int flag)
{
- uint read_length,in_buff_length;
+ size_t read_length,in_buff_length;
my_off_t offset;
uchar *in_buff_pos;
DBUG_ENTER("_mi_read_cache");
@@ -48,7 +48,7 @@ int _mi_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos, uint length,
{
read_length=length;
if ((my_off_t) read_length > (my_off_t) (info->pos_in_file-pos))
- read_length=(uint) (info->pos_in_file-pos);
+ read_length=(size_t)(info->pos_in_file-pos);
info->seek_not_done=1;
if (mysql_file_pread(info->file, buff, read_length, pos, MYF(MY_NABP)))
DBUG_RETURN(1);
@@ -61,9 +61,9 @@ int _mi_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos, uint length,
(offset= (my_off_t) (pos - info->pos_in_file)) <
(my_off_t) (info->read_end - info->request_pos))
{
- in_buff_pos=info->request_pos+(uint) offset;
- in_buff_length= MY_MIN(length, (size_t) (info->read_end-in_buff_pos));
- memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length);
+ in_buff_pos=info->request_pos+ (uint)offset;
+ in_buff_length= MY_MIN(length, (size_t)(info->read_end-in_buff_pos));
+ memcpy(buff,info->request_pos+(uint) offset, in_buff_length);
if (!(length-=in_buff_length))
DBUG_RETURN(0);
pos+=in_buff_length;
diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c
index 9a2526ad2cf..52066c0033d 100644
--- a/storage/myisam/mi_key.c
+++ b/storage/myisam/mi_key.c
@@ -74,8 +74,8 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
for (keyseg=info->s->keyinfo[keynr].seg ; keyseg->type ;keyseg++)
{
enum ha_base_keytype type=(enum ha_base_keytype) keyseg->type;
- uint length=keyseg->length;
- uint char_length;
+ size_t length=keyseg->length;
+ size_t char_length;
CHARSET_INFO *cs=keyseg->charset;
if (keyseg->null_bit)
@@ -116,11 +116,11 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
uchar *end= pos + length;
while (pos < end && pos[0] == ' ')
pos++;
- length=(uint) (end-pos);
+ length=(size_t) (end-pos);
}
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((uchar*) key,(uchar*) pos,(size_t) char_length);
+ memcpy(key, pos,char_length);
key+=char_length;
continue;
}
@@ -133,7 +133,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
set_if_smaller(length,tmp_length);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((uchar*) key,(uchar*) pos,(size_t) char_length);
+ memcpy(key, pos, char_length);
key+= char_length;
continue;
}
@@ -144,7 +144,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
set_if_smaller(length,tmp_length);
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((uchar*) key,(uchar*) pos,(size_t) char_length);
+ memcpy(key, pos, char_length);
key+= char_length;
continue;
}
@@ -235,8 +235,8 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
old+= keyseg->length, keyseg++)
{
enum ha_base_keytype type= (enum ha_base_keytype) keyseg->type;
- uint length= keyseg->length;
- uint char_length;
+ size_t length= keyseg->length;
+ size_t char_length;
uchar *pos;
CHARSET_INFO *cs=keyseg->charset;
@@ -259,7 +259,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
uchar *end= pos + length;
while (pos < end && pos[0] == ' ')
pos++;
- length= (uint) (end - pos);
+ length= (size_t)(end - pos);
}
else if (type != HA_KEYTYPE_BINARY)
{
@@ -267,7 +267,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
}
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
- memcpy((uchar*) key,pos,(size_t) char_length);
+ memcpy(key,pos,char_length);
key+= char_length;
continue;
}
@@ -280,7 +280,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length);
old+=2; /* Skip length */
- memcpy((uchar*) key, pos,(size_t) char_length);
+ memcpy(key, pos, char_length);
key+= char_length;
continue;
}
diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c
index 1921926463e..5e5e56db6e8 100644
--- a/storage/myisam/mi_locking.c
+++ b/storage/myisam/mi_locking.c
@@ -608,7 +608,7 @@ int _mi_mark_file_changed(MI_INFO *info)
{
mi_int2store(buff,share->state.open_count);
buff[2]=1; /* Mark that it's changed */
- DBUG_RETURN(mysql_file_pwrite(share->kfile, buff, sizeof(buff),
+ DBUG_RETURN((int)mysql_file_pwrite(share->kfile, buff, sizeof(buff),
sizeof(share->state.header),
MYF(MY_NABP)));
}
@@ -637,9 +637,9 @@ int _mi_decrement_open_count(MI_INFO *info)
{
share->state.open_count--;
mi_int2store(buff,share->state.open_count);
- write_error= mysql_file_pwrite(share->kfile, buff, sizeof(buff),
+ write_error= (mysql_file_pwrite(share->kfile, buff, sizeof(buff),
sizeof(share->state.header),
- MYF(MY_NABP));
+ MYF(MY_NABP)) != 0);
}
if (!lock_error && !my_disable_locking)
lock_error=mi_lock_database(info,old_lock);
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index 41b0e18da02..a50fe0879c3 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -127,7 +127,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share= &share_buff;
bzero((uchar*) &share_buff,sizeof(share_buff));
share_buff.key_cache= multi_key_cache_search((uchar*) name_buff,
- strlen(name_buff),
+ (uint)strlen(name_buff),
dflt_key_cache);
DBUG_EXECUTE_IF("myisam_pretend_crashed_table_on_open",
@@ -342,7 +342,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
(char*) key_del, (sizeof(my_off_t) *
share->state.header.max_block_size_index));
strmov(share->unique_file_name, name_buff);
- share->unique_name_length= strlen(name_buff);
+ share->unique_name_length= (uint)strlen(name_buff);
strmov(share->index_file_name, index_name);
strmov(share->data_file_name, data_name);
@@ -687,7 +687,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
if (myisam_log_file >= 0)
{
intern_filename(name_buff,share->index_file_name);
- _myisam_log(MI_LOG_OPEN, m_info, (uchar*) name_buff, strlen(name_buff));
+ _myisam_log(MI_LOG_OPEN, m_info, (uchar*) name_buff, (uint)strlen(name_buff));
}
DBUG_RETURN(m_info);
diff --git a/storage/myisam/mi_preload.c b/storage/myisam/mi_preload.c
index e0d23e0fca0..5c782defcde 100644
--- a/storage/myisam/mi_preload.c
+++ b/storage/myisam/mi_preload.c
@@ -98,7 +98,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
{
if (key_cache_insert(share->key_cache,
share->kfile, pos, DFLT_INIT_HITS,
- (uchar*) buff, block_length))
+ buff, (uint)block_length))
goto err;
}
pos+= block_length;
@@ -110,7 +110,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
{
if (key_cache_insert(share->key_cache,
share->kfile, pos, DFLT_INIT_HITS,
- (uchar*) buff, length))
+ (uchar*) buff, (uint)length))
goto err;
pos+= length;
}
diff --git a/storage/myisam/mi_test1.c b/storage/myisam/mi_test1.c
index bc1f6438e31..61e992694d2 100644
--- a/storage/myisam/mi_test1.c
+++ b/storage/myisam/mi_test1.c
@@ -386,7 +386,7 @@ static void create_key(uchar *key,uint rownr)
}
if (keyinfo[0].seg[0].flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART))
{
- uint tmp;
+ size_t tmp;
create_key_part(key+2,rownr);
tmp=strlen((char*) key+2);
int2store(key,tmp);
@@ -411,7 +411,7 @@ static void create_record(uchar *record,uint rownr)
pos=record+1;
if (recinfo[1].type == FIELD_BLOB)
{
- uint tmp;
+ size_t tmp;
uchar *ptr;
create_key_part(blob_key,rownr);
tmp=strlen((char*) blob_key);
@@ -422,7 +422,7 @@ static void create_record(uchar *record,uint rownr)
}
else if (recinfo[1].type == FIELD_VARCHAR)
{
- uint tmp, pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
+ size_t tmp, pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
create_key_part(pos+pack_length,rownr);
tmp= strlen((char*) pos+pack_length);
if (pack_length == 1)
@@ -438,7 +438,7 @@ static void create_record(uchar *record,uint rownr)
}
if (recinfo[2].type == FIELD_BLOB)
{
- uint tmp;
+ size_t tmp;
uchar *ptr;;
sprintf((char*) blob_record,"... row: %d", rownr);
strappend((char*) blob_record,MY_MAX(MAX_REC_LENGTH-rownr,10),' ');
@@ -449,7 +449,7 @@ static void create_record(uchar *record,uint rownr)
}
else if (recinfo[2].type == FIELD_VARCHAR)
{
- uint tmp, pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
+ size_t tmp, pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1);
sprintf((char*) pos+pack_length, "... row: %d", rownr);
tmp= strlen((char*) pos+pack_length);
if (pack_length == 1)
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index 1431f98ec1b..2c0c1eec49a 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -561,7 +561,7 @@ extern uint _mi_pack_key(MI_INFO *info, uint keynr, uchar *key,
HA_KEYSEG ** last_used_keyseg);
extern int _mi_read_key_record(MI_INFO *info, my_off_t filepos, uchar *buf);
extern int _mi_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos,
- uint length, int re_read_if_possibly);
+ size_t length, int re_read_if_possibly);
extern ulonglong retrieve_auto_increment(MI_INFO *info, const uchar *record);
extern uchar *mi_alloc_rec_buff(MI_INFO *, ulong, uchar **);
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index ace1f7c509e..4a35f3666d0 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -233,9 +233,9 @@ extern "C" int myisammrg_parent_open_callback(void *callback_param,
Mrg_child_def *mrg_child_def;
char *db;
char *table_name;
- uint dirlen;
- uint db_length;
- uint table_name_length;
+ size_t dirlen;
+ size_t db_length;
+ size_t table_name_length;
char dir_path[FN_REFLEN];
char name_buf[NAME_LEN];
DBUG_ENTER("myisammrg_parent_open_callback");
@@ -1549,7 +1549,7 @@ int ha_myisammrg::create_mrg(const char *name, HA_CREATE_INFO *create_info)
opened through the table cache. They are opened by db.table_name,
not by their path name.
*/
- uint length= build_table_filename(buff, sizeof(buff),
+ size_t length= build_table_filename(buff, sizeof(buff),
tables->db.str, tables->table_name.str, "", 0);
/*
If a MyISAM table is in the same directory as the MERGE table,
diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c
index 7f3937f572d..2dcbb735a8b 100644
--- a/storage/myisammrg/myrg_open.c
+++ b/storage/myisammrg/myrg_open.c
@@ -36,7 +36,8 @@
MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
{
int save_errno,errpos=0;
- uint files= 0, i, dir_length, length, UNINIT_VAR(key_parts), min_keys= 0;
+ uint files= 0, i, UNINIT_VAR(key_parts), min_keys= 0;
+ size_t length, dir_length;
ulonglong file_offset=0;
char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end;
MYRG_INFO *m_info=0;
@@ -228,7 +229,7 @@ MYRG_INFO *myrg_parent_open(const char *parent_name,
int errpos;
int save_errno;
int insert_method;
- uint length;
+ size_t length;
uint child_count;
File fd;
IO_CACHE file_cache;
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index fd415d8bc21..1b57a3d38ab 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -1239,9 +1239,9 @@ static enum_operation_type socket_operation_map[]=
static int build_prefix(const LEX_CSTRING *prefix, const char *category,
char *output, int *output_length)
{
- int len= strlen(category);
+ size_t len= strlen(category);
char *out_ptr= output;
- int prefix_length= prefix->length;
+ size_t prefix_length= prefix->length;
if (unlikely((prefix_length + len + 1) >=
PFS_MAX_FULL_PREFIX_NAME_LENGTH))
@@ -1291,7 +1291,7 @@ static int build_prefix(const LEX_CSTRING *prefix, const char *category,
{ \
DBUG_ASSERT(info->m_key != NULL); \
DBUG_ASSERT(info->m_name != NULL); \
- len= strlen(info->m_name); \
+ len= (int)strlen(info->m_name); \
full_length= prefix_length + len; \
if (likely(full_length <= PFS_MAX_INFO_NAME_LENGTH)) \
{ \
@@ -1403,7 +1403,7 @@ static void register_stage_v1(const char *category,
info= *info_array;
DBUG_ASSERT(info != NULL);
DBUG_ASSERT(info->m_name != NULL);
- len= strlen(info->m_name);
+ len= (int)strlen(info->m_name);
full_length= prefix_length + len;
if (likely(full_length <= PFS_MAX_INFO_NAME_LENGTH))
{
@@ -1447,7 +1447,7 @@ static void register_statement_v1(const char *category,
if (info->m_name == NULL)
continue;
- len= strlen(info->m_name);
+ len= (int)strlen(info->m_name);
full_length= prefix_length + len;
if (likely(full_length <= PFS_MAX_INFO_NAME_LENGTH))
{
@@ -1789,7 +1789,7 @@ static void create_file_v1(PSI_file_key key, const char *name, File file)
return;
}
- uint len= strlen(name);
+ uint len= (uint)strlen(name);
PFS_file *pfs_file= find_or_create_file(pfs_thread, klass, name, len, true);
file_handle_array[index]= pfs_file;
@@ -3964,7 +3964,7 @@ static PSI_file* end_file_open_wait_v1(PSI_file_locker *locker,
PFS_file_class *klass= reinterpret_cast<PFS_file_class*> (state->m_class);
PFS_thread *thread= reinterpret_cast<PFS_thread*> (state->m_thread);
const char *name= state->m_name;
- uint len= strlen(name);
+ uint len= (uint)strlen(name);
PFS_file *pfs_file= find_or_create_file(thread, klass, name, len, true);
state->m_file= reinterpret_cast<PSI_file*> (pfs_file);
}
@@ -3996,7 +3996,7 @@ static void end_file_open_wait_and_bind_to_descriptor_v1
PFS_file_class *klass= reinterpret_cast<PFS_file_class*> (state->m_class);
PFS_thread *thread= reinterpret_cast<PFS_thread*> (state->m_thread);
const char *name= state->m_name;
- uint len= strlen(name);
+ uint len= (uint)strlen(name);
pfs_file= find_or_create_file(thread, klass, name, len, true);
state->m_file= reinterpret_cast<PSI_file*> (pfs_file);
}
@@ -4189,7 +4189,7 @@ static void start_file_close_wait_v1(PSI_file_locker *locker,
case PSI_FILE_DELETE:
thread= reinterpret_cast<PFS_thread*> (state->m_thread);
name= state->m_name;
- len= strlen(name);
+ len= (uint)strlen(name);
pfs_file= find_or_create_file(thread, NULL, name, len, false);
state->m_file= reinterpret_cast<PSI_file*> (pfs_file);
break;
diff --git a/storage/perfschema/pfs_digest.cc b/storage/perfschema/pfs_digest.cc
index 86b05f37fd2..1cc685b7e7b 100644
--- a/storage/perfschema/pfs_digest.cc
+++ b/storage/perfschema/pfs_digest.cc
@@ -340,7 +340,7 @@ void purge_digest(PFS_thread* thread, PFS_digest_key *hash_key)
return;
}
-void PFS_statements_digest_stat::reset_data(unsigned char *token_array, uint length)
+void PFS_statements_digest_stat::reset_data(unsigned char *token_array, size_t length)
{
m_lock.set_dirty();
m_digest_storage.reset(token_array, length);
diff --git a/storage/perfschema/pfs_digest.h b/storage/perfschema/pfs_digest.h
index 429a9f4250a..a61e12d911d 100644
--- a/storage/perfschema/pfs_digest.h
+++ b/storage/perfschema/pfs_digest.h
@@ -61,7 +61,7 @@ struct PFS_ALIGNED PFS_statements_digest_stat
ulonglong m_last_seen;
/** Reset data for this record. */
- void reset_data(unsigned char* token_array, uint length);
+ void reset_data(unsigned char* token_array, size_t length);
/** Reset data and remove index for this record. */
void reset_index(PFS_thread *thread);
};
diff --git a/storage/perfschema/pfs_global.cc b/storage/perfschema/pfs_global.cc
index fe1670d0192..732f70a40df 100644
--- a/storage/perfschema/pfs_global.cc
+++ b/storage/perfschema/pfs_global.cc
@@ -219,6 +219,6 @@ uint pfs_get_socket_address(char *host,
}
/* Return actual IP address string length */
- return (strlen((const char*)host));
+ return ((uint)strlen((const char*)host));
}
diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc
index 9cb2c68dbaf..61819993c39 100644
--- a/storage/perfschema/pfs_instr.cc
+++ b/storage/perfschema/pfs_instr.cc
@@ -1296,7 +1296,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
*buf_end= '\0';
normalized_filename= buffer;
- normalized_length= strlen(normalized_filename);
+ normalized_length= (int)strlen(normalized_filename);
PFS_file **entry;
uint retry_count= 0;
diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc
index 647702c0d8f..3f5fce9e7a2 100644
--- a/storage/perfschema/pfs_instr_class.cc
+++ b/storage/perfschema/pfs_instr_class.cc
@@ -1185,7 +1185,7 @@ PFS_instr_class *sanitize_idle_class(PFS_instr_class *unsafe)
static void set_keys(PFS_table_share *pfs, const TABLE_SHARE *share)
{
- int len;
+ uint len;
KEY *key_info= share->key_info;
PFS_table_key *pfs_key= pfs->m_keys;
PFS_table_key *pfs_key_last= pfs->m_keys + share->keys;
@@ -1193,7 +1193,7 @@ static void set_keys(PFS_table_share *pfs, const TABLE_SHARE *share)
for ( ; pfs_key < pfs_key_last; pfs_key++, key_info++)
{
- len= key_info->name.length;
+ len= (uint)key_info->name.length;
memcpy(pfs_key->m_name, key_info->name.str, len);
pfs_key->m_name_length= len;
}
@@ -1215,7 +1215,7 @@ static int compare_keys(PFS_table_share *pfs, const TABLE_SHARE *share)
for ( ; pfs_key < pfs_key_last; pfs_key++, key_info++)
{
- len= key_info->name.length;
+ len= (uint)key_info->name.length;
if (len != pfs_key->m_name_length)
return 1;
@@ -1248,9 +1248,9 @@ PFS_table_share* find_or_create_table_share(PFS_thread *thread,
}
const char *schema_name= share->db.str;
- uint schema_name_length= share->db.length;
+ uint schema_name_length= (uint)share->db.length;
const char *table_name= share->table_name.str;
- uint table_name_length= share->table_name.length;
+ uint table_name_length= (uint)share->table_name.length;
set_table_share_key(&key, temporary,
schema_name, schema_name_length,
diff --git a/storage/perfschema/pfs_server.cc b/storage/perfschema/pfs_server.cc
index ee965c0e7da..eca0f619868 100644
--- a/storage/perfschema/pfs_server.cc
+++ b/storage/perfschema/pfs_server.cc
@@ -249,8 +249,8 @@ void cleanup_instrument_config()
int add_pfs_instr_to_array(const char* name, const char* value)
{
- int name_length= strlen(name);
- int value_length= strlen(value);
+ size_t name_length= strlen(name);
+ size_t value_length= strlen(value);
/* Allocate structure plus string buffers plus null terminators */
PFS_instr_config* e = (PFS_instr_config*)my_malloc(sizeof(PFS_instr_config)
@@ -260,7 +260,7 @@ int add_pfs_instr_to_array(const char* name, const char* value)
/* Copy the instrument name */
e->m_name= (char*)e + sizeof(PFS_instr_config);
memcpy(e->m_name, name, name_length);
- e->m_name_length= name_length;
+ e->m_name_length= (uint)name_length;
e->m_name[name_length]= '\0';
/* Set flags accordingly */
diff --git a/storage/perfschema/table_events_stages.cc b/storage/perfschema/table_events_stages.cc
index 42761d92abf..4d86b131049 100644
--- a/storage/perfschema/table_events_stages.cc
+++ b/storage/perfschema/table_events_stages.cc
@@ -156,7 +156,7 @@ void table_events_stages_common::make_row(PFS_events_stages *stage)
return;
base= base_name(safe_source_file);
- m_row.m_source_length= my_snprintf(m_row.m_source, sizeof(m_row.m_source),
+ m_row.m_source_length= (uint)my_snprintf(m_row.m_source, sizeof(m_row.m_source),
"%s:%d", base, stage->m_source_line);
if (m_row.m_source_length > sizeof(m_row.m_source))
m_row.m_source_length= sizeof(m_row.m_source);
diff --git a/storage/perfschema/table_events_statements.cc b/storage/perfschema/table_events_statements.cc
index fdc63034be5..37237154173 100644
--- a/storage/perfschema/table_events_statements.cc
+++ b/storage/perfschema/table_events_statements.cc
@@ -270,7 +270,7 @@ void table_events_statements_common::make_row_part_1(PFS_events_statements *stat
if (chars > 3)
{
chars-= 3;
- size_t bytes_offset= m_row.m_sqltext.charpos(chars, 0);
+ uint32 bytes_offset= m_row.m_sqltext.charpos(chars, 0);
m_row.m_sqltext.length(bytes_offset);
m_row.m_sqltext.append("...", 3);
}
diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc
index 01f8cd5e6b5..ec5acfefeb1 100644
--- a/storage/perfschema/table_events_waits.cc
+++ b/storage/perfschema/table_events_waits.cc
@@ -427,7 +427,7 @@ void table_events_waits_common::make_row(bool thread_own_wait,
return;
base= base_name(wait->m_source_file);
- m_row.m_source_length= my_snprintf(m_row.m_source, sizeof(m_row.m_source),
+ m_row.m_source_length= (uint)my_snprintf(m_row.m_source, sizeof(m_row.m_source),
"%s:%d", base, wait->m_source_line);
if (m_row.m_source_length > sizeof(m_row.m_source))
m_row.m_source_length= sizeof(m_row.m_source);
@@ -662,7 +662,7 @@ int table_events_waits_common::read_row_values(TABLE *table,
break;
case 16: /* OPERATION */
operation= &operation_names_map[(int) m_row.m_operation - 1];
- set_field_varchar_utf8(f, operation->str, operation->length);
+ set_field_varchar_utf8(f, operation->str, (uint)operation->length);
break;
case 17: /* NUMBER_OF_BYTES */
if ((m_row.m_operation == OPERATION_TYPE_FILEREAD) ||
diff --git a/storage/perfschema/table_host_cache.cc b/storage/perfschema/table_host_cache.cc
index df13207e578..d9853906b99 100644
--- a/storage/perfschema/table_host_cache.cc
+++ b/storage/perfschema/table_host_cache.cc
@@ -150,7 +150,7 @@ end:
void table_host_cache::make_row(Host_entry *entry, row_host_cache *row)
{
- row->m_ip_length= strlen(entry->ip_key);
+ row->m_ip_length= (int)strlen(entry->ip_key);
strcpy(row->m_ip, entry->ip_key);
row->m_hostname_length= entry->m_hostname_length;
if (row->m_hostname_length > 0)
diff --git a/storage/perfschema/table_setup_consumers.cc b/storage/perfschema/table_setup_consumers.cc
index f3529eb8846..b4cb359c0d2 100644
--- a/storage/perfschema/table_setup_consumers.cc
+++ b/storage/perfschema/table_setup_consumers.cc
@@ -174,7 +174,7 @@ int table_setup_consumers::read_row_values(TABLE *table,
switch(f->field_index)
{
case 0: /* NAME */
- set_field_varchar_utf8(f, m_row->m_name.str, m_row->m_name.length);
+ set_field_varchar_utf8(f, m_row->m_name.str,(uint) m_row->m_name.length);
break;
case 1: /* ENABLED */
set_field_enum(f, (*m_row->m_enabled_ptr) ? ENUM_YES : ENUM_NO);
diff --git a/storage/perfschema/table_setup_timers.cc b/storage/perfschema/table_setup_timers.cc
index 9c6af49595d..6020548abaa 100644
--- a/storage/perfschema/table_setup_timers.cc
+++ b/storage/perfschema/table_setup_timers.cc
@@ -129,7 +129,7 @@ int table_setup_timers::read_row_values(TABLE *table,
switch(f->field_index)
{
case 0: /* NAME */
- set_field_varchar_utf8(f, m_row->m_name.str, m_row->m_name.length);
+ set_field_varchar_utf8(f, m_row->m_name.str,(uint) m_row->m_name.length);
break;
case 1: /* TIMER_NAME */
set_field_enum(f, *(m_row->m_timer_name_ptr));
diff --git a/storage/perfschema/table_threads.cc b/storage/perfschema/table_threads.cc
index 1458c0b11d5..f5c97ddd175 100644
--- a/storage/perfschema/table_threads.cc
+++ b/storage/perfschema/table_threads.cc
@@ -228,7 +228,7 @@ int table_threads::read_row_values(TABLE *table,
case 7: /* PROCESSLIST_COMMAND */
if (m_row.m_processlist_id != 0)
set_field_varchar_utf8(f, command_name[m_row.m_command].str,
- command_name[m_row.m_command].length);
+ (uint)command_name[m_row.m_command].length);
else
f->set_null();
break;
diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc
index b8814f2ad2d..3da18ac30c0 100644
--- a/storage/perfschema/unittest/pfs-t.cc
+++ b/storage/perfschema/unittest/pfs-t.cc
@@ -43,10 +43,10 @@ PFS_file* lookup_file_by_name(const char* name)
{
uint i;
PFS_file *pfs;
- uint len= strlen(name);
+ size_t len= strlen(name);
size_t dirlen;
const char *filename;
- uint filename_length;;
+ size_t filename_length;;
for (i= 0; i < file_max; i++)
{
diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt
index 6cb7eb1d439..c3a95299b88 100644
--- a/storage/rocksdb/CMakeLists.txt
+++ b/storage/rocksdb/CMakeLists.txt
@@ -216,9 +216,13 @@ IF(MSVC)
# additional const qualifiers to parameters of the overriden virtual functions
# This creates a lot of warnings, that we silence here.
ADD_DEFINITIONS(/wd4373)
-
# Some checks in C++ runtime that make debug build much slower
ADD_DEFINITIONS(-D_ITERATOR_DEBUG_LEVEL=0)
+
+ # Temporarily disable "conversion from size_t .." warnings
+ IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267")
+ ENDIF()
ENDIF()
IF(GIT_EXECUTABLE)
diff --git a/storage/sphinx/CMakeLists.txt b/storage/sphinx/CMakeLists.txt
index e50ba74ba90..f05da9a496f 100644
--- a/storage/sphinx/CMakeLists.txt
+++ b/storage/sphinx/CMakeLists.txt
@@ -5,6 +5,13 @@ ADD_DEFINITIONS(-DMYSQL_SERVER)
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-write-strings")
IF(MSVC)
+ # Temporarily disable "conversion from size_t .." warnings
+ IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267")
+ ENDIF()
+ENDIF()
+
+IF(MSVC)
LINK_LIBRARIES(ws2_32)
ENDIF(MSVC)
diff --git a/storage/spider/CMakeLists.txt b/storage/spider/CMakeLists.txt
index 499b4948485..d267a6ba3f9 100644
--- a/storage/spider/CMakeLists.txt
+++ b/storage/spider/CMakeLists.txt
@@ -6,6 +6,13 @@ IF(HAVE_WVLA)
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wno-vla")
ENDIF()
+IF(MSVC)
+ # Temporarily disable "conversion from size_t .."
+ IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267")
+ ENDIF()
+ENDIF()
+
SET(SPIDER_SOURCES
spd_param.cc spd_sys_table.cc spd_trx.cc spd_db_conn.cc spd_conn.cc
spd_table.cc spd_direct_sql.cc spd_udf.cc spd_ping_table.cc
diff --git a/strings/ctype.c b/strings/ctype.c
index 64ebd51676f..28bfbf16ff6 100644
--- a/strings/ctype.c
+++ b/strings/ctype.c
@@ -831,7 +831,7 @@ my_parse_charset_xml(MY_CHARSET_LOADER *loader, const char *buf, size_t len)
uint
-my_string_repertoire_8bit(CHARSET_INFO *cs, const char *str, ulong length)
+my_string_repertoire_8bit(CHARSET_INFO *cs, const char *str, size_t length)
{
const char *strend;
if ((cs->state & MY_CS_NONASCII) && length > 0)
@@ -917,7 +917,7 @@ my_string_metadata_get(MY_STRING_METADATA *metadata,
Check repertoire: detect pure ascii strings
*/
uint
-my_string_repertoire(CHARSET_INFO *cs, const char *str, ulong length)
+my_string_repertoire(CHARSET_INFO *cs, const char *str, size_t length)
{
if (cs->mbminlen == 1 && !(cs->state & MY_CS_NONASCII))
{
@@ -1001,9 +1001,9 @@ my_charset_is_ascii_based(CHARSET_INFO *cs)
*/
uint32
-my_convert_using_func(char *to, uint32 to_length,
+my_convert_using_func(char *to, size_t to_length,
CHARSET_INFO *to_cs, my_charset_conv_wc_mb wc_mb,
- const char *from, uint32 from_length,
+ const char *from, size_t from_length,
CHARSET_INFO *from_cs, my_charset_conv_mb_wc mb_wc,
uint *errors)
{
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 015f3600e4e..46b0d86bf30 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -31,6 +31,9 @@
The fw.c file includes all the mysql_client_test framework; this file
contains only the actual tests, plus the list of test functions to call.
*/
+#ifdef _MSC_VER
+#pragma warning (disable : 4267)
+#endif
#include "mysql_client_fw.c"
#ifndef _WIN32
diff --git a/unittest/mysys/base64-t.c b/unittest/mysys/base64-t.c
index 58d0014dee1..ee0324f7dff 100644
--- a/unittest/mysys/base64-t.c
+++ b/unittest/mysys/base64-t.c
@@ -48,7 +48,7 @@ main(int argc __attribute__((unused)),char *argv[])
}
/* Encode */
- needed_length= my_base64_needed_encoded_length(src_len);
+ needed_length= my_base64_needed_encoded_length((int)src_len);
str= (char *) malloc(needed_length);
for (k= 0; k < needed_length; k++)
str[k]= 0xff; /* Fill memory to check correct NUL termination */
@@ -58,7 +58,7 @@ main(int argc __attribute__((unused)),char *argv[])
"my_base64_needed_encoded_length: size %d", i);
/* Decode */
- dst= (char *) malloc(my_base64_needed_decoded_length(strlen(str)));
+ dst= (char *) malloc(my_base64_needed_decoded_length((int)strlen(str)));
dst_len= my_base64_decode(str, strlen(str), dst, NULL, 0);
ok(dst_len == src_len, "Comparing lengths");
diff --git a/unittest/sql/mf_iocache-t.cc b/unittest/sql/mf_iocache-t.cc
index 2f36127af6d..f27e49d7ea3 100644
--- a/unittest/sql/mf_iocache-t.cc
+++ b/unittest/sql/mf_iocache-t.cc
@@ -138,7 +138,7 @@ void temp_io_cache()
res= reinit_io_cache(&info, READ_CACHE, 0, 0, 0);
ok(res == 0, "reinit READ_CACHE" INFO_TAIL);
- res= my_pread(info.file, buf, 50, 50, MYF(MY_NABP));
+ res= (int)my_pread(info.file, buf, 50, 50, MYF(MY_NABP));
ok(res == 0 && data_bad(buf, 50) == encrypt_tmp_files,
"file must be %sreadable", encrypt_tmp_files ?"un":"");
@@ -176,7 +176,7 @@ void mdev9044()
res= reinit_io_cache(&info, READ_CACHE, 0, 0, 0);
ok(res == 0, "reinit READ_CACHE" INFO_TAIL);
- res= my_b_fill(&info);
+ res= (int)my_b_fill(&info);
ok(res == 0, "fill" INFO_TAIL);
res= reinit_io_cache(&info, READ_CACHE, 0, 0, 0);
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 96bd729cfe8..75d3fc51db1 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -653,18 +653,15 @@ my_socket vio_fd(Vio* vio)
@param src_length [in] length of the src.
@param dst [out] a buffer to store normalized IP address
(sockaddr_storage).
- @param dst_length [out] actual length of the normalized IP address.
+ @param dst_length [out] optional - actual length of the normalized IP address.
*/
-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)
{
switch (src->sa_family) {
case AF_INET:
memcpy(dst, src, src_length);
- *dst_length= src_length;
break;
#ifdef HAVE_IPV6
@@ -683,9 +680,7 @@ void vio_get_normalized_ip(const struct sockaddr *src,
be converted to the IPv4 form.
*/
- *dst_length= sizeof (struct sockaddr_in);
-
- memset(dst_ip4, 0, *dst_length);
+ memset(dst_ip4, 0, sizeof (struct sockaddr_in));
dst_ip4->sin_family= AF_INET;
dst_ip4->sin_port= src_addr6->sin6_port;
@@ -699,9 +694,7 @@ void vio_get_normalized_ip(const struct sockaddr *src,
else
{
/* This is a "native" IPv6 address. */
-
memcpy(dst, src, src_length);
- *dst_length= src_length;
}
break;
@@ -732,17 +725,15 @@ void vio_get_normalized_ip(const struct sockaddr *src,
@retval FALSE on success.
*/
-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)
{
struct sockaddr_storage norm_addr_storage;
struct sockaddr *norm_addr= (struct sockaddr *) &norm_addr_storage;
- int norm_addr_length;
int err_code;
- vio_get_normalized_ip(addr, addr_length, norm_addr, &norm_addr_length);
+ vio_get_normalized_ip(addr, addr_length, norm_addr);
err_code= vio_getnameinfo(norm_addr, ip_string, ip_string_size, NULL, 0,
NI_NUMERICHOST);
@@ -781,9 +772,7 @@ my_bool vio_peer_addr(Vio *vio, char *ip_buffer, uint16 *port,
address.
*/
struct in_addr *ip4= &((struct sockaddr_in *) &(vio->remote))->sin_addr;
-
vio->remote.ss_family= AF_INET;
- vio->addrLen= sizeof (struct sockaddr_in);
ip4->s_addr= htonl(INADDR_LOOPBACK);
@@ -800,7 +789,6 @@ my_bool vio_peer_addr(Vio *vio, char *ip_buffer, uint16 *port,
struct sockaddr_storage addr_storage;
struct sockaddr *addr= (struct sockaddr *) &addr_storage;
size_socket addr_length= sizeof (addr_storage);
-
/* Get sockaddr by socked fd. */
err_code= mysql_socket_getpeername(vio->mysql_socket, addr, &addr_length);
@@ -814,7 +802,7 @@ my_bool vio_peer_addr(Vio *vio, char *ip_buffer, uint16 *port,
/* Normalize IP address. */
vio_get_normalized_ip(addr, addr_length,
- (struct sockaddr *) &vio->remote, &vio->addrLen);
+ (struct sockaddr *) &vio->remote);
/* Get IP address & port number. */