Ensure that the binary JSON objects are actually sorted
QJsonObject requires that, since it does binary searches for the keys. Change-Id: I8a7a116f51864cecb52fffff13bc24660c1cc1ac Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
2be0d3088f
commit
0fa7374f1d
@ -200,6 +200,7 @@ bool Object::isValid() const
|
||||
if (tableOffset + length*sizeof(offset) > size)
|
||||
return false;
|
||||
|
||||
QString lastKey;
|
||||
for (uint i = 0; i < length; ++i) {
|
||||
offset entryOffset = table()[i];
|
||||
if (entryOffset + sizeof(Entry) >= tableOffset)
|
||||
@ -208,8 +209,12 @@ bool Object::isValid() const
|
||||
int s = e->size();
|
||||
if (table()[i] + s > tableOffset)
|
||||
return false;
|
||||
QString key = e->key();
|
||||
if (key < lastKey)
|
||||
return false;
|
||||
if (!e->value.isValid(this))
|
||||
return false;
|
||||
lastKey = key;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user