mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user