diff options
author | unknown <igor@rurik.mysql.com> | 2004-02-19 01:09:54 -0800 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2004-02-19 01:09:54 -0800 |
commit | f4353d48ccc39527540daf709a1167462b39738c (patch) | |
tree | aa627335f475f099e0d352b39af4e24d6e1ac189 /strings | |
parent | c88e5213d4f8acbbba33d293a9573042818f0aec (diff) | |
parent | 9ce4695da0bfe74e840dcf708da10cac9740e137 (diff) | |
download | mariadb-git-f4353d48ccc39527540daf709a1167462b39738c.tar.gz |
Manual merge
mysql-test/r/func_test.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/r/user_var.result:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/item_row.cc:
Auto merged
sql/item_row.h:
Auto merged
sql/item_strfunc.h:
Auto merged
sql/sql_list.h:
Auto merged
sql/sql_select.h:
Auto merged
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-big5.c | 5 | ||||
-rw-r--r-- | strings/ctype-bin.c | 6 | ||||
-rw-r--r-- | strings/ctype-czech.c | 1 | ||||
-rw-r--r-- | strings/ctype-euc_kr.c | 3 | ||||
-rw-r--r-- | strings/ctype-extra.c | 1 | ||||
-rw-r--r-- | strings/ctype-gb2312.c | 3 | ||||
-rw-r--r-- | strings/ctype-gbk.c | 3 | ||||
-rw-r--r-- | strings/ctype-latin1.c | 4 | ||||
-rw-r--r-- | strings/ctype-mb.c | 21 | ||||
-rw-r--r-- | strings/ctype-simple.c | 14 | ||||
-rw-r--r-- | strings/ctype-sjis.c | 3 | ||||
-rw-r--r-- | strings/ctype-tis620.c | 208 | ||||
-rw-r--r-- | strings/ctype-ucs2.c | 36 | ||||
-rw-r--r-- | strings/ctype-ujis.c | 3 | ||||
-rw-r--r-- | strings/ctype-utf8.c | 3 | ||||
-rw-r--r-- | strings/ctype-win1250ch.c | 1 | ||||
-rw-r--r-- | strings/dump_map.c | 72 | ||||
-rw-r--r-- | strings/r_strinstr.c | 4 | ||||
-rw-r--r-- | strings/strinstr.c | 4 | ||||
-rw-r--r-- | strings/strstr.c | 4 |
20 files changed, 375 insertions, 24 deletions
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 85f066c4eba..574156a99ed 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -377,7 +377,7 @@ static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)), *min_length= (uint) (min_str-min_org); *max_length= res_length; do { - *min_str++ = '\0'; /* Because if key compression */ + *min_str++ = ' '; /* Because if key compression */ *max_str++ = max_sort_char; } while (min_str != min_end); return 0; @@ -6245,6 +6245,7 @@ static MY_CHARSET_HANDLER my_charset_big5_handler= mbcharlen_big5, my_numchars_mb, my_charpos_mb, + my_wellformedlen_mb, my_lengthsp_8bit, my_mb_wc_big5, /* mb_wc */ my_wc_mb_big5, /* wc_mb */ @@ -6281,6 +6282,7 @@ CHARSET_INFO my_charset_big5_chinese_ci= "", "", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 2, /* mbmaxlen */ 0, &my_charset_big5_handler, @@ -6304,6 +6306,7 @@ CHARSET_INFO my_charset_big5_bin= "", "", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 2, /* mbmaxlen */ 0, &my_charset_big5_handler, diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 6f28c43b2c6..fc22938d46e 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -294,7 +294,7 @@ uint my_instr_bin(CHARSET_INFO *cs __attribute__((unused)), end= (const uchar*) b+b_length-s_length+1; search_end= (const uchar*) s + s_length; -skipp: +skip: while (str != end) { if ( (*str++) == (*search)) @@ -306,7 +306,7 @@ skipp: while (j != search_end) if ((*i++) != (*j++)) - goto skipp; + goto skip; if (nmatch > 0) { @@ -347,6 +347,7 @@ static MY_CHARSET_HANDLER my_charset_handler= my_mbcharlen_8bit, /* mbcharlen */ my_numchars_8bit, my_charpos_8bit, + my_wellformedlen_8bit, my_lengthsp_8bit, my_mb_wc_bin, my_wc_mb_bin, @@ -381,6 +382,7 @@ CHARSET_INFO my_charset_bin = NULL, /* tab_from_uni */ "","", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 1, /* mbmaxlen */ (char) 255, /* max_sort_char */ &my_charset_handler, diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c index b2e4f1886ed..1a07a5eba7e 100644 --- a/strings/ctype-czech.c +++ b/strings/ctype-czech.c @@ -631,6 +631,7 @@ CHARSET_INFO my_charset_latin2_czech_ci = idx_uni_8859_2, /* tab_from_uni */ "","", 4, /* strxfrm_multiply */ + 1, /* mbminlen */ 1, /* mbmaxlen */ 0, &my_charset_8bit_handler, diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index addd7803680..278e8529e83 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -8653,6 +8653,7 @@ static MY_CHARSET_HANDLER my_charset_handler= mbcharlen_euc_kr, my_numchars_mb, my_charpos_mb, + my_wellformedlen_mb, my_lengthsp_8bit, my_mb_wc_euc_kr, /* mb_wc */ my_wc_mb_euc_kr, /* wc_mb */ @@ -8689,6 +8690,7 @@ CHARSET_INFO my_charset_euckr_korean_ci= "", "", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 2, /* mbmaxlen */ 0, &my_charset_handler, @@ -8712,6 +8714,7 @@ CHARSET_INFO my_charset_euckr_bin= "", "", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 2, /* mbmaxlen */ 0, &my_charset_handler, diff --git a/strings/ctype-extra.c b/strings/ctype-extra.c index 55bfa09ea5f..0085d264416 100644 --- a/strings/ctype-extra.c +++ b/strings/ctype-extra.c @@ -34,6 +34,7 @@ CHARSET_INFO compiled_charsets[] = { 0, 0, 0, + 0, NULL, NULL } diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index b84ddc9081b..722f00f0f7a 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -5704,6 +5704,7 @@ static MY_CHARSET_HANDLER my_charset_handler= mbcharlen_gb2312, my_numchars_mb, my_charpos_mb, + my_wellformedlen_mb, my_lengthsp_8bit, my_mb_wc_gb2312, /* mb_wc */ my_wc_mb_gb2312, /* wc_mb */ @@ -5740,6 +5741,7 @@ CHARSET_INFO my_charset_gb2312_chinese_ci= "", "", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 2, /* mbmaxlen */ 0, &my_charset_handler, @@ -5762,6 +5764,7 @@ CHARSET_INFO my_charset_gb2312_bin= "", "", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 2, /* mbmaxlen */ 0, &my_charset_handler, diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 585dc66be4c..9e71a18e531 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -9900,6 +9900,7 @@ static MY_CHARSET_HANDLER my_charset_handler= mbcharlen_gbk, my_numchars_mb, my_charpos_mb, + my_wellformedlen_mb, my_lengthsp_8bit, my_mb_wc_gbk, my_wc_mb_gbk, @@ -9936,6 +9937,7 @@ CHARSET_INFO my_charset_gbk_chinese_ci= "", "", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 2, /* mbmaxlen */ 0, &my_charset_handler, @@ -9958,6 +9960,7 @@ CHARSET_INFO my_charset_gbk_bin= "", "", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 2, /* mbmaxlen */ 0, &my_charset_handler, diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index 15798abb85b..933737b5f61 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -180,6 +180,7 @@ static MY_CHARSET_HANDLER my_charset_handler= my_mbcharlen_8bit, my_numchars_8bit, my_charpos_8bit, + my_wellformedlen_8bit, my_lengthsp_8bit, my_mb_wc_latin1, my_wc_mb_latin1, @@ -215,6 +216,7 @@ CHARSET_INFO my_charset_latin1= NULL, /* tab_from_uni */ "","", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 1, /* mbmaxlen */ 0, &my_charset_handler, @@ -410,6 +412,7 @@ CHARSET_INFO my_charset_latin1_german2_ci= NULL, /* tab_from_uni */ "","", 2, /* strxfrm_multiply */ + 1, /* mbminlen */ 1, /* mbmaxlen */ 0, &my_charset_handler, @@ -433,6 +436,7 @@ CHARSET_INFO my_charset_latin1_bin= "", "", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 1, /* mbmaxlen */ 0, &my_charset_handler, diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 271c56b8a0a..46f3e2f4fc3 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -271,9 +271,28 @@ uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)), b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1; pos--; } - return b-b0; + return pos ? e+2-b0 : b-b0; } +uint my_wellformedlen_mb(CHARSET_INFO *cs, + const char *b, const char *e, uint pos) +{ + my_wc_t wc; + int mblen; + const char *b0= b; + + while (pos) + { + if ((mblen= cs->cset->mb_wc(cs, &wc, b, e)) <0) + break; + b+= mblen; + pos--; + } + return b - b0; +} + + + uint my_instr_mb(CHARSET_INFO *cs, const char *b, uint b_length, const char *s, uint s_length, diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 6f77d6f3e16..233251e16a8 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -1020,6 +1020,15 @@ uint my_charpos_8bit(CHARSET_INFO *cs __attribute__((unused)), return pos; } +uint my_wellformedlen_8bit(CHARSET_INFO *cs __attribute__((unused)), + const char *start, + const char *end, + uint nchars) +{ + uint nbytes= (uint) (end-start); + return nbytes < nchars ? nbytes : nchars; +} + uint my_lengthsp_8bit(CHARSET_INFO *cs __attribute__((unused)), const char *ptr, uint length) { @@ -1055,7 +1064,7 @@ uint my_instr_simple(CHARSET_INFO *cs, end= (const uchar*) b+b_length-s_length+1; search_end= (const uchar*) s + s_length; -skipp: +skip: while (str != end) { if (cs->sort_order[*str++] == cs->sort_order[*search]) @@ -1067,7 +1076,7 @@ skipp: while (j != search_end) if (cs->sort_order[*i++] != cs->sort_order[*j++]) - goto skipp; + goto skip; if (nmatch > 0) { @@ -1096,6 +1105,7 @@ MY_CHARSET_HANDLER my_charset_8bit_handler= my_mbcharlen_8bit, /* mbcharlen */ my_numchars_8bit, my_charpos_8bit, + my_wellformedlen_8bit, my_lengthsp_8bit, my_mb_wc_8bit, my_wc_mb_8bit, diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index a84fbd16e5d..feff0fff227 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4489,6 +4489,7 @@ static MY_CHARSET_HANDLER my_charset_handler= mbcharlen_sjis, my_numchars_mb, my_charpos_mb, + my_wellformedlen_mb, my_lengthsp_8bit, my_mb_wc_sjis, /* mb_wc */ my_wc_mb_sjis, /* wc_mb */ @@ -4525,6 +4526,7 @@ CHARSET_INFO my_charset_sjis_japanese_ci= "", "", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 2, /* mbmaxlen */ 0, &my_charset_handler, @@ -4547,6 +4549,7 @@ CHARSET_INFO my_charset_sjis_bin= "", "", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 2, /* mbmaxlen */ 0, &my_charset_handler, diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index a2edc33b3d2..d577b964405 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -701,6 +701,207 @@ void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length) } #endif /* NOT_NEEDED */ +static unsigned short cs_to_uni[256]={ +0x0000,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,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0xFFFD,0x0E01,0x0E02,0x0E03,0x0E04,0x0E05,0x0E06,0x0E07, +0x0E08,0x0E09,0x0E0A,0x0E0B,0x0E0C,0x0E0D,0x0E0E,0x0E0F, +0x0E10,0x0E11,0x0E12,0x0E13,0x0E14,0x0E15,0x0E16,0x0E17, +0x0E18,0x0E19,0x0E1A,0x0E1B,0x0E1C,0x0E1D,0x0E1E,0x0E1F, +0x0E20,0x0E21,0x0E22,0x0E23,0x0E24,0x0E25,0x0E26,0x0E27, +0x0E28,0x0E29,0x0E2A,0x0E2B,0x0E2C,0x0E2D,0x0E2E,0x0E2F, +0x0E30,0x0E31,0x0E32,0x0E33,0x0E34,0x0E35,0x0E36,0x0E37, +0x0E38,0x0E39,0x0E3A,0xFFFD,0xFFFD,0xFFFD,0xFFFD,0x0E3F, +0x0E40,0x0E41,0x0E42,0x0E43,0x0E44,0x0E45,0x0E46,0x0E47, +0x0E48,0x0E49,0x0E4A,0x0E4B,0x0E4C,0x0E4D,0x0E4E,0x0E4F, +0x0E50,0x0E51,0x0E52,0x0E53,0x0E54,0x0E55,0x0E56,0x0E57, +0x0E58,0x0E59,0x0E5A,0x0E5B,0xFFFD,0xFFFD,0xFFFD,0xFFFD +}; +static unsigned char pl00[256]={ +0x0000,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,0x007F, +0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087, +0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F, +0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097, +0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; +static unsigned char pl0E[256]={ +0x0000,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,0x0000,0x0000,0x0000,0x0000,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,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 +}; +static unsigned char plFF[256]={ +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, +0x0000,0x0000,0x0000,0x0000,0x0000,0x00FF,0x0000,0x0000 +}; +static unsigned char *uni_to_cs[256]={ +pl00,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,pl0E,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, +NULL,NULL,NULL,NULL,NULL,NULL,NULL,plFF +}; + + +static +int my_mb_wc_tis620(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t *wc, + const unsigned char *str, + const unsigned char *end __attribute__((unused))) +{ + if (str >= end) + return MY_CS_TOOFEW(0); + + *wc=cs_to_uni[*str]; + return (!wc[0] && str[0]) ? MY_CS_ILSEQ : 1; +} + +static +int my_wc_mb_tis620(CHARSET_INFO *cs __attribute__((unused)), + my_wc_t wc, + unsigned char *str, + unsigned char *end __attribute__((unused))) +{ + unsigned char *pl; + + if (str >= end) + return MY_CS_TOOSMALL; + + pl= uni_to_cs[(wc>>8) & 0xFF]; + str[0]= pl ? pl[wc & 0xFF] : '\0'; + return (!str[0] && wc) ? MY_CS_ILUNI : 1; +} + static MY_COLLATION_HANDLER my_collation_ci_handler = { @@ -720,9 +921,10 @@ static MY_CHARSET_HANDLER my_charset_handler= my_mbcharlen_8bit, /* mbcharlen */ my_numchars_8bit, my_charpos_8bit, + my_wellformedlen_8bit, my_lengthsp_8bit, - my_mb_wc_8bit, /* mb_wc */ - my_wc_mb_8bit, /* wc_mb */ + my_mb_wc_tis620, /* mb_wc */ + my_wc_mb_tis620, /* wc_mb */ my_caseup_str_8bit, my_casedn_str_8bit, my_caseup_8bit, @@ -757,6 +959,7 @@ CHARSET_INFO my_charset_tis620_thai_ci= "", "", 4, /* strxfrm_multiply */ + 1, /* mbminlen */ 1, /* mbmaxlen */ 0, &my_charset_handler, @@ -779,6 +982,7 @@ CHARSET_INFO my_charset_tis620_bin= "", "", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 1, /* mbmaxlen */ 0, &my_charset_handler, diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index beb803a69f2..bb74e0cf56b 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1002,6 +1002,17 @@ uint my_charpos_ucs2(CHARSET_INFO *cs __attribute__((unused)), } static +uint my_wellformedlen_ucs2(CHARSET_INFO *cs __attribute__((unused)), + const char *b, + const char *e, + uint nchars) +{ + uint nbytes= (e-b) & ~ (uint)1; + nchars*= 2; + return nbytes < nchars ? nbytes : nchars; +} + +static void my_fill_ucs2(CHARSET_INFO *cs __attribute__((unused)), char *s, uint l, int fill) { @@ -1044,14 +1055,13 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs, scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend); if (scan <= 0) return 1; - wildstr+= scan; if (w_wc == (my_wc_t)escape) { + wildstr+= scan; scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend); if (scan <= 0) return 1; - wildstr+= scan; } if (w_wc == (my_wc_t)w_many) @@ -1060,6 +1070,7 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs, break; } + wildstr+= scan; scan= my_ucs2_uni(cs, &s_wc, (const uchar*)str, (const uchar*)str_end); if (scan <=0) return 1; @@ -1095,13 +1106,16 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs, scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend); if (scan <= 0) return 1; - wildstr+= scan; if (w_wc == (my_wc_t)w_many) + { + wildstr+= scan; continue; + } if (w_wc == (my_wc_t)w_one) { + wildstr+= scan; scan= my_ucs2_uni(cs, &s_wc, (const uchar*)str, (const uchar*)str_end); if (scan <=0) return 1; @@ -1120,17 +1134,16 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs, scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend); if (scan <= 0) return 1; - wildstr+= scan; if (w_wc == (my_wc_t)escape) { + wildstr+= scan; scan= my_ucs2_uni(cs,&w_wc, (const uchar*)wildstr, (const uchar*)wildend); if (scan <= 0) return 1; - wildstr+= scan; } - do + while (1) { /* Skip until the first character from wildstr is found */ while (str != str_end) @@ -1138,8 +1151,6 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs, scan= my_ucs2_uni(cs,&s_wc, (const uchar*)str, (const uchar*)str_end); if (scan <= 0) return 1; - str+= scan; - if (weights) { plane=(s_wc>>8) & 0xFF; @@ -1150,17 +1161,19 @@ int my_wildcmp_ucs2(CHARSET_INFO *cs, if (s_wc == w_wc) break; + str+= scan; } if (str == str_end) return -1; result= my_wildcmp_ucs2(cs,str,str_end,wildstr,wildend,escape, w_one,w_many,weights); + if (result <= 0) return result; - } while (str != str_end && w_wc != (my_wc_t)w_many); - return -1; + str+= scan; + } } } return (str != str_end ? 1 : 0); @@ -1285,6 +1298,7 @@ static MY_CHARSET_HANDLER my_charset_ucs2_handler= my_mbcharlen_ucs2, /* mbcharlen */ my_numchars_ucs2, my_charpos_ucs2, + my_wellformedlen_ucs2, my_lengthsp_ucs2, my_ucs2_uni, /* mb_wc */ my_uni_ucs2, /* wc_mb */ @@ -1322,6 +1336,7 @@ CHARSET_INFO my_charset_ucs2_general_ci= "", "", 1, /* strxfrm_multiply */ + 2, /* mbminlen */ 2, /* mbmaxlen */ 0, &my_charset_ucs2_handler, @@ -1345,6 +1360,7 @@ CHARSET_INFO my_charset_ucs2_bin= "", "", 1, /* strxfrm_multiply */ + 2, /* mbminlen */ 2, /* mbmaxlen */ 0, &my_charset_ucs2_handler, diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 2815b70351b..f27ddcf3e30 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -8444,6 +8444,7 @@ static MY_CHARSET_HANDLER my_charset_handler= mbcharlen_ujis, my_numchars_mb, my_charpos_mb, + my_wellformedlen_mb, my_lengthsp_8bit, my_mb_wc_euc_jp, /* mb_wc */ my_wc_mb_euc_jp, /* wc_mb */ @@ -8480,6 +8481,7 @@ CHARSET_INFO my_charset_ujis_japanese_ci= NULL, /* tab_from_uni */ "","", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 3, /* mbmaxlen */ 0, &my_charset_handler, @@ -8502,6 +8504,7 @@ CHARSET_INFO my_charset_ujis_bin= NULL, /* tab_from_uni */ "","", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 3, /* mbmaxlen */ 0, &my_charset_handler, diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index b5716c53ea2..ef9719bf040 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1969,6 +1969,7 @@ static MY_CHARSET_HANDLER my_charset_handler= my_mbcharlen_utf8, my_numchars_mb, my_charpos_mb, + my_wellformedlen_mb, my_lengthsp_8bit, my_utf8_uni, my_uni_utf8, @@ -2006,6 +2007,7 @@ CHARSET_INFO my_charset_utf8_general_ci= "", "", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 3, /* mbmaxlen */ 0, &my_charset_handler, @@ -2029,6 +2031,7 @@ CHARSET_INFO my_charset_utf8_bin= "", "", 1, /* strxfrm_multiply */ + 1, /* mbminlen */ 3, /* mbmaxlen */ 0, &my_charset_handler, diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index 60a5737009f..d3b5c9d1796 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -671,6 +671,7 @@ CHARSET_INFO my_charset_cp1250_czech_ci = idx_uni_cp1250, /* tab_from_uni */ "","", 2, /* strxfrm_multiply */ + 1, /* mbminlen */ 1, /* mbmaxlen */ 0, &my_charset_8bit_handler, diff --git a/strings/dump_map.c b/strings/dump_map.c new file mode 100644 index 00000000000..f999160d0d4 --- /dev/null +++ b/strings/dump_map.c @@ -0,0 +1,72 @@ +#include <stdio.h> +#include <string.h> + +static void print_short_array(unsigned short *a) +{ + int i; + printf("{\n"); + for (i=0; i<=0xFF; i++) + { + printf("0x%04X%s%s",(int)a[i],i<0xFF?",":"",(i+1) % 8 ? "" :"\n"); + } + printf("};\n"); + +} + + + +int main(void) +{ + char str[160]; + unsigned short touni[256]; + unsigned short fromuni[65536]; + unsigned short fromstat[256]; + int i; + + bzero((void*)touni,sizeof(touni)); + bzero((void*)fromuni,sizeof(fromuni)); + bzero((void*)fromstat,sizeof(fromstat)); + + while (fgets(str,sizeof(str),stdin)) + { + unsigned int c,u; + + if ((str[0]=='#') || (2!=sscanf(str,"%x%x",&c,&u))) + continue; + if (c>0xFF || u>0xFFFF) + continue; + + touni[c]= u; + fromuni[u]= c; + } + + printf("unsigned short cs_to_uni[256]="); + print_short_array(touni); + + for (i=0;i<=0xFF;i++) + { + fromstat[touni[i]>>8]++; + } + + for (i=0;i<=256;i++) + { + if (fromstat[i]) + { + printf("unsigned char pl%02X[256]=",i); + print_short_array(fromuni+i*256); + } + } + + printf("unsigned short *uni_to_cs[256]={\n"); + for (i=0;i<=255;i++) + { + if (fromstat[i]) + printf("pl%02X",i); + else + printf("NULL"); + printf("%s%s",i<255?",":"",((i+1) % 8) ? "":"\n"); + } + printf("};\n"); + + return 0; +} diff --git a/strings/r_strinstr.c b/strings/r_strinstr.c index 76d310a3fda..fdd6e010a22 100644 --- a/strings/r_strinstr.c +++ b/strings/r_strinstr.c @@ -35,7 +35,7 @@ uint r_strinstr(reg1 my_string str,int from, reg4 my_string search) /* pointer to the last char of search */ my_string search_end = search + len - 1; - skipp: + skip: while (start >= str) /* Cant be != because the first char */ { if (*start-- == *search_end) @@ -43,7 +43,7 @@ uint r_strinstr(reg1 my_string str,int from, reg4 my_string search) i = start; j = search_end - 1; while (j >= search && start > str) if (*i-- != *j--) - goto skipp; + goto skip; return (uint) ((start - len) - str + 3); } } diff --git a/strings/strinstr.c b/strings/strinstr.c index 1c814d19d47..457581af950 100644 --- a/strings/strinstr.c +++ b/strings/strinstr.c @@ -34,14 +34,14 @@ uint strinstr(reg1 const char *str,reg4 const char *search) reg2 my_string i,j; my_string start = (my_string) str; - skipp: + skip: while (*str != '\0') { if (*str++ == *search) { i=(my_string) str; j= (my_string) search+1; while (*j) - if (*i++ != *j++) goto skipp; + if (*i++ != *j++) goto skip; return ((uint) (str - start)); } } diff --git a/strings/strstr.c b/strings/strstr.c index ca845568ddb..bd65ef654b1 100644 --- a/strings/strstr.c +++ b/strings/strstr.c @@ -37,12 +37,12 @@ char *strstr(register const char *str,const char *search) register char *i,*j; register char first= *search; -skipp: +skip: while (*str != '\0') { if (*str++ == first) { i=(char*) str; j=(char*) search+1; while (*j) - if (*i++ != *j++) goto skipp; + if (*i++ != *j++) goto skip; return ((char*) str-1); } } |