summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2018-02-06 12:55:58 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2018-02-06 12:55:58 +0000
commit6c279ad6a71c63cb595fde7c951aadb31c3dbebc (patch)
tree3603f88e1b3bd1e622edb182cccd882dd31ddc8a /sql
parentf271100836d8a91a775894ec36b869a66a3145e5 (diff)
downloadmariadb-git-6c279ad6a71c63cb595fde7c951aadb31c3dbebc.tar.gz
MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from 'size_t' to 'type', possible loss of data)
Handle string length as size_t, consistently (almost always:)) Change function prototypes to accept size_t, where in the past ulong or uint were used. change local/member variables to size_t when appropriate. This fix excludes rocksdb, spider,spider, sphinx and connect for now.
Diffstat (limited to 'sql')
-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
135 files changed, 1074 insertions, 1120 deletions
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);