Fixed compiler warnings (Mostly VC++):

- Removed not used variables
- Changed some ulong parameters/variables to ulonglong (possible serious bug)
- Added casts to get rid of safe assignment from longlong to long (and similar)
- Added casts to function parameters
- Fixed signed/unsigned compares
- Added some constructores to structures
- Removed some not portable constructs

Better fix for bug Bug #21428 "skipped 9 bytes from file: socket (3)" on "mysqladmin shutdown"
(Added new parameter to net_clear() to define when we want the communication buffer to be emptied)
This commit is contained in:
monty@mysql.com/narttu.mysql.fi 2006-11-30 03:40:42 +02:00
parent 717284b85c
commit 3a35c30027
63 changed files with 198 additions and 208 deletions

View file

@ -3437,7 +3437,6 @@ server_version_string(MYSQL *mysql)
{
char *bufp = buf;
MYSQL_RES *result;
MYSQL_ROW cur;
bufp = strnmov(buf, mysql_get_server_info(mysql), sizeof buf);

View file

@ -2149,7 +2149,7 @@ continue_xml:
write_footer(sql_file);
my_fclose(sql_file, MYF(MY_WME));
}
DBUG_RETURN(num_fields);
DBUG_RETURN((uint) num_fields);
} /* get_table_structure */

View file

@ -979,7 +979,9 @@ drop_schema(MYSQL *mysql, const char *db)
static int
run_scheduler(stats *sptr, statement *stmts, uint concur, ulonglong limit)
{
#ifndef __WIN__
uint x;
#endif
File lock_file;
struct timeval start_time, end_time;
thread_context con;

View file

@ -3460,10 +3460,10 @@ int read_line(char *buf, int size)
DBUG_RETURN(0);
}
else if ((c == '{' &&
(!my_strnncoll_simple(charset_info, "while", 5,
buf, min(5, p - buf), 0) ||
!my_strnncoll_simple(charset_info, "if", 2,
buf, min(2, p - buf), 0))))
(!my_strnncoll_simple(charset_info, (const uchar*) "while", 5,
(uchar*) buf, min(5, p - buf), 0) ||
!my_strnncoll_simple(charset_info, (const uchar*) "if", 2,
(uchar*) buf, min(2, p - buf), 0))))
{
/* Only if and while commands can be terminated by { */
*p++= c;

View file

@ -1052,8 +1052,10 @@ static int convert_file(REPLACE *rep, my_string name)
{
int error;
FILE *in,*out;
char dir_buff[FN_REFLEN], tempname[FN_REFLEN];
char link_name[FN_REFLEN], *org_name = name;
char dir_buff[FN_REFLEN], tempname[FN_REFLEN],*org_name = name;
#ifdef HAVE_READLINK
char link_name[FN_REFLEN];
#endif
File temp_file;
DBUG_ENTER("convert_file");

View file

@ -1136,8 +1136,8 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#define set_timespec_nsec(ABSTIME,NSEC) \
{\
ulonglong now= my_getsystime() + (NSEC/100); \
(ABSTIME).tv_sec= (now / ULL(10000000)); \
(ABSTIME).tv_nsec= (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
(ABSTIME).tv_sec= (time_t) (now / ULL(10000000)); \
(ABSTIME).tv_nsec= (long) (now % ULL(10000000) * 100 + ((NSEC) % 100)); \
}
#endif /* !set_timespec_nsec */
#endif /* HAVE_TIMESPEC_TS_SEC */

View file

@ -340,7 +340,7 @@ extern "C" {
my_bool my_net_init(NET *net, Vio* vio);
void my_net_local_init(NET *net);
void net_end(NET *net);
void net_clear(NET *net);
void net_clear(NET *net, my_bool clear_buffer);
my_bool net_realloc(NET *net, unsigned long length);
my_bool net_flush(NET *net);
my_bool my_net_write(NET *net,const char *packet,unsigned long len);

View file

@ -2518,7 +2518,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
DBUG_RETURN(1);
}
net_clear(net); /* Sets net->write_pos */
net_clear(net, 1); /* Sets net->write_pos */
/* Reserve place for null-marker bytes */
null_count= (stmt->param_count+7) /8;
if (my_realloc_str(net, null_count + 1))

View file

@ -153,7 +153,7 @@ pos(unsigned char c)
Number of bytes written at 'dst' or -1 in case of failure
*/
int
base64_decode(const char *const src_base, size_t const len,
base64_decode(const char *src_base, size_t len,
void *dst, const char **end_ptr)
{
char b[3];

View file

@ -97,6 +97,8 @@ my_bool my_thread_global_init(void)
pthread_mutex_init(&THR_LOCK_heap,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&THR_LOCK_net,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&THR_LOCK_charset,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&THR_LOCK_threads,MY_MUTEX_INIT_FAST);
pthread_cond_init(&THR_COND_threads, NULL);
#if defined( __WIN__) || defined(OS2)
win_pthread_init();
#endif
@ -310,7 +312,7 @@ const char *my_thread_name(void)
if (!tmp->name[0])
{
long id=my_thread_id();
sprintf(name_buff,"T@%lu", id);
sprintf(name_buff,"T@%ld", id);
strmake(tmp->name,name_buff,THREAD_NAME_SIZE);
}
return tmp->name;

View file

@ -52,7 +52,7 @@ my_vle_encode(byte* out, my_size_t max, ulong n)
do
{
*ptr++= (n & 0x7F);
*ptr++= (byte) (n & 0x7F);
n>>= 7;
}
while (n > 0);

View file

@ -687,8 +687,7 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
the previous command was a shutdown command, we may have the
response for the COM_QUIT already in the communication buffer
*/
if (command != COM_QUIT)
net_clear(&mysql->net); /* Clear receive buffer */
net_clear(&mysql->net, (command != COM_QUIT));
if (net_write_command(net,(uchar) command, header, header_length,
arg, arg_length))
@ -1218,7 +1217,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
{
uchar *pos;
/* fields count may be wrong */
DBUG_ASSERT ((field - result) < fields);
DBUG_ASSERT((uint) (field - result) < fields);
cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7);
field->catalog = strdup_root(alloc,(char*) row->data[0]);
field->db = strdup_root(alloc,(char*) row->data[1]);
@ -2503,7 +2502,7 @@ my_bool mysql_reconnect(MYSQL *mysql)
mysql_close(mysql);
*mysql=tmp_mysql;
mysql_fix_pointers(mysql, &tmp_mysql); /* adjust connection pointers */
net_clear(&mysql->net);
net_clear(&mysql->net, 1);
mysql->affected_rows= ~(my_ulonglong) 0;
DBUG_RETURN(0);
}

View file

@ -429,7 +429,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
goto err;
}
if ((my_bool)check_date(l_time, not_zero_date, flags, was_cut))
if (check_date(l_time, not_zero_date != 0, flags, was_cut))
goto err;
l_time->time_type= (number_of_fields <= 3 ?
@ -530,15 +530,15 @@ my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
if ((uint) (end-str) > 1 && str != end_of_days &&
my_isdigit(&my_charset_latin1, *str))
{ /* Found days part */
date[0]= value;
date[0]= (ulong) value;
state= 1; /* Assume next is hours */
found_days= 1;
}
else if ((end-str) > 1 && *str == time_separator &&
my_isdigit(&my_charset_latin1, str[1]))
{
date[0]=0; /* Assume we found hours */
date[1]=value;
date[0]= 0; /* Assume we found hours */
date[1]= (ulong) value;
state=2;
found_hours=1;
str++; /* skip ':' */
@ -547,9 +547,9 @@ my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
{
/* String given as one number; assume HHMMSS format */
date[0]= 0;
date[1]= value/10000;
date[2]= value/100 % 100;
date[3]= value % 100;
date[1]= ((ulong) value)/10000;
date[2]= ((ulong) value)/100 % 100;
date[3]= ((ulong) value) % 100;
state=4;
goto fractional;
}
@ -559,7 +559,7 @@ my_bool str_to_time(const char *str, uint length, MYSQL_TIME *l_time,
{
for (value=0; str != end && my_isdigit(&my_charset_latin1,*str) ; str++)
value=value*10L + (long) (*str - '0');
date[state++]=value;
date[state++]= (ulong) value;
if (state == 4 || (end-str) < 2 || *str != time_separator ||
!my_isdigit(&my_charset_latin1,str[1]))
break;
@ -594,7 +594,7 @@ fractional:
value*= (long) log_10_int[field_length];
else if (field_length < 0)
*warning|= MYSQL_TIME_WARN_TRUNCATED;
date[4]=value;
date[4]= (ulong) value;
}
else
date[4]=0;

View file

@ -1095,7 +1095,7 @@ bool get_next_time(TIME *next, TIME *start, TIME *time_now, TIME *last_exec,
DBUG_PRINT("error", ("negative difference"));
DBUG_ASSERT(0);
}
uint multiplier= seconds_diff / seconds;
uint multiplier= (uint) (seconds_diff / seconds);
/*
Increase the multiplier is the modulus is not zero to make round up.
Or if time_now==start then we should not execute the same
@ -1128,7 +1128,7 @@ bool get_next_time(TIME *next, TIME *start, TIME *time_now, TIME *last_exec,
directly with +1 we will be after the current date but it could be that
we will be 1 month ahead, so 2 steps are necessary.
*/
interval.month= (diff_months / months)*months;
interval.month= (ulong) ((diff_months / months)*months);
/*
Check if the same month as last_exec (always set - prerequisite)
An event happens at most once per month so there is no way to
@ -1141,7 +1141,7 @@ bool get_next_time(TIME *next, TIME *start, TIME *time_now, TIME *last_exec,
*/
if (time_now->year == last_exec->year &&
time_now->month == last_exec->month)
interval.month+= months;
interval.month+= (ulong) months;
tmp= *start;
if ((ret= date_add_interval(&tmp, INTERVAL_MONTH, interval)))
@ -1150,7 +1150,7 @@ bool get_next_time(TIME *next, TIME *start, TIME *time_now, TIME *last_exec,
/* If `tmp` is still before time_now just add one more time the interval */
if (my_time_compare(&tmp, time_now) == -1)
{
interval.month+= months;
interval.month+= (ulong) months;
tmp= *start;
if ((ret= date_add_interval(&tmp, INTERVAL_MONTH, interval)))
goto done;
@ -1283,7 +1283,7 @@ Event_queue_element::compute_next_execution_time()
if (get_next_time(&next_exec, &starts, &time_now,
last_executed.year? &last_executed:&starts,
expression, interval))
(int) expression, interval))
goto err;
/* There was previous execution */
@ -1321,7 +1321,7 @@ Event_queue_element::compute_next_execution_time()
{
TIME next_exec;
if (get_next_time(&next_exec, &starts, &time_now, &last_executed,
expression, interval))
(int) expression, interval))
goto err;
execute_at= next_exec;
DBUG_PRINT("info",("Next[%lu]",
@ -1356,7 +1356,7 @@ Event_queue_element::compute_next_execution_time()
TIME next_exec;
if (get_next_time(&next_exec, &starts, &time_now,
last_executed.year? &last_executed:&starts,
expression, interval))
(int) expression, interval))
goto err;
execute_at= next_exec;
DBUG_PRINT("info",("Next[%lu]",
@ -1382,7 +1382,7 @@ Event_queue_element::compute_next_execution_time()
TIME next_exec;
if (get_next_time(&next_exec, &starts, &time_now, &last_executed,
expression, interval))
(int) expression, interval))
goto err;
if (my_time_compare(&ends, &next_exec) == -1)

View file

@ -442,7 +442,6 @@ bool
Event_scheduler::run(THD *thd)
{
int res= FALSE;
struct timespec abstime;
Event_job_data *job_data;
DBUG_ENTER("Event_scheduler::run");

View file

@ -2565,7 +2565,6 @@ uint Field_new_decimal::is_equal(create_field *new_field)
int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs)
{
ASSERT_COLUMN_MARKED_FOR_WRITE;
int not_used; // We can ignore result from str2int
char *end;
int error;
@ -2775,7 +2774,6 @@ void Field_tiny::sql_type(String &res) const
int Field_short::store(const char *from,uint len,CHARSET_INFO *cs)
{
ASSERT_COLUMN_MARKED_FOR_WRITE;
int not_used; // We can ignore result from str2int
char *end;
int error;
@ -3062,7 +3060,6 @@ void Field_short::sql_type(String &res) const
int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs)
{
ASSERT_COLUMN_MARKED_FOR_WRITE;
int not_used; // We can ignore result from str2int
char *end;
int error;
@ -3304,8 +3301,6 @@ static bool test_if_minus(CHARSET_INFO *cs,
int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
{
ASSERT_COLUMN_MARKED_FOR_WRITE;
ulong tmp_scan;
longlong tmp;
long store_tmp;
int error;
char *end;
@ -8484,8 +8479,9 @@ const char *Field_bit::unpack(char *to, const char *from)
void Field_bit::set_default()
{
my_ptrdiff_t const offset= table->s->default_values - table->record[0];
uchar bits= get_rec_bits(bit_ptr + offset, bit_ofs, bit_len);
my_ptrdiff_t const offset= (my_ptrdiff_t) (table->s->default_values -
table->record[0]);
uchar bits= (uchar) get_rec_bits(bit_ptr + offset, bit_ofs, bit_len);
set_rec_bits(bits, bit_ptr, bit_ofs, bit_len);
Field::set_default();
}

View file

@ -206,9 +206,10 @@ void insert_symbols()
void insert_sql_functions()
{
size_t i= 0;
int i= 0;
SYMBOL *cur;
for (cur= sql_functions; i<array_elements(sql_functions); cur++, i++){
for (cur= sql_functions; i < (int) array_elements(sql_functions); 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-1,1);

View file

@ -76,12 +76,12 @@ private:
for this since the MySQL Server sometimes allocating the handler object
without freeing them.
*/
u_long m_table_flags;
u_long m_low_byte_first;
longlong m_table_flags;
ulong m_low_byte_first;
uint m_reorged_parts; // Number of reorganised parts
uint m_tot_parts; // Total number of partitions;
uint m_no_locks; // For engines like ha_blackhole, which needs no locks
uint m_no_locks; // For engines like ha_blackhole, which needs no locks
uint m_last_part; // Last file that we update,write
int m_lock_type; // Remembers type of last
// external_lock

View file

@ -2778,7 +2778,7 @@ int ha_change_key_cache(KEY_CACHE *old_key_cache,
>0 : error. frmblob and frmlen may not be set
*/
typedef struct st_discover_args
struct st_discover_args
{
const char *db;
const char *name;
@ -2826,7 +2826,7 @@ int ha_discover(THD *thd, const char *db, const char *name,
to ask engine if there are any new tables that should be written to disk
or any dropped tables that need to be removed from disk
*/
typedef struct st_find_files_args
struct st_find_files_args
{
const char *db;
const char *path;
@ -2877,7 +2877,7 @@ ha_find_files(THD *thd,const char *db,const char *path,
*/
typedef struct st_table_exists_in_engine_args
struct st_table_exists_in_engine_args
{
const char *db;
const char *name;

View file

@ -1542,7 +1542,7 @@ bool agg_item_collations_for_comparison(DTCollation &c, const char *fname,
bool agg_item_charsets(DTCollation &coll, const char *fname,
Item **args, uint nargs, uint flags, int item_sep)
{
Item **arg, **last, *safe_args[2];
Item **arg, *safe_args[2];
LINT_INIT(safe_args[0]);
LINT_INIT(safe_args[1]);
@ -5739,7 +5739,7 @@ void Item_trigger_field::set_required_privilege(bool rw)
}
bool Item_trigger_field::set_value(THD *thd, sp_rcontext */*ctx*/, Item **it)
bool Item_trigger_field::set_value(THD *thd, sp_rcontext * /*ctx*/, Item **it)
{
Item *item= sp_prepare_func_item(thd, it);

View file

@ -2620,7 +2620,8 @@ Create_func_benchmark::create(THD *thd, Item *arg1, Item *arg2)
}
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
return new (thd->mem_root) Item_func_benchmark(arg1->val_int(), arg2);
return new (thd->mem_root) Item_func_benchmark((ulong) arg1->val_int(),
arg2);
}
@ -3242,7 +3243,7 @@ Create_func_format::create(THD *thd, Item *arg1, Item *arg2)
return NULL;
}
return new (thd->mem_root) Item_func_format(arg1, arg2->val_int());
return new (thd->mem_root) Item_func_format(arg1, (int) arg2->val_int());
}

View file

@ -2350,7 +2350,7 @@ longlong Item_func_locate::val_int()
return 0;
/* start is now sufficiently valid to pass to charpos function */
start= a->charpos(start);
start= a->charpos((int) start);
if (start + b->length() > a->length())
return 0;
@ -2360,7 +2360,8 @@ longlong Item_func_locate::val_int()
return start + 1;
if (!cmp_collation.collation->coll->instr(cmp_collation.collation,
a->ptr()+start, a->length()-start,
a->ptr()+start,
(uint) (a->length()-start),
b->ptr(), b->length(),
&match, 1))
return 0;
@ -3835,8 +3836,7 @@ bool
Item_func_set_user_var::check(bool use_result_field)
{
DBUG_ENTER("Item_func_set_user_var::check");
if (use_result_field)
DBUG_ASSERT(result_field);
DBUG_ASSERT(!use_result_field || result_field);
switch (cached_result_type) {
case REAL_RESULT:
@ -4280,7 +4280,7 @@ bool Item_func_get_user_var::eq(const Item *item, bool binary_cmp) const
bool Item_func_get_user_var::set_value(THD *thd,
sp_rcontext */*ctx*/, Item **it)
sp_rcontext * /*ctx*/, Item **it)
{
Item_func_set_user_var *suv= new Item_func_set_user_var(get_name(), *it);
/*

View file

@ -969,8 +969,8 @@ String *Item_func_insert::val_str(String *str)
length= res->length() + 1;
/* start and length are now sufficiently valid to pass to charpos function */
start= res->charpos(start);
length= res->charpos(length, start);
start= res->charpos((int) start);
length= res->charpos((int) length, (uint32) start);
/* Re-testing with corrected params */
if (start > res->length() + 1)
@ -988,7 +988,7 @@ String *Item_func_insert::val_str(String *str)
goto null;
}
res=copy_if_not_alloced(str,res,res->length());
res->replace(start,length,*res2);
res->replace((uint32) start,(uint32) length,*res2);
return res;
null:
null_value=1;
@ -1064,7 +1064,7 @@ String *Item_func_left::val_str(String *str)
return &my_empty_string;
if ((res->length() <= (ulonglong) length) ||
(res->length() <= (char_pos= res->charpos(length))))
(res->length() <= (char_pos= res->charpos((int) length))))
return res;
tmp_value.set(*res, 0, char_pos);
@ -1156,17 +1156,17 @@ String *Item_func_substr::val_str(String *str)
return &my_empty_string;
start= ((start < 0) ? res->numchars() + start : start - 1);
start= res->charpos(start);
start= res->charpos((int) start);
if ((start < 0) || ((uint) start + 1 > res->length()))
return &my_empty_string;
length= res->charpos(length, start);
length= res->charpos((int) length, (uint32) start);
tmp_length= res->length() - start;
length= min(length, tmp_length);
if (!start && res->length() == (ulonglong) length)
if (!start && (longlong) res->length() == length)
return res;
tmp_value.set(*res, (ulonglong) start, (ulonglong) length);
tmp_value.set(*res, (uint32) start, (uint32) length);
return &tmp_value;
}
@ -2214,7 +2214,7 @@ String *Item_func_repeat::val_str(String *str)
char *to;
/* must be longlong to avoid truncation */
longlong tmp_count= args[1]->val_int();
long count= tmp_count;
long count= (long) tmp_count;
String *res= args[0]->val_str(str);
/* Assumes that the maximum length of a String is < INT_MAX32. */
@ -2316,7 +2316,7 @@ String *Item_func_rpad::val_str(String *str)
if (count <= (res_char_length= res->numchars()))
{ // String to pad is big enough
res->length(res->charpos(count)); // Shorten result if longer
res->length(res->charpos((int) count)); // Shorten result if longer
return (res);
}
pad_char_length= rpad->numchars();
@ -2333,7 +2333,7 @@ String *Item_func_rpad::val_str(String *str)
if (args[2]->null_value || !pad_char_length)
goto err;
res_byte_length= res->length(); /* Must be done before alloc_buffer */
if (!(res= alloc_buffer(res,str,&tmp_value,byte_count)))
if (!(res= alloc_buffer(res,str,&tmp_value, (ulong) byte_count)))
goto err;
to= (char*) res->ptr()+res_byte_length;
@ -2347,7 +2347,7 @@ String *Item_func_rpad::val_str(String *str)
}
if (count)
{
pad_byte_length= rpad->charpos(count);
pad_byte_length= rpad->charpos((int) count);
memcpy(to,ptr_pad,(size_t) pad_byte_length);
to+= pad_byte_length;
}
@ -2419,7 +2419,7 @@ String *Item_func_lpad::val_str(String *str)
if (count <= res_char_length)
{
res->length(res->charpos(count));
res->length(res->charpos((int) count));
return res;
}
@ -2435,7 +2435,8 @@ String *Item_func_lpad::val_str(String *str)
goto err;
}
if (args[2]->null_value || !pad_char_length || str->alloc(byte_count))
if (args[2]->null_value || !pad_char_length ||
str->alloc((uint32) byte_count))
goto err;
str->length(0);
@ -2447,7 +2448,7 @@ String *Item_func_lpad::val_str(String *str)
count-= pad_char_length;
}
if (count > 0)
str->append(pad->ptr(), pad->charpos(count), collation.collation);
str->append(pad->ptr(), pad->charpos((int) count), collation.collation);
str->append(*res);
null_value= 0;

View file

@ -110,7 +110,6 @@ static bool make_datetime_with_warn(date_time_format_types format, TIME *ltime,
String *str)
{
int warning= 0;
bool rc;
if (make_datetime(format, ltime, str))
return 1;

View file

@ -777,7 +777,7 @@ String *Item_nodeset_func_elementbyindex::val_nodeset(String *nodeset)
((XPathFilter*)(&nodeset_func->context_cache))->append_element(flt->num,
flt->pos,
size);
int index= args[1]->val_int() - 1;
int index= (int) (args[1]->val_int()) - 1;
if (index >= 0 && (flt->pos == (uint) index || args[1]->is_bool_func()))
((XPathFilter*)nodeset)->append_element(flt->num, pos++);
}

View file

@ -2418,7 +2418,6 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
ulong max_size_arg,
bool null_created_arg)
{
char buff[FN_REFLEN];
File file= -1;
int open_flags = O_CREAT | O_BINARY;
DBUG_ENTER("MYSQL_BIN_LOG::open");

View file

@ -1162,11 +1162,11 @@ void Log_event::print_base64(IO_CACHE* file,
bool more)
{
const uchar *ptr= (const uchar *)temp_buf;
my_off_t size= uint4korr(ptr + EVENT_LEN_OFFSET);
uint32 size= uint4korr(ptr + EVENT_LEN_OFFSET);
DBUG_ENTER("Log_event::print_base64");
size_t const tmp_str_sz= base64_needed_encoded_length(size);
size_t const tmp_str_sz= base64_needed_encoded_length((int) size);
char *const tmp_str= (char *) my_malloc(tmp_str_sz, MYF(MY_WME));
if (!tmp_str) {
fprintf(stderr, "\nError: Out of memory. "
@ -1174,7 +1174,7 @@ void Log_event::print_base64(IO_CACHE* file,
DBUG_VOID_RETURN;
}
int const res= base64_encode(ptr, size, tmp_str);
int const res= base64_encode(ptr, (size_t) size, tmp_str);
DBUG_ASSERT(res == 0);
if (my_b_tell(file) == 0)
@ -5360,7 +5360,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
}
else
{
m_table_id= uint6korr(post_start);
m_table_id= (ulong) uint6korr(post_start);
post_start+= RW_FLAGS_OFFSET;
}
@ -6098,7 +6098,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
else
{
DBUG_ASSERT(post_header_len == TABLE_MAP_HEADER_LEN);
m_table_id= uint6korr(post_start);
m_table_id= (ulong) uint6korr(post_start);
post_start+= TM_FLAGS_OFFSET;
}

View file

@ -884,6 +884,8 @@ public:
bool write(IO_CACHE* file) { return(false); };
virtual bool write_post_header_for_derived(IO_CACHE* file) { return FALSE; }
#else
Muted_query_log_event() {}
#endif
};

View file

@ -893,7 +893,7 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
bool mysql_select(THD *thd, Item ***rref_pointer_array,
TABLE_LIST *tables, uint wild_num, List<Item> &list,
COND *conds, uint og_num, ORDER *order, ORDER *group,
Item *having, ORDER *proc_param, ulong select_type,
Item *having, ORDER *proc_param, ulonglong select_type,
select_result *result, SELECT_LEX_UNIT *unit,
SELECT_LEX *select_lex);
void free_underlaid_joins(THD *thd, SELECT_LEX *select);
@ -919,7 +919,7 @@ void sp_prepare_create_field(THD *thd, create_field *sql_field);
int prepare_create_field(create_field *sql_field,
uint *blob_columns,
int *timestamps, int *timestamps_with_niladic,
uint table_flags);
longlong table_flags);
bool mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
List<create_field> &fields, List<Key> &keys,

View file

@ -266,6 +266,7 @@ static int net_data_is_ready(my_socket sd)
SYNOPSIS
net_clear()
net NET handler
clear_buffer If <> 0, then clear all data from communication buffer
DESCRIPTION
Read from socket until there is nothing more to read. Discard
@ -280,48 +281,51 @@ static int net_data_is_ready(my_socket sd)
*/
void net_clear(NET *net)
void net_clear(NET *net, my_bool clear_buffer)
{
int count, ready;
DBUG_ENTER("net_clear");
#if !defined(EMBEDDED_LIBRARY)
while((ready= net_data_is_ready(net->vio->sd)) > 0)
if (clear_buffer)
{
/* The socket is ready */
if ((count= vio_read(net->vio, (char*) (net->buff),
(uint32) net->max_packet)) > 0)
while ((ready= net_data_is_ready(net->vio->sd)) > 0)
{
DBUG_PRINT("info",("skipped %d bytes from file: %s",
count, vio_description(net->vio)));
/* The socket is ready */
if ((count= vio_read(net->vio, (char*) (net->buff),
(uint32) net->max_packet)) > 0)
{
DBUG_PRINT("info",("skipped %d bytes from file: %s",
count, vio_description(net->vio)));
#ifdef EXTRA_DEBUG
fprintf(stderr,"MySQL: net_clear() skipped %d bytes from file: %s\n",
count, vio_description(net->vio));
fprintf(stderr,"Error: net_clear() skipped %d bytes from file: %s\n",
count, vio_description(net->vio));
#endif
}
else
{
DBUG_PRINT("info",("socket ready but only EOF to read - disconnected"));
net->error= 2;
break;
}
}
else
{
DBUG_PRINT("info",("socket ready but only EOF to read - disconnected"));
net->error= 2;
break;
}
}
#ifdef NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE
/* 'net_data_is_ready' returned "don't know" */
if (ready == -1)
{
/* Read unblocking to clear net */
my_bool old_mode;
if (!vio_blocking(net->vio, FALSE, &old_mode))
/* 'net_data_is_ready' returned "don't know" */
if (ready == -1)
{
while ((count= vio_read(net->vio, (char*) (net->buff),
(uint32) net->max_packet)) > 0)
DBUG_PRINT("info",("skipped %d bytes from file: %s",
count, vio_description(net->vio)));
vio_blocking(net->vio, TRUE, &old_mode);
/* Read unblocking to clear net */
my_bool old_mode;
if (!vio_blocking(net->vio, FALSE, &old_mode))
{
while ((count= vio_read(net->vio, (char*) (net->buff),
(uint32) net->max_packet)) > 0)
DBUG_PRINT("info",("skipped %d bytes from file: %s",
count, vio_description(net->vio)));
vio_blocking(net->vio, TRUE, &old_mode);
}
}
#endif /* NET_DATA_IS_READY_CAN_RETURN_MINUS_ONE */
}
#endif
#endif
#endif /* EMBEDDED_LIBRARY */
net->pkt_nr=net->compress_pkt_nr=0; /* Ready for new command */
net->write_pos=net->buff;
DBUG_VOID_RETURN;
@ -894,7 +898,7 @@ my_real_read(NET *net, ulong *complen)
(int) net->buff[net->where_b + 3],
net->pkt_nr));
#ifdef EXTRA_DEBUG
fprintf(stderr,"Packets out of order (Found: %d, expected %d)\n",
fprintf(stderr,"Error: Packets out of order (Found: %d, expected %d)\n",
(int) net->buff[net->where_b + 3],
(uint) (uchar) net->pkt_nr);
#endif

View file

@ -540,7 +540,8 @@ class PARAM : public RANGE_OPT_PARAM
{
public:
KEY_PART *key[MAX_KEY]; /* First key parts of keys used in the query */
uint baseflag, max_key_part, range_count;
longlong baseflag;
uint max_key_part, range_count;
char min_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH],
@ -1142,7 +1143,6 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
{
handler *save_file= file, *org_file;
THD *thd;
MY_BITMAP *bitmap;
DBUG_ENTER("QUICK_RANGE_SELECT::init_ror_merged_scan");
in_ror_merged_scan= 1;
@ -2048,7 +2048,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
/* set up parameter that is passed to all functions */
param.thd= thd;
param.baseflag=head->file->ha_table_flags();
param.baseflag= head->file->ha_table_flags();
param.prev_tables=prev_tables | const_tables;
param.read_tables=read_tables;
param.current_table= head->map;
@ -2101,7 +2101,8 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
key_parts->null_bit= key_part_info->null_bit;
key_parts->image_type =
(key_info->flags & HA_SPATIAL) ? Field::itMBR : Field::itRAW;
key_parts->flag= key_part_info->key_part_flag;
/* Only HA_PART_KEY_SEG is used */
key_parts->flag= (uint8) key_part_info->key_part_flag;
}
param.real_keynr[param.keys++]=idx;
}
@ -2508,7 +2509,6 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
prune_param.key= prune_param.range_param.key_parts;
SEL_TREE *tree;
SEL_ARG *arg;
int res;
tree= get_mm_tree(range_par, pprune_cond);
@ -3223,12 +3223,12 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar)
{
key_part->key= 0;
key_part->part= part;
key_part->length= (*field)->pack_length_in_rec();
key_part->length= (uint16) (*field)->pack_length_in_rec();
/*
psergey-todo: check yet again if this is correct for tricky field types,
e.g. see "Fix a fatal error in decimal key handling" in open_binary_frm()
*/
key_part->store_length= (*field)->pack_length();
key_part->store_length= (uint16) (*field)->pack_length();
if ((*field)->real_maybe_null())
key_part->store_length+= HA_KEY_NULL_LENGTH;
if ((*field)->type() == FIELD_TYPE_BLOB ||
@ -7652,7 +7652,7 @@ QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, TABLE *table,
key_part->length= key_info->key_part[part].length;
key_part->store_length= key_info->key_part[part].store_length;
key_part->null_bit= key_info->key_part[part].null_bit;
key_part->flag= key_info->key_part[part].key_part_flag;
key_part->flag= (uint8) key_info->key_part[part].key_part_flag;
}
if (insert_dynamic(&quick->ranges,(gptr)&range))
goto err;

View file

@ -248,7 +248,6 @@ bool partition_info::set_up_default_subpartitions(handler *file,
HA_CREATE_INFO *info)
{
uint i, j;
char *default_name, *name_ptr;
bool result= TRUE;
partition_element *part_elem;
List_iterator<partition_element> part_it(partitions);
@ -664,7 +663,8 @@ bool partition_info::check_list_constants()
qsort((void*)list_array, no_list_values, sizeof(LIST_PART_ENTRY),
&list_part_cmp);
i= prev_value= 0; //prev_value initialised to quiet compiler
i= 0;
LINT_INIT(prev_value);
do
{
DBUG_ASSERT(i < no_list_values);
@ -956,7 +956,6 @@ bool partition_info::set_up_charset_field_preps()
while ((field= *(ptr++)))
{
unsigned j= 0;
Field *part_field;
CHARSET_INFO *cs;
char *field_buf;
LINT_INIT(field_buf);
@ -985,7 +984,6 @@ bool partition_info::set_up_charset_field_preps()
}
if (tot_fields)
{
Field *part_field, *subpart_field;
uint j,k,l;
size= tot_fields*sizeof(char**);

View file

@ -27,7 +27,7 @@
/* Forward declarations */
class handler;
class MYSQL_BIN_LOG;
class st_table;
struct st_table;
typedef st_table TABLE;

View file

@ -3057,7 +3057,7 @@ static bool set_option_autocommit(THD *thd, set_var *var)
{
/* The test is negative as the flag we use is NOT autocommit */
ulong org_options=thd->options;
ulonglong org_options= thd->options;
if (var->save_result.ulong_value != 0)
thd->options&= ~((sys_var_thd_bit*) var->var)->bit_flag;
@ -3069,15 +3069,16 @@ static bool set_option_autocommit(THD *thd, set_var *var)
if ((org_options & OPTION_NOT_AUTOCOMMIT))
{
/* We changed to auto_commit mode */
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE |
OPTION_KEEP_LOG);
thd->options&= ~(ulonglong) (OPTION_BEGIN |
OPTION_STATUS_NO_TRANS_UPDATE |
OPTION_KEEP_LOG);
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
if (ha_commit(thd))
return 1;
}
else
{
thd->options&= ~(ulong) (OPTION_STATUS_NO_TRANS_UPDATE);
thd->options&= ~(ulonglong) (OPTION_STATUS_NO_TRANS_UPDATE);
thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
}
}
@ -3639,7 +3640,8 @@ bool sys_var_thd_table_type::update(THD *thd, set_var *var)
pointer to string with sql_mode representation
*/
byte *sys_var_thd_sql_mode::symbolic_mode_representation(THD *thd, ulong val,
byte *sys_var_thd_sql_mode::symbolic_mode_representation(THD *thd,
ulong val,
ulong *len)
{
char buff[256];
@ -3667,8 +3669,8 @@ byte *sys_var_thd_sql_mode::symbolic_mode_representation(THD *thd, ulong val,
byte *sys_var_thd_sql_mode::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
ulong val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
thd->variables.*offset);
ulonglong val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
thd->variables.*offset);
ulong length_unused;
return symbolic_mode_representation(thd, val, &length_unused);
}

View file

@ -913,7 +913,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
TABLE_LIST tables;
int error= 1;
handler *file;
ulong save_options;
ulonglong save_options;
NET *net= &mysql->net;
DBUG_ENTER("create_table_from_dump");

View file

@ -456,10 +456,14 @@ sp_head::operator delete(void *ptr, size_t size)
sp_head::sp_head()
:Query_arena(&main_mem_root, INITIALIZED_FOR_SP),
m_flags(0), m_recursion_level(0), m_next_cached_sp(0),
m_first_instance(this), m_first_free_instance(this), m_last_cached_sp(this),
m_cont_level(0)
{
const LEX_STRING str_reset= { NULL, 0 };
m_first_instance= this;
m_first_free_instance= this;
m_last_cached_sp= this;
m_return_field_def.charset = NULL;
/*
FIXME: the only use case when name is NULL is events, and it should
@ -1675,7 +1679,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
Item_null *null_item= new Item_null();
if (!null_item ||
nctx->set_variable(thd, i, (struct Item **)&null_item))
nctx->set_variable(thd, i, (Item **)&null_item))
{
err_status= TRUE;
break;
@ -2853,7 +2857,7 @@ void
sp_instr_freturn::print(String *str)
{
/* freturn type expr... */
if (str->reserve(UINT_MAX+8+32)) // Add some for the expr. too
if (str->reserve(1024+8+32)) // Add some for the expr. too
return;
str->qs_append(STRING_WITH_LEN("freturn "));
str->qs_append((uint)m_type);

View file

@ -1251,7 +1251,7 @@ void close_temporary_tables(THD *thd)
/* We always quote db,table names though it is slight overkill */
if (found_user_tables &&
!(was_quote_show= (thd->options & OPTION_QUOTE_SHOW_CREATE)))
!(was_quote_show= test(thd->options & OPTION_QUOTE_SHOW_CREATE)))
{
thd->options |= OPTION_QUOTE_SHOW_CREATE;
}

View file

@ -1302,7 +1302,6 @@ err:
bool mysql_change_db(THD *thd, const char *name, bool no_access_check)
{
int path_length;
LEX_STRING db_name;
bool system_db= 0;
#ifndef NO_EMBEDDED_ACCESS_CHECKS

View file

@ -975,7 +975,7 @@ end:
trunc_by_del:
/* Probably InnoDB table */
ulong save_options= thd->options;
ulonglong save_options= thd->options;
table_list->lock_type= TL_WRITE;
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT);
ha_enable_transaction(thd, FALSE);

View file

@ -2042,7 +2042,9 @@ err:
*/
ha_rollback_stmt(thd);
#ifndef __WIN__
end:
#endif
/*
di should be unlinked from the thread handler list and have no active
clients
@ -2698,7 +2700,7 @@ void select_insert::send_error(uint errcode,const char *err)
bool select_insert::send_eof()
{
int error,error2;
int error;
bool const trans_table= table->file->has_transactions();
ulonglong id;
DBUG_ENTER("select_insert::send_eof");
@ -2750,9 +2752,9 @@ bool select_insert::send_eof()
*/
if (trans_table || thd->current_stmt_binlog_row_based)
{
int const error2= ha_autocommit_or_rollback(thd, error);
int error2= ha_autocommit_or_rollback(thd, error);
if (error2 && !error)
error=error2;
error= error2;
}
table->file->ha_release_auto_increment();

View file

@ -423,7 +423,7 @@ protected:
TABLE *table; /* temporary table using for appending UNION results */
select_result *result;
ulong found_rows_for_union;
ulonglong found_rows_for_union;
bool res;
public:
bool prepared, // prepare phase already performed for UNION (unit)

View file

@ -5196,7 +5196,6 @@ end_with_restore_list:
break;
}
end:
thd->proc_info="query end";
/*

View file

@ -886,7 +886,6 @@ int check_signed_flag(partition_info *part_info)
bool fix_fields_part_func(THD *thd, Item* func_expr, TABLE *table,
bool is_sub_part, bool is_field_to_be_setup)
{
MEM_ROOT new_mem_root;
partition_info *part_info= table->part_info;
uint dir_length, home_dir_length;
bool result= TRUE;
@ -2002,7 +2001,7 @@ char *generate_partition_syntax(partition_info *part_info,
bool use_sql_alloc,
bool show_partition_options)
{
uint i,j, tot_no_parts, no_subparts, no_parts;
uint i,j, tot_no_parts, no_subparts;
partition_element *part_elem;
partition_element *save_part_elem= NULL;
ulonglong buffer_length;
@ -2302,10 +2301,13 @@ static uint32 get_part_id_hash(uint no_parts,
Item *part_expr,
longlong *func_value)
{
longlong int_hash_id;
DBUG_ENTER("get_part_id_hash");
*func_value= part_val_int(part_expr);
longlong int_hash_id= *func_value % no_parts;
DBUG_RETURN(int_hash_id < 0 ? -int_hash_id : int_hash_id);
int_hash_id= *func_value % no_parts;
DBUG_RETURN(int_hash_id < 0 ? (uint32) -int_hash_id : (uint32) int_hash_id);
}
@ -2358,7 +2360,7 @@ static uint32 get_part_id_key(Field **field_array,
{
DBUG_ENTER("get_part_id_key");
*func_value= calculate_key_value(field_array);
DBUG_RETURN(*func_value % no_parts);
DBUG_RETURN((uint32) (*func_value % no_parts));
}
@ -3936,7 +3938,7 @@ static int fast_end_partition(THD *thd, ulonglong copied,
(ulong) (copied + deleted),
(ulong) deleted,
(ulong) 0);
send_ok(thd,copied+deleted,0L,tmp_name);
send_ok(thd, (ha_rows) (copied+deleted),0L,tmp_name);
DBUG_RETURN(FALSE);
}
table->file->print_error(error, MYF(0));
@ -4024,7 +4026,6 @@ static bool check_native_partitioned(HA_CREATE_INFO *create_info,bool *ret_val,
handlerton *engine_type= create_info->db_type;
handlerton *old_engine_type= engine_type;
uint i= 0;
handler *file;
uint no_parts= part_info->partitions.elements;
DBUG_ENTER("check_native_partitioned");
@ -5476,7 +5477,6 @@ static void set_part_info_exec_log_entry(partition_info *part_info,
static bool write_log_drop_shadow_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
{
DDL_LOG_ENTRY ddl_log_entry;
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
DDL_LOG_MEMORY_ENTRY *exec_log_entry= NULL;
@ -5521,7 +5521,6 @@ error:
static bool write_log_rename_frm(ALTER_PARTITION_PARAM_TYPE *lpt)
{
DDL_LOG_ENTRY ddl_log_entry;
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
@ -5574,7 +5573,6 @@ error:
static bool write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
{
DDL_LOG_ENTRY ddl_log_entry;
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
@ -5688,7 +5686,6 @@ error:
static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
{
DDL_LOG_ENTRY ddl_log_entry;
partition_info *part_info= lpt->part_info;
DDL_LOG_MEMORY_ENTRY *log_entry;
DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
@ -5746,7 +5743,6 @@ static void write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt,
{
partition_info *part_info= lpt->part_info;
uint count_loop= 0;
bool not_success;
DDL_LOG_MEMORY_ENTRY *log_entry= part_info->exec_log_entry;
DBUG_ENTER("write_log_completed");
@ -7055,7 +7051,6 @@ static uint32 get_next_partition_via_walking(PARTITION_ITERATOR *part_iter)
static uint32 get_next_subpartition_via_walking(PARTITION_ITERATOR *part_iter)
{
uint32 part_id;
Field *field= part_iter->part_info->subpart_field_array[0];
if (part_iter->field_vals.cur == part_iter->field_vals.end)
{

View file

@ -727,7 +727,7 @@ void plugin_load(void)
TABLE_LIST tables;
TABLE *table;
READ_RECORD read_record_info;
int error, i;
int error;
MEM_ROOT mem;
THD *new_thd;
DBUG_ENTER("plugin_load");

View file

@ -2920,7 +2920,6 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
{
Statement stmt_backup;
Query_arena *old_stmt_arena;
Item *old_free_list;
bool error= TRUE;
statistic_increment(thd->status_var.com_stmt_execute, &LOCK_status);

View file

@ -35,7 +35,7 @@ static TABLE_LIST *reverse_table_list(TABLE_LIST *table_list);
bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
{
bool error= 1;
TABLE_LIST *ren_table= 0, *new_table;
TABLE_LIST *ren_table= 0;
int to_table;
char *rename_log_table[2]= {NULL, NULL};
int disable_logs= 0;
@ -353,7 +353,7 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
static TABLE_LIST *
rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
{
TABLE_LIST *ren_table,*new_table, *tmp_table;
TABLE_LIST *ren_table,*new_table;
DBUG_ENTER("rename_tables");

View file

@ -1991,7 +1991,7 @@ bool
mysql_select(THD *thd, Item ***rref_pointer_array,
TABLE_LIST *tables, uint wild_num, List<Item> &fields,
COND *conds, uint og_num, ORDER *order, ORDER *group,
Item *having, ORDER *proc_param, ulong select_options,
Item *having, ORDER *proc_param, ulonglong select_options,
select_result *result, SELECT_LEX_UNIT *unit,
SELECT_LEX *select_lex)
{
@ -4206,7 +4206,7 @@ choose_plan(JOIN *join, table_map join_tables)
{
uint search_depth= join->thd->variables.optimizer_search_depth;
uint prune_level= join->thd->variables.optimizer_prune_level;
bool straight_join= join->select_options & SELECT_STRAIGHT_JOIN;
bool straight_join= test(join->select_options & SELECT_STRAIGHT_JOIN);
DBUG_ENTER("choose_plan");
join->cur_embedding_map= 0;
@ -4808,8 +4808,6 @@ static void
find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
double read_time)
{
ha_rows rec;
double tmp;
THD *thd= join->thd;
if (!rest_tables)
{
@ -7149,7 +7147,6 @@ static COND *build_equal_items_for_cond(COND *cond,
Item_equal *item_equal;
uint members;
COND_EQUAL cond_equal;
COND *new_cond;
cond_equal.upper_levels= inherited;
if (cond->type() == Item::COND_ITEM)

View file

@ -696,7 +696,6 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
HA_CREATE_INFO *create_info)
{
Security_context *sctx= thd->security_ctx;
int length;
char buff[2048];
String buffer(buff, sizeof(buff), system_charset_info);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@ -1028,7 +1027,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
HA_CREATE_INFO *create_info_arg)
{
List<Item> field_list;
char tmp[MAX_FIELD_WIDTH], *for_str, buff[128], *end, uname[NAME_LEN*3+1];
char tmp[MAX_FIELD_WIDTH], *for_str, buff[128], *end;
const char *alias;
String type(tmp, sizeof(tmp), system_charset_info);
Field **ptr,*field;
@ -2752,7 +2751,6 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond)
INDEX_FIELD_VALUES idx_field_vals;
List<char> files;
char *file_name;
uint length;
bool with_i_schema;
HA_CREATE_INFO create;
TABLE *table= tables->table;
@ -3379,7 +3377,7 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
restore_record(table, s->default_values);
if (!wild || !wild[0] || !wild_compare(sp_name.ptr(), wild, 0))
{
int enum_idx= proc_table->field[5]->val_int();
int enum_idx= (int) proc_table->field[5]->val_int();
table->field[3]->store(sp_name.ptr(), sp_name.length(), cs);
get_field(thd->mem_root, proc_table->field[3], &tmp_string);
table->field[0]->store(tmp_string.ptr(), tmp_string.length(), cs);
@ -3992,7 +3990,6 @@ static int get_schema_partitions_record(THD *thd, struct st_table_list *tables,
char buff[61];
String tmp_res(buff, sizeof(buff), cs);
String tmp_str;
TIME time;
TABLE *show_table= tables->table;
handler *file;
#ifdef WITH_PARTITION_STORAGE_ENGINE
@ -4017,7 +4014,6 @@ static int get_schema_partitions_record(THD *thd, struct st_table_list *tables,
List_iterator<partition_element> part_it(part_info->partitions);
uint part_pos= 0, part_id= 0;
uint no_parts= part_info->no_parts;
handler *part_file;
restore_record(table, s->default_values);
table->field[1]->store(base_name, strlen(base_name), cs);
@ -4099,8 +4095,6 @@ static int get_schema_partitions_record(THD *thd, struct st_table_list *tables,
while ((part_elem= part_it++))
{
table->field[3]->store(part_elem->partition_name,
strlen(part_elem->partition_name), cs);
table->field[3]->set_notnull();
@ -5026,7 +5020,6 @@ static my_bool run_hton_fill_schema_files(THD *thd, st_plugin_int *plugin,
int fill_schema_files(THD *thd, TABLE_LIST *tables, COND *cond)
{
int i;
TABLE *table= tables->table;
DBUG_ENTER("fill_schema_files");

View file

@ -2011,7 +2011,7 @@ void calculate_interval_lengths(CHARSET_INFO *cs, TYPELIB *interval,
int prepare_create_field(create_field *sql_field,
uint *blob_columns,
int *timestamps, int *timestamps_with_niladic,
uint table_flags)
longlong table_flags)
{
DBUG_ENTER("prepare_field");

View file

@ -330,7 +330,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
TABLE *table= tables->table;
char file_buff[FN_REFLEN], trigname_buff[FN_REFLEN];
LEX_STRING file, trigname_file;
LEX_STRING *trg_def, *name;
LEX_STRING *trg_def;
LEX_STRING definer_user;
LEX_STRING definer_host;
ulonglong *trg_sql_mode;
@ -845,7 +845,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
DBUG_RETURN(1);
List_iterator_fast<LEX_STRING> it(triggers->definitions_list);
LEX_STRING *trg_create_str, *trg_name_str;
LEX_STRING *trg_create_str;
ulonglong *trg_sql_mode;
if (triggers->definition_modes_list.is_empty() &&
@ -962,7 +962,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
goto err_with_lex_cleanup;
}
lex.sphead->set_info(0, 0, &lex.sp_chistics, *trg_sql_mode);
lex.sphead->set_info(0, 0, &lex.sp_chistics, (ulong) *trg_sql_mode);
triggers->bodies[lex.trg_chistics.event]
[lex.trg_chistics.action_time]= lex.sphead;
@ -1283,7 +1283,6 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd,
{
char path_buff[FN_REFLEN];
LEX_STRING *def, *on_table_name, new_def;
ulonglong *sql_mode;
ulong save_sql_mode= thd->variables.sql_mode;
List_iterator_fast<LEX_STRING> it_def(definitions_list);
List_iterator_fast<LEX_STRING> it_on_table_name(on_table_names_list);
@ -1297,7 +1296,7 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd,
while ((def= it_def++))
{
on_table_name= it_on_table_name++;
thd->variables.sql_mode= *(it_mode++);
thd->variables.sql_mode= (ulong) *(it_mode++);
/* Construct CREATE TRIGGER statement with new table name. */
buff.length(0);

View file

@ -433,7 +433,9 @@ bool st_select_lex_unit::exec()
}
/* re-enabling indexes for next subselect iteration */
if (union_distinct && table->file->enable_indexes(HA_KEY_SWITCH_ALL))
{
DBUG_ASSERT(0);
}
}
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
{

View file

@ -118,7 +118,7 @@ int mysql_update(THD *thd,
enum enum_duplicates handle_duplicates, bool ignore)
{
bool using_limit= limit != HA_POS_ERROR;
bool safe_update= thd->options & OPTION_SAFE_UPDATES;
bool safe_update= test(thd->options & OPTION_SAFE_UPDATES);
bool used_key_is_modified, transactional_table, will_batch;
bool can_compare_record;
int res;

View file

@ -197,7 +197,7 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view)
lex->definer= &view->definer;
}
if (lex->create_view_algorithm == VIEW_ALGORITHM_UNDEFINED)
lex->create_view_algorithm= decoy.algorithm;
lex->create_view_algorithm= (uint8) decoy.algorithm;
if (lex->create_view_suid == VIEW_SUID_DEFAULT)
lex->create_view_suid= decoy.view_suid ?
VIEW_SUID_DEFINER : VIEW_SUID_INVOKER;
@ -675,7 +675,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
String str(buff,(uint32) sizeof(buff), system_charset_info);
char md5[MD5_BUFF_LENGTH];
bool can_be_merged;
char dir_buff[FN_REFLEN], file_buff[FN_REFLEN], path_buff[FN_REFLEN];
char dir_buff[FN_REFLEN], path_buff[FN_REFLEN];
const uchar *endp;
LEX_STRING dir, file, path;
DBUG_ENTER("mysql_register_view");
@ -1341,7 +1341,6 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
{
char path[FN_REFLEN];
TABLE_LIST *view;
frm_type_enum type;
String non_existant_views;
char *wrong_object_db= NULL, *wrong_object_name= NULL;
bool error= FALSE;
@ -1509,7 +1508,6 @@ bool check_key_in_view(THD *thd, TABLE_LIST *view)
TABLE *table;
Field_translator *trans, *end_of_trans;
KEY *key_info, *key_info_end;
uint i;
DBUG_ENTER("check_key_in_view");
/*

View file

@ -1894,7 +1894,6 @@ sp_decl:
uint num_vars= pctx->context_var_count();
enum enum_field_types var_type= (enum enum_field_types) $4;
Item *dflt_value_item= $5;
create_field *create_field_op;
if (!dflt_value_item)
{
@ -3090,7 +3089,7 @@ size_number:
real_ulong_num { $$= $1;}
| IDENT
{
ulonglong number, test_number;
ulonglong number;
uint text_shift_number= 0;
longlong prefix_number;
char *start_ptr= $1.str;
@ -3599,11 +3598,9 @@ part_bit_expr:
bit_expr
{
Item *part_expr= $1;
bool not_corr_func;
int part_expression_ok= 1;
LEX *lex= Lex;
THD *thd= YYTHD;
longlong item_value;
Name_resolution_context *context= &lex->current_select->context;
TABLE_LIST *save_list= context->table_list;
const char *save_where= thd->where;
@ -3744,11 +3741,11 @@ opt_part_option:
lex->part_info->default_engine_type= $4;
}
| NODEGROUP_SYM opt_equal real_ulong_num
{ Lex->part_info->curr_part_elem->nodegroup_id= $3; }
{ Lex->part_info->curr_part_elem->nodegroup_id= (uint16) $3; }
| MAX_ROWS opt_equal real_ulonglong_num
{ Lex->part_info->curr_part_elem->part_max_rows= $3; }
{ Lex->part_info->curr_part_elem->part_max_rows= (ha_rows) $3; }
| MIN_ROWS opt_equal real_ulonglong_num
{ Lex->part_info->curr_part_elem->part_min_rows= $3; }
{ Lex->part_info->curr_part_elem->part_min_rows= (ha_rows) $3; }
| DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
{ Lex->part_info->curr_part_elem->data_file_name= $4.str; }
| INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys

View file

@ -1031,7 +1031,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{
uint primary_key=(uint) (find_type((char*) primary_key_name,
&share->keynames, 3) - 1);
uint ha_option= handler_file->ha_table_flags();
longlong ha_option= handler_file->ha_table_flags();
keyinfo= share->key_info;
key_part= keyinfo->key_part;
@ -2078,7 +2078,6 @@ File create_frm(THD *thd, const char *name, const char *db,
HA_CREATE_INFO *create_info, uint keys)
{
register File file;
uint key_length;
ulong length;
char fill[IO_SIZE];
int create_flags= O_RDWR | O_TRUNC;

View file

@ -503,7 +503,7 @@ int azrewind (s)
if (!s->transparent) (void)inflateReset(&s->stream);
s->in = 0;
s->out = 0;
return my_seek(s->file, (int)s->start, MY_SEEK_SET, MYF(0));
return my_seek(s->file, (int)s->start, MY_SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR;
}
/* ===========================================================================
@ -568,7 +568,7 @@ my_off_t azseek (s, offset, whence)
/* For a negative seek, rewind and use positive seek */
if (offset >= s->out) {
offset -= s->out;
} else if (azrewind(s) < 0) {
} else if (azrewind(s)) {
return -1L;
}
/* offset is now the number of bytes to skip. */

View file

@ -267,9 +267,6 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
return share;
error2:
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
error:
pthread_mutex_unlock(&tina_mutex);
my_free((gptr) share, MYF(0));

View file

@ -57,7 +57,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record,
if (_mi_search_next(info,info->s->keyinfo+def->key, info->lastkey,
MI_UNIQUE_HASH_LENGTH, SEARCH_BIGGER,
info->s->state.key_root[def->key]) ||
bcmp(info->lastkey, key_buff, MI_UNIQUE_HASH_LENGTH))
bcmp((char*) info->lastkey, (char*) key_buff, MI_UNIQUE_HASH_LENGTH))
{
info->page_changed=1; /* Can't optimize read next */
info->lastpos=lastpos;

View file

@ -25,6 +25,7 @@
*/
class OutputStream {
public:
OutputStream() {}
virtual ~OutputStream() {}
virtual int print(const char * fmt, ...) = 0;
virtual int println(const char * fmt, ...) = 0;
@ -64,6 +65,7 @@ public:
class NullOutputStream : public OutputStream {
public:
NullOutputStream() {}
virtual ~NullOutputStream() {}
int print(const char * /* unused */, ...) { return 1;}
int println(const char * /* unused */, ...) { return 1;}

View file

@ -20,6 +20,7 @@
class SocketAuthenticator
{
public:
SocketAuthenticator() {}
virtual ~SocketAuthenticator() {};
virtual bool client_authenticate(int sockfd) = 0;
virtual bool server_authenticate(int sockfd) = 0;

View file

@ -65,6 +65,7 @@ struct Resource_limit
struct Pool_context
{
Pool_context() {}
class SimulatedBlock* m_block;
/**

View file

@ -1516,7 +1516,7 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)),
else
{
*error= 0;
return (ulonglong) (longlong) (long) -ul;
return (ulonglong) (longlong) -(long) ul;
}
}
else
@ -1667,7 +1667,7 @@ ret_sign:
return (ulonglong) LONGLONG_MIN;
}
*error= 0;
return (ulonglong) -ull;
return (ulonglong) -(longlong) ull;
}
else
{

View file

@ -28,7 +28,7 @@
byte *my_strchr(CHARSET_INFO *cs, const char *str, const char *end,
char c)
pchar c)
{
uint mbl;
while (str < end)