diff options
author | monty@mysql.com <> | 2004-08-26 18:26:38 +0300 |
---|---|---|
committer | monty@mysql.com <> | 2004-08-26 18:26:38 +0300 |
commit | ea687ba5da331017a3600bfd36b5d247efb6f757 (patch) | |
tree | c7d296d78817781f8a0bdd6d65ced41030de842c /strings | |
parent | 4ca548bcc60f34502718f1479c41b4161650a3e6 (diff) | |
download | mariadb-git-ea687ba5da331017a3600bfd36b5d247efb6f757.tar.gz |
Portability fixes
Fixed bug in end space handle for WHERE text_column="constant"
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-bin.c | 5 | ||||
-rw-r--r-- | strings/ctype-mb.c | 41 |
2 files changed, 27 insertions, 19 deletions
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index e759a5654f1..a33398fa6fa 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -93,7 +93,7 @@ static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)), NOTE This function is used for real binary strings, i.e. for BLOB, BINARY(N) and VARBINARY(N). - It does not ignore trailing spaces. + It compares trailing spaces as spaces. RETURN < 0 s < t @@ -133,7 +133,8 @@ static int my_strnncoll_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), NOTE This function is used for character strings with binary collations. - It ignores trailing spaces. + The shorter string is extended with end space to be as long as the longer + one. RETURN < 0 s < t diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index ecafa6356d5..34c2d887247 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -237,7 +237,8 @@ int my_wildcmp_mb(CHARSET_INFO *cs, if (str++ == str_end) return (-1); } { - int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one,w_many); + int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one, + w_many); if (tmp <= 0) return (tmp); } @@ -248,41 +249,46 @@ int my_wildcmp_mb(CHARSET_INFO *cs, return (str != str_end ? 1 : 0); } + uint my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e) + const char *pos, const char *end) { - register uint32 n=0,mblen; - while (b < e) + register uint32 count=0; + while (pos < end) { - b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1; - ++n; + uint mblen; + pos+= (mblen= my_ismbchar(cs,pos,end)) ? mblen : 1; + count++; } - return n; + return count; } + uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e, uint pos) + const char *pos, const char *end, uint length) { - uint mblen; - const char *b0=b; + const char *start= pos; - while (pos && b<e) + while (length && pos < end) { - b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1; - pos--; + uint mblen; + pos+= (mblen= my_ismbchar(cs, pos, end)) ? mblen : 1; + length--; } - return pos ? e+2-b0 : b-b0; + return length ? end+2-start : pos-start; } + uint my_well_formed_len_mb(CHARSET_INFO *cs, const char *b, const char *e, uint pos) { - my_wc_t wc; - int mblen; const char *b_start= b; while (pos) { + my_wc_t wc; + int mblen; + if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <0) break; b+= mblen; @@ -374,7 +380,8 @@ static int my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)), NOTE This function is used for character strings with binary collations. - It ignores trailing spaces. + The shorter string is extended with end space to be as long as the longer + one. RETURN A negative number if s < t |