Fix #188: Qt fails to handle long integers when decoding JSON (#189)

This commit is contained in:
Thomas (nezza-_-) Roth 2017-12-08 00:37:48 +01:00 committed by xarkes
parent 5aedbdba71
commit 5ce151da94

View File

@ -1537,7 +1537,7 @@ void DisassemblerGraphView::loadCurrentGraph()
QJsonObject func = funcRef.toObject(); QJsonObject func = funcRef.toObject();
Function f; Function f;
f.ready = true; f.ready = true;
f.entry = func["offset"].toInt(); f.entry = func["offset"].toVariant().toULongLong();
QString windowTitle = tr("Graph"); QString windowTitle = tr("Graph");
QString funcName = func["name"].toString().trimmed(); QString funcName = func["name"].toString().trimmed();
@ -1546,7 +1546,6 @@ void DisassemblerGraphView::loadCurrentGraph()
windowTitle += " (" + funcName + ")"; windowTitle += " (" + funcName + ")";
} }
this->parentWidget()->setWindowTitle(windowTitle); this->parentWidget()->setWindowTitle(windowTitle);
f.update_id = anal.update_id; f.update_id = anal.update_id;
for (QJsonValueRef blockRef : func["blocks"].toArray()) { for (QJsonValueRef blockRef : func["blocks"].toArray()) {
@ -1556,14 +1555,14 @@ void DisassemblerGraphView::loadCurrentGraph()
/* Parse Block data */ /* Parse Block data */
Block b; Block b;
b.entry = block["offset"].toInt(); b.entry = block["offset"].toVariant().toULongLong();
fail = block["fail"].toInt(); fail = block["fail"].toVariant().toULongLong();
if (fail) if (fail)
{ {
b.false_path = fail; b.false_path = fail;
b.exits.push_back(fail); b.exits.push_back(fail);
} }
jump = block["jump"].toInt(); jump = block["jump"].toVariant().toULongLong();
if (jump) if (jump)
{ {
if (fail) { if (fail) {
@ -1575,7 +1574,7 @@ void DisassemblerGraphView::loadCurrentGraph()
for (QJsonValueRef opRef : block["ops"].toArray()) { for (QJsonValueRef opRef : block["ops"].toArray()) {
QJsonObject op = opRef.toObject(); QJsonObject op = opRef.toObject();
Instr i; Instr i;
i.addr = op["offset"].toInt(); i.addr = op["offset"].toVariant().toULongLong();
RichTextPainter::List richText; RichTextPainter::List richText;
Colors::colorizeAssembly(richText, op["opcode"].toString(), op["type_num"].toVariant().toULongLong()); Colors::colorizeAssembly(richText, op["opcode"].toString(), op["type_num"].toVariant().toULongLong());
if (op["comment"].toString().length()) { if (op["comment"].toString().length()) {