mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
Bug#29125 Windows Server X64: so many compiler warnings
- Remove bothersome warning messages. This change focuses on the warnings that are covered by the ignore file: support-files/compiler_warnings.supp. - Strings are guaranteed to be max uint in length
This commit is contained in:
commit
5b7347bda3
94 changed files with 241 additions and 240 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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)) ||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
11
mysys/hash.c
11
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");
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue