Commit 80d25174 authored by unknown's avatar unknown

strnxfrm() for simple and binary charsets fixes

parent 3604aa00
...@@ -3964,23 +3964,11 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr) ...@@ -3964,23 +3964,11 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
void Field_string::sort_string(char *to,uint length) void Field_string::sort_string(char *to,uint length)
{ {
if (binary()) uint tmp=my_strnxfrm(field_charset,
memcpy((byte*) to,(byte*) ptr,(size_t) length);
else
{
#ifdef USE_STRCOLL
if (use_strnxfrm(field_charset)) {
uint tmp=my_strnxfrm(field_charset,
(unsigned char *)to, length, (unsigned char *)to, length,
(unsigned char *) ptr, field_length); (unsigned char *) ptr, field_length);
if (tmp < length) if (tmp < length)
bzero(to + tmp, length - tmp); bzero(to + tmp, length - tmp);
}
else
#endif
for (char *from=ptr,*end=ptr+length ; from != end ;)
*to++=(char) field_charset->sort_order[(uint) (uchar) *from++];
}
} }
...@@ -4145,27 +4133,9 @@ int Field_varstring::cmp(const char *a_ptr, const char *b_ptr) ...@@ -4145,27 +4133,9 @@ int Field_varstring::cmp(const char *a_ptr, const char *b_ptr)
void Field_varstring::sort_string(char *to,uint length) void Field_varstring::sort_string(char *to,uint length)
{ {
uint tot_length=uint2korr(ptr); uint tot_length=uint2korr(ptr);
if (binary()) tot_length=my_strnxfrm(field_charset,
memcpy((byte*) to,(byte*) ptr+2,(size_t) tot_length);
else
{
#ifdef USE_STRCOLL
if (use_strnxfrm(field_charset))
tot_length=my_strnxfrm(field_charset,
(unsigned char *) to, length, (unsigned char *) to, length,
(unsigned char *)ptr+2, tot_length); (unsigned char *)ptr+2, tot_length);
else
{
#endif
char *tmp=to;
if (tot_length > length)
tot_length=length;
for (char *from=ptr+2,*end=from+tot_length ; from != end ;)
*tmp++=(char) field_charset->sort_order[(uint) (uchar) *from++];
#ifdef USE_STRCOLL
}
#endif
}
if (tot_length < length) if (tot_length < length)
bzero(to+tot_length,length-tot_length); bzero(to+tot_length,length-tot_length);
} }
......
...@@ -29,10 +29,11 @@ int my_strnxfrm_simple(CHARSET_INFO * cs, ...@@ -29,10 +29,11 @@ int my_strnxfrm_simple(CHARSET_INFO * cs,
const uchar *src, uint srclen) const uchar *src, uint srclen)
{ {
uchar *map= cs->sort_order; uchar *map= cs->sort_order;
const uchar *end;
DBUG_ASSERT(len >= srclen); DBUG_ASSERT(len >= srclen);
len= min(len,srclen); len= min(len,srclen);
for ( ; len > 0 ; len-- ) for ( end=src+len; src < end ; )
*dest++= map[*src++]; *dest++= map[*src++];
return len; return len;
} }
......
...@@ -2823,7 +2823,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -2823,7 +2823,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_1, /* tab_from_uni */ idx_uni_8859_1, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -2869,7 +2869,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -2869,7 +2869,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1251, /* tab_from_uni */ idx_uni_cp1251, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -2914,7 +2914,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -2914,7 +2914,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1257, /* tab_from_uni */ idx_uni_cp1257, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -2959,7 +2959,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -2959,7 +2959,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_2, /* tab_from_uni */ idx_uni_8859_2, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3005,7 +3005,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3005,7 +3005,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_1, /* tab_from_uni */ idx_uni_8859_1, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3050,7 +3050,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3050,7 +3050,7 @@ static CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */ NULL, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3095,7 +3095,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3095,7 +3095,7 @@ static CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */ NULL, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3140,7 +3140,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3140,7 +3140,7 @@ static CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */ NULL, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3186,7 +3186,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3186,7 +3186,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_1, /* tab_from_uni */ idx_uni_8859_1, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3231,7 +3231,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3231,7 +3231,7 @@ static CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */ NULL, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3276,7 +3276,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3276,7 +3276,7 @@ static CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */ NULL, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3321,7 +3321,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3321,7 +3321,7 @@ static CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */ NULL, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3366,7 +3366,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3366,7 +3366,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_2, /* tab_from_uni */ idx_uni_8859_2, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3411,7 +3411,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3411,7 +3411,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_koi8_r, /* tab_from_uni */ idx_uni_koi8_r, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3456,7 +3456,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3456,7 +3456,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_koi8_u, /* tab_from_uni */ idx_uni_koi8_u, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3502,7 +3502,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3502,7 +3502,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_2, /* tab_from_uni */ idx_uni_8859_2, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3547,7 +3547,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3547,7 +3547,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_8859_9, /* tab_from_uni */ idx_uni_8859_9, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3593,7 +3593,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3593,7 +3593,7 @@ static CHARSET_INFO compiled_charsets[] = {
NULL, /* tab_from_uni */ NULL, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3639,7 +3639,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3639,7 +3639,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_us_ascii, /* tab_from_uni */ idx_uni_us_ascii, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3684,7 +3684,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3684,7 +3684,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1250, /* tab_from_uni */ idx_uni_cp1250, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3729,7 +3729,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3729,7 +3729,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1251, /* tab_from_uni */ idx_uni_cp1251, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3774,7 +3774,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3774,7 +3774,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_armscii_8, /* tab_from_uni */ idx_uni_armscii_8, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
...@@ -3819,7 +3819,7 @@ static CHARSET_INFO compiled_charsets[] = { ...@@ -3819,7 +3819,7 @@ static CHARSET_INFO compiled_charsets[] = {
idx_uni_cp1251, /* tab_from_uni */ idx_uni_cp1251, /* tab_from_uni */
0, /* strxfrm_multiply */ 0, /* strxfrm_multiply */
my_strnncoll_simple,/* strnncoll */ my_strnncoll_simple,/* strnncoll */
NULL, /* strnxfrm */ my_strnxfrm_simple, /* strnxfrm */
my_like_range_simple,/* like_range */ my_like_range_simple,/* like_range */
my_wildcmp_8bit, /* wildcmp */ my_wildcmp_8bit, /* wildcmp */
1, /* mbmaxlen */ 1, /* mbmaxlen */
......
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