mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* enc/unicode.c: Fix flag error for switch from titlecase to lowercase.
* test/ruby/enc/test_case_mapping.rb: Tests for above error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
85500b6634
commit
ef6405f71c
3 changed files with 34 additions and 4 deletions
|
@ -670,6 +670,8 @@ onigenc_unicode_case_map(OnigCaseFoldType* flagP,
|
|||
OnigUChar *to_start = to;
|
||||
OnigCaseFoldType flags = *flagP;
|
||||
to_end -= CASE_MAPPING_SLACK;
|
||||
/* copy flags ONIGENC_CASE_UPCASE and ONIGENC_CASE_DOWNCASE over to
|
||||
* ONIGENC_CASE_UP_SPECIAL and ONIGENC_CASE_DOWN_SPECIAL */
|
||||
flags |= (flags&(ONIGENC_CASE_UPCASE|ONIGENC_CASE_DOWNCASE))<<ONIGENC_CASE_SPECIAL_OFFSET;
|
||||
|
||||
while (*pp<end && to<=to_end) {
|
||||
|
@ -780,7 +782,8 @@ onigenc_unicode_case_map(OnigCaseFoldType* flagP,
|
|||
to += ONIGENC_CODE_TO_MBC(enc, code, to);
|
||||
/* switch from titlecase to lowercase for capitalize */
|
||||
if (flags & ONIGENC_CASE_TITLECASE)
|
||||
flags ^= (ONIGENC_CASE_UPCASE|ONIGENC_CASE_TITLECASE|ONIGENC_CASE_DOWNCASE);
|
||||
flags ^= (ONIGENC_CASE_UPCASE |ONIGENC_CASE_DOWNCASE|ONIGENC_CASE_TITLECASE|
|
||||
ONIGENC_CASE_UP_SPECIAL|ONIGENC_CASE_DOWN_SPECIAL);
|
||||
}
|
||||
*flagP = flags;
|
||||
return (int)(to-to_start);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue