diff options
author | Alexander Barkov <bar@mariadb.com> | 2023-04-05 15:42:27 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2023-04-05 16:16:19 +0400 |
commit | 62e137d4d739fcba6810a66242175230e8170727 (patch) | |
tree | 3d277e4400c735ff13f84870fd09d808b7311d8e /strings | |
parent | afdf19cf3303bf3797fe47e5cef398227134cc32 (diff) | |
parent | 06393cd8f81e6c9a01e9ae1c8783a7f6dac21fbd (diff) | |
download | mariadb-git-62e137d4d739fcba6810a66242175230e8170727.tar.gz |
Merge remote-tracking branch 'origin/10.4' into 10.5
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-bin.c | 6 | ||||
-rw-r--r-- | strings/ctype-simple.c | 3 | ||||
-rw-r--r-- | strings/ctype-tis620.c | 3 | ||||
-rw-r--r-- | strings/ctype-uca.inl | 27 | ||||
-rw-r--r-- | strings/ctype.c | 6 | ||||
-rw-r--r-- | strings/strcoll.inl | 3 | ||||
-rw-r--r-- | strings/strings_def.h | 6 |
7 files changed, 36 insertions, 18 deletions
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index a8420722f25..509d44672d2 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -130,7 +130,8 @@ static int my_strnncollsp_binary(CHARSET_INFO * cs __attribute__((unused)), static int my_strnncollsp_nchars_binary(CHARSET_INFO * cs __attribute__((unused)), const uchar *s, size_t slen, const uchar *t, size_t tlen, - size_t nchars) + size_t nchars, + uint flags) { set_if_smaller(slen, nchars); set_if_smaller(tlen, nchars); @@ -215,7 +216,8 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), static int my_strnncollsp_nchars_8bit_bin(CHARSET_INFO * cs, const uchar *a, size_t a_length, const uchar *b, size_t b_length, - size_t nchars) + size_t nchars, + uint flags) { set_if_smaller(a_length, nchars); set_if_smaller(b_length, nchars); diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 220cecbabfe..a50c570ec6b 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -212,7 +212,8 @@ static int my_strnncollsp_nchars_simple(CHARSET_INFO * cs, const uchar *a, size_t a_length, const uchar *b, size_t b_length, - size_t nchars) + size_t nchars, + uint flags) { set_if_smaller(a_length, nchars); set_if_smaller(b_length, nchars); diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index e6f6ad24eec..8bc9d9e8be0 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -591,7 +591,8 @@ static int my_strnncollsp_nchars_tis620(CHARSET_INFO * cs, const uchar *a, size_t a_length, const uchar *b, size_t b_length, - size_t nchars) + size_t nchars, + uint flags) { set_if_smaller(a_length, nchars); set_if_smaller(b_length, nchars); diff --git a/strings/ctype-uca.inl b/strings/ctype-uca.inl index ddc397ce212..0bde7d60d51 100644 --- a/strings/ctype-uca.inl +++ b/strings/ctype-uca.inl @@ -317,6 +317,7 @@ MY_FUNCTION_NAME(strnncollsp_nopad_multilevel)(CHARSET_INFO *cs, static inline weight_and_nchars_t MY_FUNCTION_NAME(scanner_next_pad_trim)(my_uca_scanner *scanner, size_t nchars, + uint flags, uint *generated) { weight_and_nchars_t res; @@ -330,7 +331,10 @@ MY_FUNCTION_NAME(scanner_next_pad_trim)(my_uca_scanner *scanner, We reached the end of the string, but the caller wants more weights. Perform space padding. */ - res.weight= my_space_weight(scanner->level); + res.weight= + flags & MY_STRNNCOLLSP_NCHARS_EMULATE_TRIMMED_TRAILING_SPACES ? + my_space_weight(scanner->level) : 0; + res.nchars= 1; (*generated)++; } @@ -367,7 +371,8 @@ MY_FUNCTION_NAME(strnncollsp_nchars_onelevel)(CHARSET_INFO *cs, const MY_UCA_WEIGHT_LEVEL *level, const uchar *s, size_t slen, const uchar *t, size_t tlen, - size_t nchars) + size_t nchars, + uint flags) { my_uca_scanner sscanner; my_uca_scanner tscanner; @@ -385,15 +390,17 @@ MY_FUNCTION_NAME(strnncollsp_nchars_onelevel)(CHARSET_INFO *cs, int diff; s_res= MY_FUNCTION_NAME(scanner_next_pad_trim)(&sscanner, s_nchars_left, - &generated); + flags, &generated); t_res= MY_FUNCTION_NAME(scanner_next_pad_trim)(&tscanner, t_nchars_left, - &generated); + flags, &generated); + if ((diff= (s_res.weight - t_res.weight))) return diff; if (generated == 2) { - if (cs->state & MY_CS_NOPAD) + if ((cs->state & MY_CS_NOPAD) && + (flags & MY_STRNNCOLLSP_NCHARS_EMULATE_TRIMMED_TRAILING_SPACES)) { /* Both values are auto-generated. There's no real data any more. @@ -445,11 +452,12 @@ static int MY_FUNCTION_NAME(strnncollsp_nchars)(CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *t, size_t tlen, - size_t nchars) + size_t nchars, + uint flags) { return MY_FUNCTION_NAME(strnncollsp_nchars_onelevel)(cs, &cs->uca->level[0], s, slen, t, tlen, - nchars); + nchars, flags); } @@ -460,7 +468,8 @@ static int MY_FUNCTION_NAME(strnncollsp_nchars_multilevel)(CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *t, size_t tlen, - size_t nchars) + size_t nchars, + uint flags) { uint num_level= cs->levels_for_order; uint i; @@ -470,7 +479,7 @@ MY_FUNCTION_NAME(strnncollsp_nchars_multilevel)(CHARSET_INFO *cs, &cs->uca->level[i], s, slen, t, tlen, - nchars); + nchars, flags); if (ret) return ret; } diff --git a/strings/ctype.c b/strings/ctype.c index f18d5b61a37..f1c1ec9d7fc 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -1356,7 +1356,8 @@ outp: int my_strnncollsp_nchars_generic(CHARSET_INFO *cs, const uchar *str1, size_t len1, const uchar *str2, size_t len2, - size_t nchars) + size_t nchars, + uint flags) { int error; len1= my_well_formed_length(cs, (const char *) str1, @@ -1373,7 +1374,8 @@ int my_strnncollsp_nchars_generic(CHARSET_INFO *cs, int my_strnncollsp_nchars_generic_8bit(CHARSET_INFO *cs, const uchar *str1, size_t len1, const uchar *str2, size_t len2, - size_t nchars) + size_t nchars, + uint flags) { set_if_smaller(len1, nchars); set_if_smaller(len2, nchars); diff --git a/strings/strcoll.inl b/strings/strcoll.inl index 50849c06e7d..1a727e23847 100644 --- a/strings/strcoll.inl +++ b/strings/strcoll.inl @@ -305,7 +305,8 @@ static int MY_FUNCTION_NAME(strnncollsp_nchars)(CHARSET_INFO *cs __attribute__((unused)), const uchar *a, size_t a_length, const uchar *b, size_t b_length, - size_t nchars) + size_t nchars, + uint flags) { const uchar *a_end= a + a_length; const uchar *b_end= b + b_length; diff --git a/strings/strings_def.h b/strings/strings_def.h index ba7601f5886..f3602f390a2 100644 --- a/strings/strings_def.h +++ b/strings/strings_def.h @@ -108,12 +108,14 @@ static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len) int my_strnncollsp_nchars_generic(CHARSET_INFO *cs, const uchar *str1, size_t len1, const uchar *str2, size_t len2, - size_t nchars); + size_t nchars, + uint flags); int my_strnncollsp_nchars_generic_8bit(CHARSET_INFO *cs, const uchar *str1, size_t len1, const uchar *str2, size_t len2, - size_t nchars); + size_t nchars, + uint flags); uint my_8bit_charset_flags_from_data(CHARSET_INFO *cs); uint my_8bit_collation_flags_from_data(CHARSET_INFO *cs); |