summaryrefslogtreecommitdiffstats
path: root/src/corelib/json
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-03-13 18:39:03 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-03-13 19:27:21 +0000
commit59a3ca679ede2cb9b6a162edf8eba5cf6d9af4a9 (patch)
tree0d0f76caa042db299cddaa84c14c28e4c80b2ffd /src/corelib/json
parent447a508d003ce487f2be69af9ab05aeec272e64d (diff)
parent50d0f57b77b8088875d7185c5906b5f57985d5fb (diff)
Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7
Diffstat (limited to 'src/corelib/json')
-rw-r--r--src/corelib/json/qjson_p.h9
-rw-r--r--src/corelib/json/qjsonparser.cpp2
2 files changed, 9 insertions, 2 deletions
diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h
index 4c628ff1fe..e5010c2da7 100644
--- a/src/corelib/json/qjson_p.h
+++ b/src/corelib/json/qjson_p.h
@@ -151,6 +151,13 @@ public:
return *this;
}
};
+} // namespace QJsonPrivate
+
+template <typename T>
+class QTypeInfo<QJsonPrivate::q_littleendian<T> >
+ : public QTypeInfoMerger<QJsonPrivate::q_littleendian<T>, T> {};
+
+namespace QJsonPrivate {
typedef q_littleendian<short> qle_short;
typedef q_littleendian<unsigned short> qle_ushort;
@@ -402,7 +409,7 @@ public:
// pack with itself, we'll discard the high part anyway
chunk = _mm_packus_epi16(chunk, chunk);
// unaligned 64-bit store
- *(quint64*)&l[i] = _mm_cvtsi128_si64(chunk);
+ qUnalignedStore(l + i, _mm_cvtsi128_si64(chunk));
i += 8;
}
# endif
diff --git a/src/corelib/json/qjsonparser.cpp b/src/corelib/json/qjsonparser.cpp
index 04bdb57d6b..2926adf10a 100644
--- a/src/corelib/json/qjsonparser.cpp
+++ b/src/corelib/json/qjsonparser.cpp
@@ -738,7 +738,7 @@ bool Parser::parseNumber(QJsonPrivate::Value *val, int baseOffset)
}
int pos = reserveSpace(sizeof(double));
- *(quint64 *)(data + pos) = qToLittleEndian(ui);
+ qToLittleEndian(ui, reinterpret_cast<uchar *>(data + pos));
if (current - baseOffset >= Value::MaxSize) {
lastError = QJsonParseError::DocumentTooLarge;
return false;