Move latin1 into a separarte file

This commit is contained in:
bar@bar.mysql.r18.ru 2003-01-29 17:31:20 +04:00
parent ff3eaaebe7
commit 735399a850
36 changed files with 445 additions and 245 deletions

View file

@ -135,14 +135,14 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs)
if (decimals >= NOT_FIXED_DEC)
{
sprintf(buff,"%.14g",num); // Enough for a DATETIME
return copy(buff, (uint32) strlen(buff), my_charset_latin1, cs);
return copy(buff, (uint32) strlen(buff), &my_charset_latin1, cs);
}
#ifdef HAVE_FCONVERT
int decpt,sign;
char *pos,*to;
VOID(fconvert(num,(int) decimals,&decpt,&sign,buff+1));
if (!my_isdigit(my_charset_latin1, buff[1]))
if (!my_isdigit(&my_charset_latin1, buff[1]))
{ // Nan or Inf
pos=buff+1;
if (sign)
@ -150,7 +150,7 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs)
buff[0]='-';
pos=buff;
}
return copy(pos,(uint32) strlen(pos), my_charset_latin1, cs);
return copy(pos,(uint32) strlen(pos), &my_charset_latin1, cs);
}
if (alloc((uint32) ((uint32) decpt+3+decimals)))
return TRUE;
@ -200,7 +200,7 @@ end:
#else
sprintf(buff,"%.*f",(int) decimals,num);
#endif
return copy(buff,(uint32) strlen(buff), my_charset_latin1, cs);
return copy(buff,(uint32) strlen(buff), &my_charset_latin1, cs);
#endif
}

View file

@ -164,8 +164,8 @@ typedef struct charset_info_st
} CHARSET_INFO;
extern CHARSET_INFO *my_charset_bin;
extern CHARSET_INFO *my_charset_latin1;
extern CHARSET_INFO my_charset_bin;
extern CHARSET_INFO my_charset_latin1;
extern CHARSET_INFO my_charset_big5;
extern CHARSET_INFO my_charset_czech;
extern CHARSET_INFO my_charset_euc_kr;

View file

@ -35,7 +35,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
strmake.lo strend.lo \
strnlen.lo strfill.lo is_prefix.lo \
int2str.lo str2int.lo strinstr.lo strcont.lo \
strcend.lo bcmp.lo \
strcend.lo bcmp.lo ctype-latin1.lo \
bchange.lo bmove.lo bmove_upp.lo longlong2str.lo \
strtoull.lo strtoll.lo llstr.lo my_vsnprintf.lo \
ctype.lo ctype-simple.lo ctype-bin.lo ctype-mb.lo \

View file

@ -315,8 +315,8 @@ char *get_charsets_dir(char *buf)
}
CHARSET_INFO *all_charsets[256];
CHARSET_INFO *default_charset_info = &compiled_charsets[0];
CHARSET_INFO *system_charset_info = &compiled_charsets[0];
CHARSET_INFO *default_charset_info = &my_charset_latin1;
CHARSET_INFO *system_charset_info = &my_charset_latin1;
#define MY_ADD_CHARSET(x) all_charsets[(x)->number]=(x)
@ -325,7 +325,9 @@ static my_bool init_compiled_charsets(myf flags __attribute__((unused)))
{
CHARSET_INFO *cs;
MY_ADD_CHARSET(my_charset_bin);
MY_ADD_CHARSET(&my_charset_latin1);
MY_ADD_CHARSET(&my_charset_bin);
#ifdef HAVE_CHARSET_big5
MY_ADD_CHARSET(&my_charset_big5);

View file

@ -74,7 +74,7 @@ char *argv[];
exit(status);
}
err = regcomp(&re, argv[optind++], copts, my_charset_latin1);
err = regcomp(&re, argv[optind++], copts, &my_charset_latin1);
if (err) {
len = regerror(err, &re, erbuf, sizeof(erbuf));
fprintf(stderr, "error %s, %d/%d `%s'\n",
@ -226,7 +226,7 @@ int opts; /* may not match f1 */
strcpy(f0copy, f0);
re.re_endp = (opts&REG_PEND) ? f0copy + strlen(f0copy) : NULL;
fixstr(f0copy);
err = regcomp(&re, f0copy, opts, my_charset_latin1);
err = regcomp(&re, f0copy, opts, &my_charset_latin1);
if (err != 0 && (!opt('C', f1) || err != efind(f2))) {
/* unexpected error or wrong error */
len = regerror(err, &re, erbuf, sizeof(erbuf));

View file

@ -433,7 +433,7 @@ CONVERT *get_convert_set(const char *name)
{
for (CONVERT **ptr=convert_tables ; *ptr ; ptr++)
{
if (!my_strcasecmp(my_charset_latin1,(*ptr)->name,name))
if (!my_strcasecmp(&my_charset_latin1,(*ptr)->name,name))
return (*ptr);
}
return 0;

View file

@ -34,7 +34,7 @@ static int initialized;
1 Error
*/
#define des_cs my_charset_latin1
#define des_cs &my_charset_latin1
bool
load_des_key_file(const char *file_name)

View file

@ -287,7 +287,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy)
bool Field::get_date(TIME *ltime,bool fuzzydate)
{
char buff[40];
String tmp(buff,sizeof(buff),my_charset_bin),tmp2,*res;
String tmp(buff,sizeof(buff),&my_charset_bin),tmp2,*res;
if (!(res=val_str(&tmp,&tmp2)) ||
str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE)
return 1;
@ -297,7 +297,7 @@ bool Field::get_date(TIME *ltime,bool fuzzydate)
bool Field::get_time(TIME *ltime)
{
char buff[40];
String tmp(buff,sizeof(buff),my_charset_bin),tmp2,*res;
String tmp(buff,sizeof(buff),&my_charset_bin),tmp2,*res;
if (!(res=val_str(&tmp,&tmp2)) ||
str_to_time(res->ptr(),res->length(),ltime))
return 1;
@ -311,23 +311,23 @@ void Field::store_time(TIME *ltime,timestamp_type type)
char buff[25];
switch (type) {
case TIMESTAMP_NONE:
store("",0,my_charset_bin); // Probably an error
store("",0,&my_charset_bin); // Probably an error
break;
case TIMESTAMP_DATE:
sprintf(buff,"%04d-%02d-%02d", ltime->year,ltime->month,ltime->day);
store(buff,10,my_charset_bin);
store(buff,10,&my_charset_bin);
break;
case TIMESTAMP_FULL:
sprintf(buff,"%04d-%02d-%02d %02d:%02d:%02d",
ltime->year,ltime->month,ltime->day,
ltime->hour,ltime->minute,ltime->second);
store(buff,19,my_charset_bin);
store(buff,19,&my_charset_bin);
break;
case TIMESTAMP_TIME:
{
ulong length= my_sprintf(buff, (buff, "%02d:%02d:%02d",
ltime->hour,ltime->minute,ltime->second));
store(buff,(uint) length, my_charset_bin);
store(buff,(uint) length, &my_charset_bin);
break;
}
}
@ -357,7 +357,7 @@ void Field_null::sql_type(String &res) const
void
Field_decimal::reset(void)
{
Field_decimal::store("0",1,my_charset_bin);
Field_decimal::store("0",1,&my_charset_bin);
}
void Field_decimal::overflow(bool negative)
@ -402,12 +402,12 @@ void Field_decimal::overflow(bool negative)
int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
{
char buff[80];
String tmp(buff,sizeof(buff), my_charset_bin);
String tmp(buff,sizeof(buff), &my_charset_bin);
/* Convert character set if the old one is multi byte */
if (cs->mbmaxlen > 1)
{
tmp.copy(from, len, cs, my_charset_bin);
tmp.copy(from, len, cs, &my_charset_bin);
from= tmp.ptr();
len= tmp.length();
}
@ -471,7 +471,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
tmp_dec++;
/* skip pre-space */
while (from != end && my_isspace(my_charset_bin,*from))
while (from != end && my_isspace(&my_charset_bin,*from))
from++;
if (from == end)
{
@ -508,13 +508,13 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
for (; from!=end && *from == '0'; from++) ; // Read prezeros
pre_zeros_end=int_digits_from=from;
/* Read non zero digits at the left of '.'*/
for (; from != end && my_isdigit(my_charset_bin, *from) ; from++) ;
for (; from != end && my_isdigit(&my_charset_bin, *from) ; from++) ;
int_digits_end=from;
if (from!=end && *from == '.') // Some '.' ?
from++;
frac_digits_from= from;
/* Read digits at the right of '.' */
for (;from!=end && my_isdigit(my_charset_bin, *from); from++) ;
for (;from!=end && my_isdigit(&my_charset_bin, *from); from++) ;
frac_digits_end=from;
// Some exponentiation symbol ?
if (from != end && (*from == 'e' || *from == 'E'))
@ -530,7 +530,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
exponents will become small (e.g. 1e4294967296 will become 1e0, and the
field will finally contain 1 instead of its max possible value).
*/
for (;from!=end && my_isdigit(my_charset_bin, *from); from++)
for (;from!=end && my_isdigit(&my_charset_bin, *from); from++)
{
exponent=10*exponent+(*from-'0');
if (exponent>MAX_EXPONENT)
@ -548,7 +548,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
if (current_thd->count_cuted_fields)
{
// Skip end spaces
for (;from != end && my_isspace(my_charset_bin, *from); from++) ;
for (;from != end && my_isspace(&my_charset_bin, *from); from++) ;
if (from != end) // If still something left, warn
{
current_thd->cuted_fields++;
@ -841,17 +841,17 @@ int Field_decimal::store(longlong nr)
double Field_decimal::val_real(void)
{
int not_used;
return my_strntod(my_charset_bin, ptr, field_length, NULL, &not_used);
return my_strntod(&my_charset_bin, ptr, field_length, NULL, &not_used);
}
longlong Field_decimal::val_int(void)
{
int not_used;
if (unsigned_flag)
return my_strntoull(my_charset_bin, ptr, field_length, 10, NULL,
return my_strntoull(&my_charset_bin, ptr, field_length, 10, NULL,
&not_used);
else
return my_strntoll( my_charset_bin, ptr, field_length, 10, NULL,
return my_strntoll(&my_charset_bin, ptr, field_length, 10, NULL,
&not_used);
}
@ -862,7 +862,7 @@ String *Field_decimal::val_str(String *val_buffer __attribute__((unused)),
char *str;
for (str=ptr ; *str == ' ' ; str++) ;
uint tmp_length=(uint) (str-ptr);
val_ptr->set_charset(my_charset_bin);
val_ptr->set_charset(&my_charset_bin);
if (field_length < tmp_length) // Error in data
val_ptr->length(0);
else
@ -883,9 +883,9 @@ int Field_decimal::cmp(const char *a_ptr,const char *b_ptr)
for (end=a_ptr+field_length;
a_ptr != end &&
(*a_ptr == *b_ptr ||
((my_isspace(my_charset_bin,*a_ptr) || *a_ptr == '+' ||
((my_isspace(&my_charset_bin,*a_ptr) || *a_ptr == '+' ||
*a_ptr == '0') &&
(my_isspace(my_charset_bin,*b_ptr) || *b_ptr == '+' ||
(my_isspace(&my_charset_bin,*b_ptr) || *b_ptr == '+' ||
*b_ptr == '0')));
a_ptr++,b_ptr++)
{
@ -913,7 +913,7 @@ void Field_decimal::sort_string(char *to,uint length)
char *str,*end;
for (str=ptr,end=ptr+length;
str != end &&
((my_isspace(my_charset_bin,*str) || *str == '+' ||
((my_isspace(&my_charset_bin,*str) || *str == '+' ||
*str == '0')) ;
str++)
*to++=' ';
@ -925,7 +925,7 @@ void Field_decimal::sort_string(char *to,uint length)
*to++=1; // Smaller than any number
str++;
while (str != end)
if (my_isdigit(my_charset_bin,*str))
if (my_isdigit(&my_charset_bin,*str))
*to++= (char) ('9' - *str++);
else
*to++= *str++;
@ -1103,7 +1103,7 @@ longlong Field_tiny::val_int(void)
String *Field_tiny::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
CHARSET_INFO *cs= my_charset_bin;
CHARSET_INFO *cs= &my_charset_bin;
uint length;
uint mlength=max(field_length+1,5*cs->mbmaxlen);
val_buffer->alloc(mlength);
@ -1341,7 +1341,7 @@ longlong Field_short::val_int(void)
String *Field_short::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
CHARSET_INFO *cs= my_charset_bin;
CHARSET_INFO *cs= &my_charset_bin;
uint length;
uint mlength=max(field_length+1,7*cs->mbmaxlen);
val_buffer->alloc(mlength);
@ -1586,7 +1586,7 @@ longlong Field_medium::val_int(void)
String *Field_medium::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
CHARSET_INFO *cs= my_charset_bin;
CHARSET_INFO *cs= &my_charset_bin;
uint length;
uint mlength=max(field_length+1,10*cs->mbmaxlen);
val_buffer->alloc(mlength);
@ -1816,7 +1816,7 @@ longlong Field_long::val_int(void)
String *Field_long::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
CHARSET_INFO *cs= my_charset_bin;
CHARSET_INFO *cs= &my_charset_bin;
uint length;
uint mlength=max(field_length+1,12*cs->mbmaxlen);
val_buffer->alloc(mlength);
@ -2038,7 +2038,7 @@ longlong Field_longlong::val_int(void)
String *Field_longlong::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
CHARSET_INFO *cs= my_charset_bin;
CHARSET_INFO *cs= &my_charset_bin;
uint length;
uint mlength=max(field_length+1,22*cs->mbmaxlen);
val_buffer->alloc(mlength);
@ -2844,10 +2844,10 @@ String *Field_timestamp::val_str(String *val_buffer,
if (temp == 0L)
{ /* Zero time is "000000" */
val_ptr->set("0000-00-00 00:00:00", 19, my_charset_bin);
val_ptr->set("0000-00-00 00:00:00", 19, &my_charset_bin);
return val_ptr;
}
val_buffer->set_charset(my_charset_bin); // Safety
val_buffer->set_charset(&my_charset_bin); // Safety
time_arg=(time_t) temp;
localtime_r(&time_arg,&tm_tmp);
l_time=&tm_tmp;
@ -3907,7 +3907,7 @@ int Field_string::store(double nr)
int width=min(field_length,DBL_DIG+5);
sprintf(buff,"%-*.*g",width,max(width-5,0),nr);
end=strcend(buff,' ');
return Field_string::store(buff,(uint) (end - buff), my_charset_bin);
return Field_string::store(buff,(uint) (end - buff), &my_charset_bin);
}
@ -4067,7 +4067,7 @@ int Field_varstring::store(double nr)
int width=min(field_length,DBL_DIG+5);
sprintf(buff,"%-*.*g",width,max(width-5,0),nr);
end=strcend(buff,' ');
return Field_varstring::store(buff,(uint) (end - buff), my_charset_bin);
return Field_varstring::store(buff,(uint) (end - buff), &my_charset_bin);
}

View file

@ -205,7 +205,7 @@ public:
uint fill_cache_field(struct st_cache_field *copy);
virtual bool get_date(TIME *ltime,bool fuzzydate);
virtual bool get_time(TIME *ltime);
virtual CHARSET_INFO *charset(void) const { return my_charset_bin; }
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
virtual void set_charset(CHARSET_INFO *charset) { }
friend bool reopen_table(THD *,struct st_table *,bool);
friend int cre_myisam(my_string name, register TABLE *form, uint options,
@ -943,11 +943,11 @@ public:
enum utype unireg_check_arg, const char *field_name_arg,
struct st_table *table_arg,uint blob_pack_length)
:Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
field_name_arg, table_arg, blob_pack_length,my_charset_bin) {}
field_name_arg, table_arg, blob_pack_length,&my_charset_bin) {}
Field_geom(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg,
struct st_table *table_arg)
:Field_blob(len_arg, maybe_null_arg, field_name_arg,
table_arg, my_charset_bin) {}
table_arg, &my_charset_bin) {}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY; }
enum_field_types type() const { return FIELD_TYPE_GEOMETRY;}
void sql_type(String &str) const;

View file

@ -75,7 +75,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
uchar **sort_keys;
IO_CACHE tempfile, buffpek_pointers, *selected_records_file, *outfile;
SORTPARAM param;
CHARSET_INFO *charset=my_charset_bin;
CHARSET_INFO *charset= &my_charset_bin;
DBUG_ENTER("filesort");
DBUG_EXECUTE("info",TEST_filesort(sortorder,s_length););
#ifdef SKIP_DBUG_IN_FILESORT

View file

@ -221,10 +221,10 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
/* Don't accept hostnames that starts with digits because they may be
false ip:s */
if (my_isdigit(my_charset_latin1,name[0]))
if (my_isdigit(&my_charset_latin1,name[0]))
{
char *pos;
for (pos= name+1 ; my_isdigit(my_charset_latin1,*pos); pos++) ;
for (pos= name+1 ; my_isdigit(&my_charset_latin1,*pos); pos++) ;
if (*pos == '.')
{
DBUG_PRINT("error",("mysqld doesn't accept hostnames that starts with a number followed by a '.'"));

View file

@ -115,7 +115,7 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const
bool Item::get_date(TIME *ltime,bool fuzzydate)
{
char buff[40];
String tmp(buff,sizeof(buff), my_charset_bin),*res;
String tmp(buff,sizeof(buff), &my_charset_bin),*res;
if (!(res=val_str(&tmp)) ||
str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE)
{
@ -133,7 +133,7 @@ bool Item::get_date(TIME *ltime,bool fuzzydate)
bool Item::get_time(TIME *ltime)
{
char buff[40];
String tmp(buff,sizeof(buff),my_charset_bin),*res;
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
if (!(res=val_str(&tmp)) ||
str_to_time(res->ptr(),res->length(),ltime))
{
@ -883,7 +883,7 @@ Item_varbinary::Item_varbinary(const char *str, uint str_length)
char *ptr=(char*) sql_alloc(max_length+1);
if (!ptr)
return;
str_value.set(ptr,max_length,my_charset_bin);
str_value.set(ptr,max_length,&my_charset_bin);
char *end=ptr+max_length;
if (max_length*2 != str_length)
*ptr++=char_val(*str++); // Not even, assume 0 prefix
@ -1232,7 +1232,7 @@ Item *resolve_const_item(Item *item,Item *comp_item)
if (res_type == STRING_RESULT)
{
char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff),my_charset_bin),*result;
String tmp(buff,sizeof(buff),&my_charset_bin),*result;
result=item->val_str(&tmp);
if (item->null_value)
{
@ -1287,8 +1287,8 @@ bool field_is_equal_to_item(Field *field,Item *item)
{
char item_buff[MAX_FIELD_WIDTH];
char field_buff[MAX_FIELD_WIDTH];
String item_tmp(item_buff,sizeof(item_buff),my_charset_bin),*item_result;
String field_tmp(field_buff,sizeof(field_buff),my_charset_bin);
String item_tmp(item_buff,sizeof(item_buff),&my_charset_bin),*item_result;
String field_tmp(field_buff,sizeof(field_buff),&my_charset_bin);
item_result=item->val_str(&item_tmp);
if (item->null_value)
return 1; // This must be true

View file

@ -282,7 +282,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
if (args[0]->maybe_null)
maybe_null=1;
if (args[0]->binary())
set_charset(my_charset_bin);
set_charset(&my_charset_bin);
with_sum_func= args[0]->with_sum_func;
used_tables_cache= args[0]->used_tables();
const_item_cache= args[0]->const_item();
@ -648,11 +648,11 @@ Item_func_if::fix_length_and_dec()
{
cached_result_type = STRING_RESULT;
set_charset( (args[1]->binary() || args[2]->binary()) ?
my_charset_bin : args[1]->charset());
&my_charset_bin : args[1]->charset());
}
else
{
set_charset(my_charset_bin); // Number
set_charset(&my_charset_bin); // Number
if (arg1_type == REAL_RESULT || arg2_type == REAL_RESULT)
cached_result_type = REAL_RESULT;
else
@ -1680,7 +1680,7 @@ longlong Item_func_like::val_int()
null_value=0;
if ((res->charset()->state & MY_CS_BINSORT) ||
(res2->charset()->state & MY_CS_BINSORT))
set_charset(my_charset_bin);
set_charset(&my_charset_bin);
if (canDoTurboBM)
return turboBM_matches(res->ptr(), res->length()) ? 1 : 0;
return my_wildcmp(charset(),
@ -1767,7 +1767,7 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
max_length= 1;
decimals= 0;
if (args[0]->binary() || args[1]->binary())
set_charset(my_charset_bin);
set_charset(&my_charset_bin);
used_tables_cache=args[0]->used_tables() | args[1]->used_tables();
const_item_cache=args[0]->const_item() && args[1]->const_item();

View file

@ -115,7 +115,7 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if ((*arg)->maybe_null)
maybe_null=1;
if ((*arg)->binary())
set_charset(my_charset_bin);
set_charset(&my_charset_bin);
with_sum_func= with_sum_func || (*arg)->with_sum_func;
used_tables_cache|=(*arg)->used_tables();
const_item_cache&= (*arg)->const_item();
@ -856,7 +856,7 @@ void Item_func_min_max::fix_length_and_dec()
maybe_null=0;
cmp_type=item_cmp_type(cmp_type,args[i]->result_type());
if (args[i]->binary())
set_charset(my_charset_bin);
set_charset(&my_charset_bin);
}
}
@ -1325,7 +1325,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
if ((*arg)->fix_fields(thd, tables, arg) || (*arg)->check_cols(1))
return 1;
if ((*arg)->binary())
func->set_charset(my_charset_bin);
func->set_charset(&my_charset_bin);
if ((*arg)->maybe_null)
func->maybe_null=1;
func->with_sum_func= func->with_sum_func || (*arg)->with_sum_func;
@ -1894,7 +1894,7 @@ longlong Item_func_set_last_insert_id::val_int()
longlong Item_func_benchmark::val_int()
{
char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff), my_charset_bin);
String tmp(buff,sizeof(buff), &my_charset_bin);
THD *thd=current_thd;
for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++)
@ -2040,7 +2040,7 @@ Item_func_set_user_var::update()
case STRING_RESULT:
{
char buffer[MAX_FIELD_WIDTH];
String tmp(buffer,sizeof(buffer),my_charset_bin);
String tmp(buffer,sizeof(buffer),&my_charset_bin);
(void) val_str(&tmp);
break;
}
@ -2235,7 +2235,7 @@ longlong Item_func_inet_aton::val_int()
char c = '.'; // we mark c to indicate invalid IP in case length is 0
char buff[36];
String *s,tmp(buff,sizeof(buff),my_charset_bin);
String *s,tmp(buff,sizeof(buff),&my_charset_bin);
if (!(s = args[0]->val_str(&tmp))) // If null value
goto err;
null_value=0;

View file

@ -236,7 +236,7 @@ String *Item_func_concat::val_str(String *str)
for (i=1 ; i < arg_count ; i++)
{
if (args[i]->binary())
set_charset(my_charset_bin);
set_charset(&my_charset_bin);
if (res->length() == 0)
{
if (!(res=args[i]->val_str(str)))
@ -1490,7 +1490,7 @@ String *Item_func_soundex::val_str(String *str)
{
String *res =args[0]->val_str(str);
char last_ch,ch;
CHARSET_INFO *cs=my_charset_latin1;
CHARSET_INFO *cs= &my_charset_latin1;
if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */
@ -2204,7 +2204,7 @@ String *Item_func_charset::val_str(String *str)
if ((null_value=(args[0]->null_value || !res->charset())))
return 0;
str->copy(res->charset()->name,strlen(res->charset()->name),
my_charset_latin1, thd_charset());
&my_charset_latin1, thd_charset());
return str;
}

View file

@ -526,12 +526,12 @@ public:
{
String *tmp=args[0]->val_str(a);
null_value=args[0]->null_value;
tmp->set_charset(my_charset_bin);
tmp->set_charset(&my_charset_bin);
return tmp;
}
void fix_length_and_dec()
{
set_charset(my_charset_bin);
set_charset(&my_charset_bin);
max_length=args[0]->max_length;
}
void print(String *str) { print_op(str); }
@ -547,7 +547,7 @@ public:
const char *func_name() const { return "load_file"; }
void fix_length_and_dec()
{
set_charset(my_charset_bin);
set_charset(&my_charset_bin);
maybe_null=1;
max_length=MAX_BLOB_WIDTH;
}

View file

@ -31,28 +31,28 @@
static String month_names[] =
{
String("January", my_charset_latin1),
String("February", my_charset_latin1),
String("March", my_charset_latin1),
String("April", my_charset_latin1),
String("May", my_charset_latin1),
String("June", my_charset_latin1),
String("July", my_charset_latin1),
String("August", my_charset_latin1),
String("September", my_charset_latin1),
String("October", my_charset_latin1),
String("November", my_charset_latin1),
String("December", my_charset_latin1)
String("January", &my_charset_latin1),
String("February", &my_charset_latin1),
String("March", &my_charset_latin1),
String("April", &my_charset_latin1),
String("May", &my_charset_latin1),
String("June", &my_charset_latin1),
String("July", &my_charset_latin1),
String("August", &my_charset_latin1),
String("September", &my_charset_latin1),
String("October", &my_charset_latin1),
String("November", &my_charset_latin1),
String("December", &my_charset_latin1)
};
static String day_names[] =
{
String("Monday", my_charset_latin1),
String("Tuesday", my_charset_latin1),
String("Wednesday", my_charset_latin1),
String("Thursday", my_charset_latin1),
String("Friday", my_charset_latin1),
String("Saturday", my_charset_latin1),
String("Sunday", my_charset_latin1)
String("Monday", &my_charset_latin1),
String("Tuesday", &my_charset_latin1),
String("Wednesday", &my_charset_latin1),
String("Thursday", &my_charset_latin1),
String("Friday", &my_charset_latin1),
String("Saturday", &my_charset_latin1),
String("Sunday", &my_charset_latin1)
};
/*
@ -416,7 +416,7 @@ String *Item_date::val_str(String *str)
return (String*) 0;
if (!value) // zero daynr
{
str->copy("0000-00-00",10,my_charset_latin1,thd_charset());
str->copy("0000-00-00",10,&my_charset_latin1,thd_charset());
return str;
}
@ -425,7 +425,7 @@ String *Item_date::val_str(String *str)
(int) (value/10000L) % 10000,
(int) (value/100)%100,
(int) (value%100));
str->copy(tmpbuff,10,my_charset_latin1,thd_charset());
str->copy(tmpbuff,10,&my_charset_latin1,thd_charset());
return str;
}
@ -529,7 +529,7 @@ void Item_func_now::fix_length_and_dec()
{
struct tm tm_tmp,*start;
time_t query_start=current_thd->query_start();
CHARSET_INFO *cs=my_charset_bin;
CHARSET_INFO *cs= &my_charset_bin;
decimals=0;
max_length=19*cs->mbmaxlen;
@ -595,7 +595,7 @@ String *Item_func_sec_to_time::val_str(String *str)
uint sec= (uint) ((ulonglong) seconds % 3600);
length= my_sprintf(buff,(buff,"%s%02lu:%02u:%02u",sign,(long) (seconds/3600),
sec/60, sec % 60));
str->copy(buff, length, my_charset_latin1, thd_charset());
str->copy(buff, length, &my_charset_latin1, thd_charset());
return str;
}

View file

@ -30,7 +30,7 @@
#include <stdarg.h>
#include <m_ctype.h> // For test_if_number
#define files_charset_info my_charset_latin1
#define files_charset_info &my_charset_latin1
MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log;
extern I_List<i_string> binlog_do_db, binlog_ignore_db;

View file

@ -24,7 +24,7 @@
#include <my_dir.h>
#endif /* MYSQL_CLIENT */
#define log_cs my_charset_latin1
#define log_cs &my_charset_latin1
/*****************************************************************************

View file

@ -33,7 +33,7 @@
#include <thr_alarm.h>
#include <ft_global.h>
#define mysqld_charset my_charset_latin1
#define mysqld_charset &my_charset_latin1
#ifndef DBUG_OFF
#define ONE_THREAD
@ -1937,7 +1937,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
set_var_init();
mysys_uses_curses=0;
#ifdef USE_REGEX
regex_init(my_charset_latin1);
regex_init(&my_charset_latin1);
#endif
if (set_default_charset_by_name(sys_charset.value, MYF(MY_WME)))
return 1;
@ -4736,8 +4736,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
int err;
char *end;
uint length= strlen(argument);
long value= my_strntol(my_charset_latin1, argument, length, 10, &end, &err);
if (test_if_int(argument,(uint) length, end, my_charset_latin1))
long value= my_strntol(&my_charset_latin1, argument, length, 10, &end, &err);
if (test_if_int(argument,(uint) length, end, &my_charset_latin1))
berkeley_lock_scan_time= value;
else
{

View file

@ -2794,7 +2794,7 @@ static void
print_key(KEY_PART *key_part,const char *key,uint used_length)
{
char buff[1024];
String tmp(buff,sizeof(buff),my_charset_bin);
String tmp(buff,sizeof(buff),&my_charset_bin);
for (uint length=0;
length < used_length ;

View file

@ -397,7 +397,7 @@ static ulong get_access(TABLE *form, uint fieldnr)
{
ulong access_bits=0,bit;
char buff[2];
String res(buff,sizeof(buff),my_charset_latin1);
String res(buff,sizeof(buff),&my_charset_latin1);
Field **pos;
for (pos=form->field+fieldnr, bit=1;
@ -406,7 +406,7 @@ static ulong get_access(TABLE *form, uint fieldnr)
pos++ , bit<<=1)
{
(*pos)->val_str(&res,&res);
if (my_toupper(my_charset_latin1, res[0]) == 'Y')
if (my_toupper(&my_charset_latin1, res[0]) == 'Y')
access_bits|= bit;
}
return access_bits;
@ -706,7 +706,7 @@ static void acl_update_user(const char *user, const char *host,
{
if (!acl_user->host.hostname && !host[0] ||
acl_user->host.hostname &&
!my_strcasecmp(my_charset_latin1, host, acl_user->host.hostname))
!my_strcasecmp(&my_charset_latin1, host, acl_user->host.hostname))
{
acl_user->access=privileges;
if (mqh->bits & 1)
@ -801,7 +801,7 @@ static void acl_update_db(const char *user, const char *host, const char *db,
{
if (!acl_db->host.hostname && !host[0] ||
acl_db->host.hostname &&
!my_strcasecmp(my_charset_latin1, host, acl_db->host.hostname))
!my_strcasecmp(&my_charset_latin1, host, acl_db->host.hostname))
{
if (!acl_db->db && !db[0] ||
acl_db->db && !strcmp(db,acl_db->db))
@ -865,7 +865,7 @@ ulong acl_get(const char *host, const char *ip, const char *bin_ip,
end=strmov((tmp_db=strmov(key+sizeof(struct in_addr),user)+1),db);
if (lower_case_table_names)
{
my_casedn_str(my_charset_latin1, tmp_db);
my_casedn_str(&my_charset_latin1, tmp_db);
db=tmp_db;
}
key_length=(uint) (end-key);
@ -983,7 +983,7 @@ static void init_check_host(void)
DBUG_ENTER("init_check_host");
VOID(my_init_dynamic_array(&acl_wild_hosts,sizeof(struct acl_host_and_ip),
acl_users.elements,1));
VOID(hash_init(&acl_check_hosts,my_charset_latin1,acl_users.elements,0,0,
VOID(hash_init(&acl_check_hosts,&my_charset_latin1,acl_users.elements,0,0,
(hash_get_key) check_get_key,0,HASH_CASE_INSENSITIVE));
if (!allow_all_hosts)
{
@ -999,7 +999,7 @@ static void init_check_host(void)
{ // Check if host already exists
acl_host_and_ip *acl=dynamic_element(&acl_wild_hosts,j,
acl_host_and_ip *);
if (!my_strcasecmp(my_charset_latin1,
if (!my_strcasecmp(&my_charset_latin1,
acl_user->host.hostname, acl->hostname))
break; // already stored
}
@ -1078,7 +1078,7 @@ bool check_change_password(THD *thd, const char *host, const char *user)
}
if (!thd->slave_thread &&
(strcmp(thd->user,user) ||
my_strcasecmp(my_charset_latin1, host, thd->host_or_ip)))
my_strcasecmp(&my_charset_latin1, host, thd->host_or_ip)))
{
if (check_access(thd, UPDATE_ACL, "mysql",0,1))
return(1);
@ -1242,7 +1242,7 @@ static bool compare_hostname(const acl_host_and_ip *host, const char *hostname,
return (tmp & host->ip_mask) == host->ip;
}
return (!host->hostname ||
(hostname && !wild_case_compare(my_charset_latin1,
(hostname && !wild_case_compare(&my_charset_latin1,
hostname,host->hostname)) ||
(ip && !wild_compare(ip,host->hostname)));
}
@ -1266,8 +1266,8 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
tables.db=(char*) "mysql";
if (!(table=open_ltable(thd,&tables,TL_WRITE)))
DBUG_RETURN(1); /* purecov: deadcode */
table->field[0]->store(host,(uint) strlen(host), my_charset_latin1);
table->field[1]->store(user,(uint) strlen(user), my_charset_latin1);
table->field[0]->store(host,(uint) strlen(host), &my_charset_latin1);
table->field[1]->store(user,(uint) strlen(user), &my_charset_latin1);
if (table->file->index_read_idx(table->record[0],0,
(byte*) table->field[0]->ptr,0,
@ -1277,7 +1277,7 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
DBUG_RETURN(1); /* purecov: deadcode */
}
store_record(table,1);
table->field[2]->store(new_password,(uint) strlen(new_password), my_charset_latin1);
table->field[2]->store(new_password,(uint) strlen(new_password), &my_charset_latin1);
if ((error=table->file->update_row(table->record[1],table->record[0])))
{
table->file->print_error(error,MYF(0)); /* purecov: deadcode */
@ -1344,8 +1344,8 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
password=combo.password.str;
}
table->field[0]->store(combo.host.str,combo.host.length, my_charset_latin1);
table->field[1]->store(combo.user.str,combo.user.length, my_charset_latin1);
table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1);
table->field[1]->store(combo.user.str,combo.user.length, &my_charset_latin1);
table->file->index_init(0);
if (table->file->index_read(table->record[0],
(byte*) table->field[0]->ptr,0,
@ -1366,16 +1366,16 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
}
old_row_exists = 0;
restore_record(table,2); // cp empty row from record[2]
table->field[0]->store(combo.host.str,combo.host.length, my_charset_latin1);
table->field[1]->store(combo.user.str,combo.user.length, my_charset_latin1);
table->field[2]->store(password,(uint) strlen(password), my_charset_latin1);
table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1);
table->field[1]->store(combo.user.str,combo.user.length, &my_charset_latin1);
table->field[2]->store(password,(uint) strlen(password), &my_charset_latin1);
}
else
{
old_row_exists = 1;
store_record(table,1); // Save copy for update
if (combo.password.str) // If password given
table->field[2]->store(password,(uint) strlen(password), my_charset_latin1);
table->field[2]->store(password,(uint) strlen(password), &my_charset_latin1);
}
/* Update table columns with new privileges */
@ -1388,7 +1388,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
tmp_field++, priv <<= 1)
{
if (priv & rights) // set requested privileges
(*tmp_field)->store(&what, 1, my_charset_latin1);
(*tmp_field)->store(&what, 1, &my_charset_latin1);
}
rights=get_access(table,3);
DBUG_PRINT("info",("table->fields: %d",table->fields));
@ -1397,39 +1397,39 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
/* We write down SSL related ACL stuff */
switch (thd->lex.ssl_type) {
case SSL_TYPE_ANY:
table->field[24]->store("ANY",3, my_charset_latin1);
table->field[25]->store("", 0, my_charset_latin1);
table->field[26]->store("", 0, my_charset_latin1);
table->field[27]->store("", 0, my_charset_latin1);
table->field[24]->store("ANY",3, &my_charset_latin1);
table->field[25]->store("", 0, &my_charset_latin1);
table->field[26]->store("", 0, &my_charset_latin1);
table->field[27]->store("", 0, &my_charset_latin1);
break;
case SSL_TYPE_X509:
table->field[24]->store("X509",4, my_charset_latin1);
table->field[25]->store("", 0, my_charset_latin1);
table->field[26]->store("", 0, my_charset_latin1);
table->field[27]->store("", 0, my_charset_latin1);
table->field[24]->store("X509",4, &my_charset_latin1);
table->field[25]->store("", 0, &my_charset_latin1);
table->field[26]->store("", 0, &my_charset_latin1);
table->field[27]->store("", 0, &my_charset_latin1);
break;
case SSL_TYPE_SPECIFIED:
table->field[24]->store("SPECIFIED",9, my_charset_latin1);
table->field[25]->store("", 0, my_charset_latin1);
table->field[26]->store("", 0, my_charset_latin1);
table->field[27]->store("", 0, my_charset_latin1);
table->field[24]->store("SPECIFIED",9, &my_charset_latin1);
table->field[25]->store("", 0, &my_charset_latin1);
table->field[26]->store("", 0, &my_charset_latin1);
table->field[27]->store("", 0, &my_charset_latin1);
if (thd->lex.ssl_cipher)
table->field[25]->store(thd->lex.ssl_cipher,
strlen(thd->lex.ssl_cipher), my_charset_latin1);
strlen(thd->lex.ssl_cipher), &my_charset_latin1);
if (thd->lex.x509_issuer)
table->field[26]->store(thd->lex.x509_issuer,
strlen(thd->lex.x509_issuer), my_charset_latin1);
strlen(thd->lex.x509_issuer), &my_charset_latin1);
if (thd->lex.x509_subject)
table->field[27]->store(thd->lex.x509_subject,
strlen(thd->lex.x509_subject), my_charset_latin1);
strlen(thd->lex.x509_subject), &my_charset_latin1);
break;
case SSL_TYPE_NOT_SPECIFIED:
break;
case SSL_TYPE_NONE:
table->field[24]->store("", 0, my_charset_latin1);
table->field[25]->store("", 0, my_charset_latin1);
table->field[26]->store("", 0, my_charset_latin1);
table->field[27]->store("", 0, my_charset_latin1);
table->field[24]->store("", 0, &my_charset_latin1);
table->field[25]->store("", 0, &my_charset_latin1);
table->field[26]->store("", 0, &my_charset_latin1);
table->field[27]->store("", 0, &my_charset_latin1);
break;
}
@ -1518,9 +1518,9 @@ static int replace_db_table(TABLE *table, const char *db,
DBUG_RETURN(-1);
}
table->field[0]->store(combo.host.str,combo.host.length, my_charset_latin1);
table->field[1]->store(db,(uint) strlen(db), my_charset_latin1);
table->field[2]->store(combo.user.str,combo.user.length, my_charset_latin1);
table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1);
table->field[1]->store(db,(uint) strlen(db), &my_charset_latin1);
table->field[2]->store(combo.user.str,combo.user.length, &my_charset_latin1);
table->file->index_init(0);
if (table->file->index_read(table->record[0],(byte*) table->field[0]->ptr,0,
HA_READ_KEY_EXACT))
@ -1533,9 +1533,9 @@ static int replace_db_table(TABLE *table, const char *db,
}
old_row_exists = 0;
restore_record(table,2); // cp empty row from record[2]
table->field[0]->store(combo.host.str,combo.host.length, my_charset_latin1);
table->field[1]->store(db,(uint) strlen(db), my_charset_latin1);
table->field[2]->store(combo.user.str,combo.user.length, my_charset_latin1);
table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1);
table->field[1]->store(db,(uint) strlen(db), &my_charset_latin1);
table->field[2]->store(combo.user.str,combo.user.length, &my_charset_latin1);
}
else
{
@ -1547,7 +1547,7 @@ static int replace_db_table(TABLE *table, const char *db,
for (i= 3, priv= 1; i < table->fields; i++, priv <<= 1)
{
if (priv & store_rights) // do it if priv is chosen
table->field [i]->store(&what,1, my_charset_latin1);// set requested privileges
table->field [i]->store(&what,1, &my_charset_latin1);// set requested privileges
}
rights=get_access(table,3);
rights=fix_rights_for_db(rights);
@ -1628,13 +1628,13 @@ public:
tname= strdup_root(&memex,t);
if (lower_case_table_names)
{
my_casedn_str(my_charset_latin1, db);
my_casedn_str(my_charset_latin1, tname);
my_casedn_str(&my_charset_latin1, db);
my_casedn_str(&my_charset_latin1, tname);
}
key_length =(uint) strlen(d)+(uint) strlen(u)+(uint) strlen(t)+3;
hash_key = (char*) alloc_root(&memex,key_length);
strmov(strmov(strmov(hash_key,user)+1,db)+1,tname);
(void) hash_init(&hash_columns,my_charset_latin1,
(void) hash_init(&hash_columns,&my_charset_latin1,
0,0,0, (hash_get_key) get_key_column,0,
HASH_CASE_INSENSITIVE);
}
@ -1657,8 +1657,8 @@ public:
}
if (lower_case_table_names)
{
my_casedn_str(my_charset_latin1, db);
my_casedn_str(my_charset_latin1, tname);
my_casedn_str(&my_charset_latin1, db);
my_casedn_str(&my_charset_latin1, tname);
}
key_length = ((uint) strlen(db) + (uint) strlen(user) +
(uint) strlen(tname) + 3);
@ -1669,22 +1669,22 @@ public:
privs = fix_rights_for_table(privs);
cols = fix_rights_for_column(cols);
(void) hash_init(&hash_columns,my_charset_latin1,
(void) hash_init(&hash_columns,&my_charset_latin1,
0,0,0, (hash_get_key) get_key_column,0,
HASH_CASE_INSENSITIVE);
if (cols)
{
int key_len;
col_privs->field[0]->store(host,(uint) strlen(host), my_charset_latin1);
col_privs->field[1]->store(db,(uint) strlen(db), my_charset_latin1);
col_privs->field[2]->store(user,(uint) strlen(user), my_charset_latin1);
col_privs->field[3]->store(tname,(uint) strlen(tname), my_charset_latin1);
col_privs->field[0]->store(host,(uint) strlen(host), &my_charset_latin1);
col_privs->field[1]->store(db,(uint) strlen(db), &my_charset_latin1);
col_privs->field[2]->store(user,(uint) strlen(user), &my_charset_latin1);
col_privs->field[3]->store(tname,(uint) strlen(tname), &my_charset_latin1);
key_len=(col_privs->field[0]->pack_length()+
col_privs->field[1]->pack_length()+
col_privs->field[2]->pack_length()+
col_privs->field[3]->pack_length());
key_copy(key,col_privs,0,key_len);
col_privs->field[4]->store("",0, my_charset_latin1);
col_privs->field[4]->store("",0, &my_charset_latin1);
col_privs->file->index_init(0);
if (col_privs->file->index_read(col_privs->record[0],
(byte*) col_privs->field[0]->ptr,
@ -1752,15 +1752,15 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip,
if (exact)
{
if ((host &&
!my_strcasecmp(my_charset_latin1, host, grant_table->host)) ||
!my_strcasecmp(&my_charset_latin1, host, grant_table->host)) ||
(ip && !strcmp(ip,grant_table->host)))
return grant_table;
}
else
{
if ((host && !wild_case_compare(my_charset_latin1,
if ((host && !wild_case_compare(&my_charset_latin1,
host,grant_table->host)) ||
(ip && !wild_case_compare(my_charset_latin1,
(ip && !wild_case_compare(&my_charset_latin1,
ip,grant_table->host)))
found=grant_table; // Host ok
}
@ -1788,10 +1788,10 @@ static int replace_column_table(GRANT_TABLE *g_t,
byte key[MAX_KEY_LENGTH];
DBUG_ENTER("replace_column_table");
table->field[0]->store(combo.host.str,combo.host.length, my_charset_latin1);
table->field[1]->store(db,(uint) strlen(db), my_charset_latin1);
table->field[2]->store(combo.user.str,combo.user.length, my_charset_latin1);
table->field[3]->store(table_name,(uint) strlen(table_name), my_charset_latin1);
table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1);
table->field[1]->store(db,(uint) strlen(db), &my_charset_latin1);
table->field[2]->store(combo.user.str,combo.user.length, &my_charset_latin1);
table->field[3]->store(table_name,(uint) strlen(table_name), &my_charset_latin1);
key_length=(table->field[0]->pack_length()+ table->field[1]->pack_length()+
table->field[2]->pack_length()+ table->field[3]->pack_length());
key_copy(key,table,0,key_length);
@ -1808,7 +1808,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
ulong privileges = xx->rights;
bool old_row_exists=0;
key_restore(table,key,0,key_length);
table->field[4]->store(xx->column.ptr(),xx->column.length(),my_charset_latin1);
table->field[4]->store(xx->column.ptr(),xx->column.length(),&my_charset_latin1);
if (table->file->index_read(table->record[0],(byte*) table->field[0]->ptr,
0, HA_READ_KEY_EXACT))
@ -1824,7 +1824,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
old_row_exists = 0;
restore_record(table,2); // Get empty record
key_restore(table,key,0,key_length);
table->field[4]->store(xx->column.ptr(),xx->column.length(), my_charset_latin1);
table->field[4]->store(xx->column.ptr(),xx->column.length(), &my_charset_latin1);
}
else
{
@ -1896,7 +1896,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
{
GRANT_COLUMN *grant_column = NULL;
char colum_name_buf[HOSTNAME_LENGTH+1];
String column_name(colum_name_buf,sizeof(colum_name_buf),my_charset_latin1);
String column_name(colum_name_buf,sizeof(colum_name_buf),&my_charset_latin1);
privileges&= ~rights;
table->field[6]->store((longlong)
@ -1966,10 +1966,10 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
}
restore_record(table,2); // Get empty record
table->field[0]->store(combo.host.str,combo.host.length, my_charset_latin1);
table->field[1]->store(db,(uint) strlen(db), my_charset_latin1);
table->field[2]->store(combo.user.str,combo.user.length, my_charset_latin1);
table->field[3]->store(table_name,(uint) strlen(table_name), my_charset_latin1);
table->field[0]->store(combo.host.str,combo.host.length, &my_charset_latin1);
table->field[1]->store(db,(uint) strlen(db), &my_charset_latin1);
table->field[2]->store(combo.user.str,combo.user.length, &my_charset_latin1);
table->field[3]->store(table_name,(uint) strlen(table_name), &my_charset_latin1);
store_record(table,1); // store at pos 1
if (table->file->index_read_idx(table->record[0],0,
@ -2014,7 +2014,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
}
}
table->field[4]->store(grantor,(uint) strlen(grantor), my_charset_latin1);
table->field[4]->store(grantor,(uint) strlen(grantor), &my_charset_latin1);
table->field[6]->store((longlong) store_table_rights);
table->field[7]->store((longlong) store_col_rights);
rights=fix_rights_for_table(store_table_rights);
@ -2274,7 +2274,7 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
if (lower_case_table_names && db)
{
strmov(tmp_db,db);
my_casedn_str(my_charset_latin1, tmp_db);
my_casedn_str(&my_charset_latin1, tmp_db);
db=tmp_db;
}
@ -2363,7 +2363,7 @@ my_bool grant_init(THD *org_thd)
DBUG_ENTER("grant_init");
grant_option = FALSE;
(void) hash_init(&column_priv_hash,my_charset_latin1,
(void) hash_init(&column_priv_hash,&my_charset_latin1,
0,0,0, (hash_get_key) get_grant_table,
(hash_free_key) free_grant_table,0);
init_sql_alloc(&memex,1024,0);
@ -2696,9 +2696,9 @@ bool check_grant_db(THD *thd,const char *db)
idx);
if (len < grant_table->key_length &&
!memcmp(grant_table->hash_key,helping,len) &&
(thd->host && !wild_case_compare(my_charset_latin1,
(thd->host && !wild_case_compare(&my_charset_latin1,
thd->host,grant_table->host) ||
(thd->ip && !wild_case_compare(my_charset_latin1,
(thd->ip && !wild_case_compare(&my_charset_latin1,
thd->ip,grant_table->host))))
{
error=0; // Found match
@ -2825,7 +2825,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (!(host=acl_user->host.hostname))
host="%";
if (!strcmp(lex_user->user.str,user) &&
!my_strcasecmp(my_charset_latin1, lex_user->host.str, host))
!my_strcasecmp(&my_charset_latin1, lex_user->host.str, host))
break;
}
if (counter == acl_users.elements)
@ -2835,7 +2835,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
DBUG_RETURN(-1);
}
Item_string *field=new Item_string("",0,my_charset_latin1);
Item_string *field=new Item_string("",0,&my_charset_latin1);
List<Item> field_list;
field->name=buff;
field->max_length=1024;
@ -2853,7 +2853,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
acl_user->ssl_type != SSL_TYPE_NONE)
{
want_access=acl_user->access;
String global(buff,sizeof(buff),my_charset_latin1);
String global(buff,sizeof(buff),&my_charset_latin1);
global.length(0);
global.append("GRANT ",6);
@ -2972,12 +2972,12 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
host="";
if (!strcmp(lex_user->user.str,user) &&
!my_strcasecmp(my_charset_latin1, lex_user->host.str, host))
!my_strcasecmp(&my_charset_latin1, lex_user->host.str, host))
{
want_access=acl_db->access;
if (want_access)
{
String db(buff,sizeof(buff),my_charset_latin1);
String db(buff,sizeof(buff),&my_charset_latin1);
db.length(0);
db.append("GRANT ",6);
@ -3031,12 +3031,12 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
host="";
if (!strcmp(lex_user->user.str,user) &&
!my_strcasecmp(my_charset_latin1, lex_user->host.str, host))
!my_strcasecmp(&my_charset_latin1, lex_user->host.str, host))
{
want_access=grant_table->privs;
if ((want_access | grant_table->cols) != 0)
{
String global(buff,sizeof(buff),my_charset_latin1);
String global(buff,sizeof(buff),&my_charset_latin1);
global.length(0);
global.append("GRANT ",6);

View file

@ -529,7 +529,7 @@ bool select_send::send_data(List<Item> &items)
List_iterator_fast<Item> li(items);
Protocol *protocol= thd->protocol;
char buff[MAX_FIELD_WIDTH];
String buffer(buff, sizeof(buff), my_charset_bin);
String buffer(buff, sizeof(buff), &my_charset_bin);
DBUG_ENTER("send_data");
protocol->prepare_for_resend();
@ -652,7 +652,7 @@ bool select_export::send_data(List<Item> &items)
DBUG_ENTER("send_data");
char buff[MAX_FIELD_WIDTH],null_buff[2],space[MAX_FIELD_WIDTH];
bool space_inited=0;
String tmp(buff,sizeof(buff),my_charset_bin),*res;
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
tmp.length(0);
if (unit->offset_limit_cnt)
@ -860,7 +860,7 @@ bool select_dump::send_data(List<Item> &items)
{
List_iterator_fast<Item> li(items);
char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff),my_charset_bin),*res;
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
tmp.length(0);
Item *item;
DBUG_ENTER("send_data");

View file

@ -22,7 +22,7 @@
** Get help on string
***************************************************************************/
#define help_charset my_charset_latin1
#define help_charset &my_charset_latin1
MI_INFO *open_help_file(THD *thd, const char *name)
{

View file

@ -2734,7 +2734,7 @@ mysql_execute_command(THD *thd)
if (user->password.str &&
(strcmp(thd->user,user->user.str) ||
user->host.str &&
my_strcasecmp(my_charset_latin1,
my_strcasecmp(&my_charset_latin1,
user->host.str, thd->host_or_ip)))
{
if (check_access(thd, UPDATE_ACL, "mysql",0,1))
@ -3415,7 +3415,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
/* Convert long CHAR() and VARCHAR columns to TEXT or BLOB */
new_field->sql_type= FIELD_TYPE_BLOB;
sprintf(warn_buff, ER(ER_AUTO_CONVERT), field_name, "CHAR",
(cs == my_charset_bin) ? "BLOB" : "TEXT");
(cs == &my_charset_bin) ? "BLOB" : "TEXT");
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_AUTO_CONVERT,
warn_buff);
/* fall through */

View file

@ -3819,7 +3819,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
case Item_sum::AVG_FUNC: /* Place for sum & count */
if (group)
return new Field_string(sizeof(double)+sizeof(longlong),
maybe_null, item->name,table,my_charset_bin);
maybe_null, item->name,table,&my_charset_bin);
else
return new Field_double(item_sum->max_length,maybe_null,
item->name, table, item_sum->decimals);
@ -3827,7 +3827,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
case Item_sum::STD_FUNC:
if (group)
return new Field_string(sizeof(double)*2+sizeof(longlong),
maybe_null, item->name,table,my_charset_bin);
maybe_null, item->name,table,&my_charset_bin);
else
return new Field_double(item_sum->max_length, maybe_null,
item->name,table,item_sum->decimals);
@ -4360,7 +4360,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
(uchar*) 0,
(uint) 0,
Field::NONE,
NullS, table, my_charset_bin);
NullS, table, &my_charset_bin);
key_part_info->key_type=FIELDFLAG_BINARY;
key_part_info->type= HA_KEYTYPE_BINARY;
key_part_info++;

View file

@ -124,14 +124,14 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs)
if (decimals >= NOT_FIXED_DEC)
{
sprintf(buff,"%.14g",num); // Enough for a DATETIME
return copy(buff, (uint32) strlen(buff), my_charset_latin1, cs);
return copy(buff, (uint32) strlen(buff), &my_charset_latin1, cs);
}
#ifdef HAVE_FCONVERT
int decpt,sign;
char *pos,*to;
VOID(fconvert(num,(int) decimals,&decpt,&sign,buff+1));
if (!my_isdigit(my_charset_latin1, buff[1]))
if (!my_isdigit(&my_charset_latin1, buff[1]))
{ // Nan or Inf
pos=buff+1;
if (sign)
@ -139,7 +139,7 @@ bool String::set(double num,uint decimals, CHARSET_INFO *cs)
buff[0]='-';
pos=buff;
}
return copy(pos,(uint32) strlen(pos), my_charset_latin1, cs);
return copy(pos,(uint32) strlen(pos), &my_charset_latin1, cs);
}
if (alloc((uint32) ((uint32) decpt+3+decimals)))
return TRUE;
@ -189,7 +189,7 @@ end:
#else
sprintf(buff,"%.*f",(int) decimals,num);
#endif
return copy(buff,(uint32) strlen(buff), my_charset_latin1, cs);
return copy(buff,(uint32) strlen(buff), &my_charset_latin1, cs);
#endif
}
@ -267,7 +267,7 @@ bool String::set_latin1(const char *str, uint32 arg_length)
set(str, arg_length, str_charset);
return 0;
}
return copy(str, arg_length, my_charset_latin1, str_charset);
return copy(str, arg_length, &my_charset_latin1, str_charset);
}
@ -322,7 +322,7 @@ bool String::append(const char *s,uint32 arg_length)
if (realloc(str_length+ add_length))
return TRUE;
str_length+= copy_and_convert(Ptr+str_length, add_length, str_charset,
s, arg_length, my_charset_latin1);
s, arg_length, &my_charset_latin1);
return FALSE;
}
if (realloc(str_length+arg_length))

View file

@ -573,7 +573,7 @@ multi_update::initialize_tables(JOIN *join)
/* ok to be on stack as this is not referenced outside of this func */
Field_string offset(table->file->ref_length, 0, "offset",
table, my_charset_bin);
table, &my_charset_bin);
if (temp_fields.push_front(new Item_field(((Field *) &offset))))
DBUG_RETURN(1);

View file

@ -1119,12 +1119,12 @@ type:
| char opt_binary { Lex->length=(char*) "1";
$$=FIELD_TYPE_STRING; }
| BINARY '(' NUM ')' { Lex->length=$3.str;
Lex->charset=my_charset_bin;
Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_STRING; }
| varchar '(' NUM ')' opt_binary { Lex->length=$3.str;
$$=FIELD_TYPE_VAR_STRING; }
| VARBINARY '(' NUM ')' { Lex->length=$3.str;
Lex->charset=my_charset_bin;
Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_VAR_STRING; }
| YEAR_SYM opt_len field_options { $$=FIELD_TYPE_YEAR; }
| DATE_SYM { $$=FIELD_TYPE_DATE; }
@ -1139,17 +1139,17 @@ type:
| TIMESTAMP '(' NUM ')' { Lex->length=$3.str;
$$=FIELD_TYPE_TIMESTAMP; }
| DATETIME { $$=FIELD_TYPE_DATETIME; }
| TINYBLOB { Lex->charset=my_charset_bin;
| TINYBLOB { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_TINY_BLOB; }
| BLOB_SYM opt_len { Lex->charset=my_charset_bin;
| BLOB_SYM opt_len { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_BLOB; }
| GEOMETRY_SYM { Lex->charset=my_charset_bin;
| GEOMETRY_SYM { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_GEOMETRY; }
| MEDIUMBLOB { Lex->charset=my_charset_bin;
| MEDIUMBLOB { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_MEDIUM_BLOB; }
| LONGBLOB { Lex->charset=my_charset_bin;
| LONGBLOB { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_LONG_BLOB; }
| LONG_SYM VARBINARY { Lex->charset=my_charset_bin;
| LONG_SYM VARBINARY { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_MEDIUM_BLOB; }
| LONG_SYM varchar opt_binary { $$=FIELD_TYPE_MEDIUM_BLOB; }
| TINYTEXT opt_binary { $$=FIELD_TYPE_TINY_BLOB; }
@ -1297,9 +1297,9 @@ opt_default:
opt_binary:
/* empty */ { Lex->charset=NULL; }
| ASCII_SYM { Lex->charset=my_charset_latin1; }
| BYTE_SYM { Lex->charset=my_charset_bin; }
| BINARY { Lex->charset=my_charset_bin; }
| ASCII_SYM { Lex->charset=&my_charset_latin1; }
| BYTE_SYM { Lex->charset=&my_charset_bin; }
| BINARY { Lex->charset=&my_charset_bin; }
| UNICODE_SYM
{
if (!(Lex->charset=get_charset_by_name("ucs2",MYF(0))))
@ -2087,7 +2087,7 @@ simple_expr:
{ Select->add_ftfunc_to_list((Item_func_match *)
($$=new Item_func_match_bool(*$2,$5))); }
| ASCII_SYM '(' expr ')' { $$= new Item_func_ascii($3); }
| BINARY expr %prec NEG { $$= new Item_func_set_collation($2,my_charset_bin); }
| BINARY expr %prec NEG { $$= new Item_func_set_collation($2,&my_charset_bin); }
| CAST_SYM '(' expr AS cast_type ')' { $$= create_func_cast($3, $5); }
| CASE_SYM opt_expr WHEN_SYM when_list opt_else END
{ $$= new Item_func_case(* $4, $2, $5 ); }

View file

@ -452,7 +452,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
DBUG_PRINT("enter",("str: %.*s",length,str));
// Skip garbage
for (; str != end && !my_isdigit(my_charset_latin1, *str) ; str++) ;
for (; str != end && !my_isdigit(&my_charset_latin1, *str) ; str++) ;
if (str == end)
DBUG_RETURN(TIMESTAMP_NONE);
/*
@ -460,15 +460,15 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
If length= 8 or >= 14 then year is of format YYYY.
(YYYY-MM-DD, YYYYMMDD, YYYYYMMDDHHMMSS)
*/
for (pos=str; pos != end && my_isdigit(my_charset_latin1,*pos) ; pos++) ;
for (pos=str; pos != end && my_isdigit(&my_charset_latin1,*pos) ; pos++) ;
digits= (uint) (pos-str);
year_length= (digits == 4 || digits == 8 || digits >= 14) ? 4 : 2;
field_length=year_length-1;
not_zero_date= 0;
for (i=0 ; i < 6 && str != end && my_isdigit(my_charset_latin1,*str) ; i++)
for (i=0 ; i < 6 && str != end && my_isdigit(&my_charset_latin1,*str) ; i++)
{
uint tmp_value=(uint) (uchar) (*str++ - '0');
while (str != end && my_isdigit(my_charset_latin1,str[0]) &&
while (str != end && my_isdigit(&my_charset_latin1,str[0]) &&
field_length--)
{
tmp_value=tmp_value*10 + (uint) (uchar) (*str - '0');
@ -481,11 +481,11 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
else if ( i != 5 ) // Skip inter-field delimiters
{
while (str != end &&
(my_ispunct(my_charset_latin1,*str) ||
my_isspace(my_charset_latin1,*str)))
(my_ispunct(&my_charset_latin1,*str) ||
my_isspace(&my_charset_latin1,*str)))
{
// Only allow space between days and hours
if (my_isspace(my_charset_latin1,*str) && i != 2)
if (my_isspace(&my_charset_latin1,*str) && i != 2)
DBUG_RETURN(TIMESTAMP_NONE);
str++;
}
@ -494,12 +494,12 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
}
/* Handle second fractions */
if (i == 6 && (uint) (end-str) >= 2 && *str == '.' &&
my_isdigit(my_charset_latin1,str[1]))
my_isdigit(&my_charset_latin1,str[1]))
{
str++;
uint tmp_value=(uint) (uchar) (*str - '0');
field_length=3;
while (str++ != end && my_isdigit(my_charset_latin1,str[0]) &&
while (str++ != end && my_isdigit(&my_charset_latin1,str[0]) &&
field_length--)
tmp_value=tmp_value*10 + (uint) (uchar) (*str - '0');
date[6]=tmp_value;
@ -522,7 +522,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
{
for (; str != end ; str++)
{
if (!my_isspace(my_charset_latin1, *str))
if (!my_isspace(&my_charset_latin1, *str))
{
not_zero_date= 1; // Give warning
break;
@ -537,7 +537,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
{
for (; str != end ; str++)
{
if (!my_isspace(my_charset_latin1,*str))
if (!my_isspace(&my_charset_latin1,*str))
{
current_thd->cuted_fields++;
break;
@ -599,7 +599,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
l_time->neg=0;
for (; str != end &&
!my_isdigit(my_charset_latin1,*str) && *str != '-' ; str++)
!my_isdigit(&my_charset_latin1,*str) && *str != '-' ; str++)
length--;
if (str != end && *str == '-')
{
@ -618,7 +618,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
}
/* Not a timestamp. Try to get this as a DAYS_TO_SECOND string */
for (value=0; str != end && my_isdigit(my_charset_latin1,*str) ; str++)
for (value=0; str != end && my_isdigit(&my_charset_latin1,*str) ; str++)
value=value*10L + (long) (*str - '0');
if (*str == ' ')
@ -630,7 +630,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
LINT_INIT(state);
found_days=found_hours=0;
if ((uint) (end-str) > 1 && (*str == ' ' &&
my_isdigit(my_charset_latin1,str[1])))
my_isdigit(&my_charset_latin1,str[1])))
{ // days !
date[0]=value;
state=1; // Assume next is hours
@ -638,7 +638,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
str++; // Skip space;
}
else if ((end-str) > 1 && *str == ':' &&
my_isdigit(my_charset_latin1,str[1]))
my_isdigit(&my_charset_latin1,str[1]))
{
date[0]=0; // Assume we found hours
date[1]=value;
@ -660,11 +660,11 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
/* Read hours, minutes and seconds */
for (;;)
{
for (value=0; str != end && my_isdigit(my_charset_latin1,*str) ; str++)
for (value=0; str != end && my_isdigit(&my_charset_latin1,*str) ; str++)
value=value*10L + (long) (*str - '0');
date[state++]=value;
if (state == 4 || (end-str) < 2 || *str != ':' ||
!my_isdigit(my_charset_latin1,str[1]))
!my_isdigit(&my_charset_latin1,str[1]))
break;
str++; // Skip ':'
}
@ -684,12 +684,12 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
fractional:
/* Get fractional second part */
if ((end-str) >= 2 && *str == '.' && my_isdigit(my_charset_latin1,str[1]))
if ((end-str) >= 2 && *str == '.' && my_isdigit(&my_charset_latin1,str[1]))
{
uint field_length=3;
str++; value=(uint) (uchar) (*str - '0');
while (++str != end &&
my_isdigit(my_charset_latin1,str[0]) &&
my_isdigit(&my_charset_latin1,str[0]) &&
field_length--)
value=value*10 + (uint) (uchar) (*str - '0');
date[4]=value;
@ -715,7 +715,7 @@ bool str_to_time(const char *str,uint length,TIME *l_time)
{
do
{
if (!my_isspace(my_charset_latin1,*str))
if (!my_isspace(&my_charset_latin1,*str))
{
current_thd->cuted_fields++;
break;

View file

@ -22,19 +22,19 @@ pkglib_LIBRARIES = libmystrings.a
# Exact one of ASSEMBLER_X
if ASSEMBLER_x86
ASRCS = strings-x86.s longlong2str-x86.s
CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c my_vsnprintf.c xml.c ctype-extra.c
CSRCS = bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c
else
if ASSEMBLER_sparc32
# These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile
ASRCS = bmove_upp-sparc.s strappend-sparc.s strend-sparc.s strinstr-sparc.s strmake-sparc.s strmov-sparc.s strnmov-sparc.s strstr-sparc.s
CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c my_vsnprintf.c xml.c ctype-extra.c
CSRCS = strcont.c strfill.c strcend.c is_prefix.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c strxmov.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c
else
#no assembler
ASRCS =
# These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile
CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c my_vsnprintf.c xml.c ctype-extra.c
CSRCS = strxmov.c bmove_upp.c strappend.c strcont.c strend.c strfill.c strcend.c is_prefix.c strstr.c strinstr.c strmake.c strnmov.c strmov.c longlong2str.c bfill.c bmove.c bmove512.c bchange.c strxnmov.c int2str.c str2int.c r_strinstr.c atof.c bcmp.c strtol.c strtoul.c strtoll.c strtoull.c llstr.c strnlen.c ctype.c ctype-simple.c ctype-mb.c ctype-big5.c ctype-czech.c ctype-euc_kr.c ctype-gb2312.c ctype-gbk.c ctype-latin1_de.c ctype-sjis.c ctype-tis620.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype-bin.c ctype-latin1.c my_vsnprintf.c xml.c ctype-extra.c
endif
endif

View file

@ -269,7 +269,7 @@ static int my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)),
return len;
}
static CHARSET_INFO my_charset_bin_st =
CHARSET_INFO my_charset_bin =
{
63, /* number */
MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_PRIMARY,/* state */
@ -314,6 +314,3 @@ static CHARSET_INFO my_charset_bin_st =
my_strntod_8bit,
my_scan_8bit
};
CHARSET_INFO *my_charset_bin = &my_charset_bin_st;

View file

@ -3939,5 +3939,3 @@ CHARSET_INFO compiled_charsets[] = {
NULL
}
};
CHARSET_INFO *my_charset_latin1= &compiled_charsets[0];

203
strings/ctype-latin1.c Normal file
View file

@ -0,0 +1,203 @@
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_global.h>
#include "m_string.h"
#include "m_ctype.h"
static uint16 latin1_uni[256]={
0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,
0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,
0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF
};
static uchar uni_latin1[]={
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,
0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,
0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,
0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,
0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F,
0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,
0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,
0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,
0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,
0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF};
static MY_UNI_IDX idx_uni_latin1[]={
{0x0000,0x00FF,uni_latin1},
{0,0,NULL}
};
static uchar ctype_latin1[] = {
0,
32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
132,132,132,132,132,132,132,132,132,132, 16, 16, 16, 16, 16, 16,
16,129,129,129,129,129,129, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 16, 16, 16, 16,
16,130,130,130,130,130,130, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 16, 16, 16, 16, 32,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
72, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 16, 1, 1, 1, 1, 1, 1, 1, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, 2, 2, 2
};
static uchar to_lower_latin1[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,120,121,122, 91, 92, 93, 94, 95,
96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
240,241,242,243,244,245,246,215,248,249,250,251,252,253,254,223,
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
};
static uchar to_upper_latin1[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127,
128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
208,209,210,211,212,213,214,247,216,217,218,219,220,221,222,255
};
static uchar sort_order_latin1[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127,
128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
65, 65, 65, 65, 92, 91, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73,
68, 78, 79, 79, 79, 79, 93,215,216, 85, 85, 85, 89, 89,222,223,
65, 65, 65, 65, 92, 91, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73,
68, 78, 79, 79, 79, 79, 93,247,216, 85, 85, 85, 89, 89,222,255
};
CHARSET_INFO my_charset_latin1 =
{
8, /* number */
MY_CS_COMPILED, /* state */
"latin1", /* cs name */
"latin1", /* name */
"", /* comment */
ctype_latin1,
to_lower_latin1,
to_upper_latin1,
sort_order_latin1,
latin1_uni, /* tab_to_uni */
idx_uni_latin1, /* tab_from_uni */
2, /* strxfrm_multiply */
my_strnncoll_simple,
my_strnxfrm_simple,
my_like_range_simple,
my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */
NULL, /* ismbchar */
NULL, /* ismbhead */
NULL, /* mbcharlen */
my_mb_wc_8bit, /* mb_wc */
my_wc_mb_8bit, /* wc_mb */
my_caseup_str_8bit,
my_casedn_str_8bit,
my_caseup_8bit,
my_casedn_8bit,
NULL, /* tosort */
my_strcasecmp_8bit,
my_strncasecmp_8bit,
my_hash_caseup_simple,
my_hash_sort_simple,
0,
my_snprintf_8bit,
my_long10_to_str_8bit,
my_longlong10_to_str_8bit,
my_fill_8bit,
my_strntol_8bit,
my_strntoul_8bit,
my_strntoll_8bit,
my_strntoull_8bit,
my_strntod_8bit,
my_scan_8bit
};

View file

@ -65,7 +65,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
length= num_state= pre_zero= 0;
for (;; fmt++)
{
if (my_isdigit(my_charset_latin1,*fmt))
if (my_isdigit(&my_charset_latin1,*fmt))
{
if (!num_state)
{

View file

@ -98,7 +98,7 @@ char *str2int(register const char *src, register int radix, long int lower,
converted value (and the scale!) as *negative* numbers,
so the sign is the opposite of what you might expect.
*/
while (my_isspace(my_charset_latin1,*src)) src++;
while (my_isspace(&my_charset_latin1,*src)) src++;
sign = -1;
if (*src == '+') src++; else
if (*src == '-') src++, sign = 1;