summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qchar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qchar.cpp')
-rw-r--r--src/corelib/tools/qchar.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index 9db7d1a..b296129 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -1481,7 +1481,8 @@ static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion
ucs4 = QChar::surrogateToUcs4(high, ucs4);
}
}
- if (QChar::unicodeVersion(ucs4) > version)
+ QChar::UnicodeVersion v = QChar::unicodeVersion(ucs4);
+ if (v == QChar::Unicode_Unassigned || v > version)
continue;
int length;
int tag;
@@ -1541,7 +1542,7 @@ static ushort ligatureHelper(ushort u1, ushort u2)
return 0;
}
-static void composeHelper(QString *str, int from)
+static void composeHelper(QString *str, QChar::UnicodeVersion version, int from)
{
QString &s = *str;
@@ -1561,7 +1562,14 @@ static void composeHelper(QString *str, int from)
++pos;
}
}
- int combining = QChar::combiningClass(uc);
+ const QUnicodeTables::Properties *p = qGetProp(uc);
+ if (p->unicodeVersion == QChar::Unicode_Unassigned || p->unicodeVersion > version) {
+ starter = -1; // to prevent starter == pos - 1
+ lastCombining = 0;
+ ++pos;
+ continue;
+ }
+ int combining = p->combiningClass;
if (starter == pos - 1 || combining > lastCombining) {
// allowed to form ligature with S
QChar ligature = ligatureHelper(s.at(starter).unicode(), uc);
@@ -1608,7 +1616,7 @@ static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, in
ushort c2 = 0;
{
const QUnicodeTables::Properties *p = qGetProp(u2);
- if ((QChar::UnicodeVersion)p->unicodeVersion <= version)
+ if (p->unicodeVersion != QChar::Unicode_Unassigned && p->unicodeVersion <= version)
c2 = p->combiningClass;
}
if (c2 == 0) {
@@ -1619,7 +1627,7 @@ static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, in
ushort c1 = 0;
{
const QUnicodeTables::Properties *p = qGetProp(u1);
- if ((QChar::UnicodeVersion)p->unicodeVersion <= version)
+ if (p->unicodeVersion != QChar::Unicode_Unassigned && p->unicodeVersion <= version)
c1 = p->combiningClass;
}