diff options
94 files changed, 241 insertions, 240 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 190bb2383e9..f7e9a14b33e 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -373,7 +373,7 @@ static void find_tool(char *tool_executable_name, const char *tool_name, } else { - int len; + size_t len; /* mysql_upgrade was run absolutely or relatively. We can find a sibling diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 1e3249dd92a..df0dc1e7049 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -837,7 +837,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) bool old= (find_type(argv[0], &command_typelib, 2) == ADMIN_OLD_PASSWORD); #ifdef __WIN__ - uint pw_len= strlen(pw); + uint pw_len= (uint) strlen(pw); if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'') printf("Warning: single quotes were not trimmed from the password by" " your command\nline client, as you might have expected.\n"); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 0b8e843887d..1621db5ded8 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -128,7 +128,7 @@ static Exit_status safe_connect(); class Load_log_processor { char target_dir_name[FN_REFLEN]; - int target_dir_name_len; + size_t target_dir_name_len; /* When we see first event corresponding to some LOAD DATA statement in @@ -285,9 +285,9 @@ public: File prepare_new_file_for_old_format(Load_log_event *le, char *filename); Exit_status load_old_format_file(NET* net, const char *server_fname, uint server_fname_len, File file); - Exit_status process_first_event(const char *bname, uint blen, + Exit_status process_first_event(const char *bname, size_t blen, const uchar *block, - uint block_len, uint file_id, + size_t block_len, uint file_id, Create_file_log_event *ce); }; @@ -305,7 +305,7 @@ public: File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le, char *filename) { - uint len; + size_t len; char *tail; File file; @@ -319,7 +319,7 @@ File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le, return -1; } - le->set_fname_outside_temp_buf(filename,len+strlen(tail)); + le->set_fname_outside_temp_buf(filename,len+(uint) strlen(tail)); return file; } @@ -411,9 +411,9 @@ Exit_status Load_log_processor::load_old_format_file(NET* net, @retval OK_CONTINUE No error, the program should continue. */ Exit_status Load_log_processor::process_first_event(const char *bname, - uint blen, + size_t blen, const uchar *block, - uint block_len, + size_t block_len, uint file_id, Create_file_log_event *ce) { @@ -456,7 +456,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname, } if (ce) - ce->set_fname_outside_temp_buf(fname, strlen(fname)); + ce->set_fname_outside_temp_buf(fname, (uint) strlen(fname)); if (my_write(file, (uchar*)block, block_len, MYF(MY_WME|MY_NABP))) { @@ -1189,7 +1189,7 @@ static my_time_t convert_str_to_timestamp(const char* str) long dummy_my_timezone; my_bool dummy_in_dst_time_gap; /* We require a total specification (date AND time) */ - if (str_to_datetime(str, strlen(str), &l_time, 0, &was_cut) != + if (str_to_datetime(str, (uint) strlen(str), &l_time, 0, &was_cut) != MYSQL_TIMESTAMP_DATETIME || was_cut) { error("Incorrect date and time argument: %s", str); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 86e1b3352b4..d2edd084c57 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -349,7 +349,7 @@ static int get_options(int *argc, char ***argv) if (!what_to_do) { - int pnlen = strlen(my_progname); + size_t pnlen= strlen(my_progname); if (pnlen < 6) /* name too short */ what_to_do = DO_CHECK; @@ -448,7 +448,8 @@ static int process_selected_tables(char *db, char **table_names, int tables) space is for more readable output in logs and in case of error */ char *table_names_comma_sep, *end; - int i, tot_length = 0; + size_t tot_length= 0; + int i= 0; for (i = 0; i < tables; i++) tot_length+= fixed_name_length(*(table_names + i)) + 2; @@ -464,7 +465,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) *end++= ','; } *--end = 0; - handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1); + handle_request_for_tables(table_names_comma_sep + 1, (uint) (tot_length - 1)); my_free(table_names_comma_sep, MYF(0)); } else @@ -486,7 +487,7 @@ static uint fixed_name_length(const char *name) else if (*p == '.') extra_length+= 2; } - return (p - name) + extra_length; + return (uint) ((p - name) + extra_length); } diff --git a/client/mysqldump.c b/client/mysqldump.c index 44c53a0e4c2..1e0c57782b3 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -802,7 +802,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_set_charset= 0; opt_compatible_mode_str= argument; opt_compatible_mode= find_set(&compatible_mode_typelib, - argument, strlen(argument), + argument, (uint) strlen(argument), &err_ptr, &err_len); if (err_len) { diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 9ba912d646c..b8515289df5 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -1929,7 +1929,7 @@ parse_option(const char *origin, option_string **stmt, char delm) char *ptr= (char *)origin; option_string **sptr= stmt; option_string *tmp; - uint length= strlen(origin); + size_t length= strlen(origin); uint count= 0; /* We know that there is always one */ for (tmp= *sptr= (option_string *)my_malloc(sizeof(option_string), diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 89b9c78a049..bcef47e846f 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -1316,7 +1316,7 @@ void log_msg(const char *fmt, ...) void cat_file(DYNAMIC_STRING* ds, const char* filename) { int fd; - uint len; + size_t len; char buff[512]; if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0) @@ -1614,7 +1614,7 @@ int compare_files2(File fd, const char* filename2) { int error= RESULT_OK; File fd2; - uint len, len2; + size_t len, len2; char buff[512], buff2[512]; if ((fd2= my_open(filename2, O_RDONLY, MYF(0))) < 0) diff --git a/client/sql_string.cc b/client/sql_string.cc index c41463999aa..f44350e092e 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -468,7 +468,7 @@ bool String::append(const char *s,uint32 arg_length) bool String::append(const char *s) { - return append(s, strlen(s)); + return append(s, (uint) strlen(s)); } diff --git a/extra/comp_err.c b/extra/comp_err.c index f2d486487ff..e36e85f6f0c 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -660,7 +660,7 @@ static ha_checksum checksum_format_specifier(const char* msg) case 'u': case 'x': case 's': - chksum= my_checksum(chksum, start, p-start); + chksum= my_checksum(chksum, start, (uint) (p - start)); start= 0; /* Not in format specifier anymore */ break; diff --git a/extra/yassl/src/buffer.cpp b/extra/yassl/src/buffer.cpp index 0c3f23b0cb8..66107dbe0a9 100644 --- a/extra/yassl/src/buffer.cpp +++ b/extra/yassl/src/buffer.cpp @@ -106,7 +106,7 @@ void input_buffer::add_size(uint i) uint input_buffer::get_capacity() const { - return end_ - buffer_; + return (uint) (end_ - buffer_); } @@ -223,7 +223,7 @@ uint output_buffer::get_size() const uint output_buffer::get_capacity() const { - return end_ - buffer_; + return (uint) (end_ - buffer_); } diff --git a/extra/yassl/taocrypt/include/block.hpp b/extra/yassl/taocrypt/include/block.hpp index 529a91eee08..bb34db5e07f 100644 --- a/extra/yassl/taocrypt/include/block.hpp +++ b/extra/yassl/taocrypt/include/block.hpp @@ -78,7 +78,7 @@ typename A::pointer StdReallocate(A& a, T* p, typename A::size_type oldSize, if (preserve) { A b = A(); typename A::pointer newPointer = b.allocate(newSize, 0); - memcpy(newPointer, p, sizeof(T) * min(oldSize, newSize)); + memcpy(newPointer, p, sizeof(T) * min((word32) oldSize, (word32) newSize)); a.deallocate(p, oldSize); STL::swap(a, b); return newPointer; diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp index cb597c41552..c221ce3d6cb 100644 --- a/extra/yassl/taocrypt/src/algebra.cpp +++ b/extra/yassl/taocrypt/src/algebra.cpp @@ -288,7 +288,7 @@ void AbstractGroup::SimultaneousMultiply(Integer *results, const Integer &base, r = buckets[i][buckets[i].size()-1]; if (buckets[i].size() > 1) { - for (int j = buckets[i].size()-2; j >= 1; j--) + for (int j= (unsigned int) (buckets[i].size()) - 2; j >= 1; j--) { Accumulate(buckets[i][j], buckets[i][j+1]); Accumulate(r, buckets[i][j]); diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp index a06ab658c7b..3b1c1c2136a 100644 --- a/extra/yassl/taocrypt/src/asn.cpp +++ b/extra/yassl/taocrypt/src/asn.cpp @@ -213,7 +213,7 @@ void PublicKey::AddToEnd(const byte* data, word32 len) Signer::Signer(const byte* k, word32 kSz, const char* n, const byte* h) : key_(k, kSz) { - int sz = strlen(n); + size_t sz = strlen(n); memcpy(name_, n, sz); name_[sz] = 0; diff --git a/include/config-win.h b/include/config-win.h index ab0926af864..ab4da080299 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -64,6 +64,9 @@ functions */ #endif #ifndef __WIN32__ #define __WIN32__ +#define _INTEGRAL_MAX_BITS 32 +#else +#define _INTEGRAL_MAX_BITS 64 #endif #endif /* _WIN64 */ #ifndef __WIN__ diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index ca329eadf0f..1dd32df7aff 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1617,7 +1617,7 @@ mysql_hex_string(char *to, const char *from, ulong length) ulong STDCALL mysql_escape_string(char *to,const char *from,ulong length) { - return escape_string_for_mysql(default_charset_info, to, 0, from, length); + return (uint) escape_string_for_mysql(default_charset_info, to, 0, from, length); } ulong STDCALL @@ -1625,8 +1625,8 @@ mysql_real_escape_string(MYSQL *mysql, char *to,const char *from, ulong length) { if (mysql->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES) - return escape_quotes_for_mysql(mysql->charset, to, 0, from, length); - return escape_string_for_mysql(mysql->charset, to, 0, from, length); + return (uint) escape_quotes_for_mysql(mysql->charset, to, 0, from, length); + return (uint) escape_string_for_mysql(mysql->charset, to, 0, from, length); } void STDCALL diff --git a/mysys/array.c b/mysys/array.c index f11a327232c..92940717c90 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -371,7 +371,7 @@ void freeze_size(DYNAMIC_ARRAY *array) int get_index_dynamic(DYNAMIC_ARRAY *array, uchar* element) { - uint ret; + size_t ret; if (array->buffer > element) return -1; diff --git a/mysys/base64.c b/mysys/base64.c index 6157dcaa5af..f7d9c8b0d09 100644 --- a/mysys/base64.c +++ b/mysys/base64.c @@ -223,7 +223,7 @@ base64_decode(const char *src_base, size_t len, The variable 'i' is set to 'len' when padding has been read, so it does not actually reflect the number of bytes read from 'src'. */ - return i != len ? -1 : d - dst_base; + return i != len ? -1 : (uint) (d - dst_base); } diff --git a/mysys/charset.c b/mysys/charset.c index 8f47b4027ef..e61995de1d8 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -328,7 +328,7 @@ static my_bool my_read_charset_file(const char *filename, myf myflags) { uchar *buf; int fd; - uint len, tmp_len; + size_t len, tmp_len; MY_STAT stat_info; if (!my_stat(filename, &stat_info, MYF(myflags)) || diff --git a/mysys/checksum.c b/mysys/checksum.c index 4f86f6845f0..1c7c9358d53 100644 --- a/mysys/checksum.c +++ b/mysys/checksum.c @@ -36,7 +36,7 @@ ha_checksum my_checksum(ha_checksum crc, const uchar *pos, size_t length) crc=((crc << 8) + *((uchar*) pos)) + (crc >> (8*sizeof(ha_checksum)-8)); return crc; #else - return (ha_checksum)crc32((uint)crc, pos, length); + return (ha_checksum)crc32((uint)crc, pos, (uint)length); #endif } diff --git a/mysys/default.c b/mysys/default.c index 6b2b31d43ec..dc4cce16ace 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -182,7 +182,7 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv, /* Handle --defaults-group-suffix= */ uint i; const char **extra_groups; - const uint instance_len= strlen(my_defaults_group_suffix); + const size_t instance_len= strlen(my_defaults_group_suffix); struct handle_option_ctx *ctx= (struct handle_option_ctx*) func_ctx; char *ptr; TYPELIB *group= ctx->group; @@ -194,11 +194,11 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv, for (i= 0; i < group->count; i++) { - uint len; + size_t len; extra_groups[i]= group->type_names[i]; /** copy group */ len= strlen(extra_groups[i]); - if (!(ptr= alloc_root(ctx->alloc, len+instance_len+1))) + if (!(ptr= alloc_root(ctx->alloc, (uint) (len+instance_len+1)))) goto err; extra_groups[i+group->count]= ptr; @@ -970,7 +970,7 @@ void print_defaults(const char *conf_file, const char **groups) static int add_directory(MEM_ROOT *alloc, const char *dir, const char **dirs) { char buf[FN_REFLEN]; - uint len; + size_t len; char *p; my_bool err __attribute__((unused)); @@ -1004,14 +1004,14 @@ static size_t my_get_system_windows_directory(char *buffer, size_t size) "GetSystemWindowsDirectoryA"); if (func_ptr) - return func_ptr(buffer, size); + return func_ptr(buffer, (uint) size); /* Windows NT 4.0 Terminal Server Edition: To retrieve the shared Windows directory, call GetSystemDirectory and trim the "System32" element from the end of the returned path. */ - count= GetSystemDirectory(buffer, size); + count= GetSystemDirectory(buffer, (uint) size); if (count > 8 && stricmp(buffer+(count-8), "\\System32") == 0) { count-= 8; diff --git a/mysys/default_modify.c b/mysys/default_modify.c index 78f6105b071..88df0122da2 100644 --- a/mysys/default_modify.c +++ b/mysys/default_modify.c @@ -68,11 +68,9 @@ int modify_defaults_file(const char *file_location, const char *option, FILE *cnf_file; MY_STAT file_stat; char linebuff[BUFF_SIZE], *src_ptr, *dst_ptr, *file_buffer; - size_t opt_len= 0, optval_len= 0, sect_len; + size_t opt_len= 0, optval_len= 0, sect_len, new_opt_len, reserve_extended; uint nr_newlines= 0, buffer_size; my_bool in_section= FALSE, opt_applied= 0; - uint reserve_extended; - uint new_opt_len; int reserve_occupied= 0; DBUG_ENTER("modify_defaults_file"); diff --git a/mysys/hash.c b/mysys/hash.c index dd2d589e509..0b44782aeb5 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -157,14 +157,14 @@ my_hash_key(const HASH *hash, const uchar *record, size_t *length, /* Calculate pos according to keys */ -static uint my_hash_mask(uint hashnr, uint buffmax, uint maxlength) +static uint my_hash_mask(size_t hashnr, size_t buffmax, size_t maxlength) { if ((hashnr & (buffmax-1)) < maxlength) return (hashnr & (buffmax-1)); return (hashnr & ((buffmax >> 1) -1)); } static uint my_hash_rec_mask(const HASH *hash, HASH_LINK *pos, - uint buffmax, uint maxlength) + size_t buffmax, size_t maxlength) { size_t length; uchar *key= (uchar*) my_hash_key(hash, pos->data, &length, 0); @@ -309,8 +309,7 @@ static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key, my_bool my_hash_insert(HASH *info, const uchar *record) { int flag; - size_t idx; - uint halfbuff,hash_nr,first_index; + size_t idx,halfbuff,hash_nr,first_index; uchar *ptr_to_rec,*ptr_to_rec2; HASH_LINK *data,*empty,*gpos,*gpos2,*pos; @@ -539,8 +538,8 @@ exit: my_bool my_hash_update(HASH *hash, uchar *record, uchar *old_key, size_t old_key_length) { - uint new_index,new_pos_index,blength,records,empty; - size_t idx; + uint new_index,new_pos_index,blength,records; + size_t idx,empty; HASH_LINK org_link,*data,*previous,*pos; DBUG_ENTER("my_hash_update"); diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 7cbd35580f1..397a3332740 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -2404,7 +2404,7 @@ static void read_block(KEY_CACHE *keycache, BLOCK_LINK *block, uint read_length, uint min_length, my_bool primary) { - uint got_length; + size_t got_length; /* On entry cache_lock is locked */ diff --git a/mysys/mf_tempdir.c b/mysys/mf_tempdir.c index d6492c90965..f41bbab946f 100644 --- a/mysys/mf_tempdir.c +++ b/mysys/mf_tempdir.c @@ -47,7 +47,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist) } do { - uint length; + size_t length; end=strcend(pathlist, DELIM); strmake(buff, pathlist, (uint) (end-pathlist)); length= cleanup_dirname(buff, buff); diff --git a/mysys/my_append.c b/mysys/my_append.c index 35881a959d5..d8789f95d95 100644 --- a/mysys/my_append.c +++ b/mysys/my_append.c @@ -36,7 +36,7 @@ struct utimbuf { int my_append(const char *from, const char *to, myf MyFlags) { - uint Count; + size_t Count; File from_file,to_file; uchar buff[IO_SIZE]; DBUG_ENTER("my_append"); diff --git a/mysys/my_compress.c b/mysys/my_compress.c index 0d076e77c35..a3d9d56915e 100644 --- a/mysys/my_compress.c +++ b/mysys/my_compress.c @@ -67,7 +67,7 @@ uchar *my_compress_alloc(const uchar *packet, size_t *len, size_t *complen) if (!(compbuf= (uchar *) my_malloc(*complen, MYF(MY_WME)))) return 0; /* Not enough memory */ - tmp_complen= *complen; + tmp_complen= (uint) *complen; res= compress((Bytef*) compbuf, &tmp_complen, (Bytef*) packet, (uLong) *len); *complen= tmp_complen; @@ -118,7 +118,7 @@ my_bool my_uncompress(uchar *packet, size_t len, size_t *complen) if (!compbuf) DBUG_RETURN(1); /* Not enough memory */ - tmp_complen= *complen; + tmp_complen= (uint) *complen; error= uncompress((Bytef*) compbuf, &tmp_complen, (Bytef*) packet, (uLong) len); *complen= tmp_complen; diff --git a/mysys/my_conio.c b/mysys/my_conio.c index b78966446ee..5dbd31193a9 100644 --- a/mysys/my_conio.c +++ b/mysys/my_conio.c @@ -172,7 +172,7 @@ char* my_cgets(char *buffer, size_t clen, size_t* plen) do { clen= min(clen, (size_t) csbi.dwSize.X*csbi.dwSize.Y); - if (!ReadConsole((HANDLE)my_coninpfh, (LPVOID)buffer, clen - 1, &plen_res, + if (!ReadConsole((HANDLE)my_coninpfh, (LPVOID)buffer, (DWORD) clen - 1, &plen_res, NULL)) { result= NULL; diff --git a/mysys/my_copy.c b/mysys/my_copy.c index cd741b1eb52..5679d13d39d 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -50,7 +50,7 @@ struct utimbuf { int my_copy(const char *from, const char *to, myf MyFlags) { - uint Count; + size_t Count; my_bool new_file_stat= 0; /* 1 if we could stat "to" */ int create_flag; File from_file,to_file; diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index cbfebcf2374..e0c5b94b53e 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -55,7 +55,7 @@ int my_getwd(char * buf, size_t size, myf MyFlags) else { #if defined(HAVE_GETCWD) - if (!getcwd(buf,size-2) && MyFlags & MY_WME) + if (!getcwd(buf,(uint) (size-2)) && MyFlags & MY_WME) { my_errno=errno; my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno); diff --git a/mysys/my_pread.c b/mysys/my_pread.c index de7a2b611ed..2b63a048c99 100644 --- a/mysys/my_pread.c +++ b/mysys/my_pread.c @@ -59,7 +59,7 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, pthread_mutex_lock(&my_file_info[Filedes].mutex); readbytes= (uint) -1; error= (lseek(Filedes, offset, MY_SEEK_SET) == (my_off_t) -1 || - (readbytes= read(Filedes, Buffer, Count)) != Count); + (readbytes= read(Filedes, Buffer, (uint) Count)) != Count); pthread_mutex_unlock(&my_file_info[Filedes].mutex); #else if ((error= ((readbytes= pread(Filedes, Buffer, Count, offset)) != Count))) @@ -136,7 +136,7 @@ size_t my_pwrite(int Filedes, const uchar *Buffer, size_t Count, writenbytes= (size_t) -1; pthread_mutex_lock(&my_file_info[Filedes].mutex); error= (lseek(Filedes, offset, MY_SEEK_SET) != (my_off_t) -1 && - (writenbytes = write(Filedes, Buffer, Count)) == Count); + (writenbytes = write(Filedes, Buffer, (uint) Count)) == Count); pthread_mutex_unlock(&my_file_info[Filedes].mutex); if (error) break; diff --git a/mysys/my_quick.c b/mysys/my_quick.c index c19fe08572d..0ba20a5bdee 100644 --- a/mysys/my_quick.c +++ b/mysys/my_quick.c @@ -23,7 +23,7 @@ size_t my_quick_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags) { size_t readbytes; - if ((readbytes = read(Filedes, Buffer, Count)) != Count) + if ((readbytes = read(Filedes, Buffer, (uint) Count)) != Count) { #ifndef DBUG_OFF if ((readbytes == 0 || readbytes == (size_t) -1) && errno == EINTR) @@ -50,7 +50,7 @@ size_t my_quick_write(File Filedes,const uchar *Buffer,size_t Count) #ifndef DBUG_OFF writtenbytes = #endif - (size_t) write(Filedes,Buffer,Count)) != Count) + (size_t) write(Filedes,Buffer, (uint) Count)) != Count) { #ifndef DBUG_OFF if ((writtenbytes == 0 || writtenbytes == (size_t) -1) && errno == EINTR) diff --git a/mysys/my_read.c b/mysys/my_read.c index f3e8a4b300e..0c302d5b227 100644 --- a/mysys/my_read.c +++ b/mysys/my_read.c @@ -44,7 +44,7 @@ size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags) for (;;) { errno= 0; /* Linux doesn't reset this */ - if ((readbytes= read(Filedes, Buffer, Count)) != Count) + if ((readbytes= read(Filedes, Buffer, (uint) Count)) != Count) { my_errno= errno ? errno : -1; DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d", diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c index c484f1d4c54..36d07b475e9 100644 --- a/mysys/safemalloc.c +++ b/mysys/safemalloc.c @@ -174,7 +174,7 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags) data[size + 3]= MAGICEND3; irem->filename= (char *) filename; irem->linenum= lineno; - irem->datasize= size; + irem->datasize= (uint32) size; irem->prev= NULL; /* Add this remember structure to the linked list */ diff --git a/mysys/string.c b/mysys/string.c index b234a589406..10a72b8a295 100644 --- a/mysys/string.c +++ b/mysys/string.c @@ -25,7 +25,7 @@ my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, size_t init_alloc, size_t alloc_increment) { - uint length; + size_t length; DBUG_ENTER("init_dynamic_string"); if (!alloc_increment) @@ -100,7 +100,7 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, char *new_ptr; if (str->length+length >= str->max_length) { - uint new_length=(str->length+length+str->alloc_increment)/ + size_t new_length=(str->length+length+str->alloc_increment)/ str->alloc_increment; new_length*=str->alloc_increment; if (!(new_ptr=(char*) my_realloc(str->str,new_length,MYF(MY_WME)))) @@ -160,12 +160,12 @@ my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...) /* Search for quote in each string and replace with escaped quote */ while(*(next_pos= strcend(cur_pos, quote_str[0])) != '\0') { - ret&= dynstr_append_mem(str, cur_pos, next_pos - cur_pos); + ret&= dynstr_append_mem(str, cur_pos, (uint) (next_pos - cur_pos)); ret&= dynstr_append_mem(str ,"\\", 1); ret&= dynstr_append_mem(str, quote_str, quote_len); cur_pos= next_pos + 1; } - ret&= dynstr_append_mem(str, cur_pos, next_pos - cur_pos); + ret&= dynstr_append_mem(str, cur_pos, (uint) (next_pos - cur_pos)); append= va_arg(dirty_text, char *); } va_end(dirty_text); diff --git a/server-tools/instance-manager/buffer.cc b/server-tools/instance-manager/buffer.cc index 1c50b11609e..f197f42d009 100644 --- a/server-tools/instance-manager/buffer.cc +++ b/server-tools/instance-manager/buffer.cc @@ -100,7 +100,7 @@ err: int Buffer::get_size() { - return buffer_size; + return (uint) buffer_size; } diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc index 4a1b658737e..1ad728d40eb 100644 --- a/server-tools/instance-manager/instance.cc +++ b/server-tools/instance-manager/instance.cc @@ -163,7 +163,7 @@ static bool start_process(Instance_options *instance_options, int cmdlen= 0; for (int i= 0; instance_options->argv[i] != 0; i++) - cmdlen+= strlen(instance_options->argv[i]) + 3; + cmdlen+= (uint) strlen(instance_options->argv[i]) + 3; cmdlen++; /* make room for the null */ char *cmdline= new char[cmdlen]; diff --git a/server-tools/instance-manager/options.cc b/server-tools/instance-manager/options.cc index 7eba3187dd9..d8667e155b5 100644 --- a/server-tools/instance-manager/options.cc +++ b/server-tools/instance-manager/options.cc @@ -103,7 +103,7 @@ const char *Options::Debug::config_str= "d:t:i:O,im.trace"; #endif static const char * const ANGEL_PID_FILE_SUFFIX= ".angel.pid"; -static const int ANGEL_PID_FILE_SUFFIX_LEN= strlen(ANGEL_PID_FILE_SUFFIX); +static const int ANGEL_PID_FILE_SUFFIX_LEN= (uint) strlen(ANGEL_PID_FILE_SUFFIX); /* List of options, accepted by the instance manager. diff --git a/server-tools/instance-manager/parse.h b/server-tools/instance-manager/parse.h index 00f7aa237b8..9c50ace5948 100644 --- a/server-tools/instance-manager/parse.h +++ b/server-tools/instance-manager/parse.h @@ -206,7 +206,7 @@ inline void get_word(const char **text, size_t *word_len, break; } - *word_len= word_end - *text; + *word_len= (uint) (word_end - *text); } #endif /* INCLUDES_MYSQL_INSTANCE_MANAGER_PARSE_H */ diff --git a/sql-common/client.c b/sql-common/client.c index 63c746a3f5a..b63ba33bfb8 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -3183,7 +3183,7 @@ int STDCALL mysql_set_character_set(MYSQL *mysql, const char *cs_name) if (mysql_get_server_version(mysql) < 40100) return 0; sprintf(buff, "SET NAMES %s", cs_name); - if (!mysql_real_query(mysql, buff, strlen(buff))) + if (!mysql_real_query(mysql, buff, (uint) strlen(buff))) { mysql->charset= cs; } diff --git a/sql-common/my_user.c b/sql-common/my_user.c index d6f2818ad77..0b72e002977 100644 --- a/sql-common/my_user.c +++ b/sql-common/my_user.c @@ -44,8 +44,8 @@ void parse_user(const char *user_id_str, size_t user_id_len, } else { - *user_name_len= p - user_id_str; - *host_name_len= user_id_len - *user_name_len - 1; + *user_name_len= (uint) (p - user_id_str); + *host_name_len= (uint) (user_id_len - *user_name_len - 1); if (*user_name_len > USERNAME_LENGTH) *user_name_len= USERNAME_LENGTH; diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index ea3c9f17e23..0eba357b632 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -380,7 +380,7 @@ bool Event_job_data::load_from_row(THD *thd, TABLE *table) { char *ptr; - uint len; + size_t len; LEX_STRING tz_name; DBUG_ENTER("Event_job_data::load_from_row"); @@ -580,7 +580,7 @@ bool Event_timed::load_from_row(THD *thd, TABLE *table) { char *ptr; - uint len; + size_t len; DBUG_ENTER("Event_timed::load_from_row"); diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc index 63ecc3006dd..86905b38627 100644 --- a/sql/event_parse_data.cc +++ b/sql/event_parse_data.cc @@ -527,8 +527,8 @@ Event_parse_data::init_definer(THD *thd) const char *definer_user= thd->lex->definer->user.str; const char *definer_host= thd->lex->definer->host.str; - int definer_user_len= thd->lex->definer->user.length; - int definer_host_len= thd->lex->definer->host.length; + size_t definer_user_len= thd->lex->definer->user.length; + size_t definer_host_len= thd->lex->definer->host.length; DBUG_PRINT("info",("init definer_user thd->mem_root: 0x%lx " "definer_user: 0x%lx", (long) thd->mem_root, diff --git a/sql/events.cc b/sql/events.cc index e24d51628c0..4203ca06d7f 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -694,7 +694,7 @@ send_show_create_event(THD *thd, Event_timed *et, Protocol *protocol) &sql_mode)) DBUG_RETURN(TRUE); - field_list.push_back(new Item_empty_string("sql_mode", sql_mode.length)); + field_list.push_back(new Item_empty_string("sql_mode", (uint) sql_mode.length)); tz_name= et->time_zone->get_name(); diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 214ee4c99d2..5a0904f87b9 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -204,7 +204,7 @@ void insert_symbols() for (cur= symbols; i<array_elements(symbols); cur++, i++){ hash_lex_struct *root= get_hash_struct_by_len(&root_by_len,cur->length,&max_len); - insert_into_hash(root,cur->name,0,i,0); + insert_into_hash(root,cur->name,0,(uint) i,0); } } @@ -516,7 +516,7 @@ static SYMBOL *get_hash_symbol(const char *s,\n\ res= symbols+ires;\n\ else\n\ res= sql_functions-ires-1;\n\ - register uint count= cur_str-s;\n\ + register uint count= (uint) (cur_str - s);\n\ return lex_casecmp(cur_str,res->name+count,len-count) ? 0 : res;\n\ }\n\ \n\ @@ -545,7 +545,7 @@ static SYMBOL *get_hash_symbol(const char *s,\n\ register int16 ires= (int16)(cur_struct>>16);\n\ if (ires==array_elements(symbols)) return 0;\n\ register SYMBOL *res= symbols+ires;\n\ - register uint count= cur_str-s;\n\ + register uint count= (uint) (cur_str - s);\n\ return lex_casecmp(cur_str,res->name+count,len-count)!=0 ? 0 : res;\n\ }\n\ \n\ diff --git a/sql/item.h b/sql/item.h index be9daf672f0..d28ee1a29fb 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1092,7 +1092,7 @@ inline void Item_sp_variable::make_field(Send_field *field) if (name) it->set_name(name, (uint) strlen(name), system_charset_info); else - it->set_name(m_name.str, m_name.length, system_charset_info); + it->set_name(m_name.str, (uint) m_name.length, system_charset_info); it->make_field(field); } diff --git a/sql/item_func.cc b/sql/item_func.cc index 34cb50ee7fa..ac96d4f6b24 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2739,7 +2739,7 @@ longlong Item_func_find_in_set::val_int() if (is_last_item && !is_separator) str_end= substr_end; if (!my_strnncoll(cs, (const uchar *) str_begin, - str_end - str_begin, + (uint) (str_end - str_begin), find_str, find_str_len)) return (longlong) position; else @@ -4825,7 +4825,7 @@ Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg, component(*component_arg), cache_present(0) { /* set_name() will allocate the name */ - set_name(name_arg, name_len_arg, system_charset_info); + set_name(name_arg, (uint) name_len_arg, system_charset_info); } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index fc9375e68a5..0595aa5bf7d 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1830,17 +1830,17 @@ bool Item_func_user::init(const char *user, const char *host) if (user) { CHARSET_INFO *cs= str_value.charset(); - uint res_length= (strlen(user)+strlen(host)+2) * cs->mbmaxlen; + size_t res_length= (strlen(user)+strlen(host)+2) * cs->mbmaxlen; - if (str_value.alloc(res_length)) + if (str_value.alloc((uint) res_length)) { null_value=1; return TRUE; } - res_length=cs->cset->snprintf(cs, (char*)str_value.ptr(), res_length, + res_length=cs->cset->snprintf(cs, (char*)str_value.ptr(), (uint) res_length, "%s@%s", user, host); - str_value.length(res_length); + str_value.length((uint) res_length); str_value.mark_as_const(); } return FALSE; @@ -2544,7 +2544,7 @@ String *Item_func_rpad::val_str(String *str) memcpy(to,ptr_pad,(size_t) pad_byte_length); to+= pad_byte_length; } - res->length(to- (char*) res->ptr()); + res->length((uint) (to- (char*) res->ptr())); return (res); err: @@ -2812,7 +2812,7 @@ String *Item_func_charset::val_str(String *str) CHARSET_INFO *cs= args[0]->collation.collation; null_value= 0; - str->copy(cs->csname, strlen(cs->csname), + str->copy(cs->csname, (uint) strlen(cs->csname), &my_charset_latin1, collation.collation, &dummy_errors); return str; } @@ -2824,7 +2824,7 @@ String *Item_func_collation::val_str(String *str) CHARSET_INFO *cs= args[0]->collation.collation; null_value= 0; - str->copy(cs->name, strlen(cs->name), + str->copy(cs->name, (uint) strlen(cs->name), &my_charset_latin1, collation.collation, &dummy_errors); return str; } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index ab20ed17cd7..8caff22eab9 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -391,7 +391,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format, if (tmp - val > 6) tmp= (char*) val + 6; l_time->second_part= (int) my_strtoll10(val, &tmp, &error); - frac_part= 6 - (tmp - val); + frac_part= 6 - (uint) (tmp - val); if (frac_part > 0) l_time->second_part*= (ulong) log_10_int[frac_part]; val= tmp; @@ -642,14 +642,14 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, if (!l_time->month) return 1; str->append(locale->month_names->type_names[l_time->month-1], - strlen(locale->month_names->type_names[l_time->month-1]), + (uint) strlen(locale->month_names->type_names[l_time->month-1]), system_charset_info); break; case 'b': if (!l_time->month) return 1; str->append(locale->ab_month_names->type_names[l_time->month-1], - strlen(locale->ab_month_names->type_names[l_time->month-1]), + (uint) strlen(locale->ab_month_names->type_names[l_time->month-1]), system_charset_info); break; case 'W': @@ -658,7 +658,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, weekday= calc_weekday(calc_daynr(l_time->year,l_time->month, l_time->day),0); str->append(locale->day_names->type_names[weekday], - strlen(locale->day_names->type_names[weekday]), + (uint) strlen(locale->day_names->type_names[weekday]), system_charset_info); break; case 'a': @@ -667,13 +667,13 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, weekday=calc_weekday(calc_daynr(l_time->year,l_time->month, l_time->day),0); str->append(locale->ab_day_names->type_names[weekday], - strlen(locale->ab_day_names->type_names[weekday]), + (uint) strlen(locale->ab_day_names->type_names[weekday]), system_charset_info); break; case 'D': if (type == MYSQL_TIMESTAMP_TIME) return 1; - length= int10_to_str(l_time->day, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->day, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 1, '0'); if (l_time->day >= 10 && l_time->day <= 19) str->append(STRING_WITH_LEN("th")); @@ -696,62 +696,62 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, } break; case 'Y': - length= int10_to_str(l_time->year, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->year, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 4, '0'); break; case 'y': - length= int10_to_str(l_time->year%100, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->year%100, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'm': - length= int10_to_str(l_time->month, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->month, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'c': - length= int10_to_str(l_time->month, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->month, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 1, '0'); break; case 'd': - length= int10_to_str(l_time->day, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->day, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'e': - length= int10_to_str(l_time->day, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->day, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 1, '0'); break; case 'f': - length= int10_to_str(l_time->second_part, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->second_part, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 6, '0'); break; case 'H': - length= int10_to_str(l_time->hour, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->hour, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'h': case 'I': hours_i= (l_time->hour%24 + 11)%12+1; - length= int10_to_str(hours_i, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(hours_i, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'i': /* minutes */ - length= int10_to_str(l_time->minute, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->minute, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'j': if (type == MYSQL_TIMESTAMP_TIME) return 1; - length= int10_to_str(calc_daynr(l_time->year,l_time->month, + length= (uint) (int10_to_str(calc_daynr(l_time->year,l_time->month, l_time->day) - - calc_daynr(l_time->year,1,1) + 1, intbuff, 10) - intbuff; + calc_daynr(l_time->year,1,1) + 1, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 3, '0'); break; case 'k': - length= int10_to_str(l_time->hour, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->hour, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 1, '0'); break; case 'l': hours_i= (l_time->hour%24 + 11)%12+1; - length= int10_to_str(hours_i, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(hours_i, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 1, '0'); break; case 'p': @@ -770,7 +770,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, break; case 'S': case 's': - length= int10_to_str(l_time->second, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->second, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'T': @@ -788,11 +788,11 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, uint year; if (type == MYSQL_TIMESTAMP_TIME) return 1; - length= int10_to_str(calc_week(l_time, + length= (uint) (int10_to_str(calc_week(l_time, (*ptr) == 'U' ? WEEK_FIRST_WEEKDAY : WEEK_MONDAY_FIRST, &year), - intbuff, 10) - intbuff; + intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); } break; @@ -802,12 +802,12 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, uint year; if (type == MYSQL_TIMESTAMP_TIME) return 1; - length= int10_to_str(calc_week(l_time, + length= (uint) (int10_to_str(calc_week(l_time, ((*ptr) == 'V' ? (WEEK_YEAR | WEEK_FIRST_WEEKDAY) : (WEEK_YEAR | WEEK_MONDAY_FIRST)), &year), - intbuff, 10) - intbuff; + intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); } break; @@ -822,7 +822,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, WEEK_YEAR | WEEK_FIRST_WEEKDAY : WEEK_YEAR | WEEK_MONDAY_FIRST), &year); - length= int10_to_str(year, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(year, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 4, '0'); } break; @@ -831,7 +831,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, return 1; weekday=calc_weekday(calc_daynr(l_time->year,l_time->month, l_time->day),1); - length= int10_to_str(weekday, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(weekday, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 1, '0'); break; @@ -881,7 +881,7 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs, value= value*LL(10) + (longlong) (*str - '0'); if (transform_msec && i == count - 1) // microseconds always last { - long msec_length= 6 - (str - start); + long msec_length= 6 - (uint) (str - start); if (msec_length > 0) value*= (long) log_10_int[msec_length]; } @@ -1060,7 +1060,7 @@ String* Item_func_monthname::val_str(String* str) } null_value=0; month_name= locale->month_names->type_names[month-1]; - str->copy(month_name, strlen(month_name), &my_charset_utf8_bin, + str->copy(month_name, (uint) strlen(month_name), &my_charset_utf8_bin, collation.collation, &err); return str; } @@ -1210,7 +1210,7 @@ String* Item_func_dayname::val_str(String* str) return (String*) 0; day_name= locale->day_names->type_names[weekday]; - str->copy(day_name, strlen(day_name), &my_charset_utf8_bin, + str->copy(day_name, (uint) strlen(day_name), &my_charset_utf8_bin, collation.collation, &err); return str; } @@ -3176,14 +3176,14 @@ String *Item_func_get_format::val_str(String *str) format++) { uint format_name_len; - format_name_len= strlen(format_name); + format_name_len= (uint) strlen(format_name); if (val_len == format_name_len && !my_strnncoll(&my_charset_latin1, (const uchar *) val->ptr(), val_len, (const uchar *) format_name, val_len)) { const char *format_str= get_date_time_format_str(format, type); - str->set(format_str, strlen(format_str), &my_charset_bin); + str->set(format_str, (uint) strlen(format_str), &my_charset_bin); return str; } } diff --git a/sql/lock.cc b/sql/lock.cc index f36e8d605d3..322778b89c3 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -461,7 +461,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock) for (i= 0; i < sql_lock->table_count; i++) { TABLE *tbl= *table; - tbl->lock_position= table - sql_lock->table; + tbl->lock_position= (uint) (table - sql_lock->table); tbl->lock_data_start= found; found+= tbl->lock_count; table++; @@ -862,7 +862,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, { my_error(ER_OPEN_AS_READONLY,MYF(0),table->alias); /* Clear the lock type of the lock data that are stored already. */ - sql_lock->lock_count= locks - sql_lock->locks; + sql_lock->lock_count= (uint) (locks - sql_lock->locks); reset_lock_data(sql_lock); my_free((uchar*) sql_lock,MYF(0)); DBUG_RETURN(0); diff --git a/sql/log_event.cc b/sql/log_event.cc index 0e400ac2705..35797b2cfdb 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1280,7 +1280,7 @@ void Log_event::print_header(IO_CACHE* file, char emit_buf[256]; // Enough for storing one line my_b_printf(file, "# Position Timestamp Type Master ID " "Size Master Pos Flags \n"); - int const bytes_written= + size_t const bytes_written= my_snprintf(emit_buf, sizeof(emit_buf), "# %8.8lx %02x %02x %02x %02x %02x " "%02x %02x %02x %02x %02x %02x %02x %02x " @@ -1315,7 +1315,7 @@ void Log_event::print_header(IO_CACHE* file, TODO: Rewrite my_b_printf() to support full printf() syntax. */ char emit_buf[256]; - int const bytes_written= + size_t const bytes_written= my_snprintf(emit_buf, sizeof(emit_buf), "# %8.8lx %-48.48s |%16s|\n", (unsigned long) (hexdump_from + (i & 0xfffffff0)), @@ -1335,7 +1335,7 @@ void Log_event::print_header(IO_CACHE* file, if (hex_string[0]) { char emit_buf[256]; - int const bytes_written= + size_t const bytes_written= my_snprintf(emit_buf, sizeof(emit_buf), "# %8.8lx %-48.48s |%s|\n", (unsigned long) (hexdump_from + (i & 0xfffffff0)), @@ -1628,7 +1628,7 @@ beg: case MYSQL_TYPE_DATETIME: { - uint d, t; + size_t d, t; uint64 i64= uint8korr(ptr); /* YYYYMMDDhhmmss */ d= i64 / 1000000; t= i64 % 1000000; @@ -4198,7 +4198,7 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len, table_name = fields + field_block_len; db = table_name + table_name_len + 1; fname = db + db_len + 1; - fname_len = strlen(fname); + fname_len = (uint) strlen(fname); // null termination is accomplished by the caller doing buf[event_len]=0 DBUG_RETURN(0); @@ -5697,7 +5697,7 @@ void Slave_log_event::init_from_mem_pool(int data_size) master_pos = uint8korr(mem_pool + SL_MASTER_POS_OFFSET); master_port = uint2korr(mem_pool + SL_MASTER_PORT_OFFSET); master_host = mem_pool + SL_MASTER_HOST_OFFSET; - master_host_len = strlen(master_host); + master_host_len = (uint) strlen(master_host); // safety master_log = master_host + master_host_len + 1; if (master_log > mem_pool + data_size) @@ -5705,7 +5705,7 @@ void Slave_log_event::init_from_mem_pool(int data_size) master_host = 0; return; } - master_log_len = strlen(master_log); + master_log_len = (uint) strlen(master_log); } @@ -6995,12 +6995,12 @@ int Rows_log_event::get_data_size() (m_rows_cur - m_rows_buf);); int data_size= ROWS_HEADER_LEN; data_size+= no_bytes_in_map(&m_cols); - data_size+= end - buf; + data_size+= (uint) (end - buf); if (type_code == UPDATE_ROWS_EVENT) data_size+= no_bytes_in_map(&m_cols_ai); - data_size+= (m_rows_cur - m_rows_buf); + data_size+= (uint) (m_rows_cur - m_rows_buf); return data_size; } @@ -7893,7 +7893,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len, memcpy(m_coltype, ptr_after_colcnt, m_colcnt); ptr_after_colcnt= ptr_after_colcnt + m_colcnt; - bytes_read= ptr_after_colcnt - (uchar *)buf; + bytes_read= (uint) (ptr_after_colcnt - (uchar *)buf); DBUG_PRINT("info", ("Bytes read: %d.\n", bytes_read)); if (bytes_read < event_len) { @@ -9268,7 +9268,7 @@ bool Incident_log_event::write_data_body(IO_CACHE *file) { DBUG_ENTER("Incident_log_event::write_data_body"); - DBUG_RETURN(write_str(file, m_message.str, m_message.length)); + DBUG_RETURN(write_str(file, m_message.str, (uint) m_message.length)); } diff --git a/sql/log_event.h b/sql/log_event.h index 1d11d7e2d5f..8f8fde4c9db 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -3314,7 +3314,7 @@ public: virtual Log_event_type get_type_code() { return TABLE_MAP_EVENT; } virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ } - virtual int get_data_size() { return m_data_size; } + virtual int get_data_size() { return (uint) m_data_size; } #ifndef MYSQL_CLIENT virtual int save_field_metadata(); virtual bool write_data_header(IO_CACHE *file); @@ -3897,7 +3897,7 @@ public: return m_incident > INCIDENT_NONE && m_incident < INCIDENT_COUNT; } virtual int get_data_size() { - return INCIDENT_HEADER_LEN + 1 + m_message.length; + return INCIDENT_HEADER_LEN + 1 + (uint) m_message.length; } private: diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index 75aa8722aa9..68cd2bf4673 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -1382,9 +1382,9 @@ int Old_rows_log_event::get_data_size() (m_rows_cur - m_rows_buf);); int data_size= ROWS_HEADER_LEN; data_size+= no_bytes_in_map(&m_cols); - data_size+= end - buf; + data_size+= (uint) (end - buf); - data_size+= (m_rows_cur - m_rows_buf); + data_size+= (uint) (m_rows_cur - m_rows_buf); return data_size; } diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 1098e8e6832..0a8720bae64 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -249,7 +249,7 @@ static int net_data_is_ready(my_socket sd) tv.tv_sec= tv.tv_usec= 0; - if ((res= select(sd+1, &sfds, NULL, NULL, &tv)) < 0) + if ((res= select((int) (sd + 1), &sfds, NULL, NULL, &tv)) < 0) return 0; else return test(res ? FD_ISSET(sd, &sfds) : 0); @@ -429,7 +429,7 @@ net_write_command(NET *net,uchar command, const uchar *header, size_t head_len, const uchar *packet, size_t len) { - ulong length=len+1+head_len; /* 1 extra byte for command */ + size_t length=len+1+head_len; /* 1 extra byte for command */ uchar buff[NET_HEADER_SIZE+1]; uint header_size=NET_HEADER_SIZE+1; DBUG_ENTER("net_write_command"); @@ -495,7 +495,7 @@ net_write_buff(NET *net, const uchar *packet, ulong len) { ulong left_length; if (net->compress && net->max_packet > MAX_PACKET_LENGTH) - left_length= MAX_PACKET_LENGTH - (net->write_pos - net->buff); + left_length= (ulong) (MAX_PACKET_LENGTH - (net->write_pos - net->buff)); else left_length= (ulong) (net->buff_end - net->write_pos); diff --git a/sql/sp_head.h b/sql/sp_head.h index 3d7597e2402..c17b67f962a 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -367,7 +367,7 @@ public: char *name(uint *lenp = 0) const { if (lenp) - *lenp= m_name.length; + *lenp= (uint) m_name.length; return m_name.str; } diff --git a/sql/spatial.h b/sql/spatial.h index 69a1f24506e..dbf5da6665b 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -281,7 +281,7 @@ public: uint32 len, String *res); int as_wkt(String *wkt, const char **end) { - uint32 len= get_class_info()->m_name.length; + uint32 len= (uint) get_class_info()->m_name.length; if (wkt->reserve(len + 2, 512)) return 1; wkt->qs_append(get_class_info()->m_name.str, len); diff --git a/sql/sql_class.h b/sql/sql_class.h index 3439e5b4f74..34c9a193f16 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -664,7 +664,7 @@ public: */ char *db; - uint db_length; + size_t db_length; public: diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index d9fb586eb77..e4d7cf6feb5 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -54,7 +54,7 @@ static int get_or_create_user_conn(THD *thd, const char *user, USER_RESOURCES *mqh) { int return_val= 0; - uint temp_len, user_len; + size_t temp_len, user_len; char temp_user[USER_HOST_BUFF_SIZE]; struct user_conn *uc; diff --git a/sql/sql_crypt.cc b/sql/sql_crypt.cc index ebd424f00f0..aa21d429d90 100644 --- a/sql/sql_crypt.cc +++ b/sql/sql_crypt.cc @@ -31,7 +31,7 @@ SQL_CRYPT::SQL_CRYPT(const char *password) { ulong rand_nr[2]; - hash_password(rand_nr,password, strlen(password)); + hash_password(rand_nr,password, (uint) strlen(password)); crypt_init(rand_nr); } diff --git a/sql/sql_error.cc b/sql/sql_error.cc index bd8f9469571..9ea7facbe41 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -251,7 +251,7 @@ bool mysqld_show_warnings(THD *thd, ulong levels_to_show) protocol->store(warning_level_names[err->level].str, warning_level_names[err->level].length, system_charset_info); protocol->store((uint32) err->code); - protocol->store(err->msg, strlen(err->msg), system_charset_info); + protocol->store(err->msg, (uint) strlen(err->msg), system_charset_info); if (protocol->write()) DBUG_RETURN(TRUE); } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index fcf86edeaa9..84f0f2bd0d3 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1893,7 +1893,7 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list) pthread_mutex_lock(&LOCK_thread_count); thread_count++; pthread_mutex_unlock(&LOCK_thread_count); - di->thd.set_db(table_list->db, strlen(table_list->db)); + di->thd.set_db(table_list->db, (uint) strlen(table_list->db)); di->thd.query= my_strdup(table_list->table_name, MYF(MY_WME)); if (di->thd.db == NULL || di->thd.query == NULL) { diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 9619d26893c..8899acd37ec 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -253,7 +253,7 @@ void Lex_input_stream::body_utf8_append_literal(THD *thd, { thd->convert_string(&utf_txt, &my_charset_utf8_general_ci, - txt->str, txt->length, + txt->str, (uint) txt->length, txt_cs); } else @@ -435,7 +435,7 @@ bool is_keyword(const char *name, uint len) bool is_lex_native_function(const LEX_STRING *name) { DBUG_ASSERT(name != NULL); - return (get_hash_symbol(name->str, name->length, 1) != 0); + return (get_hash_symbol(name->str, (uint) name->length, 1) != 0); } /* make a copy of token before ptr and set yytoklen */ @@ -1074,7 +1074,7 @@ int MYSQLlex(void *arg, void *yythd) if (c != '.') { // Found complete integer number. yylval->lex_str=get_token(lip, 0, lip->yyLength()); - return int_token(yylval->lex_str.str,yylval->lex_str.length); + return int_token(yylval->lex_str.str, (uint) yylval->lex_str.length); } // fall through case MY_LEX_REAL: // Incomplete real number @@ -1977,8 +1977,8 @@ void st_select_lex::print_order(String *str, if (order->counter_used) { char buffer[20]; - uint length= my_snprintf(buffer, 20, "%d", order->counter); - str->append(buffer, length); + size_t length= my_snprintf(buffer, 20, "%d", order->counter); + str->append(buffer, (uint) length); } else (*order->item)->print(str, query_type); diff --git a/sql/sql_lex.h b/sql/sql_lex.h index ed6b9e7d8df..0eefe031c8d 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1361,7 +1361,7 @@ public: /** Get the utf8-body length. */ uint get_body_utf8_length() { - return m_body_utf8_ptr - m_body_utf8; + return (uint) (m_body_utf8_ptr - m_body_utf8); } void body_utf8_start(THD *thd, const char *begin_ptr); diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 239fb1d49f3..a73286d65a1 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -534,8 +534,8 @@ static bool write_execute_load_query_log_event(THD *thd, { Execute_load_query_log_event e(thd, thd->query, thd->query_length, - (char*)thd->lex->fname_start - (char*)thd->query, - (char*)thd->lex->fname_end - (char*)thd->query, + (uint) ((char*)thd->lex->fname_start - (char*)thd->query), + (uint) ((char*)thd->lex->fname_end - (char*)thd->query), (duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE : (ignore ? LOAD_DUP_IGNORE : LOAD_DUP_ERROR), transactional_table, FALSE, killed_err_arg); diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 7fcc374e3f3..cd11b6d4c24 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -759,13 +759,13 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array, Item_param *param= *it; if (param->state != Item_param::LONG_DATA_VALUE) { - if (is_param_null(null_array, it - begin)) + if (is_param_null(null_array, (uint) (it - begin))) param->set_null(); else { if (read_pos >= data_end) DBUG_RETURN(1); - param->set_param_func(param, &read_pos, data_end - read_pos); + param->set_param_func(param, &read_pos, (uint) (data_end - read_pos)); if (param->state == Item_param::NO_VALUE) DBUG_RETURN(1); } @@ -797,13 +797,13 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array, Item_param *param= *it; if (param->state != Item_param::LONG_DATA_VALUE) { - if (is_param_null(null_array, it - begin)) + if (is_param_null(null_array, (uint) (it - begin))) param->set_null(); else { if (read_pos >= data_end) DBUG_RETURN(1); - param->set_param_func(param, &read_pos, data_end - read_pos); + param->set_param_func(param, &read_pos, (uint) (data_end - read_pos)); if (param->state == Item_param::NO_VALUE) DBUG_RETURN(1); } diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index cb5b3722559..8c9b147089f 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -119,7 +119,7 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table) if (field) { field->set_name(field_info->old_name, - strlen(field_info->old_name), + (uint) strlen(field_info->old_name), system_charset_info); if (add_item_to_list(thd, field)) return 1; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 81db5469891..6285a2dfb55 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -205,7 +205,7 @@ void adjust_linfo_offsets(my_off_t purge_offset) bool log_in_use(const char* log_name) { - int log_name_len = strlen(log_name) + 1; + size_t log_name_len = strlen(log_name) + 1; THD *tmp; bool result = 0; @@ -1366,8 +1366,8 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1, const char* log_file_name2, ulonglong log_pos2) { int res; - uint log_file_name1_len= strlen(log_file_name1); - uint log_file_name2_len= strlen(log_file_name2); + size_t log_file_name1_len= strlen(log_file_name1); + size_t log_file_name2_len= strlen(log_file_name2); // We assume that both log names match up to '.' if (log_file_name1_len == log_file_name2_len) @@ -1687,7 +1687,7 @@ int log_loaded_block(IO_CACHE* file) lf_info->last_pos_in_file >= my_b_get_pos_in_file(file)) DBUG_RETURN(0); - for (block_len= my_b_get_bytes_in_buffer(file); block_len > 0; + for (block_len= (uint) (my_b_get_bytes_in_buffer(file)); block_len > 0; buffer += min(block_len, max_event_size), block_len -= min(block_len, max_event_size)) { diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc index 13bed8001a3..b1c856c87aa 100644 --- a/sql/sql_servers.cc +++ b/sql/sql_servers.cc @@ -60,7 +60,7 @@ prepare_server_struct_for_insert(LEX_SERVER_OPTIONS *server_options); /* drop functions */ static int delete_server_record(TABLE *table, char *server_name, - int server_name_length); + size_t server_name_length); static int delete_server_record_in_cache(LEX_SERVER_OPTIONS *server_options); /* update functions */ @@ -301,7 +301,7 @@ get_server_from_table_to_cache(TABLE *table) /* get each field into the server struct ptr */ server->server_name= get_field(&mem, table->field[0]); - server->server_name_length= strlen(server->server_name); + server->server_name_length= (uint) strlen(server->server_name); ptr= get_field(&mem, table->field[1]); server->host= ptr ? ptr : blank; ptr= get_field(&mem, table->field[2]); @@ -911,7 +911,7 @@ end: static int delete_server_record(TABLE *table, - char *server_name, int server_name_length) + char *server_name, size_t server_name_length) { int error; DBUG_ENTER("delete_server_record"); @@ -1271,7 +1271,7 @@ static FOREIGN_SERVER *clone_server(MEM_ROOT *mem, const FOREIGN_SERVER *server, FOREIGN_SERVER *get_server_by_name(MEM_ROOT *mem, const char *server_name, FOREIGN_SERVER *buff) { - uint server_name_length; + size_t server_name_length; FOREIGN_SERVER *server; DBUG_ENTER("get_server_by_name"); DBUG_PRINT("info", ("server_name %s", server_name)); diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 34b310931d6..9024f98bd92 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -458,7 +458,7 @@ bool String::append(const char *s,uint32 arg_length) bool String::append(const char *s) { - return append(s, strlen(s)); + return append(s, (uint) strlen(s)); } @@ -1051,7 +1051,7 @@ outp: } } *from_end_pos= from; - res= to - to_start; + res= (uint) (to - to_start); } return (uint32) res; } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index aa2a5739f17..94426e914f8 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -84,7 +84,7 @@ static void wait_for_kill_signal(THD *thd) uint filename_to_tablename(const char *from, char *to, uint to_length) { uint errors; - uint res; + size_t res; DBUG_ENTER("filename_to_tablename"); DBUG_PRINT("enter", ("from '%s'", from)); @@ -224,7 +224,7 @@ uint build_table_filename(char *buff, size_t bufflen, const char *db, char *end = buff + bufflen; /* Don't add FN_ROOTDIR if mysql_data_home already includes it */ char *pos = strnmov(buff, mysql_data_home, bufflen); - int rootdir_len= strlen(FN_ROOTDIR); + size_t rootdir_len= strlen(FN_ROOTDIR); if (pos - rootdir_len >= buff && memcmp(pos - rootdir_len, FN_ROOTDIR, rootdir_len) != 0) pos= strnmov(pos, FN_ROOTDIR, end - pos); @@ -273,7 +273,7 @@ uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen) my_casedn_str(files_charset_info, p); } - uint length= unpack_filename(buff, buff); + size_t length= unpack_filename(buff, buff); DBUG_PRINT("exit", ("buff: '%s'", buff)); DBUG_RETURN(length); } @@ -1991,7 +1991,7 @@ void calculate_interval_lengths(CHARSET_INFO *cs, TYPELIB *interval, for (pos= interval->type_names, len= interval->type_lengths; *pos ; pos++, len++) { - uint length= cs->cset->numchars(cs, *pos, *pos + *len); + size_t length= cs->cset->numchars(cs, *pos, *pos + *len); *tot_length+= length; set_if_bigger(*max_length, (uint32)length); } @@ -2320,7 +2320,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, DBUG_ASSERT(comma_length > 0); for (uint i= 0; (tmp= int_it++); i++) { - uint lengthsp; + size_t lengthsp; if (String::needs_conversion(tmp->length(), tmp->charset(), cs, &dummy)) { @@ -4236,7 +4236,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, (!(alter_info->flags & ALTER_ALL_PARTITION))) { char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE]; - uint length; + size_t length; DBUG_PRINT("admin", ("sending non existent partition error")); protocol->prepare_for_resend(); protocol->store(table_name, system_charset_info); @@ -4318,7 +4318,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, { /* purecov: begin inspected */ char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE]; - uint length; + size_t length; DBUG_PRINT("admin", ("sending error message")); protocol->prepare_for_resend(); protocol->store(table_name, system_charset_info); @@ -4436,7 +4436,7 @@ send_result_message: case HA_ADMIN_NOT_IMPLEMENTED: { char buf[MYSQL_ERRMSG_SIZE]; - uint length=my_snprintf(buf, sizeof(buf), + size_t length=my_snprintf(buf, sizeof(buf), ER(ER_CHECK_NOT_IMPLEMENTED), operator_name); protocol->store(STRING_WITH_LEN("note"), system_charset_info); protocol->store(buf, length, system_charset_info); @@ -4446,7 +4446,7 @@ send_result_message: case HA_ADMIN_NOT_BASE_TABLE: { char buf[MYSQL_ERRMSG_SIZE]; - uint length= my_snprintf(buf, sizeof(buf), + size_t length= my_snprintf(buf, sizeof(buf), ER(ER_BAD_TABLE_ERROR), table_name); protocol->store(STRING_WITH_LEN("note"), system_charset_info); protocol->store(buf, length, system_charset_info); @@ -4574,7 +4574,7 @@ send_result_message: case HA_ADMIN_NEEDS_ALTER: { char buf[MYSQL_ERRMSG_SIZE]; - uint length; + size_t length; protocol->store(STRING_WITH_LEN("error"), system_charset_info); length=my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_UPGRADE), @@ -4587,7 +4587,7 @@ send_result_message: default: // Probably HA_ADMIN_INTERNAL_ERROR { char buf[MYSQL_ERRMSG_SIZE]; - uint length=my_snprintf(buf, sizeof(buf), + size_t length=my_snprintf(buf, sizeof(buf), "Unknown - internal error %d during operation", result_code); protocol->store(STRING_WITH_LEN("error"), system_charset_info); diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 108d5095691..8cab8fff2f3 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1728,7 +1728,7 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd, List_iterator_fast<LEX_STRING> it_def(definitions_list); List_iterator_fast<LEX_STRING> it_on_table_name(on_table_names_list); List_iterator_fast<ulonglong> it_mode(definition_modes_list); - uint on_q_table_name_len, before_on_len; + size_t on_q_table_name_len, before_on_len; String buff; DBUG_ASSERT(definitions_list.elements == on_table_names_list.elements && diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index ebd183c6803..c60dac42fb8 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -159,7 +159,7 @@ void udf_init() DBUG_PRINT("info",("init udf record")); LEX_STRING name; name.str=get_field(&mem, table->field[0]); - name.length = strlen(name.str); + name.length = (uint) strlen(name.str); char *dl_name= get_field(&mem, table->field[2]); bool new_dl=0; Item_udftype udftype=UDFTYPE_FUNCTION; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index be66f7c2d80..fa71dd860f8 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -61,7 +61,7 @@ static void make_unique_view_field_name(Item *target, char *name= (target->orig_name ? target->orig_name : target->name); - uint name_len, attempt; + size_t name_len, attempt; char buff[NAME_LEN+1]; List_iterator_fast<Item> itc(item_list); @@ -545,7 +545,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, } while ((item= it++, name= nm++)) { - item->set_name(name->str, name->length, system_charset_info); + item->set_name(name->str, (uint) name->length, system_charset_info); item->is_autogenerated_name= FALSE; } } @@ -1672,7 +1672,7 @@ frm_type_enum mysql_frm_type(THD *thd, char *path, enum legacy_db_type *dbt) { File file; uchar header[10]; //"TYPE=VIEW\n" it is 10 characters - int error; + size_t error; DBUG_ENTER("mysql_frm_type"); *dbt= DB_TYPE_UNKNOWN; diff --git a/sql/udf_example.c b/sql/udf_example.c index a3d149f0971..30d85d95034 100644 --- a/sql/udf_example.c +++ b/sql/udf_example.c @@ -1099,7 +1099,7 @@ char * is_const(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)), sprintf(result, "not const"); } *is_null= 0; - *length= strlen(result); + *length= (uint) strlen(result); return result; } @@ -1133,7 +1133,7 @@ char * check_const_len(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)), char *is_null, char *error __attribute__((unused))) { strmov(result, initid->ptr); - *length= strlen(result); + *length= (uint) strlen(result); *is_null= 0; return result; } diff --git a/sql/uniques.cc b/sql/uniques.cc index 0394eee9c6d..858bedb04cd 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -130,7 +130,7 @@ static double get_merge_buffers_cost(uint *buff_elems, uint elem_size, total_buf_elems+= *pbuf; *last= total_buf_elems; - int n_buffers= last - first + 1; + size_t n_buffers= last - first + 1; /* Using log2(n)=log(n)/log(2) formula */ return 2*((double)total_buf_elems*elem_size) / IO_SIZE + diff --git a/storage/archive/azio.c b/storage/archive/azio.c index 59fbe2182ee..916dd8ba59d 100644 --- a/storage/archive/azio.c +++ b/storage/archive/azio.c @@ -390,7 +390,7 @@ int destroy (s) Reads the given number of uncompressed bytes from the compressed file. azread returns the number of bytes actually read (0 for end of file). */ -unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, unsigned int len, int *error) +unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, size_t len, int *error) { Bytef *start = (Bytef*)buf; /* starting point for crc computation */ Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */ diff --git a/storage/archive/azlib.h b/storage/archive/azlib.h index 47772b1c4fe..d7abb40b2ae 100644 --- a/storage/archive/azlib.h +++ b/storage/archive/azlib.h @@ -265,7 +265,7 @@ int azdopen(azio_stream *s,File fd, int Flags); */ -extern unsigned int azread ( azio_stream *s, voidp buf, unsigned int len, int *error); +extern unsigned int azread ( azio_stream *s, voidp buf, size_t len, int *error); /* Reads the given number of uncompressed bytes from the compressed file. If the input file was not in gzip format, gzread copies the given number diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 368ce7e28f3..1b623c18371 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -553,7 +553,7 @@ int ha_tina::chain_append() /* We set up for the next position */ if ((off_t)(chain_ptr - chain) == (chain_size -1)) { - off_t location= chain_ptr - chain; + my_off_t location= chain_ptr - chain; chain_size += DEFAULT_CHAIN_LENGTH; if (chain_alloced) { diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index 5b4381396fc..dc00ce214c9 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -63,7 +63,7 @@ class ha_tina: public handler TINA_SHARE *share; /* Shared lock info */ off_t current_position; /* Current position in the file during a file scan */ off_t next_position; /* Next position in the file scan */ - off_t local_saved_data_file_length; /* save position for reads */ + my_off_t local_saved_data_file_length; /* save position for reads */ off_t temp_file_length; uchar byte_buffer[IO_SIZE]; Transparent_file *file_buff; diff --git a/storage/csv/transparent_file.h b/storage/csv/transparent_file.h index 4c0f4cce7e7..29da06d5ab7 100644 --- a/storage/csv/transparent_file.h +++ b/storage/csv/transparent_file.h @@ -24,7 +24,7 @@ class Transparent_file uchar *buff; /* in-memory window to the file or mmaped area */ /* current window sizes */ off_t lower_bound; - off_t upper_bound; + my_off_t upper_bound; uint buff_size; public: diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 6cfbd355c40..1f4e1ae48b9 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -505,7 +505,7 @@ int federated_done(void *p) in sql_show.cc except that quoting always occurs. */ -static bool append_ident(String *string, const char *name, uint length, +static bool append_ident(String *string, const char *name, size_t length, const char quote_char) { bool result; @@ -515,7 +515,7 @@ static bool append_ident(String *string, const char *name, uint length, if (quote_char) { - string->reserve(length * 2 + 2); + string->reserve((uint) length * 2 + 2); if ((result= string->append("e_char, 1, system_charset_info))) goto err; @@ -533,7 +533,7 @@ static bool append_ident(String *string, const char *name, uint length, result= string->append("e_char, 1, system_charset_info); } else - result= string->append(name, length, system_charset_info); + result= string->append(name, (uint) length, system_charset_info); err: DBUG_RETURN(result); @@ -543,7 +543,7 @@ err: static int parse_url_error(FEDERATED_SHARE *share, TABLE *table, int error_num) { char buf[FEDERATED_QUERY_BUFFER_SIZE]; - int buf_len; + size_t buf_len; DBUG_ENTER("ha_federated parse_url_error"); buf_len= min(table->s->connect_string.length, @@ -721,7 +721,7 @@ static int parse_url(MEM_ROOT *mem_root, FEDERATED_SHARE *share, TABLE *table, { share->connection_string[share->table_name - share->connection_string]= '\0'; share->table_name++; - share->table_name_length= strlen(share->table_name); + share->table_name_length= (uint) strlen(share->table_name); DBUG_PRINT("info", ("internal format, parsed table_name share->connection_string \ @@ -1489,7 +1489,7 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table) pthread_mutex_lock(&federated_mutex); tmp_share.share_key= table_name; - tmp_share.share_key_length= strlen(table_name); + tmp_share.share_key_length= (uint) strlen(table_name); if (parse_url(&mem_root, &tmp_share, table, 0)) goto error; @@ -2161,7 +2161,7 @@ int ha_federated::update_row(const uchar *old_data, uchar *new_data) { if (bitmap_is_set(table->write_set, (*field)->field_index)) { - uint field_name_length= strlen((*field)->field_name); + size_t field_name_length= strlen((*field)->field_name); append_ident(&update_string, (*field)->field_name, field_name_length, ident_quote_char); update_string.append(STRING_WITH_LEN(" = ")); @@ -2187,7 +2187,7 @@ int ha_federated::update_row(const uchar *old_data, uchar *new_data) if (bitmap_is_set(table->read_set, (*field)->field_index)) { - uint field_name_length= strlen((*field)->field_name); + size_t field_name_length= strlen((*field)->field_name); append_ident(&where_string, (*field)->field_name, field_name_length, ident_quote_char); if (field_in_record_is_null(table, *field, (char*) old_data)) @@ -3158,7 +3158,7 @@ int ha_federated::real_connect() } -int ha_federated::real_query(const char *query, uint length) +int ha_federated::real_query(const char *query, size_t length) { int rc= 0; DBUG_ENTER("ha_federated::real_query"); @@ -3169,7 +3169,7 @@ int ha_federated::real_query(const char *query, uint length) if (!query || !length) goto end; - rc= mysql_real_query(mysql, query, length); + rc= mysql_real_query(mysql, query, (uint) length); end: DBUG_RETURN(rc); diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h index 1974f9936fc..2f1c62decca 100644 --- a/storage/federated/ha_federated.h +++ b/storage/federated/ha_federated.h @@ -70,7 +70,7 @@ typedef struct st_federated_share { int share_key_length; ushort port; - uint table_name_length, server_name_length, connect_string_length, use_count; + size_t table_name_length, server_name_length, connect_string_length, use_count; pthread_mutex_t mutex; THR_LOCK lock; } FEDERATED_SHARE; @@ -113,7 +113,7 @@ private: uint key_len, ha_rkey_function find_flag, MYSQL_RES **result); - int real_query(const char *query, uint length); + int real_query(const char *query, size_t length); int real_connect(); public: ha_federated(handlerton *hton, TABLE_SHARE *table_arg); diff --git a/storage/heap/hp_write.c b/storage/heap/hp_write.c index 2abef2d9b43..c3dff67d3d5 100644 --- a/storage/heap/hp_write.c +++ b/storage/heap/hp_write.c @@ -69,7 +69,7 @@ int heap_write(HP_INFO *info, const uchar *record) err: if (my_errno == HA_ERR_FOUND_DUPP_KEY) DBUG_PRINT("info",("Duplicate key: %d", (int) (keydef - share->keydef))); - info->errkey= keydef - share->keydef; + info->errkey= (int) (keydef - share->keydef); /* We don't need to delete non-inserted key from rb-tree. Also, if we got ENOMEM, the key wasn't inserted, so don't try to delete it diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 50c3917c43c..52eb45871ac 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6506,7 +6506,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) f_key_info.referenced_key_name = thd_make_lex_string( thd, f_key_info.referenced_key_name, foreign->referenced_index->name, - strlen(foreign->referenced_index->name), 1); + (uint) strlen(foreign->referenced_index->name), 1); } else f_key_info.referenced_key_name= 0; @@ -7119,7 +7119,7 @@ innodb_show_status( bool result = FALSE; - if (stat_print(thd, innobase_hton_name, strlen(innobase_hton_name), + if (stat_print(thd, innobase_hton_name, (uint) strlen(innobase_hton_name), STRING_WITH_LEN(""), str, flen)) { result= TRUE; } @@ -7149,7 +7149,7 @@ innodb_mutex_show_status( ulint rw_lock_count_os_yield= 0; ulonglong rw_lock_wait_time= 0; #endif /* UNIV_DEBUG */ - uint hton_name_len= strlen(innobase_hton_name), buf1len, buf2len; + uint hton_name_len= (uint) strlen(innobase_hton_name), buf1len, buf2len; DBUG_ENTER("innodb_mutex_show_status"); mutex_enter_noninline(&mutex_list_mutex); @@ -7193,9 +7193,9 @@ innodb_mutex_show_status( rw_lock_wait_time += mutex->lspent_time; } #else /* UNIV_DEBUG */ - buf1len= my_snprintf(buf1, sizeof(buf1), "%s:%lu", + buf1len= (uint) my_snprintf(buf1, sizeof(buf1), "%s:%lu", mutex->cfile_name, (ulong) mutex->cline); - buf2len= my_snprintf(buf2, sizeof(buf2), "os_waits=%lu", + buf2len= (uint) my_snprintf(buf2, sizeof(buf2), "os_waits=%lu", mutex->count_os_wait); if (stat_print(thd, innobase_hton_name, @@ -7708,7 +7708,7 @@ ha_innobase::get_error_message(int error, String *buf) { trx_t* trx = check_trx_exists(ha_thd()); - buf->copy(trx->detailed_error, strlen(trx->detailed_error), + buf->copy(trx->detailed_error, (uint) strlen(trx->detailed_error), system_charset_info); return FALSE; diff --git a/storage/innobase/include/pars0pars.h b/storage/innobase/include/pars0pars.h index 41b788ffa05..1c6c550d313 100644 --- a/storage/innobase/include/pars0pars.h +++ b/storage/innobase/include/pars0pars.h @@ -684,7 +684,7 @@ struct for_node_struct{ definition */ que_node_t* loop_start_limit;/* initial value of loop variable */ que_node_t* loop_end_limit; /* end value of loop variable */ - int loop_end_value; /* evaluated value for the end value: + lint loop_end_value; /* evaluated value for the end value: it is calculated only when the loop is entered, and will not change within the loop */ diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 4073044bf63..ae39e2188a0 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -62,7 +62,7 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type, { THD* thd = (THD*)param->thd; Protocol *protocol= thd->protocol; - uint length, msg_length; + size_t length, msg_length; char msgbuf[MI_MAX_MSG_BUF]; char name[NAME_LEN*2+2]; @@ -1557,7 +1557,7 @@ bool ha_myisam::check_and_repair(THD *thd) old_query_length= thd->query_length; pthread_mutex_lock(&LOCK_thread_count); thd->query= table->s->table_name.str; - thd->query_length= table->s->table_name.length; + thd->query_length= (uint) table->s->table_name.length; pthread_mutex_unlock(&LOCK_thread_count); if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt)) diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index bdca1a1f0b8..535b4f7f537 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -660,7 +660,7 @@ void mi_collect_stats_nonulls_first(HA_KEYSEG *keyseg, ulonglong *notnull, uchar *key) { uint first_null, kp; - first_null= ha_find_null(keyseg, key) - keyseg; + first_null= (uint) (ha_find_null(keyseg, key) - keyseg); /* All prefix tuples that don't include keypart_{first_null} are not-null tuples (and all others aren't), increment counters for them. @@ -716,7 +716,7 @@ int mi_collect_stats_nonulls_next(HA_KEYSEG *keyseg, ulonglong *notnull, seg= keyseg + diffs[0] - 1; /* Find first NULL in last_key */ - first_null_seg= ha_find_null(seg, last_key + diffs[1]) - keyseg; + first_null_seg= (uint) (ha_find_null(seg, last_key + diffs[1]) - keyseg); for (kp= 0; kp < first_null_seg; kp++) notnull[kp]++; @@ -3952,7 +3952,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a) key_block++; sort_info->key_block=key_block; sort_param->keyinfo=& sort_info->info->s->ft2_keyinfo; - ft_buf->count=(ft_buf->buf - p)/val_len; + ft_buf->count=(uint) (ft_buf->buf - p)/val_len; /* flushing buffer to second-level tree */ for (error=0; !error && p < ft_buf->buf; p+= val_len) diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index 2c4444d67c6..b5260e9c463 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -255,7 +255,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) MYF(MY_HOLD_ON_ERROR)); /* Fix the table addresses in the tree heads. */ { - long diff=PTR_BYTE_DIFF(decode_table,share->decode_tables); + my_ptrdiff_t diff=PTR_BYTE_DIFF(decode_table,share->decode_tables); share->decode_tables=decode_table; for (i=0 ; i < trees ; i++) share->decode_trees[i].table=ADD_TO_PTR(share->decode_trees[i].table, diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c index 89fabfa46d0..1dd6c6b5f0d 100644 --- a/storage/myisam/mi_search.c +++ b/storage/myisam/mi_search.c @@ -409,7 +409,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, } from+=keyseg->length; page=from+nod_flag; - length=from-vseg; + length= (uint) (from - vseg); } if (page > end) diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c index 0b472f4fb0e..e094c302f92 100644 --- a/storage/myisam/rt_index.c +++ b/storage/myisam/rt_index.c @@ -95,7 +95,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag, _mi_kpos(nod_flag, k), level + 1))) { case 0: /* found - exit from recursion */ - *saved_key = k - page_buf; + *saved_key = (uint) (k - page_buf); goto ok; case 1: /* not found - continue searching */ info->rtree_recursion_depth = level; @@ -117,7 +117,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag, info->lastkey_length = k_len + info->s->base.rec_reflength; memcpy(info->lastkey, k, info->lastkey_length); info->rtree_recursion_depth = level; - *saved_key = last - page_buf; + *saved_key = (uint) (last - page_buf); if (after_key < last) { @@ -314,7 +314,7 @@ static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length, _mi_kpos(nod_flag, k), level + 1))) { case 0: /* found - exit from recursion */ - *saved_key = k - page_buf; + *saved_key = (uint) (k - page_buf); goto ok; case 1: /* not found - continue searching */ info->rtree_recursion_depth = level; @@ -333,7 +333,7 @@ static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length, memcpy(info->lastkey, k, info->lastkey_length); info->rtree_recursion_depth = level; - *saved_key = k - page_buf; + *saved_key = (uint) (k - page_buf); if (after_key < last) { @@ -420,7 +420,7 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length) info->lastkey_length = k_len + info->s->base.rec_reflength; memcpy(info->lastkey, key, k_len + info->s->base.rec_reflength); - *(int*)info->int_keypos = key - info->buff; + *(uint*)info->int_keypos = (uint) (key - info->buff); if (after_key >= info->int_maxpos) { info->buff_used = 1; diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 956f0e421cc..dc04699f42b 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -218,7 +218,7 @@ static int myisammrg_parent_open_callback(void *callback_param, TABLE_LIST *child_l; const char *db; const char *table_name; - uint dirlen; + size_t dirlen; char dir_path[FN_REFLEN]; DBUG_ENTER("myisammrg_parent_open_callback"); @@ -961,7 +961,7 @@ THR_LOCK_DATA **ha_myisammrg::store_lock(THD *thd, static void split_file_name(const char *file_name, LEX_STRING *db, LEX_STRING *name) { - uint dir_length, prefix_length; + size_t dir_length, prefix_length; char buff[FN_REFLEN]; db->length= 0; @@ -1034,7 +1034,7 @@ int ha_myisammrg::create(const char *name, register TABLE *form, const char **table_names, **pos; TABLE_LIST *tables= (TABLE_LIST*) create_info->merge_list.first; THD *thd= current_thd; - uint dirlgt= dirname_length(name); + size_t dirlgt= dirname_length(name); DBUG_ENTER("ha_myisammrg::create"); /* Allocate a table_names array in thread mem_root. */ @@ -1093,7 +1093,7 @@ int ha_myisammrg::create(const char *name, register TABLE *form, void ha_myisammrg::append_create_info(String *packet) { const char *current_db; - uint db_length; + size_t db_length; THD *thd= current_thd; MYRG_TABLE *open_table, *first; diff --git a/strings/ctype.c b/strings/ctype.c index 2c0fe09c07b..446eb168804 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -39,7 +39,7 @@ */ -static char *mstr(char *str,const char *src,uint l1,uint l2) +static char *mstr(char *str,const char *src,size_t l1,size_t l2) { l1= l1<l2 ? l1 : l2; memcpy(str,src,l1); @@ -143,7 +143,7 @@ typedef struct my_cs_file_info -static int fill_uchar(uchar *a,uint size,const char *str, uint len) +static int fill_uchar(uchar *a,uint size,const char *str, size_t len) { uint i= 0; const char *s, *b, *e=str+len; diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index a57cc5b5ebe..920022aae91 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -108,7 +108,7 @@ size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) char *par = va_arg(ap, char *); DBUG_ASSERT(to <= end); if (to + abs(width) + 1 > end) - width= end - to - 1; /* sign doesn't matter */ + width= (uint) (end - to - 1); /* sign doesn't matter */ memmove(to, par, abs(width)); to+= width; continue; @@ -176,7 +176,7 @@ size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) size_t my_snprintf(char* to, size_t n, const char* fmt, ...) { - int result; + size_t result; va_list args; va_start(args,fmt); result= my_vsnprintf(to, n, fmt, args); diff --git a/tests/bug25714.c b/tests/bug25714.c index 03d28f59aa4..c0d9fbf7652 100644 --- a/tests/bug25714.c +++ b/tests/bug25714.c @@ -54,14 +54,14 @@ int main (int argc, char **argv) printf("%s\n", mysql_error(&conn)); } - OK = mysql_real_query (&conn, query4, strlen(query4)); + OK = mysql_real_query (&conn, query4, (uint) strlen(query4)); assert(0 == OK); printf("%ld inserted\n", (long) mysql_insert_id(&conn)); - OK = mysql_real_query (&conn, query5, strlen(query5)); + OK = mysql_real_query (&conn, query5, (uint) strlen(query5)); assert(0 == OK); diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 4f30d43f53f..32f2d76ff20 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -262,7 +262,7 @@ static MYSQL_STMT *STDCALL mysql_simple_prepare(MYSQL *mysql_arg, const char *query) { MYSQL_STMT *stmt= mysql_stmt_init(mysql_arg); - if (stmt && mysql_stmt_prepare(stmt, query, strlen(query))) + if (stmt && mysql_stmt_prepare(stmt, query, (uint) strlen(query))) { mysql_stmt_close(stmt); return 0; |