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:
@@ -1065,7 +1065,7 @@ static void fix_history(String *final_command);
|
||||
|
||||
static COMMANDS *find_command(char *name);
|
||||
static COMMANDS *find_command(char cmd_name);
|
||||
static bool add_line(String &, char *, ulong, char *, bool *, bool);
|
||||
static bool add_line(String &, char *, size_t line_length, char *, bool *, bool);
|
||||
static void remove_cntrl(String &buffer);
|
||||
static void print_table_data(MYSQL_RES *result);
|
||||
static void print_table_data_html(MYSQL_RES *result);
|
||||
@@ -1987,7 +1987,7 @@ static int read_and_execute(bool interactive)
|
||||
ulong line_number=0;
|
||||
bool ml_comment= 0;
|
||||
COMMANDS *com;
|
||||
ulong line_length= 0;
|
||||
size_t line_length= 0;
|
||||
status.exit_status=1;
|
||||
|
||||
real_binary_mode= !interactive && opt_binary_mode;
|
||||
@@ -2281,7 +2281,7 @@ static COMMANDS *find_command(char *name)
|
||||
}
|
||||
|
||||
|
||||
static bool add_line(String &buffer, char *line, ulong line_length,
|
||||
static bool add_line(String &buffer, char *line, size_t line_length,
|
||||
char *in_string, bool *ml_comment, bool truncated)
|
||||
{
|
||||
uchar inchar;
|
||||
@@ -2989,12 +2989,12 @@ static void get_current_db()
|
||||
The different commands
|
||||
***************************************************************************/
|
||||
|
||||
int mysql_real_query_for_lazy(const char *buf, int length)
|
||||
int mysql_real_query_for_lazy(const char *buf, size_t length)
|
||||
{
|
||||
for (uint retry=0;; retry++)
|
||||
{
|
||||
int error;
|
||||
if (!mysql_real_query(&mysql,buf,length))
|
||||
if (!mysql_real_query(&mysql,buf,(ulong)length))
|
||||
return 0;
|
||||
error= put_error(&mysql);
|
||||
if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1 ||
|
||||
@@ -3565,10 +3565,10 @@ is_binary_field(MYSQL_FIELD *field)
|
||||
/* Print binary value as hex literal (0x ...) */
|
||||
|
||||
static void
|
||||
print_as_hex(FILE *output_file, const char *str, ulong len, ulong total_bytes_to_send)
|
||||
print_as_hex(FILE *output_file, const char *str, size_t len, size_t total_bytes_to_send)
|
||||
{
|
||||
const char *ptr= str, *end= ptr+len;
|
||||
ulong i;
|
||||
size_t i;
|
||||
fprintf(output_file, "0x");
|
||||
for(; ptr < end; ptr++)
|
||||
fprintf(output_file, "%02X", *((uchar*)ptr));
|
||||
@@ -3618,11 +3618,11 @@ print_table_data(MYSQL_RES *result)
|
||||
(void) tee_fputs("|", PAGER);
|
||||
for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
|
||||
{
|
||||
uint name_length= (uint) strlen(field->name);
|
||||
uint numcells= charset_info->cset->numcells(charset_info,
|
||||
size_t name_length= (uint) strlen(field->name);
|
||||
size_t numcells= charset_info->cset->numcells(charset_info,
|
||||
field->name,
|
||||
field->name + name_length);
|
||||
uint display_length= field->max_length + name_length - numcells;
|
||||
size_t display_length= field->max_length + name_length - numcells;
|
||||
tee_fprintf(PAGER, " %-*s |",(int) MY_MIN(display_length,
|
||||
MAX_COLUMN_LENGTH),
|
||||
field->name);
|
||||
@@ -3643,7 +3643,6 @@ print_table_data(MYSQL_RES *result)
|
||||
const char *buffer;
|
||||
uint data_length;
|
||||
uint field_max_length;
|
||||
uint visible_length;
|
||||
uint extra_padding;
|
||||
|
||||
if (off)
|
||||
@@ -3671,7 +3670,7 @@ print_table_data(MYSQL_RES *result)
|
||||
We need to find how much screen real-estate we will occupy to know how
|
||||
many extra padding-characters we should send with the printing function.
|
||||
*/
|
||||
visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
|
||||
size_t visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
|
||||
extra_padding= (uint) (data_length - visible_length);
|
||||
|
||||
if (opt_binhex && is_binary_field(field))
|
||||
|
Reference in New Issue
Block a user