Fixed QJsonDocument::fromBinaryData on big endian platforms.

Change-Id: I1786b6222867c8780f6768e5220e7ddff952b28e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
bb10
Konstantin Tokarev 2012-09-24 01:34:01 +04:00 committed by The Qt Project
parent 609d2eebe8
commit 855018ac55
2 changed files with 4 additions and 4 deletions

View File

@ -278,9 +278,9 @@ int Value::usedStorage(const Base *b) const
case QJsonValue::String: {
char *d = data(b);
if (latinOrIntValue)
s = sizeof(ushort) + *(ushort *)d;
s = sizeof(ushort) + qFromLittleEndian(*(ushort *)d);
else
s = sizeof(int) + sizeof(ushort)*(*(int *)d);
s = sizeof(int) + sizeof(ushort) * qFromLittleEndian(*(int *)d);
break;
}
case QJsonValue::Array:

View File

@ -590,9 +590,9 @@ public:
int size() const {
int s = sizeof(Entry);
if (value.latinKey)
s += sizeof(ushort) + *(ushort *) ((const char *)this + sizeof(Entry));
s += sizeof(ushort) + qFromLittleEndian(*(ushort *) ((const char *)this + sizeof(Entry)));
else
s += sizeof(uint) + *(int *) ((const char *)this + sizeof(Entry));
s += sizeof(uint) + qFromLittleEndian(*(int *) ((const char *)this + sizeof(Entry)));
return alignedSize(s);
}