diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2018-02-06 12:55:58 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2018-02-06 12:55:58 +0000 |
commit | 6c279ad6a71c63cb595fde7c951aadb31c3dbebc (patch) | |
tree | 3603f88e1b3bd1e622edb182cccd882dd31ddc8a /sql/sql_error.cc | |
parent | f271100836d8a91a775894ec36b869a66a3145e5 (diff) | |
download | mariadb-git-6c279ad6a71c63cb595fde7c951aadb31c3dbebc.tar.gz |
MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from 'size_t' to 'type', possible loss of data)
Handle string length as size_t, consistently (almost always:))
Change function prototypes to accept size_t, where in the past
ulong or uint were used. change local/member variables to size_t
when appropriate.
This fix excludes rocksdb, spider,spider, sphinx and connect for now.
Diffstat (limited to 'sql/sql_error.cc')
-rw-r--r-- | sql/sql_error.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 24fb934c279..67440aeed33 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -523,8 +523,7 @@ Warning_info::~Warning_info() } -bool Warning_info::has_sql_condition(const char *message_str, - ulong message_length) const +bool Warning_info::has_sql_condition(const char *message_str, size_t message_length) const { Diagnostics_area::Sql_condition_iterator it(m_warn_list); const Sql_condition *err; @@ -918,11 +917,11 @@ char *err_conv(char *buff, uint to_length, const char *from, length of converted string */ -uint32 convert_error_message(char *to, uint32 to_length, CHARSET_INFO *to_cs, - const char *from, uint32 from_length, +size_t convert_error_message(char *to, size_t to_length, CHARSET_INFO *to_cs, + const char *from, size_t from_length, CHARSET_INFO *from_cs, uint *errors) { - int cnvres; + int cnvres; my_wc_t wc; const uchar *from_end= (const uchar*) from+from_length; char *to_start= to; @@ -930,7 +929,7 @@ uint32 convert_error_message(char *to, uint32 to_length, CHARSET_INFO *to_cs, my_charset_conv_mb_wc mb_wc= from_cs->cset->mb_wc; my_charset_conv_wc_mb wc_mb; uint error_count= 0; - uint length; + size_t length; DBUG_ASSERT(to_length > 0); /* Make room for the null terminator. */ @@ -969,7 +968,7 @@ uint32 convert_error_message(char *to, uint32 to_length, CHARSET_INFO *to_cs, length= (wc <= 0xFFFF) ? 6/* '\1234' format*/ : 9 /* '\+123456' format*/; if ((uchar*)(to + length) >= to_end) break; - cnvres= my_snprintf(to, 9, + cnvres= (int)my_snprintf(to, 9, (wc <= 0xFFFF) ? "\\%04X" : "\\+%06X", (uint) wc); to+= cnvres; } @@ -979,7 +978,7 @@ uint32 convert_error_message(char *to, uint32 to_length, CHARSET_INFO *to_cs, *to= 0; *errors= error_count; - return (uint32) (to - to_start); + return (size_t) (to - to_start); } |