diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2017-10-03 19:43:43 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2017-10-03 19:43:43 +0000 |
commit | 8d413c32dc50469d65185d6252014ef29b7b42c2 (patch) | |
tree | 707b0d82b49713267be24e9a1aafb4c6e8acdb18 /sql | |
parent | 4732767981442cf2522088471ba211ecf9f542a2 (diff) | |
download | mariadb-git-8d413c32dc50469d65185d6252014ef29b7b42c2.tar.gz |
Fix several truncation and formatting warnings.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_inetfunc.cc | 20 | ||||
-rw-r--r-- | sql/lock.cc | 2 | ||||
-rw-r--r-- | sql/log.cc | 2 | ||||
-rw-r--r-- | sql/mf_iocache_encr.cc | 4 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 | ||||
-rw-r--r-- | sql/sql_window.cc | 2 |
6 files changed, 17 insertions, 17 deletions
diff --git a/sql/item_inetfunc.cc b/sql/item_inetfunc.cc index 7f3ec3829f4..cf484d251a9 100644 --- a/sql/item_inetfunc.cc +++ b/sql/item_inetfunc.cc @@ -217,7 +217,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres { DBUG_PRINT("error", ("str_to_ipv4(%.*s): " "invalid IPv4 address: too short.", - str_length, str)); + (int)str_length, str)); return false; } @@ -225,7 +225,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres { DBUG_PRINT("error", ("str_to_ipv4(%.*s): " "invalid IPv4 address: too long.", - str_length, str)); + (int)str_length, str)); return false; } @@ -248,7 +248,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres { DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: " "too many characters in a group.", - str_length, str)); + (int)str_length, str)); return false; } @@ -258,7 +258,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres { DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: " "invalid byte value.", - str_length, str)); + (int)str_length, str)); return false; } } @@ -268,7 +268,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres { DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: " "too few characters in a group.", - str_length, str)); + (int)str_length, str)); return false; } @@ -281,7 +281,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres if (dot_count > 3) { DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: " - "too many dots.", str_length, str)); + "too many dots.", (int)str_length, str)); return false; } } @@ -289,7 +289,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres { DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: " "invalid character at pos %d.", - str_length, str, (int) (p - str))); + (int)str_length, str, (int) (p - str))); return false; } } @@ -297,7 +297,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres if (c == '.') { DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: " - "ending at '.'.", str_length, str)); + "ending at '.'.",(int)str_length, str)); return false; } @@ -305,14 +305,14 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres { DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: " "too few groups.", - str_length, str)); + (int)str_length, str)); return false; } ipv4_bytes[3]= (unsigned char) byte_value; DBUG_PRINT("info", ("str_to_ipv4(%.*s): valid IPv4 address: %d.%d.%d.%d", - str_length, str, + (int)str_length, str, ipv4_bytes[0], ipv4_bytes[1], ipv4_bytes[2], ipv4_bytes[3])); return true; diff --git a/sql/lock.cc b/sql/lock.cc index 06cb00fe32d..79ce27b9937 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -824,7 +824,7 @@ MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, uint flags) we may allocate too much, but better safe than memory overrun. And in the FLUSH case, the memory is released quickly anyway. */ - sql_lock->lock_count= locks - locks_buf; + sql_lock->lock_count= (uint)(locks - locks_buf); DBUG_ASSERT(sql_lock->lock_count <= lock_count); DBUG_PRINT("info", ("sql_lock->table_count %d sql_lock->lock_count %d", sql_lock->table_count, sql_lock->lock_count)); diff --git a/sql/log.cc b/sql/log.cc index b0115c3e480..cd7fd0f440b 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1292,7 +1292,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length, } /* fill in user_host value: the format is "%s[%s] @ %s [%s]" */ - user_host_len= (strxnmov(user_host_buff, MAX_USER_HOST_SIZE, + user_host_len= (uint)(strxnmov(user_host_buff, MAX_USER_HOST_SIZE, sctx->priv_user, "[", sctx->user ? sctx->user : (thd->slave_thread ? "SQL_SLAVE" : ""), "] @ ", sctx->host ? sctx->host : "", " [", diff --git a/sql/mf_iocache_encr.cc b/sql/mf_iocache_encr.cc index 434fcd1f435..546e0fe03a0 100644 --- a/sql/mf_iocache_encr.cc +++ b/sql/mf_iocache_encr.cc @@ -92,7 +92,7 @@ static int my_b_encr_read(IO_CACHE *info, uchar *Buffer, size_t Count) DBUG_RETURN(1); } - elength= wlength - (ebuffer - wbuffer); + elength= wlength - (uint)(ebuffer - wbuffer); set_iv(iv, pos_in_file, crypt_data->inbuf_counter); if (encryption_crypt(ebuffer, elength, info->buffer, &length, @@ -184,7 +184,7 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count) my_errno= 1; DBUG_RETURN(info->error= -1); } - wlength= elength + ebuffer - wbuffer; + wlength= elength + (uint)(ebuffer - wbuffer); if (length == info->buffer_length) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 21f0cfd0434..ecd7d845635 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1484,8 +1484,8 @@ uint maria_multi_check(THD *thd, char *packet, uint packet_length) size_t subpacket_length= net_field_length((uchar **)&packet_start); 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, + DBUG_PRINT("info", ("sub-packet length: %zu + %zu command: %x", + subpacket_length, length_length, packet_start[3])); if (subpacket_length == 0 || diff --git a/sql/sql_window.cc b/sql/sql_window.cc index 5fae2228646..7ae967d7077 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -327,7 +327,7 @@ int compare_order_elements(ORDER *ord1, ORDER *ord2) Item *item2= (*ord2->item)->real_item(); DBUG_ASSERT(item1->type() == Item::FIELD_ITEM && item2->type() == Item::FIELD_ITEM); - int cmp= ((Item_field *) item1)->field - ((Item_field *) item2)->field; + ptrdiff_t cmp= ((Item_field *) item1)->field - ((Item_field *) item2)->field; if (cmp == 0) { if (ord1->direction == ord2->direction) |