Bug#29333 myisam corruption with character set cp932 collate cp932_japanese_ci

Problem: wrong comparison with trailing space.
  This problem was fixed for all other character sets under terms of
  bug 7788 ""Table is full" occurs during a multitable update".
  ctype-cp932.c was forgotten.
  Fix: applying the same fix for ctype-cp932.c.
  (see ctype-sjis.c as an example of a previously correctly fixed file)


mysql-test/r/ctype_cp932.result:
  Adding test
mysql-test/t/ctype_cp932.test:
  Adding test
strings/ctype-cp932.c:
  Applying the same fix which was done for all other
      character sets under terms of bug 7788.
strings/ctype-utf8.c:
  Fixing the same problem for utf8_general_cs,
  which was forgotten in bug 7788 as well.
This commit is contained in:
unknown 2007-07-04 16:17:40 +05:00
commit 3b1fefbf14
4 changed files with 67 additions and 14 deletions

View file

@ -250,9 +250,16 @@ static int my_strnncollsp_cp932(CHARSET_INFO *cs __attribute__((unused)),
const uchar *a_end= a + a_length;
const uchar *b_end= b + b_length;
int res= my_strnncoll_cp932_internal(cs, &a, a_length, &b, b_length);
#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
diff_if_only_endspace_difference= 0;
#endif
if (!res && (a != a_end || b != b_end))
{
int swap= 0;
int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
Check the next not space character of the longer key. If it's < ' ',
then it's smaller than the other key.
@ -263,11 +270,12 @@ static int my_strnncollsp_cp932(CHARSET_INFO *cs __attribute__((unused)),
a_end= b_end;
a= b;
swap= -1; /* swap sign of result */
res= -res;
}
for (; a < a_end ; a++)
{
if (*a != ' ')
return ((int) *a - (int) ' ') ^ swap;
if (*a != (uchar) ' ')
return (*a < (uchar) ' ') ? -swap : swap;
}
}
return res;