diff options
| author | Lars Knoll <lars.knoll@nokia.com> | 2012-04-16 12:04:34 +0200 |
|---|---|---|
| committer | Lars Knoll <lars.knoll@nokia.com> | 2012-04-16 12:04:34 +0200 |
| commit | 9bd032355163d92cda5e7e59ecd21214b131f187 (patch) | |
| tree | 002fa12558505683143c7eb08949a3d225bf0712 /src/corelib/json/qjsonparser.cpp | |
| parent | d037d25c3d5236623371cf051aaf6a9e59792ba7 (diff) | |
| parent | 41673c45dde2eb95ee21dd918235218399f2be2c (diff) | |
Merge remote-tracking branch 'origin/master' into api_changes
Conflicts:
configure
src/corelib/io/qurl.cpp
src/gui/kernel/qwindow.cpp
src/tools/moc/generator.cpp
src/widgets/kernel/qwidget_qpa.cpp
src/widgets/styles/qstyle.h
src/widgets/widgets/qtabbar.cpp
tests/auto/corelib/codecs/utf8/tst_utf8.cpp
Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
Diffstat (limited to 'src/corelib/json/qjsonparser.cpp')
| -rw-r--r-- | src/corelib/json/qjsonparser.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp index 9b11c9ac3e7..a17426580fd 100644 --- a/src/corelib/json/qjsonparser.cpp +++ b/src/corelib/json/qjsonparser.cpp @@ -731,7 +731,7 @@ static inline bool isUnicodeNonCharacter(uint ucs4) // U+FDEF (inclusive) return (ucs4 & 0xfffe) == 0xfffe - || (ucs4 - 0xfdd0U) < 16; + || (ucs4 - 0xfdd0U) < 32; } static inline bool scanUtf8Char(const char *&json, const char *end, uint *result) @@ -769,9 +769,10 @@ static inline bool scanUtf8Char(const char *&json, const char *end, uint *result uc = (uc << 6) | (ch & 0x3f); } - if (isUnicodeNonCharacter(uc) || uc >= 0x110000 || - (uc < min_uc) || (uc >= 0xd800 && uc <= 0xdfff)) + if (uc < min_uc || isUnicodeNonCharacter(uc) || + (uc >= 0xd800 && uc <= 0xdfff) || uc >= 0x110000) { return false; + } *result = uc; return true; @@ -850,7 +851,7 @@ bool Parser::parseString(bool *latin1) return false; } } - if (ch > 0xffff) { + if (QChar::requiresSurrogates(ch)) { int pos = reserveSpace(4); *(QJsonPrivate::qle_ushort *)(data + pos) = QChar::highSurrogate(ch); *(QJsonPrivate::qle_ushort *)(data + pos + 2) = QChar::lowSurrogate(ch); |
