summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-03-01 08:27:39 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-03-07 19:07:27 +0200
commit89d80c1b0be94639d0913dee7b6a284c32787b09 (patch)
treea08340d45a09b067df4490259f68b5a3f9d2fa03 /sql/log.cc
parentd2f5e624223fe502ddf4c6f42062c29edb988627 (diff)
downloadmariadb-git-89d80c1b0be94639d0913dee7b6a284c32787b09.tar.gz
Fix many -Wconversion warnings.
Define my_thread_id as an unsigned type, to avoid mismatch with ulonglong. Change some parameters to this type. Use size_t in a few more places. Declare many flag constants as unsigned to avoid sign mismatch when shifting bits or applying the unary ~ operator. When applying the unary ~ operator to enum constants, explictly cast the result to an unsigned type, because enum constants can be treated as signed. In InnoDB, change the source code line number parameters from ulint to unsigned type. Also, make some InnoDB functions return a narrower type (unsigned or uint32_t instead of ulint; bool instead of ibool).
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc21
1 files changed, 10 insertions, 11 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 23326532388..7ad9790bb13 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2009, 2016, MariaDB
+ Copyright (c) 2009, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -646,7 +646,7 @@ void Log_to_csv_event_handler::cleanup()
bool Log_to_csv_event_handler::
log_general(THD *thd, my_hrtime_t event_time, const char *user_host,
- uint user_host_len, int thread_id_arg,
+ uint user_host_len, my_thread_id thread_id_arg,
const char *command_type, uint command_type_len,
const char *sql_text, uint sql_text_len,
CHARSET_INFO *client_cs)
@@ -1056,7 +1056,7 @@ bool Log_to_file_event_handler::
bool Log_to_file_event_handler::
log_general(THD *thd, my_hrtime_t event_time, const char *user_host,
- uint user_host_len, int thread_id_arg,
+ uint user_host_len, my_thread_id thread_id_arg,
const char *command_type, uint command_type_len,
const char *sql_text, uint sql_text_len,
CHARSET_INFO *client_cs)
@@ -2850,12 +2850,11 @@ void MYSQL_QUERY_LOG::reopen_file()
*/
bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host,
- uint user_host_len, int thread_id_arg,
+ uint user_host_len, my_thread_id thread_id_arg,
const char *command_type, uint command_type_len,
const char *sql_text, uint sql_text_len)
{
char buff[32];
- uint length= 0;
char local_time_buff[MAX_TIME_SIZE];
struct tm start;
uint time_buff_len= 0;
@@ -2889,7 +2888,7 @@ bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host,
goto err;
/* command_type, thread_id */
- length= my_snprintf(buff, 32, "%5ld ", (long) thread_id_arg);
+ size_t length= my_snprintf(buff, 32, "%5llu ", thread_id_arg);
if (my_b_write(&log_file, (uchar*) buff, length))
goto err;
@@ -2973,7 +2972,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
int tmp_errno= 0;
char buff[80], *end;
char query_time_buff[22+7], lock_time_buff[22+7];
- uint buff_len;
+ size_t buff_len;
end= buff;
if (!(specialflag & SPECIAL_SHORT_LOG_FORMAT))
@@ -10244,8 +10243,8 @@ IO_CACHE * get_trans_log(THD * thd)
if (cache_mngr)
return cache_mngr->get_binlog_cache_log(true);
- WSREP_DEBUG("binlog cache not initialized, conn: %lld",
- (longlong) thd->thread_id);
+ WSREP_DEBUG("binlog cache not initialized, conn: %llu",
+ thd->thread_id);
return NULL;
}
@@ -10283,8 +10282,8 @@ void thd_binlog_trx_reset(THD * thd)
void thd_binlog_rollback_stmt(THD * thd)
{
- WSREP_DEBUG("thd_binlog_rollback_stmt connection: %lld",
- (longlong) thd->thread_id);
+ WSREP_DEBUG("thd_binlog_rollback_stmt connection: %llu",
+ thd->thread_id);
binlog_cache_mngr *const cache_mngr=
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
if (cache_mngr)