Skip to content

Commit 3d7e682

Browse files
committed
Fix build for latest r2-5.9.9
1 parent 008e0e3 commit 3d7e682

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

src/core/Iaito.cpp

+13-8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
#else
3232
#define BO o
3333
#endif
34+
#if R2_VERSION_NUMBER >= 50909
35+
#define ADDRESS_OF(x) (x)->addr
36+
#else
37+
#define ADDRESS_OF(x) (x)->offset
38+
#endif
3439

3540
Q_GLOBAL_STATIC(IaitoCore, uniqueInstance)
3641

@@ -409,13 +414,13 @@ QString IaitoCore::cmdHtml(const char *str)
409414
{
410415
CORE_LOCK();
411416

412-
RVA offset = core->offset;
417+
RVA offset = ADDRESS_OF (core);
413418
r_core_cmd0(core, "e scr.html=true;e scr.color=2");
414419
char *res = r_core_cmd_str(core, str);
415420
r_core_cmd0(core, "e scr.html=false;e scr.color=0");
416421
QString o = fromOwnedCharPtr(res);
417422

418-
if (offset != core->offset) {
423+
if (offset != ADDRESS_OF (core)) {
419424
updateSeek();
420425
}
421426
return o;
@@ -425,11 +430,11 @@ QString IaitoCore::cmd(const char *str)
425430
{
426431
CORE_LOCK();
427432

428-
RVA offset = core->offset;
433+
RVA offset = ADDRESS_OF (core);
429434
char *res = r_core_cmd_str(core, str);
430435
QString o = fromOwnedCharPtr(res);
431436

432-
if (offset != core->offset) {
437+
if (offset != ADDRESS_OF (core)) {
433438
updateSeek();
434439
}
435440
return o;
@@ -490,13 +495,13 @@ bool IaitoCore::asyncCmd(const char *str, QSharedPointer<R2Task> &task)
490495

491496
CORE_LOCK();
492497

493-
RVA offset = core->offset;
498+
RVA offset = ADDRESS_OF (core);
494499

495500
task = QSharedPointer<R2Task>(new R2Task(str, true));
496501
connect(task.data(), &R2Task::finished, task.data(), [this, offset, task]() {
497502
CORE_LOCK();
498503

499-
if (offset != core->offset) {
504+
if (offset != ADDRESS_OF (core)) {
500505
updateSeek();
501506
}
502507
});
@@ -991,7 +996,7 @@ void IaitoCore::seek(ut64 offset)
991996

992997
// use cmd and not cmdRaw to make sure seekChanged is emitted
993998
cmd(QStringLiteral("s %1").arg(offset));
994-
// cmd already does emit seekChanged(core_->offset);
999+
// cmd already does emit seekChanged(core_->addr);
9951000
}
9961001

9971002
void IaitoCore::showMemoryWidget()
@@ -1070,7 +1075,7 @@ RVA IaitoCore::nextOpAddr(RVA startAddr, int count)
10701075

10711076
RVA IaitoCore::getOffset()
10721077
{
1073-
return core_->offset;
1078+
return ADDRESS_OF (core_);
10741079
}
10751080

10761081
ut64 IaitoCore::math(const QString &expr)

src/core/Iaito.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ class R2TaskDialog;
3131
#include "common/R2Task.h"
3232
#include "dialogs/R2TaskDialog.h"
3333

34+
#if R2_VERSION_NUMBER >= 50909
35+
#define ADDRESS_OF(x) (x)->addr
36+
#else
37+
#define ADDRESS_OF(x) (x)->offset
38+
#endif
39+
3440
#if __APPLE__ && QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
3541
#define QFILEDIALOG_FLAGS QFileDialog::DontUseNativeDialog
3642
#else
@@ -65,7 +71,7 @@ class IAITO_EXPORT IaitoCore : public QObject
6571

6672
AsyncTaskManager *getAsyncTaskManager() { return asyncTaskManager; }
6773

68-
RVA getOffset() const { return core_->offset; }
74+
RVA getOffset() const { return ADDRESS_OF (core_); }
6975

7076
/* Core functions (commands) */
7177
static QString sanitizeStringForCommand(QString s);

0 commit comments

Comments
 (0)