diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2012-05-31 16:43:45 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-01 13:11:50 +0200 |
commit | 79194978cdb8770a06648a85eddbefe9acad7b77 (patch) | |
tree | a270fab1f80aba80f77c409eaeea4fc40e840f35 /src/corelib/tools | |
parent | 524d47b3f5653d7643635092a03b7539d59c43e3 (diff) |
Fix a bug in the case conversion code
Chars that have a case conversion that converts
them into several characters can't be handled
by QChar::toUpper() etc and should get ignored. The code
didn't do that correctly.
Change-Id: I281d122e90bf49187b6449088d2fccef2ef75e86
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qchar.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp index ecaeff453b..f7744ee3f1 100644 --- a/src/corelib/tools/qchar.cpp +++ b/src/corelib/tools/qchar.cpp @@ -1152,8 +1152,7 @@ static inline T toLowerCase_helper(T uc) const QUnicodeTables::Properties *p = qGetProp(uc); if (p->lowerCaseSpecial) { const ushort *specialCase = specialCaseMap + p->lowerCaseDiff; - if (*specialCase == 1) - return specialCase[1]; + return (*specialCase == 1) ? specialCase[1] : uc; } return uc + p->lowerCaseDiff; } @@ -1164,8 +1163,7 @@ static inline T toUpperCase_helper(T uc) const QUnicodeTables::Properties *p = qGetProp(uc); if (p->upperCaseSpecial) { const ushort *specialCase = specialCaseMap + p->upperCaseDiff; - if (*specialCase == 1) - return specialCase[1]; + return (*specialCase == 1) ? specialCase[1] : uc; } return uc + p->upperCaseDiff; } @@ -1176,8 +1174,7 @@ static inline T toTitleCase_helper(T uc) const QUnicodeTables::Properties *p = qGetProp(uc); if (p->titleCaseSpecial) { const ushort *specialCase = specialCaseMap + p->titleCaseDiff; - if (*specialCase == 1) - return specialCase[1]; + return (*specialCase == 1) ? specialCase[1] : uc; } return uc + p->titleCaseDiff; } @@ -1188,8 +1185,7 @@ static inline T toCaseFolded_helper(T uc) const QUnicodeTables::Properties *p = qGetProp(uc); if (p->caseFoldSpecial) { const ushort *specialCase = specialCaseMap + p->caseFoldDiff; - if (*specialCase == 1) - return specialCase[1]; + return (*specialCase == 1) ? specialCase[1] : uc; } return uc + p->caseFoldDiff; } |