Commit 17384904 authored by Sinisa@sinisa.nasamreza.org's avatar Sinisa@sinisa.nasamreza.org

Merge sinisa@work.mysql.com:/home/bk/mysql-4.1

into sinisa.nasamreza.org:/mnt/hdc/Sinisa/mysql-4.1
parents 284972b5 0300bac6
...@@ -1872,7 +1872,7 @@ CHARSETS_AVAILABLE="armscii8 big5 cp1251 cp1257 ...@@ -1872,7 +1872,7 @@ CHARSETS_AVAILABLE="armscii8 big5 cp1251 cp1257
latin1 latin1_de latin2 latin5 sjis swe7 tis620 ujis latin1 latin1_de latin2 latin5 sjis swe7 tis620 ujis
usa7 utf8 win1250 win1251ukr" usa7 utf8 win1250 win1251ukr"
CHARSETS_DEPRECATED="win1251" CHARSETS_DEPRECATED="win1251"
CHARSETS_COMPLEX="big5 czech euc_kr gb2312 gbk latin1_de sjis tis620 ujis" CHARSETS_COMPLEX="big5 czech euc_kr gb2312 gbk latin1_de sjis tis620 ujis utf8"
DEFAULT_CHARSET=latin1 DEFAULT_CHARSET=latin1
AC_DIVERT_POP AC_DIVERT_POP
......
...@@ -29,6 +29,26 @@ extern "C" { ...@@ -29,6 +29,26 @@ extern "C" {
#define CHARSET_DIR "charsets/" #define CHARSET_DIR "charsets/"
#define my_wc_t ulong
typedef struct unicase_info_st {
uint16 toupper;
uint16 tolower;
uint16 sort;
} MY_UNICASE_INFO;
#define MY_CS_ILSEQ 0
#define MY_CS_ILUNI 0
#define MY_CS_TOOSMALL -1
#define MY_CS_TOOFEW(n) (-1-(n))
typedef struct my_uni_idx_st {
uint16 from;
uint16 to;
uchar *tab;
} MY_UNI_IDX;
typedef struct charset_info_st typedef struct charset_info_st
{ {
uint number; uint number;
...@@ -37,7 +57,10 @@ typedef struct charset_info_st ...@@ -37,7 +57,10 @@ typedef struct charset_info_st
uchar *to_lower; uchar *to_lower;
uchar *to_upper; uchar *to_upper;
uchar *sort_order; uchar *sort_order;
uint16 *tab_to_uni;
MY_UNI_IDX *tab_from_uni;
/* Collation routines */
uint strxfrm_multiply; uint strxfrm_multiply;
int (*strnncoll)(struct charset_info_st *, int (*strnncoll)(struct charset_info_st *,
const uchar *, uint, const uchar *, uint); const uchar *, uint, const uchar *, uint);
...@@ -47,10 +70,17 @@ typedef struct charset_info_st ...@@ -47,10 +70,17 @@ typedef struct charset_info_st
const char *, uint, pchar, uint, const char *, uint, pchar, uint,
char *, char *, uint *, uint *); char *, char *, uint *, uint *);
/* Multibyte routines */
uint mbmaxlen; uint mbmaxlen;
int (*ismbchar)(const char *, const char *); int (*ismbchar)(struct charset_info_st *, const char *, const char *);
my_bool (*ismbhead)(uint); my_bool (*ismbhead)(struct charset_info_st *, uint);
int (*mbcharlen)(uint); int (*mbcharlen)(struct charset_info_st *, uint);
/* Unicode convertion */
int (*mb_wc)(struct charset_info_st *cs,my_wc_t *wc,
const unsigned char *s,const unsigned char *e);
int (*wc_mb)(struct charset_info_st *cs,my_wc_t wc,
unsigned char *s,unsigned char *e);
/* Functions for case convertion */ /* Functions for case convertion */
void (*caseup_str)(struct charset_info_st *, char *); void (*caseup_str)(struct charset_info_st *, char *);
...@@ -90,6 +120,12 @@ extern void my_casedn_8bit(CHARSET_INFO *, char *, uint); ...@@ -90,6 +120,12 @@ extern void my_casedn_8bit(CHARSET_INFO *, char *, uint);
extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *); extern int my_strcasecmp_8bit(CHARSET_INFO * cs, const char *, const char *);
extern int my_strncasecmp_8bit(CHARSET_INFO * cs, const char *, const char *, uint); extern int my_strncasecmp_8bit(CHARSET_INFO * cs, const char *, const char *, uint);
int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc,
const unsigned char *s,const unsigned char *e);
int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc,
unsigned char *s, unsigned char *e);
#ifdef USE_MB #ifdef USE_MB
/* Functions for multibyte charsets */ /* Functions for multibyte charsets */
extern void my_caseup_str_mb(CHARSET_INFO *, char *); extern void my_caseup_str_mb(CHARSET_INFO *, char *);
...@@ -107,9 +143,9 @@ extern int my_strnncoll_big5(CHARSET_INFO *,const uchar *, uint, const uchar ...@@ -107,9 +143,9 @@ extern int my_strnncoll_big5(CHARSET_INFO *,const uchar *, uint, const uchar
extern int my_strnxfrm_big5(CHARSET_INFO *,uchar *, uint, const uchar *, uint); extern int my_strnxfrm_big5(CHARSET_INFO *,uchar *, uint, const uchar *, uint);
extern my_bool my_like_range_big5(CHARSET_INFO *,const char *, uint, pchar, uint, extern my_bool my_like_range_big5(CHARSET_INFO *,const char *, uint, pchar, uint,
char *, char *, uint *, uint *); char *, char *, uint *, uint *);
extern int ismbchar_big5(const char *, const char *); extern int ismbchar_big5(CHARSET_INFO *, const char *, const char *);
extern my_bool ismbhead_big5(uint); extern my_bool ismbhead_big5(CHARSET_INFO *, uint);
extern int mbcharlen_big5(uint); extern int mbcharlen_big5(CHARSET_INFO *, uint);
#endif #endif
#ifdef HAVE_CHARSET_czech #ifdef HAVE_CHARSET_czech
...@@ -125,17 +161,17 @@ extern my_bool my_like_range_czech(CHARSET_INFO *, ...@@ -125,17 +161,17 @@ extern my_bool my_like_range_czech(CHARSET_INFO *,
#ifdef HAVE_CHARSET_euc_kr #ifdef HAVE_CHARSET_euc_kr
/* declarations for the euc_kr character set */ /* declarations for the euc_kr character set */
extern uchar ctype_euc_kr[], to_lower_euc_kr[], to_upper_euc_kr[], sort_order_euc_kr[]; extern uchar ctype_euc_kr[], to_lower_euc_kr[], to_upper_euc_kr[], sort_order_euc_kr[];
extern int ismbchar_euc_kr(const char *, const char *); extern int ismbchar_euc_kr(CHARSET_INFO *, const char *, const char *);
extern my_bool ismbhead_euc_kr(uint); extern my_bool ismbhead_euc_kr(CHARSET_INFO *, uint);
extern int mbcharlen_euc_kr(uint); extern int mbcharlen_euc_kr(CHARSET_INFO *, uint);
#endif #endif
#ifdef HAVE_CHARSET_gb2312 #ifdef HAVE_CHARSET_gb2312
/* declarations for the gb2312 character set */ /* declarations for the gb2312 character set */
extern uchar ctype_gb2312[], to_lower_gb2312[], to_upper_gb2312[], sort_order_gb2312[]; extern uchar ctype_gb2312[], to_lower_gb2312[], to_upper_gb2312[], sort_order_gb2312[];
extern int ismbchar_gb2312(const char *, const char *); extern int ismbchar_gb2312(CHARSET_INFO *, const char *, const char *);
extern my_bool ismbhead_gb2312(uint); extern my_bool ismbhead_gb2312(CHARSET_INFO *, uint);
extern int mbcharlen_gb2312(uint); extern int mbcharlen_gb2312(CHARSET_INFO *, uint);
#endif #endif
#ifdef HAVE_CHARSET_gbk #ifdef HAVE_CHARSET_gbk
...@@ -145,9 +181,9 @@ extern int my_strnncoll_gbk(CHARSET_INFO *, const uchar *, uint, const uchar ...@@ -145,9 +181,9 @@ extern int my_strnncoll_gbk(CHARSET_INFO *, const uchar *, uint, const uchar
extern int my_strnxfrm_gbk(CHARSET_INFO *, uchar *, uint, const uchar *, uint); extern int my_strnxfrm_gbk(CHARSET_INFO *, uchar *, uint, const uchar *, uint);
extern my_bool my_like_range_gbk(CHARSET_INFO *, const char *, uint, pchar, uint, extern my_bool my_like_range_gbk(CHARSET_INFO *, const char *, uint, pchar, uint,
char *, char *, uint *, uint *); char *, char *, uint *, uint *);
extern int ismbchar_gbk(const char *, const char *); extern int ismbchar_gbk(CHARSET_INFO *, const char *, const char *);
extern my_bool ismbhead_gbk(uint); extern my_bool ismbhead_gbk(CHARSET_INFO *, uint);
extern int mbcharlen_gbk(uint); extern int mbcharlen_gbk(CHARSET_INFO *, uint);
#endif #endif
#ifdef HAVE_CHARSET_latin1_de #ifdef HAVE_CHARSET_latin1_de
...@@ -166,9 +202,9 @@ extern int my_strnncoll_sjis(CHARSET_INFO *, const uchar *, uint, const ucha ...@@ -166,9 +202,9 @@ extern int my_strnncoll_sjis(CHARSET_INFO *, const uchar *, uint, const ucha
extern int my_strnxfrm_sjis(CHARSET_INFO *, uchar *, uint, const uchar *, uint); extern int my_strnxfrm_sjis(CHARSET_INFO *, uchar *, uint, const uchar *, uint);
extern my_bool my_like_range_sjis(CHARSET_INFO *, const char *, uint, pchar, uint, extern my_bool my_like_range_sjis(CHARSET_INFO *, const char *, uint, pchar, uint,
char *, char *, uint *, uint *); char *, char *, uint *, uint *);
extern int ismbchar_sjis(const char *, const char *); extern int ismbchar_sjis(CHARSET_INFO *, const char *, const char *);
extern my_bool ismbhead_sjis(uint); extern my_bool ismbhead_sjis(CHARSET_INFO *, uint);
extern int mbcharlen_sjis(uint); extern int mbcharlen_sjis(CHARSET_INFO *, uint);
#endif #endif
#ifdef HAVE_CHARSET_tis620 #ifdef HAVE_CHARSET_tis620
...@@ -183,11 +219,38 @@ extern my_bool my_like_range_tis620(CHARSET_INFO *, const char *, uint, pchar, u ...@@ -183,11 +219,38 @@ extern my_bool my_like_range_tis620(CHARSET_INFO *, const char *, uint, pchar, u
#ifdef HAVE_CHARSET_ujis #ifdef HAVE_CHARSET_ujis
/* declarations for the ujis character set */ /* declarations for the ujis character set */
extern uchar ctype_ujis[], to_lower_ujis[], to_upper_ujis[], sort_order_ujis[]; extern uchar ctype_ujis[], to_lower_ujis[], to_upper_ujis[], sort_order_ujis[];
extern int ismbchar_ujis(const char *, const char *); extern int ismbchar_ujis(CHARSET_INFO *, const char *, const char *);
extern my_bool ismbhead_ujis(uint); extern my_bool ismbhead_ujis(CHARSET_INFO *, uint);
extern int mbcharlen_ujis(uint); extern int mbcharlen_ujis(CHARSET_INFO *, uint);
#endif #endif
#ifdef HAVE_CHARSET_utf8
extern uchar ctype_utf8[];
extern uchar to_lower_utf8[];
extern uchar to_upper_utf8[];
int my_strnncoll_utf8(CHARSET_INFO *cs,
const uchar *s, uint s_len, const uchar *t, uint t_len);
int my_strnxfrm_utf8(CHARSET_INFO *cs,
uchar *dest, uint destlen, const uchar *src, uint srclen);
int my_ismbchar_utf8(CHARSET_INFO *cs, const char *b, const char *e);
my_bool my_ismbhead_utf8(CHARSET_INFO * cs, uint ch);
int my_mbcharlen_utf8(CHARSET_INFO *cs, uint c);
void my_caseup_str_utf8(CHARSET_INFO * cs, char * s);
void my_casedn_str_utf8(CHARSET_INFO *cs, char * s);
void my_caseup_utf8(CHARSET_INFO *cs, char *s, uint len);
void my_casedn_utf8(CHARSET_INFO *cs, char *s, uint len);
int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t);
int my_strncasecmp_utf8(CHARSET_INFO *cs, const char *s,const char *t,uint l);
int my_utf8_uni (CHARSET_INFO *cs, my_wc_t *p, const uchar *s, const uchar *e);
int my_uni_utf8 (CHARSET_INFO *cs, my_wc_t wc, uchar *b, uchar *e);
#endif
#define _U 01 /* Upper case */ #define _U 01 /* Upper case */
#define _L 02 /* Lower case */ #define _L 02 /* Lower case */
...@@ -229,9 +292,9 @@ extern int mbcharlen_ujis(uint); ...@@ -229,9 +292,9 @@ extern int mbcharlen_ujis(uint);
((s)->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h))) ((s)->like_range((s), (a), (b), (c), (d), (e), (f), (g), (h)))
#define use_mb(s) ((s)->ismbchar != NULL) #define use_mb(s) ((s)->ismbchar != NULL)
#define my_ismbchar(s, a, b) ((s)->ismbchar((a), (b))) #define my_ismbchar(s, a, b) ((s)->ismbchar((s), (a), (b)))
#define my_ismbhead(s, a) ((s)->ismbhead((a))) #define my_ismbhead(s, a) ((s)->ismbhead((s), (a)))
#define my_mbcharlen(s, a) ((s)->mbcharlen((a))) #define my_mbcharlen(s, a) ((s)->mbcharlen((s),(a)))
#define my_caseup(s, a, l) ((s)->caseup((s), (a), (l))) #define my_caseup(s, a, l) ((s)->caseup((s), (a), (l)))
#define my_casedn(s, a, l) ((s)->casedn((s), (a), (l))) #define my_casedn(s, a, l) ((s)->casedn((s), (a), (l)))
......
...@@ -41,7 +41,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \ ...@@ -41,7 +41,7 @@ mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \
ctype.lo ctype-simple.lo ctype-mb.lo \ ctype.lo ctype-simple.lo ctype-mb.lo \
ctype-big5.lo ctype-czech.lo ctype-euc_kr.lo \ ctype-big5.lo ctype-czech.lo ctype-euc_kr.lo \
ctype-gb2312.lo ctype-gbk.lo ctype-latin1_de.lo \ ctype-gb2312.lo ctype-gbk.lo ctype-latin1_de.lo \
ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo ctype-sjis.lo ctype-tis620.lo ctype-ujis.lo ctype-utf8.lo
mystringsextra= strto.c mystringsextra= strto.c
dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo dbugobjects = dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo
......
...@@ -114,7 +114,8 @@ static uint hash_rec_mask(HASH *hash,HASH_LINK *pos,uint buffmax, ...@@ -114,7 +114,8 @@ static uint hash_rec_mask(HASH *hash,HASH_LINK *pos,uint buffmax,
/* Calc hashvalue for a key */ /* Calc hashvalue for a key */
static uint calc_hashnr(CHARSET_INFO *cs, const byte *key,uint length) static uint calc_hashnr(CHARSET_INFO *cs __attribute__((unused)),
const byte *key,uint length)
{ {
register uint nr=1, nr2=4; register uint nr=1, nr2=4;
while (length--) while (length--)
......
...@@ -57,7 +57,10 @@ void unireg_init(ulong options) ...@@ -57,7 +57,10 @@ void unireg_init(ulong options)
for (cs=compiled_charsets; cs->number; cs++) for (cs=compiled_charsets; cs->number; cs++)
{ {
uchar max_char=cs->sort_order[(uchar) cs->max_sort_char]; uchar max_char;
if (!cs->sort_order)
continue;
cs->sort_order[(uchar) cs->max_sort_char];
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
if ((uchar) cs->sort_order[i] > max_char) if ((uchar) cs->sort_order[i] > max_char)
......
...@@ -37,3 +37,4 @@ cp1257 29 ...@@ -37,3 +37,4 @@ cp1257 29
latin5 30 latin5 30
latin1_de 31 latin1_de 31
armscii8 32 armscii8 32
utf8 33
...@@ -22,19 +22,19 @@ pkglib_LIBRARIES = libmystrings.a ...@@ -22,19 +22,19 @@ pkglib_LIBRARIES = libmystrings.a
# Exact one of ASSEMBLER_X # Exact one of ASSEMBLER_X
if ASSEMBLER_x86 if ASSEMBLER_x86
ASRCS = strings-x86.s longlong2str-x86.s 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 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
else else
if ASSEMBLER_sparc if ASSEMBLER_sparc
# These file MUST all be on the same line!! Otherwise automake # These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile # 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 strxmov-sparc.s 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 strxmov-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 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 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 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.cctype-utf8.c
else else
#no assembler #no assembler
ASRCS = ASRCS =
# These file MUST all be on the same line!! Otherwise automake # These file MUST all be on the same line!! Otherwise automake
# generats a very broken makefile # 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 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
endif endif
endif endif
...@@ -42,7 +42,7 @@ libmystrings_a_SOURCES = $(ASRCS) $(CSRCS) ...@@ -42,7 +42,7 @@ libmystrings_a_SOURCES = $(ASRCS) $(CSRCS)
noinst_PROGRAMS = conf_to_src noinst_PROGRAMS = conf_to_src
# Default charset definitions # Default charset definitions
EXTRA_DIST = ctype-big5.c ctype-czech.c ctype-euc_kr.c \ EXTRA_DIST = ctype-big5.c ctype-czech.c ctype-euc_kr.c \
ctype-gb2312.c ctype-gbk.c ctype-sjis.c \ ctype-gb2312.c ctype-gbk.c ctype-sjis.c ctype-utf8.c \
ctype-tis620.c ctype-ujis.c ctype-latin1_de.c \ ctype-tis620.c ctype-ujis.c ctype-latin1_de.c \
strto.c strings-x86.s longlong2str-x86.s \ strto.c strings-x86.s longlong2str-x86.s \
strxmov.c bmove_upp.c strappend.c strcont.c strend.c \ strxmov.c bmove_upp.c strappend.c strcont.c strend.c \
......
...@@ -215,7 +215,7 @@ static uint16 big5strokexfrm(uint16 i) ...@@ -215,7 +215,7 @@ static uint16 big5strokexfrm(uint16 i)
return 0xA140; return 0xA140;
} }
int my_strnncoll_big5(CHARSET_INFO *cs, int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)),
const uchar * s1, uint len1, const uchar * s1, uint len1,
const uchar * s2, uint len2) const uchar * s2, uint len2)
{ {
...@@ -239,7 +239,7 @@ int my_strnncoll_big5(CHARSET_INFO *cs, ...@@ -239,7 +239,7 @@ int my_strnncoll_big5(CHARSET_INFO *cs,
return (int) (len1-len2); return (int) (len1-len2);
} }
int my_strnxfrm_big5(CHARSET_INFO *cs, int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len, uchar * dest, uint len,
const uchar * src, uint srclen) const uchar * src, uint srclen)
{ {
...@@ -328,7 +328,7 @@ int my_strxfrm_big5(uchar * dest, const uchar * src, int len) ...@@ -328,7 +328,7 @@ int my_strxfrm_big5(uchar * dest, const uchar * src, int len)
#define wild_one '_' #define wild_one '_'
#define wild_many '%' #define wild_many '%'
my_bool my_like_range_big5(CHARSET_INFO *cs, my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)),
const char *ptr,uint ptr_length,pchar escape, const char *ptr,uint ptr_length,pchar escape,
uint res_length, char *min_str,char *max_str, uint res_length, char *min_str,char *max_str,
uint *min_length,uint *max_length) uint *min_length,uint *max_length)
...@@ -378,17 +378,18 @@ my_bool my_like_range_big5(CHARSET_INFO *cs, ...@@ -378,17 +378,18 @@ my_bool my_like_range_big5(CHARSET_INFO *cs,
return 0; return 0;
} }
int ismbchar_big5(const char* p, const char *e) int ismbchar_big5(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
{ {
return (isbig5head(*(p)) && (e)-(p)>1 && isbig5tail(*((p)+1))? 2: 0); return (isbig5head(*(p)) && (e)-(p)>1 && isbig5tail(*((p)+1))? 2: 0);
} }
my_bool ismbhead_big5(uint c) my_bool ismbhead_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
{ {
return isbig5head(c); return isbig5head(c);
} }
int mbcharlen_big5(uint c) int mbcharlen_big5(CHARSET_INFO *cs __attribute__((unused)), uint c)
{ {
return (isbig5head(c)? 2: 0); return (isbig5head(c)? 2: 0);
} }
......
...@@ -282,7 +282,7 @@ int my_strxfrm_czech(uchar * dest, const uchar * src, int len) ...@@ -282,7 +282,7 @@ int my_strxfrm_czech(uchar * dest, const uchar * src, int len)
/* Function strnncoll, actually strcoll, with Czech sorting, which expect /* Function strnncoll, actually strcoll, with Czech sorting, which expect
the length of the strings being specified */ the length of the strings being specified */
int my_strnncoll_czech(CHARSET_INFO *cs, int my_strnncoll_czech(CHARSET_INFO *cs __attribute__((unused)),
const uchar * s1, uint len1, const uchar * s1, uint len1,
const uchar * s2, uint len2) const uchar * s2, uint len2)
{ {
...@@ -308,7 +308,7 @@ int my_strnncoll_czech(CHARSET_INFO *cs, ...@@ -308,7 +308,7 @@ int my_strnncoll_czech(CHARSET_INFO *cs,
/* Function strnxfrm, actually strxfrm, with Czech sorting, which expect /* Function strnxfrm, actually strxfrm, with Czech sorting, which expect
the length of the strings being specified */ the length of the strings being specified */
int my_strnxfrm_czech(CHARSET_INFO *cs, int my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len, uchar * dest, uint len,
const uchar * src, uint srclen) const uchar * src, uint srclen)
{ {
...@@ -378,7 +378,7 @@ int my_strnxfrm_czech(CHARSET_INFO *cs, ...@@ -378,7 +378,7 @@ int my_strnxfrm_czech(CHARSET_INFO *cs,
#define EXAMPLE #define EXAMPLE
my_bool my_like_range_czech(CHARSET_INFO *cs, my_bool my_like_range_czech(CHARSET_INFO *cs __attribute__((unused)),
const char *ptr,uint ptr_length,pchar escape, const char *ptr,uint ptr_length,pchar escape,
uint res_length, char *min_str,char *max_str, uint res_length, char *min_str,char *max_str,
uint *min_length,uint *max_length) uint *min_length,uint *max_length)
......
...@@ -183,19 +183,20 @@ uchar NEAR sort_order_euc_kr[]= ...@@ -183,19 +183,20 @@ uchar NEAR sort_order_euc_kr[]=
#define iseuc_kr(c) ((0xa1<=(uchar)(c) && (uchar)(c)<=0xfe)) #define iseuc_kr(c) ((0xa1<=(uchar)(c) && (uchar)(c)<=0xfe))
int ismbchar_euc_kr(const char* p, const char *e) int ismbchar_euc_kr(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
{ {
return ((*(uchar*)(p)<0x80)? 0:\ return ((*(uchar*)(p)<0x80)? 0:\
iseuc_kr(*(p)) && (e)-(p)>1 && iseuc_kr(*((p)+1))? 2:\ iseuc_kr(*(p)) && (e)-(p)>1 && iseuc_kr(*((p)+1))? 2:\
0); 0);
} }
my_bool ismbhead_euc_kr(uint c) my_bool ismbhead_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
{ {
return (iseuc_kr(c)); return (iseuc_kr(c));
} }
int mbcharlen_euc_kr(uint c) int mbcharlen_euc_kr(CHARSET_INFO *cs __attribute__((unused)),uint c)
{ {
return (iseuc_kr(c) ? 2 : 0); return (iseuc_kr(c) ? 2 : 0);
} }
......
...@@ -166,17 +166,18 @@ uchar NEAR sort_order_gb2312[]= ...@@ -166,17 +166,18 @@ uchar NEAR sort_order_gb2312[]=
#define isgb2312tail(c) (0xa1<=(uchar)(c) && (uchar)(c)<=0xfe) #define isgb2312tail(c) (0xa1<=(uchar)(c) && (uchar)(c)<=0xfe)
int ismbchar_gb2312(const char* p, const char *e) int ismbchar_gb2312(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
{ {
return (isgb2312head(*(p)) && (e)-(p)>1 && isgb2312tail(*((p)+1))? 2: 0); return (isgb2312head(*(p)) && (e)-(p)>1 && isgb2312tail(*((p)+1))? 2: 0);
} }
my_bool ismbhead_gb2312(uint c) my_bool ismbhead_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
{ {
return isgb2312head(c); return isgb2312head(c);
} }
int mbcharlen_gb2312(uint c) int mbcharlen_gb2312(CHARSET_INFO *cs __attribute__((unused)),uint c)
{ {
return (isgb2312head(c)? 2:0); return (isgb2312head(c)? 2:0);
} }
......
...@@ -2582,7 +2582,7 @@ static uint16 gbksortorder(uint16 i) ...@@ -2582,7 +2582,7 @@ static uint16 gbksortorder(uint16 i)
} }
int my_strnncoll_gbk(CHARSET_INFO *cs, int my_strnncoll_gbk(CHARSET_INFO *cs __attribute__((unused)),
const uchar * s1, uint len1, const uchar * s1, uint len1,
const uchar * s2, uint len2) const uchar * s2, uint len2)
{ {
...@@ -2609,7 +2609,7 @@ int my_strnncoll_gbk(CHARSET_INFO *cs, ...@@ -2609,7 +2609,7 @@ int my_strnncoll_gbk(CHARSET_INFO *cs,
} }
int my_strnxfrm_gbk(CHARSET_INFO *cs, int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len, uchar * dest, uint len,
const uchar * src, uint srclen) const uchar * src, uint srclen)
{ {
...@@ -2653,7 +2653,7 @@ int my_strnxfrm_gbk(CHARSET_INFO *cs, ...@@ -2653,7 +2653,7 @@ int my_strnxfrm_gbk(CHARSET_INFO *cs,
#define wild_one '_' #define wild_one '_'
#define wild_many '%' #define wild_many '%'
extern my_bool my_like_range_gbk(CHARSET_INFO *cs, extern my_bool my_like_range_gbk(CHARSET_INFO *cs __attribute__((unused)),
const char *ptr,uint ptr_length,pchar escape, const char *ptr,uint ptr_length,pchar escape,
uint res_length, char *min_str,char *max_str, uint res_length, char *min_str,char *max_str,
uint *min_length,uint *max_length) uint *min_length,uint *max_length)
...@@ -2704,17 +2704,18 @@ extern my_bool my_like_range_gbk(CHARSET_INFO *cs, ...@@ -2704,17 +2704,18 @@ extern my_bool my_like_range_gbk(CHARSET_INFO *cs,
} }
int ismbchar_gbk(const char* p, const char *e) int ismbchar_gbk(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
{ {
return (isgbkhead(*(p)) && (e)-(p)>1 && isgbktail(*((p)+1))? 2: 0); return (isgbkhead(*(p)) && (e)-(p)>1 && isgbktail(*((p)+1))? 2: 0);
} }
my_bool ismbhead_gbk(uint c) my_bool ismbhead_gbk(CHARSET_INFO *cs __attribute__((unused)),uint c)
{ {
return isgbkhead(c); return isgbkhead(c);
} }
int mbcharlen_gbk(uint c) int mbcharlen_gbk(CHARSET_INFO *cs __attribute__((unused)),uint c)
{ {
return (isgbkhead(c)? 2:0); return (isgbkhead(c)? 2:0);
} }
......
...@@ -164,7 +164,7 @@ uchar sort_order_latin1_de[] = { ...@@ -164,7 +164,7 @@ uchar sort_order_latin1_de[] = {
} }
int my_strnncoll_latin1_de(CHARSET_INFO *cs, int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
const uchar * s1, uint len1, const uchar * s1, uint len1,
const uchar * s2, uint len2) const uchar * s2, uint len2)
{ {
...@@ -238,7 +238,7 @@ int my_strnncoll_latin1_de(CHARSET_INFO *cs, ...@@ -238,7 +238,7 @@ int my_strnncoll_latin1_de(CHARSET_INFO *cs,
} }
int my_strnxfrm_latin1_de(CHARSET_INFO *cs, int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len, uchar * dest, uint len,
const uchar * src, uint srclen) const uchar * src, uint srclen)
{ {
...@@ -303,7 +303,7 @@ int my_strnxfrm_latin1_de(CHARSET_INFO *cs, ...@@ -303,7 +303,7 @@ int my_strnxfrm_latin1_de(CHARSET_INFO *cs,
#define wild_one '_' #define wild_one '_'
#define wild_many '%' #define wild_many '%'
my_bool my_like_range_latin1_de(CHARSET_INFO *cs, my_bool my_like_range_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
const char *ptr, uint ptr_length, const char *ptr, uint ptr_length,
pchar escape, uint res_length, pchar escape, uint res_length,
char *min_str, char *max_str, char *min_str, char *max_str,
......
...@@ -85,3 +85,26 @@ int my_strncasecmp_8bit(CHARSET_INFO * cs, ...@@ -85,3 +85,26 @@ int my_strncasecmp_8bit(CHARSET_INFO * cs,
while (len-- != 0 && my_toupper(cs,(uchar)*s++) == my_toupper(cs,(uchar)*t++)) ; while (len-- != 0 && my_toupper(cs,(uchar)*s++) == my_toupper(cs,(uchar)*t++)) ;
return (int) len+1; return (int) len+1;
} }
int my_mb_wc_8bit(CHARSET_INFO *cs,my_wc_t *wc,
const unsigned char *str,
const unsigned char *end __attribute__((unused)))
{
*wc=cs->tab_to_uni[*str];
return (!wc[0] && str[0]) ? MY_CS_ILSEQ : 1;
}
int my_wc_mb_8bit(CHARSET_INFO *cs,my_wc_t wc,
unsigned char *s,
unsigned char *e __attribute__((unused)))
{
MY_UNI_IDX *idx;
for(idx=cs->tab_from_uni; idx->tab ; idx++){
if(idx->from<=wc && idx->to>=wc){
s[0]=idx->tab[wc-idx->from];
return (!s[0] && wc) ? MY_CS_ILUNI : 1;
}
}
return MY_CS_ILUNI;
}
...@@ -183,17 +183,18 @@ uchar NEAR sort_order_sjis[]= ...@@ -183,17 +183,18 @@ uchar NEAR sort_order_sjis[]=
(0x80<=(c) && (c)<=0xfc)) (0x80<=(c) && (c)<=0xfc))
int ismbchar_sjis(const char* p, const char *e) int 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); return (issjishead((uchar) *p) && (e-p)>1 && issjistail((uchar)p[1]) ? 2: 0);
} }
my_bool ismbhead_sjis(uint c) my_bool ismbhead_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
{ {
return issjishead((uchar) c); return issjishead((uchar) c);
} }
int mbcharlen_sjis(uint c) int mbcharlen_sjis(CHARSET_INFO *cs __attribute__((unused)),uint c)
{ {
return (issjishead((uchar) c) ? 2: 0); return (issjishead((uchar) c) ? 2: 0);
} }
...@@ -201,15 +202,15 @@ int mbcharlen_sjis(uint c) ...@@ -201,15 +202,15 @@ int mbcharlen_sjis(uint c)
#define sjiscode(c,d) ((((uint) (uchar)(c)) << 8) | (uint) (uchar) (d)) #define sjiscode(c,d) ((((uint) (uchar)(c)) << 8) | (uint) (uchar) (d))
int my_strnncoll_sjis(CHARSET_INFO *cs, int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)),
const uchar *s1, uint len1, const uchar *s1, uint len1,
const uchar *s2, uint len2) const uchar *s2, uint len2)
{ {
const uchar *e1 = s1 + len1; const uchar *e1 = s1 + len1;
const uchar *e2 = s2 + len2; const uchar *e2 = s2 + len2;
while (s1 < e1 && s2 < e2) { while (s1 < e1 && s2 < e2) {
if (ismbchar_sjis((char*) s1, (char*) e1) && if (ismbchar_sjis(cs,(char*) s1, (char*) e1) &&
ismbchar_sjis((char*) s2, (char*) e2)) { ismbchar_sjis(cs,(char*) s2, (char*) e2)) {
uint c1 = sjiscode(*s1, *(s1+1)); uint c1 = sjiscode(*s1, *(s1+1));
uint c2 = sjiscode(*s2, *(s2+1)); uint c2 = sjiscode(*s2, *(s2+1));
if (c1 != c2) if (c1 != c2)
...@@ -226,14 +227,14 @@ int my_strnncoll_sjis(CHARSET_INFO *cs, ...@@ -226,14 +227,14 @@ int my_strnncoll_sjis(CHARSET_INFO *cs,
return len1 - len2; return len1 - len2;
} }
int my_strnxfrm_sjis(CHARSET_INFO *cs, int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)),
uchar *dest, uint len, uchar *dest, uint len,
const uchar *src, uint srclen) const uchar *src, uint srclen)
{ {
uchar *d_end = dest + len; uchar *d_end = dest + len;
uchar *s_end = (uchar*) src + srclen; uchar *s_end = (uchar*) src + srclen;
while (dest < d_end && src < s_end) { while (dest < d_end && src < s_end) {
if (ismbchar_sjis((char*) src, (char*) s_end)) { if (ismbchar_sjis(cs,(char*) src, (char*) s_end)) {
*dest++ = *src++; *dest++ = *src++;
if (dest < d_end && src < s_end) if (dest < d_end && src < s_end)
*dest++ = *src++; *dest++ = *src++;
...@@ -265,7 +266,7 @@ int my_strnxfrm_sjis(CHARSET_INFO *cs, ...@@ -265,7 +266,7 @@ int my_strnxfrm_sjis(CHARSET_INFO *cs,
#define wild_one '_' #define wild_one '_'
#define wild_many '%' #define wild_many '%'
my_bool my_like_range_sjis(CHARSET_INFO *cs, my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)),
const char *ptr,uint ptr_length,pchar escape, const char *ptr,uint ptr_length,pchar escape,
uint res_length, char *min_str,char *max_str, uint res_length, char *min_str,char *max_str,
uint *min_length,uint *max_length) uint *min_length,uint *max_length)
...@@ -275,7 +276,7 @@ my_bool my_like_range_sjis(CHARSET_INFO *cs, ...@@ -275,7 +276,7 @@ my_bool my_like_range_sjis(CHARSET_INFO *cs,
char *min_end=min_str+res_length; char *min_end=min_str+res_length;
while (ptr < end && min_str < min_end) { while (ptr < end && min_str < min_end) {
if (ismbchar_sjis(ptr, end)) { if (ismbchar_sjis(cs, ptr, end)) {
*min_str++ = *max_str++ = *ptr++; *min_str++ = *max_str++ = *ptr++;
if (min_str < min_end) if (min_str < min_end)
*min_str++ = *max_str++ = *ptr++; *min_str++ = *max_str++ = *ptr++;
...@@ -283,7 +284,7 @@ my_bool my_like_range_sjis(CHARSET_INFO *cs, ...@@ -283,7 +284,7 @@ my_bool my_like_range_sjis(CHARSET_INFO *cs,
} }
if (*ptr == escape && ptr+1 < end) { if (*ptr == escape && ptr+1 < end) {
ptr++; /* Skip escape */ ptr++; /* Skip escape */
if (ismbchar_sjis(ptr, end)) if (ismbchar_sjis(cs, ptr, end))
*min_str++ = *max_str++ = *ptr++; *min_str++ = *max_str++ = *ptr++;
if (min_str < min_end) if (min_str < min_end)
*min_str++ = *max_str++ = *ptr++; *min_str++ = *max_str++ = *ptr++;
......
...@@ -537,7 +537,7 @@ static uchar* thai2sortable(const uchar * tstr,uint len) ...@@ -537,7 +537,7 @@ static uchar* thai2sortable(const uchar * tstr,uint len)
Arg: 2 Strings and it compare length Arg: 2 Strings and it compare length
Ret: strcmp result Ret: strcmp result
*/ */
int my_strnncoll_tis620(CHARSET_INFO *cs, int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)),
const uchar * s1, uint len1, const uchar * s1, uint len1,
const uchar * s2, uint len2) const uchar * s2, uint len2)
{ {
...@@ -555,7 +555,7 @@ int my_strnncoll_tis620(CHARSET_INFO *cs, ...@@ -555,7 +555,7 @@ int my_strnncoll_tis620(CHARSET_INFO *cs,
Arg: Destination buffer, source string, dest length and source length Arg: Destination buffer, source string, dest length and source length
Ret: Conveted string size Ret: Conveted string size
*/ */
int my_strnxfrm_tis620(CHARSET_INFO *cs, int my_strnxfrm_tis620(CHARSET_INFO *cs __attribute__((unused)),
uchar * dest, uint len, uchar * dest, uint len,
const uchar * src, uint srclen) const uchar * src, uint srclen)
{ {
...@@ -613,7 +613,7 @@ int my_strxfrm_tis620(uchar * dest, const uchar * src, int len) ...@@ -613,7 +613,7 @@ int my_strxfrm_tis620(uchar * dest, const uchar * src, int len)
#define wild_one '_' #define wild_one '_'
#define wild_many '%' #define wild_many '%'
my_bool my_like_range_tis620(CHARSET_INFO *cs, my_bool my_like_range_tis620(CHARSET_INFO *cs __attribute__((unused)),
const char *ptr, uint ptr_length, pchar escape, const char *ptr, uint ptr_length, pchar escape,
uint res_length, char *min_str, char *max_str, uint res_length, char *min_str, char *max_str,
uint *min_length, uint *max_length) uint *min_length, uint *max_length)
......
...@@ -183,7 +183,8 @@ uchar NEAR sort_order_ujis[]= ...@@ -183,7 +183,8 @@ uchar NEAR sort_order_ujis[]=
#define isujis_ss3(c) (((c)&0xff) == 0x8f) #define isujis_ss3(c) (((c)&0xff) == 0x8f)
int ismbchar_ujis(const char* p, const char *e) int ismbchar_ujis(CHARSET_INFO *cs __attribute__((unused)),
const char* p, const char *e)
{ {
return ((*(uchar*)(p)<0x80)? 0:\ return ((*(uchar*)(p)<0x80)? 0:\
isujis(*(p)) && (e)-(p)>1 && isujis(*((p)+1))? 2:\ isujis(*(p)) && (e)-(p)>1 && isujis(*((p)+1))? 2:\
...@@ -192,12 +193,12 @@ int ismbchar_ujis(const char* p, const char *e) ...@@ -192,12 +193,12 @@ int ismbchar_ujis(const char* p, const char *e)
0); 0);
} }
my_bool ismbhead_ujis(uint c) my_bool ismbhead_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
{ {
return (isujis(c) || isujis_ss2(c) || isujis_ss3(c)); return (isujis(c) || isujis_ss2(c) || isujis_ss3(c));
} }
int mbcharlen_ujis(uint c) int mbcharlen_ujis(CHARSET_INFO *cs __attribute__((unused)),uint c)
{ {
return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 0); return (isujis(c)? 2: isujis_ss2(c)? 2: isujis_ss3(c)? 3: 0);
} }
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment