summaryrefslogtreecommitdiff
path: root/regex
diff options
context:
space:
mode:
authormonty@mishka.local <>2004-12-22 13:54:39 +0200
committermonty@mishka.local <>2004-12-22 13:54:39 +0200
commit4f4bbfc279800923299df1fefeb2fcd299fcde90 (patch)
tree8e5f08b17957f896c2d4e931e60b57d99c260ed6 /regex
parent198dc7a8ec6e220c348bb47e59a2ac7532be18b8 (diff)
parent98f2a83539735f1a69680195290adcf02861f073 (diff)
downloadmariadb-git-4f4bbfc279800923299df1fefeb2fcd299fcde90.tar.gz
Merge with 4.1
Diffstat (limited to 'regex')
-rw-r--r--regex/regcomp.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/regex/regcomp.c b/regex/regcomp.c
index 5f0351c32aa..998b39379aa 100644
--- a/regex/regcomp.c
+++ b/regex/regcomp.c
@@ -860,11 +860,28 @@ othercase(charset,ch)
CHARSET_INFO *charset;
int ch;
{
+ /*
+ In MySQL some multi-byte character sets
+ have 'ctype' array but don't have 'to_lower'
+ and 'to_upper' arrays. In this case we handle
+ only basic latin letters a..z and A..Z.
+
+ If 'to_lower' and 'to_upper' arrays are empty in a character set,
+ then my_isalpha(cs, ch) should never return TRUE for characters
+ other than basic latin letters. Otherwise it should be
+ considered as a mistake in character set definition.
+ */
assert(my_isalpha(charset,ch));
if (my_isupper(charset,ch))
- return(my_tolower(charset,ch));
+ {
+ return(charset->to_lower ? my_tolower(charset,ch) :
+ ch - 'A' + 'a');
+ }
else if (my_islower(charset,ch))
- return(my_toupper(charset,ch));
+ {
+ return(charset->to_upper ? my_toupper(charset,ch) :
+ ch - 'a' + 'A');
+ }
else /* peculiar, but could happen */
return(ch);
}