From ea687ba5da331017a3600bfd36b5d247efb6f757 Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Thu, 26 Aug 2004 18:26:38 +0300 Subject: Portability fixes Fixed bug in end space handle for WHERE text_column="constant" --- strings/ctype-bin.c | 5 +++-- strings/ctype-mb.c | 41 ++++++++++++++++++++++++----------------- 2 files changed, 27 insertions(+), 19 deletions(-) (limited to 'strings') 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 && bcset->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 -- cgit v1.2.1