Commit 24ce0838 authored by unknown's avatar unknown

Fixed compiler warnings

Fixed type that caused windows builds to fail


include/my_alloc.h:
  Use size_t for memory areas instead of uint
mysys/mf_iocache.c:
  Fixed compiler warnings by adding casts
mysys/my_compress.c:
  Fixed compiler warnings by adding casts
mysys/my_getsystime.c:
  Fixed typo
mysys/my_static.h:
  Use size_t for memory areas
mysys/safemalloc.c:
  Use size_t for memory areas
storage/maria/ma_bitmap.c:
  Fixed compiler warnings by adding casts
storage/maria/ma_blockrec.c:
  Fixed compiler warnings by adding casts
storage/maria/ma_cache.c:
  Use size_t for memory areas
storage/maria/ma_info.c:
  Use size_t for memory areas
storage/maria/ma_key.c:
  Fixed compiler warnings by adding casts
storage/maria/ma_locking.c:
  Fixed compiler warnings by adding casts
storage/maria/ma_open.c:
  Fixed compiler warnings by adding casts
storage/maria/ma_packrec.c:
  Fixed compiler warnings by fixing type for variable
storage/maria/ma_statrec.c:
  Fixed compiler warnings by adding casts
storage/maria/ma_write.c:
  Fixed compiler warnings by adding casts
storage/maria/maria_def.h:
  Use size_t for memory areas
storage/myisam/mi_search.c:
  Fixed compiler warnings by adding casts
parent 3d4fff18
......@@ -26,8 +26,8 @@
typedef struct st_used_mem
{ /* struct for once_alloc (block) */
struct st_used_mem *next; /* Next block in use */
unsigned int left; /* memory left in block */
unsigned int size; /* size of block */
size_t left; /* memory left in block */
size_t size; /* size of block */
} USED_MEM;
......@@ -39,12 +39,12 @@ typedef struct st_mem_root
/* if block have less memory it will be put in 'used' list */
size_t min_malloc;
size_t block_size; /* initial block size */
unsigned int block_num; /* allocated blocks counter */
unsigned long block_num; /* allocated blocks counter */
/*
first free block in queue test counter (if it exceed
MAX_BLOCK_USAGE_BEFORE_DROP block will be dropped in 'used' list)
*/
unsigned int first_block_usage;
unsigned long first_block_usage;
void (*error_handler)(void);
} MEM_ROOT;
......
......@@ -527,7 +527,7 @@ int _my_b_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
{
if (Count)
{
info->error= left_length; /* We only got this many char */
info->error= (int) left_length; /* We only got this many char */
DBUG_RETURN(1);
}
length=0; /* Didn't read any chars */
......@@ -1255,7 +1255,7 @@ int _my_b_seq_read(register IO_CACHE *info, uchar *Buffer, size_t Count)
info->append_read_pos += copy_len;
Count -= copy_len;
if (Count)
info->error = save_count - Count;
info->error= (int) (save_count - Count);
/* Fill read buffer with data from write buffer */
memcpy(info->buffer, info->append_read_pos,
......@@ -1644,8 +1644,8 @@ int my_block_write(register IO_CACHE *info, const uchar *Buffer, size_t Count,
{
/* Of no overlap, write everything without buffering */
if (pos + Count <= info->pos_in_file)
return my_pwrite(info->file, Buffer, Count, pos,
info->myflags | MY_NABP);
return (int) my_pwrite(info->file, Buffer, Count, pos,
info->myflags | MY_NABP);
/* Write the part of the block that is before buffer */
length= (uint) (info->pos_in_file - pos);
if (my_pwrite(info->file, Buffer, length, pos, info->myflags | MY_NABP))
......
......@@ -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= (uLongf) *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= (uLongf) *complen;
error= uncompress((Bytef*) compbuf, &tmp_complen, (Bytef*) packet,
(uLong) len);
*complen= tmp_complen;
......
......@@ -108,8 +108,8 @@ ulonglong my_micro_time()
if (query_performance_frequency)
{
QueryPerformanceCounter((LARGE_INTEGER*) &newtime);
newtime= ((new_time / query_performance_frequency * 10000000) +
(new_time % query_performance_frequency * 10000000 /
newtime= ((newtime / query_performance_frequency * 10000000) +
(newtime % query_performance_frequency * 10000000 /
query_performance_frequency));
}
else
......@@ -161,8 +161,8 @@ ulonglong my_micro_time_and_time(time_t *time_arg)
if (query_performance_frequency)
{
QueryPerformanceCounter((LARGE_INTEGER*) &newtime);
newtime= ((new_time / query_performance_frequency * 10000000) +
(new_time % query_performance_frequency * 10000000 /
newtime= ((newtime / query_performance_frequency * 10000000) +
(newtime % query_performance_frequency * 10000000 /
query_performance_frequency));
}
else
......@@ -231,4 +231,3 @@ time_t my_time_possible_from_micro(ulonglong microtime __attribute__((unused)))
return (time_t) (microtime / 1000000);
#endif /* defined(__WIN__) */
}
......@@ -44,8 +44,8 @@ struct st_irem
struct st_irem *next; /* Linked list of structures */
struct st_irem *prev; /* Other link */
char *filename; /* File in which memory was new'ed */
size_t datasize; /* Size requested */
uint32 linenum; /* Line number in above file */
uint32 datasize; /* Size requested */
uint32 SpecialValue; /* Underrun marker value */
};
......
......@@ -404,14 +404,16 @@ void TERMINATE(FILE *file, uint flag)
if (file)
{
fprintf(file,
"\t%6u bytes at 0x%09lx, allocated at line %4u in '%s'",
irem->datasize, (long) data, irem->linenum, irem->filename);
"\t%6lu bytes at 0x%09lx, allocated at line %4u in '%s'",
(ulong) irem->datasize, (long) data,
irem->linenum, irem->filename);
fprintf(file, "\n");
(void) fflush(file);
}
DBUG_PRINT("safe",
("%6u bytes at 0x%09lx, allocated at line %4d in '%s'",
irem->datasize, (long) data, irem->linenum, irem->filename));
("%6lu bytes at 0x%09lx, allocated at line %4d in '%s'",
(ulong) irem->datasize, (long) data,
irem->linenum, irem->filename));
irem= irem->next;
}
}
......@@ -445,8 +447,9 @@ void sf_malloc_report_allocated(void *memory)
sf_malloc_prehunc);
if (data <= (char*) memory && (char*) memory <= data + irem->datasize)
{
printf("%u bytes at 0x%lx, allocated at line %u in '%s'\n",
irem->datasize, (long) data, irem->linenum, irem->filename);
printf("%lu bytes at 0x%lx, allocated at line %u in '%s'\n",
(ulong) irem->datasize, (long) data,
irem->linenum, irem->filename);
break;
}
}
......
......@@ -914,7 +914,7 @@ static void fill_block(MARIA_FILE_BITMAP *bitmap,
uchar *data;
/* For each 6 bytes we have 6*8/3= 16 patterns */
page= (best_data - bitmap->map) / 6 * 16 + best_pos;
page= ((uint) (best_data - bitmap->map)) / 6 * 16 + best_pos;
DBUG_ASSERT(page + 1 < bitmap->pages_covered);
block->page= bitmap->page + 1 + page;
block->page_count= TAIL_PAGE_COUNT_MARKER;
......@@ -1171,7 +1171,7 @@ static ulong allocate_full_pages(MARIA_FILE_BITMAP *bitmap,
if ((bits= uint6korr(data)))
break;
}
area_size= (data - data_start) / 6 * 16;
area_size= (uint) (data - data_start) / 6 * 16;
if (area_size >= best_area_size)
continue;
prefix_area_size= suffix_area_size= 0;
......@@ -1182,7 +1182,7 @@ static ulong allocate_full_pages(MARIA_FILE_BITMAP *bitmap,
This is needed because bitmap->used_size only covers the set bits
in the bitmap.
*/
area_size+= (page_end - data) / 6 * 16;
area_size+= (uint) (page_end - data) / 6 * 16;
if (area_size >= best_area_size)
break;
data= page_end;
......@@ -1239,7 +1239,7 @@ static ulong allocate_full_pages(MARIA_FILE_BITMAP *bitmap,
best_area_size= pages_needed;
/* For each 6 bytes we have 6*8/3= 16 patterns */
page= ((best_data - bitmap->map) * 8) / 3 + best_prefix_area_size;
page= ((uint) (best_data - bitmap->map) * 8) / 3 + best_prefix_area_size;
block->page= bitmap->page + 1 + page;
block->page_count= best_area_size;
block->empty_space= 0;
......
......@@ -1205,7 +1205,7 @@ static void calc_record_size(MARIA_HA *info, const uchar *record,
}
else
{
uint length= (end - pos);
uint length= (uint) (end - pos);
if (column->length <= 255)
*field_length_data++= (uchar) length;
else
......@@ -2232,7 +2232,7 @@ static my_bool free_full_pages(MARIA_HA *info, MARIA_ROW *row)
my_afree(compact_extent_info);
DBUG_RETURN(0);
}
extents_count= extents_length / ROW_EXTENT_SIZE;
extents_count= (uint) (extents_length / ROW_EXTENT_SIZE);
pagerange_store(log_data + FILEID_STORE_SIZE, extents_count);
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= (char*) log_data;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data);
......@@ -2651,7 +2651,7 @@ static my_bool write_block_record(MARIA_HA *info,
MARIA_BITMAP_BLOCK *cur_block, *end_block, *last_head_block;
MARIA_BITMAP_BLOCK *head_tail_block= 0;
ulong length;
ulong data_length= (tmp_data - info->rec_buff);
ulong data_length= (ulong) (tmp_data - info->rec_buff);
#ifdef SANITY_CHECKS
DBUG_ASSERT(head_block->sub_blocks != 1);
......@@ -2779,7 +2779,7 @@ static my_bool write_block_record(MARIA_HA *info,
head_block+1, bitmap_blocks->count - 1);
if (head_tail_block)
{
ulong block_length= (tmp_data - info->rec_buff);
ulong block_length= (ulong) (tmp_data - info->rec_buff);
uchar *extent_data;
length= (uint) (block_length % FULL_PAGE_SIZE(block_size));
......@@ -5349,7 +5349,7 @@ static size_t fill_insert_undo_parts(MARIA_HA *info, const uchar *record,
log_parts++;
}
}
*log_parts_count= (log_parts - start_log_parts);
*log_parts_count= (uint) (log_parts - start_log_parts);
DBUG_RETURN(row_length);
}
......@@ -5544,8 +5544,8 @@ static size_t fill_update_undo_parts(MARIA_HA *info, const uchar *oldrec,
memcmp(old_column_pos, new_column_pos, new_column_length))
{
field_data= ma_store_length(field_data,
(uint) (column - share->columndef));
field_data= ma_store_length(field_data, old_column_length);
(ulong) (column - share->columndef));
field_data= ma_store_length(field_data, (ulong) old_column_length);
log_parts->str= (char*) old_column_pos;
log_parts->length= old_column_length;
......@@ -5554,10 +5554,10 @@ static size_t fill_update_undo_parts(MARIA_HA *info, const uchar *oldrec,
}
}
*log_parts_count= (log_parts - start_log_parts);
*log_parts_count= (uint) (log_parts - start_log_parts);
/* Store length of field length data before the field/field_lengths */
field_lengths= (field_data - start_field_data);
field_lengths= (uint) (field_data - start_field_data);
start_log_parts->str= ((char*)
(start_field_data -
ma_calc_length_for_store_length(field_lengths)));
......@@ -5886,7 +5886,7 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn,
goto crashed_file;
}
if (extend_area_on_page(buff, dir, rownr, block_size,
data_length, &empty_space,
(uint) data_length, &empty_space,
&rec_offset, &length))
goto crashed_file;
}
......@@ -5894,7 +5894,7 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn,
/* Copy data */
int2store(dir+2, data_length);
memcpy(buff + rec_offset, data, data_length);
empty_space-= data_length;
empty_space-= (uint) data_length;
int2store(buff + EMPTY_SPACE_OFFSET, empty_space);
/*
......
......@@ -35,10 +35,10 @@
#include "maria_def.h"
int _ma_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos, uint length,
int flag)
my_bool _ma_read_cache(IO_CACHE *info, uchar *buff, my_off_t pos,
size_t length, uint flag)
{
uint read_length,in_buff_length;
size_t read_length,in_buff_length;
my_off_t offset;
uchar *in_buff_pos;
DBUG_ENTER("_ma_read_cache");
......
......@@ -120,14 +120,14 @@ int maria_status(MARIA_HA *info, register MARIA_INFO *x, uint flag)
void _ma_report_error(int errcode, const char *file_name)
{
uint length;
size_t length;
DBUG_ENTER("_ma_report_error");
DBUG_PRINT("enter",("errcode %d, table '%s'", errcode, file_name));
if ((length= strlen(file_name)) > 64)
{
/* we first remove the directory */
uint dir_length= dirname_length(file_name);
size_t dir_length= dirname_length(file_name);
file_name+= dir_length;
if ((length-= dir_length) > 64)
{
......
......@@ -27,7 +27,7 @@
#define FIX_LENGTH(cs, pos, length, char_length) \
do { \
if (length > char_length) \
char_length= my_charpos(cs, pos, pos+length, char_length); \
char_length= (uint) my_charpos(cs, pos, pos+length, char_length); \
set_if_smaller(char_length,length); \
} while(0)
......@@ -108,7 +108,7 @@ uint _ma_make_key(register MARIA_HA *info, uint keynr, uchar *key,
{
if (type != HA_KEYTYPE_NUM)
{
length= cs->cset->lengthsp(cs, (char*) pos, length);
length= (uint) cs->cset->lengthsp(cs, (char*) pos, length);
}
else
{
......
......@@ -593,10 +593,10 @@ int _ma_decrement_open_count(MARIA_HA *info)
if (!(share->temporary | share->base.born_transactional))
{
mi_int2store(buff,share->state.open_count);
write_error= my_pwrite(share->kfile.file, buff, sizeof(buff),
sizeof(share->state.header) +
MARIA_FILE_OPEN_COUNT_OFFSET,
MYF(MY_NABP));
write_error= (int) my_pwrite(share->kfile.file, buff, sizeof(buff),
sizeof(share->state.header) +
MARIA_FILE_OPEN_COUNT_OFFSET,
MYF(MY_NABP));
}
}
if (!lock_error)
......
......@@ -283,7 +283,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
share_buff.state.nulls_per_key_part= nulls_per_key_part;
share_buff.state.key_root=key_root;
share_buff.pagecache= multi_pagecache_search((uchar*) name_buff,
strlen(name_buff),
(uint) strlen(name_buff),
maria_pagecache);
DBUG_EXECUTE_IF("maria_pretend_crashed_table_on_open",
......@@ -497,7 +497,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
memcpy((char*) share->state.key_root,
(char*) key_root, sizeof(my_off_t)*keys);
strmov(share->unique_file_name, name_buff);
share->unique_name_length= strlen(name_buff);
share->unique_name_length= (uint) strlen(name_buff);
strmov(share->index_file_name, index_name);
strmov(share->data_file_name, data_name);
strmov(share->open_file_name, name);
......
......@@ -295,7 +295,7 @@ static my_bool _ma_read_pack_info(MARIA_SHARE *share, File file,
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,
......
......@@ -182,8 +182,8 @@ int _ma_read_static_record(register MARIA_HA *info, register uchar *record,
return(my_errno);
info->rec_cache.seek_not_done=1; /* We have done a seek */
error=info->s->file_read(info, record,info->s->base.reclength,
pos, MYF(MY_NABP));
error= (int) info->s->file_read(info, record,info->s->base.reclength,
pos, MYF(MY_NABP));
if (! error)
{
fast_ma_writeinfo(info);
......
......@@ -2058,14 +2058,15 @@ static my_bool _ma_log_key_middle(MARIA_HA *info, my_off_t page, uchar *buff,
log_array[TRANSLOG_INTERNAL_PARTS + 3].str= (char*) key_pos;
log_array[TRANSLOG_INTERNAL_PARTS + 3].length= key_length;
translog_parts+=2;
extra_length+= log_array[TRANSLOG_INTERNAL_PARTS + 2].length + key_length;
extra_length+= (uint) (log_array[TRANSLOG_INTERNAL_PARTS + 2].length +
key_length);
}
DBUG_RETURN(translog_write_record(&lsn, LOGREC_REDO_INDEX,
info->trn, info,
(translog_size_t)
log_array[TRANSLOG_INTERNAL_PARTS +
0].length + extra_length,
(log_array[TRANSLOG_INTERNAL_PARTS +
0].length + extra_length),
TRANSLOG_INTERNAL_PARTS + translog_parts,
log_array, log_data, NULL));
}
......
......@@ -884,8 +884,9 @@ extern uint _ma_pack_key(MARIA_HA *info, uint keynr, uchar *key,
const uchar *old, key_part_map keypart_map,
HA_KEYSEG ** last_used_keyseg);
extern int _ma_read_key_record(MARIA_HA *info, uchar *buf, MARIA_RECORD_POS);
extern int _ma_read_cache(IO_CACHE *info, uchar *buff, MARIA_RECORD_POS pos,
uint length, int re_read_if_possibly);
extern my_bool _ma_read_cache(IO_CACHE *info, uchar *buff,
MARIA_RECORD_POS pos, size_t length,
uint re_read_if_possibly);
extern ulonglong ma_retrieve_auto_increment(const uchar *key, uint8 key_type);
extern my_bool _ma_alloc_buffer(uchar **old_addr, size_t *old_size,
size_t new_size);
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment