Blob Blame Raw
From da1e3a2660146aa40d1af9d36d9ab76bc8f76189 Mon Sep 17 00:00:00 2001
From: Paul I <pelijah@users.noreply.github.com>
Date: Sun, 24 Mar 2019 12:39:54 +0300
Subject: [PATCH 1/4] Update radare2 (#1381)

(cherry picked from commit c7adeb4dd6d92058081a3c677f798f71199b0f34)
---
 radare2                   | 2 +-
 src/core/Cutter.cpp       | 5 +++--
 src/lib_radare2.pri       | 3 +--
 src/meson.build           | 2 --
 src/widgets/Dashboard.cpp | 7 +++----
 5 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp
index 226849c..51c8c82 100644
--- a/src/core/Cutter.cpp
+++ b/src/core/Cutter.cpp
@@ -10,6 +10,7 @@
 #include "common/R2Task.h"
 #include "common/Json.h"
 #include "core/Cutter.h"
+#include "r_asm.h"
 #include "sdb.h"
 
 Q_GLOBAL_STATIC(CutterCore, uniqueInstance)
@@ -393,7 +394,7 @@ bool CutterCore::loadFile(QString path, ut64 baddr, ut64 mapaddr, int perms, int
     }
 
     ut64 hashLimit = getConfigut64("cfg.hashlimit");
-    r_bin_file_hash(core_->bin, hashLimit, path.toUtf8().constData());
+    r_bin_file_hash(core_->bin, hashLimit, path.toUtf8().constData(), NULL);
 
     fflush(stdout);
     return true;
@@ -784,7 +785,7 @@ QString CutterCore::assemble(const QString &code)
 QString CutterCore::disassemble(const QString &hex)
 {
     CORE_LOCK();
-    RAsmCode *ac = r_asm_mdisassemble_hexstr(core_->assembler, hex.toUtf8().constData());
+    RAsmCode *ac = r_asm_mdisassemble_hexstr(core_->assembler, NULL, hex.toUtf8().constData());
     QString code = QString(ac != nullptr ? ac->buf_asm : "");
     r_asm_code_free(ac);
     return code;
diff --git a/src/lib_radare2.pri b/src/lib_radare2.pri
index a9e2ee9..315f232 100644
--- a/src/lib_radare2.pri
+++ b/src/lib_radare2.pri
@@ -1,7 +1,6 @@
 win32 {
     DEFINES += _CRT_NONSTDC_NO_DEPRECATE
     DEFINES += _CRT_SECURE_NO_WARNINGS
-    R2_INCLUDEPATH += "$$PWD/../radare2/libr/include/msvc"
     !contains(QT_ARCH, x86_64) {
         LIBS += -L"$$PWD/../r2_dist_x86/radare2/lib"
         R2_INCLUDEPATH += "$$PWD/../r2_dist_x86/include"
@@ -102,4 +101,4 @@ win32 {
         -lr_util \
         -lr_crypto
     }
-}
\ No newline at end of file
+}
diff --git a/src/meson.build b/src/meson.build
index 9ff58f8..d2a955f 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -112,8 +112,6 @@ platform_inc = []
 if host_machine.system() == 'windows'
   add_project_arguments('-D_CRT_NONSTDC_NO_DEPRECATE', language: 'cpp')
   add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: 'cpp')
-  platform_inc = include_directories('../radare2/libr/include/msvc')
-  # Workaround for https://github.com/mesonbuild/meson/issues/2327
   qt_host_libs = run_command('qmake', '-query', 'QT_HOST_LIBS').stdout().strip()
   if get_option('buildtype').startswith('debug')
     qtmain_libname = 'qtmaind.lib'
diff --git a/src/widgets/Dashboard.cpp b/src/widgets/Dashboard.cpp
index ae0bb41..e16b9b9 100644
--- a/src/widgets/Dashboard.cpp
+++ b/src/widgets/Dashboard.cpp
@@ -105,10 +105,9 @@ void Dashboard::updateContents()
     }
 
     // Add file hashes and libraries
-    QString md5 = Core()->cmd("e file.md5");
-    QString sha1 = Core()->cmd("e file.sha1");
-    ui->md5Edit->setText(md5);
-    ui->sha1Edit->setText(sha1);
+    QJsonObject hashes = Core()->cmdj("itj").object();
+    ui->md5Edit->setText(hashes["md5"].toString());
+    ui->sha1Edit->setText(hashes["sha1"].toString());
 
     QString libs = Core()->cmd("il");
     QStringList lines = libs.split("\n", QString::SkipEmptyParts);
-- 
2.21.0