summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2017-09-28 10:38:02 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2017-09-28 17:20:46 +0000
commit7354dc67737fdeb105656f5cec055da627bb9c29 (patch)
tree7cc2b5f975d5e32eb94cd1344b259ea1b24018d6
parent509928718d52a14739fcfb2ebf0e68b4c8e01be5 (diff)
downloadmariadb-git-7354dc67737fdeb105656f5cec055da627bb9c29.tar.gz
MDEV-13384 - misc Windows warnings fixed
-rw-r--r--client/mysql_upgrade.c2
-rw-r--r--client/mysqlbinlog.cc2
-rw-r--r--client/mysqldump.c10
-rw-r--r--client/mysqlslap.c6
-rw-r--r--client/mysqltest.cc24
-rw-r--r--cmake/os/Windows.cmake4
-rw-r--r--cmake/os/WindowsCache.cmake4
-rw-r--r--extra/innochecksum.cc2
-rw-r--r--extra/yassl/taocrypt/src/algebra.cpp4
-rw-r--r--include/mysql_async.h4
-rw-r--r--libmysqld/libmysql.c2
-rw-r--r--mysys/lf_alloc-pin.c2
-rw-r--r--mysys/mf_keycache.c2
-rw-r--r--mysys/my_getopt.c4
-rw-r--r--mysys/typelib.c2
-rw-r--r--mysys_ssl/my_md5.cc6
-rw-r--r--mysys_ssl/my_sha.ic4
-rw-r--r--plugin/auth_ed25519/server_ed25519.c5
-rw-r--r--plugin/auth_pipe/auth_pipe.c4
-rw-r--r--plugin/feedback/feedback.cc2
-rw-r--r--plugin/feedback/sender_thread.cc2
-rw-r--r--plugin/feedback/utils.cc14
-rw-r--r--plugin/file_key_management/parser.cc4
-rw-r--r--plugin/file_key_management/parser.h3
-rw-r--r--plugin/query_response_time/query_response_time.cc2
-rw-r--r--plugin/server_audit/server_audit.c2
-rw-r--r--plugin/userstat/index_stats.cc6
-rw-r--r--scripts/comp_sql.c2
-rw-r--r--sql-common/client.c10
-rw-r--r--sql-common/my_time.c6
-rw-r--r--sql-common/mysql_async.c4
-rw-r--r--sql/CMakeLists.txt1
-rw-r--r--sql/debug_sync.cc4
-rw-r--r--sql/discover.cc2
-rw-r--r--sql/event_data_objects.cc2
-rw-r--r--sql/field.cc33
-rw-r--r--sql/field.h4
-rw-r--r--sql/filesort.cc5
-rw-r--r--sql/ha_partition.cc8
-rw-r--r--sql/handler.cc8
-rw-r--r--sql/handler.h6
-rw-r--r--sql/item.cc2
-rw-r--r--sql/item.h4
-rw-r--r--sql/item_cmpfunc.cc2
-rw-r--r--sql/item_create.cc15
-rw-r--r--sql/item_func.cc4
-rw-r--r--sql/item_inetfunc.cc6
-rw-r--r--sql/item_jsonfunc.cc20
-rw-r--r--sql/item_strfunc.cc12
-rw-r--r--sql/item_strfunc.h4
-rw-r--r--sql/item_timefunc.cc8
-rw-r--r--sql/key.cc2
-rw-r--r--sql/log.cc6
-rw-r--r--sql/log_event.cc36
-rw-r--r--sql/log_event.h2
-rw-r--r--sql/log_event_old.cc4
-rw-r--r--sql/mf_iocache_encr.cc6
-rw-r--r--sql/mysqld.cc5
-rw-r--r--sql/parse_file.cc2
-rw-r--r--sql/rpl_filter.cc2
-rw-r--r--sql/rpl_parallel.cc2
-rw-r--r--sql/rpl_record.cc4
-rw-r--r--sql/rpl_rli.cc8
-rw-r--r--sql/session_tracker.cc8
-rw-r--r--sql/slave.cc8
-rw-r--r--sql/sp_pcontext.h8
-rw-r--r--sql/sql_acl.cc27
-rw-r--r--sql/sql_audit.h87
-rw-r--r--sql/sql_bootstrap.cc4
-rw-r--r--sql/sql_class.cc4
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_error.h5
-rw-r--r--sql/sql_join_cache.cc6
-rw-r--r--sql/sql_lex.cc2
-rw-r--r--sql/sql_parse.cc10
-rw-r--r--sql/sql_plugin.cc6
-rw-r--r--sql/sql_select.cc2
-rw-r--r--sql/sql_string.cc35
-rw-r--r--sql/sql_string.h38
-rw-r--r--sql/sql_time.h2
-rw-r--r--sql/sql_window.cc2
-rw-r--r--sql/sql_yacc.yy2
-rw-r--r--sql/sys_vars.cc6
-rw-r--r--sql/sys_vars.ic12
-rw-r--r--sql/table.cc2
-rw-r--r--sql/table_cache.cc4
-rw-r--r--sql/threadpool_generic.cc9
-rw-r--r--sql/udf_example.c2
-rw-r--r--sql/unireg.cc4
-rw-r--r--storage/archive/ha_archive.cc2
-rw-r--r--storage/connect/jsonudf.cpp2
-rw-r--r--storage/connect/plugutil.cpp2
-rw-r--r--storage/connect/tabmysql.cpp2
-rw-r--r--storage/heap/ha_heap.cc2
-rw-r--r--storage/innobase/CMakeLists.txt7
-rw-r--r--storage/innobase/buf/buf0rea.cc4
-rw-r--r--storage/innobase/fil/fil0crypt.cc4
-rw-r--r--storage/innobase/handler/ha_innodb.cc19
-rw-r--r--storage/innobase/handler/handler0alter.cc2
-rw-r--r--storage/innobase/include/fsp0pagecompress.ic2
-rw-r--r--storage/innobase/include/os0file.h6
-rw-r--r--storage/innobase/include/sync0types.h10
-rw-r--r--storage/innobase/os/os0file.cc5
-rw-r--r--storage/innobase/row/row0merge.cc2
-rw-r--r--storage/innobase/srv/srv0start.cc3
-rw-r--r--storage/maria/ha_maria.cc12
-rw-r--r--storage/maria/ma_blockrec.c2
-rw-r--r--storage/maria/ma_check.c6
-rw-r--r--storage/maria/ma_key.c4
-rw-r--r--storage/maria/ma_loghandler.c50
-rw-r--r--storage/maria/ma_recovery.c2
-rw-r--r--storage/maria/ma_rt_index.c8
-rw-r--r--storage/maria/ma_rt_key.c2
-rw-r--r--storage/maria/ma_rt_split.c8
-rw-r--r--storage/maria/ma_search.c4
-rw-r--r--storage/maria/ma_sort.c10
-rw-r--r--storage/maria/maria_read_log.c2
-rw-r--r--storage/maria/unittest/ma_test_loghandler_multigroup-t.c2
-rw-r--r--storage/myisam/mi_check.c2
-rw-r--r--storage/myisam/mi_preload.c4
-rw-r--r--storage/myisam/myisamchk.c2
-rw-r--r--storage/myisammrg/ha_myisammrg.cc2
-rw-r--r--storage/perfschema/pfs.cc6
-rw-r--r--storage/perfschema/pfs_account.cc2
-rw-r--r--storage/perfschema/pfs_engine_table.cc2
-rw-r--r--storage/perfschema/pfs_host.cc2
-rw-r--r--storage/perfschema/pfs_instr.cc4
-rw-r--r--storage/perfschema/pfs_instr_class.cc2
-rw-r--r--storage/perfschema/pfs_setup_actor.cc2
-rw-r--r--storage/perfschema/pfs_setup_object.cc2
-rw-r--r--storage/perfschema/pfs_user.cc2
-rw-r--r--storage/perfschema/table_events_waits.cc2
-rw-r--r--storage/rocksdb/rdb_sst_info.cc2
-rw-r--r--storage/sphinx/ha_sphinx.cc56
-rw-r--r--storage/sphinx/snippets_udf.cc4
-rw-r--r--storage/spider/ha_spider.cc2
-rw-r--r--storage/spider/hs_client/config.cpp4
-rw-r--r--storage/spider/hs_client/hstcpcli.cpp2
-rw-r--r--storage/spider/hs_client/socket.cpp6
-rw-r--r--storage/spider/spd_sys_table.cc4
-rw-r--r--strings/ctype-mb.c2
-rw-r--r--strings/ctype-simple.c6
-rw-r--r--strings/ctype-ucs2.c4
-rw-r--r--strings/dtoa.c8
-rw-r--r--strings/json_lib.c10
-rw-r--r--tests/mysql_client_fw.c20
-rw-r--r--tests/mysql_client_test.c6
147 files changed, 545 insertions, 491 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index c10dc20e7d7..7ba15b772b5 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -501,7 +501,7 @@ static void find_tool(char *tool_executable_name, const char *tool_name,
last_fn_libchar -= 6;
}
- len= last_fn_libchar - self_name;
+ len= (int)(last_fn_libchar - self_name);
my_snprintf(tool_executable_name, FN_REFLEN, "%.*s%c%s",
len, self_name, FN_LIBCHAR, tool_name);
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 584f6955453..2712e6ea668 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -604,7 +604,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
Exit_status Load_log_processor::process(Create_file_log_event *ce)
{
const char *bname= ce->fname + dirname_length(ce->fname);
- uint blen= ce->fname_len - (bname-ce->fname);
+ size_t blen= ce->fname_len - (bname-ce->fname);
return process_first_event(bname, blen, ce->block, ce->block_len,
ce->file_id, ce);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index c8ebd2217a3..a260065c64c 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -247,8 +247,8 @@ static struct my_option my_long_options[] =
&opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory for character set files.", &charsets_dir,
- &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory for character set files.", (char **)&charsets_dir,
+ (char **)&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"comments", 'i', "Write additional information.",
&opt_comments, &opt_comments, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
@@ -285,8 +285,8 @@ static struct my_option my_long_options[] =
{"debug", '#', "This is a non-debug version. Catch this and exit.",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
- {"debug", '#', "Output debug log.", &default_dbug_option,
- &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log.", (char *)&default_dbug_option,
+ (char *)&default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
&debug_check_flag, &debug_check_flag, 0,
@@ -5733,7 +5733,7 @@ static int replace(DYNAMIC_STRING *ds_str,
return 1;
init_dynamic_string_checked(&ds_tmp, "",
ds_str->length + replace_len, 256);
- dynstr_append_mem_checked(&ds_tmp, ds_str->str, start - ds_str->str);
+ dynstr_append_mem_checked(&ds_tmp, ds_str->str, (uint)(start - ds_str->str));
dynstr_append_mem_checked(&ds_tmp, replace_str, replace_len);
dynstr_append_checked(&ds_tmp, start + search_len);
dynstr_set_checked(ds_str, ds_tmp.str);
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index a78bf35d51b..60e0939491c 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -587,8 +587,8 @@ static struct my_option my_long_options[] =
&auto_generate_sql_number, &auto_generate_sql_number,
0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
- "Directory for character set files.", &charsets_dir,
- &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory for character set files.", (char **)&charsets_dir,
+ (char **)&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"commit", OPT_SLAP_COMMIT, "Commit records every X number of statements.",
&commit_rate, &commit_rate, 0, GET_UINT, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
@@ -817,7 +817,7 @@ get_random_string(char *buf)
DBUG_ENTER("get_random_string");
for (x= RAND_STRING_SIZE; x > 0; x--)
*buf_ptr++= ALPHANUMERICS[random() % ALPHANUMERICS_SIZE];
- DBUG_RETURN(buf_ptr - buf);
+ DBUG_RETURN((uint)(buf_ptr - buf));
}
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 30ca28577f3..e2fe43645f8 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -767,7 +767,7 @@ public:
if (show_from != buf)
{
// The last new line was found in this buf, adjust offset
- show_offset+= (show_from - buf) + 1;
+ show_offset+= (int)(show_from - buf) + 1;
DBUG_PRINT("info", ("adjusted offset to %d", show_offset));
}
DBUG_PRINT("info", ("show_offset: %d", show_offset));
@@ -2700,7 +2700,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
DBUG_ASSERT(query_end);
memset(&command, 0, sizeof(command));
command.query= (char*)query;
- command.first_word_len= (*query_end - query);
+ command.first_word_len= (int)(*query_end - query);
command.first_argument= command.query + command.first_word_len;
command.end= (char*)*query_end;
command.abort_on_error= 1; /* avoid uninitialized variables */
@@ -6501,7 +6501,7 @@ void do_delimiter(struct st_command* command)
if (!(*p))
die("Can't set empty delimiter");
- delimiter_length= strmake_buf(delimiter, p) - delimiter;
+ delimiter_length= (uint)(strmake_buf(delimiter, p) - delimiter);
DBUG_PRINT("exit", ("delimiter: %s", delimiter));
command->last_argument= p + delimiter_length;
@@ -6987,7 +6987,7 @@ int read_command(struct st_command** command_ptr)
command->first_argument= p;
command->end= strend(command->query);
- command->query_len= (command->end - command->query);
+ command->query_len= (int)(command->end - command->query);
parser.read_lines++;
DBUG_RETURN(0);
}
@@ -7544,7 +7544,7 @@ void fix_win_paths(char *val, size_t len)
*/
void append_field(DYNAMIC_STRING *ds, uint col_idx, MYSQL_FIELD* field,
- char* val, ulonglong len, my_bool is_null)
+ char* val, size_t len, my_bool is_null)
{
char null[]= "NULL";
@@ -8540,7 +8540,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
if (flags & QUERY_PRINT_ORIGINAL_FLAG)
{
print_query= command->query;
- print_len= command->end - command->query;
+ print_len= (int)(command->end - command->query);
}
replace_dynstr_append_mem(ds, print_query, print_len);
dynstr_append_mem(ds, delimiter, delimiter_length);
@@ -10237,7 +10237,7 @@ void free_replace_regex()
*/
#define SECURE_REG_BUF if (buf_len < need_buf_len) \
{ \
- int off= res_p - buf; \
+ ssize_t off= res_p - buf; \
buf= (char*)my_realloc(buf,need_buf_len,MYF(MY_WME+MY_FAE)); \
res_p= buf + off; \
buf_len= need_buf_len; \
@@ -10262,13 +10262,15 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
regmatch_t *subs;
char *replace_end;
char *buf= *buf_p;
- int len;
- int buf_len, need_buf_len;
+ size_t len;
+ size_t buf_len, need_buf_len;
int cflags= REG_EXTENDED | REG_DOTALL;
int err_code;
char *res_p,*str_p,*str_end;
- buf_len= *buf_len_p;
+ DBUG_ASSERT(*buf_len_p > 0);
+
+ buf_len= (size_t)*buf_len_p;
len= strlen(string);
str_end= string + len;
@@ -10411,7 +10413,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
}
else /* no match this time, just copy the string as is */
{
- int left_in_str= str_end-str_p;
+ size_t left_in_str= str_end-str_p;
need_buf_len= (res_p-buf) + left_in_str;
SECURE_REG_BUF
memcpy(res_p,str_p,left_in_str);
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake
index 69cb9f3613d..021f23a14f2 100644
--- a/cmake/os/Windows.cmake
+++ b/cmake/os/Windows.cmake
@@ -139,8 +139,8 @@ IF(MSVC)
ENDIF()
#TODO: update the code and remove the disabled warnings
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996 /we4700 /we4311 /we4477 /we4302")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099 /we4700 /we4311 /we4477 /we4302")
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996 /we4700 /we4311 /we4477 /we4302 /we4090 /wd4267 ")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099 /we4700 /we4311 /we4477 /we4302 /we4090 /wd4267")
ENDIF()
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index e8c46c1888a..1710c7bb13b 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -90,7 +90,7 @@ SET(HAVE_LDIV 1 CACHE INTERNAL "")
SET(HAVE_LIMITS_H 1 CACHE INTERNAL "")
SET(HAVE_LOCALE_H 1 CACHE INTERNAL "")
SET(HAVE_LOCALTIME_R 1 CACHE INTERNAL "")
-SET(HAVE_LOG2 CACHE INTERNAL "")
+#SET(HAVE_LOG2 CACHE INTERNAL "")
SET(HAVE_LRAND48 CACHE INTERNAL "")
SET(HAVE_LSTAT CACHE INTERNAL "")
SET(HAVE_MADVISE CACHE INTERNAL "")
@@ -141,7 +141,7 @@ SET(HAVE_READLINK CACHE INTERNAL "")
SET(HAVE_READ_REAL_TIME CACHE INTERNAL "")
SET(HAVE_REALPATH CACHE INTERNAL "")
SET(HAVE_RENAME 1 CACHE INTERNAL "")
-SET(HAVE_RINT CACHE INTERNAL "")
+#SET(HAVE_RINT CACHE INTERNAL "")
SET(HAVE_RWLOCK_INIT CACHE INTERNAL "")
SET(HAVE_SCHED_H CACHE INTERNAL "")
SET(HAVE_SCHED_YIELD CACHE INTERNAL "")
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc
index 6b4fc73d049..b937cc6fa1a 100644
--- a/extra/innochecksum.cc
+++ b/extra/innochecksum.cc
@@ -524,7 +524,7 @@ is_page_corrupted(
normal method. */
if (is_encrypted && key_version != 0) {
is_corrupted = !fil_space_verify_crypt_checksum(buf,
- page_size, space_id, cur_page_num);
+ page_size, space_id, (ulint)cur_page_num);
} else {
is_corrupted = true;
}
diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp
index 7dae7d6a917..892de25587e 100644
--- a/extra/yassl/taocrypt/src/algebra.cpp
+++ b/extra/yassl/taocrypt/src/algebra.cpp
@@ -218,7 +218,7 @@ struct WindowSlider
exp >>= skipCount;
windowBegin += skipCount;
- expWindow = exp % (1 << windowSize);
+ expWindow = (unsigned int)(exp % (1LL << windowSize));
if (fastNegate && exp.GetBit(windowSize))
{
@@ -248,7 +248,7 @@ void AbstractGroup::SimultaneousMultiply(Integer *results, const Integer &base,
{
exponents.push_back(WindowSlider(*expBegin++, InversionIsFast(), 0));
exponents[i].FindNextWindow();
- buckets[i].resize(1<<(exponents[i].windowSize-1), Identity());
+ buckets[i].resize(size_t(1)<<(exponents[i].windowSize-1), Identity());
}
unsigned int expBitPosition = 0;
diff --git a/include/mysql_async.h b/include/mysql_async.h
index 04b975211db..32c1116dc58 100644
--- a/include/mysql_async.h
+++ b/include/mysql_async.h
@@ -21,9 +21,9 @@
extern int my_connect_async(struct mysql_async_context *b, my_socket fd,
const struct sockaddr *name, uint namelen,
int vio_timeout);
-extern ssize_t my_recv_async(struct mysql_async_context *b, int fd,
+extern ssize_t my_recv_async(struct mysql_async_context *b, my_socket fd,
unsigned char *buf, size_t size, int timeout);
-extern ssize_t my_send_async(struct mysql_async_context *b, int fd,
+extern ssize_t my_send_async(struct mysql_async_context *b, my_socket fd,
const unsigned char *buf, size_t size,
int timeout);
extern my_bool my_io_wait_async(struct mysql_async_context *b,
diff --git a/libmysqld/libmysql.c b/libmysqld/libmysql.c
index e610d239fa4..767afed06b1 100644
--- a/libmysqld/libmysql.c
+++ b/libmysqld/libmysql.c
@@ -3249,7 +3249,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
ulong copy_length;
if (start < end)
{
- copy_length= end - start;
+ copy_length= (ulong)(end - start);
/* We've got some data beyond offset: copy up to buffer_length bytes */
if (param->buffer_length)
memcpy(buffer, start, MY_MIN(copy_length, param->buffer_length));
diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c
index e2073df1e4d..bf2b8a12846 100644
--- a/mysys/lf_alloc-pin.c
+++ b/mysys/lf_alloc-pin.c
@@ -355,7 +355,7 @@ static void lf_pinbox_real_free(LF_PINS *pins)
lf_dynarray_iterate(&pinbox->pinarray,
(lf_dynarray_func)harvest_pins, &hv);
- npins= hv.granary-addr;
+ npins= (int)(hv.granary-addr);
/* and sort them */
if (npins)
qsort(addr, npins, sizeof(void *), (qsort_cmp)ptr_cmp);
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 683e3edecd0..f2dddc0bd7f 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -5190,7 +5190,7 @@ int init_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache,
}
}
- keycache->partitions= partitions= partition_ptr-keycache->partition_array;
+ keycache->partitions= partitions= (uint) (partition_ptr-keycache->partition_array);
keycache->key_cache_mem_size= mem_per_cache * partitions;
for (i= 0; i < (int) partitions; i++)
keycache->partition_array[i]->hash_factor= partitions;
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 57b28d1fd8a..dd4fba5bda7 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -1400,7 +1400,7 @@ static uint print_name(const struct my_option *optp)
for (;*s;s++)
putchar(*s == '_' ? '-' : *s);
- return s - optp->name;
+ return (uint)(s - optp->name);
}
/** prints option comment with indentation and wrapping.
@@ -1441,7 +1441,7 @@ static uint print_comment(const char *comment,
putchar(' ');
}
printf("%s", comment);
- return curpos + (end - comment);
+ return curpos + (int)(end - comment);
}
diff --git a/mysys/typelib.c b/mysys/typelib.c
index a256c26f048..e45ede2c43a 100644
--- a/mysys/typelib.c
+++ b/mysys/typelib.c
@@ -399,7 +399,7 @@ my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name,
continue;
err:
*err_pos= (char*)start;
- *err_len= end - start;
+ *err_len= (uint)(end - start);
break;
}
}
diff --git a/mysys_ssl/my_md5.cc b/mysys_ssl/my_md5.cc
index 582c83d0522..359bcd49ec6 100644
--- a/mysys_ssl/my_md5.cc
+++ b/mysys_ssl/my_md5.cc
@@ -90,7 +90,7 @@ void my_md5(uchar *digest, const char *buf, size_t len)
char ctx_buf[EVP_MD_CTX_SIZE];
EVP_MD_CTX * const ctx= (EVP_MD_CTX*)ctx_buf;
md5_init(ctx);
- md5_input(ctx, (const uchar *)buf, len);
+ md5_input(ctx, (const uchar *)buf, (uint) len);
md5_result(ctx, digest);
}
@@ -117,7 +117,7 @@ void my_md5_multi(uchar *digest, ...)
md5_init(ctx);
for (str= va_arg(args, const uchar*); str; str= va_arg(args, const uchar*))
- md5_input(ctx, str, va_arg(args, size_t));
+ md5_input(ctx, str, (uint) va_arg(args, size_t));
md5_result(ctx, digest);
va_end(args);
@@ -135,7 +135,7 @@ void my_md5_init(void *context)
void my_md5_input(void *context, const uchar *buf, size_t len)
{
- md5_input((EVP_MD_CTX *)context, buf, len);
+ md5_input((EVP_MD_CTX *)context, buf, (uint) len);
}
void my_md5_result(void *context, uchar *digest)
diff --git a/mysys_ssl/my_sha.ic b/mysys_ssl/my_sha.ic
index 361a4d851e7..e4433b49a0f 100644
--- a/mysys_ssl/my_sha.ic
+++ b/mysys_ssl/my_sha.ic
@@ -161,7 +161,7 @@ void my_sha_multi(uchar *digest, ...)
sha_init_fast(&context);
for (str= va_arg(args, const uchar*); str; str= va_arg(args, const uchar*))
- sha_input(&context, str, va_arg(args, size_t));
+ sha_input(&context, str, (uint) va_arg(args, size_t));
sha_result(&context, digest);
va_end(args);
@@ -179,7 +179,7 @@ void my_sha_init(void *context)
void my_sha_input(void *context, const uchar *buf, size_t len)
{
- sha_input((CONTEXT *)context, buf, len);
+ sha_input((CONTEXT *)context, buf, (uint) len);
}
void my_sha_result(void *context, uchar *digest)
diff --git a/plugin/auth_ed25519/server_ed25519.c b/plugin/auth_ed25519/server_ed25519.c
index 88760275b9b..e3f00409ae3 100644
--- a/plugin/auth_ed25519/server_ed25519.c
+++ b/plugin/auth_ed25519/server_ed25519.c
@@ -33,7 +33,6 @@ static int loaded= 0;
static int auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
{
- unsigned int i;
int pkt_len;
unsigned long nonce[CRYPTO_LONGS + NONCE_LONGS];
unsigned char *pkt, *reply= (unsigned char*)nonce;
@@ -51,8 +50,8 @@ static int auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
info->password_used= PASSWORD_USED_YES;
/* prepare random nonce */
- for (i=CRYPTO_LONGS; i < CRYPTO_LONGS + NONCE_LONGS; i++)
- nonce[i]= thd_rnd(info->thd) * ~0UL;
+ if (my_random_bytes((unsigned char *)nonce, (int)sizeof(nonce)))
+ return CR_AUTH_USER_CREDENTIALS;
/* send it */
if (vio->write_packet(vio, reply + CRYPTO_BYTES, NONCE_BYTES))
diff --git a/plugin/auth_pipe/auth_pipe.c b/plugin/auth_pipe/auth_pipe.c
index 20c33c07e84..a803653b31a 100644
--- a/plugin/auth_pipe/auth_pipe.c
+++ b/plugin/auth_pipe/auth_pipe.c
@@ -36,7 +36,7 @@ static int pipe_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
unsigned char *pkt;
MYSQL_PLUGIN_VIO_INFO vio_info;
char username[UNLEN + 1];
- size_t username_length;
+ DWORD username_length;
int ret;
/* no user name yet ? read the client handshake packet with the user name */
@@ -54,7 +54,7 @@ static int pipe_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
if (!ImpersonateNamedPipeClient(vio_info.handle))
return CR_ERROR;
- username_length= sizeof(username) - 1;
+ username_length=UNLEN;
ret= CR_ERROR;
if (GetUserName(username, &username_length))
{
diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc
index bd433efa4d3..15a280f34bf 100644
--- a/plugin/feedback/feedback.cc
+++ b/plugin/feedback/feedback.cc
@@ -112,7 +112,7 @@ static COND* make_cond(THD *thd, TABLE_LIST *tables, LEX_STRING *filter)
Item_field *fld= new (thd->mem_root) Item_field(thd, &nrc, db, table,
field);
Item_string *pattern= new (thd->mem_root) Item_string(thd, filter->str,
- filter->length, cs);
+ (uint) filter->length, cs);
Item_string *escape= new (thd->mem_root) Item_string(thd, "\\", 1, cs);
if (!fld || !pattern || !escape)
diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc
index 4742d5f4920..bcd10f6713f 100644
--- a/plugin/feedback/sender_thread.cc
+++ b/plugin/feedback/sender_thread.cc
@@ -238,7 +238,7 @@ static void send_report(const char *when)
Url *url= todo[i];
if (thd) // for nicer SHOW PROCESSLIST
- thd->set_query(const_cast<char*>(url->url()), url->url_length());
+ thd->set_query(const_cast<char*>(url->url()), (uint) url->url_length());
if (url->send(str.ptr(), str.length()))
i++;
diff --git a/plugin/feedback/utils.cc b/plugin/feedback/utils.cc
index 0805a6e1d76..b5b9d412f05 100644
--- a/plugin/feedback/utils.cc
+++ b/plugin/feedback/utils.cc
@@ -151,7 +151,7 @@ namespace feedback {
*/
#define INSERT2(NAME,LEN,VALUE) \
do { \
- table->field[0]->store(NAME, LEN, system_charset_info); \
+ table->field[0]->store(NAME, (uint) LEN, system_charset_info); \
table->field[1]->store VALUE; \
if (schema_table_store_record(thd, table)) \
return 1; \
@@ -159,7 +159,7 @@ namespace feedback {
#define INSERT1(NAME,VALUE) \
do { \
- table->field[0]->store(NAME, sizeof(NAME)-1, system_charset_info); \
+ table->field[0]->store(NAME, (uint) sizeof(NAME)-1, system_charset_info); \
table->field[1]->store VALUE; \
if (schema_table_store_record(thd, table)) \
return 1; \
@@ -186,7 +186,7 @@ static my_bool show_plugins(THD *thd, plugin_ref plugin, void *arg)
(plugin_decl(plugin)->version) & 0xff);
INSERT2(name, name_len,
- (version, version_len, system_charset_info));
+ (version, (uint)version_len, system_charset_info));
name_len= my_snprintf(name, sizeof(name), "%s used",
plugin_name(plugin)->str);
@@ -358,10 +358,10 @@ int fill_linux_info(THD *thd, TABLE_LIST *tables)
#ifdef HAVE_SYS_UTSNAME_H
if (have_ubuf)
{
- INSERT1("Uname_sysname", (ubuf.sysname, strlen(ubuf.sysname), cs));
- INSERT1("Uname_release", (ubuf.release, strlen(ubuf.release), cs));
- INSERT1("Uname_version", (ubuf.version, strlen(ubuf.version), cs));
- INSERT1("Uname_machine", (ubuf.machine, strlen(ubuf.machine), cs));
+ INSERT1("Uname_sysname", (ubuf.sysname, (uint) strlen(ubuf.sysname), cs));
+ INSERT1("Uname_release", (ubuf.release, (uint) strlen(ubuf.release), cs));
+ INSERT1("Uname_version", (ubuf.version, (uint) strlen(ubuf.version), cs));
+ INSERT1("Uname_machine", (ubuf.machine, (uint) strlen(ubuf.machine), cs));
}
#endif
diff --git a/plugin/file_key_management/parser.cc b/plugin/file_key_management/parser.cc
index ac78186a488..4700788bf83 100644
--- a/plugin/file_key_management/parser.cc
+++ b/plugin/file_key_management/parser.cc
@@ -230,9 +230,9 @@ bool Parser::parse_file(std::map<uint,keyentry> *keys, const char *secret)
return 0;
}
-void Parser::report_error(const char *reason, uint position)
+void Parser::report_error(const char *reason, size_t position)
{
- my_printf_error(EE_READ, "%s at %s line %u, column %u",
+ my_printf_error(EE_READ, "%s at %s line %u, column %zu",
ME_ERROR_LOG, reason, filename, line_number, position + 1);
}
diff --git a/plugin/file_key_management/parser.h b/plugin/file_key_management/parser.h
index 627b7fd84a6..044be0f5b95 100644
--- a/plugin/file_key_management/parser.h
+++ b/plugin/file_key_management/parser.h
@@ -23,6 +23,7 @@ Created 09/15/2014
#include <my_crypt.h>
#include <ctype.h>
#include <map>
+#include <stdlib.h> /* size_t */
struct keyentry {
unsigned int id;
@@ -43,7 +44,7 @@ class Parser
unsigned char *key, unsigned char *iv);
bool read_filekey(const char *filekey, char *secret);
bool parse_file(std::map<unsigned int ,keyentry> *keys, const char *secret);
- void report_error(const char *reason, unsigned int position);
+ void report_error(const char *reason, size_t position);
int parse_line(char **line_ptr, keyentry *key);
char* read_and_decrypt_file(const char *secret);
diff --git a/plugin/query_response_time/query_response_time.cc b/plugin/query_response_time/query_response_time.cc
index 10b9391d9da..5d6119d20ef 100644
--- a/plugin/query_response_time/query_response_time.cc
+++ b/plugin/query_response_time/query_response_time.cc
@@ -221,7 +221,7 @@ public:
print_time(total, sizeof(total), TOTAL_STRING_FORMAT, this->total(i));
}
fields[0]->store(time,strlen(time),system_charset_info);
- fields[1]->store(this->count(i));
+ fields[1]->store((longlong)this->count(i),true);
fields[2]->store(total,strlen(total),system_charset_info);
if (schema_table_store_record(thd, table))
{
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index 51f616b9af4..5ecacb79865 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -1423,7 +1423,7 @@ static size_t escape_string_hide_passwords(const char *str, unsigned int len,
}
next_s++;
}
- len-= next_s - str;
+ len-= (uint)(next_s - str);
str= next_s;
continue;
}
diff --git a/plugin/userstat/index_stats.cc b/plugin/userstat/index_stats.cc
index 236130d327f..87e6da63e38 100644
--- a/plugin/userstat/index_stats.cc
+++ b/plugin/userstat/index_stats.cc
@@ -35,11 +35,11 @@ static int index_stats_fill(THD *thd, TABLE_LIST *tables, COND *cond)
index_name_length= (index_stats->index_name_length - schema_name_length -
table_name_length - 3);
- table->field[0]->store(tmp_table.db, schema_name_length,
+ table->field[0]->store(tmp_table.db, (uint)schema_name_length,
system_charset_info);
- table->field[1]->store(tmp_table.table_name, table_name_length,
+ table->field[1]->store(tmp_table.table_name, (uint) table_name_length,
system_charset_info);
- table->field[2]->store(index_name, index_name_length, system_charset_info);
+ table->field[2]->store(index_name, (uint) index_name_length, system_charset_info);
table->field[3]->store((longlong)index_stats->rows_read, TRUE);
if (schema_table_store_record(thd, table))
diff --git a/scripts/comp_sql.c b/scripts/comp_sql.c
index bcc653a3b7f..6f32d6fe9a8 100644
--- a/scripts/comp_sql.c
+++ b/scripts/comp_sql.c
@@ -68,7 +68,7 @@ static void die(const char *fmt, ...)
char *fgets_fn(char *buffer, size_t size, fgets_input_t input, int *error)
{
- char *line= fgets(buffer, size, (FILE*) input);
+ char *line= fgets(buffer, (int)size, (FILE*) input);
if (error)
*error= (line == NULL) ? ferror((FILE*)input) : 0;
return line;
diff --git a/sql-common/client.c b/sql-common/client.c
index f3c100db900..a19d9fca8d1 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -2807,11 +2807,11 @@ void mpvio_info(Vio *vio, MYSQL_PLUGIN_VIO_INFO *info)
switch (vio->type) {
case VIO_TYPE_TCPIP:
info->protocol= MYSQL_VIO_TCP;
- info->socket= vio_fd(vio);
+ info->socket= (int)vio_fd(vio);
return;
case VIO_TYPE_SOCKET:
info->protocol= MYSQL_VIO_SOCKET;
- info->socket= vio_fd(vio);
+ info->socket= (int)vio_fd(vio);
return;
case VIO_TYPE_SSL:
{
@@ -2821,7 +2821,7 @@ void mpvio_info(Vio *vio, MYSQL_PLUGIN_VIO_INFO *info)
return;
info->protocol= addr.sa_family == AF_UNIX ?
MYSQL_VIO_SOCKET : MYSQL_VIO_TCP;
- info->socket= vio_fd(vio);
+ info->socket= (int)vio_fd(vio);
return;
}
#ifdef _WIN32
@@ -3558,11 +3558,11 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
scramble_data_len= pkt_scramble_len;
scramble_plugin= scramble_data + scramble_data_len;
if (scramble_data + scramble_data_len > pkt_end)
- scramble_data_len= pkt_end - scramble_data;
+ scramble_data_len= (int)(pkt_end - scramble_data);
}
else
{
- scramble_data_len= pkt_end - scramble_data;
+ scramble_data_len= (int)(pkt_end - scramble_data);
scramble_plugin= native_password_plugin_name;
}
}
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 5571b87e08a..d7953fe36bf 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -202,7 +202,7 @@ static uint skip_digits(const char **str, const char *end)
while (s < end && my_isdigit(&my_charset_latin1, *s))
s++;
*str= s;
- return s - start;
+ return (uint)(s - start);
}
@@ -236,7 +236,7 @@ static void get_microseconds(ulong *val, MYSQL_TIME_STATUS *status,
uint tmp= 0; /* For the case '10:10:10.' */
if (get_digits(&tmp, number_of_fields, str, end, 6))
status->warnings|= MYSQL_TIME_WARN_TRUNCATED;
- if ((status->precision= (*str - start)) < 6)
+ if ((status->precision= (uint)(*str - start)) < 6)
*val= (ulong) (tmp * log_10_int[6 - (*str - start)]);
else
*val= tmp;
@@ -358,7 +358,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
const char *start= str;
if (get_number(&l_time->year, &number_of_fields, &str, end))
status->warnings|= MYSQL_TIME_WARN_TRUNCATED;
- year_length= str - start;
+ year_length= (uint)(str - start);
if (!status->warnings &&
(get_punct(&str, end)
diff --git a/sql-common/mysql_async.c b/sql-common/mysql_async.c
index decf48e0e69..1bac16edd1e 100644
--- a/sql-common/mysql_async.c
+++ b/sql-common/mysql_async.c
@@ -128,7 +128,7 @@ my_connect_async(struct mysql_async_context *b, my_socket fd,
#endif
ssize_t
-my_recv_async(struct mysql_async_context *b, int fd,
+my_recv_async(struct mysql_async_context *b, my_socket fd,
unsigned char *buf, size_t size, int timeout)
{
ssize_t res;
@@ -156,7 +156,7 @@ my_recv_async(struct mysql_async_context *b, int fd,
ssize_t
-my_send_async(struct mysql_async_context *b, int fd,
+my_send_async(struct mysql_async_context *b, my_socket fd,
const unsigned char *buf, size_t size, int timeout)
{
ssize_t res;
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index f856c313ce8..d929f4c047f 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -240,6 +240,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/debug_sync.cc b/sql/debug_sync.cc
index 4a4a93757ef..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);
@@ -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 86866edffd9..e494b4a429b 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,
diff --git a/sql/field.cc b/sql/field.cc
index 50c372bf53d..3a16f408fa3 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5595,7 +5595,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);
}
@@ -7949,7 +7949,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,
@@ -8496,7 +8496,7 @@ uint gis_field_options_read(const uchar *buf, uint buf_len,
}
end_of_record:
- return cbuf - buf;
+ return (uint)(cbuf - buf);
}
@@ -9750,8 +9750,9 @@ void Column_definition::create_length_to_internal_length(void)
case MYSQL_TYPE_STRING:
case MYSQL_TYPE_VARCHAR:
length*= charset->mbmaxlen;
- key_length= length;
- pack_length= calc_pack_length(sql_type, length);
+ DBUG_ASSERT(length <= UINT_MAX32);
+ key_length= (uint32)length;
+ pack_length= calc_pack_length(sql_type, key_length);
break;
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
@@ -9766,21 +9767,21 @@ void Column_definition::create_length_to_internal_length(void)
}
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);
}
break;
case MYSQL_TYPE_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),
decimals);
break;
default:
- key_length= pack_length= calc_pack_length(sql_type, length);
+ key_length= pack_length= calc_pack_length(sql_type, (uint)length);
break;
}
}
@@ -9953,9 +9954,9 @@ bool Column_definition::check(THD *thd)
DBUG_RETURN(TRUE);
}
length=
- my_decimal_precision_to_length(length, decimals, flags & UNSIGNED_FLAG);
+ my_decimal_precision_to_length((uint)length, decimals, flags & UNSIGNED_FLAG);
pack_length=
- my_decimal_get_binary_size(length, decimals);
+ my_decimal_get_binary_size((uint)length, decimals);
break;
case MYSQL_TYPE_VARCHAR:
/*
@@ -10077,14 +10078,14 @@ bool Column_definition::check(THD *thd)
static_cast<ulong>(MAX_BIT_FIELD_LENGTH));
DBUG_RETURN(TRUE);
}
- pack_length= (length + 7) / 8;
+ pack_length= ((uint)length + 7) / 8;
break;
}
case MYSQL_TYPE_DECIMAL:
DBUG_ASSERT(0); /* Was obsolete */
}
/* 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
@@ -10546,7 +10547,7 @@ Column_definition::Column_definition(THD *thd, Field *old_field,
interval= ((Field_enum*) old_field)->typelib;
else
interval=0;
- char_length= length;
+ char_length= (uint)length;
/*
Copy the default (constant/function) from the column object orig_field, if
@@ -10839,7 +10840,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)
@@ -10858,13 +10859,13 @@ bool Field::save_in_field_default_value(bool view_error_processing)
ER_THD(thd, ER_NO_DEFAULT_FOR_FIELD),
field_name);
}
- 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 2167b90e26c..91e97c8dce7 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -211,7 +211,7 @@ protected:
CHARSET_INFO *cs, const char *str, size_t length,
my_decimal *buf)
{
- m_error= str2my_decimal(mask, str, length, cs,
+ m_error= str2my_decimal(mask, str,(uint) length, cs,
buf, (const char **) &m_end_of_num);
// E_DEC_TRUNCATED means a very minor truncation: '1e-100' -> 0
m_edom= m_error && m_error != E_DEC_TRUNCATED;
@@ -848,7 +848,7 @@ public:
int store(const char *to, uint length, CHARSET_INFO *cs,
enum_check_fields check_level);
int store(const LEX_STRING *ls, CHARSET_INFO *cs)
- { return store(ls->str, ls->length, cs); }
+ { return store(ls->str, (uint32) ls->length, cs); }
virtual double val_real(void)=0;
virtual longlong val_int(void)=0;
virtual bool val_bool(void)= 0;
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 2388dd759b5..f772011241f 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;
@@ -1803,7 +1804,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/ha_partition.cc b/sql/ha_partition.cc
index 4375e891f1f..a0fbdffec90 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -2508,7 +2508,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,
@@ -2524,7 +2524,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,
@@ -6738,7 +6738,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)
{
@@ -7704,7 +7704,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 e87ee03d0ee..2e499238dba 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1372,7 +1372,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));
@@ -5557,9 +5557,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();
diff --git a/sql/handler.h b/sql/handler.h
index e64d407f202..486ba564050 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -766,9 +766,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 74c5d94ec98..910fdd06303 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1051,7 +1051,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
{
diff --git a/sql/item.h b/sql/item.h
index 38bbd6edcd5..a834e3fef94 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -3425,7 +3425,7 @@ public:
Item_string(thd, str, length, system_charset_info)
{ }
Item_string_sys(THD *thd, const char *str):
- Item_string(thd, str, strlen(str), system_charset_info)
+ Item_string(thd, str, (uint) strlen(str), system_charset_info)
{ }
};
@@ -3512,7 +3512,7 @@ class Item_blob :public Item_partition_func_safe_string
{
public:
Item_blob(THD *thd, const char *name_arg, uint length):
- Item_partition_func_safe_string(thd, name_arg, strlen(name_arg), &my_charset_bin)
+ Item_partition_func_safe_string(thd, name_arg, (uint) strlen(name_arg), &my_charset_bin)
{ max_length= length; }
enum Type type() const { return TYPE_HOLDER; }
enum_field_types field_type() const { return MYSQL_TYPE_BLOB; }
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 9a8a158f9e6..1702e450c2a 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -5404,7 +5404,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 4730e187ebe..b6430ecf18d 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -71,7 +71,7 @@ static void wrong_precision_error(uint errcode, Item *a,
*/
bool get_length_and_scale(ulonglong length, ulonglong decimals,
- ulong *out_length, uint *out_decimals,
+ uint *out_length, uint *out_decimals,
uint max_precision, uint max_scale,
Item *a)
{
@@ -88,8 +88,9 @@ bool get_length_and_scale(ulonglong length, ulonglong decimals,
*out_decimals= (uint) decimals;
my_decimal_trim(&length, out_decimals);
- *out_length= (ulong) length;
-
+ *out_length= (uint) length;
+
+
if (*out_length < *out_decimals)
{
my_error(ER_M_BIGGER_THAN_D, MYF(0), "");
@@ -3309,7 +3310,7 @@ Create_udf_func Create_udf_func::s_singleton;
Item*
Create_udf_func::create_func(THD *thd, LEX_STRING 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);
}
@@ -7182,7 +7183,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
break;
case ITEM_CAST_DECIMAL:
{
- ulong len;
+ uint len;
uint dec;
if (get_length_and_scale(length, decimals, &len, &dec,
DECIMAL_MAX_PRECISION, DECIMAL_MAX_SCALE,
@@ -7193,9 +7194,7 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type,
}
case ITEM_CAST_DOUBLE:
{
- ulong len;
- uint dec;
-
+ uint len, dec;
if (!c_len)
{
length= DBL_DIG+7;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index f452b820090..f14222f4451 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1040,8 +1040,8 @@ bool Item_func_hybrid_field_type::get_date(MYSQL_TIME *ltime,
}
case TIME_RESULT:
return date_op(ltime,
- fuzzydate |
- (field_type() == MYSQL_TYPE_TIME ? TIME_TIME_ONLY : 0));
+ (uint)(fuzzydate |
+ (field_type() == MYSQL_TYPE_TIME ? TIME_TIME_ONLY : 0)));
case STRING_RESULT:
{
char buff[40];
diff --git a/sql/item_inetfunc.cc b/sql/item_inetfunc.cc
index 6a09747fa1a..7f3ec3829f4 100644
--- a/sql/item_inetfunc.cc
+++ b/sql/item_inetfunc.cc
@@ -211,7 +211,7 @@ 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)
{
@@ -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++;
@@ -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 6398929defc..77363f80919 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))
@@ -1529,7 +1530,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);
@@ -2860,7 +2862,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))
{
@@ -3134,7 +3136,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 02bfc98b293..89e55234482 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
@@ -3694,12 +3694,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;
@@ -3776,7 +3776,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));
@@ -4002,7 +4002,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_strfunc.h b/sql/item_strfunc.h
index 9c7dfc03aa3..e2dcab01e3b 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -735,7 +735,7 @@ public:
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec()
{
- max_length= (username_char_length +
+ max_length= (uint32) (username_char_length +
HOSTNAME_LENGTH + 1) * SYSTEM_CHARSET_MBMAXLEN;
}
const char *func_name() const { return "user"; }
@@ -777,7 +777,7 @@ public:
Item_func_sysconst(thd), context(context_arg) {}
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec()
- { max_length= username_char_length * SYSTEM_CHARSET_MBMAXLEN; }
+ { max_length= (uint32) username_char_length * SYSTEM_CHARSET_MBMAXLEN; }
int save_in_field(Field *field, bool no_conversions)
{ return save_str_value_in_field(field, &str_value); }
const char *func_name() const { return "current_role"; }
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 8dbd47444f2..2724bb63eda 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -714,7 +714,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++;
@@ -725,7 +725,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++;
@@ -1061,7 +1061,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);
@@ -2456,7 +2456,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 0c931184da7..cdf5c8c4a74 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 a249f102dbd..b0115c3e480 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -5254,7 +5254,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:
@@ -5480,9 +5480,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
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 19bb3a51671..9299932ac4b 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))
@@ -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),
@@ -4170,7 +4170,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;
@@ -4271,7 +4271,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);
@@ -6487,7 +6487,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 : ""),
@@ -6611,7 +6611,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];
@@ -8673,7 +8673,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);
@@ -10382,7 +10382,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;
@@ -10418,9 +10418,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();
diff --git a/sql/log_event.h b/sql/log_event.h
index a06781aebeb..34000a5f9de 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -5097,7 +5097,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 36c4a3867b2..68ffa32fafe 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -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);
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 05e25d99e13..96bbe38d3dd 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4971,7 +4971,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();
@@ -5815,7 +5816,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);
diff --git a/sql/parse_file.cc b/sql/parse_file.cc
index 8f3e26d5e03..0c44f6a9820 100644
--- a/sql/parse_file.cc
+++ b/sql/parse_file.cc
@@ -437,7 +437,7 @@ sql_parse_prepare(const LEX_STRING *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 44d407e0a60..3147baf7d73 100644
--- a/sql/rpl_record.cc
+++ b/sql/rpl_record.cc
@@ -339,8 +339,8 @@ unpack_row(rpl_group_info *rgi,
" pack_ptr: %p; conv_table %p conv_field %p table %s"
" row_end: %p",
f->field_name, 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/session_tracker.cc b/sql/session_tracker.cc
index 03d4b150434..4ca94b6cd60 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 3fb28b587a6..1b1a597fa2a 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -4526,12 +4526,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_pcontext.h b/sql/sp_pcontext.h
index 2a080536b8a..d4d532340fb 100644
--- a/sql/sp_pcontext.h
+++ b/sql/sp_pcontext.h
@@ -323,11 +323,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 map index in this parsing context to runtime offset.
uint var_context2runtime(uint i) const
@@ -476,10 +476,10 @@ public:
const LEX_STRING *find_cursor(uint offset) const;
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(); }
private:
/// Constructor for a tree node.
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 6032c7a9742..819bdb8200a 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -12298,7 +12298,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 */
@@ -12320,10 +12320,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;
}
@@ -12580,7 +12580,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;
@@ -12595,15 +12595,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_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_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_class.cc b/sql/sql_class.cc
index d090372bb1e..1ab2ac67802 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -5235,9 +5235,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_, (ha_rows)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 48e1f3cd0e3..e5aaba9b407 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -3853,7 +3853,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;
}
@@ -3878,7 +3878,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_error.h b/sql/sql_error.h
index 3aef5d38368..0a1e7d38e01 100644
--- a/sql/sql_error.h
+++ b/sql/sql_error.h
@@ -571,7 +571,10 @@ public:
ErrConvString(const String *s)
: ErrConv(), str(s->ptr()), len(s->length()), cs(s->charset()) {}
const char *ptr() const
- { return err_conv(err_buffer, sizeof(err_buffer), str, len, cs); }
+ {
+ DBUG_ASSERT(len < UINT_MAX32);
+ return err_conv(err_buffer, (uint) sizeof(err_buffer), str, (uint) len, cs);
+ }
};
class ErrConvInteger : public ErrConv
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 4d776671ee7..7879edc3f67 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -379,7 +379,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;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index efa48c6e241..b2f20171467 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1482,7 +1482,7 @@ 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,
@@ -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)
@@ -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;
@@ -7645,7 +7645,7 @@ void create_select_for_variable(const char *var_name)
if ((var= get_system_var(thd, OPT_SESSION, tmp, null_lex_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_plugin.cc b/sql/sql_plugin.cc
index eb18a5ba36f..6fe01519380 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -3307,14 +3307,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_select.cc b/sql/sql_select.cc
index 513c02b99e4..0ce7ff958db 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -7807,7 +7807,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]))
{
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index c16b2ef9844..9808c081a54 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;
}
@@ -140,7 +142,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,
@@ -180,10 +182,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;
@@ -440,8 +443,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;
@@ -485,7 +490,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;
}
@@ -495,7 +500,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;
}
@@ -591,7 +596,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)
@@ -720,7 +725,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);
}
@@ -1025,10 +1030,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);
}
@@ -1164,5 +1169,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 1310819d2e3..1a4690a92f4 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -354,22 +354,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;
@@ -378,7 +378,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)
{
@@ -388,7 +388,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;
@@ -405,7 +405,7 @@ public:
else
{
Ptr=new_ptr;
- Alloced_length=arg_length;
+ Alloced_length=(uint32)arg_length;
}
}
}
@@ -428,7 +428,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);
@@ -466,10 +466,10 @@ public:
}
bool append(const String &s);
bool append(const char *s);
- bool append(const LEX_STRING *ls) { return append(ls->str, (uint32)ls->length); }
- bool append(const LEX_CSTRING *ls) { 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 LEX_STRING *ls) { return append(ls->str, (uint32) ls->length); }
+ bool append(const LEX_CSTRING *ls) { return append(ls->str, (uint32) ls->length); }
+ bool append(const char *s, size_t size);
+ bool append(const char *s, uint arg_length, CHARSET_INFO *cs);
bool append_ulonglong(ulonglong val);
bool append_longlong(longlong val);
bool append(IO_CACHE* file, uint32 arg_length);
@@ -552,10 +552,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 write_at_position(int position, uint32 value)
@@ -634,7 +635,9 @@ public:
}
bool append_for_single_quote(const char *st)
{
- return append_for_single_quote(st, (uint)strlen(st));
+ size_t len= strlen(st);
+ DBUG_ASSERT(len < UINT_MAX32);
+ return append_for_single_quote(st, (uint32) len);
}
/* Swap two string objects. Efficient way to exchange data without memcpy. */
@@ -678,10 +681,11 @@ public:
}
void q_net_store_data(const uchar *from, size_t length)
{
+ DBUG_ASSERT(length < UINT_MAX32);
DBUG_ASSERT(Alloced_length >= (str_length + length +
net_length_size(length)));
q_net_store_length(length);
- q_append((const char *)from, length);
+ q_append((const char *)from, (uint32) length);
}
};
diff --git a/sql/sql_time.h b/sql/sql_time.h
index e0cab5cfa66..d560edc296e 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_window.cc b/sql/sql_window.cc
index 0e407308d4e..5fae2228646 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -1733,7 +1733,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 5f956e02bcf..e994ec5f2a5 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -16547,7 +16547,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/sys_vars.cc b/sql/sys_vars.cc
index 6f3ccfc9823..9f5dfa2d3a9 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -2733,7 +2733,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
@@ -4705,7 +4705,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;
}
@@ -5330,7 +5330,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 780450b484b..bc913b1adbd 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_STRING *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 7e75015deb9..2f403de9888 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -343,7 +343,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));
}
diff --git a/sql/table_cache.cc b/sql/table_cache.cc
index f7296ca72c8..8c14b60e73c 100644
--- a/sql/table_cache.cc
+++ b/sql/table_cache.cc
@@ -1203,13 +1203,13 @@ int tdc_wait_for_old_version(THD *thd, const char *db, const char *table_name,
ulong tdc_refresh_version(void)
{
- return my_atomic_load64_explicit(&tdc_version, MY_MEMORY_ORDER_RELAXED);
+ return (ulong)my_atomic_load64_explicit(&tdc_version, MY_MEMORY_ORDER_RELAXED);
}
ulong tdc_increment_refresh_version(void)
{
- ulong v= my_atomic_add64_explicit(&tdc_version, 1, MY_MEMORY_ORDER_RELAXED);
+ ulong v= (ulong)my_atomic_add64_explicit(&tdc_version, 1, MY_MEMORY_ORDER_RELAXED);
DBUG_PRINT("tcache", ("incremented global refresh_version to: %lu", v));
return v + 1;
}
diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc
index 880593a17e9..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,6 +450,7 @@ 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);
@@ -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 a48801d1c4a..c7e2f989829 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/unireg.cc b/sql/unireg.cc
index 8dbfed1cd7e..06151d9318b 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -619,7 +619,7 @@ static bool pack_header(THD *thd, uchar *forminfo,
ER_TOO_LONG_FIELD_COMMENT, field->field_name))
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
@@ -949,7 +949,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,
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 7f83905547b..afa39e6a5f7 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -409,7 +409,7 @@ unsigned int ha_archive::pack_row_v1(uchar *record)
pos+= length;
}
}
- DBUG_RETURN(pos - record_buffer->buffer);
+ DBUG_RETURN((int)(pos - record_buffer->buffer));
}
/*
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index 9b6db947806..a7052188a5d 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -1563,7 +1563,7 @@ static PCSZ MakeKey(PGLOBAL g, UDF_ARGS *args, int i)
n = strlen(s);
if (IsJson(args, i))
- j = strchr(s, '_') - s + 1;
+ j = (int)(strchr(s, '_') - s + 1);
if (j && n > j) {
s += j;
diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp
index d63674e2e36..dbf90fb5599 100644
--- a/storage/connect/plugutil.cpp
+++ b/storage/connect/plugutil.cpp
@@ -534,7 +534,7 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size)
if (trace)
htrc("PlugSubAlloc: %s\n", g->Message);
- throw 1234;
+ abort();
} /* endif size OS32 code */
/*********************************************************************/
diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp
index 196ac16c7b0..b9c97bd2f40 100644
--- a/storage/connect/tabmysql.cpp
+++ b/storage/connect/tabmysql.cpp
@@ -681,7 +681,7 @@ bool TDBMYSQL::MakeCommand(PGLOBAL g)
strlwr(strcpy(name, Name)); // Not a keyword
if ((p = strstr(qrystr, name))) {
- Query->Set(Qrystr, p - qrystr);
+ Query->Set(Qrystr, (uint)(p - qrystr));
if (qtd && *(p-1) == ' ') {
Query->Append('`');
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index 970c503497f..08c4b226e22 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -216,7 +216,7 @@ void ha_heap::update_key_stats()
else
{
ha_rows hash_buckets= file->s->keydef[i].hash_buckets;
- ha_rows no_records= hash_buckets ? (file->s->records/hash_buckets) : 2;
+ ulong no_records= hash_buckets ? (ulong)(file->s->records/hash_buckets) : 2;
if (no_records < 2)
no_records= 2;
key->rec_per_key[key->user_defined_key_parts-1]= no_records;
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index 061ff1ce2ac..d291f6f7c37 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -163,6 +163,7 @@ IF(NOT TARGET innobase)
RETURN()
ENDIF()
+INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
# A GCC bug causes crash when compiling these files on ARM64 with -O1+
# Compile them with -O0 as a workaround.
IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
@@ -170,7 +171,6 @@ IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION)
IF(GCC_VERSION VERSION_LESS 5.2)
- INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
ADD_COMPILE_FLAGS(
btr/btr0btr.cc
btr/btr0cur.cc
@@ -180,5 +180,10 @@ IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
)
ENDIF()
ENDIF()
+IF(MSVC)
+ # silence "switch statement contains 'default' but no 'case' label
+ # on generated file.
+ TARGET_COMPILE_OPTIONS(innobase PRIVATE "/wd4065")
+ENDIF()
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/extra/mariabackup ${CMAKE_BINARY_DIR}/extra/mariabackup)
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index 3c2b697b0f4..f7ea768f5c1 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -292,8 +292,8 @@ buf_read_ahead_random(
node != NULL;
node = UT_LIST_GET_NEXT(chain, node)) {
- size += os_file_get_size(node->handle)
- / page_size.physical();
+ size += ulint(os_file_get_size(node->handle)
+ / page_size.physical());
}
ut_ad(size == space->size);
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 5e7e5a2f21b..08a832a4cd5 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -1324,7 +1324,7 @@ fil_crypt_realloc_iops(
if (10 * state->cnt_waited > state->batch) {
/* if we waited more than 10% re-estimate max_iops */
ulint avg_wait_time_us =
- state->sum_waited_us / state->cnt_waited;
+ ulint(state->sum_waited_us / state->cnt_waited);
if (avg_wait_time_us == 0) {
avg_wait_time_us = 1; // prevent division by zero
@@ -1669,7 +1669,7 @@ fil_crypt_get_page_throttle_func(
/* average page load */
ulint add_sleeptime_ms = 0;
- ulint avg_wait_time_us = state->sum_waited_us / state->cnt_waited;
+ ulint avg_wait_time_us =ulint(state->sum_waited_us / state->cnt_waited);
ulint alloc_wait_us = 1000000 / state->allocated_iops;
if (avg_wait_time_us < alloc_wait_us) {
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 2ebdd259e93..d04971af25d 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -2181,7 +2181,7 @@ convert_error_code_to_mysql(
bool comp = !!(flags & DICT_TF_COMPACT);
ulint free_space = page_get_free_space_of_empty(comp) / 2;
- if (free_space >= (comp ? COMPRESSED_REC_MAX_DATA_SIZE :
+ if (free_space >= ulint(comp ? COMPRESSED_REC_MAX_DATA_SIZE :
REDUNDANT_REC_MAX_DATA_SIZE)) {
free_space = (comp ? COMPRESSED_REC_MAX_DATA_SIZE :
REDUNDANT_REC_MAX_DATA_SIZE) - 1;
@@ -11850,7 +11850,7 @@ err_col:
err = row_create_table_for_mysql(
table, m_trx, false,
(fil_encryption_t)options->encryption,
- options->encryption_key_id);
+ (uint32_t)options->encryption_key_id);
}
DBUG_EXECUTE_IF("ib_crash_during_create_for_encryption",
@@ -15472,7 +15472,7 @@ ha_innobase::update_table_comment(
{
uint length = (uint) strlen(comment);
char* str=0;
- long flen;
+ size_t flen;
std::string fk_str;
/* We do not know if MySQL can call this function before calling
@@ -15500,9 +15500,7 @@ ha_innobase::update_table_comment(
flen = fk_str.length();
- if (flen < 0) {
- flen = 0;
- } else if (length + flen + 3 > 64000) {
+ if (length + flen + 3 > 64000) {
flen = 64000 - 3 - length;
}
/* allocate buffer for the full string */
@@ -22139,8 +22137,8 @@ innobase_find_mysql_table_for_vc(
char dbname[MAX_DATABASE_NAME_LEN + 1];
char tbname[MAX_TABLE_NAME_LEN + 1];
char* name = table->name.m_name;
- uint dbnamelen = dict_get_db_name_len(name);
- uint tbnamelen = strlen(name) - dbnamelen - 1;
+ uint dbnamelen = (uint) dict_get_db_name_len(name);
+ uint tbnamelen = (uint) strlen(name) - dbnamelen - 1;
char t_dbname[MAX_DATABASE_NAME_LEN + 1];
char t_tbname[MAX_TABLE_NAME_LEN + 1];
@@ -22155,7 +22153,6 @@ innobase_find_mysql_table_for_vc(
if (is_part != NULL) {
*is_part = '\0';
- tbnamelen = is_part - tbname;
}
dbnamelen = filename_to_tablename(dbname, t_dbname,
@@ -22665,7 +22662,7 @@ innobase_convert_to_filename_charset(
return(static_cast<uint>(strconvert(
cs_from, from, strlen(from),
- cs_to, to, static_cast<size_t>(len), &errors)));
+ cs_to, to, static_cast<uint>(len), &errors)));
}
/**********************************************************************
@@ -22684,7 +22681,7 @@ innobase_convert_to_system_charset(
return(static_cast<uint>(strconvert(
cs1, from, strlen(from),
- cs2, to, static_cast<size_t>(len), errors)));
+ cs2, to, static_cast<uint>(len), errors)));
}
/**********************************************************************
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index ee8e06ea19f..322a39813d1 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -326,7 +326,7 @@ my_error_innodb(
bool comp = !!(flags & DICT_TF_COMPACT);
ulint free_space = page_get_free_space_of_empty(comp) / 2;
- if (free_space >= (comp ? COMPRESSED_REC_MAX_DATA_SIZE :
+ if (free_space >= ulint(comp ? COMPRESSED_REC_MAX_DATA_SIZE :
REDUNDANT_REC_MAX_DATA_SIZE)) {
free_space = (comp ? COMPRESSED_REC_MAX_DATA_SIZE :
REDUNDANT_REC_MAX_DATA_SIZE) - 1;
diff --git a/storage/innobase/include/fsp0pagecompress.ic b/storage/innobase/include/fsp0pagecompress.ic
index f4b95162b2a..d1f2ea45fbd 100644
--- a/storage/innobase/include/fsp0pagecompress.ic
+++ b/storage/innobase/include/fsp0pagecompress.ic
@@ -82,7 +82,7 @@ UNIV_INLINE
const char*
fil_get_compression_alg_name(
/*=========================*/
- ulint comp_alg) /*!<in: compression algorithm number */
+ ib_uint64_t comp_alg) /*!<in: compression algorithm number */
{
switch(comp_alg) {
case PAGE_UNCOMPRESSED:
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index b366267d6d2..f78336fc2da 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -638,6 +638,9 @@ os_file_create_simple_no_error_handling_func(
bool* success)
MY_ATTRIBUTE((warn_unused_result));
+#ifdef _WIN32
+#define os_file_set_nocache(fd, file_name, operation_name) do{}while(0)
+#else
/** Tries to disable OS caching on an opened file descriptor.
@param[in] fd file descriptor to alter
@param[in] file_name file name, used in the diagnostic message
@@ -646,9 +649,10 @@ os_file_create_simple_no_error_handling_func(
void
os_file_set_nocache(
/*================*/
- os_file_t fd, /*!< in: file descriptor to alter */
+ int fd, /*!< in: file descriptor to alter */
const char* file_name,
const char* operation_name);
+#endif
/** NOTE! Use the corresponding macro os_file_create(), not directly
this function!
diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h
index 8d08416cccd..d7583f87f3b 100644
--- a/storage/innobase/include/sync0types.h
+++ b/storage/innobase/include/sync0types.h
@@ -1192,10 +1192,16 @@ struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) simple_counter
{
compile_time_assert(!atomic || sizeof(Type) == sizeof(lint));
if (atomic) {
- /* Silence MSVS warnings when instantiating
- this template with atomic=false. */
+#ifdef _MSC_VER
+// Suppress type conversion/ possible loss of data warning
+#pragma warning (push)
+#pragma warning (disable : 4244)
+#endif
return Type(my_atomic_addlint(reinterpret_cast<lint*>
(&m_counter), i));
+#ifdef _MSC_VER
+#pragma warning (pop)
+#endif
} else {
return m_counter += i;
}
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 0c015be12f2..31b5cc437f3 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -5254,6 +5254,7 @@ os_file_handle_error_no_exit(
name, operation, false, on_error_silent));
}
+#ifndef _WIN32
/** Tries to disable OS caching on an opened file descriptor.
@param[in] fd file descriptor to alter
@param[in] file_name file name, used in the diagnostic message
@@ -5261,7 +5262,7 @@ os_file_handle_error_no_exit(
message */
void
os_file_set_nocache(
- os_file_t fd MY_ATTRIBUTE((unused)),
+ int fd MY_ATTRIBUTE((unused)),
const char* file_name MY_ATTRIBUTE((unused)),
const char* operation_name MY_ATTRIBUTE((unused)))
{
@@ -5310,6 +5311,8 @@ short_warning:
#endif /* defined(UNIV_SOLARIS) && defined(DIRECTIO_ON) */
}
+#endif /* _WIN32 */
+
/** Write the specified number of zeros to a newly created file.
@param[in] name name of the file or path as a null-terminated
string
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index cffc40af835..69ad8e3ad0f 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -4016,7 +4016,7 @@ row_merge_file_create(
if (merge_file->fd >= 0) {
if (srv_disable_sort_file_cache) {
- os_file_set_nocache((os_file_t)merge_file->fd,
+ os_file_set_nocache(merge_file->fd,
"row0merge.cc", "sort");
}
}
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index bd3c5a3d8bc..d7e1e062d7a 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -1898,9 +1898,6 @@ innobase_start_or_create_for_mysql()
return(srv_init_abort(DB_ERROR));
}
- compile_time_assert(ulonglong(ULINT_MAX) * UNIV_PAGE_SIZE_MIN
- >= 512ULL << 30);
-
os_normalize_path(srv_data_home);
/* Check if the data files exist or not. */
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 33ec4ea7db1..0c642aa6c65 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -405,7 +405,7 @@ static void _ma_check_print_msg(HA_CHECK *param, const char *msg_type,
{
THD *thd= (THD *) param->thd;
Protocol *protocol= thd->protocol;
- uint length, msg_length;
+ size_t length, msg_length;
char msgbuf[MYSQL_ERRMSG_SIZE];
char name[NAME_LEN * 2 + 2];
@@ -442,10 +442,10 @@ static void _ma_check_print_msg(HA_CHECK *param, const char *msg_type,
push_warning).
*/
protocol->prepare_for_resend();
- protocol->store(name, length, system_charset_info);
+ protocol->store(name, (uint)length, system_charset_info);
protocol->store(param->op_name, system_charset_info);
protocol->store(msg_type, system_charset_info);
- protocol->store(msgbuf, msg_length, system_charset_info);
+ protocol->store(msgbuf, (uint)msg_length, system_charset_info);
if (protocol->write())
sql_print_error("Failed on my_net_write, writing to stderr instead: %s.%s: %s\n",
param->db_name, param->table_name, msgbuf);
@@ -3427,7 +3427,7 @@ bool maria_show_status(handlerton *hton,
{
char *file;
const char *status;
- uint length, status_len;
+ size_t length, status_len;
MY_STAT stat_buff, *stat;
const char error[]= "can't stat";
char object[SHOW_MSG_LEN];
@@ -3455,8 +3455,8 @@ bool maria_show_status(handlerton *hton,
status= needed;
status_len= sizeof(needed) - 1;
}
- length= my_snprintf(object, SHOW_MSG_LEN, "Size %12lu ; %s",
- (ulong) stat->st_size, file);
+ length= my_snprintf(object, SHOW_MSG_LEN, "Size %12llu ; %s",
+ (ulonglong) stat->st_size, file);
}
print(thd, engine_name->str, engine_name->length,
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index 57596558208..b965f5db34b 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -7540,7 +7540,7 @@ void _ma_print_block_info(MARIA_SHARE *share, uchar *buff)
{
LSN lsn= lsn_korr(buff);
- printf("LSN: %lu,0x%lx type: %u dir_entries: %u dir_free: %u empty_space: %u\n",
+ printf("LSN:" LSN_FMT " type: %u dir_entries: %u dir_free: %u empty_space: %u\n",
LSN_IN_PARTS(lsn),
(uint)buff[PAGE_TYPE_OFFSET],
(uint)buff[DIR_COUNT_OFFSET],
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 078ef813605..7caec1fd834 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -772,7 +772,7 @@ static
void maria_collect_stats_nonulls_first(HA_KEYSEG *keyseg, ulonglong *notnull,
const uchar *key)
{
- uint first_null, kp;
+ size_t first_null, kp;
first_null= ha_find_null(keyseg, key) - keyseg;
/*
All prefix tuples that don't include keypart_{first_null} are not-null
@@ -814,7 +814,7 @@ int maria_collect_stats_nonulls_next(HA_KEYSEG *keyseg, ulonglong *notnull,
const uchar *last_key)
{
uint diffs[2];
- uint first_null_seg, kp;
+ size_t first_null_seg, kp;
HA_KEYSEG *seg;
/*
@@ -5671,7 +5671,7 @@ static int sort_maria_ft_key_write(MARIA_SORT_PARAM *sort_param,
key_block++;
sort_info->key_block=key_block;
sort_param->keyinfo= &share->ft2_keyinfo;
- ft_buf->count=(ft_buf->buf - p)/val_len;
+ ft_buf->count=(uint)(ft_buf->buf - p)/val_len;
/* flushing buffer to second-level tree */
for (error=0; !error && p < ft_buf->buf; p+= val_len)
diff --git a/storage/maria/ma_key.c b/storage/maria/ma_key.c
index 89693f45dca..6f3e17ed80d 100644
--- a/storage/maria/ma_key.c
+++ b/storage/maria/ma_key.c
@@ -318,7 +318,7 @@ MARIA_KEY *_ma_make_key(MARIA_HA *info, MARIA_KEY *int_key, uint keynr,
key+= length;
}
_ma_dpointer(info->s, key, filepos);
- int_key->data_length= (key - int_key->data);
+ int_key->data_length= (uint)(key - int_key->data);
int_key->ref_length= info->s->rec_reflength;
int_key->flag= 0;
if (_ma_have_versioning(info) && trid)
@@ -449,7 +449,7 @@ MARIA_KEY *_ma_pack_key(register MARIA_HA *info, MARIA_KEY *int_key,
/* set flag to SEARCH_PART_KEY if we are not using all key parts */
int_key->flag= keyseg->type ? SEARCH_PART_KEY : 0;
int_key->ref_length= 0;
- int_key->data_length= (key - int_key->data);
+ int_key->data_length= (uint)(key - int_key->data);
DBUG_PRINT("exit", ("length: %u", int_key->data_length));
DBUG_RETURN(int_key);
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index c9d2362d7e2..ce254c5f631 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -1770,11 +1770,11 @@ static void translog_new_page_header(TRANSLOG_ADDRESS *horizon,
ptr+= TRANSLOG_PAGE_SIZE / DISK_DRIVE_SECTOR_SIZE;
}
{
- uint len= (ptr - cursor->ptr);
+ size_t len= (ptr - cursor->ptr);
(*horizon)+= len; /* increasing the offset part of the address */
- cursor->current_page_fill= len;
+ cursor->current_page_fill= (uint16)len;
if (!cursor->chaser)
- cursor->buffer->size+= len;
+ cursor->buffer->size+= (translog_size_t)len;
}
cursor->ptr= ptr;
DBUG_PRINT("info", ("NewP buffer #%u: %p chaser: %d Size: %lu (%lu) "
@@ -1885,14 +1885,14 @@ static void translog_finish_page(TRANSLOG_ADDRESS *horizon,
DBUG_PRINT("enter", ("Buffer: #%u %p "
"Buffer addr: " LSN_FMT " "
"Page addr: " LSN_FMT " "
- "size:%lu (%lu) Pg:%u left:%u",
+ "size:%u (%u) Pg:%u left:%u",
(uint) cursor->buffer_no, cursor->buffer,
LSN_IN_PARTS(cursor->buffer->offset),
- LSN_FILE_NO(*horizon),
- (LSN_OFFSET(*horizon) -
+ (uint)LSN_FILE_NO(*horizon),
+ (uint)(LSN_OFFSET(*horizon) -
cursor->current_page_fill),
- (ulong) cursor->buffer->size,
- (ulong) (cursor->ptr -cursor->buffer->buffer),
+ (uint) cursor->buffer->size,
+ (uint) (cursor->ptr -cursor->buffer->buffer),
(uint) cursor->current_page_fill, (uint) left));
DBUG_ASSERT(LSN_FILE_NO(*horizon) == LSN_FILE_NO(cursor->buffer->offset));
translog_check_cursor(cursor);
@@ -2637,8 +2637,8 @@ static my_bool translog_buffer_flush(struct st_translog_buffer *buffer)
{
DBUG_PRINT("error",
("Can't write page " LSN_FMT " to pagecache, error: %d",
- (ulong) buffer->file->number,
- (ulong) (LSN_OFFSET(buffer->offset)+ i),
+ buffer->file->number,
+ (uint)(LSN_OFFSET(buffer->offset)+ i),
my_errno));
translog_stop_writing();
DBUG_RETURN(1);
@@ -2653,8 +2653,8 @@ static my_bool translog_buffer_flush(struct st_translog_buffer *buffer)
{
DBUG_PRINT("error", ("Can't write buffer " LSN_FMT " size %lu "
"to the disk (%d)",
- (ulong) file->handler.file,
- (ulong) LSN_OFFSET(buffer->offset),
+ (uint) file->handler.file,
+ (uint) LSN_OFFSET(buffer->offset),
(ulong) buffer->size, errno));
translog_stop_writing();
DBUG_RETURN(1);
@@ -2877,7 +2877,7 @@ static my_bool translog_page_validator(int res, PAGECACHE_IO_HOOK_ARGS *args)
DBUG_PRINT("error", ("Page " LSN_FMT ": "
"page address written in the page is incorrect: "
"File %lu instead of %lu or page %lu instead of %lu",
- (ulong) data->number, (ulong) offset,
+ (uint)data->number, (uint)offset,
(ulong) uint3korr(page + 3), (ulong) data->number,
(ulong) uint3korr(page),
(ulong) page_no));
@@ -2890,7 +2890,7 @@ static my_bool translog_page_validator(int res, PAGECACHE_IO_HOOK_ARGS *args)
{
DBUG_PRINT("error", ("Page " LSN_FMT ": "
"Garbage in the page flags field detected : %x",
- (ulong) data->number, (ulong) offset,
+ (uint) data->number, (uint) offset,
(uint) flags));
DBUG_RETURN(1);
}
@@ -2904,7 +2904,7 @@ static my_bool translog_page_validator(int res, PAGECACHE_IO_HOOK_ARGS *args)
{
DBUG_PRINT("error", ("Page " LSN_FMT ": "
"CRC mismatch: calculated: %lx on the page %lx",
- (ulong) data->number, (ulong) offset,
+ (uint) data->number, (uint) offset,
(ulong) crc, (ulong) uint4korr(page_pos)));
DBUG_RETURN(1);
}
@@ -4892,7 +4892,7 @@ static uint translog_get_current_page_rest()
static uint translog_get_current_buffer_rest()
{
- return ((log_descriptor.bc.buffer->buffer + TRANSLOG_WRITE_BUFFER -
+ return (uint)((log_descriptor.bc.buffer->buffer + TRANSLOG_WRITE_BUFFER -
log_descriptor.bc.ptr) /
TRANSLOG_PAGE_SIZE);
}
@@ -5087,10 +5087,10 @@ translog_write_variable_record_1group(LSN *lsn,
&horizon, &cursor))
DBUG_RETURN(1);
DBUG_PRINT("info", ("absolute horizon: " LSN_FMT " local: " LSN_FMT,
- (ulong) LSN_FILE_NO(log_descriptor.horizon),
- (ulong) LSN_OFFSET(log_descriptor.horizon),
- (ulong) LSN_FILE_NO(horizon),
- (ulong) LSN_OFFSET(horizon)));
+ (uint) LSN_FILE_NO(log_descriptor.horizon),
+ (uint) LSN_OFFSET(log_descriptor.horizon),
+ (uint) LSN_FILE_NO(horizon),
+ (uint) LSN_OFFSET(horizon)));
translog_buffer_lock(cursor.buffer);
translog_buffer_decrease_writers(cursor.buffer);
@@ -6624,11 +6624,11 @@ static my_bool translog_scanner_eol(TRANSLOG_SCANNER_DATA *scanner)
{
DBUG_ENTER("translog_scanner_eol");
DBUG_PRINT("enter",
- ("Horizon: " LSN_FMT " Current: (%lu, 0x%lx+0x%x=0x%lx)",
+ ("Horizon: " LSN_FMT " Current: (%u, 0x%x+0x%x=0x%x)",
LSN_IN_PARTS(scanner->horizon),
LSN_IN_PARTS(scanner->page_addr),
(uint) scanner->page_offset,
- (ulong) (LSN_OFFSET(scanner->page_addr) + scanner->page_offset)));
+ (uint) (LSN_OFFSET(scanner->page_addr) + scanner->page_offset)));
if (scanner->horizon > (scanner->page_addr +
scanner->page_offset))
{
@@ -6834,7 +6834,7 @@ translog_variable_length_header(uchar *page, translog_size_t page_offset,
src+= (2 + 2);
page_rest= (uint16) (TRANSLOG_PAGE_SIZE - (src - page));
curr= 0;
- header_to_skip= src - (page + page_offset);
+ header_to_skip= (uint) (src - (page + page_offset));
buff->chunk0_pages= 0;
for (;;)
@@ -7465,8 +7465,8 @@ static void translog_force_current_buffer_to_finish()
(uint) old_buffer_no,
old_buffer,
LSN_IN_PARTS(old_buffer->offset),
- (ulong) LSN_FILE_NO(log_descriptor.horizon),
- (ulong) (LSN_OFFSET(log_descriptor.horizon) -
+ LSN_FILE_NO(log_descriptor.horizon),
+ (uint)(LSN_OFFSET(log_descriptor.horizon) -
log_descriptor.bc.current_page_fill),
(ulong) old_buffer->size,
(ulong) (log_descriptor.bc.ptr -log_descriptor.bc.
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index 8a51ff99fc2..256cb2b45b2 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -3349,7 +3349,7 @@ static LSN parse_checkpoint_record(LSN lsn)
page_id, rec_lsn, next_dirty_page_in_pool++))
return LSN_ERROR;
if (maria_recovery_verbose)
- tprint(tracef, "%8u %8u %12lu %lu,0x%lx\n", (uint) table_id,
+ tprint(tracef, "%8u %8u %12lu " LSN_FMT "\n", (uint) table_id,
(uint) is_index, (ulong) page_id, LSN_IN_PARTS(rec_lsn));
set_if_smaller(minimum_rec_lsn_of_dirty_pages, rec_lsn);
}
diff --git a/storage/maria/ma_rt_index.c b/storage/maria/ma_rt_index.c
index c92045eb245..4c18bff7c70 100644
--- a/storage/maria/ma_rt_index.c
+++ b/storage/maria/ma_rt_index.c
@@ -105,7 +105,7 @@ static int maria_rtree_find_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
level + 1)))
{
case 0: /* found - exit from recursion */
- *saved_key= k - page_buf;
+ *saved_key= (uint) (k - page_buf);
goto ok;
case 1: /* not found - continue searching */
info->maria_rtree_recursion_depth= level;
@@ -140,7 +140,7 @@ static int maria_rtree_find_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
memcpy(info->last_key.data, k,
info->last_key.data_length + info->last_key.ref_length);
info->maria_rtree_recursion_depth= level;
- *saved_key= last - page_buf;
+ *saved_key= (uint) (last - page_buf);
if (after_key < last)
{
@@ -366,7 +366,7 @@ static int maria_rtree_get_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
_ma_kpos(nod_flag, k), level + 1)))
{
case 0: /* found - exit from recursion */
- *saved_key= k - page.buff;
+ *saved_key= (uint) (k - page.buff);
goto ok;
case 1: /* not found - continue searching */
info->maria_rtree_recursion_depth= level;
@@ -398,7 +398,7 @@ static int maria_rtree_get_req(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
info->last_key.data_length + info->last_key.ref_length);
info->maria_rtree_recursion_depth= level;
- *saved_key= k - page.buff;
+ *saved_key= (uint) (k - page.buff);
if (after_key < last)
{
diff --git a/storage/maria/ma_rt_key.c b/storage/maria/ma_rt_key.c
index 488137ff159..500e484cf02 100644
--- a/storage/maria/ma_rt_key.c
+++ b/storage/maria/ma_rt_key.c
@@ -58,7 +58,7 @@ int maria_rtree_add_key(const MARIA_KEY *key, MARIA_PAGE *page,
page->size+= tot_key_length;
page_store_size(share, page);
if (share->now_transactional &&
- _ma_log_add(page, key_pos - page->buff,
+ _ma_log_add(page, (uint)(key_pos - page->buff),
key_pos, tot_key_length, tot_key_length, 0,
KEY_OP_DEBUG_LOG_ADD_1))
DBUG_RETURN(-1);
diff --git a/storage/maria/ma_rt_split.c b/storage/maria/ma_rt_split.c
index 804cfe75558..898cb574f63 100644
--- a/storage/maria/ma_rt_split.c
+++ b/storage/maria/ma_rt_split.c
@@ -477,11 +477,11 @@ int maria_rtree_split_page(const MARIA_KEY *key, MARIA_PAGE *page,
memcpy(to_with_nod_flag, cur_key_with_nod_flag, full_length);
if (log_this_change)
{
- uint to_with_nod_flag_offs= to_with_nod_flag - page->buff;
+ size_t to_with_nod_flag_offs= to_with_nod_flag - page->buff;
if (likely(cur_key != key->data))
{
/* this memcpy() is internal to the page (source in the page) */
- uint cur_key_with_nod_flag_offs= cur_key_with_nod_flag - page->buff;
+ size_t cur_key_with_nod_flag_offs= cur_key_with_nod_flag - page->buff;
int2store(log_internal_copy_ptr, to_with_nod_flag_offs);
log_internal_copy_ptr+= 2;
int2store(log_internal_copy_ptr, cur_key_with_nod_flag_offs);
@@ -526,8 +526,8 @@ int maria_rtree_split_page(const MARIA_KEY *key, MARIA_PAGE *page,
( /* log change to split page */
_ma_log_rt_split(page, key->data - nod_flag,
full_length, log_internal_copy,
- log_internal_copy_ptr - log_internal_copy,
- log_key_copy, org_length - page->size) ||
+ (uint)(log_internal_copy_ptr - log_internal_copy),
+ log_key_copy, (uint)(org_length - page->size)) ||
/* and to new page */
_ma_log_new(&new_page, 0)))
err_code= -1;
diff --git a/storage/maria/ma_search.c b/storage/maria/ma_search.c
index 87e422d0230..089e3fabdb2 100644
--- a/storage/maria/ma_search.c
+++ b/storage/maria/ma_search.c
@@ -1134,7 +1134,7 @@ uint _ma_get_pack_key(MARIA_KEY *int_key, uint page_flag,
page+=length;
}
- int_key->data_length= (key - int_key->data);
+ int_key->data_length= (uint)(key - int_key->data);
int_key->flag= 0;
length= keyseg->length;
if (page_flag & KEYPAGE_FLAG_HAS_TRANSID)
@@ -1336,7 +1336,7 @@ uint _ma_get_binary_pack_key(MARIA_KEY *int_key, uint page_flag, uint nod_flag,
If we have mixed key blocks with data pointer and key block pointer,
we have to copy both.
*/
- int_key->data_length= (key - int_key->data);
+ int_key->data_length= (uint)(key - int_key->data);
int_key->ref_length= length= keyseg->length;
int_key->flag= 0;
if ((tmp=(uint) (from_end-from)) <= length)
diff --git a/storage/maria/ma_sort.c b/storage/maria/ma_sort.c
index 6e106976b70..024b72fff2e 100644
--- a/storage/maria/ma_sort.c
+++ b/storage/maria/ma_sort.c
@@ -500,10 +500,10 @@ static my_bool _ma_thr_find_all_keys_exec(MARIA_SORT_PARAM* sort_param)
(BUFFPEK *) alloc_dynamic(&sort_param->buffpek),
&sort_param->tempfile))
goto err;
- sort_param->keys= (sort_param->buffpek.elements - 1) * (keys - 1) + idx;
+ sort_param->keys= (uint)((sort_param->buffpek.elements - 1) * (keys - 1) + idx);
}
else
- sort_param->keys= idx;
+ sort_param->keys= (uint)idx;
DBUG_RETURN(FALSE);
@@ -627,7 +627,7 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
uint maxbuffer=sinfo->buffpek.elements-1;
if (!mergebuf)
{
- length=param->sort_buffer_length;
+ length=(size_t)param->sort_buffer_length;
while (length >= MIN_SORT_MEMORY)
{
if ((mergebuf= my_malloc((size_t) length, MYF(0))))
@@ -919,13 +919,13 @@ static my_off_t read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek,
uint sort_length)
{
register ha_keys count;
- my_off_t length;
+ size_t length;
if ((count= (ha_keys) MY_MIN((ha_rows) buffpek->max_keys,
(ha_rows) buffpek->count)))
{
if (my_b_pread(fromfile, (uchar*) buffpek->base,
- (length= sort_length * count), buffpek->file_pos))
+ (length= sort_length * (size_t)count), buffpek->file_pos))
return(HA_OFFSET_ERROR); /* purecov: inspected */
buffpek->key=buffpek->base;
buffpek->file_pos+= length; /* New filepos */
diff --git a/storage/maria/maria_read_log.c b/storage/maria/maria_read_log.c
index c4570922e08..2c24c125f36 100644
--- a/storage/maria/maria_read_log.c
+++ b/storage/maria/maria_read_log.c
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
fprintf(stderr, "Can't find any log\n");
goto err;
}
- if (init_pagecache(maria_pagecache, opt_page_buffer_size, 0, 0,
+ if (init_pagecache(maria_pagecache, (size_t)opt_page_buffer_size, 0, 0,
maria_block_size, 0, MY_WME) == 0)
{
fprintf(stderr, "Got error in init_pagecache() (errno: %d)\n", errno);
diff --git a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
index 776fcb56570..69bc2f70f8c 100644
--- a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
@@ -485,7 +485,7 @@ int main(int argc __attribute__((unused)), char *argv[])
fprintf(stderr, "Incorrect LOGREC_FIXED_RECORD_0LSN_EXAMPLE "
"data read(0)\n"
"type %u, strid %u, len %u, i: %u, 4: %u 5: %u, "
- "lsn(0x%lu,0x%lx)\n",
+ LSN_FMT "\n",
(uint) rec.type, (uint) rec.short_trid, (uint) rec.record_length,
(uint)uint4korr(rec.header), (uint) rec.header[4],
(uint) rec.header[5],
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index 8fd2bf74ccb..917e142af91 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -3968,7 +3968,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a)
key_block++;
sort_info->key_block=key_block;
sort_param->keyinfo=& sort_info->info->s->ft2_keyinfo;
- ft_buf->count=((uchar*) ft_buf->buf - p)/val_len;
+ ft_buf->count=(int)((uchar*) ft_buf->buf - p)/val_len;
/* flushing buffer to second-level tree */
for (error=0; !error && p < (uchar*) ft_buf->buf; p+= val_len)
diff --git a/storage/myisam/mi_preload.c b/storage/myisam/mi_preload.c
index 1a2d5aac94f..5feb1c59ac3 100644
--- a/storage/myisam/mi_preload.c
+++ b/storage/myisam/mi_preload.c
@@ -41,7 +41,7 @@
int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
{
uint i;
- ulong length, block_length= 0;
+ size_t length, block_length= 0;
uchar *buff= NULL;
MYISAM_SHARE* share= info->s;
uint keys= share->state.header.keys;
@@ -84,7 +84,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
{
/* Read the next block of index file into the preload buffer */
if ((my_off_t) length > (key_file_length-pos))
- length= (ulong) (key_file_length-pos);
+ length= (size_t) (key_file_length-pos);
if (mysql_file_pread(share->kfile, (uchar*) buff, length, pos,
MYF(MY_FAE|MY_FNABP)))
goto err;
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index c31ac8cd0d4..b4eef26f028 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -28,7 +28,7 @@
static uint decode_bits;
static char **default_argv;
static const char *load_default_groups[]= { "myisamchk", 0 };
-static const char *set_collation_name, *opt_tmpdir;
+static char *set_collation_name, *opt_tmpdir;
static CHARSET_INFO *set_collation;
static long opt_myisam_block_size;
static long opt_key_cache_block_size;
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 93b6e08eda8..7ff4b2e483b 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -1684,7 +1684,7 @@ uint ha_myisammrg::count_query_cache_dependant_tables(uint8 *tables_type)
(*tables_type)|= HA_CACHE_TBL_NONTRANSACT;
but it has no effect because HA_CACHE_TBL_NONTRANSACT is 0
*/
- return (file->end_table - file->open_tables);
+ return (uint)(file->end_table - file->open_tables);
}
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index 3fd0e62ac44..d51908bdd66 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -1265,7 +1265,7 @@ static int build_prefix(const LEX_STRING *prefix, const char *category,
out_ptr+= len;
*out_ptr= '/';
out_ptr++;
- *output_length= out_ptr - output;
+ *output_length= (int)(out_ptr - output);
return 0;
}
@@ -1942,7 +1942,7 @@ static void set_thread_id_v1(PSI_thread *thread, ulonglong processlist_id)
PFS_thread *pfs= reinterpret_cast<PFS_thread*> (thread);
if (unlikely(pfs == NULL))
return;
- pfs->m_processlist_id= processlist_id;
+ pfs->m_processlist_id= (ulong)processlist_id;
}
/**
@@ -5121,7 +5121,7 @@ static void set_socket_info_v1(PSI_socket *socket,
/** Set socket descriptor */
if (fd != NULL)
- pfs->m_fd= *fd;
+ pfs->m_fd= (uint)*fd;
/** Set raw socket address and length */
if (likely(addr != NULL && addr_len > 0))
diff --git a/storage/perfschema/pfs_account.cc b/storage/perfschema/pfs_account.cc
index 4e3a6d8d1d3..60467a764e3 100644
--- a/storage/perfschema/pfs_account.cc
+++ b/storage/perfschema/pfs_account.cc
@@ -202,7 +202,7 @@ static void set_account_key(PFS_account_key *key,
}
ptr[0]= 0;
ptr++;
- key->m_key_length= ptr - &key->m_hash_key[0];
+ key->m_key_length= (uint)(ptr - &key->m_hash_key[0]);
}
PFS_account *
diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc
index 9e9ab02df46..547e5a3dfe3 100644
--- a/storage/perfschema/pfs_engine_table.cc
+++ b/storage/perfschema/pfs_engine_table.cc
@@ -1359,7 +1359,7 @@ bool pfs_show_status(handlerton *hton, THD *thd,
break;
}
- buflen= longlong10_to_str(size, buf, 10) - buf;
+ buflen= (uint)(longlong10_to_str(size, buf, 10) - buf);
if (print(thd,
PERFORMANCE_SCHEMA_str.str, PERFORMANCE_SCHEMA_str.length,
name, strlen(name),
diff --git a/storage/perfschema/pfs_host.cc b/storage/perfschema/pfs_host.cc
index 7da34a6d5f6..15db3e80a94 100644
--- a/storage/perfschema/pfs_host.cc
+++ b/storage/perfschema/pfs_host.cc
@@ -190,7 +190,7 @@ static void set_host_key(PFS_host_key *key,
}
ptr[0]= 0;
ptr++;
- key->m_key_length= ptr - &key->m_hash_key[0];
+ key->m_key_length= (uint)(ptr - &key->m_hash_key[0]);
}
PFS_host *find_or_create_host(PFS_thread *thread,
diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc
index a9ea6faf212..9cb2c68dbaf 100644
--- a/storage/perfschema/pfs_instr.cc
+++ b/storage/perfschema/pfs_instr.cc
@@ -952,7 +952,7 @@ PFS_thread* create_thread(PFS_thread_class *klass, const void *identity,
pfs->m_thread_internal_id=
PFS_atomic::add_u64(&thread_internal_id_counter, 1);
pfs->m_parent_thread_internal_id= 0;
- pfs->m_processlist_id= processlist_id;
+ pfs->m_processlist_id= (ulong)processlist_id;
pfs->m_event_id= 1;
pfs->m_stmt_lock.set_allocated();
pfs->m_session_lock.set_allocated();
@@ -1604,7 +1604,7 @@ PFS_socket* create_socket(PFS_socket_class *klass, const my_socket *fd,
uint addr_len_used= addr_len;
if (fd != NULL)
- fd_used= *fd;
+ fd_used= (int)*fd;
if (addr_len_used > sizeof(sockaddr_storage))
addr_len_used= sizeof(sockaddr_storage);
diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc
index c67c120283d..ed22c36f0d2 100644
--- a/storage/perfschema/pfs_instr_class.cc
+++ b/storage/perfschema/pfs_instr_class.cc
@@ -449,7 +449,7 @@ static void set_table_share_key(PFS_table_share_key *key,
ptr+= table_name_length;
ptr[0]= 0;
ptr++;
- key->m_key_length= ptr - &key->m_hash_key[0];
+ key->m_key_length= (uint)(ptr - &key->m_hash_key[0]);
if (lower_case_table_names)
{
diff --git a/storage/perfschema/pfs_setup_actor.cc b/storage/perfschema/pfs_setup_actor.cc
index f12d70840c1..40534d65da0 100644
--- a/storage/perfschema/pfs_setup_actor.cc
+++ b/storage/perfschema/pfs_setup_actor.cc
@@ -152,7 +152,7 @@ static void set_setup_actor_key(PFS_setup_actor_key *key,
ptr+= role_length;
ptr[0]= 0;
ptr++;
- key->m_key_length= ptr - &key->m_hash_key[0];
+ key->m_key_length= (uint)(ptr - &key->m_hash_key[0]);
}
int insert_setup_actor(const String *user, const String *host, const String *role)
diff --git a/storage/perfschema/pfs_setup_object.cc b/storage/perfschema/pfs_setup_object.cc
index 809fe8edd24..9fca9a6b945 100644
--- a/storage/perfschema/pfs_setup_object.cc
+++ b/storage/perfschema/pfs_setup_object.cc
@@ -145,7 +145,7 @@ static void set_setup_object_key(PFS_setup_object_key *key,
ptr+= object_length;
ptr[0]= 0;
ptr++;
- key->m_key_length= ptr - &key->m_hash_key[0];
+ key->m_key_length= (uint)(ptr - &key->m_hash_key[0]);
}
int insert_setup_object(enum_object_type object_type, const String *schema,
diff --git a/storage/perfschema/pfs_user.cc b/storage/perfschema/pfs_user.cc
index 528457fe017..d2266e1f7ef 100644
--- a/storage/perfschema/pfs_user.cc
+++ b/storage/perfschema/pfs_user.cc
@@ -190,7 +190,7 @@ static void set_user_key(PFS_user_key *key,
}
ptr[0]= 0;
ptr++;
- key->m_key_length= ptr - &key->m_hash_key[0];
+ key->m_key_length= (uint)(ptr - &key->m_hash_key[0]);
}
PFS_user *
diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc
index cd32d81519e..01f8cd5e6b5 100644
--- a/storage/perfschema/table_events_waits.cc
+++ b/storage/perfschema/table_events_waits.cc
@@ -279,7 +279,7 @@ int table_events_waits_common::make_socket_object_columns(volatile PFS_events_wa
safe_socket->m_addr_len);
/* Convert port number to a string (length includes ':') */
- int port_len= int10_to_str(port, (port_str+1), 10) - port_str + 1;
+ int port_len= (int)(int10_to_str(port, (port_str+1), 10) - port_str + 1);
/* OBJECT NAME */
m_row.m_object_name_length= ip_length + port_len;
diff --git a/storage/rocksdb/rdb_sst_info.cc b/storage/rocksdb/rdb_sst_info.cc
index 8ca00bb30f5..72abfab5d6b 100644
--- a/storage/rocksdb/rdb_sst_info.cc
+++ b/storage/rocksdb/rdb_sst_info.cc
@@ -104,9 +104,11 @@ Rdb_sst_file_ordered::Rdb_sst_file::put(const rocksdb::Slice &key,
const rocksdb::Slice &value) {
DBUG_ASSERT(m_sst_file_writer != nullptr);
+#ifdef __GNUC__
// Add the specified key/value to the sst file writer
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
return m_sst_file_writer->Add(key, value);
}
diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc
index 650bc93cf67..121cf41a3fe 100644
--- a/storage/sphinx/ha_sphinx.cc
+++ b/storage/sphinx/ha_sphinx.cc
@@ -1735,7 +1735,7 @@ bool CSphSEQuery::ParseField ( char * sField )
}
} else if ( !strcmp ( sName, "override" ) ) // name,type,id:value,id:value,...
{
- char * sName = NULL;
+ sName = NULL;
int iType = 0;
CSphSEQuery::Override_t * pOverride = NULL;
@@ -1790,7 +1790,7 @@ bool CSphSEQuery::ParseField ( char * sField )
if (!( sRest = strchr ( sRest, ':' ) )) break; *sRest++ = '\0';
if (!( sRest - sId )) break;
- char * sValue = sRest;
+ sValue = sRest;
if ( ( sRest = strchr ( sRest, ',' ) )!=NULL )
*sRest++ = '\0';
if ( !*sValue )
@@ -2209,7 +2209,7 @@ int ha_sphinx::Connect ( const char * sHost, ushort uPort )
}
char sError[512];
- int iSocket = socket ( iDomain, SOCK_STREAM, 0 );
+ int iSocket = (int) socket ( iDomain, SOCK_STREAM, 0 );
if ( iSocket<0 )
{
@@ -2670,7 +2670,7 @@ bool ha_sphinx::UnpackStats ( CSphSEStats * pStats )
assert ( pStats );
char * pCurSave = m_pCur;
- for ( uint i=0; i<m_iMatchesTotal && m_pCur<m_pResponseEnd-sizeof(uint32); i++ ) // NOLINT
+ for ( uint m=0; m<m_iMatchesTotal && m_pCur<m_pResponseEnd-sizeof(uint32); m++ ) // NOLINT
{
m_pCur += m_bId64 ? 12 : 8; // skip id+weight
for ( uint32 i=0; i<m_iAttrs && m_pCur<m_pResponseEnd-sizeof(uint32); i++ ) // NOLINT
@@ -3155,7 +3155,7 @@ int ha_sphinx::get_rec ( byte * buf, const byte *, uint )
}
}
- af->store ( sBuf, pCur-sBuf, &my_charset_bin );
+ af->store ( sBuf, uint(pCur-sBuf), &my_charset_bin );
}
break;
@@ -3382,39 +3382,39 @@ ha_rows ha_sphinx::records_in_range ( uint, key_range *, key_range * )
// currently provided for doing that.
//
// Called from handle.cc by ha_create_table().
-int ha_sphinx::create ( const char * name, TABLE * table, HA_CREATE_INFO * )
+int ha_sphinx::create ( const char * name, TABLE * table_arg, HA_CREATE_INFO * )
{
SPH_ENTER_METHOD();
char sError[256];
CSphSEShare tInfo;
- if ( !ParseUrl ( &tInfo, table, true ) )
+ if ( !ParseUrl ( &tInfo, table_arg, true ) )
SPH_RET(-1);
// check SphinxAPI table
for ( ; !tInfo.m_bSphinxQL; )
{
// check system fields (count and types)
- if ( table->s->fields<SPHINXSE_SYSTEM_COLUMNS )
+ if ( table_arg->s->fields<SPHINXSE_SYSTEM_COLUMNS )
{
my_snprintf ( sError, sizeof(sError), "%s: there MUST be at least %d columns",
name, SPHINXSE_SYSTEM_COLUMNS );
break;
}
- if ( !IsIDField ( table->field[0] ) )
+ if ( !IsIDField ( table_arg->field[0] ) )
{
my_snprintf ( sError, sizeof(sError), "%s: 1st column (docid) MUST be unsigned integer or bigint", name );
break;
}
- if ( !IsIntegerFieldType ( table->field[1]->type() ) )
+ if ( !IsIntegerFieldType ( table_arg->field[1]->type() ) )
{
my_snprintf ( sError, sizeof(sError), "%s: 2nd column (weight) MUST be integer or bigint", name );
break;
}
- enum_field_types f2 = table->field[2]->type();
+ enum_field_types f2 = table_arg->field[2]->type();
if ( f2!=MYSQL_TYPE_VARCHAR
&& f2!=MYSQL_TYPE_BLOB && f2!=MYSQL_TYPE_MEDIUM_BLOB && f2!=MYSQL_TYPE_LONG_BLOB && f2!=MYSQL_TYPE_TINY_BLOB )
{
@@ -3424,28 +3424,28 @@ int ha_sphinx::create ( const char * name, TABLE * table, HA_CREATE_INFO * )
// check attributes
int i;
- for ( i=3; i<(int)table->s->fields; i++ )
+ for ( i=3; i<(int)table_arg->s->fields; i++ )
{
- enum_field_types eType = table->field[i]->type();
+ enum_field_types eType = table_arg->field[i]->type();
if ( eType!=MYSQL_TYPE_TIMESTAMP && !IsIntegerFieldType(eType) && eType!=MYSQL_TYPE_VARCHAR && eType!=MYSQL_TYPE_FLOAT )
{
my_snprintf ( sError, sizeof(sError), "%s: %dth column (attribute %s) MUST be integer, bigint, timestamp, varchar, or float",
- name, i+1, table->field[i]->field_name );
+ name, i+1, table_arg->field[i]->field_name );
break;
}
}
- if ( i!=(int)table->s->fields )
+ if ( i!=(int)table_arg->s->fields )
break;
// check index
if (
- table->s->keys!=1 ||
- table->key_info[0].user_defined_key_parts!=1 ||
- strcasecmp ( table->key_info[0].key_part[0].field->field_name, table->field[2]->field_name ) )
+ table_arg->s->keys!=1 ||
+ table_arg->key_info[0].user_defined_key_parts!=1 ||
+ strcasecmp ( table_arg->key_info[0].key_part[0].field->field_name, table_arg->field[2]->field_name ) )
{
my_snprintf ( sError, sizeof(sError), "%s: there must be an index on '%s' column",
- name, table->field[2]->field_name );
+ name, table_arg->field[2]->field_name );
break;
}
@@ -3460,13 +3460,13 @@ int ha_sphinx::create ( const char * name, TABLE * table, HA_CREATE_INFO * )
sError[0] = '\0';
// check that 1st column is id, is of int type, and has an index
- if ( strcmp ( table->field[0]->field_name, "id" ) )
+ if ( strcmp ( table_arg->field[0]->field_name, "id" ) )
{
my_snprintf ( sError, sizeof(sError), "%s: 1st column must be called 'id'", name );
break;
}
- if ( !IsIDField ( table->field[0] ) )
+ if ( !IsIDField ( table_arg->field[0] ) )
{
my_snprintf ( sError, sizeof(sError), "%s: 'id' column must be INT UNSIGNED or BIGINT", name );
break;
@@ -3474,22 +3474,22 @@ int ha_sphinx::create ( const char * name, TABLE * table, HA_CREATE_INFO * )
// check index
if (
- table->s->keys!=1 ||
- table->key_info[0].user_defined_key_parts!=1 ||
- strcasecmp ( table->key_info[0].key_part[0].field->field_name, "id" ) )
+ table_arg->s->keys!=1 ||
+ table_arg->key_info[0].user_defined_key_parts!=1 ||
+ strcasecmp ( table_arg->key_info[0].key_part[0].field->field_name, "id" ) )
{
my_snprintf ( sError, sizeof(sError), "%s: 'id' column must be indexed", name );
break;
}
// check column types
- for ( int i=1; i<(int)table->s->fields; i++ )
+ for ( int i=1; i<(int)table_arg->s->fields; i++ )
{
- enum_field_types eType = table->field[i]->type();
+ enum_field_types eType = table_arg->field[i]->type();
if ( eType!=MYSQL_TYPE_TIMESTAMP && !IsIntegerFieldType(eType) && eType!=MYSQL_TYPE_VARCHAR && eType!=MYSQL_TYPE_FLOAT )
{
my_snprintf ( sError, sizeof(sError), "%s: column %d(%s) is of unsupported type (use int/bigint/timestamp/varchar/float)",
- name, i+1, table->field[i]->field_name );
+ name, i+1, table_arg->field[i]->field_name );
break;
}
}
@@ -3504,7 +3504,7 @@ int ha_sphinx::create ( const char * name, TABLE * table, HA_CREATE_INFO * )
if ( sError[0] )
{
my_error ( ER_CANT_CREATE_TABLE, MYF(0),
- table->s->db.str, table->s->table_name, sError );
+ table_arg->s->db.str, table_arg->s->table_name, sError );
SPH_RET(-1);
}
diff --git a/storage/sphinx/snippets_udf.cc b/storage/sphinx/snippets_udf.cc
index 2a290bd8de9..1eab4b4ed3d 100644
--- a/storage/sphinx/snippets_udf.cc
+++ b/storage/sphinx/snippets_udf.cc
@@ -450,7 +450,7 @@ int CSphUrl::Connect()
char * pError = NULL;
do
{
- iSocket = socket ( iDomain, SOCK_STREAM, 0 );
+ iSocket = (int)socket ( iDomain, SOCK_STREAM, 0 );
if ( iSocket==-1 )
{
pError = "Failed to create client socket";
@@ -642,7 +642,7 @@ struct CSphSnippets
}
#define STRING CHECK_TYPE(STRING_RESULT)
-#define INT CHECK_TYPE(INT_RESULT); int iValue = *(long long *)pArgs->args[i]
+#define INT CHECK_TYPE(INT_RESULT); int iValue =(int)*(long long *)pArgs->args[i]
my_bool sphinx_snippets_init ( UDF_INIT * pUDF, UDF_ARGS * pArgs, char * sMessage )
{
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc
index d6a5a20df8f..7363a69f49f 100644
--- a/storage/spider/ha_spider.cc
+++ b/storage/spider/ha_spider.cc
@@ -7793,7 +7793,7 @@ int ha_spider::cmp_ref(
*field;
field++
) {
- if ((ret = (*field)->cmp_binary_offset(ptr_diff)))
+ if ((ret = (*field)->cmp_binary_offset((uint)ptr_diff)))
{
DBUG_PRINT("info",("spider different at %s", (*field)->field_name));
break;
diff --git a/storage/spider/hs_client/config.cpp b/storage/spider/hs_client/config.cpp
index b546230ca03..3bf0f3e5bdf 100644
--- a/storage/spider/hs_client/config.cpp
+++ b/storage/spider/hs_client/config.cpp
@@ -263,8 +263,8 @@ parse_args(int argc, char **argv, config& conf)
}
if (!(param = new conf_param()))
continue;
- uint32 key_len = eq - arg;
- uint32 val_len = strlen(eq + 1);
+ uint32 key_len = (uint32)(eq - arg);
+ uint32 val_len = (uint32)(strlen(eq + 1));
if (
param->key.reserve(key_len + 1) ||
param->val.reserve(val_len + 1)
diff --git a/storage/spider/hs_client/hstcpcli.cpp b/storage/spider/hs_client/hstcpcli.cpp
index fed87803f9c..60da87b9f20 100644
--- a/storage/spider/hs_client/hstcpcli.cpp
+++ b/storage/spider/hs_client/hstcpcli.cpp
@@ -497,7 +497,7 @@ hstcpcli::response_recv(size_t& num_flds_r)
char *const err_begin = start;
read_token(start, finish);
char *const err_end = start;
- String e = String(err_begin, err_end - err_begin, &my_charset_bin);
+ String e = String(err_begin, (uint32)(err_end - err_begin), &my_charset_bin);
if (!e.length()) {
e = String("unknown_error", &my_charset_bin);
}
diff --git a/storage/spider/hs_client/socket.cpp b/storage/spider/hs_client/socket.cpp
index c61b39d140f..0717acf0da1 100644
--- a/storage/spider/hs_client/socket.cpp
+++ b/storage/spider/hs_client/socket.cpp
@@ -223,7 +223,7 @@ socket_set_options(auto_file& fd, const socket_args& args, String& err_r)
int
socket_open(auto_file& fd, const socket_args& args, String& err_r)
{
- fd.reset(socket(args.family, args.socktype, args.protocol));
+ fd.reset((int)socket(args.family, args.socktype, args.protocol));
if (fd.get() < 0) {
return errno_string("socket", errno, err_r);
}
@@ -253,7 +253,7 @@ socket_connect(auto_file& fd, const socket_args& args, String& err_r)
int
socket_bind(auto_file& fd, const socket_args& args, String& err_r)
{
- fd.reset(socket(args.family, args.socktype, args.protocol));
+ fd.reset((int)socket(args.family, args.socktype, args.protocol));
if (fd.get() < 0) {
return errno_string("socket", errno, err_r);
}
@@ -300,7 +300,7 @@ int
socket_accept(int listen_fd, auto_file& fd, const socket_args& args,
sockaddr_storage& addr_r, socklen_t& addrlen_r, String& err_r)
{
- fd.reset(accept(listen_fd, reinterpret_cast<sockaddr *>(&addr_r),
+ fd.reset((int)accept(listen_fd, reinterpret_cast<sockaddr *>(&addr_r),
&addrlen_r));
if (fd.get() < 0) {
return errno_string("accept", errno, err_r);
diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc
index e1e81394ce8..09dbeff328e 100644
--- a/storage/spider/spd_sys_table.cc
+++ b/storage/spider/spd_sys_table.cc
@@ -677,13 +677,13 @@ void spider_store_tables_name(
}
table->field[0]->store(
ptr_db,
- ptr_diff_table - 1,
+ (uint)(ptr_diff_table - 1),
system_charset_info);
DBUG_PRINT("info",("spider field[0]->null_bit = %d",
table->field[0]->null_bit));
table->field[1]->store(
ptr_table,
- name_length - ptr_diff_db - ptr_diff_table,
+ (uint)(name_length - ptr_diff_db - ptr_diff_table),
system_charset_info);
DBUG_PRINT("info",("spider field[1]->null_bit = %d",
table->field[1]->null_bit));
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 6438273bc4b..9e476c23202 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -637,7 +637,7 @@ size_t my_strnxfrm_mb_internal(CHARSET_INFO *cs, uchar *dst, uchar *de,
else
{
/* Multi-byte character */
- int len= (dst + chlen <= de) ? chlen : de - dst;
+ size_t len= (dst + chlen <= de) ? chlen : de - dst;
memcpy(dst, src, len);
dst+= len;
src+= len;
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 99f26731851..cf73f117f0f 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -1703,7 +1703,7 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)),
/* Unknown character, exit the loop */
break;
}
- shift= dot ? dot - str : 0; /* Right shift */
+ shift= dot ? (int)(dot - str) : 0; /* Right shift */
addon= 0;
exp: /* [ E [ <sign> ] <unsigned integer> ] */
@@ -2019,7 +2019,7 @@ my_strxfrm_pad_desc_and_reverse(CHARSET_INFO *cs,
my_strxfrm_desc_and_reverse(str, frmend, flags, level);
if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && frmend < strend)
{
- uint fill_length= strend - frmend;
+ size_t fill_length= strend - frmend;
cs->cset->fill(cs, (char*) frmend, fill_length, cs->pad_char);
frmend= strend;
}
@@ -2041,7 +2041,7 @@ my_strxfrm_pad_desc_and_reverse_nopad(CHARSET_INFO *cs,
my_strxfrm_desc_and_reverse(str, frmend, flags, level);
if ((flags & MY_STRXFRM_PAD_TO_MAXLEN) && frmend < strend)
{
- uint fill_length= strend - frmend;
+ size_t fill_length= strend - frmend;
memset(frmend, 0x00, fill_length);
frmend= strend;
}
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index 071d50d8256..cba44afc926 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -1051,7 +1051,7 @@ static void
my_fill_mb2(CHARSET_INFO *cs, char *s, size_t slen, int fill)
{
char buf[10], *last;
- int buflen, remainder;
+ size_t buflen, remainder;
DBUG_ASSERT((slen % 2) == 0);
@@ -1066,7 +1066,7 @@ my_fill_mb2(CHARSET_INFO *cs, char *s, size_t slen, int fill)
for (last= s + slen - buflen; s <= last; s+= buflen)
{
/* Enough space for the characer */
- memcpy(s, buf, (size_t) buflen);
+ memcpy(s, buf, buflen);
}
/*
diff --git a/strings/dtoa.c b/strings/dtoa.c
index a16ec93d3eb..0da850bd1ca 100644
--- a/strings/dtoa.c
+++ b/strings/dtoa.c
@@ -106,7 +106,7 @@ size_t my_fcvt(double x, int precision, char *to, my_bool *error)
}
src= res;
- len= end - src;
+ len= (int)(end - src);
if (sign)
*dst++= '-';
@@ -238,7 +238,7 @@ size_t my_gcvt(double x, my_gcvt_arg_type type, int width, char *to,
*error= FALSE;
src= res;
- len= end - res;
+ len= (int)(end - res);
/*
Number of digits in the exponent from the 'e' conversion.
@@ -330,7 +330,7 @@ size_t my_gcvt(double x, my_gcvt_arg_type type, int width, char *to,
dtoa_free(res, buf, sizeof(buf));
res= dtoa(x, 5, width - decpt, &decpt, &sign, &end, buf, sizeof(buf));
src= res;
- len= end - res;
+ len= (int)(end - res);
}
if (len == 0)
@@ -396,7 +396,7 @@ size_t my_gcvt(double x, my_gcvt_arg_type type, int width, char *to,
dtoa_free(res, buf, sizeof(buf));
res= dtoa(x, 4, width, &decpt, &sign, &end, buf, sizeof(buf));
src= res;
- len= end - res;
+ len= (int)(end - res);
if (--decpt < 0)
decpt= -decpt;
}
diff --git a/strings/json_lib.c b/strings/json_lib.c
index f666d95985b..3df2ecd4768 100644
--- a/strings/json_lib.c
+++ b/strings/json_lib.c
@@ -401,7 +401,7 @@ static int read_strn(json_engine_t *j)
return 1;
j->state= j->stack[j->stack_p];
- j->value_len= (j->s.c_str - j->value) - 1;
+ j->value_len= (int)(j->s.c_str - j->value) - 1;
return 0;
}
@@ -539,7 +539,7 @@ static int read_num(json_engine_t *j)
if (skip_num_constant(j) == 0)
{
j->value_type= JSON_VALUE_NUMBER;
- j->value_len= j->s.c_str - j->value_begin;
+ j->value_len= (int)(j->s.c_str - j->value_begin);
return 0;
}
return 1;
@@ -1496,7 +1496,7 @@ int json_append_ascii(CHARSET_INFO *json_cs,
return c_len;
}
- return json - json_start;
+ return (int)(json - json_start);
}
@@ -1532,7 +1532,7 @@ int json_unescape(CHARSET_INFO *json_cs,
return -1;
}
- return s.error==JE_EOS ? res - res_b : -1;
+ return s.error==JE_EOS ? (int)(res - res_b) : -1;
}
@@ -1647,7 +1647,7 @@ int json_escape(CHARSET_INFO *str_cs,
}
}
- return json - json_start;
+ return (int)(json - json_start);
}
diff --git a/tests/mysql_client_fw.c b/tests/mysql_client_fw.c
index 50ecf6c0860..bf06e2b502b 100644
--- a/tests/mysql_client_fw.c
+++ b/tests/mysql_client_fw.c
@@ -977,7 +977,7 @@ const char *query_arg)
fetch->handle= mysql_stmt_init(mysql);
- rc= mysql_stmt_prepare(fetch->handle, fetch->query, strlen(fetch->query));
+ rc= mysql_stmt_prepare(fetch->handle, fetch->query, (ulong)strlen(fetch->query));
check_execute(fetch->handle, rc);
/*
@@ -1087,7 +1087,7 @@ enum fetch_type fetch_type)
for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
{
/* Init will exit(1) in case of error */
- stmt_fetch_init(fetch, fetch - fetch_array,
+ stmt_fetch_init(fetch, (uint)(fetch - fetch_array),
query_list[fetch - fetch_array]);
}
@@ -1187,19 +1187,19 @@ static char **defaults_argv;
static struct my_option client_test_long_options[] =
{
- {"basedir", 'b', "Basedir for tests.", &opt_basedir,
- &opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"basedir", 'b', "Basedir for tests.",(void *)&opt_basedir,
+ (void *)&opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", 'C',
- "Directory for character set files.", &charsets_dir,
- &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Directory for character set files.", (void *)&charsets_dir,
+ (void *)&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"count", 't', "Number of times test to be executed", &opt_count_read,
&opt_count_read, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use", &opt_db, &opt_db,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"do-not-drop-database", 'd', "Do not drop database while disconnecting",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"debug", '#', "Output debug log", &default_dbug_option,
- &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ {"debug", '#', "Output debug log", (void *)&default_dbug_option,
+ (void *)&default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
{"host", 'h', "Connect to host", &opt_host, &opt_host,
@@ -1235,8 +1235,8 @@ static struct my_option client_test_long_options[] =
{"user", 'u', "User for login if not current user", &opt_user,
&opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
- {"vardir", 'v', "Data dir for tests.", &opt_vardir,
- &opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"vardir", 'v', "Data dir for tests.", (void *)&opt_vardir,
+ (void *)&opt_vardir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"non-blocking-api", 'n',
"Use the non-blocking client API for communication.",
&non_blocking_api_enabled, &non_blocking_api_enabled, 0,
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 383036ff092..1124a29e6b9 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -11751,7 +11751,7 @@ static void test_bug5194()
}
*query_ptr= '\0';
- rc= mysql_stmt_prepare(stmt, query, query_ptr - query);
+ rc= mysql_stmt_prepare(stmt, query, (ulong)(query_ptr - query));
if (rc && nrows * COLUMN_COUNT > uint16_max)
{
if (!opt_silent)
@@ -15733,7 +15733,7 @@ static void test_bug21206()
for (fetch= fetch_array; fetch < fetch_array + cursor_count; ++fetch)
{
/* Init will exit(1) in case of error */
- stmt_fetch_init(fetch, fetch - fetch_array, query);
+ stmt_fetch_init(fetch, (uint)(fetch - fetch_array), query);
}
for (fetch= fetch_array; fetch < fetch_array + cursor_count; ++fetch)
@@ -15935,7 +15935,7 @@ static void test_bug21635()
rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1)");
myquery(rc);
- rc= mysql_real_query(mysql, query, query_end - query);
+ rc= mysql_real_query(mysql, query, (ulong)(query_end - query));
myquery(rc);
result= mysql_use_result(mysql);