summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/corelib/tools/qstring
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-04-12 18:21:39 +0300
committerQt by Nokia <qt-info@nokia.com>2012-04-13 10:44:28 +0200
commit9fd2edb6da5f1f6d644cd7c3f35aebe3e88beee2 (patch)
treed644aeef68584469ec1b9b6cdbc3d86cc7ddf86b /tests/benchmarks/corelib/tools/qstring
parentb317fe2a606e5b79f24b1e4a1b808f5ff66d3621 (diff)
replace hardcoded values with a surrogate handling methods
Change-Id: Ib41e08d835f2e8ca2e32b4025c6f5a99840f2e27 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests/benchmarks/corelib/tools/qstring')
-rw-r--r--tests/benchmarks/corelib/tools/qstring/main.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp
index 40300af947..9f9e7e41d5 100644
--- a/tests/benchmarks/corelib/tools/qstring/main.cpp
+++ b/tests/benchmarks/corelib/tools/qstring/main.cpp
@@ -1996,7 +1996,7 @@ int fromUtf8_qt47(ushort *dst, const char *chars, int len)
bool nonCharacter;
if (!headerdone && uc == 0xfeff) {
// don't do anything, just skip the BOM
- } else if (!(nonCharacter = isUnicodeNonCharacter(uc)) && uc > 0xffff && uc < 0x110000) {
+ } else if (!(nonCharacter = isUnicodeNonCharacter(uc)) && QChar::requiresSurrogates(uc) && uc < 0x110000) {
// surrogate pair
//Q_ASSERT((qch - (ushort*)result.unicode()) + 2 < result.length());
*qch++ = QChar::highSurrogate(uc);
@@ -2102,7 +2102,7 @@ int fromUtf8_qt47_stateless(ushort *dst, const char *chars, int len)
bool nonCharacter;
if (!headerdone && uc == 0xfeff) {
// don't do anything, just skip the BOM
- } else if (!(nonCharacter = isUnicodeNonCharacter(uc)) && uc > 0xffff && uc < 0x110000) {
+ } else if (!(nonCharacter = isUnicodeNonCharacter(uc)) && QChar::requiresSurrogates(uc) && uc < 0x110000) {
// surrogate pair
//Q_ASSERT((qch - (ushort*)result.unicode()) + 2 < result.length());
*qch++ = QChar::highSurrogate(uc);
@@ -2258,7 +2258,7 @@ static inline void extract_utf8_multibyte(ushort *&dst, const char *&chars, qptr
// dst[counter] will correspond to chars[counter..counter+2], so adjust
chars += 3;
len -= 3;
- if (trusted || (ucs >= 0x10000 && ucs < 0x110000 && !isUnicodeNonCharacter(ucs))) {
+ if (trusted || (QChar::requiresSurrogates(ucs) && ucs < 0x110000 && !isUnicodeNonCharacter(ucs))) {
dst[counter + 0] = QChar::highSurrogate(ucs);
dst[counter + 1] = QChar::lowSurrogate(ucs);
counter += 2;