Merged from main 5.1

This commit is contained in:
unknown 2007-05-24 19:47:58 +03:00
parent 6356f5631c
commit 635728a6e6
15 changed files with 66 additions and 75 deletions

View File

@ -317,7 +317,7 @@ my_bool my_hash_insert(HASH *info,const uchar *record)
if (HASH_UNIQUE & info->flags)
{
byte *key= (byte*) hash_key(info, record, &idx, 1);
char *key= (char*) hash_key(info, record, &idx, 1);
if (hash_search(info, key, idx))
return(TRUE); /* Duplicate entry */
}
@ -542,7 +542,7 @@ my_bool hash_update(HASH *hash, uchar *record, uchar *old_key,
if (HASH_UNIQUE & hash->flags)
{
HASH_SEARCH_STATE state;
byte *found, *new_key= hash_key(hash, record, &idx, 1);
char *found, *new_key= hash_key(hash, record, &idx, 1);
if ((found= hash_first(hash, new_key, idx, &state)))
do
{

View File

@ -163,11 +163,11 @@ const char *get_type(TYPELIB *typelib, uint nr)
a integer representation of the supplied string
*/
my_ulonglong find_typeset(my_string x, TYPELIB *lib, int *err)
my_ulonglong find_typeset(char *x, TYPELIB *lib, int *err)
{
my_ulonglong result;
int find;
my_string i;
char *i;
DBUG_ENTER("find_set");
DBUG_PRINT("enter",("x: '%s' lib: 0x%lx", x, (long) lib));

View File

@ -7021,7 +7021,7 @@ Field_blob::Field_blob(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
}
void Field_blob::store_length(char *i_ptr, uint i_packlength, uint32 i_number)
void Field_blob::store_length(uchar *i_ptr, uint i_packlength, uint32 i_number)
{
switch (i_packlength) {
case 1:

View File

@ -1313,7 +1313,7 @@ public:
#ifndef WORDS_BIGENDIAN
static
#endif
void store_length(char *i_ptr, uint i_packlength, uint32 i_number);
void store_length(uchar *i_ptr, uint i_packlength, uint32 i_number);
inline void store_length(uint32 number)
{
store_length(ptr, packlength, number);
@ -1336,9 +1336,9 @@ public:
memcpy(ptr,length,packlength);
memcpy_fixed(ptr+packlength,&data,sizeof(char*));
}
void set_ptr_offset(my_ptrdiff_t ptr_diff, uint32 length,char *data)
void set_ptr_offset(my_ptrdiff_t ptr_diff, uint32 length, uchar *data)
{
char *ptr_ofs= ADD_TO_PTR(ptr,ptr_diff,char*);
uchar *ptr_ofs= ADD_TO_PTR(ptr,ptr_diff,uchar*);
store_length(ptr_ofs, packlength, length);
memcpy_fixed(ptr_ofs+packlength,&data,sizeof(char*));
}

View File

@ -1910,7 +1910,7 @@ bool ha_ndbcluster::check_all_operations_for_error(NdbTransaction *trans,
*/
static
int
check_null_in_record(const KEY* key_info, const byte *record)
check_null_in_record(const KEY* key_info, const uchar *record)
{
KEY_PART_INFO *curr_part, *end_part;
curr_part= key_info->key_part;

View File

@ -2901,7 +2901,7 @@ void in_datetime::set(uint pos,Item *item)
buff->unsigned_flag= 1L;
}
byte *in_datetime::get_value(Item *item)
uchar *in_datetime::get_value(Item *item)
{
bool is_null;
Item **tmp_item= lval_cache ? &lval_cache : &item;
@ -2909,7 +2909,7 @@ byte *in_datetime::get_value(Item *item)
if (item->null_value)
return 0;
tmp.unsigned_flag= 1L;
return (byte*) &tmp;
return (uchar*) &tmp;
}
in_double::in_double(uint elements)

View File

@ -853,7 +853,7 @@ public:
:in_longlong(elements), thd(current_thd), warn_item(warn_item_arg),
lval_cache(0) {};
void set(uint pos,Item *item);
byte *get_value(Item *item);
uchar *get_value(Item *item);
friend int cmp_longlong(void *cmp_arg, packed_longlong *a,packed_longlong *b);
};
@ -1233,10 +1233,12 @@ public:
cmp_item_row(): comparators(0), n(0) {}
~cmp_item_row();
void store_value(Item *item);
inline void alloc_comparators();
int cmp(Item *arg);
int compare(cmp_item *arg);
cmp_item *make_same();
void store_value_by_template(cmp_item *tmpl, Item *);
friend void Item_func_in::fix_length_and_dec();
};
@ -1248,6 +1250,7 @@ public:
~in_row();
void set(uint pos,Item *item);
uchar *get_value(Item *item);
friend void Item_func_in::fix_length_and_dec();
Item_result result_type() { return ROW_RESULT; }
};

View File

@ -227,7 +227,7 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
from_key+= HA_KEY_BLOB_LENGTH;
key_length-= HA_KEY_BLOB_LENGTH;
field->set_ptr_offset(to_record - field->table->record[0],
(ulong) blob_length, (char*) from_key);
(ulong) blob_length, from_key);
length= key_part->length;
}
else if (key_part->key_part_flag & HA_VAR_LENGTH_PART)
@ -239,7 +239,7 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
key_length-= HA_KEY_BLOB_LENGTH;
length= min(key_length, key_part->length);
old_map= dbug_tmp_use_all_columns(field->table, field->table->write_set);
field->set_key_image((char *) from_key, length);
field->set_key_image(from_key, length);
dbug_tmp_restore_column_map(field->table->write_set, old_map);
from_key+= HA_KEY_BLOB_LENGTH;
field->move_field_offset(-ptrdiff);

View File

@ -1863,19 +1863,6 @@ void sys_var_collation_sv::set_default(THD *thd, enum_var_type type)
}
bool sys_var_collation_server::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
global_system_variables.collation_server= var->save_result.charset;
else
{
thd->variables.collation_server= var->save_result.charset;
thd->update_charset();
}
return 0;
}
uchar *sys_var_collation_sv::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
@ -2900,7 +2887,7 @@ void set_var_free()
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint count)
{
for (; count > 0; count--, show_vars++)
if (insert_dynamic(&fixed_show_vars, (char*) show_vars))
if (insert_dynamic(&fixed_show_vars, (uchar*) show_vars))
return 1;
return 0;
}

View File

@ -915,8 +915,8 @@ class sys_var_trust_routine_creators :public sys_var_bool_ptr
{
/* We need a derived class only to have a warn_deprecated() */
public:
sys_var_event_scheduler(sys_var_chain *chain, const char *name_arg) :
sys_var_long_ptr(chain, name_arg, NULL, NULL) {};
sys_var_trust_routine_creators(sys_var_chain *chain,
const char *name_arg, my_bool *value_arg) :
sys_var_bool_ptr(chain, name_arg, value_arg) {};
void warn_deprecated(THD *thd);
void set_default(THD *thd, enum_var_type type);
@ -967,8 +967,8 @@ class sys_var_event_scheduler :public sys_var_long_ptr
{
/* We need a derived class only to have a warn_deprecated() */
public:
sys_var_event_scheduler(const char *name_arg) :
sys_var_long_ptr(name_arg, NULL, NULL) {};
sys_var_event_scheduler(sys_var_chain *chain, const char *name_arg) :
sys_var_long_ptr(chain, name_arg, NULL, NULL) {};
bool update(THD *thd, set_var *var);
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
SHOW_TYPE show_type() { return SHOW_CHAR; }

View File

@ -2060,7 +2060,7 @@ TABLE *table_cache_insert_placeholder(THD *thd, const char *key,
if (my_hash_insert(&open_cache, (uchar*)table))
{
my_free((gptr) table, MYF(0));
my_free((uchar*) table, MYF(0));
DBUG_RETURN(NULL);
}

View File

@ -177,9 +177,9 @@ public:
{ return !(plugin_var->flags & PLUGIN_VAR_THDLOCAL) && type != OPT_GLOBAL; }
bool check_update_type(Item_result type);
SHOW_TYPE show_type();
byte* real_value_ptr(THD *thd, enum_var_type type);
uchar* real_value_ptr(THD *thd, enum_var_type type);
TYPELIB* plugin_var_typelib(void);
byte* value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
uchar* value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
bool update(THD *thd, set_var *var);
@ -628,7 +628,7 @@ static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc CALLER_INFO_PROTO)
(long) current_thd, pi->name.str, pi->ref_count));
if (lex)
insert_dynamic(&lex->plugins, (gptr)&plugin);
insert_dynamic(&lex->plugins, (uchar*)&plugin);
DBUG_RETURN(plugin);
}
DBUG_RETURN(NULL);
@ -913,7 +913,7 @@ static void intern_plugin_unlock(LEX *lex, plugin_ref plugin)
if (!pi->plugin_dl)
DBUG_VOID_RETURN;
#else
my_free((gptr) plugin, MYF(MY_WME));
my_free((uchar*) plugin, MYF(MY_WME));
#endif
DBUG_PRINT("info",("unlocking plugin, name= %s, ref_count= %d",
@ -1056,12 +1056,12 @@ static uchar *get_hash_key(const uchar *buff, size_t *length,
}
static byte *get_bookmark_hash_key(const byte *buff, uint *length,
static uchar *get_bookmark_hash_key(const uchar *buff, uint *length,
my_bool not_used __attribute__((unused)))
{
struct st_bookmark *var= (st_bookmark *)buff;
*length= var->name_len + 1;
return (byte*) var->key;
return (uchar*) var->key;
}
@ -1233,13 +1233,13 @@ static bool register_builtin(struct st_mysql_plugin *plugin,
tmp->ref_count= 0;
tmp->plugin_dl= 0;
if (insert_dynamic(&plugin_array, (gptr)tmp))
if (insert_dynamic(&plugin_array, (uchar*)tmp))
DBUG_RETURN(1);
*ptr= dynamic_element(&plugin_array, plugin_array.elements - 1,
struct st_plugin_int *);
if (my_hash_insert(&plugin_hash[plugin->type],(byte*) *ptr))
if (my_hash_insert(&plugin_hash[plugin->type],(uchar*) *ptr))
DBUG_RETURN(1);
DBUG_RETURN(0);
@ -1790,7 +1790,7 @@ typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_ulonglong_t, ulonglong);
#define SET_PLUGIN_VAR_RESOLVE(opt)\
*(mysql_sys_var_ptr_p*)&((opt)->resolve)= mysql_sys_var_ptr
typedef byte *(*mysql_sys_var_ptr_p)(void* a_thd, int offset);
typedef uchar *(*mysql_sys_var_ptr_p)(void* a_thd, int offset);
/****************************************************************************
@ -2103,7 +2103,7 @@ static st_bookmark *find_bookmark(const char *plugin, const char *name,
varname[0]= flags & PLUGIN_VAR_TYPEMASK;
result= (st_bookmark*) hash_search(&bookmark_hash,
(const byte*) varname, length - 1);
(const uchar*) varname, length - 1);
my_afree(varname);
return result;
@ -2171,10 +2171,10 @@ static st_bookmark *register_var(const char *plugin, const char *name,
if (new_size > global_variables_dynamic_size)
{
global_system_variables.dynamic_variables_ptr=
global_system_variables.dynamic_variables_ptr= (char*)
my_realloc(global_system_variables.dynamic_variables_ptr, new_size,
MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
max_system_variables.dynamic_variables_ptr=
max_system_variables.dynamic_variables_ptr= (char*)
my_realloc(max_system_variables.dynamic_variables_ptr, new_size,
MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
/*
@ -2201,7 +2201,7 @@ static st_bookmark *register_var(const char *plugin, const char *name,
result->version= global_system_variables.dynamic_variables_version;
/* this should succeed because we have already checked if a dup exists */
if (my_hash_insert(&bookmark_hash, (byte*) result))
if (my_hash_insert(&bookmark_hash, (uchar*) result))
{
fprintf(stderr, "failed to add placeholder to hash");
DBUG_ASSERT(0);
@ -2218,13 +2218,13 @@ static st_bookmark *register_var(const char *plugin, const char *name,
If required, will sync with global variables if the requested variable
has not yet been allocated in the current thread.
*/
static byte *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
static uchar *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
{
DBUG_ASSERT(offset >= 0);
DBUG_ASSERT((uint)offset <= global_system_variables.dynamic_variables_head);
if (!thd)
return (byte*) global_system_variables.dynamic_variables_ptr + offset;
return (uchar*) global_system_variables.dynamic_variables_ptr + offset;
/*
dynamic_variables_head points to the largest valid offset
@ -2236,7 +2236,7 @@ static byte *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
rw_rdlock(&LOCK_system_variables_hash);
thd->variables.dynamic_variables_ptr=
thd->variables.dynamic_variables_ptr= (char*)
my_realloc(thd->variables.dynamic_variables_ptr,
global_variables_dynamic_size,
MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
@ -2294,10 +2294,10 @@ static byte *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
rw_unlock(&LOCK_system_variables_hash);
}
return (byte*)thd->variables.dynamic_variables_ptr + offset;
return (uchar*)thd->variables.dynamic_variables_ptr + offset;
}
static byte *mysql_sys_var_ptr(void* a_thd, int offset)
static uchar *mysql_sys_var_ptr(void* a_thd, int offset)
{
return intern_sys_var_ptr((THD *)a_thd, offset, true);
}
@ -2398,7 +2398,7 @@ void plugin_thdvar_cleanup(THD *thd)
{
list= ((plugin_ref*) thd->lex->plugins.buffer) + idx - 1;
DBUG_PRINT("info",("unlocking %d plugins", idx));
while ((char*) list >= thd->lex->plugins.buffer)
while ((uchar*) list >= thd->lex->plugins.buffer)
intern_plugin_unlock(NULL, *list--);
}
@ -2485,7 +2485,7 @@ SHOW_TYPE sys_var_pluginvar::show_type()
}
byte* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type)
uchar* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type)
{
DBUG_ASSERT(thd || (type == OPT_GLOBAL));
if (plugin_var->flags & PLUGIN_VAR_THDLOCAL)
@ -2495,7 +2495,7 @@ byte* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type)
return intern_sys_var_ptr(thd, *(int*) (plugin_var+1), false);
}
return *(byte**) (plugin_var+1);
return *(uchar**) (plugin_var+1);
}
@ -2517,15 +2517,15 @@ TYPELIB* sys_var_pluginvar::plugin_var_typelib(void)
}
byte* sys_var_pluginvar::value_ptr(THD *thd, enum_var_type type,
uchar* sys_var_pluginvar::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
byte* result;
uchar* result;
result= real_value_ptr(thd, type);
if ((plugin_var->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_ENUM)
result= (byte*) get_type(plugin_var_typelib(), *(ulong*)result);
result= (uchar*) get_type(plugin_var_typelib(), *(ulong*)result);
else if ((plugin_var->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_SET)
{
char buffer[STRING_BUFFER_USUAL_SIZE];
@ -2543,9 +2543,9 @@ byte* sys_var_pluginvar::value_ptr(THD *thd, enum_var_type type,
str.append(',');
}
result= (byte*) "";
result= (uchar*) "";
if (str.length())
result= (byte*) thd->strmake(str.ptr(), str.length()-1);
result= (uchar*) thd->strmake(str.ptr(), str.length()-1);
}
return result;
}
@ -2800,7 +2800,7 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
options[0].arg_type= options[1].arg_type= NO_ARG;
options[0].def_value= options[1].def_value= **enabled;
options[0].value= options[0].u_max_value=
options[1].value= options[1].u_max_value= (gptr*) (name - 1);
options[1].value= options[1].u_max_value= (uchar**) (name - 1);
options+= 2;
/*
@ -2925,7 +2925,7 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
optnamelen= namelen + optnamelen + 1;
}
else
optname= memdup_root(mem_root, v->key + 1, (optnamelen= v->name_len) + 1);
optname= (char*) memdup_root(mem_root, v->key + 1, (optnamelen= v->name_len) + 1);
/* convert '_' to '-' */
for (p= optname; *p; p++)
@ -2946,10 +2946,10 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
(opt->flags & PLUGIN_VAR_TYPEMASK) != PLUGIN_VAR_SET)
{
if (opt->flags & PLUGIN_VAR_THDLOCAL)
options->value= options->u_max_value= (gptr*)
options->value= options->u_max_value= (uchar**)
(global_system_variables.dynamic_variables_ptr + offset);
else
options->value= options->u_max_value= *(gptr**) (opt + 1);
options->value= options->u_max_value= *(uchar***) (opt + 1);
}
options[1]= options[0];
@ -3149,16 +3149,16 @@ void my_print_help_inc_plugins(my_option *main_options, uint size)
/* Only options with a non-NULL comment are displayed in help text */
for (;opt->id; opt++)
if (opt->comment)
insert_dynamic(&all_options, (gptr) opt);
insert_dynamic(&all_options, (uchar*) opt);
}
for (;main_options->id; main_options++)
insert_dynamic(&all_options, (gptr) main_options);
insert_dynamic(&all_options, (uchar*) main_options);
sort_dynamic(&all_options, (qsort_cmp) option_cmp);
/* main_options now points to the empty option terminator */
insert_dynamic(&all_options, (gptr) main_options);
insert_dynamic(&all_options, (uchar*) main_options);
my_print_help((my_option*) all_options.buffer);
my_print_variables((my_option*) all_options.buffer);

View File

@ -10190,7 +10190,8 @@ option_type_value:
else
qbuff.length= lip->tok_end - sp->m_tmp_query;
if (!(qbuff.str= alloc_root(thd->mem_root, qbuff.length + 5)))
if (!(qbuff.str= (char*) alloc_root(thd->mem_root,
qbuff.length + 5)))
MYSQL_YYABORT;
strmake(strmake(qbuff.str, "SET ", 4), sp->m_tmp_query,

View File

@ -704,7 +704,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{
LEX_STRING pname= { C_STRING_WITH_LEN( "partition" ) };
if (str_db_type_length == pname.length &&
!strncmp(next_chunk + 2, pname.str, pname.length))
!strncmp((char *) next_chunk + 2, pname.str, pname.length))
{
/*
Use partition handler

View File

@ -247,7 +247,7 @@ static st_blackhole_share *get_share(const char *table_name)
pthread_mutex_lock(&blackhole_mutex);
if (!(share= (st_blackhole_share*) hash_search(&blackhole_open_tables,
(byte*) table_name, length)))
(uchar*) table_name, length)))
{
if (!(share= (st_blackhole_share*) my_malloc(sizeof(st_blackhole_share) +
length,
@ -257,9 +257,9 @@ static st_blackhole_share *get_share(const char *table_name)
share->table_name_length= length;
strmov(share->table_name, table_name);
if (my_hash_insert(&blackhole_open_tables, (byte*) share))
if (my_hash_insert(&blackhole_open_tables, (uchar*) share))
{
my_free((gptr) share, MYF(0));
my_free((uchar*) share, MYF(0));
share= NULL;
goto error;
}
@ -277,21 +277,21 @@ static void free_share(st_blackhole_share *share)
{
pthread_mutex_lock(&blackhole_mutex);
if (!--share->use_count)
hash_delete(&blackhole_open_tables, (byte*) share);
hash_delete(&blackhole_open_tables, (uchar*) share);
pthread_mutex_unlock(&blackhole_mutex);
}
static void blackhole_free_key(st_blackhole_share *share)
{
thr_lock_delete(&share->lock);
my_free((gptr) share, MYF(0));
my_free((uchar*) share, MYF(0));
}
static byte* blackhole_get_key(st_blackhole_share *share, uint *length,
static uchar* blackhole_get_key(st_blackhole_share *share, uint *length,
my_bool not_used __attribute__((unused)))
{
*length= share->table_name_length;
return (byte*) share->table_name;
return (uchar*) share->table_name;
}
static int blackhole_init(void *p)