mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-9665 Remove cs->cset->ismbchar()
Using a more powerfull cs->cset->charlen() instead.
This commit is contained in:
parent
dc08ccab42
commit
e09299511e
20 changed files with 83 additions and 188 deletions
|
@ -400,7 +400,6 @@ struct my_charset_handler_st
|
|||
{
|
||||
my_bool (*init)(struct charset_info_st *, MY_CHARSET_LOADER *loader);
|
||||
/* Multibyte routines */
|
||||
uint (*ismbchar)(CHARSET_INFO *, const char *, const char *);
|
||||
uint (*mbcharlen)(CHARSET_INFO *, uint c);
|
||||
size_t (*numchars)(CHARSET_INFO *, const char *b, const char *e);
|
||||
size_t (*charpos)(CHARSET_INFO *, const char *b, const char *e,
|
||||
|
@ -972,8 +971,42 @@ size_t my_convert_fix(CHARSET_INFO *dstcs, char *dst, size_t dst_length,
|
|||
#define my_strcasecmp(s, a, b) ((s)->coll->strcasecmp((s), (a), (b)))
|
||||
#define my_charpos(cs, b, e, num) (cs)->cset->charpos((cs), (const char*) (b), (const char *)(e), (num))
|
||||
|
||||
#define use_mb(s) ((s)->cset->ismbchar != NULL)
|
||||
#define my_ismbchar(s, a, b) ((s)->cset->ismbchar((s), (a), (b)))
|
||||
#define use_mb(s) ((s)->mbmaxlen > 1)
|
||||
/**
|
||||
Detect if the leftmost character in a string is a valid multi-byte character
|
||||
and return its length, or return 0 otherwise.
|
||||
@param cs - character set
|
||||
@param str - the beginning of the string
|
||||
@param end - the string end (the next byte after the string)
|
||||
@return >0, for a multi-byte character
|
||||
@rerurn 0, for a single byte character, broken sequence, empty string.
|
||||
*/
|
||||
static inline
|
||||
uint my_ismbchar(CHARSET_INFO *cs, const char *str, const char *end)
|
||||
{
|
||||
int char_length= (cs->cset->charlen)(cs, (const uchar *) str,
|
||||
(const uchar *) end);
|
||||
return char_length > 1 ? (uint) char_length : 0U;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Return length of the leftmost character in a string.
|
||||
@param cs - character set
|
||||
@param str - the beginning of the string
|
||||
@param end - the string end (the next byte after the string)
|
||||
@return <=0 on errors (EOL, wrong byte sequence)
|
||||
@return 1 on a single byte character
|
||||
@return >1 on a multi-byte character
|
||||
|
||||
Note, inlike my_ismbchar(), 1 is returned for a single byte character.
|
||||
*/
|
||||
static inline
|
||||
uint my_charlen(CHARSET_INFO *cs, const char *str, const char *end)
|
||||
{
|
||||
return (cs->cset->charlen)(cs, (const uchar *) str,
|
||||
(const uchar *) end);
|
||||
}
|
||||
#ifdef USE_MB
|
||||
#define my_mbcharlen(s, a) ((s)->cset->mbcharlen((s),(a)))
|
||||
#else
|
||||
|
|
|
@ -5437,8 +5437,7 @@ String_copier_for_item::copy_with_warn(CHARSET_INFO *dstcs, String *dst,
|
|||
if (const char *pos= cannot_convert_error_pos())
|
||||
{
|
||||
char buf[16];
|
||||
int mblen= srccs->cset->charlen(srccs, (const uchar *) pos,
|
||||
(const uchar *) src + src_length);
|
||||
int mblen= my_charlen(srccs, pos, src + src_length);
|
||||
DBUG_ASSERT(mblen > 0 && mblen * 2 + 1 <= (int) sizeof(buf));
|
||||
octet2hex(buf, pos, mblen);
|
||||
push_warning_printf(m_thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
|
|
|
@ -1406,28 +1406,22 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd)
|
|||
if (use_mb(cs))
|
||||
{
|
||||
result_state= IDENT_QUOTED;
|
||||
if (my_mbcharlen(cs, lip->yyGetLast()) > 1)
|
||||
int char_length= my_charlen(cs, lip->get_ptr() - 1,
|
||||
lip->get_end_of_query());
|
||||
if (char_length <= 0)
|
||||
{
|
||||
int l = my_ismbchar(cs,
|
||||
lip->get_ptr() -1,
|
||||
lip->get_end_of_query());
|
||||
if (l == 0) {
|
||||
state = MY_LEX_CHAR;
|
||||
continue;
|
||||
}
|
||||
lip->skip_binary(l - 1);
|
||||
state= MY_LEX_CHAR;
|
||||
continue;
|
||||
}
|
||||
lip->skip_binary(char_length - 1);
|
||||
|
||||
while (ident_map[c=lip->yyGet()])
|
||||
{
|
||||
if (my_mbcharlen(cs, c) > 1)
|
||||
{
|
||||
int l;
|
||||
if ((l = my_ismbchar(cs,
|
||||
lip->get_ptr() -1,
|
||||
lip->get_end_of_query())) == 0)
|
||||
break;
|
||||
lip->skip_binary(l-1);
|
||||
}
|
||||
char_length= my_charlen(cs, lip->get_ptr() - 1,
|
||||
lip->get_end_of_query());
|
||||
if (char_length <= 0)
|
||||
break;
|
||||
lip->skip_binary(char_length - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1568,15 +1562,11 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd)
|
|||
result_state= IDENT_QUOTED;
|
||||
while (ident_map[c=lip->yyGet()])
|
||||
{
|
||||
if (my_mbcharlen(cs, c) > 1)
|
||||
{
|
||||
int l;
|
||||
if ((l = my_ismbchar(cs,
|
||||
lip->get_ptr() -1,
|
||||
lip->get_end_of_query())) == 0)
|
||||
break;
|
||||
lip->skip_binary(l-1);
|
||||
}
|
||||
int char_length= my_charlen(cs, lip->get_ptr() - 1,
|
||||
lip->get_end_of_query());
|
||||
if (char_length <= 0)
|
||||
break;
|
||||
lip->skip_binary(char_length - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1604,8 +1594,9 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd)
|
|||
char quote_char= c; // Used char
|
||||
while ((c=lip->yyGet()))
|
||||
{
|
||||
int var_length;
|
||||
if ((var_length= my_mbcharlen(cs, c)) == 1)
|
||||
int var_length= my_charlen(cs, lip->get_ptr() - 1,
|
||||
lip->get_end_of_query());
|
||||
if (var_length == 1)
|
||||
{
|
||||
if (c == quote_char)
|
||||
{
|
||||
|
@ -1617,11 +1608,9 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd)
|
|||
}
|
||||
}
|
||||
#ifdef USE_MB
|
||||
else if (use_mb(cs))
|
||||
else if (var_length > 1)
|
||||
{
|
||||
if ((var_length= my_ismbchar(cs, lip->get_ptr() - 1,
|
||||
lip->get_end_of_query())))
|
||||
lip->skip_binary(var_length-1);
|
||||
lip->skip_binary(var_length - 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1431,14 +1431,13 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild)
|
|||
|
||||
static const char *require_quotes(const char *name, uint name_length)
|
||||
{
|
||||
uint length;
|
||||
bool pure_digit= TRUE;
|
||||
const char *end= name + name_length;
|
||||
|
||||
for (; name < end ; name++)
|
||||
{
|
||||
uchar chr= (uchar) *name;
|
||||
length= my_mbcharlen(system_charset_info, chr);
|
||||
int length= my_charlen(system_charset_info, name, end);
|
||||
if (length == 1 && !system_charset_info->ident_map[chr])
|
||||
return name;
|
||||
if (length == 1 && (chr < '0' || chr > '9'))
|
||||
|
@ -1496,24 +1495,25 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
|
|||
if (packet->append("e_char, 1, quote_charset))
|
||||
return true;
|
||||
|
||||
for (name_end= name+length ; name < name_end ; name+= length)
|
||||
for (name_end= name+length ; name < name_end ; )
|
||||
{
|
||||
uchar chr= (uchar) *name;
|
||||
length= my_mbcharlen(system_charset_info, chr);
|
||||
int char_length= my_charlen(system_charset_info, name, name_end);
|
||||
/*
|
||||
my_mbcharlen can return 0 on a wrong multibyte
|
||||
charlen can return 0 and negative numbers on a wrong multibyte
|
||||
sequence. It is possible when upgrading from 4.0,
|
||||
and identifier contains some accented characters.
|
||||
The manual says it does not work. So we'll just
|
||||
change length to 1 not to hang in the endless loop.
|
||||
change char_length to 1 not to hang in the endless loop.
|
||||
*/
|
||||
if (!length)
|
||||
length= 1;
|
||||
if (length == 1 && chr == (uchar) quote_char &&
|
||||
if (char_length <= 0)
|
||||
char_length= 1;
|
||||
if (char_length == 1 && chr == (uchar) quote_char &&
|
||||
packet->append("e_char, 1, quote_charset))
|
||||
return true;
|
||||
if (packet->append(name, length, system_charset_info))
|
||||
if (packet->append(name, char_length, system_charset_info))
|
||||
return true;
|
||||
name+= char_length;
|
||||
}
|
||||
return packet->append("e_char, 1, quote_charset);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ static char* add_identifier(THD* thd, char *to_p, const char * end_p,
|
|||
{
|
||||
uint res;
|
||||
uint errors;
|
||||
const char *conv_name;
|
||||
const char *conv_name, *conv_name_end;
|
||||
char tmp_name[FN_REFLEN];
|
||||
char conv_string[FN_REFLEN];
|
||||
int quote;
|
||||
|
@ -111,11 +111,13 @@ static char* add_identifier(THD* thd, char *to_p, const char * end_p,
|
|||
{
|
||||
DBUG_PRINT("error", ("strconvert of '%s' failed with %u (errors: %u)", conv_name, res, errors));
|
||||
conv_name= name;
|
||||
conv_name_end= name + name_len;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBUG_PRINT("info", ("conv '%s' -> '%s'", conv_name, conv_string));
|
||||
conv_name= conv_string;
|
||||
conv_name_end= conv_string + res;
|
||||
}
|
||||
|
||||
quote = thd ? get_quote_char_for_identifier(thd, conv_name, res - 1) : '"';
|
||||
|
@ -125,8 +127,8 @@ static char* add_identifier(THD* thd, char *to_p, const char * end_p,
|
|||
*(to_p++)= (char) quote;
|
||||
while (*conv_name && (end_p - to_p - 1) > 0)
|
||||
{
|
||||
uint length= my_mbcharlen(system_charset_info, *conv_name);
|
||||
if (!length)
|
||||
int length= my_charlen(system_charset_info, conv_name, conv_name_end);
|
||||
if (length <= 0)
|
||||
length= 1;
|
||||
if (length == 1 && *conv_name == (char) quote)
|
||||
{
|
||||
|
|
|
@ -862,12 +862,12 @@ my_strnxfrm_big5(CHARSET_INFO *cs,
|
|||
|
||||
for (; dst < de && src < se && nweights; nweights--)
|
||||
{
|
||||
if (cs->cset->ismbchar(cs, (const char*) src, (const char*) se))
|
||||
if (my_charlen(cs, src, se) > 1)
|
||||
{
|
||||
/*
|
||||
Note, it is safe not to check (src < se)
|
||||
in the code below, because ismbchar() would
|
||||
not return TRUE if src was too short
|
||||
in the code below, because my_charlen() would
|
||||
not return 2 if src was too short
|
||||
*/
|
||||
uint16 e= big5strokexfrm((uint16) big5code(*src, *(src + 1)));
|
||||
*dst++= big5head(e);
|
||||
|
@ -930,13 +930,6 @@ static int my_strxfrm_big5(uchar *dest, const uchar *src, int len)
|
|||
#endif
|
||||
|
||||
|
||||
static uint ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char* p, const char *e)
|
||||
{
|
||||
return (isbig5head(*(p)) && (e)-(p)>1 && isbig5tail(*((p)+1))? 2: 0);
|
||||
}
|
||||
|
||||
|
||||
static uint mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
|
||||
{
|
||||
return (isbig5head(c)? 2 : 1);
|
||||
|
@ -6818,7 +6811,6 @@ static MY_COLLATION_HANDLER my_collation_handler_big5_bin=
|
|||
static MY_CHARSET_HANDLER my_charset_big5_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
ismbchar_big5,
|
||||
mbcharlen_big5,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
|
@ -521,7 +521,6 @@ static MY_COLLATION_HANDLER my_collation_binary_handler =
|
|||
static MY_CHARSET_HANDLER my_charset_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
NULL, /* ismbchar */
|
||||
my_mbcharlen_8bit, /* mbcharlen */
|
||||
my_numchars_8bit,
|
||||
my_charpos_8bit,
|
||||
|
|
|
@ -191,12 +191,6 @@ static const uchar sort_order_cp932[]=
|
|||
#include "ctype-mb.ic"
|
||||
|
||||
|
||||
static uint ismbchar_cp932(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char* p, const char *e)
|
||||
{
|
||||
return (iscp932head((uchar) *p) && (e-p)>1 && iscp932tail((uchar)p[1]) ? 2: 0);
|
||||
}
|
||||
|
||||
static uint mbcharlen_cp932(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (iscp932head((uchar) c) ? 2 : 1);
|
||||
|
@ -34693,7 +34687,6 @@ static MY_COLLATION_HANDLER my_collation_handler_cp932_bin=
|
|||
static MY_CHARSET_HANDLER my_charset_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
ismbchar_cp932,
|
||||
mbcharlen_cp932,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
|
@ -210,14 +210,6 @@ static const uchar sort_order_euc_kr[]=
|
|||
#include "ctype-mb.ic"
|
||||
|
||||
|
||||
static uint ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char* p, const char *e)
|
||||
{
|
||||
return ((*(uchar*)(p)<0x80)? 0:\
|
||||
iseuc_kr_head(*(p)) && (e)-(p)>1 && iseuc_kr_tail(*((p)+1))? 2:\
|
||||
0);
|
||||
}
|
||||
|
||||
static uint mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (iseuc_kr_head(c) ? 2 : 1);
|
||||
|
@ -9987,7 +9979,6 @@ static MY_COLLATION_HANDLER my_collation_handler_euckr_bin=
|
|||
static MY_CHARSET_HANDLER my_charset_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
ismbchar_euc_kr,
|
||||
mbcharlen_euc_kr,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
|
@ -220,16 +220,6 @@ static const uchar sort_order_eucjpms[]=
|
|||
#include "strcoll.ic"
|
||||
|
||||
|
||||
static uint ismbchar_eucjpms(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char* p, const char *e)
|
||||
{
|
||||
return ((*(uchar*)(p)<0x80)? 0:\
|
||||
iseucjpms(*(p)) && (e)-(p)>1 && iseucjpms(*((p)+1))? 2:\
|
||||
iseucjpms_ss2(*(p)) && (e)-(p)>1 && iskata(*((p)+1))? 2:\
|
||||
iseucjpms_ss3(*(p)) && (e)-(p)>2 && iseucjpms(*((p)+1)) && iseucjpms(*((p)+2))? 3:\
|
||||
0);
|
||||
}
|
||||
|
||||
static uint mbcharlen_eucjpms(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (iseucjpms(c)? 2: iseucjpms_ss2(c)? 2: iseucjpms_ss3(c)? 3: 1);
|
||||
|
@ -67520,7 +67510,6 @@ static MY_COLLATION_HANDLER my_collation_eucjpms_bin_handler =
|
|||
static MY_CHARSET_HANDLER my_charset_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
ismbchar_eucjpms,
|
||||
mbcharlen_eucjpms,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
|
@ -173,12 +173,6 @@ static const uchar sort_order_gb2312[]=
|
|||
#include "ctype-mb.ic"
|
||||
|
||||
|
||||
static uint ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char* p, const char *e)
|
||||
{
|
||||
return (isgb2312head(*(p)) && (e)-(p)>1 && isgb2312tail(*((p)+1))? 2: 0);
|
||||
}
|
||||
|
||||
static uint mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (isgb2312head(c)? 2 : 1);
|
||||
|
@ -6391,7 +6385,6 @@ static MY_COLLATION_HANDLER my_collation_handler_gb2312_bin=
|
|||
static MY_CHARSET_HANDLER my_charset_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
ismbchar_gb2312,
|
||||
mbcharlen_gb2312,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
|
@ -3463,12 +3463,12 @@ my_strnxfrm_gbk(CHARSET_INFO *cs,
|
|||
|
||||
for (; dst < de && src < se && nweights; nweights--)
|
||||
{
|
||||
if (cs->cset->ismbchar(cs, (const char*) src, (const char*) se))
|
||||
if (my_charlen(cs, src, se) > 1)
|
||||
{
|
||||
/*
|
||||
Note, it is safe not to check (src < se)
|
||||
in the code below, because ismbchar() would
|
||||
not return TRUE if src was too short
|
||||
in the code below, because my_charlen() would
|
||||
not return 2 if src was too short
|
||||
*/
|
||||
uint16 e= gbksortorder((uint16) gbkcode(*src, *(src + 1)));
|
||||
*dst++= gbkhead(e);
|
||||
|
@ -3483,12 +3483,6 @@ my_strnxfrm_gbk(CHARSET_INFO *cs,
|
|||
}
|
||||
|
||||
|
||||
static uint ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char* p, const char *e)
|
||||
{
|
||||
return (isgbkhead(*(p)) && (e)-(p)>1 && isgbktail(*((p)+1))? 2: 0);
|
||||
}
|
||||
|
||||
static uint mbcharlen_gbk(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (isgbkhead(c)? 2 : 1);
|
||||
|
@ -10703,7 +10697,6 @@ static MY_COLLATION_HANDLER my_collation_handler_gbk_bin=
|
|||
static MY_CHARSET_HANDLER my_charset_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
ismbchar_gbk,
|
||||
mbcharlen_gbk,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
|
@ -396,7 +396,6 @@ int my_wc_mb_latin1(CHARSET_INFO *cs __attribute__((unused)),
|
|||
static MY_CHARSET_HANDLER my_charset_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
NULL,
|
||||
my_mbcharlen_8bit,
|
||||
my_numchars_8bit,
|
||||
my_charpos_8bit,
|
||||
|
|
|
@ -668,7 +668,7 @@ my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
|||
*/
|
||||
#define my_strnxfrm_mb_non_ascii_char(cs, dst, src, se) \
|
||||
{ \
|
||||
switch (cs->cset->ismbchar(cs, (const char*) src, (const char*) se)) { \
|
||||
switch (my_ismbchar(cs, src, se)) { \
|
||||
case 4: \
|
||||
*dst++= *src++; \
|
||||
/* fall through */ \
|
||||
|
@ -740,8 +740,7 @@ my_strnxfrm_mb(CHARSET_INFO *cs,
|
|||
for (; src < se && nweights && dst < de; nweights--)
|
||||
{
|
||||
int chlen;
|
||||
if (*src < 128 ||
|
||||
!(chlen= cs->cset->ismbchar(cs, (const char*) src, (const char*) se)))
|
||||
if (*src < 128 || !(chlen= my_ismbchar(cs, src, se)))
|
||||
{
|
||||
/* Single byte character */
|
||||
*dst++= sort_order ? sort_order[*src++] : *src++;
|
||||
|
|
|
@ -1926,7 +1926,6 @@ my_strxfrm_pad_desc_and_reverse(CHARSET_INFO *cs,
|
|||
MY_CHARSET_HANDLER my_charset_8bit_handler=
|
||||
{
|
||||
my_cset_init_8bit,
|
||||
NULL, /* ismbchar */
|
||||
my_mbcharlen_8bit, /* mbcharlen */
|
||||
my_numchars_8bit,
|
||||
my_charpos_8bit,
|
||||
|
|
|
@ -192,12 +192,6 @@ static const uchar sort_order_sjis[]=
|
|||
#include "ctype-mb.ic"
|
||||
|
||||
|
||||
static uint ismbchar_sjis(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char* p, const char *e)
|
||||
{
|
||||
return (issjishead((uchar) *p) && (e-p)>1 && issjistail((uchar)p[1]) ? 2: 0);
|
||||
}
|
||||
|
||||
static uint mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (issjishead((uchar) c) ? 2 : 1);
|
||||
|
@ -34072,7 +34066,6 @@ static MY_COLLATION_HANDLER my_collation_handler_sjis_bin=
|
|||
static MY_CHARSET_HANDLER my_charset_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
ismbchar_sjis,
|
||||
mbcharlen_sjis,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
|
@ -860,7 +860,6 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
|
|||
static MY_CHARSET_HANDLER my_charset_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
NULL, /* ismbchar */
|
||||
my_mbcharlen_8bit, /* mbcharlen */
|
||||
my_numchars_8bit,
|
||||
my_charpos_8bit,
|
||||
|
|
|
@ -1413,15 +1413,6 @@ my_casedn_utf16(CHARSET_INFO *cs, char *src, size_t srclen,
|
|||
}
|
||||
|
||||
|
||||
static uint
|
||||
my_ismbchar_utf16(CHARSET_INFO *cs, const char *b, const char *e)
|
||||
{
|
||||
my_wc_t wc;
|
||||
int res= cs->cset->mb_wc(cs, &wc, (const uchar *) b, (const uchar *) e);
|
||||
return (uint) (res > 0 ? res : 0);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
my_charlen_utf16(CHARSET_INFO *cs, const uchar *str, const uchar *end)
|
||||
{
|
||||
|
@ -1456,7 +1447,7 @@ my_numchars_utf16(CHARSET_INFO *cs,
|
|||
size_t nchars= 0;
|
||||
for ( ; ; nchars++)
|
||||
{
|
||||
size_t charlen= my_ismbchar_utf16(cs, b, e);
|
||||
size_t charlen= my_ismbchar(cs, b, e);
|
||||
if (!charlen)
|
||||
break;
|
||||
b+= charlen;
|
||||
|
@ -1576,7 +1567,6 @@ static MY_COLLATION_HANDLER my_collation_utf16_bin_handler =
|
|||
MY_CHARSET_HANDLER my_charset_utf16_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
my_ismbchar_utf16, /* ismbchar */
|
||||
my_mbcharlen_utf16, /* mbcharlen */
|
||||
my_numchars_utf16,
|
||||
my_charpos_utf16,
|
||||
|
@ -1799,7 +1789,6 @@ static MY_COLLATION_HANDLER my_collation_utf16le_bin_handler =
|
|||
static MY_CHARSET_HANDLER my_charset_utf16le_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
my_ismbchar_utf16,
|
||||
my_mbcharlen_utf16,
|
||||
my_numchars_utf16,
|
||||
my_charpos_utf16,
|
||||
|
@ -2075,15 +2064,6 @@ my_casedn_utf32(CHARSET_INFO *cs, char *src, size_t srclen,
|
|||
}
|
||||
|
||||
|
||||
static uint
|
||||
my_ismbchar_utf32(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *b,
|
||||
const char *e)
|
||||
{
|
||||
return b + 4 > e || !IS_UTF32_MBHEAD4(b[0], b[1]) ? 0 : 4;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
my_charlen_utf32(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const uchar *b, const uchar *e)
|
||||
|
@ -2545,7 +2525,6 @@ static MY_COLLATION_HANDLER my_collation_utf32_bin_handler =
|
|||
MY_CHARSET_HANDLER my_charset_utf32_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
my_ismbchar_utf32,
|
||||
my_mbcharlen_utf32,
|
||||
my_numchars_utf32,
|
||||
my_charpos_utf32,
|
||||
|
@ -2883,14 +2862,6 @@ my_fill_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
|||
}
|
||||
|
||||
|
||||
static uint my_ismbchar_ucs2(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char *b,
|
||||
const char *e)
|
||||
{
|
||||
return b + 2 > e ? 0 : 2;
|
||||
}
|
||||
|
||||
|
||||
static uint my_mbcharlen_ucs2(CHARSET_INFO *cs __attribute__((unused)) ,
|
||||
uint c __attribute__((unused)))
|
||||
{
|
||||
|
@ -3032,7 +3003,6 @@ static MY_COLLATION_HANDLER my_collation_ucs2_bin_handler =
|
|||
MY_CHARSET_HANDLER my_charset_ucs2_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
my_ismbchar_ucs2, /* ismbchar */
|
||||
my_mbcharlen_ucs2, /* mbcharlen */
|
||||
my_numchars_ucs2,
|
||||
my_charpos_ucs2,
|
||||
|
|
|
@ -219,16 +219,6 @@ static const uchar sort_order_ujis[]=
|
|||
#include "strcoll.ic"
|
||||
|
||||
|
||||
static uint ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const char* p, const char *e)
|
||||
{
|
||||
return ((*(uchar*)(p)<0x80)? 0:\
|
||||
isujis(*(p)) && (e)-(p)>1 && isujis(*((p)+1))? 2:\
|
||||
isujis_ss2(*(p)) && (e)-(p)>1 && iskata(*((p)+1))? 2:\
|
||||
isujis_ss3(*(p)) && (e)-(p)>2 && isujis(*((p)+1)) && isujis(*((p)+2))? 3:\
|
||||
0);
|
||||
}
|
||||
|
||||
static uint mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
|
||||
{
|
||||
return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 1);
|
||||
|
@ -67264,7 +67254,6 @@ static MY_COLLATION_HANDLER my_collation_ujis_bin_handler =
|
|||
static MY_CHARSET_HANDLER my_charset_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
ismbchar_ujis,
|
||||
mbcharlen_ujis,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
|
@ -5426,12 +5426,6 @@ my_weight_mb3_utf8_general_mysql500_ci(uchar b0, uchar b1, uchar b2)
|
|||
#include "strcoll.ic"
|
||||
|
||||
|
||||
static uint my_ismbchar_utf8(CHARSET_INFO *cs,const char *b, const char *e)
|
||||
{
|
||||
int res= my_charlen_utf8(cs, (const uchar*) b, (const uchar*) e);
|
||||
return (res>1) ? res : 0;
|
||||
}
|
||||
|
||||
static uint my_mbcharlen_utf8(CHARSET_INFO *cs __attribute__((unused)),
|
||||
uint c)
|
||||
{
|
||||
|
@ -5497,7 +5491,6 @@ static MY_COLLATION_HANDLER my_collation_utf8_bin_handler =
|
|||
MY_CHARSET_HANDLER my_charset_utf8_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
my_ismbchar_utf8,
|
||||
my_mbcharlen_utf8,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
@ -7044,15 +7037,6 @@ my_charlen_filename(CHARSET_INFO *cs, const uchar *str, const uchar *end)
|
|||
}
|
||||
|
||||
|
||||
static uint
|
||||
my_ismbchar_filename(CHARSET_INFO *cs, const char *str, const char *end)
|
||||
{
|
||||
my_wc_t wc;
|
||||
int rc= my_mb_wc_filename(cs, &wc, (const uchar *) str, (const uchar *) end);
|
||||
return rc > 1 ? rc : 0;
|
||||
}
|
||||
|
||||
|
||||
#define MY_FUNCTION_NAME(x) my_ ## x ## _filename
|
||||
#define CHARLEN(cs,str,end) my_charlen_filename(cs,str,end)
|
||||
#define DEFINE_WELL_FORMED_CHAR_LENGTH_USING_CHARLEN
|
||||
|
@ -7081,7 +7065,6 @@ static MY_COLLATION_HANDLER my_collation_filename_handler =
|
|||
static MY_CHARSET_HANDLER my_charset_filename_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
my_ismbchar_filename,
|
||||
my_mbcharlen_utf8,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
@ -7792,14 +7775,6 @@ size_t my_well_formed_len_utf8mb4(CHARSET_INFO *cs,
|
|||
#include "strcoll.ic"
|
||||
|
||||
|
||||
static uint
|
||||
my_ismbchar_utf8mb4(CHARSET_INFO *cs, const char *b, const char *e)
|
||||
{
|
||||
int res= my_charlen_utf8mb4(cs, (const uchar*) b, (const uchar*) e);
|
||||
return (res > 1) ? res : 0;
|
||||
}
|
||||
|
||||
|
||||
static uint
|
||||
my_mbcharlen_utf8mb4(CHARSET_INFO *cs __attribute__((unused)), uint c)
|
||||
{
|
||||
|
@ -7852,7 +7827,6 @@ static MY_COLLATION_HANDLER my_collation_utf8mb4_bin_handler =
|
|||
MY_CHARSET_HANDLER my_charset_utf8mb4_handler=
|
||||
{
|
||||
NULL, /* init */
|
||||
my_ismbchar_utf8mb4,
|
||||
my_mbcharlen_utf8mb4,
|
||||
my_numchars_mb,
|
||||
my_charpos_mb,
|
||||
|
|
Loading…
Reference in a new issue