Skip to content

Commit cc66f88

Browse files
committed
Bug#11752665: WINDOWS SERVER X64: SO MANY COMPILER WARNINGS
Patch mysql#10: This patch reduces the compiler warning count on Win64 by an additional 230, as reported by VS2013.
1 parent 298f912 commit cc66f88

Some content is hidden

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

77 files changed

+245
-237
lines changed

client/mysql.cc

+6-6
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ static void initialize_readline (char *name);
11221122

11231123
static COMMANDS *find_command(char *name);
11241124
static COMMANDS *find_command(char cmd_name);
1125-
static bool add_line(String &buffer, char *line, ulong line_length,
1125+
static bool add_line(String &buffer, char *line, size_t line_length,
11261126
char *in_string, bool *ml_comment, bool truncated);
11271127
static void remove_cntrl(String &buffer);
11281128
static void print_table_data(MYSQL_RES *result);
@@ -2439,7 +2439,7 @@ static COMMANDS *find_command(char *name)
24392439
}
24402440

24412441

2442-
static bool add_line(String &buffer, char *line, ulong line_length,
2442+
static bool add_line(String &buffer, char *line, size_t line_length,
24432443
char *in_string, bool *ml_comment, bool truncated)
24442444
{
24452445
uchar inchar;
@@ -3841,10 +3841,10 @@ print_table_data(MYSQL_RES *result)
38413841
for (uint off=0; (field = mysql_fetch_field(result)) ; off++)
38423842
{
38433843
size_t name_length= strlen(field->name);
3844-
uint numcells= charset_info->cset->numcells(charset_info,
3845-
field->name,
3846-
field->name + name_length);
3847-
uint display_length= field->max_length + name_length - numcells;
3844+
size_t numcells= charset_info->cset->numcells(charset_info,
3845+
field->name,
3846+
field->name + name_length);
3847+
size_t display_length= field->max_length + name_length - numcells;
38483848
tee_fprintf(PAGER, " %-*s |",
38493849
min<int>(display_length, MAX_COLUMN_LENGTH),
38503850
field->name);

client/mysqlbinlog.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -2167,7 +2167,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
21672167
uchar *command_buffer= NULL;
21682168
size_t command_size= 0;
21692169
ulong len= 0;
2170-
uint logname_len= 0;
2170+
size_t logname_len= 0;
21712171
uint server_id= 0;
21722172
NET* net= NULL;
21732173
my_off_t old_off= start_position_mot;
@@ -2215,7 +2215,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
22152215
error("Log name too long.");
22162216
DBUG_RETURN(ERROR_STOP);
22172217
}
2218-
const uint BINLOG_NAME_INFO_SIZE= logname_len= tlen;
2218+
const size_t BINLOG_NAME_INFO_SIZE= logname_len= tlen;
22192219

22202220
if (opt_remote_proto == BINLOG_DUMP_NON_GTID)
22212221
{
@@ -2273,7 +2273,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
22732273
ptr_buffer+= ::BINLOG_FLAGS_INFO_SIZE;
22742274
int4store(ptr_buffer, server_id);
22752275
ptr_buffer+= ::BINLOG_SERVER_ID_INFO_SIZE;
2276-
int4store(ptr_buffer, BINLOG_NAME_INFO_SIZE);
2276+
int4store(ptr_buffer, static_cast<uint32>(BINLOG_NAME_INFO_SIZE));
22772277
ptr_buffer+= ::BINLOG_NAME_SIZE_INFO_SIZE;
22782278
memcpy(ptr_buffer, logname, BINLOG_NAME_INFO_SIZE);
22792279
ptr_buffer+= BINLOG_NAME_INFO_SIZE;
@@ -2487,7 +2487,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
24872487
{
24882488
Load_log_event *le= (Load_log_event*)ev;
24892489
const char *old_fname= le->fname;
2490-
uint old_len= le->fname_len;
2490+
size_t old_len= le->fname_len;
24912491
File file;
24922492

24932493
if ((file= load_processor.prepare_new_file_for_old_format(le,fname)) < 0)

client/mysqltest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -10233,7 +10233,7 @@ int reg_replace(char** buf_p, int* buf_len_p, char *pattern,
1023310233
}
1023410234
else /* no match this time, just copy the string as is */
1023510235
{
10236-
int left_in_str= str_end-str_p;
10236+
size_t left_in_str= str_end-str_p;
1023710237
need_buf_len= (res_p-buf) + left_in_str;
1023810238
SECURE_REG_BUF
1023910239
memcpy(res_p,str_p,left_in_str);

include/my_global.h

+2
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,9 @@ typedef char my_bool; /* Small bool */
651651
#define dlsym(lib, name) (void*)GetProcAddress((HMODULE)lib, name)
652652
#define dlopen(libname, unused) LoadLibraryEx(libname, NULL, 0)
653653
#define dlclose(lib) FreeLibrary((HMODULE)lib)
654+
#ifndef HAVE_DLOPEN
654655
#define HAVE_DLOPEN
656+
#endif
655657
#define DLERROR_GENERATE(errmsg, error_number) \
656658
char win_errormsg[2048]; \
657659
if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, \

include/my_pthread.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ typedef void * (__cdecl *pthread_handler)(void *);
6767

6868
int pthread_create(pthread_t *, const pthread_attr_t *, pthread_handler, void *);
6969
int pthread_attr_init(pthread_attr_t *connect_att);
70-
int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack);
70+
int pthread_attr_setstacksize(pthread_attr_t *connect_att, size_t stack);
7171
int pthread_attr_getstacksize(pthread_attr_t *connect_att, size_t *stack);
7272
int pthread_attr_destroy(pthread_attr_t *connect_att);
7373

include/my_stacktrace.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ C_MODE_START
3030
#define HAVE_STACKTRACE 1
3131
void my_init_stacktrace();
3232
void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack);
33-
void my_safe_puts_stderr(const char* val, int max_len);
33+
void my_safe_puts_stderr(const char* val, size_t max_len);
3434
#if HAVE_BACKTRACE && HAVE_ABI_CXA_DEMANGLE
3535
char *my_demangle(const char *mangled_name, int *status);
3636
#endif

include/my_sys.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -782,10 +782,10 @@ extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem,
782782
size_t count);
783783

784784
/* Wait a given number of microseconds */
785-
static inline void my_sleep(ulong m_seconds)
785+
static inline void my_sleep(time_t m_seconds)
786786
{
787787
#if defined(_WIN32)
788-
Sleep(m_seconds/1000+1); /* Sleep() has millisecond arg */
788+
Sleep((DWORD)m_seconds/1000+1); /* Sleep() has millisecond arg */
789789
#else
790790
struct timeval t;
791791
t.tv_sec= m_seconds / 1000000L;

libmysqld/emb_qcache.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Querycache_stream
2424
public:
2525
#ifndef DBUG_OFF
2626
Query_cache_block *first_block;
27-
uint stored_size;
27+
size_t stored_size;
2828
#endif
2929
Querycache_stream(Query_cache_block *ini_block, uint ini_headers_len) :
3030
block(ini_block), headers_len(ini_headers_len)

libmysqld/lib_sql.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ bool Protocol::net_store_data(const uchar *from, size_t length,
13441344
const CHARSET_INFO *from_cs,
13451345
const CHARSET_INFO *to_cs)
13461346
{
1347-
uint conv_length= to_cs->mbmaxlen * length / from_cs->mbminlen;
1347+
size_t conv_length= to_cs->mbmaxlen * length / from_cs->mbminlen;
13481348
uint dummy_error;
13491349
char *field_buf;
13501350
if (!thd->mysql) // bootstrap file handling

mysys/my_init.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static my_bool win32_init_tcp_ip();
3838
#define SCALE_USEC 10000
3939

4040
my_bool my_init_done= 0;
41-
ulong my_thread_stack_size= 65536;
41+
ulong my_thread_stack_size= 65536;
4242

4343
static ulong atoi_octal(const char *str)
4444
{

mysys/my_winthread.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ int pthread_attr_init(pthread_attr_t *connect_att)
2929
}
3030

3131

32-
int pthread_attr_setstacksize(pthread_attr_t *connect_att,DWORD stack)
32+
int pthread_attr_setstacksize(pthread_attr_t *connect_att, size_t stack)
3333
{
34-
connect_att->dwStackSize=stack;
34+
connect_att->dwStackSize= (DWORD)stack;
3535
return 0;
3636
}
3737

mysys/stacktrace.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static int safe_print_str(const char *addr, int max_len)
131131

132132
#endif /* __linux __ */
133133

134-
void my_safe_puts_stderr(const char* val, int max_len)
134+
void my_safe_puts_stderr(const char* val, size_t max_len)
135135
{
136136
char *heap_end;
137137

@@ -524,7 +524,7 @@ void my_write_core(int unused)
524524
}
525525

526526

527-
void my_safe_puts_stderr(const char *val, int len)
527+
void my_safe_puts_stderr(const char *val, size_t len)
528528
{
529529
__try
530530
{

mysys_ssl/my_getopt.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,8 @@ void my_print_variables(const struct my_option *options)
15101510

15111511
void my_print_variables_ex(const struct my_option *options, FILE* file)
15121512
{
1513-
uint name_space= 34, length, nr;
1513+
uint name_space= 34, nr;
1514+
size_t length;
15141515
ulonglong llvalue;
15151516
char buff[255];
15161517
const struct my_option *optp;

sql/auth/sql_authentication.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,7 @@ bool rsa_auth_status()
11131113

11141114

11151115
/* the packet format is described in send_change_user_packet() */
1116-
static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
1116+
static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, size_t packet_length)
11171117
{
11181118
NET *net= mpvio->net;
11191119

sql/auth/sql_authorization.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -3588,8 +3588,8 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
35883588

35893589
static bool update_schema_privilege(THD *thd, TABLE *table, char *buff,
35903590
const char* db, const char* t_name,
3591-
const char* column, uint col_length,
3592-
const char *priv, uint priv_length,
3591+
const char* column, size_t col_length,
3592+
const char *priv, size_t priv_length,
35933593
const char* is_grantable)
35943594
{
35953595
int i= 2;

sql/binlog.cc

+5-3
Original file line numberDiff line numberDiff line change
@@ -4867,7 +4867,7 @@ int MYSQL_BIN_LOG::purge_index_entry(THD *thd, ulonglong *decrease_log_space,
48674867

48684868
for (;;)
48694869
{
4870-
uint length;
4870+
size_t length;
48714871

48724872
if ((length=my_b_gets(&purge_index_file, log_info.log_file_name,
48734873
FN_REFLEN)) <= 1)
@@ -6005,8 +6005,10 @@ int MYSQL_BIN_LOG::do_write_cache(IO_CACHE *cache)
60056005
if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
60066006
DBUG_RETURN(ER_ERROR_ON_WRITE);
60076007
size_t length = my_b_bytes_in_cache(cache);
6008-
uint group, carry, hdr_offs;
6009-
ulong remains= 0; // part of unprocessed yet netto length of the event
6008+
uint group;
6009+
size_t carry;
6010+
size_t hdr_offs;
6011+
size_t remains= 0; // part of unprocessed yet netto length of the event
60106012
long val;
60116013
ulong end_log_pos_inc= 0; // each event processed adds BINLOG_CHECKSUM_LEN 2 t
60126014
uint pc_offset= LOG_EVENT_HEADER_LEN + cache->commit_seq_offset;

sql/conn_handler/socket_connection.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class Mysqld_socket_listener
9999
struct select_info_t
100100
{
101101
fd_set m_read_fds,m_client_fds;
102-
uint m_max_used_connection;
102+
my_socket m_max_used_connection;
103103
select_info_t() : m_max_used_connection(0)
104104
{ FD_ZERO(&m_client_fds); }
105105
};

sql/field.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -7018,7 +7018,7 @@ int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr)
70187018

70197019
void Field_string::make_sort_key(uchar *to, size_t length)
70207020
{
7021-
uint tmp __attribute__((unused))=
7021+
size_t tmp __attribute__((unused))=
70227022
field_charset->coll->strnxfrm(field_charset,
70237023
to, length, char_length(),
70247024
ptr, field_length,
@@ -7298,7 +7298,7 @@ type_conversion_status Field_varstring::store(const char *from, size_t length,
72987298
if (length_bytes == 1)
72997299
*ptr= (uchar) copy_length;
73007300
else
7301-
int2store(ptr, copy_length);
7301+
int2store(ptr, static_cast<uint16>(copy_length));
73027302

73037303
return check_string_copy_error(well_formed_error_pos,
73047304
cannot_convert_error_pos, from_end_pos,
@@ -8132,7 +8132,7 @@ size_t Field_blob::get_key_image(uchar *buff, size_t length, imagetype type_arg)
81328132
memset(buff+HA_KEY_BLOB_LENGTH+blob_length, 0, (length-blob_length));
81338133
length=(uint) blob_length;
81348134
}
8135-
int2store(buff,length);
8135+
int2store(buff, static_cast<uint16>(length));
81368136
memcpy(buff+HA_KEY_BLOB_LENGTH, blob, length);
81378137
return HA_KEY_BLOB_LENGTH+length;
81388138
}

sql/field_conv.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ static uint get_varstring_copy_length(Field_varstring *to,
490490
const bool is_multibyte_charset= (cs->mbmaxlen != 1);
491491
const uint to_byte_length= to->row_pack_length();
492492

493-
uint bytes_to_copy;
493+
size_t bytes_to_copy;
494494
if (from->length_bytes == 1)
495495
bytes_to_copy= *from->ptr;
496496
else

sql/filesort.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ write_keys(Sort_param *param, Filesort_info *fs_info, uint count,
10291029
Store length as suffix in high-byte-first order.
10301030
*/
10311031

1032-
static inline void store_length(uchar *to, uint length, uint pack_length)
1032+
static inline void store_length(uchar *to, size_t length, uint pack_length)
10331033
{
10341034
switch (pack_length) {
10351035
case 1:
@@ -1149,7 +1149,7 @@ uint Sort_param::make_sortkey(uchar *to, const uchar *ref_pos)
11491149
}
11501150
else
11511151
{
1152-
uint diff;
1152+
size_t diff;
11531153
uint sort_field_length= sort_field->length -
11541154
sort_field->suffix_length;
11551155
if (sort_field_length < length)

sql/ha_partition.cc

+5-4
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ static bool print_admin_msg(THD* thd, uint len,
12471247
va_list args;
12481248
Protocol *protocol= thd->protocol;
12491249
uint length;
1250-
uint msg_length;
1250+
size_t msg_length;
12511251
char name[NAME_LEN*2+2];
12521252
char *msgbuf;
12531253
bool error= true;
@@ -2457,8 +2457,9 @@ static uint name_add(char *dest, const char *first_name, const char *sec_name)
24572457
bool ha_partition::create_handler_file(const char *name)
24582458
{
24592459
partition_element *part_elem, *subpart_elem;
2460-
uint i, j, part_name_len, subpart_name_len;
2461-
uint tot_partition_words, tot_name_len, num_parts;
2460+
uint i, j;
2461+
size_t part_name_len, subpart_name_len, tot_name_len;
2462+
uint tot_partition_words, num_parts;
24622463
uint tot_parts= 0;
24632464
uint tot_len_words, tot_len_byte, chksum, tot_name_words;
24642465
char *name_buffer_ptr;
@@ -2948,7 +2949,7 @@ bool ha_partition::insert_partition_name_in_hash(const char *name, uint part_id,
29482949
{
29492950
PART_NAME_DEF *part_def;
29502951
uchar *part_name;
2951-
uint part_name_length;
2952+
size_t part_name_length;
29522953
DBUG_ENTER("ha_partition::insert_partition_name_in_hash");
29532954
/*
29542955
Calculate and store the length here, to avoid doing it when

sql/handler.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -5404,7 +5404,7 @@ struct binlog_log_query_st
54045404
{
54055405
enum_binlog_command binlog_command;
54065406
const char *query;
5407-
uint query_length;
5407+
size_t query_length;
54085408
const char *db;
54095409
const char *table_name;
54105410
};

sql/item.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -8602,7 +8602,7 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
86028602
}
86038603
else
86048604
{
8605-
uint length= result->length();
8605+
size_t length= result->length();
86068606
char *tmp_str= sql_strmake(result->ptr(), length);
86078607
new_item= new Item_string(item->item_name, tmp_str, length, result->charset());
86088608
}

sql/item_func.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -3870,7 +3870,7 @@ udf_handler::fix_fields(THD *thd, Item_result_field *func,
38703870
free_udf(u_d);
38713871
DBUG_RETURN(TRUE);
38723872
}
3873-
func->max_length= min<size_t>(initid.max_length, MAX_BLOB_WIDTH);
3873+
func->max_length= min<uint32>(initid.max_length, MAX_BLOB_WIDTH);
38743874
func->maybe_null=initid.maybe_null;
38753875
const_item_cache=initid.const_item;
38763876
/*
@@ -5798,7 +5798,7 @@ get_var_with_binlog(THD *thd, enum_sql_command sql_command,
57985798
return 0;
57995799
}
58005800

5801-
uint size;
5801+
size_t size;
58025802
/*
58035803
First we need to store value of var_entry, when the next situation
58045804
appears:

sql/item_inetfunc.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ String* Item_func_inet_ntoa::val_str(String* str)
113113
str->length(0);
114114

115115
uchar buf[8];
116-
int4store(buf, n);
116+
int4store(buf, static_cast<uint32>(n));
117117

118118
/* Now we can assume little endian. */
119119

sql/item_strfunc.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,7 @@ String *Item_func_left::val_str(String *str)
15741574

15751575
/* must be longlong to avoid truncation */
15761576
longlong length= args[1]->val_int();
1577-
uint char_pos;
1577+
size_t char_pos;
15781578

15791579
if ((null_value=(args[0]->null_value || args[1]->null_value)))
15801580
return 0;

sql/item_timefunc.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static DATE_TIME_FORMAT time_24hrs_format= {{0}, '\0', 0,
176176
*/
177177

178178
static bool extract_date_time(DATE_TIME_FORMAT *format,
179-
const char *val, uint length, MYSQL_TIME *l_time,
179+
const char *val, size_t length, MYSQL_TIME *l_time,
180180
timestamp_type cached_timestamp_type,
181181
const char **sub_pattern_end,
182182
const char *date_time_type)

sql/item_xmlfunc.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,7 @@ MY_XPATH_FUNC *
13021302
my_xpath_function(const char *beg, const char *end)
13031303
{
13041304
MY_XPATH_FUNC *k, *function_names;
1305-
uint length= end-beg;
1305+
size_t length= end-beg;
13061306
switch (length)
13071307
{
13081308
case 1: return 0;

0 commit comments

Comments
 (0)