summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-01-08 21:18:38 +0100
committerJamey Hicks <jamey.hicks@nokia.com>2012-01-09 12:28:58 +0100
commitb35b1163b7bd3d48c6f23ed78ece5905868bcc3f (patch)
treea1cf49501ce34c93e2668761a90dd245f1531381 /src
parent36820aaf81585241aea551c0d8d6d688f8abde1b (diff)
Fix a bug in QJsonDocument::operator==()
Also add a test case loading binary data and comparing it to something created from text based json. Change-Id: Ib8ee7a415365498323e57d60cb469695ea34fdaa Sanity-Review: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com> Reviewed-by: Jamey Hicks <jamey.hicks@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/qjsondocument.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qjsondocument.cpp b/src/qjsondocument.cpp
index 3b15b64..a5c39ab 100644
--- a/src/qjsondocument.cpp
+++ b/src/qjsondocument.cpp
@@ -259,10 +259,11 @@ bool JsonDocument::operator==(const JsonDocument &other) const
if (!d || !other.d)
return false;
+
if (d->header->root()->isArray() != other.d->header->root()->isArray())
return false;
- if (d->header->root()->isArray())
+ if (d->header->root()->isObject())
return JsonObject(d, static_cast<Object *>(d->header->root()))
== JsonObject(other.d, static_cast<Object *>(other.d->header->root()));
else