Bug #45287: phase 2 : 5.0 64 bit compilation warnings

Fixed various compilation warnings when compiling on a 
 64 bit windows.
This commit is contained in:
Georgi Kodinov 2009-07-16 15:37:38 +03:00
parent 1b7754a533
commit bf6e255d8c
14 changed files with 40 additions and 38 deletions

View File

@ -387,7 +387,7 @@ static void find_tool(char *tool_executable_name, const char *tool_name,
last_fn_libchar -= 6; last_fn_libchar -= 6;
} }
len= last_fn_libchar - self_name; len= (int) (last_fn_libchar - self_name);
my_snprintf(tool_executable_name, FN_REFLEN, "%.*s%c%s", my_snprintf(tool_executable_name, FN_REFLEN, "%.*s%c%s",
len, self_name, FN_LIBCHAR, tool_name); len, self_name, FN_LIBCHAR, tool_name);

View File

@ -3122,7 +3122,7 @@ static my_bool dump_all_views_in_db(char *database)
for (numrows= 0 ; (table= getTableName(1)); ) for (numrows= 0 ; (table= getTableName(1)); )
{ {
char *end= strmov(afterdot, table); char *end= strmov(afterdot, table);
if (include_table(hash_key,end - hash_key)) if (include_table(hash_key,(uint) (end - hash_key)))
{ {
numrows++; numrows++;
dynstr_append_checked(&query, quote_name(table, table_buff, 1)); dynstr_append_checked(&query, quote_name(table, table_buff, 1));
@ -3143,7 +3143,7 @@ static my_bool dump_all_views_in_db(char *database)
while ((table= getTableName(0))) while ((table= getTableName(0)))
{ {
char *end= strmov(afterdot, table); char *end= strmov(afterdot, table);
if (include_table(hash_key, end - hash_key)) if (include_table(hash_key, (uint) (end - hash_key)))
get_view_structure(table, database); get_view_structure(table, database);
} }
if (opt_xml) if (opt_xml)

View File

@ -855,8 +855,9 @@ void _db_pop_()
} \ } \
} while (0) } while (0)
int _db_explain_ (CODE_STATE *cs, char *buf, size_t len) int _db_explain_ (CODE_STATE *cs, char *buf, size_t len_arg)
{ {
uint len= (uint) len_arg;
char *start=buf, *end=buf+len-4; char *start=buf, *end=buf+len-4;
get_code_state_or_return *buf=0; get_code_state_or_return *buf=0;
@ -1267,7 +1268,7 @@ static struct link *ListAdd(struct link *head,
start= ctlp; start= ctlp;
while (ctlp < end && *ctlp != ',') while (ctlp < end && *ctlp != ',')
ctlp++; ctlp++;
len=ctlp-start; len=(int) (ctlp-start);
new_malloc= (struct link *) DbugMalloc(sizeof(struct link)+len); new_malloc= (struct link *) DbugMalloc(sizeof(struct link)+len);
memcpy(new_malloc->str, start, len); memcpy(new_malloc->str, start, len);
new_malloc->str[len]=0; new_malloc->str[len]=0;
@ -1303,7 +1304,7 @@ static struct link *ListDel(struct link *head,
{ {
const char *start; const char *start;
struct link **cur; struct link **cur;
int len; size_t len;
while (ctlp < end) while (ctlp < end)
{ {
@ -1357,7 +1358,7 @@ static struct link *ListCopy(struct link *orig)
head= NULL; head= NULL;
while (orig != NULL) while (orig != NULL)
{ {
len= strlen(orig->str); len= (int) strlen(orig->str);
new_malloc= (struct link *) DbugMalloc(sizeof(struct link)+len); new_malloc= (struct link *) DbugMalloc(sizeof(struct link)+len);
memcpy(new_malloc->str, orig->str, len); memcpy(new_malloc->str, orig->str, len);
new_malloc->str[len]= 0; new_malloc->str[len]= 0;
@ -1827,7 +1828,7 @@ static void DBUGOpenFile(CODE_STATE *cs,
{ {
if (end) if (end)
{ {
int len=end-name; size_t len=(size_t) (end-name);
memcpy(cs->stack->name, name, len); memcpy(cs->stack->name, name, len);
cs->stack->name[len]=0; cs->stack->name[len]=0;
} }

View File

@ -512,7 +512,7 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
((info)->write_pos + (Count) <=(info)->write_end ?\ ((info)->write_pos + (Count) <=(info)->write_end ?\
(memcpy((info)->write_pos, (Buffer), (size_t)(Count)),\ (memcpy((info)->write_pos, (Buffer), (size_t)(Count)),\
((info)->write_pos+=(Count)),0) : \ ((info)->write_pos+=(Count)),0) : \
(*(info)->write_function)((info),(Buffer),(Count))) (*(info)->write_function)((info),(Buffer), (uint)(Count)))
#define my_b_get(info) \ #define my_b_get(info) \
((info)->read_pos != (info)->read_end ?\ ((info)->read_pos != (info)->read_end ?\

View File

@ -3036,7 +3036,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
sys_init_connect.value_length= 0; sys_init_connect.value_length= 0;
if ((sys_init_connect.value= opt_init_connect)) if ((sys_init_connect.value= opt_init_connect))
sys_init_connect.value_length= strlen(opt_init_connect); sys_init_connect.value_length= (uint) strlen(opt_init_connect);
else else
sys_init_connect.value=my_strdup("",MYF(0)); sys_init_connect.value=my_strdup("",MYF(0));
sys_init_connect.is_os_charset= TRUE; sys_init_connect.is_os_charset= TRUE;
@ -7840,7 +7840,7 @@ static void fix_paths(void)
} }
convert_dirname(mysql_real_data_home,mysql_real_data_home,NullS); convert_dirname(mysql_real_data_home,mysql_real_data_home,NullS);
my_realpath(mysql_unpacked_real_data_home, mysql_real_data_home, MYF(0)); my_realpath(mysql_unpacked_real_data_home, mysql_real_data_home, MYF(0));
mysql_unpacked_real_data_home_len= strlen(mysql_unpacked_real_data_home); mysql_unpacked_real_data_home_len= (int) strlen(mysql_unpacked_real_data_home);
if (mysql_unpacked_real_data_home[mysql_unpacked_real_data_home_len-1] == FN_LIBCHAR) if (mysql_unpacked_real_data_home[mysql_unpacked_real_data_home_len-1] == FN_LIBCHAR)
--mysql_unpacked_real_data_home_len; --mysql_unpacked_real_data_home_len;

View File

@ -792,7 +792,7 @@ SEL_TREE::SEL_TREE(SEL_TREE *arg, PARAM *param): Sql_alloc()
SEL_IMERGE::SEL_IMERGE (SEL_IMERGE *arg, PARAM *param) : Sql_alloc() SEL_IMERGE::SEL_IMERGE (SEL_IMERGE *arg, PARAM *param) : Sql_alloc()
{ {
uint elements= (arg->trees_end - arg->trees); uint elements= (uint) (arg->trees_end - arg->trees);
if (elements > PREALLOCED_TREES) if (elements > PREALLOCED_TREES)
{ {
uint size= elements * sizeof (SEL_TREE **); uint size= elements * sizeof (SEL_TREE **);

View File

@ -3528,7 +3528,7 @@ int set_var_password::check(THD *thd)
{ {
DBUG_ASSERT(thd->security_ctx->priv_user); DBUG_ASSERT(thd->security_ctx->priv_user);
user->user.str= (char *) thd->security_ctx->priv_user; user->user.str= (char *) thd->security_ctx->priv_user;
user->user.length= strlen(thd->security_ctx->priv_user); user->user.length= (uint) strlen(thd->security_ctx->priv_user);
} }
/* Returns 1 as the function sends error to client */ /* Returns 1 as the function sends error to client */
return check_change_password(thd, user->host.str, user->user.str, return check_change_password(thd, user->host.str, user->user.str,

View File

@ -430,9 +430,9 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
type, type,
NULL, 0, NULL, 0,
name->m_name.str, name->m_name.length, name->m_name.str, name->m_name.length,
params, strlen(params), params, (ulong) strlen(params),
returns, strlen(returns), returns, (ulong) strlen(returns),
body, strlen(body), body, (ulong) strlen(body),
&chistics, &definer_user_name, &definer_host_name)) &chistics, &definer_user_name, &definer_host_name))
{ {
ret= SP_INTERNAL_ERROR; ret= SP_INTERNAL_ERROR;

View File

@ -5988,15 +5988,15 @@ static bool update_schema_privilege(THD *thd, TABLE *table, char *buff,
int i= 2; int i= 2;
CHARSET_INFO *cs= system_charset_info; CHARSET_INFO *cs= system_charset_info;
restore_record(table, s->default_values); restore_record(table, s->default_values);
table->field[0]->store(buff, strlen(buff), cs); table->field[0]->store(buff, (uint) strlen(buff), cs);
if (db) if (db)
table->field[i++]->store(db, strlen(db), cs); table->field[i++]->store(db, (uint) strlen(db), cs);
if (t_name) if (t_name)
table->field[i++]->store(t_name, strlen(t_name), cs); table->field[i++]->store(t_name, (uint) strlen(t_name), cs);
if (column) if (column)
table->field[i++]->store(column, col_length, cs); table->field[i++]->store(column, col_length, cs);
table->field[i++]->store(priv, priv_length, cs); table->field[i++]->store(priv, priv_length, cs);
table->field[i]->store(is_grantable, strlen(is_grantable), cs); table->field[i]->store(is_grantable, (uint) strlen(is_grantable), cs);
return schema_table_store_record(thd, table); return schema_table_store_record(thd, table);
} }
#endif #endif

View File

@ -8231,7 +8231,7 @@ int test_if_data_home_dir(const char *dir)
(void) fn_format(path, dir, "", "", (void) fn_format(path, dir, "", "",
(MY_RETURN_REAL_PATH|MY_RESOLVE_SYMLINKS)); (MY_RETURN_REAL_PATH|MY_RESOLVE_SYMLINKS));
dir_len= strlen(path); dir_len= (int) strlen(path);
if (mysql_unpacked_real_data_home_len<= dir_len) if (mysql_unpacked_real_data_home_len<= dir_len)
{ {
if (dir_len > mysql_unpacked_real_data_home_len && if (dir_len > mysql_unpacked_real_data_home_len &&

View File

@ -119,7 +119,7 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table)
if (field) if (field)
{ {
field->set_name(field_info->old_name, field->set_name(field_info->old_name,
strlen(field_info->old_name), (uint) strlen(field_info->old_name),
system_charset_info); system_charset_info);
if (add_item_to_list(thd, field)) if (add_item_to_list(thd, field))
return 1; return 1;

View File

@ -287,7 +287,7 @@ find_files(THD *thd, List<char> *files, const char *db,
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
uint col_access=thd->col_access; uint col_access=thd->col_access;
#endif #endif
uint wild_length= 0; size_t wild_length= 0;
TABLE_LIST table_list; TABLE_LIST table_list;
DBUG_ENTER("find_files"); DBUG_ENTER("find_files");
@ -3738,7 +3738,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
if (item->decimals > 0) if (item->decimals > 0)
item->max_length+= 1; item->max_length+= 1;
item->set_name(fields_info->field_name, item->set_name(fields_info->field_name,
strlen(fields_info->field_name), cs); (uint) strlen(fields_info->field_name), cs);
break; break;
case MYSQL_TYPE_STRING: case MYSQL_TYPE_STRING:
default: default:

View File

@ -51,7 +51,7 @@ int yylex(void *yylval, void *yythd);
const LEX_STRING null_lex_str={0,0}; const LEX_STRING null_lex_str={0,0};
#define yyoverflow(A,B,C,D,E,F) {ulong val= *(F); if (my_yyoverflow((B), (D), &val)) { yyerror((char*) (A)); return 2; } else { *(F)= (YYSIZE_T)val; }} #define yyoverflow(A,B,C,D,E,F) {ulong val= (ulong) *(F); if (my_yyoverflow((B), (D), &val)) { yyerror((char*) (A)); return 2; } else { *(F)= (YYSIZE_T)val; }}
#undef WARN_DEPRECATED /* this macro is also defined in mysql_priv.h */ #undef WARN_DEPRECATED /* this macro is also defined in mysql_priv.h */
#define WARN_DEPRECATED(A,B) \ #define WARN_DEPRECATED(A,B) \
@ -2239,9 +2239,9 @@ sp_proc_stmt:
lex->tok_end otherwise. lex->tok_end otherwise.
*/ */
if (yychar == YYEMPTY) if (yychar == YYEMPTY)
i->m_query.length= lip->ptr - sp->m_tmp_query; i->m_query.length= (uint) (lip->ptr - sp->m_tmp_query);
else else
i->m_query.length= lip->tok_end - sp->m_tmp_query; i->m_query.length= (uint) (lip->tok_end - sp->m_tmp_query);
if (!(i->m_query.str= strmake_root(thd->mem_root, if (!(i->m_query.str= strmake_root(thd->mem_root,
sp->m_tmp_query, sp->m_tmp_query,
i->m_query.length)) || i->m_query.length)) ||
@ -9027,9 +9027,10 @@ simple_ident:
Item_splocal *splocal; Item_splocal *splocal;
splocal= new Item_splocal($1, spv->offset, spv->type, splocal= new Item_splocal($1, spv->offset, spv->type,
lip->tok_start_prev - (uint) (lip->tok_start_prev -
lex->sphead->m_tmp_query, lex->sphead->m_tmp_query),
lip->tok_end - lip->tok_start_prev); (uint) (lip->tok_end -
lip->tok_start_prev));
if (splocal == NULL) if (splocal == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
#ifndef DBUG_OFF #ifndef DBUG_OFF
@ -9743,9 +9744,9 @@ option_type_value:
lip->tok_end otherwise. lip->tok_end otherwise.
*/ */
if (yychar == YYEMPTY) if (yychar == YYEMPTY)
qbuff.length= lip->ptr - sp->m_tmp_query; qbuff.length= (uint) (lip->ptr - sp->m_tmp_query);
else else
qbuff.length= lip->tok_end - sp->m_tmp_query; qbuff.length= (uint) (lip->tok_end - sp->m_tmp_query);
if (!(qbuff.str= alloc_root(thd->mem_root, qbuff.length + 5))) if (!(qbuff.str= alloc_root(thd->mem_root, qbuff.length + 5)))
MYSQL_YYABORT; MYSQL_YYABORT;
@ -11065,7 +11066,7 @@ view_select_aux:
char *stmt_beg= (lex->sphead ? char *stmt_beg= (lex->sphead ?
(char *)lex->sphead->m_tmp_query : (char *)lex->sphead->m_tmp_query :
thd->query); thd->query);
lex->create_view_select_start= $2 - stmt_beg; lex->create_view_select_start= (uint) ($2 - stmt_beg);
} }
| '(' remember_name select_paren ')' union_opt | '(' remember_name select_paren ')' union_opt
{ {
@ -11074,7 +11075,7 @@ view_select_aux:
char *stmt_beg= (lex->sphead ? char *stmt_beg= (lex->sphead ?
(char *)lex->sphead->m_tmp_query : (char *)lex->sphead->m_tmp_query :
thd->query); thd->query);
lex->create_view_select_start= $2 - stmt_beg; lex->create_view_select_start= (uint) ($2 - stmt_beg);
} }
; ;
@ -11119,7 +11120,7 @@ trigger_tail:
lex->stmt_definition_begin= $2; lex->stmt_definition_begin= $2;
lex->ident.str= $7; lex->ident.str= $7;
lex->ident.length= $10 - $7; lex->ident.length= (uint) ($10 - $7);
lex->sphead= sp; lex->sphead= sp;
lex->spname= $3; lex->spname= $3;

View File

@ -16248,14 +16248,14 @@ static void test_bug38486(void)
stmt= mysql_stmt_init(mysql); stmt= mysql_stmt_init(mysql);
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type); mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type);
stmt_text= "CREATE TABLE t1 (a INT)"; stmt_text= "CREATE TABLE t1 (a INT)";
mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); mysql_stmt_prepare(stmt, stmt_text, (ulong) strlen(stmt_text));
mysql_stmt_execute(stmt); mysql_stmt_execute(stmt);
mysql_stmt_close(stmt); mysql_stmt_close(stmt);
stmt= mysql_stmt_init(mysql); stmt= mysql_stmt_init(mysql);
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type); mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type);
stmt_text= "INSERT INTO t1 VALUES (1)"; stmt_text= "INSERT INTO t1 VALUES (1)";
mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); mysql_stmt_prepare(stmt, stmt_text, (ulong) strlen(stmt_text));
mysql_stmt_execute(stmt); mysql_stmt_execute(stmt);
mysql_stmt_close(stmt); mysql_stmt_close(stmt);