Commit 05f0d520 authored by unknown's avatar unknown

Bug#25213 - Compiler warnings in MyISAM code

Compiler warnings due to non-matching conversion
specifications in format strings in DBUG_PRINT calls,
due to non-used parameters (in non-debug mode), and
due to seemingly uninitialized variables.

Initialized variables, declared parameters unused, and
casted DBUG_PRINT arguments to get rid of warnings.


myisam/mi_range.c:
  Bug#25213 - Compiler warnings in MyISAM code
  Initialized a variable to get rid of a compiler warning.
myisam/mi_test1.c:
  Bug#25213 - Compiler warnings in MyISAM code
  Declared an parameter unused to get rid of warnings.
myisam/mi_write.c:
  Bug#25213 - Compiler warnings in MyISAM code
  Initialized a variable to get rid of a compiler warning.
  Casted arguments to DBUG_PRINT to match them with their
  format string conversion specification.
myisam/rt_split.c:
  Bug#25213 - Compiler warnings in MyISAM code
  Initialized variables to get rid of compiler warnings.
parent 3b05bef9
...@@ -171,6 +171,7 @@ static double _mi_search_pos(register MI_INFO *info, ...@@ -171,6 +171,7 @@ static double _mi_search_pos(register MI_INFO *info,
uchar *keypos,*buff; uchar *keypos,*buff;
double offset; double offset;
DBUG_ENTER("_mi_search_pos"); DBUG_ENTER("_mi_search_pos");
LINT_INIT(max_keynr);
if (pos == HA_OFFSET_ERROR) if (pos == HA_OFFSET_ERROR)
DBUG_RETURN(0.5); DBUG_RETURN(0.5);
......
...@@ -562,7 +562,7 @@ static struct my_option my_long_options[] = ...@@ -562,7 +562,7 @@ static struct my_option my_long_options[] =
static my_bool static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)), get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument) char *argument __attribute__((unused)))
{ {
switch(optid) { switch(optid) {
case 'a': case 'a':
......
...@@ -331,7 +331,7 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -331,7 +331,7 @@ static int w_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
my_bool was_last_key; my_bool was_last_key;
my_off_t next_page, dupp_key_pos; my_off_t next_page, dupp_key_pos;
DBUG_ENTER("w_search"); DBUG_ENTER("w_search");
DBUG_PRINT("enter",("page: %ld",page)); DBUG_PRINT("enter",("page: %ld", (long) page));
search_key_length= (comp_flag & SEARCH_FIND) ? key_length : USE_WHOLE_KEY; search_key_length= (comp_flag & SEARCH_FIND) ? key_length : USE_WHOLE_KEY;
if (!(temp_buff= (uchar*) my_alloca((uint) keyinfo->block_length+ if (!(temp_buff= (uchar*) my_alloca((uint) keyinfo->block_length+
...@@ -453,7 +453,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -453,7 +453,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
uchar *endpos, *prev_key; uchar *endpos, *prev_key;
MI_KEY_PARAM s_temp; MI_KEY_PARAM s_temp;
DBUG_ENTER("_mi_insert"); DBUG_ENTER("_mi_insert");
DBUG_PRINT("enter",("key_pos: %lx",key_pos)); DBUG_PRINT("enter",("key_pos: %lx", (ulong) key_pos));
DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,keyinfo->seg,key,USE_WHOLE_KEY);); DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,keyinfo->seg,key,USE_WHOLE_KEY););
nod_flag=mi_test_if_nod(anc_buff); nod_flag=mi_test_if_nod(anc_buff);
...@@ -475,7 +475,8 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -475,7 +475,8 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo,
DBUG_PRINT("test",("t_length: %d ref_len: %d", DBUG_PRINT("test",("t_length: %d ref_len: %d",
t_length,s_temp.ref_length)); t_length,s_temp.ref_length));
DBUG_PRINT("test",("n_ref_len: %d n_length: %d key_pos: %lx", DBUG_PRINT("test",("n_ref_len: %d n_length: %d key_pos: %lx",
s_temp.n_ref_length,s_temp.n_length,s_temp.key)); s_temp.n_ref_length, s_temp.n_length,
(ulong) s_temp.key));
} }
#endif #endif
if (t_length > 0) if (t_length > 0)
...@@ -572,6 +573,7 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo, ...@@ -572,6 +573,7 @@ int _mi_split_page(register MI_INFO *info, register MI_KEYDEF *keyinfo,
my_off_t new_pos; my_off_t new_pos;
MI_KEY_PARAM s_temp; MI_KEY_PARAM s_temp;
DBUG_ENTER("mi_split_page"); DBUG_ENTER("mi_split_page");
LINT_INIT(after_key);
DBUG_DUMP("buff",(byte*) buff,mi_getint(buff)); DBUG_DUMP("buff",(byte*) buff,mi_getint(buff));
if (info->s->keyinfo+info->lastinx == keyinfo) if (info->s->keyinfo+info->lastinx == keyinfo)
...@@ -664,7 +666,8 @@ uchar *_mi_find_half_pos(uint nod_flag, MI_KEYDEF *keyinfo, uchar *page, ...@@ -664,7 +666,8 @@ uchar *_mi_find_half_pos(uint nod_flag, MI_KEYDEF *keyinfo, uchar *page,
} while (page < end); } while (page < end);
*return_key_length=length; *return_key_length=length;
*after_key=page; *after_key=page;
DBUG_PRINT("exit",("returns: %lx page: %lx half: %lx",lastpos,page,end)); DBUG_PRINT("exit",("returns: %lx page: %lx half: %lx",
(ulong) lastpos, (ulong) page, (ulong) end));
DBUG_RETURN(lastpos); DBUG_RETURN(lastpos);
} /* _mi_find_half_pos */ } /* _mi_find_half_pos */
...@@ -718,7 +721,8 @@ static uchar *_mi_find_last_pos(MI_KEYDEF *keyinfo, uchar *page, ...@@ -718,7 +721,8 @@ static uchar *_mi_find_last_pos(MI_KEYDEF *keyinfo, uchar *page,
} }
*return_key_length=last_length; *return_key_length=last_length;
*after_key=lastpos; *after_key=lastpos;
DBUG_PRINT("exit",("returns: %lx page: %lx end: %lx",prevpos,page,end)); DBUG_PRINT("exit",("returns: %lx page: %lx end: %lx",
(ulong) prevpos, (ulong) page, (ulong) end));
DBUG_RETURN(prevpos); DBUG_RETURN(prevpos);
} /* _mi_find_last_pos */ } /* _mi_find_last_pos */
...@@ -754,7 +758,7 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo, ...@@ -754,7 +758,7 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo,
next_page= _mi_kpos(info->s->base.key_reflength, next_page= _mi_kpos(info->s->base.key_reflength,
father_key_pos+father_keylength); father_key_pos+father_keylength);
buff=info->buff; buff=info->buff;
DBUG_PRINT("test",("use right page: %lu",next_page)); DBUG_PRINT("test",("use right page: %lu", (ulong) next_page));
} }
else else
{ {
...@@ -763,7 +767,7 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo, ...@@ -763,7 +767,7 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo,
next_page= _mi_kpos(info->s->base.key_reflength,father_key_pos); next_page= _mi_kpos(info->s->base.key_reflength,father_key_pos);
/* Fix that curr_buff is to left */ /* Fix that curr_buff is to left */
buff=curr_buff; curr_buff=info->buff; buff=curr_buff; curr_buff=info->buff;
DBUG_PRINT("test",("use left page: %lu",next_page)); DBUG_PRINT("test",("use left page: %lu", (ulong) next_page));
} /* father_key_pos ptr to parting key */ } /* father_key_pos ptr to parting key */
if (!_mi_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff,0)) if (!_mi_fetch_keypage(info,keyinfo,next_page,DFLT_INIT_HITS,info->buff,0))
......
...@@ -188,6 +188,10 @@ static int split_rtree_node(SplitStruct *node, int n_entries, ...@@ -188,6 +188,10 @@ static int split_rtree_node(SplitStruct *node, int n_entries,
int next_node; int next_node;
int i; int i;
SplitStruct *end = node + n_entries; SplitStruct *end = node + n_entries;
LINT_INIT(a);
LINT_INIT(b);
LINT_INIT(next);
LINT_INIT(next_node);
if (all_size < min_size * 2) if (all_size < min_size * 2)
{ {
......
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