summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-10-02 22:35:13 +0400
committerAlexander Barkov <bar@mariadb.org>2017-10-02 22:35:13 +0400
commit8ae8cd63485eb063de0b70ea6f3acf7102a61fef (patch)
tree70fa448baa769b6c8c331063a61bf929ad61c976 /sql
parent6857cb57fe7090f131b272f31485b7a478a0b324 (diff)
parent387bdf07ae0973bc3e4dc3f5064d2a29c64bb769 (diff)
downloadmariadb-git-8ae8cd63485eb063de0b70ea6f3acf7102a61fef.tar.gz
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Diffstat (limited to 'sql')
-rw-r--r--sql/CMakeLists.txt1
-rw-r--r--sql/create_options.cc4
-rw-r--r--sql/debug_sync.cc8
-rw-r--r--sql/discover.cc2
-rw-r--r--sql/event_data_objects.cc6
-rw-r--r--sql/event_db_repository.cc4
-rw-r--r--sql/event_parse_data.cc12
-rw-r--r--sql/event_queue.cc14
-rw-r--r--sql/event_scheduler.cc10
-rw-r--r--sql/events.cc2
-rw-r--r--sql/field.cc34
-rw-r--r--sql/field.h7
-rw-r--r--sql/filesort.cc5
-rw-r--r--sql/gen_lex_token.cc2
-rw-r--r--sql/ha_partition.cc12
-rw-r--r--sql/handler.cc20
-rw-r--r--sql/handler.h6
-rw-r--r--sql/item.cc6
-rw-r--r--sql/item_cmpfunc.cc6
-rw-r--r--sql/item_create.cc2
-rw-r--r--sql/item_func.h6
-rw-r--r--sql/item_inetfunc.cc26
-rw-r--r--sql/item_jsonfunc.cc20
-rw-r--r--sql/item_strfunc.cc12
-rw-r--r--sql/item_subselect.cc10
-rw-r--r--sql/item_sum.cc4
-rw-r--r--sql/item_sum.h2
-rw-r--r--sql/item_timefunc.cc8
-rw-r--r--sql/key.cc2
-rw-r--r--sql/log.cc14
-rw-r--r--sql/log_event.cc54
-rw-r--r--sql/log_event.h2
-rw-r--r--sql/log_event_old.cc24
-rw-r--r--sql/mf_iocache_encr.cc6
-rw-r--r--sql/mysqld.cc17
-rw-r--r--sql/opt_range.cc22
-rw-r--r--sql/parse_file.cc6
-rw-r--r--sql/rpl_filter.cc2
-rw-r--r--sql/rpl_parallel.cc2
-rw-r--r--sql/rpl_record.cc18
-rw-r--r--sql/rpl_rli.cc8
-rw-r--r--sql/rpl_tblmap.cc12
-rw-r--r--sql/session_tracker.cc8
-rw-r--r--sql/slave.cc12
-rw-r--r--sql/sp.cc14
-rw-r--r--sql/sp_head.cc32
-rw-r--r--sql/sp_pcontext.h8
-rw-r--r--sql/sql_acl.cc27
-rw-r--r--sql/sql_admin.cc2
-rw-r--r--sql/sql_audit.h87
-rw-r--r--sql/sql_base.cc32
-rw-r--r--sql/sql_binlog.cc4
-rw-r--r--sql/sql_bootstrap.cc4
-rw-r--r--sql/sql_cache.cc426
-rw-r--r--sql/sql_cache.h4
-rw-r--r--sql/sql_class.cc24
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_delete.cc2
-rw-r--r--sql/sql_derived.cc2
-rw-r--r--sql/sql_insert.cc4
-rw-r--r--sql/sql_join_cache.cc6
-rw-r--r--sql/sql_lex.cc24
-rw-r--r--sql/sql_manager.cc2
-rw-r--r--sql/sql_parse.cc14
-rw-r--r--sql/sql_partition.cc2
-rw-r--r--sql/sql_plugin.cc20
-rw-r--r--sql/sql_prepare.cc8
-rw-r--r--sql/sql_select.cc20
-rw-r--r--sql/sql_servers.cc16
-rw-r--r--sql/sql_show.cc8
-rw-r--r--sql/sql_string.cc37
-rw-r--r--sql/sql_string.h27
-rw-r--r--sql/sql_table.cc12
-rw-r--r--sql/sql_test.cc2
-rw-r--r--sql/sql_time.h2
-rw-r--r--sql/sql_view.cc2
-rw-r--r--sql/sql_window.cc2
-rw-r--r--sql/sql_yacc.yy2
-rw-r--r--sql/sql_yacc_ora.yy2
-rw-r--r--sql/strfunc.cc2
-rw-r--r--sql/sys_vars.cc6
-rw-r--r--sql/sys_vars.ic12
-rw-r--r--sql/table.cc8
-rw-r--r--sql/table_cache.cc23
-rw-r--r--sql/table_cache.h12
-rw-r--r--sql/temporary_tables.cc8
-rw-r--r--sql/threadpool_generic.cc13
-rw-r--r--sql/udf_example.c2
-rw-r--r--sql/uniques.cc6
-rw-r--r--sql/uniques.h12
-rw-r--r--sql/unireg.cc8
91 files changed, 743 insertions, 713 deletions
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index f71c43daaec..b3c99cc4788 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -245,6 +245,7 @@ IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS)
SET(CMAKE_CONFIGURABLE_FILE_CONTENT "
IF ((mysqld_lib.def IS_NEWER_THAN mysqld_lib.lib) OR
(mysqld_lib.def IS_NEWER_THAN mysqld_lib.exp))
+ FILE(REMOVE mysqld_lib.lib mysqld_lib.exp)
SET(ENV{VS_UNICODE_OUTPUT})
EXECUTE_PROCESS (
COMMAND \"${CMAKE_LINKER}\" /lib /NAME:mysqld.exe \"/DEF:${MYSQLD_DEF}\" /MACHINE:${_PLATFORM}
diff --git a/sql/create_options.cc b/sql/create_options.cc
index a56357db588..22e58f8801b 100644
--- a/sql/create_options.cc
+++ b/sql/create_options.cc
@@ -124,8 +124,8 @@ static bool set_one_value(ha_create_table_option *opt,
MEM_ROOT *root)
{
DBUG_ENTER("set_one_value");
- DBUG_PRINT("enter", ("opt: 0x%lx type: %u name '%s' value: '%s'",
- (ulong) opt,
+ DBUG_PRINT("enter", ("opt: %p type: %u name '%s' value: '%s'",
+ opt,
opt->type, opt->name,
(value->str ? value->str : "<DEFAULT>")));
switch (opt->type)
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc
index ab022c770b8..6b09978d128 100644
--- a/sql/debug_sync.cc
+++ b/sql/debug_sync.cc
@@ -549,7 +549,7 @@ static void debug_sync_reset(THD *thd)
static void debug_sync_remove_action(st_debug_sync_control *ds_control,
st_debug_sync_action *action)
{
- uint dsp_idx= action - ds_control->ds_action;
+ uint dsp_idx= (uint)(action - ds_control->ds_action);
DBUG_ENTER("debug_sync_remove_action");
DBUG_ASSERT(ds_control);
DBUG_ASSERT(ds_control == current_thd->debug_sync_control);
@@ -681,8 +681,8 @@ static st_debug_sync_action *debug_sync_get_action(THD *thd,
}
DBUG_ASSERT(action >= ds_control->ds_action);
DBUG_ASSERT(action < ds_control->ds_action + ds_control->ds_active);
- DBUG_PRINT("debug_sync", ("action: 0x%lx array: 0x%lx count: %u",
- (long) action, (long) ds_control->ds_action,
+ DBUG_PRINT("debug_sync", ("action: %p array: %p count: %u",
+ action, ds_control->ds_action,
ds_control->ds_active));
DBUG_RETURN(action);
@@ -871,7 +871,7 @@ static char *debug_sync_token(char **token_p, uint *token_length_p,
ptr, ptrend, MY_SEQ_NONSPACES);
/* Get token length. */
- *token_length_p= ptr - *token_p;
+ *token_length_p= (uint)(ptr - *token_p);
/* If necessary, terminate token. */
if (*ptr)
diff --git a/sql/discover.cc b/sql/discover.cc
index d8bf6ca79c5..62a0084e2e7 100644
--- a/sql/discover.cc
+++ b/sql/discover.cc
@@ -229,7 +229,7 @@ int extension_based_table_discovery(MY_DIR *dirp, const char *ext_meta,
cur++;
}
advance(from, to, cur, skip);
- dirp->number_of_files= to - dirp->dir_entry;
+ dirp->number_of_files= (uint)(to - dirp->dir_entry);
return 0;
}
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index 2ab06fb34f2..4df981700ef 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -561,7 +561,7 @@ Event_queue_element::load_from_row(THD *thd, TABLE *table)
}
if ((ptr= get_field(&mem_root, table->field[ET_FIELD_ORIGINATOR])) == NullS)
DBUG_RETURN(TRUE);
- originator = table->field[ET_FIELD_ORIGINATOR]->val_int();
+ originator = (uint32) table->field[ET_FIELD_ORIGINATOR]->val_int();
/* ToDo : Andrey . Find a way not to allocate ptr on event_mem_root */
if ((ptr= get_field(&mem_root,
@@ -911,9 +911,9 @@ Event_queue_element::compute_next_execution_time()
{
my_time_t time_now;
DBUG_ENTER("Event_queue_element::compute_next_execution_time");
- DBUG_PRINT("enter", ("starts: %lu ends: %lu last_executed: %lu this: 0x%lx",
+ DBUG_PRINT("enter", ("starts: %lu ends: %lu last_executed: %lu this: %p",
(long) starts, (long) ends, (long) last_executed,
- (long) this));
+ this));
if (status != Event_parse_data::ENABLED)
{
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index e71cfdc1e16..20c2384ff04 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -1063,7 +1063,7 @@ Event_db_repository::load_named_event(THD *thd, const LEX_CSTRING *dbname,
TABLE_LIST event_table;
DBUG_ENTER("Event_db_repository::load_named_event");
- DBUG_PRINT("enter",("thd: 0x%lx name: %*s", (long) thd,
+ DBUG_PRINT("enter",("thd: %p name: %*s", thd,
(int) name->length, name->str));
event_table.init_one_table("mysql", 5, "event", 5, "event", TL_READ);
@@ -1186,7 +1186,7 @@ Event_db_repository::check_system_tables(THD *thd)
const unsigned int event_priv_column_position= 29;
DBUG_ENTER("Event_db_repository::check_system_tables");
- DBUG_PRINT("enter", ("thd: 0x%lx", (long) thd));
+ DBUG_PRINT("enter", ("thd: %p", thd));
/* Check mysql.db */
tables.init_one_table("mysql", 5, "db", 2, "db", TL_READ);
diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc
index 7932f228309..e203712e229 100644
--- a/sql/event_parse_data.cc
+++ b/sql/event_parse_data.cc
@@ -494,9 +494,9 @@ Event_parse_data::check_parse_data(THD *thd)
{
bool ret;
DBUG_ENTER("Event_parse_data::check_parse_data");
- DBUG_PRINT("info", ("execute_at: 0x%lx expr=0x%lx starts=0x%lx ends=0x%lx",
- (long) item_execute_at, (long) item_expression,
- (long) item_starts, (long) item_ends));
+ DBUG_PRINT("info", ("execute_at: %p expr=%p starts=%p ends=%p",
+ item_execute_at, item_expression,
+ item_starts, item_ends));
init_name(thd, identifier);
@@ -529,9 +529,9 @@ Event_parse_data::init_definer(THD *thd)
size_t definer_user_len= thd->lex->definer->user.length;
size_t definer_host_len= thd->lex->definer->host.length;
char *tmp;
- DBUG_PRINT("info",("init definer_user thd->mem_root: 0x%lx "
- "definer_user: 0x%lx", (long) thd->mem_root,
- (long) definer_user));
+ DBUG_PRINT("info",("init definer_user thd->mem_root: %p "
+ "definer_user: %p", thd->mem_root,
+ definer_user));
/* + 1 for @ */
DBUG_PRINT("info",("init definer as whole"));
diff --git a/sql/event_queue.cc b/sql/event_queue.cc
index 9ffb9935634..208ad55c5f5 100644
--- a/sql/event_queue.cc
+++ b/sql/event_queue.cc
@@ -135,7 +135,7 @@ bool
Event_queue::init_queue(THD *thd)
{
DBUG_ENTER("Event_queue::init_queue");
- DBUG_PRINT("enter", ("this: 0x%lx", (long) this));
+ DBUG_PRINT("enter", ("this: %p", this));
LOCK_QUEUE_DATA();
@@ -201,7 +201,7 @@ Event_queue::create_event(THD *thd, Event_queue_element *new_element,
bool *created)
{
DBUG_ENTER("Event_queue::create_event");
- DBUG_PRINT("enter", ("thd: 0x%lx et=%s.%s", (long) thd,
+ DBUG_PRINT("enter", ("thd: %p et=%s.%s", thd,
new_element->dbname.str, new_element->name.str));
/* Will do nothing if the event is disabled */
@@ -213,7 +213,7 @@ Event_queue::create_event(THD *thd, Event_queue_element *new_element,
DBUG_RETURN(FALSE);
}
- DBUG_PRINT("info", ("new event in the queue: 0x%lx", (long) new_element));
+ DBUG_PRINT("info", ("new event in the queue: %p", new_element));
LOCK_QUEUE_DATA();
*created= (queue_insert_safe(&queue, (uchar *) new_element) == FALSE);
@@ -266,7 +266,7 @@ Event_queue::update_event(THD *thd, const LEX_CSTRING *dbname,
/* If not disabled event */
if (new_element)
{
- DBUG_PRINT("info", ("new event in the queue: 0x%lx", (long) new_element));
+ DBUG_PRINT("info", ("new event in the queue: %p", new_element));
queue_insert_safe(&queue, (uchar *) new_element);
mysql_cond_broadcast(&COND_queue_state);
}
@@ -549,7 +549,7 @@ Event_queue::dbug_dump_queue(my_time_t when)
i++)
{
et= ((Event_queue_element*)queue_element(&queue, i));
- DBUG_PRINT("info", ("et: 0x%lx name: %s.%s", (long) et,
+ DBUG_PRINT("info", ("et: %p name: %s.%s", et,
et->dbname.str, et->name.str));
DBUG_PRINT("info", ("exec_at: %lu starts: %lu ends: %lu execs_so_far: %u "
"expr: %ld et.exec_at: %ld now: %ld "
@@ -677,8 +677,8 @@ Event_queue::get_top_for_execution_if_time(THD *thd,
end:
UNLOCK_QUEUE_DATA();
- DBUG_PRINT("info", ("returning %d et_new: 0x%lx ",
- ret, (long) *event_name));
+ DBUG_PRINT("info", ("returning %d et_new: %p ",
+ ret, *event_name));
if (*event_name)
{
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index c889cbeba67..1e808a17604 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -295,7 +295,7 @@ Event_worker_thread::run(THD *thd, Event_queue_element_for_exec *event)
res= post_init_event_thread(thd);
DBUG_ENTER("Event_worker_thread::run");
- DBUG_PRINT("info", ("Time is %ld, THD: 0x%lx", (long) my_time(0), (long) thd));
+ DBUG_PRINT("info", ("Time is %u, THD: %p", (uint)my_time(0), thd));
inc_thread_running();
if (res)
@@ -420,7 +420,7 @@ Event_scheduler::start(int *err_no)
scheduler_thd= new_thd;
DBUG_PRINT("info", ("Setting state go RUNNING"));
state= RUNNING;
- DBUG_PRINT("info", ("Forking new thread for scheduler. THD: 0x%lx", (long) new_thd));
+ DBUG_PRINT("info", ("Forking new thread for scheduler. THD: %p", new_thd));
if ((*err_no= mysql_thread_create(key_thread_event_scheduler,
&th, &connection_attrib,
event_scheduler_thread,
@@ -485,7 +485,7 @@ Event_scheduler::run(THD *thd)
}
DBUG_PRINT("info", ("get_top_for_execution_if_time returned "
- "event_name=0x%lx", (long) event_name));
+ "event_name=%p", event_name));
if (event_name)
{
if ((res= execute_top(event_name)))
@@ -566,7 +566,7 @@ Event_scheduler::execute_top(Event_queue_element_for_exec *event_name)
started_events++;
executed_events++; // For SHOW STATUS
- DBUG_PRINT("info", ("Event is in THD: 0x%lx", (long) new_thd));
+ DBUG_PRINT("info", ("Event is in THD: %p", new_thd));
DBUG_RETURN(FALSE);
error:
@@ -617,7 +617,7 @@ Event_scheduler::stop()
{
THD *thd= current_thd;
DBUG_ENTER("Event_scheduler::stop");
- DBUG_PRINT("enter", ("thd: 0x%lx", (long) thd));
+ DBUG_PRINT("enter", ("thd: %p", thd));
LOCK_DATA();
DBUG_PRINT("info", ("state before action %s", scheduler_states_names[state].str));
diff --git a/sql/events.cc b/sql/events.cc
index 86e85d7f757..6a38d4d3a1f 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -1121,7 +1121,7 @@ Events::load_events_from_db(THD *thd)
uint count= 0;
ulong saved_master_access;
DBUG_ENTER("Events::load_events_from_db");
- DBUG_PRINT("enter", ("thd: 0x%lx", (long) thd));
+ DBUG_PRINT("enter", ("thd: %p", thd));
/*
NOTE: even if we run in read-only mode, we should be able to lock the
diff --git a/sql/field.cc b/sql/field.cc
index acf0af095a1..c7aa0dce16e 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5434,7 +5434,7 @@ int Field_temporal_with_date::store(double nr)
ErrConvDouble str(nr);
longlong tmp= double_to_datetime(nr, &ltime,
- sql_mode_for_dates(thd), &error);
+ (uint) sql_mode_for_dates(thd), &error);
return store_TIME_with_warning(&ltime, &str, error, tmp != -1);
}
@@ -7813,7 +7813,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
DBUG_ASSERT(length <= max_data_length());
new_length= length;
- copy_length= table->in_use->variables.group_concat_max_len;
+ copy_length= (uint)MY_MIN(UINT_MAX,table->in_use->variables.group_concat_max_len);
if (new_length > copy_length)
{
new_length= Well_formed_prefix(cs,
@@ -8243,8 +8243,8 @@ const uchar *Field_blob::unpack(uchar *to, const uchar *from,
const uchar *from_end, uint param_data)
{
DBUG_ENTER("Field_blob::unpack");
- DBUG_PRINT("enter", ("to: 0x%lx; from: 0x%lx; param_data: %u",
- (ulong) to, (ulong) from, param_data));
+ DBUG_PRINT("enter", ("to: %p; from: %p; param_data: %u",
+ to, from, param_data));
uint const master_packlength=
param_data > 0 ? param_data & 0xFF : packlength;
if (from + master_packlength > from_end)
@@ -8378,7 +8378,7 @@ uint gis_field_options_read(const uchar *buf, uint buf_len,
}
end_of_record:
- return cbuf - buf;
+ return (uint)(cbuf - buf);
}
@@ -9109,8 +9109,8 @@ Field_bit::do_last_null_byte() const
bits. On systems with CHAR_BIT > 8 (not very common), the storage
will lose the extra bits.
*/
- DBUG_PRINT("test", ("bit_ofs: %d, bit_len: %d bit_ptr: 0x%lx",
- bit_ofs, bit_len, (long) bit_ptr));
+ DBUG_PRINT("test", ("bit_ofs: %d, bit_len: %d bit_ptr: %p",
+ bit_ofs, bit_len, bit_ptr));
uchar *result;
if (bit_len == 0)
result= null_ptr;
@@ -9794,7 +9794,7 @@ void Column_definition::create_length_to_internal_length_bit()
}
else
{
- pack_length= length / 8;
+ pack_length= (uint) length / 8;
/* We need one extra byte to store the bits we save among the null bits */
key_length= pack_length + MY_TEST(length & 7);
}
@@ -9804,7 +9804,7 @@ void Column_definition::create_length_to_internal_length_bit()
void Column_definition::create_length_to_internal_length_newdecimal()
{
key_length= pack_length=
- my_decimal_get_binary_size(my_decimal_length_to_precision(length,
+ my_decimal_get_binary_size(my_decimal_length_to_precision((uint) length,
decimals,
flags &
UNSIGNED_FLAG),
@@ -9911,9 +9911,9 @@ bool Column_definition::fix_attributes_decimal()
my_error(ER_M_BIGGER_THAN_D, MYF(0), field_name.str);
return true;
}
- length= my_decimal_precision_to_length(length, decimals,
+ length= my_decimal_precision_to_length((uint) length, decimals,
flags & UNSIGNED_FLAG);
- pack_length= my_decimal_get_binary_size(length, decimals);
+ pack_length= my_decimal_get_binary_size((uint) length, decimals);
return false;
}
@@ -9922,7 +9922,7 @@ bool Column_definition::fix_attributes_bit()
{
if (!length)
length= 1;
- pack_length= (length + 7) / 8;
+ pack_length= ((uint) length + 7) / 8;
return check_length(ER_TOO_BIG_DISPLAYWIDTH, MAX_BIT_FIELD_LENGTH);
}
@@ -10020,7 +10020,7 @@ bool Column_definition::check(THD *thd)
DBUG_RETURN(true);
/* Remember the value of length */
- char_length= length;
+ char_length= (uint)length;
/*
Set NO_DEFAULT_VALUE_FLAG if this field doesn't have a default value and
@@ -10410,7 +10410,7 @@ Column_definition::Column_definition(THD *thd, Field *old_field,
interval_list.empty(); // prepare_interval_field() needs this
- char_length= length;
+ char_length= (uint)length;
/*
Copy the default (constant/function) from the column object orig_field, if
@@ -10730,7 +10730,7 @@ bool Field::save_in_field_default_value(bool view_error_processing)
{
my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
ER_THD(thd, ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
- return -1;
+ return true;
}
if (view_error_processing)
@@ -10749,13 +10749,13 @@ bool Field::save_in_field_default_value(bool view_error_processing)
ER_THD(thd, ER_NO_DEFAULT_FOR_FIELD),
field_name.str);
}
- return 1;
+ return true;
}
set_default();
return
!is_null() &&
validate_value_in_record_with_warn(thd, table->record[0]) &&
- thd->is_error() ? -1 : 0;
+ thd->is_error();
}
diff --git a/sql/field.h b/sql/field.h
index 548445eb1fa..17b84e058a8 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -3929,13 +3929,14 @@ public:
}
void create_length_to_internal_length_simple()
{
- key_length= pack_length= type_handler()->calc_pack_length(length);
+ key_length= pack_length= type_handler()->calc_pack_length((uint32) length);
}
void create_length_to_internal_length_string()
{
length*= charset->mbmaxlen;
- key_length= length;
- pack_length= type_handler()->calc_pack_length(length);
+ DBUG_ASSERT(length <= UINT_MAX32);
+ key_length= (uint) length;
+ pack_length= type_handler()->calc_pack_length((uint32) length);
}
void create_length_to_internal_length_typelib()
{
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 31ff2e511a9..fc6453b904b 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -141,7 +141,8 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort,
table_map first_table_bit)
{
int error;
- size_t memory_available= thd->variables.sortbuff_size;
+ DBUG_ASSERT(thd->variables.sortbuff_size <= SIZE_T_MAX);
+ size_t memory_available= (size_t)thd->variables.sortbuff_size;
uint maxbuffer;
BUFFPEK *buffpek;
ha_rows num_rows= HA_POS_ERROR;
@@ -1806,7 +1807,7 @@ int merge_buffers(Sort_param *param, IO_CACHE *from_file,
if (flag == 0)
{
if (my_b_write(to_file, (uchar*) buffpek->key,
- (rec_length*buffpek->mem_count)))
+ (size_t)(rec_length*buffpek->mem_count)))
{
error= 1; goto err; /* purecov: inspected */
}
diff --git a/sql/gen_lex_token.cc b/sql/gen_lex_token.cc
index eefe9163819..bd2b9728177 100644
--- a/sql/gen_lex_token.cc
+++ b/sql/gen_lex_token.cc
@@ -79,7 +79,7 @@ void set_token(int tok, const char *str)
}
compiled_token_array[tok].m_token_string= str;
- compiled_token_array[tok].m_token_length= strlen(str);
+ compiled_token_array[tok].m_token_length= (int)strlen(str);
compiled_token_array[tok].m_append_space= true;
compiled_token_array[tok].m_start_expr= false;
}
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 12ca31ad50e..2076379cd61 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -2510,7 +2510,7 @@ register_query_cache_dependant_tables(THD *thd,
part= i * num_subparts + j;
/* we store the end \0 as part of the key */
end= strmov(engine_pos, sub_elem->partition_name);
- length= end - engine_key;
+ length= (uint)(end - engine_key);
/* Copy the suffix also to query cache key */
memcpy(query_cache_key_end, engine_key_end, (end - engine_key_end));
if (reg_query_cache_dependant_table(thd, engine_key, length,
@@ -2526,7 +2526,7 @@ register_query_cache_dependant_tables(THD *thd,
else
{
char *end= engine_pos+1; // copy end \0
- uint length= end - engine_key;
+ uint length= (uint)(end - engine_key);
/* Copy the suffix also to query cache key */
memcpy(query_cache_key_end, engine_key_end, (end - engine_key_end));
if (reg_query_cache_dependant_table(thd, engine_key, length,
@@ -4807,8 +4807,8 @@ int ha_partition::rnd_init(bool scan)
}
/* Now we see what the index of our first important partition is */
- DBUG_PRINT("info", ("m_part_info->read_partitions: 0x%lx",
- (long) m_part_info->read_partitions.bitmap));
+ DBUG_PRINT("info", ("m_part_info->read_partitions: %p",
+ m_part_info->read_partitions.bitmap));
part_id= bitmap_get_first_set(&(m_part_info->read_partitions));
DBUG_PRINT("info", ("m_part_spec.start_part %d", part_id));
@@ -6742,7 +6742,7 @@ int ha_partition::info(uint flag)
/* Get variables if not already done */
if (!(flag & HA_STATUS_VARIABLE) ||
!bitmap_is_set(&(m_part_info->read_partitions),
- (file_array - m_file)))
+ (uint)(file_array - m_file)))
file->info(HA_STATUS_VARIABLE | no_lock_flag | extra_var_flag);
if (file->stats.records > max_records)
{
@@ -7709,7 +7709,7 @@ ha_rows ha_partition::estimate_rows_upper_bound()
do
{
- if (bitmap_is_set(&(m_part_info->read_partitions), (file - m_file)))
+ if (bitmap_is_set(&(m_part_info->read_partitions), (uint)(file - m_file)))
{
rows= (*file)->estimate_rows_upper_bound();
if (rows == HA_POS_ERROR)
diff --git a/sql/handler.cc b/sql/handler.cc
index baec78b42a1..d072e750e09 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -259,7 +259,7 @@ handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc,
{
handler *file;
DBUG_ENTER("get_new_handler");
- DBUG_PRINT("enter", ("alloc: 0x%lx", (long) alloc));
+ DBUG_PRINT("enter", ("alloc: %p", alloc));
if (db_type && db_type->state == SHOW_OPTION_YES && db_type->create)
{
@@ -1376,7 +1376,7 @@ int ha_commit_trans(THD *thd, bool all)
uint rw_ha_count= ha_check_and_coalesce_trx_read_only(thd, ha_info, all);
/* rw_trans is TRUE when we in a transaction changing data */
bool rw_trans= is_real_trans &&
- (rw_ha_count > !thd->is_current_stmt_binlog_disabled());
+ (rw_ha_count > (thd->is_current_stmt_binlog_disabled()?0U:1U));
MDL_request mdl_request;
DBUG_PRINT("info", ("is_real_trans: %d rw_trans: %d rw_ha_count: %d",
is_real_trans, rw_trans, rw_ha_count));
@@ -3202,8 +3202,8 @@ void handler::column_bitmaps_signal()
{
DBUG_ENTER("column_bitmaps_signal");
if (table)
- DBUG_PRINT("info", ("read_set: 0x%lx write_set: 0x%lx",
- (long) table->read_set, (long) table->write_set));
+ DBUG_PRINT("info", ("read_set: %p write_set: %p",
+ table->read_set, table->write_set));
DBUG_VOID_RETURN;
}
@@ -5574,9 +5574,9 @@ TYPELIB *ha_known_exts(void)
}
-static bool stat_print(THD *thd, const char *type, uint type_len,
- const char *file, uint file_len,
- const char *status, uint status_len)
+static bool stat_print(THD *thd, const char *type, size_t type_len,
+ const char *file, size_t file_len,
+ const char *status, size_t status_len)
{
Protocol *protocol= thd->protocol;
protocol->prepare_for_resend();
@@ -5758,9 +5758,9 @@ bool handler::check_table_binlog_row_based_internal(bool binlog_row)
static int write_locked_table_maps(THD *thd)
{
DBUG_ENTER("write_locked_table_maps");
- DBUG_PRINT("enter", ("thd: 0x%lx thd->lock: 0x%lx "
- "thd->extra_lock: 0x%lx",
- (long) thd, (long) thd->lock, (long) thd->extra_lock));
+ DBUG_PRINT("enter", ("thd:%p thd->lock:%p "
+ "thd->extra_lock: %p",
+ thd, thd->lock, thd->extra_lock));
DBUG_PRINT("debug", ("get_binlog_table_maps(): %d", thd->get_binlog_table_maps()));
diff --git a/sql/handler.h b/sql/handler.h
index 950c3be2fca..9ada2ccbe7c 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -790,9 +790,9 @@ struct TABLE_SHARE;
struct HA_CREATE_INFO;
struct st_foreign_key_info;
typedef struct st_foreign_key_info FOREIGN_KEY_INFO;
-typedef bool (stat_print_fn)(THD *thd, const char *type, uint type_len,
- const char *file, uint file_len,
- const char *status, uint status_len);
+typedef bool (stat_print_fn)(THD *thd, const char *type, size_t type_len,
+ const char *file, size_t file_len,
+ const char *status, size_t status_len);
enum ha_stat_type { HA_ENGINE_STATUS, HA_ENGINE_LOGS, HA_ENGINE_MUTEX };
extern st_plugin_int *hton2plugin[MAX_HA];
diff --git a/sql/item.cc b/sql/item.cc
index 9f8e3df05f5..f609bfdf082 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1164,7 +1164,7 @@ void Item::set_name(THD *thd, const char *str, uint length, CHARSET_INFO *cs)
if (!cs->ctype || cs->mbminlen > 1)
{
str+= cs->cset->scan(cs, str, str + length, MY_SEQ_SPACES);
- length-= str - str_start;
+ length-= (uint)(str - str_start);
}
else
{
@@ -6454,8 +6454,8 @@ void Item_field::save_org_in_field(Field *to,
fast_field_copier fast_field_copier_func)
{
DBUG_ENTER("Item_field::save_org_in_field");
- DBUG_PRINT("enter", ("setup: 0x%lx data: 0x%lx",
- (ulong) to, (ulong) fast_field_copier_func));
+ DBUG_PRINT("enter", ("setup: %p data: %p",
+ to, fast_field_copier_func));
if (fast_field_copier_func)
{
if (field->is_null())
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 47c9fd57ee9..23b90235cdf 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -3601,7 +3601,7 @@ uchar *in_row::get_value(Item *item)
void in_row::set(uint pos, Item *item)
{
DBUG_ENTER("in_row::set");
- DBUG_PRINT("enter", ("pos: %u item: 0x%lx", pos, (ulong) item));
+ DBUG_PRINT("enter", ("pos: %u item: %p", pos,item));
((cmp_item_row*) base)[pos].store_value_by_template(current_thd, &tmp, item);
DBUG_VOID_RETURN;
}
@@ -3842,7 +3842,7 @@ cmp_item* cmp_item_row::make_same()
cmp_item_row::~cmp_item_row()
{
DBUG_ENTER("~cmp_item_row");
- DBUG_PRINT("enter",("this: 0x%lx", (long) this));
+ DBUG_PRINT("enter",("this: %p", this));
if (comparators)
{
for (uint i= 0; i < n; i++)
@@ -5374,7 +5374,7 @@ void Regexp_processor_pcre::set_recursion_limit(THD *thd)
DBUG_ASSERT(thd == current_thd);
stack_used= available_stack_size(thd->thread_stack, &stack_used);
m_pcre_extra.match_limit_recursion=
- (my_thread_stack_size - STACK_MIN_SIZE - stack_used)/my_pcre_frame_size;
+ (ulong)((my_thread_stack_size - STACK_MIN_SIZE - stack_used)/my_pcre_frame_size);
}
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 5f1485a1336..fdfa95912ac 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -3302,7 +3302,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, name->length);
+ udf_func *udf= find_udf(name->str, (uint) name->length);
DBUG_ASSERT(udf);
return create(thd, udf, item_list);
}
diff --git a/sql/item_func.h b/sql/item_func.h
index 605b17b540e..1d96c0d024e 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -2385,12 +2385,6 @@ public:
bool update();
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
- table_map used_tables() const
- {
- return used_tables_cache | RAND_TABLE_BIT;
- }
- bool const_item() const { return 0; }
- bool is_expensive() { return 1; }
void print(String *str, enum_query_type query_type);
enum precedence precedence() const { return ASSIGN_PRECEDENCE; }
void print_as_stmt(String *str, enum_query_type query_type);
diff --git a/sql/item_inetfunc.cc b/sql/item_inetfunc.cc
index 6a09747fa1a..9aaa64823f7 100644
--- a/sql/item_inetfunc.cc
+++ b/sql/item_inetfunc.cc
@@ -211,13 +211,13 @@ String *Item_func_inet_str_base::val_str_ascii(String *buffer)
IPv4-part differently on different platforms.
*/
-static bool str_to_ipv4(const char *str, int str_length, in_addr *ipv4_address)
+static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_address)
{
if (str_length < 7)
{
DBUG_PRINT("error", ("str_to_ipv4(%.*s): "
"invalid IPv4 address: too short.",
- str_length, str));
+ (int) str_length, str));
return false;
}
@@ -225,7 +225,7 @@ static bool str_to_ipv4(const char *str, int str_length, in_addr *ipv4_address)
{
DBUG_PRINT("error", ("str_to_ipv4(%.*s): "
"invalid IPv4 address: too long.",
- str_length, str));
+ (int) str_length, str));
return false;
}
@@ -236,7 +236,7 @@ static bool str_to_ipv4(const char *str, int str_length, in_addr *ipv4_address)
int dot_count= 0;
char c= 0;
- while (((p - str) < str_length) && *p)
+ while (((p - str) < (int)str_length) && *p)
{
c= *p++;
@@ -248,7 +248,7 @@ static bool str_to_ipv4(const char *str, int str_length, in_addr *ipv4_address)
{
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"too many characters in a group.",
- str_length, str));
+ (int) str_length, str));
return false;
}
@@ -258,7 +258,7 @@ static bool str_to_ipv4(const char *str, int str_length, in_addr *ipv4_address)
{
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"invalid byte value.",
- str_length, str));
+ (int) str_length, str));
return false;
}
}
@@ -268,7 +268,7 @@ static bool str_to_ipv4(const char *str, int str_length, in_addr *ipv4_address)
{
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"too few characters in a group.",
- str_length, str));
+ (int) str_length, str));
return false;
}
@@ -281,7 +281,7 @@ static bool str_to_ipv4(const char *str, int str_length, in_addr *ipv4_address)
if (dot_count > 3)
{
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
- "too many dots.", str_length, str));
+ "too many dots.", (int) str_length, str));
return false;
}
}
@@ -289,7 +289,7 @@ static bool str_to_ipv4(const char *str, int str_length, in_addr *ipv4_address)
{
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"invalid character at pos %d.",
- str_length, str, (int) (p - str)));
+ (int) str_length, str, (int) (p - str)));
return false;
}
}
@@ -297,7 +297,7 @@ static bool str_to_ipv4(const char *str, int str_length, in_addr *ipv4_address)
if (c == '.')
{
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
- "ending at '.'.", str_length, str));
+ "ending at '.'.", (int) str_length, str));
return false;
}
@@ -305,14 +305,14 @@ static bool str_to_ipv4(const char *str, int str_length, in_addr *ipv4_address)
{
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"too few groups.",
- str_length, str));
+ (int) str_length, str));
return false;
}
ipv4_bytes[3]= (unsigned char) byte_value;
DBUG_PRINT("info", ("str_to_ipv4(%.*s): valid IPv4 address: %d.%d.%d.%d",
- str_length, str,
+ (int) str_length, str,
ipv4_bytes[0], ipv4_bytes[1],
ipv4_bytes[2], ipv4_bytes[3]));
return true;
@@ -493,7 +493,7 @@ static bool str_to_ipv6(const char *str, int str_length, in6_addr *ipv6_address)
return false;
}
- int bytes_to_move= dst - gap_ptr;
+ int bytes_to_move= (int)(dst - gap_ptr);
for (int i= 1; i <= bytes_to_move; ++i)
{
diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc
index 27d5cea3652..2f4c1ef8e46 100644
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@ -48,7 +48,7 @@ static bool eq_ascii_string(const CHARSET_INFO *cs,
}
-static bool append_simple(String *s, const char *a, uint a_len)
+static bool append_simple(String *s, const char *a, size_t a_len)
{
if (!s->realloc_with_extra_if_needed(s->length() + a_len))
{
@@ -60,7 +60,7 @@ static bool append_simple(String *s, const char *a, uint a_len)
}
-static inline bool append_simple(String *s, const uchar *a, uint a_len)
+static inline bool append_simple(String *s, const uchar *a, size_t a_len)
{
return append_simple(s, (const char *) a, a_len);
}
@@ -255,7 +255,7 @@ void report_json_error_ex(String *js, json_engine_t *je,
Sql_condition::enum_warning_level lv)
{
THD *thd= current_thd;
- int position= (const char *) je->s.c_str - js->ptr();
+ int position= (int)((const char *) je->s.c_str - js->ptr());
uint code;
n_param++;
@@ -312,7 +312,7 @@ static void report_path_error_ex(String *ps, json_path_t *p,
Sql_condition::enum_warning_level lv)
{
THD *thd= current_thd;
- int position= (const char *) p->s.c_str - ps->ptr() + 1;
+ int position= (int)((const char *) p->s.c_str - ps->ptr() + 1);
uint code;
n_param++;
@@ -539,7 +539,7 @@ bool Item_func_json_query::check_and_get_value(json_engine_t *je, String *res,
return true;
}
- res->set((const char *) je->value, je->s.c_str - value, je->s.cs);
+ res->set((const char *) je->value, (uint32)(je->s.c_str - value), je->s.cs);
return false;
}
@@ -742,7 +742,8 @@ String *Item_func_json_extract::read_json(String *str,
json_path_t p;
const uchar *value;
int not_first_value= 0;
- uint n_arg, v_len;
+ uint n_arg;
+ size_t v_len;
int possible_multiple_values;
if ((null_value= args[0]->null_value))
@@ -1530,7 +1531,8 @@ String *Item_func_json_array_append::val_str(String *str)
{
json_engine_t je;
String *js= args[0]->val_json(&tmp_js);
- uint n_arg, n_path, str_rest_len;
+ uint n_arg, n_path;
+ size_t str_rest_len;
const uchar *ar_end;
DBUG_ASSERT(fixed == 1);
@@ -2863,7 +2865,7 @@ skip_search:
} while (json_read_keyname_chr(&je) == 0);
if (je.s.error)
goto err_return;
- key_len= key_end - key_start;
+ key_len= (int)(key_end - key_start);
if (!check_key_in_list(str, key_start, key_len))
{
@@ -3137,7 +3139,7 @@ String *Item_func_json_format::val_str(String *str)
{
if (arg_count > 1)
{
- tab_size= args[1]->val_int();
+ tab_size= (int)args[1]->val_int();
if (args[1]->null_value)
{
null_value= 1;
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index d29e579bcd9..69f8ff185b5 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -257,7 +257,7 @@ String *Item_func_sha2::val_str_ascii(String *str)
str->realloc((uint) digest_length*2 + 1); /* Each byte as two nybbles */
/* Convert the large number to a string-hex representation. */
- array_to_hex((char *) str->ptr(), digest_buf, digest_length);
+ array_to_hex((char *) str->ptr(), digest_buf, (uint)digest_length);
/* We poked raw bytes in. We must inform the the String of its length. */
str->length((uint) digest_length*2); /* Each byte as two nybbles */
@@ -272,7 +272,7 @@ void Item_func_sha2::fix_length_and_dec()
maybe_null= 1;
max_length = 0;
- int sha_variant= args[1]->const_item() ? args[1]->val_int() : 512;
+ int sha_variant= (int)(args[1]->const_item() ? args[1]->val_int() : 512);
switch (sha_variant) {
case 0: // SHA-256 is the default
@@ -3796,12 +3796,12 @@ String *Item_func_like_range::val_str(String *str)
if (!res || args[0]->null_value || args[1]->null_value ||
nbytes < 0 || nbytes > MAX_BLOB_WIDTH ||
- min_str.alloc(nbytes) || max_str.alloc(nbytes))
+ min_str.alloc((size_t)nbytes) || max_str.alloc((size_t)nbytes))
goto err;
null_value=0;
if (cs->coll->like_range(cs, res->ptr(), res->length(),
- '\\', '_', '%', nbytes,
+ '\\', '_', '%', (size_t)nbytes,
(char*) min_str.ptr(), (char*) max_str.ptr(),
&min_len, &max_len))
goto err;
@@ -3878,7 +3878,7 @@ String *Item_load_file::val_str(String *str)
if ((file= mysql_file_open(key_file_loadfile,
file_name->ptr(), O_RDONLY, MYF(0))) < 0)
goto err;
- if (mysql_file_read(file, (uchar*) tmp_value.ptr(), stat_info.st_size,
+ if (mysql_file_read(file, (uchar*) tmp_value.ptr(), (size_t)stat_info.st_size,
MYF(MY_NABP)))
{
mysql_file_close(file, MYF(0));
@@ -4104,7 +4104,7 @@ String *Item_func_quote::val_str(String *str)
if ((mblen= cs->cset->wc_mb(cs, '\'', (uchar *) to, to_end)) <= 0)
goto toolong;
to+= mblen;
- new_length= to - str->ptr();
+ new_length= (uint)(to - str->ptr());
goto ret;
}
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index d596d87b703..71594c0478b 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -58,7 +58,7 @@ Item_subselect::Item_subselect(THD *thd_arg):
changed(0), is_correlated(FALSE), with_recursive_reference(0)
{
DBUG_ENTER("Item_subselect::Item_subselect");
- DBUG_PRINT("enter", ("this: 0x%lx", (ulong) this));
+ DBUG_PRINT("enter", ("this: %p", this));
sortbuffer.str= 0;
#ifndef DBUG_OFF
@@ -84,8 +84,8 @@ void Item_subselect::init(st_select_lex *select_lex,
*/
DBUG_ENTER("Item_subselect::init");
- DBUG_PRINT("enter", ("select_lex: 0x%lx this: 0x%lx",
- (ulong) select_lex, (ulong) this));
+ DBUG_PRINT("enter", ("select_lex: %p this: %p",
+ select_lex, this));
unit= select_lex->master_unit();
if (unit->item)
@@ -130,7 +130,7 @@ void Item_subselect::init(st_select_lex *select_lex,
/* The subquery is an expression cache candidate */
upper->expr_cache_may_be_used[upper->parsing_place]= TRUE;
}
- DBUG_PRINT("info", ("engine: 0x%lx", (ulong)engine));
+ DBUG_PRINT("info", ("engine: %p", engine));
DBUG_VOID_RETURN;
}
@@ -215,7 +215,7 @@ void Item_allany_subselect::cleanup()
Item_subselect::~Item_subselect()
{
DBUG_ENTER("Item_subselect::~Item_subselect");
- DBUG_PRINT("enter", ("this: 0x%lx", (ulong) this));
+ DBUG_PRINT("enter", ("this: %p", this));
if (own_engine)
delete engine;
else
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 65eeb7bafbf..0c0b5a64953 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -36,9 +36,9 @@
used in Item_sum_*
*/
-ulonglong Item_sum::ram_limitation(THD *thd)
+size_t Item_sum::ram_limitation(THD *thd)
{
- return MY_MIN(thd->variables.tmp_memory_table_size,
+ return (size_t)MY_MIN(thd->variables.tmp_memory_table_size,
thd->variables.max_heap_table_size);
}
diff --git a/sql/item_sum.h b/sql/item_sum.h
index a160d0ee522..7845ed3318f 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -382,7 +382,7 @@ protected:
*/
Item **orig_args, *tmp_orig_args[2];
- static ulonglong ram_limitation(THD *thd);
+ static size_t ram_limitation(THD *thd);
public:
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 189addc767b..885db3a64f1 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -715,7 +715,7 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
{
const char *end=str+length;
uint i;
- long msec_length= 0;
+ int msec_length= 0;
while (str != end && !my_isdigit(cs,*str))
str++;
@@ -726,7 +726,7 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
const char *start= str;
for (value= 0; str != end && my_isdigit(cs, *str); str++)
value= value*10 + *str - '0';
- msec_length= 6 - (str - start);
+ msec_length= 6 - (int)(str - start);
values[i]= value;
while (str != end && !my_isdigit(cs,*str))
str++;
@@ -1062,7 +1062,7 @@ longlong Item_func_week::val_int()
if (get_arg0_date(&ltime, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE))
return 0;
if (arg_count > 1)
- week_format= args[1]->val_int();
+ week_format= (uint)args[1]->val_int();
else
week_format= current_thd->variables.default_week_format;
return (longlong) calc_week(&ltime, week_mode(week_format), &year);
@@ -2457,7 +2457,7 @@ String *Item_char_typecast::copy(String *str, CHARSET_INFO *strcs)
null_value= 1; // EOM
return 0;
}
- check_truncation_with_warn(str, copier.source_end_pos() - str->ptr());
+ check_truncation_with_warn(str, (uint)(copier.source_end_pos() - str->ptr()));
return &tmp_value;
}
diff --git a/sql/key.cc b/sql/key.cc
index c2d22005736..db44e4780c4 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -374,7 +374,7 @@ void field_unpack(String *to, Field *field, const uchar *rec, uint max_length,
{
const char *tmp_end= tmp.ptr() + tmp.length();
while (tmp_end > tmp.ptr() && !*--tmp_end) ;
- tmp.length(tmp_end - tmp.ptr() + 1);
+ tmp.length((uint32)(tmp_end - tmp.ptr() + 1));
}
if (cs->mbmaxlen > 1 && prefix_key)
{
diff --git a/sql/log.cc b/sql/log.cc
index cb789e7f9f3..d7a3f19c2f0 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -5292,7 +5292,7 @@ bool MYSQL_BIN_LOG::write_event_buffer(uchar* buf, uint len)
if (!ebuf)
goto err;
- crypto.set_iv(iv, my_b_append_tell(&log_file));
+ crypto.set_iv(iv, (uint32)my_b_append_tell(&log_file));
/*
we want to encrypt everything, excluding the event length:
@@ -5518,9 +5518,9 @@ binlog_cache_mngr *THD::binlog_setup_trx_data()
cache_mngr= (binlog_cache_mngr*) my_malloc(sizeof(binlog_cache_mngr), MYF(MY_ZEROFILL));
if (!cache_mngr ||
open_cached_file(&cache_mngr->stmt_cache.cache_log, mysql_tmpdir,
- LOG_PREFIX, binlog_stmt_cache_size, MYF(MY_WME)) ||
+ LOG_PREFIX, (size_t)binlog_stmt_cache_size, MYF(MY_WME)) ||
open_cached_file(&cache_mngr->trx_cache.cache_log, mysql_tmpdir,
- LOG_PREFIX, binlog_cache_size, MYF(MY_WME)))
+ LOG_PREFIX, (size_t)binlog_cache_size, MYF(MY_WME)))
{
my_free(cache_mngr);
DBUG_RETURN(0); // Didn't manage to set it up
@@ -5649,8 +5649,8 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional,
{
int error;
DBUG_ENTER("THD::binlog_write_table_map");
- DBUG_PRINT("enter", ("table: 0x%lx (%s: #%lu)",
- (long) table, table->s->table_name.str,
+ DBUG_PRINT("enter", ("table: %p (%s: #%lu)",
+ table, table->s->table_name.str,
table->s->table_map_id));
/* Ensure that all events in a GTID group are in the same cache */
@@ -5799,7 +5799,7 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
{
DBUG_ENTER("MYSQL_BIN_LOG::flush_and_set_pending_rows_event(event)");
DBUG_ASSERT(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open());
- DBUG_PRINT("enter", ("event: 0x%lx", (long) event));
+ DBUG_PRINT("enter", ("event: %p", event));
int error= 0;
binlog_cache_mngr *const cache_mngr=
@@ -5810,7 +5810,7 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
binlog_cache_data *cache_data=
cache_mngr->get_binlog_cache_data(use_trans_cache(thd, is_transactional));
- DBUG_PRINT("info", ("cache_mngr->pending(): 0x%lx", (long) cache_data->pending()));
+ DBUG_PRINT("info", ("cache_mngr->pending(): %p", cache_data->pending()));
if (Rows_log_event* pending= cache_data->pending())
{
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 7edcaf1c015..177e6c2c775 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -838,19 +838,19 @@ query_event_uncompress(const Format_description_log_event *description_event,
if (end <= tmp)
return 1;
- int32 comp_len = len - (tmp - src) -
- (contain_checksum ? BINLOG_CHECKSUM_LEN : 0);
+ int32 comp_len = (int32)(len - (tmp - src) -
+ (contain_checksum ? BINLOG_CHECKSUM_LEN : 0));
uint32 un_len = binlog_get_uncompress_len(tmp);
// bad event
if (comp_len < 0 || un_len == 0)
return 1;
- *newlen = (tmp - src) + un_len;
+ *newlen = (ulong)(tmp - src) + un_len;
if(contain_checksum)
*newlen += BINLOG_CHECKSUM_LEN;
- uint32 alloc_size = ALIGN_SIZE(*newlen);
+ uint32 alloc_size = (uint32)ALIGN_SIZE(*newlen);
char *new_dst = NULL;
@@ -963,17 +963,17 @@ row_log_event_uncompress(const Format_description_log_event *description_event,
if (un_len == 0)
return 1;
- long comp_len = len - (tmp - src) -
- (contain_checksum ? BINLOG_CHECKSUM_LEN : 0);
+ int32 comp_len = (int32)(len - (tmp - src) -
+ (contain_checksum ? BINLOG_CHECKSUM_LEN : 0));
//bad event
if (comp_len <=0)
return 1;
- *newlen = (tmp - src) + un_len;
+ *newlen = ulong(tmp - src) + un_len;
if(contain_checksum)
*newlen += BINLOG_CHECKSUM_LEN;
- uint32 alloc_size = ALIGN_SIZE(*newlen);
+ size_t alloc_size = ALIGN_SIZE(*newlen);
*is_malloc = false;
if (alloc_size <= buf_size)
@@ -1626,7 +1626,7 @@ int Log_event_writer::write_header(uchar *pos, size_t len)
if (ctx)
{
uchar iv[BINLOG_IV_LENGTH];
- crypto->set_iv(iv, my_b_safe_tell(file));
+ crypto->set_iv(iv, (uint32)my_b_safe_tell(file));
if (encryption_ctx_init(ctx, crypto->key, crypto->key_length,
iv, sizeof(iv), ENCRYPTION_FLAG_ENCRYPT | ENCRYPTION_FLAG_NOPAD,
ENCRYPTION_KEY_SYSTEM_DATA, crypto->key_version))
@@ -2427,9 +2427,9 @@ void Log_event::print_header(IO_CACHE* file,
if (checksum_alg != BINLOG_CHECKSUM_ALG_OFF &&
checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF)
{
- char checksum_buf[BINLOG_CHECKSUM_LEN * 2 + 4]; // to fit to "0x%lx "
+ char checksum_buf[BINLOG_CHECKSUM_LEN * 2 + 4]; // to fit to "%p "
size_t const bytes_written=
- my_snprintf(checksum_buf, sizeof(checksum_buf), "0x%08lx ", (ulong) crc);
+ my_snprintf(checksum_buf, sizeof(checksum_buf), "0x%08x ", crc);
my_b_printf(file, "%s ", get_type(&binlog_checksum_typelib, checksum_alg));
my_b_printf(file, checksum_buf, bytes_written);
}
@@ -3968,7 +3968,7 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
db(thd_arg->db), q_len((uint32) query_length),
thread_id(thd_arg->thread_id),
/* save the original thread id; we already know the server id */
- slave_proxy_id(thd_arg->variables.pseudo_thread_id),
+ slave_proxy_id((ulong)thd_arg->variables.pseudo_thread_id),
flags2_inited(1), sql_mode_inited(1), charset_inited(1),
sql_mode(thd_arg->variables.sql_mode),
auto_increment_increment(thd_arg->variables.auto_increment_increment),
@@ -4172,7 +4172,7 @@ get_str_len_and_pointer(const Log_event::Byte **src,
if (length > 0)
{
if (*src + length >= end)
- return *src + length - end + 1; // Number of bytes missing
+ return (int)(*src + length - end + 1); // Number of bytes missing
*dst= (char *)*src + 1; // Will be copied later
}
*len= length;
@@ -4273,7 +4273,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
data_len = event_len - (common_header_len + post_header_len);
buf+= common_header_len;
- slave_proxy_id= thread_id = uint4korr(buf + Q_THREAD_ID_OFFSET);
+ thread_id = slave_proxy_id = uint4korr(buf + Q_THREAD_ID_OFFSET);
exec_time = uint4korr(buf + Q_EXEC_TIME_OFFSET);
db_len = (uchar)buf[Q_DB_LEN_OFFSET]; // TODO: add a check of all *_len vars
error_code = uint2korr(buf + Q_ERR_CODE_OFFSET);
@@ -4347,8 +4347,8 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
break;
}
case Q_CATALOG_NZ_CODE:
- DBUG_PRINT("info", ("case Q_CATALOG_NZ_CODE; pos: 0x%lx; end: 0x%lx",
- (ulong) pos, (ulong) end));
+ DBUG_PRINT("info", ("case Q_CATALOG_NZ_CODE; pos:%p; end:%p",
+ pos, end));
if (get_str_len_and_pointer(&pos, &catalog, &catalog_len, end))
{
DBUG_PRINT("info", ("query= 0"));
@@ -6488,7 +6488,7 @@ Load_log_event::Load_log_event(THD *thd_arg, sql_exchange *ex,
thd_arg->thread_specific_used ? LOG_EVENT_THREAD_SPECIFIC_F : 0,
using_trans),
thread_id(thd_arg->thread_id),
- slave_proxy_id(thd_arg->variables.pseudo_thread_id),
+ slave_proxy_id((ulong)thd_arg->variables.pseudo_thread_id),
num_fields(0),fields(0),
field_lens(0),field_block_len(0),
table_name(table_name_arg ? table_name_arg : ""),
@@ -6612,7 +6612,7 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len,
char* buf_end = (char*)buf + event_len;
/* this is the beginning of the post-header */
const char* data_head = buf + description_event->common_header_len;
- slave_proxy_id= thread_id= uint4korr(data_head + L_THREAD_ID_OFFSET);
+ thread_id= slave_proxy_id= uint4korr(data_head + L_THREAD_ID_OFFSET);
exec_time = uint4korr(data_head + L_EXEC_TIME_OFFSET);
skip_lines = uint4korr(data_head + L_SKIP_LINES_OFFSET);
table_name_len = (uint)data_head[L_TBL_LEN_OFFSET];
@@ -8675,7 +8675,7 @@ User_var_log_event(const char* buf, uint event_len,
Old events will not have this extra byte, thence,
we keep the flags set to UNDEF_F.
*/
- uint bytes_read= ((val + val_len) - buf_start);
+ size_t bytes_read= ((val + val_len) - buf_start);
#ifndef DBUG_OFF
bool old_pre_checksum_fd= description_event->is_version_before_checksum(
&description_event->server_version_split);
@@ -10384,7 +10384,7 @@ void Rows_log_event::uncompress_buf()
if (new_buf)
{
if(!binlog_buf_uncompress((char *)m_rows_buf, (char *)new_buf,
- m_rows_cur - m_rows_buf, &un_len))
+ (uint32)(m_rows_cur - m_rows_buf), &un_len))
{
my_free(m_rows_buf);
m_rows_buf = new_buf;
@@ -10420,9 +10420,9 @@ int Rows_log_event::get_data_size()
uchar *end= net_store_length(buf, m_width);
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
- return 6 + no_bytes_in_map(&m_cols) + (end - buf) +
+ return (int)(6 + no_bytes_in_map(&m_cols) + (end - buf) +
(general_type_code == UPDATE_ROWS_EVENT ? no_bytes_in_map(&m_cols_ai) : 0) +
- (m_rows_cur - m_rows_buf););
+ m_rows_cur - m_rows_buf););
int data_size= 0;
Log_event_type type = get_type_code();
@@ -10458,7 +10458,7 @@ int Rows_log_event::do_add_row_data(uchar *row_data, size_t length)
would save binlog space. TODO
*/
DBUG_ENTER("Rows_log_event::do_add_row_data");
- DBUG_PRINT("enter", ("row_data: 0x%lx length: %lu", (ulong) row_data,
+ DBUG_PRINT("enter", ("row_data:%p length: %lu", row_data,
(ulong) length));
/*
@@ -10838,8 +10838,8 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
table= m_table= rgi->m_table_map.get_table(m_table_id);
- DBUG_PRINT("debug", ("m_table: 0x%lx, m_table_id: %lu%s",
- (ulong) m_table, m_table_id,
+ DBUG_PRINT("debug", ("m_table:%p, m_table_id: %lu%s",
+ m_table, m_table_id,
table && master_had_triggers ?
" (master had triggers)" : ""));
if (table)
@@ -10959,8 +10959,8 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
m_curr_row_end.
*/
- DBUG_PRINT("info", ("curr_row: 0x%lu; curr_row_end: 0x%lu; rows_end: 0x%lu",
- (ulong) m_curr_row, (ulong) m_curr_row_end, (ulong) m_rows_end));
+ DBUG_PRINT("info", ("curr_row: %p; curr_row_end: %p; rows_end:%p",
+ m_curr_row, m_curr_row_end, m_rows_end));
if (!m_curr_row_end && !error)
error= unpack_current_row(rgi);
diff --git a/sql/log_event.h b/sql/log_event.h
index 6f71784cfea..428616fcb0d 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -5127,7 +5127,7 @@ static inline bool copy_event_cache_to_string_and_reinit(IO_CACHE *cache, LEX_ST
String tmp;
reinit_io_cache(cache, READ_CACHE, 0L, FALSE, FALSE);
- if (tmp.append(cache, cache->end_of_file))
+ if (tmp.append(cache, (uint32)cache->end_of_file))
goto err;
reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 8f1cfe17656..68ffa32fafe 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -364,10 +364,10 @@ copy_extra_record_fields(TABLE *table,
my_ptrdiff_t master_fields)
{
DBUG_ENTER("copy_extra_record_fields(table, master_reclen, master_fields)");
- DBUG_PRINT("info", ("Copying to 0x%lx "
+ DBUG_PRINT("info", ("Copying to %p "
"from field %lu at offset %lu "
"to field %d at offset %lu",
- (long) table->record[0],
+ table->record[0],
(ulong) master_fields, (ulong) master_reclength,
table->s->fields, table->s->reclength));
/*
@@ -625,8 +625,8 @@ replace_record(THD *thd, TABLE *table,
static int find_and_fetch_row(TABLE *table, uchar *key)
{
DBUG_ENTER("find_and_fetch_row(TABLE *table, uchar *key, uchar *record)");
- DBUG_PRINT("enter", ("table: 0x%lx, key: 0x%lx record: 0x%lx",
- (long) table, (long) key, (long) table->record[1]));
+ DBUG_PRINT("enter", ("table: %p, key: %p record: %p",
+ table, key, table->record[1]));
DBUG_ASSERT(table->in_use != NULL);
@@ -1254,8 +1254,8 @@ Old_rows_log_event::Old_rows_log_event(const char *buf, uint event_len,
const uchar* const ptr_rows_data= (const uchar*) ptr_after_width;
size_t const data_size= event_len - (ptr_rows_data - (const uchar *) buf);
- DBUG_PRINT("info",("m_table_id: %lu m_flags: %d m_width: %lu data_size: %lu",
- m_table_id, m_flags, m_width, (ulong) data_size));
+ DBUG_PRINT("info",("m_table_id: %lu m_flags: %d m_width: %lu data_size: %zu",
+ m_table_id, m_flags, m_width, data_size));
DBUG_DUMP("rows_data", (uchar*) ptr_rows_data, data_size);
m_rows_buf= (uchar*) my_malloc(data_size, MYF(MY_WME));
@@ -1290,8 +1290,8 @@ int Old_rows_log_event::get_data_size()
uchar *end= net_store_length(buf, (m_width + 7) / 8);
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
- return 6 + no_bytes_in_map(&m_cols) + (end - buf) +
- (m_rows_cur - m_rows_buf););
+ return (int)(6 + no_bytes_in_map(&m_cols) + (end - buf) +
+ m_rows_cur - m_rows_buf););
int data_size= ROWS_HEADER_LEN;
data_size+= no_bytes_in_map(&m_cols);
data_size+= (uint) (end - buf);
@@ -1310,8 +1310,8 @@ int Old_rows_log_event::do_add_row_data(uchar *row_data, size_t length)
would save binlog space. TODO
*/
DBUG_ENTER("Old_rows_log_event::do_add_row_data");
- DBUG_PRINT("enter", ("row_data: 0x%lx length: %lu", (ulong) row_data,
- (ulong) length));
+ DBUG_PRINT("enter", ("row_data: %p length: %zu",row_data,
+ length));
/*
Don't print debug messages when running valgrind since they can
trigger false warnings.
@@ -1599,8 +1599,8 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi)
*/
DBUG_PRINT("info", ("error: %d", error));
- DBUG_PRINT("info", ("curr_row: 0x%lu; curr_row_end: 0x%lu; rows_end: 0x%lu",
- (ulong) m_curr_row, (ulong) m_curr_row_end, (ulong) m_rows_end));
+ DBUG_PRINT("info", ("curr_row: %p; curr_row_end:%p; rows_end: %p",
+ m_curr_row, m_curr_row_end, m_rows_end));
if (!m_curr_row_end && !error)
unpack_current_row(rgi);
diff --git a/sql/mf_iocache_encr.cc b/sql/mf_iocache_encr.cc
index ae314d826a0..434fcd1f435 100644
--- a/sql/mf_iocache_encr.cc
+++ b/sql/mf_iocache_encr.cc
@@ -57,7 +57,7 @@ static int my_b_encr_read(IO_CACHE *info, uchar *Buffer, size_t Count)
if (info->seek_not_done)
{
- size_t wpos;
+ my_off_t wpos;
pos_offset= pos_in_file % info->buffer_length;
pos_in_file-= pos_offset;
@@ -106,7 +106,7 @@ static int my_b_encr_read(IO_CACHE *info, uchar *Buffer, size_t Count)
DBUG_ASSERT(length <= info->buffer_length);
- copied= MY_MIN(Count, length - pos_offset);
+ copied= MY_MIN(Count, (size_t)(length - pos_offset));
memcpy(Buffer, info->buffer + pos_offset, copied);
Count-= copied;
@@ -120,7 +120,7 @@ static int my_b_encr_read(IO_CACHE *info, uchar *Buffer, size_t Count)
if (wlength < crypt_data->block_length && pos_in_file < info->end_of_file)
{
- info->error= pos_in_file - old_pos_in_file;
+ info->error= (int)(pos_in_file - old_pos_in_file);
DBUG_RETURN(1);
}
} while (Count);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 5fbc85b158d..d0993151f76 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1590,8 +1590,8 @@ static void close_connections(void)
/* kill connection thread */
#if !defined(__WIN__)
- DBUG_PRINT("quit", ("waiting for select thread: 0x%lx",
- (ulong) select_thread));
+ DBUG_PRINT("quit", ("waiting for select thread: %lu",
+ (ulong)select_thread));
mysql_mutex_lock(&LOCK_start_thread);
while (select_thread_in_use)
@@ -2890,7 +2890,7 @@ void signal_thd_deleted()
void unlink_thd(THD *thd)
{
DBUG_ENTER("unlink_thd");
- DBUG_PRINT("enter", ("thd: 0x%lx", (long) thd));
+ DBUG_PRINT("enter", ("thd: %p", thd));
/*
Do not decrement when its wsrep system thread. wsrep_applier is set for
@@ -4855,7 +4855,7 @@ static void init_ssl()
opt_ssl_ca, opt_ssl_capath,
opt_ssl_cipher, &error,
opt_ssl_crl, opt_ssl_crlpath);
- DBUG_PRINT("info",("ssl_acceptor_fd: 0x%lx", (long) ssl_acceptor_fd));
+ DBUG_PRINT("info",("ssl_acceptor_fd: %p", ssl_acceptor_fd));
if (!ssl_acceptor_fd)
{
sql_print_warning("Failed to setup SSL");
@@ -4978,7 +4978,8 @@ static int init_server_components()
global_system_variables.query_cache_type= 1;
}
query_cache_init();
- query_cache_resize(query_cache_size);
+ DBUG_ASSERT(query_cache_size < ULONG_MAX);
+ query_cache_resize((ulong)query_cache_size);
my_rnd_init(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
setup_fpu();
init_thr_lock();
@@ -5822,7 +5823,7 @@ int mysqld_main(int argc, char **argv)
ulonglong new_thread_stack_size;
new_thread_stack_size= my_setstacksize(&connection_attrib,
- my_thread_stack_size);
+ (size_t)my_thread_stack_size);
if (new_thread_stack_size != my_thread_stack_size)
SYSVAR_AUTOSIZE(my_thread_stack_size, new_thread_stack_size);
@@ -7870,9 +7871,9 @@ static int show_table_definitions(THD *thd, SHOW_VAR *var, char *buff,
static int show_flush_commands(THD *thd, SHOW_VAR *var, char *buff,
enum enum_var_type scope)
{
- var->type= SHOW_LONG;
+ var->type= SHOW_LONGLONG;
var->value= buff;
- *((long *) buff)= (long) tdc_refresh_version();
+ *((longlong *) buff)= (longlong)tdc_refresh_version();
return 0;
}
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 843f66b5097..9846583a83c 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1321,7 +1321,7 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
file->ha_end_keyread();
if (free_file)
{
- DBUG_PRINT("info", ("Freeing separate handler 0x%lx (free: %d)", (long) file,
+ DBUG_PRINT("info", ("Freeing separate handler %p (free: %d)", file,
free_file));
file->ha_external_lock(current_thd, F_UNLCK);
file->ha_close();
@@ -1483,7 +1483,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler,
in_ror_merged_scan= 1;
if (reuse_handler)
{
- DBUG_PRINT("info", ("Reusing handler 0x%lx", (long) file));
+ DBUG_PRINT("info", ("Reusing handler %p", file));
if (init())
{
DBUG_RETURN(1);
@@ -4756,7 +4756,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
unique_calc_buff_size=
Unique::get_cost_calc_buff_size((ulong)non_cpk_scan_records,
param->table->file->ref_length,
- param->thd->variables.sortbuff_size);
+ (size_t)param->thd->variables.sortbuff_size);
if (param->imerge_cost_buff_size < unique_calc_buff_size)
{
if (!(param->imerge_cost_buff= (uint*)alloc_root(param->mem_root,
@@ -4768,7 +4768,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
imerge_cost +=
Unique::get_use_cost(param->imerge_cost_buff, (uint)non_cpk_scan_records,
param->table->file->ref_length,
- param->thd->variables.sortbuff_size,
+ (size_t)param->thd->variables.sortbuff_size,
TIME_FOR_COMPARE_ROWID,
FALSE, NULL);
DBUG_PRINT("info",("index_merge total cost: %g (wanted: less then %g)",
@@ -5021,7 +5021,7 @@ typedef struct st_common_index_intersect_info
PARAM *param; /* context info for range optimizations */
uint key_size; /* size of a ROWID element stored in Unique object */
uint compare_factor; /* 1/compare - cost to compare two ROWIDs */
- ulonglong max_memory_size; /* maximum space allowed for Unique objects */
+ size_t max_memory_size; /* maximum space allowed for Unique objects */
ha_rows table_cardinality; /* estimate of the number of records in table */
double cutoff_cost; /* discard index intersects with greater costs */
INDEX_SCAN_INFO *cpk_scan; /* clustered primary key used in intersection */
@@ -5216,7 +5216,7 @@ bool prepare_search_best_index_intersect(PARAM *param,
common->param= param;
common->key_size= table->file->ref_length;
common->compare_factor= TIME_FOR_COMPARE_ROWID;
- common->max_memory_size= param->thd->variables.sortbuff_size;
+ common->max_memory_size= (size_t)param->thd->variables.sortbuff_size;
common->cutoff_cost= cutoff_cost;
common->cpk_scan= NULL;
common->table_cardinality=
@@ -5652,7 +5652,7 @@ bool check_index_intersect_extension(PARTIAL_INDEX_INTERSECT_INFO *curr,
uint *buff_elems= common_info->buff_elems;
uint key_size= common_info->key_size;
uint compare_factor= common_info->compare_factor;
- ulonglong max_memory_size= common_info->max_memory_size;
+ size_t max_memory_size= common_info->max_memory_size;
records_sent_to_unique+= ext_index_scan_records;
cost= Unique::get_use_cost(buff_elems, (size_t) records_sent_to_unique, key_size,
@@ -10239,7 +10239,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
ulong count=count_key_part_usage(root,pos->next_key_part);
if (count > pos->next_key_part->use_count)
{
- sql_print_information("Use_count: Wrong count for key at 0x%lx, %lu "
+ sql_print_information("Use_count: Wrong count for key at %p, %lu "
"should be %lu", (long unsigned int)pos,
pos->next_key_part->use_count, count);
return;
@@ -10248,7 +10248,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root)
}
}
if (e_count != elements)
- sql_print_warning("Wrong use count: %u (should be %u) for tree at 0x%lx",
+ sql_print_warning("Wrong use count: %u (should be %u) for tree at %p",
e_count, elements, (long unsigned int) this);
}
#endif
@@ -10934,7 +10934,7 @@ int read_keys_and_merge_scans(THD *thd,
unique= new Unique(refpos_order_cmp, (void *)file,
file->ref_length,
- thd->variables.sortbuff_size,
+ (size_t)thd->variables.sortbuff_size,
intersection ? quick_selects.elements : 0);
if (!unique)
goto err;
@@ -14634,7 +14634,7 @@ static void print_sel_tree(PARAM *param, SEL_TREE *tree, key_map *tree_map,
if (!tmp.length())
tmp.append(STRING_WITH_LEN("(empty)"));
- DBUG_PRINT("info", ("SEL_TREE: 0x%lx (%s) scans: %s", (long) tree, msg,
+ DBUG_PRINT("info", ("SEL_TREE: %p (%s) scans: %s", tree, msg,
tmp.c_ptr_safe()));
DBUG_VOID_RETURN;
diff --git a/sql/parse_file.cc b/sql/parse_file.cc
index b091259d273..196feabb235 100644
--- a/sql/parse_file.cc
+++ b/sql/parse_file.cc
@@ -259,9 +259,9 @@ sql_create_definition_file(const LEX_CSTRING *dir,
int path_end;
File_option *param;
DBUG_ENTER("sql_create_definition_file");
- DBUG_PRINT("enter", ("Dir: %s, file: %s, base 0x%lx",
+ DBUG_PRINT("enter", ("Dir: %s, file: %s, base %p",
dir ? dir->str : "",
- file_name->str, (ulong) base));
+ file_name->str, base));
if (dir)
{
@@ -438,7 +438,7 @@ sql_parse_prepare(const LEX_CSTRING *file_name, MEM_ROOT *mem_root,
DBUG_RETURN(0);
}
- if ((len= mysql_file_read(file, (uchar *)buff, stat_info.st_size,
+ if ((len= mysql_file_read(file, (uchar *)buff, (size_t)stat_info.st_size,
MYF(MY_WME))) == MY_FILE_ERROR)
{
mysql_file_close(file, MYF(MY_WME));
diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc
index b82e7bada45..0ab4c62235f 100644
--- a/sql/rpl_filter.cc
+++ b/sql/rpl_filter.cc
@@ -239,7 +239,7 @@ Rpl_filter::db_ok_with_wild_table(const char *db)
int len;
end= strmov(hash_key, db);
*end++= '.';
- len= end - hash_key ;
+ len= (int)(end - hash_key);
if (wild_do_table_inited && find_wild(&wild_do_table, hash_key, len))
{
DBUG_PRINT("return",("1"));
diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc
index 433e7ea03c8..973b9d899c1 100644
--- a/sql/rpl_parallel.cc
+++ b/sql/rpl_parallel.cc
@@ -1697,7 +1697,7 @@ rpl_parallel_thread::get_qev_common(Log_event *ev, ulonglong event_size)
}
qev->typ= rpl_parallel_thread::queued_event::QUEUED_EVENT;
qev->ev= ev;
- qev->event_size= event_size;
+ qev->event_size= (size_t)event_size;
qev->next= NULL;
return qev;
}
diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc
index c07fe0464a1..51e93003c56 100644
--- a/sql/rpl_record.cc
+++ b/sql/rpl_record.cc
@@ -105,10 +105,10 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
#endif
pack_ptr= field->pack(pack_ptr, field->ptr + offset,
field->max_data_length());
- DBUG_PRINT("debug", ("field: %s; real_type: %d, pack_ptr: 0x%lx;"
- " pack_ptr':0x%lx; bytes: %d",
+ DBUG_PRINT("debug", ("field: %s; real_type: %d, pack_ptr: %p;"
+ " pack_ptr':%p; bytes: %d",
field->field_name.str, field->real_type(),
- (ulong) old_pack_ptr, (ulong) pack_ptr,
+ old_pack_ptr,pack_ptr,
(int) (pack_ptr - old_pack_ptr)));
DBUG_DUMP("packed_data", old_pack_ptr, pack_ptr - old_pack_ptr);
}
@@ -322,9 +322,9 @@ unpack_row(rpl_group_info *rgi,
pack_ptr= f->unpack(f->ptr, pack_ptr, row_end, metadata);
DBUG_PRINT("debug", ("field: %s; metadata: 0x%x;"
- " pack_ptr: 0x%lx; pack_ptr': 0x%lx; bytes: %d",
+ " pack_ptr: %p; pack_ptr': %p; bytes: %d",
f->field_name.str, metadata,
- (ulong) old_pack_ptr, (ulong) pack_ptr,
+ old_pack_ptr, pack_ptr,
(int) (pack_ptr - old_pack_ptr)));
if (!pack_ptr)
{
@@ -336,11 +336,11 @@ unpack_row(rpl_group_info *rgi,
Galera Node throws "Could not read field" error and drops out of cluster
*/
WSREP_WARN("ROW event unpack field: %s metadata: 0x%x;"
- " pack_ptr: 0x%lx; conv_table %p conv_field %p table %s"
- " row_end: 0x%lx",
+ " pack_ptr: %p; conv_table %p conv_field %p table %s"
+ " row_end: %p",
f->field_name.str, metadata,
- (ulong) old_pack_ptr, conv_table, conv_field,
- (table_found) ? "found" : "not found", (ulong)row_end
+ old_pack_ptr, conv_table, conv_field,
+ (table_found) ? "found" : "not found", row_end
);
}
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index f5069682223..ed9f0369f5d 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -234,7 +234,7 @@ a file name for --relay-log-index option", opt_relaylog_index_name);
mysql_mutex_lock(log_lock);
if (relay_log.open_index_file(buf_relaylog_index_name, ln, TRUE) ||
relay_log.open(ln, LOG_BIN, 0, 0, SEQ_READ_APPEND,
- max_relay_log_size, 1, TRUE))
+ (ulong)max_relay_log_size, 1, TRUE))
{
mysql_mutex_unlock(log_lock);
mysql_mutex_unlock(&data_lock);
@@ -1175,7 +1175,7 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
}
mysql_mutex_lock(rli->relay_log.get_log_lock());
if (rli->relay_log.open(ln, LOG_BIN, 0, 0, SEQ_READ_APPEND,
- (rli->max_relay_log_size ? rli->max_relay_log_size :
+ (ulong)(rli->max_relay_log_size ? rli->max_relay_log_size :
max_binlog_size), 1, TRUE))
{
sql_print_error("Unable to purge relay log files. Failed to open relay "
@@ -1577,9 +1577,9 @@ rpl_load_gtid_slave_state(THD *thd)
goto end;
}
}
- domain_id= (ulonglong)table->field[0]->val_int();
+ domain_id= (uint32)table->field[0]->val_int();
sub_id= (ulonglong)table->field[1]->val_int();
- server_id= (ulonglong)table->field[2]->val_int();
+ server_id= (uint32)table->field[2]->val_int();
seq_no= (ulonglong)table->field[3]->val_int();
DBUG_PRINT("info", ("Read slave state row: %u-%u-%lu sub_id=%lu\n",
(unsigned)domain_id, (unsigned)server_id,
diff --git a/sql/rpl_tblmap.cc b/sql/rpl_tblmap.cc
index 4c521cf0c16..48111bc5d0a 100644
--- a/sql/rpl_tblmap.cc
+++ b/sql/rpl_tblmap.cc
@@ -66,8 +66,8 @@ TABLE* table_mapping::get_table(ulong table_id)
entry *e= find_entry(table_id);
if (e)
{
- DBUG_PRINT("info", ("tid %lu -> table 0x%lx (%s)",
- table_id, (long) e->table,
+ DBUG_PRINT("info", ("tid %lu -> table %p (%s)",
+ table_id, e->table,
MAYBE_TABLE_NAME(e->table)));
DBUG_RETURN(e->table);
}
@@ -105,9 +105,9 @@ int table_mapping::expand()
int table_mapping::set_table(ulong table_id, TABLE* table)
{
DBUG_ENTER("table_mapping::set_table(ulong,TABLE*)");
- DBUG_PRINT("enter", ("table_id: %lu table: 0x%lx (%s)",
+ DBUG_PRINT("enter", ("table_id: %lu table: %p (%s)",
table_id,
- (long) table, MAYBE_TABLE_NAME(table)));
+ table, MAYBE_TABLE_NAME(table)));
entry *e= find_entry(table_id);
if (e == 0)
{
@@ -133,8 +133,8 @@ int table_mapping::set_table(ulong table_id, TABLE* table)
DBUG_RETURN(ERR_MEMORY_ALLOCATION);
}
- DBUG_PRINT("info", ("tid %lu -> table 0x%lx (%s)",
- table_id, (long) e->table,
+ DBUG_PRINT("info", ("tid %lu -> table %p (%s)",
+ table_id, e->table,
MAYBE_TABLE_NAME(e->table)));
DBUG_RETURN(0); // All OK
}
diff --git a/sql/session_tracker.cc b/sql/session_tracker.cc
index 61680fb17f6..4b449f3991a 100644
--- a/sql/session_tracker.cc
+++ b/sql/session_tracker.cc
@@ -967,7 +967,7 @@ bool Current_schema_tracker::update(THD *thd, set_var *)
bool Current_schema_tracker::store(THD *thd, String *buf)
{
- ulonglong db_length, length;
+ size_t db_length, length;
/*
Protocol made (by unknown reasons) redundant:
@@ -1320,16 +1320,16 @@ bool Transaction_state_tracker::store(THD *thd, String *buf)
}
{
- ulonglong length= buf->length() - start;
+ size_t length= buf->length() - start;
uchar *place= (uchar *)(buf->ptr() + (start - 2));
DBUG_ASSERT(length < 249); // in fact < 110
DBUG_ASSERT(start >= 3);
DBUG_ASSERT((place - 1)[0] == SESSION_TRACK_TRANSACTION_CHARACTERISTICS);
/* Length of the overall entity. */
- place[0]= length + 1;
+ place[0]= (uchar)length + 1;
/* Transaction characteristics (length-encoded string). */
- place[1]= length;
+ place[1]= (uchar)length;
}
}
diff --git a/sql/slave.cc b/sql/slave.cc
index 00dc02a6f48..86675b4f19c 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -3462,11 +3462,11 @@ sql_delay_event(Log_event *ev, THD *thd, rpl_group_info *rgi)
"ev->when= %lu "
"rli->mi->clock_diff_with_master= %lu "
"now= %ld "
- "sql_delay_end= %lu "
+ "sql_delay_end= %llu "
"nap_time= %ld",
sql_delay, (long)ev->when,
rli->mi->clock_diff_with_master,
- (long)now, sql_delay_end, (long)nap_time));
+ (long)now, (ulonglong)sql_delay_end, (long)nap_time));
if (sql_delay_end > now)
{
@@ -4523,12 +4523,12 @@ Stopping slave I/O thread due to out-of-memory error from master");
lastchecktime = currenttime;
if(tokenamount < network_read_len)
{
- ulonglong micro_time = 1000*1000 * (network_read_len - tokenamount) / speed_limit_in_bytes ;
- ulonglong second_time = micro_time / (1000 * 1000);
- micro_time = micro_time % (1000 * 1000);
+ ulonglong duration =1000ULL*1000 * (network_read_len - tokenamount) / speed_limit_in_bytes;
+ time_t second_time = (time_t)(duration / (1000 * 1000));
+ uint micro_time = duration % (1000 * 1000);
// at least sleep 1000 micro second
- my_sleep(micro_time > 1000 ? micro_time : 1000);
+ my_sleep(MY_MAX(micro_time,1000));
/*
If it sleep more than one second,
diff --git a/sql/sp.cc b/sql/sp.cc
index 32adb3f7195..c8b9e02076b 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -720,8 +720,8 @@ Sp_handler::db_find_and_cache_routine(THD *thd,
if (rc == SP_OK)
{
sp_cache_insert(get_cache(thd), *sp);
- DBUG_PRINT("info", ("added new: 0x%lx, level: %lu, flags %x",
- (ulong) sp[0], sp[0]->m_recursion_level,
+ DBUG_PRINT("info", ("added new: %p, level: %lu, flags %x",
+ sp[0], sp[0]->m_recursion_level,
sp[0]->m_flags));
}
return rc;
@@ -1775,11 +1775,11 @@ Sp_handler::sp_clone_and_link_routine(THD *thd,
String retstr(64);
retstr.set_charset(sp->get_creation_ctx()->get_client_cs());
- DBUG_PRINT("info", ("found: 0x%lx", (ulong)sp));
+ DBUG_PRINT("info", ("found: %p", sp));
if (sp->m_first_free_instance)
{
- DBUG_PRINT("info", ("first free: 0x%lx level: %lu flags %x",
- (ulong)sp->m_first_free_instance,
+ DBUG_PRINT("info", ("first free: %p level: %lu flags %x",
+ sp->m_first_free_instance,
sp->m_first_free_instance->m_recursion_level,
sp->m_first_free_instance->m_flags));
DBUG_ASSERT(!(sp->m_first_free_instance->m_flags & sp_head::IS_INVOKED));
@@ -1819,8 +1819,8 @@ Sp_handler::sp_clone_and_link_routine(THD *thd,
new_sp->m_recursion_level= level;
new_sp->m_first_instance= sp;
sp->m_last_cached_sp= sp->m_first_free_instance= new_sp;
- DBUG_PRINT("info", ("added level: 0x%lx, level: %lu, flags %x",
- (ulong)new_sp, new_sp->m_recursion_level,
+ DBUG_PRINT("info", ("added level: %p, level: %lu, flags %x",
+ new_sp, new_sp->m_recursion_level,
new_sp->m_flags));
DBUG_RETURN(new_sp);
}
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index c797d172e5d..83884502342 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -515,7 +515,7 @@ sp_head::operator new(size_t size) throw()
if (sp == NULL)
DBUG_RETURN(NULL);
sp->main_mem_root= own_root;
- DBUG_PRINT("info", ("mem_root 0x%lx", (ulong) &sp->mem_root));
+ DBUG_PRINT("info", ("mem_root %p", &sp->mem_root));
DBUG_RETURN(sp);
}
@@ -532,8 +532,8 @@ sp_head::operator delete(void *ptr, size_t size) throw()
/* Make a copy of main_mem_root as free_root will free the sp */
own_root= sp->main_mem_root;
- DBUG_PRINT("info", ("mem_root 0x%lx moved to 0x%lx",
- (ulong) &sp->mem_root, (ulong) &own_root));
+ DBUG_PRINT("info", ("mem_root %p moved to %p",
+ &sp->mem_root, &own_root));
free_root(&own_root, MYF(0));
DBUG_VOID_RETURN;
@@ -1027,9 +1027,9 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
if (m_next_cached_sp)
{
DBUG_PRINT("info",
- ("first free for 0x%lx ++: 0x%lx->0x%lx level: %lu flags %x",
- (ulong)m_first_instance, (ulong) this,
- (ulong) m_next_cached_sp,
+ ("first free for %p ++: %p->%p level: %lu flags %x",
+ m_first_instance, this,
+ m_next_cached_sp,
m_next_cached_sp->m_recursion_level,
m_next_cached_sp->m_flags));
}
@@ -1333,10 +1333,10 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
}
m_flags&= ~IS_INVOKED;
DBUG_PRINT("info",
- ("first free for 0x%lx --: 0x%lx->0x%lx, level: %lu, flags %x",
- (ulong) m_first_instance,
- (ulong) m_first_instance->m_first_free_instance,
- (ulong) this, m_recursion_level, m_flags));
+ ("first free for %p --: %p->%p, level: %lu, flags %x",
+ m_first_instance,
+ m_first_instance->m_first_free_instance,
+ this, m_recursion_level, m_flags));
/*
Check that we have one of following:
@@ -2310,8 +2310,8 @@ sp_head::backpatch(sp_label *lab)
{
if (bp->lab == lab)
{
- DBUG_PRINT("info", ("backpatch: (m_ip %d, label 0x%lx <%s>) to dest %d",
- bp->instr->m_ip, (ulong) lab, lab->name.str, dest));
+ DBUG_PRINT("info", ("backpatch: (m_ip %d, label %p <%s>) to dest %d",
+ bp->instr->m_ip, lab, lab->name.str, dest));
bp->instr->backpatch(dest, lab->ctx);
}
}
@@ -2492,8 +2492,8 @@ sp_head::reset_thd_mem_root(THD *thd)
DBUG_ENTER("sp_head::reset_thd_mem_root");
m_thd_root= thd->mem_root;
thd->mem_root= &main_mem_root;
- DBUG_PRINT("info", ("mem_root 0x%lx moved to thd mem root 0x%lx",
- (ulong) &mem_root, (ulong) &thd->mem_root));
+ DBUG_PRINT("info", ("mem_root %p moved to thd mem root %p",
+ &mem_root, &thd->mem_root));
free_list= thd->free_list; // Keep the old list
thd->free_list= NULL; // Start a new one
m_thd= thd;
@@ -2523,8 +2523,8 @@ sp_head::restore_thd_mem_root(THD *thd)
set_query_arena(thd); // Get new free_list and mem_root
state= STMT_INITIALIZED_FOR_SP;
- DBUG_PRINT("info", ("mem_root 0x%lx returned from thd mem root 0x%lx",
- (ulong) &mem_root, (ulong) &thd->mem_root));
+ DBUG_PRINT("info", ("mem_root %p returned from thd mem root %p",
+ &mem_root, &thd->mem_root));
thd->free_list= flist; // Restore the old one
thd->mem_root= m_thd_root;
m_thd= NULL;
diff --git a/sql/sp_pcontext.h b/sql/sp_pcontext.h
index 215ebbe5f77..9c879099410 100644
--- a/sql/sp_pcontext.h
+++ b/sql/sp_pcontext.h
@@ -433,11 +433,11 @@ public:
/// @return the current number of variables used in the parent contexts
/// (from the root), including this context.
uint current_var_count() const
- { return m_var_offset + m_vars.elements(); }
+ { return m_var_offset + (uint)m_vars.elements(); }
/// @return the number of variables in this context alone.
uint context_var_count() const
- { return m_vars.elements(); }
+ { return (uint)m_vars.elements(); }
/// return the i-th variable on the current context
sp_variable *get_context_variable(uint i) const
@@ -678,10 +678,10 @@ public:
{ return m_cursors.elements(); }
uint max_cursor_index() const
- { return m_max_cursor_index + m_cursors.elements(); }
+ { return m_max_cursor_index + (uint)m_cursors.elements(); }
uint current_cursor_count() const
- { return m_cursor_offset + m_cursors.elements(); }
+ { return m_cursor_offset + (uint)m_cursors.elements(); }
void set_for_loop(const Lex_for_loop_st &for_loop)
{
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 41d0e73a84e..b0550fb5189 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -12355,7 +12355,7 @@ static bool find_mpvio_user(MPVIO_EXT *mpvio)
static bool
read_client_connect_attrs(char **ptr, char *end, CHARSET_INFO *from_cs)
{
- size_t length;
+ ulonglong length;
char *ptr_save= *ptr;
/* not enough bytes to hold the length */
@@ -12377,10 +12377,10 @@ read_client_connect_attrs(char **ptr, char *end, CHARSET_INFO *from_cs)
return true;
#ifdef HAVE_PSI_THREAD_INTERFACE
- if (PSI_THREAD_CALL(set_thread_connect_attrs)(*ptr, length, from_cs) &&
+ if (PSI_THREAD_CALL(set_thread_connect_attrs)(*ptr, (size_t)length, from_cs) &&
current_thd->variables.log_warnings)
- sql_print_warning("Connection attributes of length %lu were truncated",
- (unsigned long) length);
+ sql_print_warning("Connection attributes of length %llu were truncated",
+ length);
#endif
return false;
}
@@ -12637,7 +12637,7 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
char *user= end;
char *passwd= strend(user)+1;
- uint user_len= passwd - user - 1, db_len;
+ uint user_len= (uint)(passwd - user - 1), db_len;
char *db= passwd;
char user_buff[USERNAME_LENGTH + 1]; // buffer to store user in utf8
uint dummy_errors;
@@ -12652,15 +12652,22 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
Cast *passwd to an unsigned char, so that it doesn't extend the sign for
*passwd > 127 and become 2**32-127+ after casting to uint.
*/
- uint passwd_len;
+ ulonglong len;
+ size_t passwd_len;
+
if (!(thd->client_capabilities & CLIENT_SECURE_CONNECTION))
- passwd_len= strlen(passwd);
+ len= strlen(passwd);
else if (!(thd->client_capabilities & CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA))
- passwd_len= (uchar)(*passwd++);
+ len= (uchar)(*passwd++);
else
- passwd_len= safe_net_field_length_ll((uchar**)&passwd,
+ {
+ len= safe_net_field_length_ll((uchar**)&passwd,
net->read_pos + pkt_len - (uchar*)passwd);
-
+ if (len > pkt_len)
+ return packet_error;
+ }
+
+ passwd_len= (size_t)len;
db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ?
db + passwd_len + 1 : 0;
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 31933e63b4e..1e46fc44c5e 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -588,7 +588,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
}
}
#endif
- DBUG_PRINT("admin", ("table: 0x%lx", (long) table->table));
+ DBUG_PRINT("admin", ("table: %p", table->table));
if (prepare_func)
{
diff --git a/sql/sql_audit.h b/sql/sql_audit.h
index f7ad8d3cd20..96f9d0caece 100644
--- a/sql/sql_audit.h
+++ b/sql/sql_audit.h
@@ -62,15 +62,26 @@ static inline void mysql_audit_notify(THD *thd, uint event_class,
#endif
extern void mysql_audit_release(THD *thd);
+static inline unsigned int strlen_uint(const char *s)
+{
+ return (uint)strlen(s);
+}
+
+static inline unsigned int safe_strlen_uint(const char *s)
+{
+ return (uint)safe_strlen(s);
+}
+
#define MAX_USER_HOST_SIZE 512
static inline uint make_user_name(THD *thd, char *buf)
{
const Security_context *sctx= thd->security_ctx;
- return strxnmov(buf, MAX_USER_HOST_SIZE,
+ char *end= strxnmov(buf, MAX_USER_HOST_SIZE,
sctx->priv_user[0] ? sctx->priv_user : "", "[",
sctx->user ? sctx->user : "", "] @ ",
sctx->host ? sctx->host : "", " [",
- sctx->ip ? sctx->ip : "", "]", NullS) - buf;
+ sctx->ip ? sctx->ip : "", "]", NullS);
+ return (uint)(end-buf);
}
/**
@@ -112,7 +123,7 @@ void mysql_audit_general_log(THD *thd, time_t time,
event.general_thread_id= (unsigned long)thd->thread_id;
event.general_charset= thd->variables.character_set_client;
event.database= thd->db;
- event.database_length= thd->db_length;
+ event.database_length= (unsigned int)thd->db_length;
event.query_id= thd->query_id;
}
else
@@ -153,7 +164,7 @@ void mysql_audit_general(THD *thd, uint event_subtype,
event.general_error_code= error_code;
event.general_time= my_time(0);
event.general_command= msg;
- event.general_command_length= safe_strlen(msg);
+ event.general_command_length= safe_strlen_uint(msg);
if (thd)
{
@@ -165,7 +176,7 @@ void mysql_audit_general(THD *thd, uint event_subtype,
event.general_charset= thd->query_string.charset();
event.general_rows= thd->get_stmt_da()->current_row_for_warning();
event.database= thd->db;
- event.database_length= thd->db_length;
+ event.database_length= (uint)thd->db_length;
event.query_id= thd->query_id;
}
else
@@ -199,19 +210,19 @@ void mysql_audit_notify_connection_connect(THD *thd)
thd->get_stmt_da()->sql_errno() : 0;
event.thread_id= (unsigned long)thd->thread_id;
event.user= sctx->user;
- event.user_length= safe_strlen(sctx->user);
+ event.user_length= safe_strlen_uint(sctx->user);
event.priv_user= sctx->priv_user;
- event.priv_user_length= strlen(sctx->priv_user);
+ event.priv_user_length= strlen_uint(sctx->priv_user);
event.external_user= sctx->external_user;
- event.external_user_length= safe_strlen(sctx->external_user);
+ event.external_user_length= safe_strlen_uint(sctx->external_user);
event.proxy_user= sctx->proxy_user;
- event.proxy_user_length= strlen(sctx->proxy_user);
+ event.proxy_user_length= strlen_uint(sctx->proxy_user);
event.host= sctx->host;
- event.host_length= safe_strlen(sctx->host);
+ event.host_length= safe_strlen_uint(sctx->host);
event.ip= sctx->ip;
- event.ip_length= safe_strlen(sctx->ip);
+ event.ip_length= safe_strlen_uint(sctx->ip);
event.database= thd->db;
- event.database_length= safe_strlen(thd->db);
+ event.database_length= safe_strlen_uint(thd->db);
mysql_audit_notify(thd, MYSQL_AUDIT_CONNECTION_CLASS, &event);
}
@@ -229,19 +240,19 @@ void mysql_audit_notify_connection_disconnect(THD *thd, int errcode)
event.status= errcode;
event.thread_id= (unsigned long)thd->thread_id;
event.user= sctx->user;
- event.user_length= safe_strlen(sctx->user);
+ event.user_length= safe_strlen_uint(sctx->user);
event.priv_user= sctx->priv_user;
- event.priv_user_length= strlen(sctx->priv_user);
+ event.priv_user_length= strlen_uint(sctx->priv_user);
event.external_user= sctx->external_user;
- event.external_user_length= safe_strlen(sctx->external_user);
+ event.external_user_length= safe_strlen_uint(sctx->external_user);
event.proxy_user= sctx->proxy_user;
- event.proxy_user_length= strlen(sctx->proxy_user);
+ event.proxy_user_length= strlen_uint(sctx->proxy_user);
event.host= sctx->host;
- event.host_length= safe_strlen(sctx->host);
+ event.host_length= safe_strlen_uint(sctx->host);
event.ip= sctx->ip;
- event.ip_length= safe_strlen(sctx->ip) ;
+ event.ip_length= safe_strlen_uint(sctx->ip) ;
event.database= thd->db;
- event.database_length= safe_strlen(thd->db);
+ event.database_length= safe_strlen_uint(thd->db);
mysql_audit_notify(thd, MYSQL_AUDIT_CONNECTION_CLASS, &event);
}
@@ -260,19 +271,19 @@ void mysql_audit_notify_connection_change_user(THD *thd)
thd->get_stmt_da()->sql_errno() : 0;
event.thread_id= (unsigned long)thd->thread_id;
event.user= sctx->user;
- event.user_length= safe_strlen(sctx->user);
+ event.user_length= safe_strlen_uint(sctx->user);
event.priv_user= sctx->priv_user;
- event.priv_user_length= strlen(sctx->priv_user);
+ event.priv_user_length= strlen_uint(sctx->priv_user);
event.external_user= sctx->external_user;
- event.external_user_length= safe_strlen(sctx->external_user);
+ event.external_user_length= safe_strlen_uint(sctx->external_user);
event.proxy_user= sctx->proxy_user;
- event.proxy_user_length= strlen(sctx->proxy_user);
+ event.proxy_user_length= strlen_uint(sctx->proxy_user);
event.host= sctx->host;
- event.host_length= safe_strlen(sctx->host);
+ event.host_length= safe_strlen_uint(sctx->host);
event.ip= sctx->ip;
- event.ip_length= safe_strlen(sctx->ip);
+ event.ip_length= safe_strlen_uint(sctx->ip);
event.database= thd->db;
- event.database_length= safe_strlen(thd->db);
+ event.database_length= safe_strlen_uint(thd->db);
mysql_audit_notify(thd, MYSQL_AUDIT_CONNECTION_CLASS, &event);
}
@@ -297,9 +308,9 @@ void mysql_audit_external_lock(THD *thd, TABLE_SHARE *share, int lock)
event.host= sctx->host;
event.ip= sctx->ip;
event.database= share->db.str;
- event.database_length= share->db.length;
+ event.database_length= (unsigned int)share->db.length;
event.table= share->table_name.str;
- event.table_length= share->table_name.length;
+ event.table_length= (unsigned int)share->table_name.length;
event.new_database= 0;
event.new_database_length= 0;
event.new_table= 0;
@@ -331,9 +342,9 @@ void mysql_audit_create_table(TABLE *table)
event.host= sctx->host;
event.ip= sctx->ip;
event.database= share->db.str;
- event.database_length= share->db.length;
+ event.database_length= (unsigned int)share->db.length;
event.table= share->table_name.str;
- event.table_length= share->table_name.length;
+ event.table_length= (unsigned int)share->table_name.length;
event.new_database= 0;
event.new_database_length= 0;
event.new_table= 0;
@@ -363,9 +374,9 @@ void mysql_audit_drop_table(THD *thd, TABLE_LIST *table)
event.host= sctx->host;
event.ip= sctx->ip;
event.database= table->db;
- event.database_length= table->db_length;
+ event.database_length= (unsigned int)table->db_length;
event.table= table->table_name;
- event.table_length= table->table_name_length;
+ event.table_length= (unsigned int)table->table_name_length;
event.new_database= 0;
event.new_database_length= 0;
event.new_table= 0;
@@ -396,13 +407,13 @@ void mysql_audit_rename_table(THD *thd, const char *old_db, const char *old_tb,
event.host= sctx->host;
event.ip= sctx->ip;
event.database= old_db;
- event.database_length= strlen(old_db);
+ event.database_length= strlen_uint(old_db);
event.table= old_tb;
- event.table_length= strlen(old_tb);
+ event.table_length= strlen_uint(old_tb);
event.new_database= new_db;
- event.new_database_length= strlen(new_db);
+ event.new_database_length= strlen_uint(new_db);
event.new_table= new_tb;
- event.new_table_length= strlen(new_tb);
+ event.new_table_length= strlen_uint(new_tb);
event.query_id= thd->query_id;
mysql_audit_notify(thd, MYSQL_AUDIT_TABLE_CLASS, &event);
@@ -428,9 +439,9 @@ void mysql_audit_alter_table(THD *thd, TABLE_LIST *table)
event.host= sctx->host;
event.ip= sctx->ip;
event.database= table->db;
- event.database_length= table->db_length;
+ event.database_length= (unsigned int)table->db_length;
event.table= table->table_name;
- event.table_length= table->table_name_length;
+ event.table_length= (unsigned int)table->table_name_length;
event.new_database= 0;
event.new_database_length= 0;
event.new_table= 0;
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 8c724ee8561..c0736130cfe 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -325,7 +325,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild)
struct close_cached_tables_arg
{
- ulong refresh_version;
+ tdc_version_t refresh_version;
TDC_element *element;
};
@@ -351,7 +351,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables,
{
bool result= FALSE;
struct timespec abstime;
- ulong refresh_version;
+ tdc_version_t refresh_version;
DBUG_ENTER("close_cached_tables");
DBUG_ASSERT(thd || (!wait_for_refresh && !tables));
@@ -716,8 +716,8 @@ void close_thread_tables(THD *thd)
#ifdef EXTRA_DEBUG
DBUG_PRINT("tcache", ("open tables:"));
for (table= thd->open_tables; table; table= table->next)
- DBUG_PRINT("tcache", ("table: '%s'.'%s' 0x%lx", table->s->db.str,
- table->s->table_name.str, (long) table));
+ DBUG_PRINT("tcache", ("table: '%s'.'%s' %p", table->s->db.str,
+ table->s->table_name.str, table));
#endif
#if defined(ENABLED_DEBUG_SYNC)
@@ -857,8 +857,8 @@ void close_thread_table(THD *thd, TABLE **table_ptr)
{
TABLE *table= *table_ptr;
DBUG_ENTER("close_thread_table");
- DBUG_PRINT("tcache", ("table: '%s'.'%s' 0x%lx", table->s->db.str,
- table->s->table_name.str, (long) table));
+ DBUG_PRINT("tcache", ("table: '%s'.'%s' %p", table->s->db.str,
+ table->s->table_name.str, table));
DBUG_ASSERT(!table->file->keyread_enabled());
DBUG_ASSERT(!table->file || table->file->inited == handler::NONE);
@@ -1192,8 +1192,8 @@ bool wait_while_table_is_used(THD *thd, TABLE *table,
{
DBUG_ENTER("wait_while_table_is_used");
DBUG_ASSERT(!table->s->tmp_table);
- DBUG_PRINT("enter", ("table: '%s' share: 0x%lx db_stat: %u version: %lu",
- table->s->table_name.str, (ulong) table->s,
+ DBUG_PRINT("enter", ("table: '%s' share: %p db_stat: %u version: %lld",
+ table->s->table_name.str, table->s,
table->db_stat, table->s->tdc->version));
if (thd->mdl_context.upgrade_shared_lock(
@@ -1812,7 +1812,7 @@ retry_share:
{
if (share->tdc->flushed)
{
- DBUG_PRINT("info", ("Found old share version: %lu current: %lu",
+ DBUG_PRINT("info", ("Found old share version: %lld current: %lld",
share->tdc->version, tdc_refresh_version()));
/*
We already have an MDL lock. But we have encountered an old
@@ -5244,8 +5244,8 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
{
DBUG_ENTER("find_field_in_view");
DBUG_PRINT("enter",
- ("view: '%s', field name: '%s', item name: '%s', ref 0x%lx",
- table_list->alias, name, item_name, (ulong) ref));
+ ("view: '%s', field name: '%s', item name: '%s', ref %p",
+ table_list->alias, name, item_name, ref));
Field_iterator_view field_it;
field_it.set(table_list);
Query_arena *arena= 0, backup;
@@ -5329,8 +5329,8 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
Field *UNINIT_VAR(found_field);
Query_arena *UNINIT_VAR(arena), backup;
DBUG_ENTER("find_field_in_natural_join");
- DBUG_PRINT("enter", ("field name: '%s', ref 0x%lx",
- name, (ulong) ref));
+ DBUG_PRINT("enter", ("field name: '%s', ref %p",
+ name, ref));
DBUG_ASSERT(table_ref->is_natural_join && table_ref->join_columns);
DBUG_ASSERT(*actual_table == NULL);
@@ -5556,8 +5556,8 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
DBUG_ASSERT(name);
DBUG_ASSERT(item_name);
DBUG_PRINT("enter",
- ("table: '%s' field name: '%s' item name: '%s' ref 0x%lx",
- table_list->alias, name, item_name, (ulong) ref));
+ ("table: '%s' field name: '%s' item name: '%s' ref %p",
+ table_list->alias, name, item_name, ref));
/*
Check that the table and database that qualify the current field name
@@ -7456,7 +7456,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
bool found;
char name_buff[SAFE_NAME_LEN+1];
DBUG_ENTER("insert_fields");
- DBUG_PRINT("arena", ("stmt arena: 0x%lx", (ulong)thd->stmt_arena));
+ DBUG_PRINT("arena", ("stmt arena: %p",thd->stmt_arena));
if (db_name && lower_case_table_names)
{
diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc
index 5f554a3cd92..f58bcf2e8fe 100644
--- a/sql/sql_binlog.cc
+++ b/sql/sql_binlog.cc
@@ -192,8 +192,8 @@ void mysql_client_binlog_statement(THD* thd)
since it will read from unassigned memory.
*/
DBUG_PRINT("info",
- ("bytes_decoded: %d strptr: 0x%lx endptr: 0x%lx ('%c':%d)",
- bytes_decoded, (long) strptr, (long) endptr, *endptr,
+ ("bytes_decoded: %d strptr: %p endptr: %p ('%c':%d)",
+ bytes_decoded, strptr, endptr, *endptr,
*endptr));
#endif
diff --git a/sql/sql_bootstrap.cc b/sql/sql_bootstrap.cc
index 30d03029ce6..4ef9885b34d 100644
--- a/sql/sql_bootstrap.cc
+++ b/sql/sql_bootstrap.cc
@@ -24,8 +24,8 @@ int read_bootstrap_query(char *query, int *query_length,
{
char line_buffer[MAX_BOOTSTRAP_LINE_SIZE];
const char *line;
- int len;
- int query_len= 0;
+ size_t len;
+ size_t query_len= 0;
int fgets_error= 0;
*error= 0;
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 3db6e6a68c1..7849e16a839 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -356,27 +356,27 @@ const uchar *query_state_map;
#endif
#if defined(EXTRA_DEBUG) && !defined(DBUG_OFF)
-#define RW_WLOCK(M) {DBUG_PRINT("lock", ("rwlock wlock 0x%lx",(ulong)(M))); \
+#define RW_WLOCK(M) {DBUG_PRINT("lock", ("rwlock wlock %p",(M))); \
if (!mysql_rwlock_wrlock(M)) DBUG_PRINT("lock", ("rwlock wlock ok")); \
else DBUG_PRINT("lock", ("rwlock wlock FAILED %d", errno)); }
-#define RW_RLOCK(M) {DBUG_PRINT("lock", ("rwlock rlock 0x%lx", (ulong)(M))); \
+#define RW_RLOCK(M) {DBUG_PRINT("lock", ("rwlock rlock %p",(M))); \
if (!mysql_rwlock_rdlock(M)) DBUG_PRINT("lock", ("rwlock rlock ok")); \
else DBUG_PRINT("lock", ("rwlock wlock FAILED %d", errno)); }
-#define RW_UNLOCK(M) {DBUG_PRINT("lock", ("rwlock unlock 0x%lx",(ulong)(M))); \
+#define RW_UNLOCK(M) {DBUG_PRINT("lock", ("rwlock unlock %p",(M))); \
if (!mysql_rwlock_unlock(M)) DBUG_PRINT("lock", ("rwlock unlock ok")); \
else DBUG_PRINT("lock", ("rwlock unlock FAILED %d", errno)); }
-#define BLOCK_LOCK_WR(B) {DBUG_PRINT("lock", ("%d LOCK_WR 0x%lx",\
- __LINE__,(ulong)(B))); \
+#define BLOCK_LOCK_WR(B) {DBUG_PRINT("lock", ("%d LOCK_WR %p",\
+ __LINE__,(B))); \
B->query()->lock_writing();}
-#define BLOCK_LOCK_RD(B) {DBUG_PRINT("lock", ("%d LOCK_RD 0x%lx",\
- __LINE__,(ulong)(B))); \
+#define BLOCK_LOCK_RD(B) {DBUG_PRINT("lock", ("%d LOCK_RD %p",\
+ __LINE__,(B))); \
B->query()->lock_reading();}
#define BLOCK_UNLOCK_WR(B) { \
- DBUG_PRINT("lock", ("%d UNLOCK_WR 0x%lx",\
- __LINE__,(ulong)(B)));B->query()->unlock_writing();}
+ DBUG_PRINT("lock", ("%d UNLOCK_WR %p",\
+ __LINE__,(B)));B->query()->unlock_writing();}
#define BLOCK_UNLOCK_RD(B) { \
- DBUG_PRINT("lock", ("%d UNLOCK_RD 0x%lx",\
- __LINE__,(ulong)(B)));B->query()->unlock_reading();}
+ DBUG_PRINT("lock", ("%d UNLOCK_RD %p",\
+ __LINE__,(B)));B->query()->unlock_reading();}
#define DUMP(C) DBUG_EXECUTE("qcache", {\
(C)->cache_dump(); (C)->queries_dump();(C)->tables_dump();})
#else
@@ -647,7 +647,7 @@ bool Query_cache::try_lock(THD *thd, Cache_try_lock_mode mode)
else if (mode == TIMEOUT)
{
struct timespec waittime;
- set_timespec_nsec(waittime,(ulong)(50000000L)); /* Wait for 50 msec */
+ set_timespec_nsec(waittime,50000000UL); /* Wait for 50 msec */
int res= mysql_cond_timedwait(&COND_cache_status_changed,
&structure_guard_mutex, &waittime);
if (res == ETIMEDOUT)
@@ -821,7 +821,7 @@ inline Query_cache_block * Query_cache_block_table::block()
void Query_cache_block::init(ulong block_length)
{
DBUG_ENTER("Query_cache_block::init");
- DBUG_PRINT("qcache", ("init block: 0x%lx length: %lu", (ulong) this,
+ DBUG_PRINT("qcache", ("init block: %p length: %lu", this,
block_length));
length = block_length;
used = 0;
@@ -833,8 +833,8 @@ void Query_cache_block::init(ulong block_length)
void Query_cache_block::destroy()
{
DBUG_ENTER("Query_cache_block::destroy");
- DBUG_PRINT("qcache", ("destroy block 0x%lx, type %d",
- (ulong) this, type));
+ DBUG_PRINT("qcache", ("destroy block %p, type %d",
+ this, type));
type = INCOMPLETE;
DBUG_VOID_RETURN;
}
@@ -936,7 +936,7 @@ bool Query_cache_query::try_lock_writing()
DBUG_PRINT("info", ("can't lock rwlock"));
DBUG_RETURN(0);
}
- DBUG_PRINT("info", ("rwlock 0x%lx locked", (ulong) &lock));
+ DBUG_PRINT("info", ("rwlock %p locked", &lock));
DBUG_RETURN(1);
}
@@ -965,9 +965,9 @@ void Query_cache_query::init_n_lock()
res=0; wri = 0; len = 0; ready= 0;
mysql_rwlock_init(key_rwlock_query_cache_query_lock, &lock);
lock_writing();
- DBUG_PRINT("qcache", ("inited & locked query for block 0x%lx",
- (long) (((uchar*) this) -
- ALIGN_SIZE(sizeof(Query_cache_block)))));
+ DBUG_PRINT("qcache", ("inited & locked query for block %p",
+ (uchar*) this -
+ ALIGN_SIZE(sizeof(Query_cache_block))));
DBUG_VOID_RETURN;
}
@@ -975,9 +975,9 @@ void Query_cache_query::init_n_lock()
void Query_cache_query::unlock_n_destroy()
{
DBUG_ENTER("Query_cache_query::unlock_n_destroy");
- DBUG_PRINT("qcache", ("destroyed & unlocked query for block 0x%lx",
- (long) (((uchar*) this) -
- ALIGN_SIZE(sizeof(Query_cache_block)))));
+ DBUG_PRINT("qcache", ("destroyed & unlocked query for block %p",
+ (uchar*) this -
+ ALIGN_SIZE(sizeof(Query_cache_block))));
/*
The following call is not needed on system where one can destroy an
active semaphore
@@ -1110,7 +1110,7 @@ Query_cache::insert(THD *thd, Query_cache_tls *query_cache_tls,
{
DBUG_PRINT("warning", ("Can't append data"));
header->result(result);
- DBUG_PRINT("qcache", ("free query 0x%lx", (ulong) query_block));
+ DBUG_PRINT("qcache", ("free query %p", query_block));
// The following call will remove the lock on query_block
query_cache.free_query(query_block);
query_cache.refused++;
@@ -1446,8 +1446,8 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
flags.default_week_format= thd->variables.default_week_format;
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: %lu, TZ: 0x%lx, \
-sql mode: 0x%llx, sort len: %lu, conncat len: %lu, div_precision: %lu, \
+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",
(int)flags.client_long_flag,
(int)flags.client_protocol_41,
@@ -1458,8 +1458,8 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
flags.character_set_client_num,
flags.character_set_results_num,
flags.collation_connection_num,
- (ulong) flags.limit,
- (ulong) flags.time_zone,
+ (ulonglong)flags.limit,
+ flags.time_zone,
flags.sql_mode,
flags.max_sort_length,
flags.group_concat_max_len,
@@ -1522,7 +1522,7 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
/* Check if another thread is processing the same query? */
Query_cache_block *competitor = (Query_cache_block *)
my_hash_search(&queries, (uchar*) query, tot_length);
- DBUG_PRINT("qcache", ("competitor 0x%lx", (ulong) competitor));
+ DBUG_PRINT("qcache", ("competitor %p", competitor));
if (competitor == 0)
{
/* Query is not in cache and no one is working with it; Store it */
@@ -1532,8 +1532,8 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
Query_cache_block::QUERY, local_tables);
if (query_block != 0)
{
- DBUG_PRINT("qcache", ("query block 0x%lx allocated, %lu",
- (ulong) query_block, query_block->used));
+ DBUG_PRINT("qcache", ("query block %p allocated, %lu",
+ query_block, query_block->used));
Query_cache_query *header = query_block->query();
header->init_n_lock();
@@ -1944,8 +1944,8 @@ Query_cache::send_result_to_client(THD *thd, char *org_sql, uint query_length)
flags.lc_time_names= thd->variables.lc_time_names;
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: %lu, TZ: 0x%lx, \
-sql mode: 0x%llx, sort len: %lu, conncat len: %lu, div_precision: %lu, \
+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",
(int)flags.client_long_flag,
(int)flags.client_protocol_41,
@@ -1956,8 +1956,8 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
flags.character_set_client_num,
flags.character_set_results_num,
flags.collation_connection_num,
- (ulong) flags.limit,
- (ulong) flags.time_zone,
+ (ulonglong) flags.limit,
+ flags.time_zone,
flags.sql_mode,
flags.max_sort_length,
flags.group_concat_max_len,
@@ -1984,7 +1984,7 @@ lookup:
DBUG_PRINT("qcache", ("No query in query hash or no results"));
goto err_unlock;
}
- DBUG_PRINT("qcache", ("Query in query hash 0x%lx", (ulong)query_block));
+ DBUG_PRINT("qcache", ("Query in query hash %p",query_block));
#ifdef WITH_WSREP
if (once_more && WSREP_CLIENT(thd) && wsrep_must_sync_wait(thd))
@@ -2015,7 +2015,7 @@ lookup:
BLOCK_UNLOCK_RD(query_block);
goto err_unlock;
}
- DBUG_PRINT("qcache", ("Query have result 0x%lx", (ulong) query));
+ DBUG_PRINT("qcache", ("Query have result %p", query));
if (thd->in_multi_stmt_transaction_mode() &&
(query->tables_type() & HA_CACHE_TBL_TRANSACT))
@@ -2112,9 +2112,9 @@ lookup:
if (engine_data != table->engine_data())
{
DBUG_PRINT("qcache",
- ("Handler require invalidation queries of %.*s %lu-%lu",
+ ("Handler require invalidation queries of %.*s %llu-%llu",
qcache_se_key_len, qcache_se_key_name,
- (ulong) engine_data, (ulong) table->engine_data()));
+ engine_data, table->engine_data()));
invalidate_table_internal(thd,
(uchar *) table->db(),
table->key_length());
@@ -2152,9 +2152,9 @@ lookup:
THD_STAGE_INFO(thd, stage_sending_cached_result_to_client);
do
{
- DBUG_PRINT("qcache", ("Results (len: %lu used: %lu headers: %lu)",
+ DBUG_PRINT("qcache", ("Results (len: %lu used: %lu headers: %u)",
result_block->length, result_block->used,
- (ulong) (result_block->headers_len()+
+ (uint) (result_block->headers_len()+
ALIGN_SIZE(sizeof(Query_cache_result)))));
Query_cache_result *result = result_block->result();
@@ -2192,7 +2192,7 @@ lookup:
thd->get_stmt_da()->disable_status();
BLOCK_UNLOCK_RD(query_block);
- MYSQL_QUERY_CACHE_HIT(thd->query(), (ulong) thd->limit_found_rows);
+ MYSQL_QUERY_CACHE_HIT(thd->query(), thd->limit_found_rows);
DBUG_RETURN(1); // Result sent to client
err_unlock:
@@ -2899,8 +2899,8 @@ 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 0x%lx %lu bytes result",
- (ulong) query_block,
+ DBUG_PRINT("qcache", ("free query %p %lu bytes result",
+ query_block,
query_block->query()->length() ));
queries_in_cache--;
@@ -2969,8 +2969,8 @@ 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 0x%lx %lu bytes result",
- (ulong) query_block,
+ DBUG_PRINT("qcache", ("free query %p %lu bytes result",
+ query_block,
query_block->query()->length() ));
my_hash_delete(&queries,(uchar *) query_block);
@@ -3017,8 +3017,8 @@ Query_cache::append_result_data(Query_cache_block **current_block,
Query_cache_block *query_block)
{
DBUG_ENTER("Query_cache::append_result_data");
- DBUG_PRINT("qcache", ("append %lu bytes to 0x%lx query",
- data_len, (long) query_block));
+ DBUG_PRINT("qcache", ("append %lu bytes to %p query",
+ data_len, query_block));
if (query_block->query()->add(data_len) > query_cache_limit)
{
@@ -3035,8 +3035,8 @@ Query_cache::append_result_data(Query_cache_block **current_block,
}
Query_cache_block *last_block = (*current_block)->prev;
- DBUG_PRINT("qcache", ("lastblock 0x%lx len %lu used %lu",
- (ulong) last_block, last_block->length,
+ DBUG_PRINT("qcache", ("lastblock %p len %lu used %lu",
+ last_block, last_block->length,
last_block->used));
my_bool success = 1;
ulong last_block_free_space= last_block->length - last_block->used;
@@ -3081,8 +3081,8 @@ Query_cache::append_result_data(Query_cache_block **current_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 0x%lx to copy %lub",
- last_block_free_space, (ulong)last_block, to_copy));
+ DBUG_PRINT("qcache", ("use free space %lub at block %p to copy %lub",
+ last_block_free_space,last_block, to_copy));
memcpy((uchar*) last_block + last_block->used, data, to_copy);
last_block->used+=to_copy;
}
@@ -3123,8 +3123,8 @@ my_bool Query_cache::write_result_data(Query_cache_block **result_block,
{
block->type = type;
ulong length = block->used - headers_len;
- DBUG_PRINT("qcache", ("write %lu byte in block 0x%lx",length,
- (ulong)block));
+ DBUG_PRINT("qcache", ("write %lu byte in block %p",length,
+ block));
memcpy((uchar*) block+headers_len, rest, length);
rest += length;
block = block->next;
@@ -3387,12 +3387,12 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
else
{
DBUG_PRINT("qcache",
- ("table: %s db: %s openinfo: 0x%lx keylen: %lu key: 0x%lx",
+ ("table: %s db: %s openinfo: %p keylen: %zu key: %p",
tables_used->table->s->table_name.str,
tables_used->table->s->table_cache_key.str,
- (ulong) tables_used->table,
- (ulong) tables_used->table->s->table_cache_key.length,
- (ulong) tables_used->table->s->table_cache_key.str));
+ tables_used->table,
+ tables_used->table->s->table_cache_key.length,
+ tables_used->table->s->table_cache_key.str));
if (!insert_table(thd, tables_used->table->s->table_cache_key.length,
tables_used->table->s->table_cache_key.str,
@@ -3429,8 +3429,8 @@ my_bool Query_cache::register_all_tables(THD *thd,
TABLE_COUNTER_TYPE tables_arg)
{
TABLE_COUNTER_TYPE n;
- DBUG_PRINT("qcache", ("register tables block 0x%lx, n %d, header %x",
- (ulong) block, (int) tables_arg,
+ DBUG_PRINT("qcache", ("register tables block %p, n %d, header %x",
+ block, (int) tables_arg,
(int) ALIGN_SIZE(sizeof(Query_cache_block))));
Query_cache_block_table *block_table = block->table(0);
@@ -3469,8 +3469,8 @@ Query_cache::insert_table(THD *thd, uint key_len, const char *key,
my_bool hash)
{
DBUG_ENTER("Query_cache::insert_table");
- DBUG_PRINT("qcache", ("insert table node 0x%lx, len %d",
- (ulong)node, key_len));
+ DBUG_PRINT("qcache", ("insert table node %p, len %d",
+ node, key_len));
Query_cache_block *table_block=
(hash ?
@@ -3481,11 +3481,11 @@ Query_cache::insert_table(THD *thd, uint key_len, const char *key,
table_block->table()->engine_data() != engine_data)
{
DBUG_PRINT("qcache",
- ("Handler require invalidation queries of %s.%s %lu-%lu",
+ ("Handler require invalidation queries of %s.%s %llu-%llu",
table_block->table()->db(),
table_block->table()->table(),
- (ulong) engine_data,
- (ulong) table_block->table()->engine_data()));
+ engine_data,
+ table_block->table()->engine_data()));
/*
as far as we delete all queries with this table, table block will be
deleted, too
@@ -3500,8 +3500,8 @@ Query_cache::insert_table(THD *thd, uint key_len, const char *key,
if (table_block == 0)
{
- DBUG_PRINT("qcache", ("new table block from 0x%lx (%u)",
- (ulong) key, (int) key_len));
+ DBUG_PRINT("qcache", ("new table block from %p (%u)",
+ key, (int) key_len));
table_block= write_block_data(key_len, (uchar*) key,
ALIGN_SIZE(sizeof(Query_cache_table)),
Query_cache_block::TABLE, 1);
@@ -3710,7 +3710,7 @@ Query_cache::get_free_block(ulong len, my_bool not_less, ulong min)
if (block != 0)
exclude_from_free_memory_list(block);
- DBUG_PRINT("qcache",("getting block 0x%lx", (ulong) block));
+ DBUG_PRINT("qcache",("getting block %p", block));
DBUG_RETURN(block);
}
@@ -3721,9 +3721,9 @@ void Query_cache::free_memory_block(Query_cache_block *block)
block->used=0;
block->type= Query_cache_block::FREE; // mark block as free in any case
DBUG_PRINT("qcache",
- ("first_block 0x%lx, block 0x%lx, pnext 0x%lx pprev 0x%lx",
- (ulong) first_block, (ulong) block, (ulong) block->pnext,
- (ulong) block->pprev));
+ ("first_block %p, block %p, pnext %p pprev %p",
+ first_block, block, block->pnext,
+ block->pprev));
if (block->pnext != first_block && block->pnext->is_free())
block = join_free_blocks(block, block->pnext);
@@ -3755,8 +3755,8 @@ void Query_cache::split_block(Query_cache_block *block, ulong len)
else
free_memory_block(new_block);
- DBUG_PRINT("qcache", ("split 0x%lx (%lu) new 0x%lx",
- (ulong) block, len, (ulong) new_block));
+ DBUG_PRINT("qcache", ("split %p (%lu) new %p",
+ block, len, new_block));
DBUG_VOID_RETURN;
}
@@ -3768,9 +3768,9 @@ Query_cache::join_free_blocks(Query_cache_block *first_block_arg,
Query_cache_block *second_block;
DBUG_ENTER("Query_cache::join_free_blocks");
DBUG_PRINT("qcache",
- ("join first 0x%lx, pnext 0x%lx, in list 0x%lx",
- (ulong) first_block_arg, (ulong) first_block_arg->pnext,
- (ulong) block_in_list));
+ ("join first %p, pnext %p, in list %p",
+ first_block_arg, first_block_arg->pnext,
+ block_in_list));
exclude_from_free_memory_list(block_in_list);
second_block = first_block_arg->pnext;
@@ -3792,7 +3792,7 @@ my_bool Query_cache::append_next_free_block(Query_cache_block *block,
{
Query_cache_block *next_block = block->pnext;
DBUG_ENTER("Query_cache::append_next_free_block");
- DBUG_PRINT("enter", ("block 0x%lx, add_size %lu", (ulong) block,
+ DBUG_PRINT("enter", ("block %p, add_size %lu", block,
add_size));
if (next_block != first_block && next_block->is_free())
@@ -3824,8 +3824,8 @@ void Query_cache::exclude_from_free_memory_list(Query_cache_block *free_block)
bin->number--;
free_memory-=free_block->length;
free_memory_blocks--;
- DBUG_PRINT("qcache",("exclude block 0x%lx, bin 0x%lx", (ulong) free_block,
- (ulong) bin));
+ DBUG_PRINT("qcache",("exclude block %p, bin %p", free_block,
+ bin));
DBUG_VOID_RETURN;
}
@@ -3842,8 +3842,8 @@ void Query_cache::insert_into_free_memory_list(Query_cache_block *free_block)
free_block->data());
*bin_ptr = bins+idx;
(*bin_ptr)->number++;
- DBUG_PRINT("qcache",("insert block 0x%lx, bin[%d] 0x%lx",
- (ulong) free_block, idx, (ulong) *bin_ptr));
+ DBUG_PRINT("qcache",("insert block %p, bin[%d] %p",
+ free_block, idx, *bin_ptr));
DBUG_VOID_RETURN;
}
@@ -3940,7 +3940,7 @@ Query_cache::double_linked_list_simple_include(Query_cache_block *point,
list_pointer)
{
DBUG_ENTER("Query_cache::double_linked_list_simple_include");
- DBUG_PRINT("qcache", ("including block 0x%lx", (ulong) point));
+ DBUG_PRINT("qcache", ("including block %p", point));
if (*list_pointer == 0)
*list_pointer=point->next=point->prev=point;
else
@@ -3959,8 +3959,8 @@ Query_cache::double_linked_list_exclude(Query_cache_block *point,
Query_cache_block **list_pointer)
{
DBUG_ENTER("Query_cache::double_linked_list_exclude");
- DBUG_PRINT("qcache", ("excluding block 0x%lx, list 0x%lx",
- (ulong) point, (ulong) list_pointer));
+ DBUG_PRINT("qcache", ("excluding block %p, list %p",
+ point, list_pointer));
if (point->next == point)
*list_pointer = 0; // empty list
else
@@ -4255,7 +4255,7 @@ my_bool Query_cache::move_by_type(uchar **border,
switch (block->type) {
case Query_cache_block::FREE:
{
- DBUG_PRINT("qcache", ("block 0x%lx FREE", (ulong) block));
+ DBUG_PRINT("qcache", ("block %p FREE", block));
if (*border == 0)
{
*border = (uchar *) block;
@@ -4274,7 +4274,7 @@ my_bool Query_cache::move_by_type(uchar **border,
case Query_cache_block::TABLE:
{
HASH_SEARCH_STATE record_idx;
- DBUG_PRINT("qcache", ("block 0x%lx TABLE", (ulong) block));
+ DBUG_PRINT("qcache", ("block %p TABLE", block));
if (*border == 0)
break;
ulong len = block->length, used = block->used;
@@ -4310,9 +4310,9 @@ my_bool Query_cache::move_by_type(uchar **border,
nlist_root->prev = tprev;
tprev->next = nlist_root;
DBUG_PRINT("qcache",
- ("list_root: 0x%lx tnext 0x%lx tprev 0x%lx tprev->next 0x%lx tnext->prev 0x%lx",
- (ulong) list_root, (ulong) tnext, (ulong) tprev,
- (ulong)tprev->next, (ulong)tnext->prev));
+ ("list_root: %p tnext %p tprev %p tprev->next %p tnext->prev %p",
+ list_root, tnext, tprev,
+ tprev->next,tnext->prev));
/*
Go through all queries that uses this table and change them to
point to the new table object
@@ -4327,14 +4327,14 @@ 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 0x%lx, new gap at 0x%lx",
- len, (ulong) new_block, (ulong) *border));
+ DBUG_PRINT("qcache", ("moved %lu bytes to %p, new gap at %p",
+ len, new_block, *border));
break;
}
case Query_cache_block::QUERY:
{
HASH_SEARCH_STATE record_idx;
- DBUG_PRINT("qcache", ("block 0x%lx QUERY", (ulong) block));
+ DBUG_PRINT("qcache", ("block %p QUERY", block));
if (*border == 0)
break;
BLOCK_LOCK_WR(block);
@@ -4420,8 +4420,8 @@ 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 0x%lx, new gap at 0x%lx",
- len, (ulong) new_block, (ulong) *border));
+ DBUG_PRINT("qcache", ("moved %lu bytes to %p, new gap at %p",
+ len, new_block, *border));
break;
}
case Query_cache_block::RES_INCOMPLETE:
@@ -4429,7 +4429,7 @@ my_bool Query_cache::move_by_type(uchar **border,
case Query_cache_block::RES_CONT:
case Query_cache_block::RESULT:
{
- DBUG_PRINT("qcache", ("block 0x%lx RES* (%d)", (ulong) block,
+ DBUG_PRINT("qcache", ("block %p RES* (%d)", block,
(int) block->type));
if (*border == 0)
break;
@@ -4469,13 +4469,13 @@ my_bool Query_cache::move_by_type(uchar **border,
new_block->length -= free_space;
}
BLOCK_UNLOCK_WR(query_block);
- DBUG_PRINT("qcache", ("moved %lu bytes to 0x%lx, new gap at 0x%lx",
- len, (ulong) new_block, (ulong) *border));
+ DBUG_PRINT("qcache", ("moved %lu bytes to %p, new gap at %p",
+ len, new_block, *border));
break;
}
default:
- DBUG_PRINT("error", ("unexpected block type %d, block 0x%lx",
- (int)block->type, (ulong) block));
+ DBUG_PRINT("error", ("unexpected block type %d, block %p",
+ (int)block->type, block));
ok = 0;
}
DBUG_RETURN(ok);
@@ -4676,16 +4676,16 @@ void Query_cache::bins_dump()
DBUG_PRINT("qcache", ("-------------------------"));
for (i=0; i < mem_bin_num; i++)
{
- DBUG_PRINT("qcache", ("%10lu %3d 0x%lx", bins[i].size, bins[i].number,
- (ulong)&(bins[i])));
+ DBUG_PRINT("qcache", ("%10lu %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 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx",
- block->length, (ulong)block,
- (ulong)block->next, (ulong)block->prev,
- (ulong)block->pnext, (ulong)block->pprev));
+ DBUG_PRINT("qcache", ("\\-- %lu %p %p %p %p %p",
+ block->length,block,
+ block->next,block->prev,
+ block->pnext,block->pprev));
block = block->next;
} while ( block != bins[i].free_blocks );
}
@@ -4709,11 +4709,11 @@ void Query_cache::cache_dump()
do
{
DBUG_PRINT("qcache",
- ("%10lu %10lu %1d %2d 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx",
+ ("%10lu %10lu %1d %2d %p %p %p %p %p",
i->length, i->used, (int)i->type,
- i->n_tables, (ulong)i,
- (ulong)i->next, (ulong)i->prev, (ulong)i->pnext,
- (ulong)i->pprev));
+ i->n_tables,i,
+ i->next,i->prev,i->pnext,
+ i->pprev));
i = i->pnext;
} while ( i != first_block );
DBUG_PRINT("qcache", ("-------------------------------------"));
@@ -4743,15 +4743,15 @@ void Query_cache::queries_dump()
Query_cache_query_flags flags;
memcpy(&flags, str+len, QUERY_CACHE_FLAGS_SIZE);
str[len]= 0; // make zero ending DB name
- DBUG_PRINT("qcache", ("F: %u C: %u L: %lu T: '%s' (%lu) '%s' '%s'",
+ DBUG_PRINT("qcache", ("F: %u C: %u L: %llu T: '%s' (%zu) '%s' '%s'",
flags.client_long_flag,
flags.character_set_client_num,
- (ulong)flags.limit,
+ flags.limit,
flags.time_zone->get_name()->ptr(),
- (ulong) len, str, strend(str)+1));
- DBUG_PRINT("qcache", ("-b- 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx", (ulong) block,
- (ulong) block->next, (ulong) block->prev,
- (ulong)block->pnext, (ulong)block->pprev));
+ len, str, strend(str)+1));
+ DBUG_PRINT("qcache", ("-b- %p %p %p %p %p", block,
+ block->next, block->prev,
+ block->pnext,block->pprev));
memcpy(str + len, &flags, QUERY_CACHE_FLAGS_SIZE); // restore flags
for (TABLE_COUNTER_TYPE t= 0; t < block->n_tables; t++)
{
@@ -4765,14 +4765,14 @@ void Query_cache::queries_dump()
Query_cache_block *result_beg = result_block;
do
{
- DBUG_PRINT("qcache", ("-r- %u %lu/%lu 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx",
+ DBUG_PRINT("qcache", ("-r- %u %lu/%lu %p %p %p %p %p",
(uint) result_block->type,
result_block->length, result_block->used,
- (ulong) result_block,
- (ulong) result_block->next,
- (ulong) result_block->prev,
- (ulong) result_block->pnext,
- (ulong) result_block->pprev));
+ result_block,
+ result_block->next,
+ result_block->prev,
+ result_block->pnext,
+ result_block->pprev));
result_block = result_block->next;
} while ( result_block != result_beg );
}
@@ -4851,14 +4851,14 @@ my_bool Query_cache::check_integrity(bool locked)
if (!block)
break;
- DBUG_PRINT("qcache", ("block 0x%lx, type %u...",
- (ulong) block, (uint) block->type));
+ DBUG_PRINT("qcache", ("block %p, type %u...",
+ block, (uint) block->type));
// Check allignment
- if ((((long)block) % (long) ALIGN_SIZE(1)) !=
- (((long)first_block) % (long)ALIGN_SIZE(1)))
+ if ((((size_t)block) % ALIGN_SIZE(1)) !=
+ (((size_t)first_block) % ALIGN_SIZE(1)))
{
DBUG_PRINT("error",
- ("block 0x%lx do not aligned by %d", (ulong) block,
+ ("block %p do not aligned by %d", block,
(int) ALIGN_SIZE(1)));
result = 1;
}
@@ -4869,10 +4869,10 @@ my_bool Query_cache::check_integrity(bool locked)
((uchar*)first_block) + query_cache_size)
{
DBUG_PRINT("error",
- ("block 0x%lx, type %u, ended at 0x%lx, but cache ended at 0x%lx",
- (ulong) block, (uint) block->type,
- (ulong) (((uchar*)block) + block->length),
- (ulong) (((uchar*)first_block) + query_cache_size)));
+ ("block %p, type %u, ended at %p, but cache ended at %p",
+ block, (uint) block->type,
+ (((uchar*)block) + block->length),
+ (((uchar*)first_block) + query_cache_size)));
result = 1;
}
}
@@ -4880,10 +4880,10 @@ my_bool Query_cache::check_integrity(bool locked)
if (((uchar*)block) + block->length != ((uchar*)block->pnext))
{
DBUG_PRINT("error",
- ("block 0x%lx, type %u, ended at 0x%lx, but next block beginning at 0x%lx",
- (ulong) block, (uint) block->type,
- (ulong) (((uchar*)block) + block->length),
- (ulong) ((uchar*)block->pnext)));
+ ("block %p, type %u, ended at %p, but next block beginning at %p",
+ block, (uint) block->type,
+ (((uchar*)block) + block->length),
+ ((uchar*)block->pnext)));
}
if (block->type == Query_cache_block::FREE)
free+= block->length;
@@ -4899,11 +4899,11 @@ my_bool Query_cache::check_integrity(bool locked)
((uchar*)bin) >= ((uchar*)first_block))
{
DBUG_PRINT("error",
- ("free block 0x%lx have bin pointer 0x%lx beyaond of bins array bounds [0x%lx,0x%lx]",
- (ulong) block,
- (ulong) bin,
- (ulong) bins,
- (ulong) first_block));
+ ("free block %p have bin pointer %p beyaond of bins array bounds [%p,%p]",
+ block,
+ bin,
+ bins,
+ first_block));
result = 1;
}
else
@@ -4950,11 +4950,11 @@ my_bool Query_cache::check_integrity(bool locked)
((uchar*)query_block) >= (((uchar*)first_block) + query_cache_size))
{
DBUG_PRINT("error",
- ("result block 0x%lx have query block pointer 0x%lx beyaond of block pool bounds [0x%lx,0x%lx]",
- (ulong) block,
- (ulong) query_block,
- (ulong) first_block,
- (ulong) (((uchar*)first_block) + query_cache_size)));
+ ("result block %p have query block pointer %p beyaond of block pool bounds [%p,%p]",
+ block,
+ query_block,
+ first_block,
+ (((uchar*)first_block) + query_cache_size)));
result = 1;
}
else
@@ -4970,8 +4970,8 @@ my_bool Query_cache::check_integrity(bool locked)
break;
}
default:
- DBUG_PRINT("error", ("block 0x%lx have incorrect type %u",
- (long) block, block->type));
+ DBUG_PRINT("error", ("block %p have incorrect type %u",
+ block, block->type));
result = 1;
}
@@ -4999,15 +4999,15 @@ my_bool Query_cache::check_integrity(bool locked)
{
do
{
- DBUG_PRINT("qcache", ("block 0x%lx, type %u...",
- (ulong) block, (uint) block->type));
+ DBUG_PRINT("qcache", ("block %p, type %u...",
+ block, (uint) block->type));
size_t length;
uchar *key = query_cache_query_get_key((uchar*) block, &length, 0);
uchar* val = my_hash_search(&queries, key, length);
if (((uchar*)block) != val)
{
- DBUG_PRINT("error", ("block 0x%lx found in queries hash like 0x%lx",
- (ulong) block, (ulong) val));
+ DBUG_PRINT("error", ("block %p found in queries hash like %p",
+ block, val));
}
if (in_blocks(block))
result = 1;
@@ -5017,8 +5017,8 @@ my_bool Query_cache::check_integrity(bool locked)
Query_cache_block * result_block = results;
do
{
- DBUG_PRINT("qcache", ("block 0x%lx, type %u...",
- (ulong) block, (uint) block->type));
+ DBUG_PRINT("qcache", ("block %p, type %u...",
+ block, (uint) block->type));
if (in_blocks(result_block))
result = 1;
@@ -5034,15 +5034,15 @@ my_bool Query_cache::check_integrity(bool locked)
{
do
{
- DBUG_PRINT("qcache", ("block 0x%lx, type %u...",
- (ulong) block, (uint) block->type));
+ DBUG_PRINT("qcache", ("block %p, type %u...",
+ block, (uint) block->type));
size_t length;
uchar *key = query_cache_table_get_key((uchar*) block, &length, 0);
uchar* val = my_hash_search(&tables, key, length);
if (((uchar*)block) != val)
{
- DBUG_PRINT("error", ("block 0x%lx found in tables hash like 0x%lx",
- (ulong) block, (ulong) val));
+ DBUG_PRINT("error", ("block %p found in tables hash like %p",
+ block, val));
}
if (in_blocks(block))
@@ -5059,8 +5059,8 @@ my_bool Query_cache::check_integrity(bool locked)
uint count = 0;
do
{
- DBUG_PRINT("qcache", ("block 0x%lx, type %u...",
- (ulong) block, (uint) block->type));
+ DBUG_PRINT("qcache", ("block %p, type %u...",
+ block, (uint) block->type));
if (in_blocks(block))
result = 1;
@@ -5092,13 +5092,13 @@ my_bool Query_cache::in_blocks(Query_cache_block * point)
if (block->pprev->pnext != block)
{
DBUG_PRINT("error",
- ("block 0x%lx in physical list is incorrect linked, prev block 0x%lx refered as next to 0x%lx (check from 0x%lx)",
- (ulong) block, (ulong) block->pprev,
- (ulong) block->pprev->pnext,
- (ulong) point));
+ ("block %p in physical list is incorrect linked, prev block %p refered as next to %p (check from %p)",
+ block, block->pprev,
+ block->pprev->pnext,
+ point));
//back trace
for (; block != point; block = block->pnext)
- DBUG_PRINT("error", ("back trace 0x%lx", (ulong) block));
+ DBUG_PRINT("error", ("back trace %p", block));
result = 1;
goto err1;
}
@@ -5107,8 +5107,8 @@ my_bool Query_cache::in_blocks(Query_cache_block * point)
if (block != first_block)
{
DBUG_PRINT("error",
- ("block 0x%lx (0x%lx<-->0x%lx) not owned by pysical list",
- (ulong) block, (ulong) block->pprev, (ulong )block->pnext));
+ ("block %p (%p<-->%p) not owned by pysical list",
+ block, block->pprev, block->pnext));
return 1;
}
@@ -5120,13 +5120,13 @@ err1:
if (block->pnext->pprev != block)
{
DBUG_PRINT("error",
- ("block 0x%lx in physicel list is incorrect linked, next block 0x%lx refered as prev to 0x%lx (check from 0x%lx)",
- (ulong) block, (ulong) block->pnext,
- (ulong) block->pnext->pprev,
- (ulong) point));
+ ("block %p in physicel list is incorrect linked, next block %p refered as prev to %p (check from %p)",
+ block, block->pnext,
+ block->pnext->pprev,
+ point));
//back trace
for (; block != point; block = block->pprev)
- DBUG_PRINT("error", ("back trace 0x%lx", (ulong) block));
+ DBUG_PRINT("error", ("back trace %p", block));
result = 1;
goto err2;
}
@@ -5149,13 +5149,13 @@ my_bool Query_cache::in_list(Query_cache_block * root,
if (block->prev->next != block)
{
DBUG_PRINT("error",
- ("block 0x%lx in list '%s' 0x%lx is incorrect linked, prev block 0x%lx refered as next to 0x%lx (check from 0x%lx)",
- (ulong) block, name, (ulong) root, (ulong) block->prev,
- (ulong) block->prev->next,
- (ulong) point));
+ ("block %p in list '%s' %p is incorrect linked, prev block %p refered as next to %p (check from %p)",
+ block, name, root, block->prev,
+ block->prev->next,
+ point));
//back trace
for (; block != point; block = block->next)
- DBUG_PRINT("error", ("back trace 0x%lx", (ulong) block));
+ DBUG_PRINT("error", ("back trace %p", block));
result = 1;
goto err1;
}
@@ -5164,10 +5164,10 @@ my_bool Query_cache::in_list(Query_cache_block * root,
if (block != root)
{
DBUG_PRINT("error",
- ("block 0x%lx (0x%lx<-->0x%lx) not owned by list '%s' 0x%lx",
- (ulong) block,
- (ulong) block->prev, (ulong) block->next,
- name, (ulong) root));
+ ("block %p (%p<-->%p) not owned by list '%s' %p",
+ block,
+ block->prev, block->next,
+ name, root));
return 1;
}
err1:
@@ -5178,13 +5178,13 @@ err1:
if (block->next->prev != block)
{
DBUG_PRINT("error",
- ("block 0x%lx in list '%s' 0x%lx is incorrect linked, next block 0x%lx refered as prev to 0x%lx (check from 0x%lx)",
- (ulong) block, name, (ulong) root, (ulong) block->next,
- (ulong) block->next->prev,
- (ulong) point));
+ ("block %p in list '%s' %p is incorrect linked, next block %p refered as prev to %p (check from %p)",
+ block, name, root, block->next,
+ block->next->prev,
+ point));
//back trace
for (; block != point; block = block->prev)
- DBUG_PRINT("error", ("back trace 0x%lx", (ulong) block));
+ DBUG_PRINT("error", ("back trace %p", block));
result = 1;
goto err2;
}
@@ -5197,13 +5197,13 @@ err2:
void dump_node(Query_cache_block_table * node,
const char * call, const char * descr)
{
- DBUG_PRINT("qcache", ("%s: %s: node: 0x%lx", call, descr, (ulong) node));
- DBUG_PRINT("qcache", ("%s: %s: node block: 0x%lx",
- call, descr, (ulong) node->block()));
- DBUG_PRINT("qcache", ("%s: %s: next: 0x%lx", call, descr,
- (ulong) node->next));
- DBUG_PRINT("qcache", ("%s: %s: prev: 0x%lx", call, descr,
- (ulong) node->prev));
+ DBUG_PRINT("qcache", ("%s: %s: node: %p", call, descr, node));
+ DBUG_PRINT("qcache", ("%s: %s: node block: %p",
+ call, descr, node->block()));
+ DBUG_PRINT("qcache", ("%s: %s: next: %p", call, descr,
+ node->next));
+ DBUG_PRINT("qcache", ("%s: %s: prev: %p", call, descr,
+ node->prev));
}
my_bool Query_cache::in_table_list(Query_cache_block_table * root,
@@ -5220,17 +5220,17 @@ my_bool Query_cache::in_table_list(Query_cache_block_table * root,
if (table->prev->next != table)
{
DBUG_PRINT("error",
- ("table 0x%lx(0x%lx) in list '%s' 0x%lx(0x%lx) is incorrect linked, prev table 0x%lx(0x%lx) refered as next to 0x%lx(0x%lx) (check from 0x%lx(0x%lx))",
- (ulong) table, (ulong) table->block(), name,
- (ulong) root, (ulong) root->block(),
- (ulong) table->prev, (ulong) table->prev->block(),
- (ulong) table->prev->next,
- (ulong) table->prev->next->block(),
- (ulong) point, (ulong) point->block()));
+ ("table %p(%p) in list '%s' %p(%p) is incorrect linked, prev table %p(%p) refered as next to %p(%p) (check from %p(%p))",
+ table, table->block(), name,
+ root, root->block(),
+ table->prev, table->prev->block(),
+ table->prev->next,
+ table->prev->next->block(),
+ point, point->block()));
//back trace
for (; table != point; table = table->next)
- DBUG_PRINT("error", ("back trace 0x%lx(0x%lx)",
- (ulong) table, (ulong) table->block()));
+ DBUG_PRINT("error", ("back trace %p(%p)",
+ table, table->block()));
result = 1;
goto err1;
}
@@ -5239,11 +5239,11 @@ my_bool Query_cache::in_table_list(Query_cache_block_table * root,
if (table != root)
{
DBUG_PRINT("error",
- ("table 0x%lx(0x%lx) (0x%lx(0x%lx)<-->0x%lx(0x%lx)) not owned by list '%s' 0x%lx(0x%lx)",
- (ulong) table, (ulong) table->block(),
- (ulong) table->prev, (ulong) table->prev->block(),
- (ulong) table->next, (ulong) table->next->block(),
- name, (ulong) root, (ulong) root->block()));
+ ("table %p(%p) (%p(%p)<-->%p(%p)) not owned by list '%s' %p(%p)",
+ table, table->block(),
+ table->prev, table->prev->block(),
+ table->next, table->next->block(),
+ name, root, root->block()));
return 1;
}
err1:
@@ -5255,17 +5255,17 @@ err1:
if (table->next->prev != table)
{
DBUG_PRINT("error",
- ("table 0x%lx(0x%lx) in list '%s' 0x%lx(0x%lx) is incorrect linked, next table 0x%lx(0x%lx) refered as prev to 0x%lx(0x%lx) (check from 0x%lx(0x%lx))",
- (ulong) table, (ulong) table->block(),
- name, (ulong) root, (ulong) root->block(),
- (ulong) table->next, (ulong) table->next->block(),
- (ulong) table->next->prev,
- (ulong) table->next->prev->block(),
- (ulong) point, (ulong) point->block()));
+ ("table %p(%p) in list '%s' %p(%p) is incorrect linked, next table %p(%p) refered as prev to %p(%p) (check from %p(%p))",
+ table, table->block(),
+ name, root, root->block(),
+ table->next, table->next->block(),
+ table->next->prev,
+ table->next->prev->block(),
+ point, point->block()));
//back trace
for (; table != point; table = table->prev)
- DBUG_PRINT("error", ("back trace 0x%lx(0x%lx)",
- (ulong) table, (ulong) table->block()));
+ DBUG_PRINT("error", ("back trace %p(%p)",
+ table, table->block()));
result = 1;
goto err2;
}
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index 3230034cf74..07a80f778b8 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -557,8 +557,8 @@ struct Query_cache_query_flags
ha_rows limit;
Time_zone *time_zone;
sql_mode_t sql_mode;
- ulong max_sort_length;
- ulong group_concat_max_len;
+ ulonglong max_sort_length;
+ ulonglong group_concat_max_len;
ulong default_week_format;
ulong div_precision_increment;
MY_LOCALE *lc_time_names;
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 1e69535d00c..b40ee63fac6 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -569,8 +569,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 %p, query id %lu",
- (ulong) thd->thread_id, (void*) thd->real_id, (ulong) thd->query_id);
+ "MySQL thread id %lu, OS thread handle %lu, query id %lu",
+ (ulong) thd->thread_id, (ulong) thd->real_id, (ulong) thd->query_id);
str.length(0);
str.append(header, len);
@@ -936,7 +936,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
by adding the address of the stack.
*/
tmp= (ulong) (my_rnd(&sql_rand) * 0xffffffff);
- my_rnd_init(&rand, tmp + (ulong) &rand, tmp + (ulong) ::global_query_id);
+ my_rnd_init(&rand, tmp + (ulong)((size_t) &rand), tmp + (ulong) ::global_query_id);
substitute_null_with_insert_id = FALSE;
lock_info.mysql_thd= (void *)this;
@@ -1177,13 +1177,13 @@ Sql_condition* THD::raise_condition(uint sql_errno,
}
extern "C"
-void *thd_alloc(MYSQL_THD thd, unsigned int size)
+void *thd_alloc(MYSQL_THD thd, size_t size)
{
return thd->alloc(size);
}
extern "C"
-void *thd_calloc(MYSQL_THD thd, unsigned int size)
+void *thd_calloc(MYSQL_THD thd, size_t size)
{
return thd->calloc(size);
}
@@ -1195,14 +1195,14 @@ char *thd_strdup(MYSQL_THD thd, const char *str)
}
extern "C"
-char *thd_strmake(MYSQL_THD thd, const char *str, unsigned int size)
+char *thd_strmake(MYSQL_THD thd, const char *str, size_t size)
{
return thd->strmake(str, size);
}
extern "C"
LEX_CSTRING *thd_make_lex_string(THD *thd, LEX_CSTRING *lex_str,
- const char *str, unsigned int size,
+ const char *str, size_t size,
int allocate_lex_string)
{
return allocate_lex_string ? thd->make_clex_string(str, size)
@@ -1210,7 +1210,7 @@ LEX_CSTRING *thd_make_lex_string(THD *thd, LEX_CSTRING *lex_str,
}
extern "C"
-void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size)
+void *thd_memdup(MYSQL_THD thd, const void* str, size_t size)
{
return thd->memdup(str, size);
}
@@ -3617,7 +3617,7 @@ void Query_arena::free_items()
{
next= free_list->next;
DBUG_ASSERT(free_list != next);
- DBUG_PRINT("info", ("free item: 0x%lx", (ulong) free_list));
+ DBUG_PRINT("info", ("free item: %p", free_list));
free_list->delete_self();
}
/* Postcondition: free_list is 0 */
@@ -4086,7 +4086,7 @@ int select_materialize_with_stats::send_data(List<Item> &items)
void TMP_TABLE_PARAM::init()
{
DBUG_ENTER("TMP_TABLE_PARAM::init");
- DBUG_PRINT("enter", ("this: 0x%lx", (ulong)this));
+ DBUG_PRINT("enter", ("this: %p", this));
field_count= sum_func_count= func_count= hidden_field_count= 0;
group_parts= group_length= group_null_parts= 0;
quick_group= 1;
@@ -5334,9 +5334,9 @@ void THD::inc_status_sort_range()
void THD::inc_status_sort_rows(ha_rows count)
{
- statistic_add(status_var.filesort_rows_, count, &LOCK_status);
+ statistic_add(status_var.filesort_rows_, (ulong)count, &LOCK_status);
#ifdef HAVE_PSI_STATEMENT_INTERFACE
- PSI_STATEMENT_CALL(inc_statement_sort_rows)(m_statement_psi, count);
+ PSI_STATEMENT_CALL(inc_statement_sort_rows)(m_statement_psi, (ulong)count);
#endif
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index a957bb67726..96a3cc3522f 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -3884,7 +3884,7 @@ public:
mysql_mutex_unlock(&LOCK_thd_data);
#ifdef HAVE_PSI_THREAD_INTERFACE
if (result)
- PSI_THREAD_CALL(set_thread_db)(new_db, new_db_len);
+ PSI_THREAD_CALL(set_thread_db)(new_db, (int) new_db_len);
#endif
return result;
}
@@ -3909,7 +3909,7 @@ public:
db_length= new_db_len;
mysql_mutex_unlock(&LOCK_thd_data);
#ifdef HAVE_PSI_THREAD_INTERFACE
- PSI_THREAD_CALL(set_thread_db)(new_db, new_db_len);
+ PSI_THREAD_CALL(set_thread_db)(new_db, (int) new_db_len);
#endif
}
}
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index a9275bd39fd..17e2404fdf1 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -45,7 +45,7 @@
// end_read_record
#include "sql_partition.h" // make_used_partitions_str
-#define MEM_STRIP_BUF_SIZE thd->variables.sortbuff_size
+#define MEM_STRIP_BUF_SIZE ((size_t) thd->variables.sortbuff_size)
/*
@brief
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 5244a083939..8dff001d4d0 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -641,7 +641,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
SELECT_LEX_UNIT *unit= derived->get_unit();
DBUG_ENTER("mysql_derived_prepare");
bool res= FALSE;
- DBUG_PRINT("enter", ("unit 0x%lx", (ulong) unit));
+ DBUG_PRINT("enter", ("unit %p", unit));
if (!unit)
DBUG_RETURN(FALSE);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 1bfde721a34..3d81ab35373 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1472,8 +1472,8 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
bool res= 0;
table_map map= 0;
DBUG_ENTER("mysql_prepare_insert");
- DBUG_PRINT("enter", ("table_list: 0x%lx table: 0x%lx view: %d",
- (ulong)table_list, (ulong)table,
+ DBUG_PRINT("enter", ("table_list: %p table: %p view: %d",
+ table_list, table,
(int)insert_into_view));
/* INSERT should have a SELECT or VALUES clause */
DBUG_ASSERT (!select_insert || !values);
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index 5a11bb82cbe..41741f3dcc7 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -695,7 +695,7 @@ void JOIN_CACHE::set_constants()
pack_length_with_blob_ptrs= pack_length + blobs*sizeof(uchar *);
min_buff_size= 0;
min_records= 1;
- buff_size= MY_MAX(join->thd->variables.join_buff_size,
+ buff_size= (size_t)MY_MAX(join->thd->variables.join_buff_size,
get_min_join_buffer_size());
size_of_rec_ofs= offset_size(buff_size);
size_of_rec_len= blobs ? size_of_rec_ofs : offset_size(len);
@@ -840,7 +840,7 @@ ulong JOIN_CACHE::get_max_join_buffer_size(bool optimize_buff_size)
len+= get_max_key_addon_space_per_record() + avg_aux_buffer_incr;
space_per_record= len;
- size_t limit_sz= join->thd->variables.join_buff_size;
+ size_t limit_sz= (size_t)join->thd->variables.join_buff_size;
if (join_tab->join_buffer_size_limit)
set_if_smaller(limit_sz, join_tab->join_buffer_size_limit);
if (!optimize_buff_size)
@@ -3828,7 +3828,7 @@ uint JOIN_TAB_SCAN_MRR::aux_buffer_incr(ulong recno)
set_if_bigger(rec_per_key, 1);
if (recno == 1)
incr= ref->key_length + tab->file->ref_length;
- incr+= tab->file->stats.mrr_length_per_rec * rec_per_key;
+ incr+= (uint)(tab->file->stats.mrr_length_per_rec * rec_per_key);
return incr;
}
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index b080fb7f822..169f33f81e2 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -391,7 +391,7 @@ void Lex_input_stream::body_utf8_append(const char *ptr,
if (m_cpp_utf8_processed_ptr >= ptr)
return;
- int bytes_to_copy= ptr - m_cpp_utf8_processed_ptr;
+ size_t bytes_to_copy= ptr - m_cpp_utf8_processed_ptr;
memcpy(m_body_utf8_ptr, m_cpp_utf8_processed_ptr, bytes_to_copy);
m_body_utf8_ptr += bytes_to_copy;
@@ -779,7 +779,7 @@ void LEX::start(THD *thd_arg)
void lex_end(LEX *lex)
{
DBUG_ENTER("lex_end");
- DBUG_PRINT("enter", ("lex: 0x%lx", (long) lex));
+ DBUG_PRINT("enter", ("lex: %p", lex));
lex_end_stage1(lex);
lex_end_stage2(lex);
@@ -2682,7 +2682,7 @@ bool st_select_lex::add_gorder_to_list(THD *thd, Item *item, bool asc)
bool st_select_lex::add_item_to_list(THD *thd, Item *item)
{
DBUG_ENTER("st_select_lex::add_item_to_list");
- DBUG_PRINT("info", ("Item: 0x%lx", (long) item));
+ DBUG_PRINT("info", ("Item: %p", item));
DBUG_RETURN(item_list.push_back(item, thd->mem_root));
}
@@ -4789,9 +4789,9 @@ bool LEX::set_arena_for_set_stmt(Query_arena *backup)
Query_arena_memroot(mem_root_for_set_stmt,
Query_arena::STMT_INITIALIZED)))
DBUG_RETURN(1);
- DBUG_PRINT("info", ("mem_root: 0x%lx arena: 0x%lx",
- (ulong) mem_root_for_set_stmt,
- (ulong) arena_for_set_stmt));
+ DBUG_PRINT("info", ("mem_root: %p arena: %p",
+ mem_root_for_set_stmt,
+ arena_for_set_stmt));
thd->set_n_backup_active_arena(arena_for_set_stmt, backup);
DBUG_RETURN(0);
}
@@ -4802,9 +4802,9 @@ void LEX::reset_arena_for_set_stmt(Query_arena *backup)
DBUG_ENTER("LEX::reset_arena_for_set_stmt");
DBUG_ASSERT(arena_for_set_stmt);
thd->restore_active_arena(arena_for_set_stmt, backup);
- DBUG_PRINT("info", ("mem_root: 0x%lx arena: 0x%lx",
- (ulong) arena_for_set_stmt->mem_root,
- (ulong) arena_for_set_stmt));
+ DBUG_PRINT("info", ("mem_root: %p arena: %p",
+ arena_for_set_stmt->mem_root,
+ arena_for_set_stmt));
DBUG_VOID_RETURN;
}
@@ -4814,9 +4814,9 @@ void LEX::free_arena_for_set_stmt()
DBUG_ENTER("LEX::free_arena_for_set_stmt");
if (!arena_for_set_stmt)
return;
- DBUG_PRINT("info", ("mem_root: 0x%lx arena: 0x%lx",
- (ulong) arena_for_set_stmt->mem_root,
- (ulong) arena_for_set_stmt));
+ DBUG_PRINT("info", ("mem_root: %p arena: %p",
+ arena_for_set_stmt->mem_root,
+ arena_for_set_stmt));
arena_for_set_stmt->free_items();
delete(arena_for_set_stmt);
free_root(mem_root_for_set_stmt, MYF(MY_KEEP_PREALLOC));
diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc
index 8cf849b97d0..8c8aee0cb03 100644
--- a/sql/sql_manager.cc
+++ b/sql/sql_manager.cc
@@ -159,7 +159,7 @@ void stop_handle_manager()
if (manager_thread_in_use)
{
mysql_mutex_lock(&LOCK_manager);
- DBUG_PRINT("quit", ("initiate shutdown of handle manager thread: 0x%lx",
+ DBUG_PRINT("quit", ("initiate shutdown of handle manager thread: %lu",
(ulong)manager_thread));
mysql_cond_signal(&COND_manager);
mysql_mutex_unlock(&LOCK_manager);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 832079c964f..145a12afb52 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1482,10 +1482,10 @@ uint maria_multi_check(THD *thd, char *packet, uint packet_length)
{
char *packet_start= packet;
size_t subpacket_length= net_field_length((uchar **)&packet_start);
- uint length_length= packet_start - packet;
+ size_t length_length= packet_start - packet;
// length of command + 3 bytes where that length was stored
DBUG_PRINT("info", ("sub-packet length: %ld + %d command: %x",
- (ulong)subpacket_length, length_length,
+ (ulong)subpacket_length, (int) length_length,
packet_start[3]));
if (subpacket_length == 0 ||
@@ -1932,7 +1932,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
(The packet is guaranteed to end with an end zero)
*/
arg_end= strend(packet);
- uint arg_length= arg_end - packet;
+ uint arg_length= (uint)(arg_end - packet);
/* Check given table name length. */
if (packet_length - arg_length > NAME_LEN + 1 || arg_length > SAFE_NAME_LEN)
@@ -2173,7 +2173,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
length= my_snprintf(buff, buff_len - 1,
"Uptime: %lu Threads: %d Questions: %lu "
- "Slow queries: %lu Opens: %lu Flush tables: %lu "
+ "Slow queries: %lu Opens: %lu Flush tables: %lld "
"Open tables: %u Queries per second avg: %u.%03u",
uptime,
(int) thread_count, (ulong) thd->query_id,
@@ -2262,7 +2262,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
char *packet_start= packet;
/* We have to store next length because it will be destroyed by '\0' */
size_t next_subpacket_length= net_field_length((uchar **)&packet_start);
- uint next_length_length= packet_start - packet;
+ size_t next_length_length= packet_start - packet;
unsigned char *readbuff= net->buff;
if (net_allocate_new_packet(net, thd, MYF(0)))
@@ -2277,7 +2277,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
{
current_com++;
size_t subpacket_length= next_subpacket_length + next_length_length;
- uint length_length= next_length_length;
+ size_t length_length= next_length_length;
if (subpacket_length < packet_length)
{
packet_start= packet + subpacket_length;
@@ -7666,7 +7666,7 @@ void create_select_for_variable(const char *var_name)
if ((var= get_system_var(thd, OPT_SESSION, tmp, null_clex_str)))
{
end= strxmov(buff, "@@session.", var_name, NullS);
- var->set_name(thd, buff, end-buff, system_charset_info);
+ var->set_name(thd, buff, (uint)(end-buff), system_charset_info);
add_item_to_list(thd, var);
}
DBUG_VOID_RETURN;
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 892b5770c99..c9e78964e2a 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -4884,7 +4884,7 @@ that are reorganised.
{
if (!alt_part_info->use_default_partitions)
{
- DBUG_PRINT("info", ("part_info: 0x%lx", (long) tab_part_info));
+ DBUG_PRINT("info", ("part_info: %p", tab_part_info));
tab_part_info->use_default_partitions= FALSE;
}
tab_part_info->use_default_num_partitions= FALSE;
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index ab829c093f6..4d25de0f299 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -775,7 +775,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, int report)
if (global_system_variables.log_warnings > 2)
{
struct link_map *lm = (struct link_map*) plugin_dl.handle;
- sql_print_information("Loaded '%s' with offset 0x%lx", dl->str, lm->l_addr);
+ sql_print_information("Loaded '%s' with offset 0x%zx", dl->str, (size_t)lm->l_addr);
}
#endif
@@ -979,8 +979,8 @@ static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc)
*plugin= pi;
#endif
pi->ref_count++;
- DBUG_PRINT("lock",("thd: 0x%lx plugin: \"%s\" LOCK ref_count: %d",
- (long) current_thd, pi->name.str, pi->ref_count));
+ DBUG_PRINT("lock",("thd: %p plugin: \"%s\" LOCK ref_count: %d",
+ current_thd, pi->name.str, pi->ref_count));
if (lex)
insert_dynamic(&lex->plugins, (uchar*)&plugin);
@@ -1341,8 +1341,8 @@ static void intern_plugin_unlock(LEX *lex, plugin_ref plugin)
DBUG_ASSERT(pi->ref_count);
pi->ref_count--;
- DBUG_PRINT("lock",("thd: 0x%lx plugin: \"%s\" UNLOCK ref_count: %d",
- (long) current_thd, pi->name.str, pi->ref_count));
+ DBUG_PRINT("lock",("thd: %p plugin: \"%s\" UNLOCK ref_count: %d",
+ current_thd, pi->name.str, pi->ref_count));
if (pi->state == PLUGIN_IS_DELETED && !pi->ref_count)
reap_needed= true;
@@ -3249,8 +3249,8 @@ static void plugin_vars_free_values(sys_var *vars)
{
/* Free the string from global_system_variables. */
char **valptr= (char**) piv->real_value_ptr(NULL, OPT_GLOBAL);
- DBUG_PRINT("plugin", ("freeing value for: '%s' addr: 0x%lx",
- var->name.str, (long) valptr));
+ DBUG_PRINT("plugin", ("freeing value for: '%s' addr: %p",
+ var->name.str, valptr));
my_free(*valptr);
*valptr= NULL;
}
@@ -3313,14 +3313,14 @@ uchar* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type)
{
switch (plugin_var->flags & PLUGIN_VAR_TYPEMASK) {
case PLUGIN_VAR_BOOL:
- thd->sys_var_tmp.my_bool_value= option.def_value;
+ thd->sys_var_tmp.my_bool_value= (my_bool)option.def_value;
return (uchar*) &thd->sys_var_tmp.my_bool_value;
case PLUGIN_VAR_INT:
- thd->sys_var_tmp.int_value= option.def_value;
+ thd->sys_var_tmp.int_value= (int)option.def_value;
return (uchar*) &thd->sys_var_tmp.int_value;
case PLUGIN_VAR_LONG:
case PLUGIN_VAR_ENUM:
- thd->sys_var_tmp.long_value= option.def_value;
+ thd->sys_var_tmp.long_value= (long)option.def_value;
return (uchar*) &thd->sys_var_tmp.long_value;
case PLUGIN_VAR_LONGLONG:
case PLUGIN_VAR_SET:
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index f83df07a80f..4df92c71006 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -3227,7 +3227,7 @@ void mysql_sql_stmt_execute(THD *thd)
DBUG_VOID_RETURN;
}
- DBUG_PRINT("info",("stmt: 0x%lx", (long) stmt));
+ DBUG_PRINT("info",("stmt: %p", stmt));
if (lex->prepared_stmt_params_fix_fields(thd))
DBUG_VOID_RETURN;
@@ -3754,8 +3754,8 @@ void Prepared_statement::setup_set_params()
Prepared_statement::~Prepared_statement()
{
DBUG_ENTER("Prepared_statement::~Prepared_statement");
- DBUG_PRINT("enter",("stmt: 0x%lx cursor: 0x%lx",
- (long) this, (long) cursor));
+ DBUG_PRINT("enter",("stmt: %p cursor: %p",
+ this, cursor));
delete cursor;
/*
We have to call free on the items even if cleanup is called as some items,
@@ -3782,7 +3782,7 @@ Query_arena::Type Prepared_statement::type() const
void Prepared_statement::cleanup_stmt()
{
DBUG_ENTER("Prepared_statement::cleanup_stmt");
- DBUG_PRINT("enter",("stmt: 0x%lx", (long) this));
+ DBUG_PRINT("enter",("stmt: %p", this));
thd->restore_set_statement_var();
cleanup_items(free_list);
thd->cleanup_after_query();
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3391ca30905..a4caa4077fa 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -7871,7 +7871,7 @@ double table_cond_selectivity(JOIN *join, uint idx, JOIN_TAB *s,
*/
if (!is_hash_join_key_no(key))
{
- table_map quick_key_map= (table_map(1) << table->quick_key_parts[key]) - 1;
+ key_part_map quick_key_map= (key_part_map(1) << table->quick_key_parts[key]) - 1;
if (table->quick_rows[key] &&
!(quick_key_map & ~table->const_key_parts[key]))
{
@@ -10600,8 +10600,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
tmp_cond= new (thd->mem_root) Item_func_trig_cond(thd, tmp_cond,
&first_inner_tab->
not_null_compl);
- DBUG_PRINT("info", ("Item_func_trig_cond 0x%lx",
- (ulong) tmp_cond));
+ DBUG_PRINT("info", ("Item_func_trig_cond %p",
+ tmp_cond));
if (tmp_cond)
tmp_cond->quick_fix_field();
/* Add the predicate to other pushed down predicates */
@@ -10609,8 +10609,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
*sel_cond_ref= !(*sel_cond_ref) ?
tmp_cond :
new (thd->mem_root) Item_cond_and(thd, *sel_cond_ref, tmp_cond);
- DBUG_PRINT("info", ("Item_cond_and 0x%lx",
- (ulong)(*sel_cond_ref)));
+ DBUG_PRINT("info", ("Item_cond_and %p",
+ (*sel_cond_ref)));
if (!(*sel_cond_ref))
DBUG_RETURN(1);
(*sel_cond_ref)->quick_fix_field();
@@ -20332,9 +20332,9 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
Item *item= *group->item;
if (group->fast_field_copier_setup != group->field)
{
- DBUG_PRINT("info", ("new setup 0x%lx -> 0x%lx",
- (ulong)group->fast_field_copier_setup,
- (ulong)group->field));
+ DBUG_PRINT("info", ("new setup %p -> %p",
+ group->fast_field_copier_setup,
+ group->field));
group->fast_field_copier_setup= group->field;
group->fast_field_copier_func=
item->setup_fast_field_copier(group->field);
@@ -24968,8 +24968,8 @@ int JOIN::save_explain_data_intern(Explain_query *output,
JOIN *join= this; /* Legacy: this code used to be a non-member function */
int cur_error= 0;
DBUG_ENTER("JOIN::save_explain_data_intern");
- DBUG_PRINT("info", ("Select 0x%lx, type %s, message %s",
- (ulong)join->select_lex, join->select_lex->type,
+ DBUG_PRINT("info", ("Select %p, type %s, message %s",
+ join->select_lex, join->select_lex->type,
message ? message : "NULL"));
DBUG_ASSERT(have_query_plan == QEP_AVAILABLE);
/* fake_select_lex is created/printed by Explain_union */
diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc
index bbed5ac8991..5e826dff2e0 100644
--- a/sql/sql_servers.cc
+++ b/sql/sql_servers.cc
@@ -350,8 +350,8 @@ get_server_from_table_to_cache(TABLE *table)
DBUG_PRINT("info", ("server->socket %s", server->socket));
if (my_hash_insert(&servers_cache, (uchar*) server))
{
- DBUG_PRINT("info", ("had a problem inserting server %s at %lx",
- server->server_name, (long unsigned int) server));
+ DBUG_PRINT("info", ("had a problem inserting server %s at %p",
+ server->server_name, server));
// error handling needed here
DBUG_RETURN(TRUE);
}
@@ -431,13 +431,13 @@ 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 %lx, length %d",
- server->server_name, (long unsigned int) server,
+ DBUG_PRINT("info", ("inserting server %s at %p, length %d",
+ server->server_name, server,
server->server_name_length));
if (my_hash_insert(&servers_cache, (uchar*) server))
{
- DBUG_PRINT("info", ("had a problem inserting server %s at %lx",
- server->server_name, (long unsigned int) server));
+ DBUG_PRINT("info", ("had a problem inserting server %s at %p",
+ server->server_name, server));
// error handling needed here
error= 1;
}
@@ -804,8 +804,8 @@ int update_server_record_in_cache(FOREIGN_SERVER *existing,
*/
if (my_hash_insert(&servers_cache, (uchar*)altered))
{
- DBUG_PRINT("info", ("had a problem inserting server %s at %lx",
- altered->server_name, (long unsigned int) altered));
+ DBUG_PRINT("info", ("had a problem inserting server %s at %p",
+ altered->server_name,altered));
error= ER_OUT_OF_RESOURCES;
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index ed0d9ae15e9..4dcc519029c 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2527,7 +2527,7 @@ public:
size_t size __attribute__((unused)))
{ TRASH(ptr, size); }
- ulong thread_id;
+ my_thread_id thread_id;
uint32 os_thread_id;
ulonglong start_time;
uint command;
@@ -2701,7 +2701,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
while ((thd_info=thread_infos.get()))
{
protocol->prepare_for_resend();
- protocol->store((ulonglong) thd_info->thread_id);
+ protocol->store(thd_info->thread_id);
protocol->store(thd_info->user, system_charset_info);
protocol->store(thd_info->host, system_charset_info);
protocol->store(thd_info->db, system_charset_info);
@@ -6563,7 +6563,7 @@ static bool store_trigger(THD *thd, Trigger *trigger,
{
table->field[16]->set_notnull();
thd->variables.time_zone->gmt_sec_to_TIME(&timestamp,
- trigger->create_time/100);
+ (my_time_t)(trigger->create_time/100));
/* timestamp is with 6 digits */
timestamp.second_part= (trigger->create_time % 100) * 10000;
((Field_temporal_with_date*) table->field[16])->store_time_dec(&timestamp,
@@ -9591,7 +9591,7 @@ static bool show_create_trigger_impl(THD *thd, Trigger *trigger)
{
MYSQL_TIME timestamp;
thd->variables.time_zone->gmt_sec_to_TIME(&timestamp,
- trigger->create_time/100);
+ (my_time_t)(trigger->create_time/100));
timestamp.second_part= (trigger->create_time % 100) * 10000;
p->store(&timestamp, 2);
}
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 9a21c0a9144..e07a1cd6820 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -32,9 +32,9 @@
** String functions
*****************************************************************************/
-bool String::real_alloc(uint32 length)
+bool String::real_alloc(size_t length)
{
- uint32 arg_length= ALIGN_SIZE(length + 1);
+ size_t arg_length= ALIGN_SIZE(length + 1);
DBUG_ASSERT(arg_length > length);
if (arg_length <= length)
return TRUE; /* Overflow */
@@ -46,7 +46,8 @@ bool String::real_alloc(uint32 length)
(thread_specific ?
MY_THREAD_SPECIFIC : 0)))))
return TRUE;
- Alloced_length=arg_length;
+ DBUG_ASSERT(length < UINT_MAX32);
+ Alloced_length=(uint32) arg_length;
alloced=1;
}
Ptr[0]=0;
@@ -81,7 +82,7 @@ bool String::real_alloc(uint32 length)
@retval true An error occurred when attempting to allocate memory.
*/
-bool String::realloc_raw(uint32 alloc_length)
+bool String::realloc_raw(size_t alloc_length)
{
if (Alloced_length <= alloc_length)
{
@@ -113,7 +114,8 @@ bool String::realloc_raw(uint32 alloc_length)
else
return TRUE; // Signal error
Ptr= new_ptr;
- Alloced_length= len;
+ DBUG_ASSERT(len < UINT_MAX32);
+ Alloced_length= (uint32)len;
}
return FALSE;
}
@@ -195,7 +197,7 @@ bool String::set_real(double num,uint decimals, CHARSET_INFO *cs)
if (decimals >= FLOATING_POINT_DECIMALS)
{
len= my_gcvt(num, MY_GCVT_ARG_DOUBLE, sizeof(buff) - 1, buff, NULL);
- return copy(buff, len, &my_charset_latin1, cs, &dummy_errors);
+ return copy(buff, (uint)len, &my_charset_latin1, cs, &dummy_errors);
}
len= my_fcvt(num, decimals, buff, NULL);
return copy(buff, (uint32) len, &my_charset_latin1, cs,
@@ -235,10 +237,11 @@ bool String::copy(const String &str)
return FALSE;
}
-bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs)
+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))
memcpy(Ptr,str,arg_length);
Ptr[arg_length]=0;
@@ -495,8 +498,10 @@ bool String::append(const String &s)
Append an ASCII string to the a string of the current character set
*/
-bool String::append(const char *s,uint32 arg_length)
+bool String::append(const char *s,size_t size)
{
+ DBUG_ASSERT(size <= UINT_MAX32);
+ uint32 arg_length= (uint32) size;
if (!arg_length)
return FALSE;
@@ -540,7 +545,7 @@ bool String::append_longlong(longlong val)
if (realloc(str_length+MAX_BIGINT_WIDTH+2))
return TRUE;
char *end= (char*) longlong10_to_str(val, (char*) Ptr + str_length, -10);
- str_length= end - Ptr;
+ str_length= (uint32)(end - Ptr);
return FALSE;
}
@@ -550,7 +555,7 @@ bool String::append_ulonglong(ulonglong val)
if (realloc(str_length+MAX_BIGINT_WIDTH+2))
return TRUE;
char *end= (char*) longlong10_to_str(val, (char*) Ptr + str_length, 10);
- str_length= end - Ptr;
+ str_length= (uint32) (end - Ptr);
return FALSE;
}
@@ -559,7 +564,7 @@ bool String::append_ulonglong(ulonglong val)
with character set recoding
*/
-bool String::append(const char *s,uint32 arg_length, CHARSET_INFO *cs)
+bool String::append(const char *s, uint arg_length, CHARSET_INFO *cs)
{
uint32 offset;
@@ -646,7 +651,7 @@ bool String::append_with_prefill(const char *s,uint32 arg_length,
uint32 String::numchars() const
{
- return str_charset->cset->numchars(str_charset, Ptr, Ptr+str_length);
+ return (uint32) str_charset->cset->numchars(str_charset, Ptr, Ptr+str_length);
}
int String::charpos(longlong i,uint32 offset)
@@ -775,7 +780,7 @@ void String::qs_append(const char *str, uint32 len)
void String::qs_append(double d)
{
char *buff = Ptr + str_length;
- str_length+= my_gcvt(d, MY_GCVT_ARG_DOUBLE, FLOATING_POINT_BUFFER - 1, buff,
+ str_length+= (uint32) my_gcvt(d, MY_GCVT_ARG_DOUBLE, FLOATING_POINT_BUFFER - 1, buff,
NULL);
}
@@ -1079,10 +1084,10 @@ String_copier::well_formed_copy(CHARSET_INFO *to_cs,
my_charset_same(from_cs, to_cs))
{
m_cannot_convert_error_pos= NULL;
- return to_cs->cset->copy_fix(to_cs, to, to_length, from, from_length,
+ return (uint) to_cs->cset->copy_fix(to_cs, to, to_length, from, from_length,
nchars, this);
}
- return my_convert_fix(to_cs, to, to_length, from_cs, from, from_length,
+ return (uint) my_convert_fix(to_cs, to, to_length, from_cs, from, from_length,
nchars, this, this);
}
@@ -1217,5 +1222,5 @@ uint convert_to_printable(char *to, size_t to_len,
memcpy(dots, STRING_WITH_LEN("...\0"));
else
*t= '\0';
- return t - to;
+ return (uint) (t - to);
}
diff --git a/sql/sql_string.h b/sql/sql_string.h
index 9111d0b5792..3908cdff252 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -357,22 +357,22 @@ public:
Ptr=0;
str_length=0; /* Safety */
}
- inline bool alloc(uint32 arg_length)
+ inline bool alloc(size_t arg_length)
{
if (arg_length < Alloced_length)
return 0;
return real_alloc(arg_length);
}
- bool real_alloc(uint32 arg_length); // Empties old string
- bool realloc_raw(uint32 arg_length);
- bool realloc(uint32 arg_length)
+ bool real_alloc(size_t arg_length); // Empties old string
+ bool realloc_raw(size_t arg_length);
+ bool realloc(size_t arg_length)
{
if (realloc_raw(arg_length))
return TRUE;
Ptr[arg_length]=0; // This make other funcs shorter
return FALSE;
}
- bool realloc_with_extra(uint32 arg_length)
+ bool realloc_with_extra(size_t arg_length)
{
if (extra_alloc < 4096)
extra_alloc= extra_alloc*2+128;
@@ -381,7 +381,7 @@ public:
Ptr[arg_length]=0; // This make other funcs shorter
return FALSE;
}
- bool realloc_with_extra_if_needed(uint32 arg_length)
+ bool realloc_with_extra_if_needed(size_t arg_length)
{
if (arg_length < Alloced_length)
{
@@ -391,7 +391,7 @@ public:
return realloc_with_extra(arg_length);
}
// Shrink the buffer, but only if it is allocated on the heap.
- inline void shrink(uint32 arg_length)
+ inline void shrink(size_t arg_length)
{
if (!is_alloced())
return;
@@ -408,7 +408,7 @@ public:
else
{
Ptr=new_ptr;
- Alloced_length=arg_length;
+ Alloced_length=(uint32)arg_length;
}
}
}
@@ -431,7 +431,7 @@ public:
bool copy(); // Alloc string if not alloced
bool copy(const String &s); // Allocate new string
- bool copy(const char *s,uint32 arg_length, CHARSET_INFO *cs); // 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,
CHARSET_INFO *cs_from, CHARSET_INFO *cs_to,
uint32 *offset);
@@ -484,8 +484,8 @@ public:
DBUG_ASSERT(ls.length < UINT_MAX32);
return append(ls.str, (uint32) ls.length);
}
- bool append(const char *s, uint32 arg_length);
- bool append(const char *s, uint32 arg_length, CHARSET_INFO *cs);
+ bool append(const char *s, size_t size);
+ bool append(const char *s, uint arg_length, CHARSET_INFO *cs);
bool append_ulonglong(ulonglong val);
bool append_longlong(longlong val);
bool append(IO_CACHE* file, uint32 arg_length);
@@ -568,10 +568,11 @@ public:
float8store(Ptr + str_length, *d);
str_length += 8;
}
- void q_append(const char *data, uint32 data_len)
+ void q_append(const char *data, size_t data_len)
{
memcpy(Ptr + str_length, data, data_len);
- str_length += data_len;
+ DBUG_ASSERT(str_length <= UINT_MAX32 - data_len);
+ str_length += (uint)data_len;
}
void q_append(const LEX_CSTRING *ls)
{
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 16fb57b1572..cfc571b22ef 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2275,9 +2275,9 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
size_t db_length= table->db_length;
handlerton *table_type= 0;
- DBUG_PRINT("table", ("table_l: '%s'.'%s' table: 0x%lx s: 0x%lx",
- table->db, table->table_name, (long) table->table,
- table->table ? (long) table->table->s : (long) -1));
+ DBUG_PRINT("table", ("table_l: '%s'.'%s' table: %p s: %p",
+ table->db, table->table_name, table->table,
+ table->table ? table->table->s : NULL));
/*
If we are in locked tables mode and are dropping a temporary table,
@@ -2526,8 +2526,8 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
mysql_audit_drop_table(thd, table);
}
- DBUG_PRINT("table", ("table: 0x%lx s: 0x%lx", (long) table->table,
- table->table ? (long) table->table->s : (long) -1));
+ DBUG_PRINT("table", ("table: %p s: %p", table->table,
+ table->table ? table->table->s : NULL));
}
DEBUG_SYNC(thd, "rm_table_no_locks_before_binlog");
thd->thread_specific_used|= (trans_tmp_table_deleted ||
@@ -4226,7 +4226,7 @@ bool Column_definition::prepare_blob_field(THD *thd)
real_field_type() == FIELD_TYPE_MEDIUM_BLOB)
{
/* The user has given a length to the blob column */
- set_handler(Type_handler::blob_type_handler(length));
+ set_handler(Type_handler::blob_type_handler((uint) length));
pack_length= type_handler()->calc_pack_length(0);
}
length= 0;
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 33a82883f8f..1baa5c3d983 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -433,7 +433,7 @@ static void push_locks_into_array(DYNAMIC_ARRAY *ar, THR_LOCK_DATA *data,
if (table && table->s->tmp_table == NO_TMP_TABLE)
{
TABLE_LOCK_INFO table_lock_info;
- table_lock_info.thread_id= table->in_use->thread_id;
+ table_lock_info.thread_id= (ulong)table->in_use->thread_id;
memcpy(table_lock_info.table_name, table->s->table_cache_key.str,
table->s->table_cache_key.length);
table_lock_info.table_name[strlen(table_lock_info.table_name)]='.';
diff --git a/sql/sql_time.h b/sql/sql_time.h
index 43c19f7c451..4e8f280514f 100644
--- a/sql/sql_time.h
+++ b/sql/sql_time.h
@@ -194,7 +194,7 @@ inline bool parse_date_time_format(timestamp_type format_type,
{
return parse_date_time_format(format_type,
date_time_format->format.str,
- date_time_format->format.length,
+ (uint) date_time_format->format.length,
date_time_format);
}
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 5e0cd57f2d9..75d8841d25c 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -1157,7 +1157,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
bool result, view_is_mergeable;
TABLE_LIST *UNINIT_VAR(view_main_select_tables);
DBUG_ENTER("mysql_make_view");
- DBUG_PRINT("info", ("table: 0x%lx (%s)", (ulong) table, table->table_name));
+ DBUG_PRINT("info", ("table: %p (%s)", table, table->table_name));
if (table->required_type == TABLE_TYPE_NORMAL)
{
diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index 33e5464e659..3869628dfea 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -1811,7 +1811,7 @@ public:
private:
void move_cursor_if_possible()
{
- int rows_difference= n_rows - n_rows_behind;
+ longlong rows_difference= n_rows - n_rows_behind;
if (rows_difference > 0) /* We still have to wait. */
return;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 24fee1548cb..17fcd83f681 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -16447,7 +16447,7 @@ view_select:
opt_with_clause query_expression_body_view view_check_option
{
LEX *lex= Lex;
- uint len= YYLIP->get_cpp_ptr() - lex->create_view->select.str;
+ 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;
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index bc3302c49d3..3f531f07e54 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -16661,7 +16661,7 @@ view_select:
opt_with_clause query_expression_body_view view_check_option
{
LEX *lex= Lex;
- uint len= YYLIP->get_cpp_ptr() - lex->create_view->select.str;
+ 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;
diff --git a/sql/strfunc.cc b/sql/strfunc.cc
index 01c9fe4e70b..b09eadb098e 100644
--- a/sql/strfunc.cc
+++ b/sql/strfunc.cc
@@ -158,7 +158,7 @@ uint find_type2(const TYPELIB *typelib, const char *x, uint length,
int pos;
const char *j;
DBUG_ENTER("find_type2");
- DBUG_PRINT("enter",("x: '%.*s' lib: 0x%lx", length, x, (long) typelib));
+ DBUG_PRINT("enter",("x: '%.*s' lib: %p", length, x, typelib));
if (!typelib->count)
{
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 4fdc870ab50..eb154d215d3 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -2734,7 +2734,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(query_cache_size);
+ ulong new_cache_size= query_cache.resize((ulong)query_cache_size);
/*
Note: query_cache_size is a global variable reflecting the
requested cache size. See also query_cache_size_arg
@@ -4714,7 +4714,7 @@ static Sys_var_multi_source_ulonglong Sys_slave_skip_counter(
static bool update_max_relay_log_size(sys_var *self, THD *thd, Master_info *mi)
{
mi->rli.max_relay_log_size= thd->variables.max_relay_log_size;
- mi->rli.relay_log.set_max_size(mi->rli.max_relay_log_size);
+ mi->rli.relay_log.set_max_size((ulong)mi->rli.max_relay_log_size);
return false;
}
@@ -5339,7 +5339,7 @@ static Sys_var_ulong Sys_rowid_merge_buff_size(
"rowid_merge_buff_size",
"The size of the buffers used [NOT] IN evaluation via partial matching",
SESSION_VAR(rowid_merge_buff_size), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(0, ((ulonglong)~(intptr)0)/2), DEFAULT(8*1024*1024),
+ VALID_RANGE(0, LONG_MAX), DEFAULT(8*1024*1024),
BLOCK_SIZE(1));
static Sys_var_mybool Sys_userstat(
diff --git a/sql/sys_vars.ic b/sql/sys_vars.ic
index ade2928f4c2..ba58315b449 100644
--- a/sql/sys_vars.ic
+++ b/sql/sys_vars.ic
@@ -234,25 +234,25 @@ typedef Sys_var_integer<long, GET_LONG, SHOW_SLONG> Sys_var_long;
template<> uchar *Sys_var_int::default_value_ptr(THD *thd)
{
- thd->sys_var_tmp.int_value= option.def_value;
+ thd->sys_var_tmp.int_value= (int)option.def_value;
return (uchar*) &thd->sys_var_tmp.int_value;
}
template<> uchar *Sys_var_uint::default_value_ptr(THD *thd)
{
- thd->sys_var_tmp.uint_value= option.def_value;
+ thd->sys_var_tmp.uint_value= (uint)option.def_value;
return (uchar*) &thd->sys_var_tmp.uint_value;
}
template<> uchar *Sys_var_long::default_value_ptr(THD *thd)
{
- thd->sys_var_tmp.long_value= option.def_value;
+ thd->sys_var_tmp.long_value= (long)option.def_value;
return (uchar*) &thd->sys_var_tmp.long_value;
}
template<> uchar *Sys_var_ulong::default_value_ptr(THD *thd)
{
- thd->sys_var_tmp.ulong_value= option.def_value;
+ thd->sys_var_tmp.ulong_value= (ulong)option.def_value;
return (uchar*) &thd->sys_var_tmp.ulong_value;
}
@@ -369,7 +369,7 @@ public:
uchar *global_value_ptr(THD *thd, const LEX_CSTRING *base)
{ return valptr(thd, global_var(ulong)); }
uchar *default_value_ptr(THD *thd)
- { return valptr(thd, option.def_value); }
+ { return valptr(thd, (ulong)option.def_value); }
};
/**
@@ -416,7 +416,7 @@ public:
{ var->save_result.ulonglong_value= option.def_value; }
uchar *default_value_ptr(THD *thd)
{
- thd->sys_var_tmp.my_bool_value= option.def_value;
+ thd->sys_var_tmp.my_bool_value=(my_bool) option.def_value;
return (uchar*) &thd->sys_var_tmp.my_bool_value;
}
};
diff --git a/sql/table.cc b/sql/table.cc
index 7c6aa205edd..7131e9d4a7d 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -345,7 +345,7 @@ TABLE_SHARE *alloc_table_share(const char *db, const char *table_name,
*/
do
{
- share->table_map_id= my_atomic_add64_explicit(&last_table_id, 1,
+ share->table_map_id=(ulong) my_atomic_add64_explicit(&last_table_id, 1,
MY_MEMORY_ORDER_RELAXED);
} while (unlikely(share->table_map_id == ~0UL));
}
@@ -3020,8 +3020,8 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
Field **field_ptr;
uint8 save_context_analysis_only= thd->lex->context_analysis_only;
DBUG_ENTER("open_table_from_share");
- DBUG_PRINT("enter",("name: '%s.%s' form: 0x%lx", share->db.str,
- share->table_name.str, (long) outparam));
+ DBUG_PRINT("enter",("name: '%s.%s' form: %p", share->db.str,
+ share->table_name.str, outparam));
thd->lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_VIEW; // not a view
@@ -3436,7 +3436,7 @@ int closefrm(register TABLE *table)
{
int error=0;
DBUG_ENTER("closefrm");
- DBUG_PRINT("enter", ("table: 0x%lx", (long) table));
+ DBUG_PRINT("enter", ("table: %p", table));
if (table->db_stat)
error=table->file->ha_close();
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index 2feace30672..be990543757 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -68,7 +68,7 @@ I_P_List <TDC_element,
I_P_List_null_counter,
I_P_List_fast_push_back<TDC_element> > unused_shares;
-static int64 tdc_version; /* Increments on each reload */
+static tdc_version_t tdc_version; /* Increments on each reload */
static bool tdc_inited;
@@ -913,8 +913,8 @@ retry:
}
end:
- DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u",
- (ulong) share, share->tdc->ref_count));
+ DBUG_PRINT("exit", ("share: %p ref_count: %u",
+ share, share->tdc->ref_count));
if (flags & GTS_NOLOCK)
{
tdc_release_share(share);
@@ -945,8 +945,8 @@ void tdc_release_share(TABLE_SHARE *share)
mysql_mutex_lock(&share->tdc->LOCK_table_share);
DBUG_PRINT("enter",
- ("share: 0x%lx table: %s.%s ref_count: %u version: %lu",
- (ulong) share, share->db.str, share->table_name.str,
+ ("share: %p table: %s.%s ref_count: %u version: %lld",
+ share, share->db.str, share->table_name.str,
share->tdc->ref_count, share->tdc->version));
DBUG_ASSERT(share->tdc->ref_count);
@@ -1181,8 +1181,7 @@ bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
*/
int tdc_wait_for_old_version(THD *thd, const char *db, const char *table_name,
- ulong wait_timeout, uint deadlock_weight,
- ulong refresh_version)
+ ulong wait_timeout, uint deadlock_weight, tdc_version_t refresh_version)
{
TDC_element *element;
@@ -1201,16 +1200,16 @@ int tdc_wait_for_old_version(THD *thd, const char *db, const char *table_name,
}
-ulong tdc_refresh_version(void)
+tdc_version_t tdc_refresh_version(void)
{
- return my_atomic_load64_explicit(&tdc_version, MY_MEMORY_ORDER_RELAXED);
+ return (tdc_version_t)my_atomic_load64_explicit(&tdc_version, MY_MEMORY_ORDER_RELAXED);
}
-ulong tdc_increment_refresh_version(void)
+tdc_version_t tdc_increment_refresh_version(void)
{
- ulong v= my_atomic_add64_explicit(&tdc_version, 1, MY_MEMORY_ORDER_RELAXED);
- DBUG_PRINT("tcache", ("incremented global refresh_version to: %lu", v));
+ tdc_version_t v= (tdc_version_t)my_atomic_add64_explicit(&tdc_version, 1, MY_MEMORY_ORDER_RELAXED);
+ DBUG_PRINT("tcache", ("incremented global refresh_version to: %lld", v));
return v + 1;
}
diff --git a/sql/table_cache.h b/sql/table_cache.h
index cac69296cc2..2e5bb3428dc 100644
--- a/sql/table_cache.h
+++ b/sql/table_cache.h
@@ -26,12 +26,14 @@ struct Share_free_tables
char pad[CPU_LEVEL1_DCACHE_LINESIZE];
};
+typedef int64 tdc_version_t;
+#define TDC_VERSION_MAX INT_MAX64
struct TDC_element
{
uchar m_key[NAME_LEN + 1 + NAME_LEN + 1];
uint m_key_length;
- ulong version;
+ tdc_version_t version;
bool flushed;
TABLE_SHARE *share;
@@ -84,12 +86,14 @@ extern void tdc_release_share(TABLE_SHARE *share);
extern bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
const char *db, const char *table_name,
bool kill_delayed_threads);
+
+
extern int tdc_wait_for_old_version(THD *thd, const char *db,
const char *table_name,
ulong wait_timeout, uint deadlock_weight,
- ulong refresh_version= ULONG_MAX);
-extern ulong tdc_refresh_version(void);
-extern ulong tdc_increment_refresh_version(void);
+ tdc_version_t refresh_version= TDC_VERSION_MAX);
+extern tdc_version_t tdc_refresh_version(void);
+extern tdc_version_t tdc_increment_refresh_version(void);
extern int tdc_iterate(THD *thd, my_hash_walk_action action, void *argument,
bool no_dups= false);
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc
index 0fc5150cfe1..5e5a05084b3 100644
--- a/sql/temporary_tables.cc
+++ b/sql/temporary_tables.cc
@@ -1131,8 +1131,8 @@ TABLE *THD::open_temporary_table(TMP_TABLE_SHARE *share,
thread_safe_increment32(&slave_open_temp_tables);
}
- DBUG_PRINT("tmptable", ("Opened table: '%s'.'%s' 0x%lx", table->s->db.str,
- table->s->table_name.str, (long) table));
+ DBUG_PRINT("tmptable", ("Opened table: '%s'.'%s'%p", table->s->db.str,
+ table->s->table_name.str, table));
DBUG_RETURN(table);
}
@@ -1225,9 +1225,9 @@ void THD::close_temporary_table(TABLE *table)
{
DBUG_ENTER("THD::close_temporary_table");
- DBUG_PRINT("tmptable", ("closing table: '%s'.'%s' 0x%lx alias: '%s'",
+ DBUG_PRINT("tmptable", ("closing table: '%s'.'%s'%p alias: '%s'",
table->s->db.str, table->s->table_name.str,
- (long) table, table->alias.c_ptr()));
+ table, table->alias.c_ptr()));
closefrm(table);
my_free(table);
diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc
index 2ab874b2232..e90f87fffc4 100644
--- a/sql/threadpool_generic.cc
+++ b/sql/threadpool_generic.cc
@@ -55,6 +55,9 @@ typedef OVERLAPPED_ENTRY native_event;
#error threadpool is not available on this platform
#endif
+#ifdef _MSC_VER
+#pragma warning (disable : 4312)
+#endif
static void io_poll_close(int fd)
{
@@ -447,10 +450,11 @@ static void* native_event_get_userdata(native_event *event)
#elif defined(HAVE_IOCP)
+
static int io_poll_create()
{
HANDLE h= CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0);
- return (int)h;
+ return PtrToInt(h);
}
@@ -476,7 +480,7 @@ int io_poll_start_read(int pollfd, int fd, void *, void *opt)
static int io_poll_associate_fd(int pollfd, int fd, void *data, void *opt)
{
- HANDLE h= CreateIoCompletionPort((HANDLE)fd, (HANDLE)pollfd, (ULONG_PTR)data, 0);
+ HANDLE h= CreateIoCompletionPort(IntToPtr(fd), IntToPtr(pollfd), (ULONG_PTR)data, 0);
if (!h)
return -1;
return io_poll_start_read(pollfd,fd, 0, opt);
@@ -504,7 +508,6 @@ static void* native_event_get_userdata(native_event *event)
{
return (void *)event->lpCompletionKey;
}
-
#endif
@@ -1483,7 +1486,7 @@ static int change_group(TP_connection_generic *c,
thread_group_t *new_group)
{
int ret= 0;
- int fd= mysql_socket_getfd(c->thd->net.vio->mysql_socket);
+ int fd= (int)mysql_socket_getfd(c->thd->net.vio->mysql_socket);
DBUG_ASSERT(c->thread_group == old_group);
@@ -1511,7 +1514,7 @@ static int change_group(TP_connection_generic *c,
int TP_connection_generic::start_io()
{
- int fd= mysql_socket_getfd(thd->net.vio->mysql_socket);
+ int fd= (int)mysql_socket_getfd(thd->net.vio->mysql_socket);
#ifndef HAVE_IOCP
/*
diff --git a/sql/udf_example.c b/sql/udf_example.c
index 6a0d78078a6..98700953b2c 100644
--- a/sql/udf_example.c
+++ b/sql/udf_example.c
@@ -1095,7 +1095,7 @@ my_bool is_const_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
strmov(message, "IS_CONST accepts only one argument");
return 1;
}
- initid->ptr= (char*)((args->args[0] != NULL) ? 1UL : 0);
+ initid->ptr= (char*)((args->args[0] != NULL) ? (size_t)1 : (size_t)0);
return 0;
}
diff --git a/sql/uniques.cc b/sql/uniques.cc
index 338f7c7c537..7def2d79ad7 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -79,7 +79,7 @@ int unique_intersect_write_to_ptrs(uchar* key, element_count count, Unique *uniq
Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg,
- uint size_arg, ulonglong max_in_memory_size_arg,
+ uint size_arg, size_t max_in_memory_size_arg,
uint min_dupl_count_arg)
:max_in_memory_size(max_in_memory_size_arg),
size(size_arg),
@@ -91,7 +91,7 @@ Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg,
if (min_dupl_count_arg)
full_size+= sizeof(element_count);
with_counters= MY_TEST(min_dupl_count_arg);
- init_tree(&tree, (ulong) (max_in_memory_size / 16), 0, size, comp_func,
+ init_tree(&tree, (max_in_memory_size / 16), 0, size, comp_func,
NULL, comp_func_fixed_arg, MYF(MY_THREAD_SPECIFIC));
/* If the following fail's the next add will also fail */
my_init_dynamic_array(&file_ptrs, sizeof(BUFFPEK), 16, 16,
@@ -306,7 +306,7 @@ static double get_merge_many_buffs_cost(uint *buffer,
*/
double Unique::get_use_cost(uint *buffer, size_t nkeys, uint key_size,
- ulonglong max_in_memory_size,
+ size_t max_in_memory_size,
uint compare_factor,
bool intersect_fl, bool *in_memory)
{
diff --git a/sql/uniques.h b/sql/uniques.h
index 0210e879788..efc79953bb6 100644
--- a/sql/uniques.h
+++ b/sql/uniques.h
@@ -30,7 +30,7 @@ class Unique :public Sql_alloc
{
DYNAMIC_ARRAY file_ptrs;
ulong max_elements;
- ulonglong max_in_memory_size;
+ size_t max_in_memory_size;
IO_CACHE file;
TREE tree;
ulong filtered_out_elems;
@@ -46,7 +46,7 @@ public:
ulong elements;
SORT_INFO sort;
Unique(qsort_cmp2 comp_func, void *comp_func_fixed_arg,
- uint size_arg, ulonglong max_in_memory_size_arg,
+ uint size_arg, size_t max_in_memory_size_arg,
uint min_dupl_count_arg= 0);
~Unique();
ulong elements_in_tree() { return tree.elements_in_tree; }
@@ -72,12 +72,12 @@ public:
}
static double get_use_cost(uint *buffer, size_t nkeys, uint key_size,
- ulonglong max_in_memory_size, uint compare_factor,
+ size_t max_in_memory_size, uint compare_factor,
bool intersect_fl, bool *in_memory);
inline static int get_cost_calc_buff_size(size_t nkeys, uint key_size,
- ulonglong max_in_memory_size)
+ size_t max_in_memory_size)
{
- register ulonglong max_elems_in_tree=
+ register size_t max_elems_in_tree=
max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size);
return (int) (sizeof(uint)*(1 + nkeys/max_elems_in_tree));
}
@@ -86,7 +86,7 @@ public:
bool walk(TABLE *table, tree_walk_action action, void *walk_action_arg);
uint get_size() const { return size; }
- ulonglong get_max_in_memory_size() const { return max_in_memory_size; }
+ size_t get_max_in_memory_size() const { return max_in_memory_size; }
friend int unique_write_to_file(uchar* key, element_count count, Unique *unique);
friend int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique);
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 655cfa20c61..5d5b82ba015 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -452,9 +452,9 @@ static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo,
int2store(pos+6, key->block_size);
pos+=8;
key_parts+=key->user_defined_key_parts;
- DBUG_PRINT("loop", ("flags: %lu key_parts: %d key_part: 0x%lx",
+ DBUG_PRINT("loop", ("flags: %lu key_parts: %d key_part: %p",
key->flags, key->user_defined_key_parts,
- (long) key->key_part));
+ key->key_part));
for (key_part=key->key_part,key_part_end=key_part+key->user_defined_key_parts ;
key_part != key_part_end ;
key_part++)
@@ -620,7 +620,7 @@ static bool pack_header(THD *thd, uchar *forminfo,
field->field_name.str))
DBUG_RETURN(1);
- totlength+= field->length;
+ totlength+= (size_t)field->length;
com_length+= field->comment.length;
/*
We mark first TIMESTAMP field with NOW() in DEFAULT or ON UPDATE
@@ -950,7 +950,7 @@ static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
/* regfield don't have to be deleted as it's allocated on THD::mem_root */
Field *regfield= make_field(&share, thd->mem_root,
buff+field->offset + data_offset,
- field->length,
+ (uint32)field->length,
null_pos + null_count / 8,
null_count & 7,
field->pack_flag,