Commit 8d413c32 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Fix several truncation and formatting warnings.

parent 47327679
...@@ -217,7 +217,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres ...@@ -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): " DBUG_PRINT("error", ("str_to_ipv4(%.*s): "
"invalid IPv4 address: too short.", "invalid IPv4 address: too short.",
str_length, str)); (int)str_length, str));
return false; return false;
} }
...@@ -225,7 +225,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres ...@@ -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): " DBUG_PRINT("error", ("str_to_ipv4(%.*s): "
"invalid IPv4 address: too long.", "invalid IPv4 address: too long.",
str_length, str)); (int)str_length, str));
return false; return false;
} }
...@@ -248,7 +248,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres ...@@ -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: " DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"too many characters in a group.", "too many characters in a group.",
str_length, str)); (int)str_length, str));
return false; return false;
} }
...@@ -258,7 +258,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres ...@@ -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: " DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"invalid byte value.", "invalid byte value.",
str_length, str)); (int)str_length, str));
return false; return false;
} }
} }
...@@ -268,7 +268,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres ...@@ -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: " DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"too few characters in a group.", "too few characters in a group.",
str_length, str)); (int)str_length, str));
return false; return false;
} }
...@@ -281,7 +281,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres ...@@ -281,7 +281,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres
if (dot_count > 3) if (dot_count > 3)
{ {
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: " 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; return false;
} }
} }
...@@ -289,7 +289,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres ...@@ -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: " DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"invalid character at pos %d.", "invalid character at pos %d.",
str_length, str, (int) (p - str))); (int)str_length, str, (int) (p - str)));
return false; return false;
} }
} }
...@@ -297,7 +297,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres ...@@ -297,7 +297,7 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres
if (c == '.') if (c == '.')
{ {
DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: " DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"ending at '.'.", str_length, str)); "ending at '.'.",(int)str_length, str));
return false; return false;
} }
...@@ -305,14 +305,14 @@ static bool str_to_ipv4(const char *str, size_t str_length, in_addr *ipv4_addres ...@@ -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: " DBUG_PRINT("error", ("str_to_ipv4(%.*s): invalid IPv4 address: "
"too few groups.", "too few groups.",
str_length, str)); (int)str_length, str));
return false; return false;
} }
ipv4_bytes[3]= (unsigned char) byte_value; ipv4_bytes[3]= (unsigned char) byte_value;
DBUG_PRINT("info", ("str_to_ipv4(%.*s): valid IPv4 address: %d.%d.%d.%d", 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[0], ipv4_bytes[1],
ipv4_bytes[2], ipv4_bytes[3])); ipv4_bytes[2], ipv4_bytes[3]));
return true; return true;
......
...@@ -824,7 +824,7 @@ MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, uint flags) ...@@ -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. we may allocate too much, but better safe than memory overrun.
And in the FLUSH case, the memory is released quickly anyway. 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_ASSERT(sql_lock->lock_count <= lock_count);
DBUG_PRINT("info", ("sql_lock->table_count %d sql_lock->lock_count %d", DBUG_PRINT("info", ("sql_lock->table_count %d sql_lock->lock_count %d",
sql_lock->table_count, sql_lock->lock_count)); sql_lock->table_count, sql_lock->lock_count));
......
...@@ -1292,7 +1292,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length, ...@@ -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]" */ /* 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->priv_user, "[",
sctx->user ? sctx->user : (thd->slave_thread ? "SQL_SLAVE" : ""), "] @ ", sctx->user ? sctx->user : (thd->slave_thread ? "SQL_SLAVE" : ""), "] @ ",
sctx->host ? sctx->host : "", " [", sctx->host ? sctx->host : "", " [",
......
...@@ -92,7 +92,7 @@ static int my_b_encr_read(IO_CACHE *info, uchar *Buffer, size_t Count) ...@@ -92,7 +92,7 @@ static int my_b_encr_read(IO_CACHE *info, uchar *Buffer, size_t Count)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
elength= wlength - (ebuffer - wbuffer); elength= wlength - (uint)(ebuffer - wbuffer);
set_iv(iv, pos_in_file, crypt_data->inbuf_counter); set_iv(iv, pos_in_file, crypt_data->inbuf_counter);
if (encryption_crypt(ebuffer, elength, info->buffer, &length, 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) ...@@ -184,7 +184,7 @@ static int my_b_encr_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
my_errno= 1; my_errno= 1;
DBUG_RETURN(info->error= -1); DBUG_RETURN(info->error= -1);
} }
wlength= elength + ebuffer - wbuffer; wlength= elength + (uint)(ebuffer - wbuffer);
if (length == info->buffer_length) if (length == info->buffer_length)
{ {
......
...@@ -1484,8 +1484,8 @@ uint maria_multi_check(THD *thd, char *packet, uint packet_length) ...@@ -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 subpacket_length= net_field_length((uchar **)&packet_start);
size_t length_length= packet_start - packet; size_t length_length= packet_start - packet;
// length of command + 3 bytes where that length was stored // length of command + 3 bytes where that length was stored
DBUG_PRINT("info", ("sub-packet length: %ld + %d command: %x", DBUG_PRINT("info", ("sub-packet length: %zu + %zu command: %x",
(ulong)subpacket_length, length_length, subpacket_length, length_length,
packet_start[3])); packet_start[3]));
if (subpacket_length == 0 || if (subpacket_length == 0 ||
......
...@@ -327,7 +327,7 @@ int compare_order_elements(ORDER *ord1, ORDER *ord2) ...@@ -327,7 +327,7 @@ int compare_order_elements(ORDER *ord1, ORDER *ord2)
Item *item2= (*ord2->item)->real_item(); Item *item2= (*ord2->item)->real_item();
DBUG_ASSERT(item1->type() == Item::FIELD_ITEM && DBUG_ASSERT(item1->type() == Item::FIELD_ITEM &&
item2->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 (cmp == 0)
{ {
if (ord1->direction == ord2->direction) if (ord1->direction == ord2->direction)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment