summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-05-04 16:51:00 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-05-11 14:51:56 (GMT)
commitfb6c3e4f31dd0943d8751c986f7112dccd604211 (patch)
tree718ebcde9c93f9be330ecbcb7a50525c920c75f9 /src/corelib/tools
parent65a46b9f0b130cb3e509d7e4c06ab662b2fb54ec (diff)
downloadQt-fb6c3e4f31dd0943d8751c986f7112dccd604211.zip
Qt-fb6c3e4f31dd0943d8751c986f7112dccd604211.tar.gz
Qt-fb6c3e4f31dd0943d8751c986f7112dccd604211.tar.bz2
fix composition (C/KC) of some sequences
an unassigned code point should be treated like a starter code point; thus, if we have met an unassigned code point in the currently processed sequence, we should start process the next one (but we know there are no composed character for an unassigned starter -> simply skip it) This patch doesn't apply to qtbase, commit 46b78113b22428e6f8540193fcf0e00591dbd724 solved the same issue in a different way. Change-Id: I781a26024878d8b83a182b0fd4e681be2a6d9a27 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qchar.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index e5d7c82..017c0f2 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -1546,7 +1546,7 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, int from)
{
QString &s = *str;
- if (s.length() - from < 2)
+ if (from < 0 || s.length() - from < 2)
return;
// the loop can partly ignore high Unicode as all ligatures are in the BMP
@@ -1565,12 +1565,13 @@ static void composeHelper(QString *str, QChar::UnicodeVersion version, int from)
const QUnicodeTables::Properties *p = qGetProp(uc);
if (p->unicodeVersion == QChar::Unicode_Unassigned || p->unicodeVersion > version) {
starter = -1; // to prevent starter == pos - 1
- lastCombining = 0;
+ lastCombining = 255; // to prevent combining > lastCombining
++pos;
continue;
}
int combining = p->combiningClass;
if (starter == pos - 1 || combining > lastCombining) {
+ Q_ASSERT(starter >= from);
// allowed to form ligature with S
QChar ligature = ligatureHelper(s.at(starter).unicode(), uc);
if (ligature.unicode()) {