diff options
author | bar@mysql.com <> | 2005-06-28 15:00:22 +0500 |
---|---|---|
committer | bar@mysql.com <> | 2005-06-28 15:00:22 +0500 |
commit | 46536c3a60a00131ceaec7760813bbdae2d301c4 (patch) | |
tree | b205719ca1f2fd190bb9062325c7cd5ff12f84ca /strings | |
parent | eaec18bda635cbed6242a7c960596c216aa14afc (diff) | |
download | mariadb-git-46536c3a60a00131ceaec7760813bbdae2d301c4.tar.gz |
ctype_ucs.result, ctype_ucs.test, ctype_utf8.result, ctype_utf8.test:
Fixing tests accordingly.
ctype-ucs2.c:
The same fix for UCS2.
ctype-utf8.c:
Bug #9557
MyISAM utf8 table crash
The problem was that my_strnncollsp_xxx could
return big value in the range 0..0xffff.
for some constant pairs it could return 32738,
which is defined as MI_FOUND_WRONG_KEY in
myisamdef.h. As a result, table considered to
be crashed.
Fix to return -1,0 or 1.
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-ucs2.c | 6 | ||||
-rw-r--r-- | strings/ctype-utf8.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 12c1ae905cf..c3caaeadfb3 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -209,7 +209,7 @@ static int my_strnncoll_ucs2(CHARSET_INFO *cs, t_wc = uni_plane[plane] ? uni_plane[plane][t_wc & 0xFF].sort : t_wc; if ( s_wc != t_wc ) { - return ((int) s_wc) - ((int) t_wc); + return s_wc > t_wc ? 1 : -1; } s+=s_res; @@ -267,7 +267,7 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)), int t_wc = uni_plane[t[0]] ? (int) uni_plane[t[0]][t[1]].sort : (((int) t[0]) << 8) + (int) t[1]; if ( s_wc != t_wc ) - return s_wc - t_wc; + return s_wc > t_wc ? 1 : -1; s+= 2; t+= 2; @@ -1343,7 +1343,7 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *cs, } if ( s_wc != t_wc ) { - return ((int) s_wc) - ((int) t_wc); + return s_wc > t_wc ? 1 : -1; } s+=s_res; diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 230b44796e8..f5192b26ce2 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -2000,7 +2000,7 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs, t_wc = uni_plane[plane] ? uni_plane[plane][t_wc & 0xFF].sort : t_wc; if ( s_wc != t_wc ) { - return ((int) s_wc) - ((int) t_wc); + return s_wc > t_wc ? 1 : -1; } s+=s_res; @@ -2065,7 +2065,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs, t_wc = uni_plane[plane] ? uni_plane[plane][t_wc & 0xFF].sort : t_wc; if ( s_wc != t_wc ) { - return ((int) s_wc) - ((int) t_wc); + return s_wc > t_wc ? 1 : -1; } s+=s_res; |