diff options
author | Ritt Konstantin <ritt.ks@gmail.com> | 2010-02-24 19:13:22 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-03-05 15:58:06 (GMT) |
commit | 7706e9ba3807f9f31a9310f39f0c8b3007f7fb10 (patch) | |
tree | f1bcf891a6b83ce9cf9eac999d11b248cbd4d796 /util/unicode | |
parent | c0e07ee419b9bf3023d5802a7e685c0d3c817185 (diff) | |
download | Qt-7706e9ba3807f9f31a9310f39f0c8b3007f7fb10.zip Qt-7706e9ba3807f9f31a9310f39f0c8b3007f7fb10.tar.gz Qt-7706e9ba3807f9f31a9310f39f0c8b3007f7fb10.tar.bz2 |
fix some 0x10000 codepoint -related issues
Merge-request: 480
Reviewed-by: Thiago Macieira <thiago.macieira@nokia.com>
Diffstat (limited to 'util/unicode')
-rw-r--r-- | util/unicode/main.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp index 70d362d..14d8046 100644 --- a/util/unicode/main.cpp +++ b/util/unicode/main.cpp @@ -2131,15 +2131,14 @@ static QByteArray createCompositionInfo() if (!d.decomposition.isEmpty()) { int utf16Chars = 0; for (int j = 0; j < d.decomposition.size(); ++j) - utf16Chars += d.decomposition.at(j) > 0x10000 ? 2 : 1; + utf16Chars += d.decomposition.at(j) >= 0x10000 ? 2 : 1; decompositions.append(d.decompositionType + (utf16Chars<<8)); for (int j = 0; j < d.decomposition.size(); ++j) { int code = d.decomposition.at(j); - if (code > 0x10000) { + if (code >= 0x10000) { // save as surrogate pair - code -= 0x10000; - ushort high = code/0x400 + 0xd800; - ushort low = code%0x400 + 0xdc00; + ushort high = QChar::highSurrogate(code); + ushort low = QChar::lowSurrogate(code); decompositions.append(high); decompositions.append(low); } else { @@ -2173,15 +2172,14 @@ static QByteArray createCompositionInfo() if (!d.decomposition.isEmpty()) { int utf16Chars = 0; for (int j = 0; j < d.decomposition.size(); ++j) - utf16Chars += d.decomposition.at(j) > 0x10000 ? 2 : 1; + utf16Chars += d.decomposition.at(j) >= 0x10000 ? 2 : 1; decompositions.append(d.decompositionType + (utf16Chars<<8)); for (int j = 0; j < d.decomposition.size(); ++j) { int code = d.decomposition.at(j); - if (code > 0x10000) { + if (code >= 0x10000) { // save as surrogate pair - code -= 0x10000; - ushort high = code/0x400 + 0xd800; - ushort low = code%0x400 + 0xdc00; + ushort high = QChar::highSurrogate(code); + ushort low = QChar::lowSurrogate(code); decompositions.append(high); decompositions.append(low); } else { |