summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-08-26 18:27:33 +0300
committerunknown <monty@mysql.com>2004-08-26 18:27:33 +0300
commit717fc0b01eae7a0c0f647ff16cd5b7244fcc21e8 (patch)
treef50012bc1acc5d741fe45620f11da82773be8227 /strings
parentc75e4dfed14e0f96e3458e2a8764ef570bf3b744 (diff)
parent44b2807e4bb2383525c3abfd9ad896114dec0796 (diff)
downloadmariadb-git-717fc0b01eae7a0c0f647ff16cd5b7244fcc21e8.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1 libmysql/libmysql.c: Auto merged mysql-test/r/endspace.result: Auto merged strings/ctype-bin.c: Auto merged strings/ctype-mb.c: Auto merged
Diffstat (limited to 'strings')
-rw-r--r--strings/ctype-bin.c5
-rw-r--r--strings/ctype-mb.c41
2 files changed, 27 insertions, 19 deletions
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index 9e59c22c31e..42dc0ab086d 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 7af76126fc4..2548a68ab19 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