diff options
author | Alexander Barkov <bar@mnogosearch.org> | 2013-10-23 20:25:52 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mnogosearch.org> | 2013-10-23 20:25:52 +0400 |
commit | 426d246f5b8a4c598a913838b625e05e63ccb41f (patch) | |
tree | 16792dd3268c0ec0fb02837c761a535af1938b1f /strings/ctype-latin1.c | |
parent | de8e306b6921ab32aedde957594e570166a7fce1 (diff) | |
download | mariadb-git-426d246f5b8a4c598a913838b625e05e63ccb41f.tar.gz |
MDEV-5163 Merge WEIGHT_STRING function from MySQL-5.6
Diffstat (limited to 'strings/ctype-latin1.c')
-rw-r--r-- | strings/ctype-latin1.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index 759997dae2d..2c84f86fad0 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -452,6 +452,7 @@ struct charset_info_st my_charset_latin1= 255, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ &my_charset_handler, &my_collation_8bit_simple_ci_handler }; @@ -663,22 +664,25 @@ static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)), } -static size_t my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)), - uchar *dest, size_t len, - const uchar *src, size_t srclen) +static size_t +my_strnxfrm_latin1_de(CHARSET_INFO *cs, + uchar *dst, size_t dstlen, uint nweights, + const uchar* src, size_t srclen, uint flags) { - const uchar *de = dest + len; - const uchar *se = src + srclen; - for ( ; src < se && dest < de ; src++) + uchar *de= dst + dstlen; + const uchar *se= src + srclen; + uchar *d0= dst; + for ( ; src < se && dst < de && nweights; src++, nweights--) { - uchar chr=combo1map[*src]; - *dest++=chr; - if ((chr=combo2map[*src]) && dest < de) - *dest++=chr; + uchar chr= combo1map[*src]; + *dst++= chr; + if ((chr= combo2map[*src]) && dst < de && nweights > 1) + { + *dst++= chr; + nweights--; + } } - if (dest < de) - bfill(dest, de - dest, ' '); - return (int) len; + return my_strxfrm_pad_desc_and_reverse(cs, d0, dst, de, nweights, flags, 0); } @@ -750,6 +754,7 @@ struct charset_info_st my_charset_latin1_german2_ci= 247, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ &my_charset_handler, &my_collation_german2_ci_handler }; @@ -782,6 +787,7 @@ struct charset_info_st my_charset_latin1_bin= 255, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ + 1, /* levels_for_order */ &my_charset_handler, &my_collation_8bit_bin_handler }; |