Skip to content

Commit 2b85c64

Browse files
author
Ignacio Galarza
committed
Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages. This change focuses on the warnings that are covered by the ignore file: support-files/compiler_warnings.supp. - Strings are guaranteed to be max uint in length
1 parent 1a7b0ec commit 2b85c64

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+786
-751
lines changed

client/mysql.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ sig_handler mysql_sigint(int sig)
12261226
goto err;
12271227
/* kill_buffer is always big enough because max length of %lu is 15 */
12281228
sprintf(kill_buffer, "KILL /*!50000 QUERY */ %lu", mysql_thread_id(&mysql));
1229-
mysql_real_query(kill_mysql, kill_buffer, strlen(kill_buffer));
1229+
mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
12301230
mysql_close(kill_mysql);
12311231
tee_fprintf(stdout, "Query aborted by Ctrl+C\n");
12321232

@@ -3449,7 +3449,7 @@ static void print_warnings()
34493449

34503450
/* Get the warnings */
34513451
query= "show warnings";
3452-
mysql_real_query_for_lazy(query, strlen(query));
3452+
mysql_real_query_for_lazy(query, (uint) strlen(query));
34533453
mysql_store_result_for_lazy(&result);
34543454

34553455
/* Bail out when no warnings */
@@ -4329,7 +4329,8 @@ server_version_string(MYSQL *con)
43294329
MYSQL_ROW cur = mysql_fetch_row(result);
43304330
if (cur && cur[0])
43314331
{
4332-
bufp = strxnmov(bufp, sizeof buf - (bufp - buf), " ", cur[0], NullS);
4332+
bufp = strxnmov(bufp, (uint) (sizeof buf - (bufp - buf)), " ", cur[0],
4333+
NullS);
43334334
}
43344335
mysql_free_result(result);
43354336
}

client/mysql_upgrade.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
429429
MYF(MY_WME))) < 0)
430430
die("Failed to create temporary file for defaults");
431431

432-
if (my_write(fd, query, strlen(query),
432+
if (my_write(fd, query, (uint) strlen(query),
433433
MYF(MY_FNABP | MY_WME)))
434434
{
435435
my_close(fd, MYF(0));

client/mysqladmin.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
844844
bool old= (find_type(argv[0], &command_typelib, 2) ==
845845
ADMIN_OLD_PASSWORD);
846846
#ifdef __WIN__
847-
uint pw_len= strlen(pw);
847+
uint pw_len= (uint) strlen(pw);
848848
if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'')
849849
printf("Warning: single quotes were not trimmed from the password by"
850850
" your command\nline client, as you might have expected.\n");

client/mysqlbinlog.cc

+8-8
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static MYSQL* safe_connect();
105105
class Load_log_processor
106106
{
107107
char target_dir_name[FN_REFLEN];
108-
int target_dir_name_len;
108+
size_t target_dir_name_len;
109109

110110
/*
111111
When we see first event corresponding to some LOAD DATA statement in
@@ -275,7 +275,7 @@ File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le,
275275
File file;
276276

277277
fn_format(filename, le->fname, target_dir_name, "", 1);
278-
len= strlen(filename);
278+
len= (uint) strlen(filename);
279279
tail= filename + len;
280280

281281
if ((file= create_unique_file(filename,tail)) < 0)
@@ -284,7 +284,7 @@ File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le,
284284
return -1;
285285
}
286286

287-
le->set_fname_outside_temp_buf(filename,len+strlen(tail));
287+
le->set_fname_outside_temp_buf(filename,len+(uint) strlen(tail));
288288

289289
return file;
290290
}
@@ -369,7 +369,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
369369
uint file_id,
370370
Create_file_log_event *ce)
371371
{
372-
uint full_len= target_dir_name_len + blen + 9 + 9 + 1;
372+
size_t full_len= target_dir_name_len + blen + 9 + 9 + 1;
373373
int error= 0;
374374
char *fname, *ptr;
375375
File file;
@@ -403,7 +403,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
403403
}
404404

405405
if (ce)
406-
ce->set_fname_outside_temp_buf(fname, strlen(fname));
406+
ce->set_fname_outside_temp_buf(fname, (uint) strlen(fname));
407407

408408
if (my_write(file, (byte*)block, block_len, MYF(MY_WME|MY_NABP)))
409409
error= -1;
@@ -416,7 +416,7 @@ int Load_log_processor::process_first_event(const char *bname, uint blen,
416416
int Load_log_processor::process(Create_file_log_event *ce)
417417
{
418418
const char *bname= ce->fname + dirname_length(ce->fname);
419-
uint blen= ce->fname_len - (bname-ce->fname);
419+
uint blen= (uint) (ce->fname_len - (bname-ce->fname));
420420

421421
return process_first_event(bname, blen, ce->block, ce->block_len,
422422
ce->file_id, ce);
@@ -864,7 +864,7 @@ static my_time_t convert_str_to_timestamp(const char* str)
864864
long dummy_my_timezone;
865865
my_bool dummy_in_dst_time_gap;
866866
/* We require a total specification (date AND time) */
867-
if (str_to_datetime(str, strlen(str), &l_time, 0, &was_cut) !=
867+
if (str_to_datetime(str, (uint) strlen(str), &l_time, 0, &was_cut) !=
868868
MYSQL_TIMESTAMP_DATETIME || was_cut)
869869
{
870870
fprintf(stderr, "Incorrect date and time argument: %s\n", str);
@@ -1109,7 +1109,7 @@ could be out of memory");
11091109
int4store(buf, (uint32)start_position);
11101110
int2store(buf + BIN_LOG_HEADER_SIZE, binlog_flags);
11111111

1112-
size_s tlen = strlen(logname);
1112+
size_t tlen= strlen(logname);
11131113
if (tlen > UINT_MAX)
11141114
{
11151115
fprintf(stderr,"Log name too long\n");

client/mysqlcheck.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static int get_options(int *argc, char ***argv)
328328

329329
if (!what_to_do)
330330
{
331-
int pnlen = strlen(my_progname);
331+
size_t pnlen= strlen(my_progname);
332332

333333
if (pnlen < 6) /* name too short */
334334
what_to_do = DO_CHECK;
@@ -414,7 +414,8 @@ static int process_selected_tables(char *db, char **table_names, int tables)
414414
space is for more readable output in logs and in case of error
415415
*/
416416
char *table_names_comma_sep, *end;
417-
int i, tot_length = 0;
417+
size_t tot_length= 0;
418+
int i= 0;
418419

419420
for (i = 0; i < tables; i++)
420421
tot_length+= fixed_name_length(*(table_names + i)) + 2;
@@ -430,7 +431,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
430431
*end++= ',';
431432
}
432433
*--end = 0;
433-
handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1);
434+
handle_request_for_tables(table_names_comma_sep + 1, (uint) (tot_length - 1));
434435
my_free(table_names_comma_sep, MYF(0));
435436
}
436437
else
@@ -452,7 +453,7 @@ static uint fixed_name_length(const char *name)
452453
else if (*p == '.')
453454
extra_length+= 2;
454455
}
455-
return (p - name) + extra_length;
456+
return (uint) ((p - name) + extra_length);
456457
}
457458

458459

client/mysqldump.c

+16-14
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static void free_table_ent(char *key)
662662
byte* get_table_key(const char *entry, uint *length,
663663
my_bool not_used __attribute__((unused)))
664664
{
665-
*length= strlen(entry);
665+
*length= (uint) strlen(entry);
666666
return (byte*) entry;
667667
}
668668

@@ -778,7 +778,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
778778
opt_set_charset= 0;
779779
opt_compatible_mode_str= argument;
780780
opt_compatible_mode= find_set(&compatible_mode_typelib,
781-
argument, strlen(argument),
781+
argument, (uint) strlen(argument),
782782
&err_ptr, &err_len);
783783
if (err_len)
784784
{
@@ -791,7 +791,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
791791
uint size_for_sql_mode= 0;
792792
const char **ptr;
793793
for (ptr= compatible_mode_names; *ptr; ptr++)
794-
size_for_sql_mode+= strlen(*ptr);
794+
size_for_sql_mode+= (uint) strlen(*ptr);
795795
size_for_sql_mode+= sizeof(compatible_mode_names)-1;
796796
DBUG_ASSERT(sizeof(compatible_mode_normal_str)>=size_for_sql_mode);
797797
}
@@ -1039,7 +1039,7 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name)
10391039
"SET SESSION character_set_results = '%s'",
10401040
(const char *) cs_name);
10411041

1042-
return mysql_real_query(mysql, query_buffer, query_length);
1042+
return mysql_real_query(mysql, query_buffer, (uint) query_length);
10431043
}
10441044

10451045

@@ -1371,7 +1371,8 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg,
13711371
fputs(attribute_name, xml_file);
13721372
fputc('\"', xml_file);
13731373

1374-
print_quoted_xml(xml_file, attribute_value, strlen(attribute_value));
1374+
print_quoted_xml(xml_file, attribute_value,
1375+
(uint) strlen(attribute_value));
13751376
fputc('\"', xml_file);
13761377

13771378
attribute_name= va_arg(arg_list, char *);
@@ -1411,7 +1412,7 @@ static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
14111412
fputs("<", xml_file);
14121413
fputs(stag_atr, xml_file);
14131414
fputs("\"", xml_file);
1414-
print_quoted_xml(xml_file, sval, strlen(sval));
1415+
print_quoted_xml(xml_file, sval, (uint) strlen(sval));
14151416
fputs("\" xsi:nil=\"true\" />", xml_file);
14161417
fputs(line_end, xml_file);
14171418
check_io(xml_file);
@@ -1509,7 +1510,7 @@ static uint dump_routines_for_db(char *db)
15091510
DBUG_ENTER("dump_routines_for_db");
15101511
DBUG_PRINT("enter", ("db: '%s'", db));
15111512

1512-
mysql_real_escape_string(mysql, db_name_buff, db, strlen(db));
1513+
mysql_real_escape_string(mysql, db_name_buff, db, (uint) strlen(db));
15131514

15141515
/* nice comments */
15151516
if (opt_comments)
@@ -1601,13 +1602,13 @@ static uint dump_routines_for_db(char *db)
16011602
Allocate memory for new query string: original string
16021603
from SHOW statement and version-specific comments.
16031604
*/
1604-
query_str= alloc_query_str(strlen(row[2]) + 23);
1605+
query_str= alloc_query_str((uint) strlen(row[2]) + 23);
16051606

16061607
query_str_tail= strnmov(query_str, row[2],
1607-
definer_begin - row[2]);
1608+
(uint) (definer_begin - row[2]));
16081609
query_str_tail= strmov(query_str_tail, "*/ /*!50020");
16091610
query_str_tail= strnmov(query_str_tail, definer_begin,
1610-
definer_end - definer_begin);
1611+
(uint) (definer_end - definer_begin));
16111612
query_str_tail= strxmov(query_str_tail, "*/ /*!50003",
16121613
definer_end, NullS);
16131614
}
@@ -2216,7 +2217,7 @@ static void dump_triggers_for_table(char *table,
22162217
char host_name_str[HOSTNAME_LENGTH + 1];
22172218
char quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3];
22182219

2219-
parse_user(row[7], strlen(row[7]), user_name_str, &user_name_len,
2220+
parse_user(row[7], (uint) strlen(row[7]), user_name_str, &user_name_len,
22202221
host_name_str, &host_name_len);
22212222

22222223
fprintf(sql_file,
@@ -3054,7 +3055,7 @@ static int dump_all_tables_in_db(char *database)
30543055
while ((table= getTableName(0)))
30553056
{
30563057
char *end= strmov(afterdot, table);
3057-
if (include_table(hash_key, end - hash_key))
3058+
if (include_table(hash_key, (uint) (end - hash_key)))
30583059
{
30593060
dump_table(table,database);
30603061
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
@@ -3622,7 +3623,7 @@ static char *primary_key_fields(const char *table_name)
36223623
do
36233624
{
36243625
quoted_field= quote_name(row[4], buff, 0);
3625-
result_length+= strlen(quoted_field) + 1; /* + 1 for ',' or \0 */
3626+
result_length+= (uint) strlen(quoted_field) + 1; /* + 1 for ',' or \0 */
36263627
} while ((row= mysql_fetch_row(res)) && atoi(row[3]) > 1);
36273628
}
36283629

@@ -3682,7 +3683,8 @@ static int replace(DYNAMIC_STRING *ds_str,
36823683
return 1;
36833684
init_dynamic_string_checked(&ds_tmp, "",
36843685
ds_str->length + replace_len, 256);
3685-
dynstr_append_mem_checked(&ds_tmp, ds_str->str, start - ds_str->str);
3686+
dynstr_append_mem_checked(&ds_tmp, ds_str->str,
3687+
(uint) (start - ds_str->str));
36863688
dynstr_append_mem_checked(&ds_tmp, replace_str, replace_len);
36873689
dynstr_append_checked(&ds_tmp, start + search_len);
36883690
dynstr_set_checked(ds_str, ds_tmp.str);

0 commit comments

Comments
 (0)