diff options
author | unknown <evgen@moonbone.local> | 2005-12-28 17:23:08 +0300 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2005-12-28 17:23:08 +0300 |
commit | 8f29cc3e84a0bfff0562e7d3a25dc497704a6ff5 (patch) | |
tree | ea959e5b741859843de5cfa759921b35e7c55ad5 /strings | |
parent | 4f5664f391ff12c0c6e94b4df0ea7654a484afd1 (diff) | |
parent | c37389cfdf633fda75caaf06e8e481661b71cd47 (diff) | |
download | mariadb-git-8f29cc3e84a0bfff0562e7d3a25dc497704a6ff5.tar.gz |
Manual merge
mysql-test/t/ctype_ucs.test:
Auto merged
sql/sql_update.cc:
Auto merged
BitKeeper/deleted/.del-ha_blackhole.cc~727c69ef7846623a:
Auto merged
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-ucs2.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 80a7bd84601..e2629f445cb 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1373,14 +1373,50 @@ int my_strnncoll_ucs2_bin(CHARSET_INFO *cs, return (int) (t_is_prefix ? t-te : ((se-s) - (te-t))); } -static int my_strnncollsp_ucs2_bin(CHARSET_INFO *cs, +static int my_strnncollsp_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), const uchar *s, uint slen, const uchar *t, uint tlen, my_bool diff_if_only_endspace_difference __attribute__((unused))) { - /* TODO: Needs to be fixed to handle end space! */ - return my_strnncoll_ucs2_bin(cs,s,slen,t,tlen,0); + const uchar *se, *te; + uint minlen; + + /* extra safety to make sure the lengths are even numbers */ + slen= (slen >> 1) << 1; + tlen= (tlen >> 1) << 1; + + se= s + slen; + te= t + tlen; + + for (minlen= min(slen, tlen); minlen; minlen-= 2) + { + int s_wc= s[0] * 256 + s[1]; + int t_wc= t[0] * 256 + t[1]; + if ( s_wc != t_wc ) + return s_wc > t_wc ? 1 : -1; + + s+= 2; + t+= 2; + } + + if (slen != tlen) + { + int swap= 1; + if (slen < tlen) + { + s= t; + se= te; + swap= -1; + } + + for ( ; s < se ; s+= 2) + { + if (s[0] || s[1] != ' ') + return (s[0] == 0 && s[1] < ' ') ? -swap : swap; + } + } + return 0; } |