diff options
author | unknown <bar@mysql.com/bar.myoffice.izhnet.ru> | 2007-06-28 13:34:44 +0500 |
---|---|---|
committer | unknown <bar@mysql.com/bar.myoffice.izhnet.ru> | 2007-06-28 13:34:44 +0500 |
commit | 54344f681dfc75170867c3e92dd726f9c28a3f41 (patch) | |
tree | da899a52dc4bbef9ed8e4bc182401319f6095505 /strings/ctype-uca.c | |
parent | 9b940d0cb70508ca295bc68a8bab5832d79ededd (diff) | |
download | mariadb-git-54344f681dfc75170867c3e92dd726f9c28a3f41.tar.gz |
Bug#27345 Incorrect data returned when range-read from utf8_danish_ci indexes
Problem: like_range() returned wrong ranges for contractions (like 'ch' in Czech').
Fix: adding a special code to handle tricky cases:
- contraction head followed by a wild character
- full contraction
- contraction part followed by another contraction part,
but they are not a contraction together.
mysql-test/r/ctype_uca.result:
Adding test case
mysql-test/t/ctype_uca.test:
Adding test case
strings/ctype-mb.c:
Adding test case
strings/ctype-uca.c:
Allocate additional 256 bytes for flags "is contraction part".
strings/ctype-ucs2.c:
Adding test case
Diffstat (limited to 'strings/ctype-uca.c')
-rw-r--r-- | strings/ctype-uca.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 4dbda0b9239..81fb9ee1970 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -7937,10 +7937,16 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(uint)) /* Now process contractions */ if (ncontractions) { - uint size= 0x40*0x40*sizeof(uint16); /* 8K, for basic latin letter only */ + /* + 8K for weights for basic latin letter pairs, + plus 256 bytes for "is contraction part" flags. + */ + uint size= 0x40*0x40*sizeof(uint16) + 256; + char *contraction_flags; if (!(cs->contractions= (uint16*) (*alloc)(size))) return 1; bzero((void*)cs->contractions, size); + contraction_flags= ((char*) cs->contractions) + 0x40*0x40; for (i=0; i < rc; i++) { if (rule[i].curr[1]) @@ -7966,6 +7972,9 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(uint)) /* Copy base weight applying primary difference */ cs->contractions[offsc]= offsb[0] + rule[i].diff[0]; + /* Mark both letters as "is contraction part */ + contraction_flags[rule[i].curr[0]]= 1; + contraction_flags[rule[i].curr[1]]= 1; } } } |