From 434302eae1a0c5d3016fe07c7d343bdbad118a8a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 12 Jan 2016 13:55:01 -0800 Subject: Fix non-Latin1 strings in QJsonDocument on big-endian platforms QJsonDocument stores the entire JSON tree in its binary format. Since the binary format is the same on-disk as in-memory, it has a fixed endianness. But when converting from QString to the little-endian format, the code accidentally converted twice (from little endian, to little endian), which resulted in a no-op and the string got stored as big-endian. It's like encrypting with double-ROT13. No new testcase because tst_QtJson::removeNonLatinKey was already failing and gets fixed by this commit. Task-number: QTBUG-50419 Change-Id: I408dcb81ba654c929f25ffff1428cc79472bbe13 Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Lars Knoll --- src/corelib/json/qjson_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/json') diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h index 5fc021c841..17f49d41c8 100644 --- a/src/corelib/json/qjson_p.h +++ b/src/corelib/json/qjson_p.h @@ -305,7 +305,7 @@ public: { d->length = str.length(); #if Q_BYTE_ORDER == Q_BIG_ENDIAN - const qle_ushort *uc = (const qle_ushort *)str.unicode(); + const ushort *uc = (const ushort *)str.unicode(); for (int i = 0; i < str.length(); ++i) d->utf16[i] = uc[i]; #else -- cgit v1.2.3