aboutsummaryrefslogtreecommitdiffstats
path: root/enc
diff options
context:
space:
mode:
Diffstat (limited to 'enc')
-rw-r--r--enc/unicode.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/enc/unicode.c b/enc/unicode.c
index e51c2a1363..5c96448259 100644
--- a/enc/unicode.c
+++ b/enc/unicode.c
@@ -712,12 +712,15 @@ onigenc_unicode_case_map(OnigCaseFoldType* flagP,
if (flags&OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_SPECIALS) { /* special */
OnigCodePoint *SpecialsStart = CaseMappingSpecials + OnigSpecialIndexDecode(folded->n);
- if (OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_TITLECASE) { /* Titlecase available */
- if (flags&ONIGENC_CASE_TITLECASE) { /* titlecase needed */
- if (OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_IS_TITLECASE) /* alread titlecase */
- flags ^= ONIGENC_CASE_MODIFIED;
+ if ((OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_TITLECASE) /* titlecase available, */
+ && (flags&ONIGENC_CASE_TITLECASE) /* AND titlecase needed, */
+ && (OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_IS_TITLECASE)) { /* BUT alread titlecase */
+ flags ^= ONIGENC_CASE_MODIFIED;
+ goto SpecialsCopy;
+ }
+ else if (OnigCaseFoldFlags(folded->n)&ONIGENC_CASE_TITLECASE) { /* Titlecase available */
+ if (flags&ONIGENC_CASE_TITLECASE) /* titlecase needed, but not yet titlecase */
goto SpecialsCopy;
- }
else /* Titlecase not needed */
SpecialsStart += SpecialsLengthExtract(*SpecialsStart);
}