diff options
author | Ignacio Galarza <iggy@mysql.com> | 2009-02-13 11:41:47 -0500 |
---|---|---|
committer | Ignacio Galarza <iggy@mysql.com> | 2009-02-13 11:41:47 -0500 |
commit | 5b7347bda31b9d66cd78937e5dc339f553b9a736 (patch) | |
tree | 85b39362efeae16536a90f3a3624acd6916d4305 /sql | |
parent | 50b19265ffcf4e4708c86345a5c166c58dbdb523 (diff) | |
parent | 54fbbf9591e21cda9f7b26c2d795d88f51827f07 (diff) | |
download | mariadb-git-5b7347bda31b9d66cd78937e5dc339f553b9a736.tar.gz |
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
Diffstat (limited to 'sql')
-rw-r--r-- | sql/event_data_objects.cc | 4 | ||||
-rw-r--r-- | sql/event_parse_data.cc | 4 | ||||
-rw-r--r-- | sql/events.cc | 2 | ||||
-rw-r--r-- | sql/gen_lex_hash.cc | 6 | ||||
-rw-r--r-- | sql/item.h | 2 | ||||
-rw-r--r-- | sql/item_func.cc | 4 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 14 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 64 | ||||
-rw-r--r-- | sql/lock.cc | 4 | ||||
-rw-r--r-- | sql/log_event.cc | 22 | ||||
-rw-r--r-- | sql/log_event.h | 4 | ||||
-rw-r--r-- | sql/log_event_old.cc | 4 | ||||
-rw-r--r-- | sql/net_serv.cc | 6 | ||||
-rw-r--r-- | sql/sp_head.h | 2 | ||||
-rw-r--r-- | sql/spatial.h | 2 | ||||
-rw-r--r-- | sql/sql_class.h | 2 | ||||
-rw-r--r-- | sql/sql_connect.cc | 2 | ||||
-rw-r--r-- | sql/sql_crypt.cc | 2 | ||||
-rw-r--r-- | sql/sql_error.cc | 2 | ||||
-rw-r--r-- | sql/sql_insert.cc | 2 | ||||
-rw-r--r-- | sql/sql_lex.cc | 10 | ||||
-rw-r--r-- | sql/sql_lex.h | 2 | ||||
-rw-r--r-- | sql/sql_load.cc | 4 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 8 | ||||
-rw-r--r-- | sql/sql_profile.cc | 2 | ||||
-rw-r--r-- | sql/sql_repl.cc | 8 | ||||
-rw-r--r-- | sql/sql_servers.cc | 8 | ||||
-rw-r--r-- | sql/sql_string.cc | 4 | ||||
-rw-r--r-- | sql/sql_table.cc | 22 | ||||
-rw-r--r-- | sql/sql_trigger.cc | 2 | ||||
-rw-r--r-- | sql/sql_udf.cc | 2 | ||||
-rw-r--r-- | sql/sql_view.cc | 6 | ||||
-rw-r--r-- | sql/udf_example.c | 4 | ||||
-rw-r--r-- | sql/uniques.cc | 2 |
34 files changed, 119 insertions, 119 deletions
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 + |