diff --git a/src/common/BugReporting.cpp b/src/common/BugReporting.cpp index 95da855f..13463d00 100644 --- a/src/common/BugReporting.cpp +++ b/src/common/BugReporting.cpp @@ -10,7 +10,8 @@ void openIssue() { RzCoreLocked core(Core()); RzBinFile *bf = rz_bin_cur(core->bin); - RzBinInfo *info = rz_bin_get_info(core->bin); + RzBinObject *bobj = rz_bin_cur_object(core->bin); + const RzBinInfo *info = bobj ? rz_bin_object_get_info(bobj) : nullptr; RzBinPlugin *plugin = rz_bin_file_cur_plugin(bf); QString url, osInfo, format, arch, type; diff --git a/src/core/Cutter.cpp b/src/core/Cutter.cpp index 3bce681a..6951e01a 100644 --- a/src/core/Cutter.cpp +++ b/src/core/Cutter.cpp @@ -517,7 +517,7 @@ CutterJson CutterCore::parseJson(const char *name, char *res, const char *cmd) return CutterJson(doc, QSharedPointer::create(doc, res)); } -QStringList CutterCore::autocomplete(const QString &cmd, RzLinePromptType promptType, size_t limit) +QStringList CutterCore::autocomplete(const QString &cmd, RzLinePromptType promptType) { RzLineBuffer buf; int c = snprintf(buf.data, sizeof(buf.data), "%s", cmd.toUtf8().constData()); @@ -526,18 +526,17 @@ QStringList CutterCore::autocomplete(const QString &cmd, RzLinePromptType prompt } buf.index = buf.length = std::min((int)(sizeof(buf.data) - 1), c); - RzLineCompletion completion; - rz_line_completion_init(&completion, limit); - rz_core_autocomplete(core(), &completion, &buf, promptType); + RzLineNSCompletionResult *compr = rz_core_autocomplete_rzshell(core(), &buf, promptType); QStringList r; - r.reserve(rz_pvector_len(&completion.args)); - for (size_t i = 0; i < rz_pvector_len(&completion.args); i++) { + auto optslen = rz_pvector_len(&compr->options); + r.reserve(optslen); + for (size_t i = 0; i < optslen; i++) { r.push_back(QString::fromUtf8( - reinterpret_cast(rz_pvector_at(&completion.args, i)))); + reinterpret_cast(rz_pvector_at(&compr->options, i)))); } + rz_line_ns_completion_result_free(compr); - rz_line_completion_fini(&completion); return r; } @@ -1377,7 +1376,11 @@ CutterJson CutterCore::getSignatureInfo() bool CutterCore::existsFileInfo() { CORE_LOCK(); - const RzBinInfo *info = rz_bin_get_info(core->bin); + RzBinObject *bobj = rz_bin_cur_object(core->bin); + if (!bobj) { + return false; + } + const RzBinInfo *info = rz_bin_object_get_info(bobj); if (!(info && info->rclass)) { return false; } @@ -3179,11 +3182,11 @@ QList CutterCore::getAllSymbols() } } - const RzList *entries = rz_bin_object_get_entries(bf->o); - if (entries) { + const RzPVector *entries = rz_bin_object_get_entries(bf->o); + if (symbols) { /* list entrypoints as symbols too */ int n = 0; - for (const auto &entry : CutterRzList(entries)) { + for (const auto &entry : CutterPVector(entries)) { SymbolDescription symbol; symbol.vaddr = entry->vaddr; symbol.name = QString("entry") + QString::number(n++); @@ -3496,10 +3499,8 @@ QList CutterCore::getAllEntrypoint() ut64 laddr = rz_bin_get_laddr(core->bin); QList qList; - const RzList *entries = rz_bin_object_get_entries(bf->o); - RzListIter *iter; - RzBinAddr *entry; - CutterRzListForeach (entries, iter, RzBinAddr, entry) { + const RzPVector *entries = rz_bin_object_get_entries(bf->o); + for (const auto &entry : CutterPVector(entries)) { if (entry->type != RZ_BIN_ENTRY_TYPE_PROGRAM) { continue; } diff --git a/src/core/Cutter.h b/src/core/Cutter.h index 1ebf89f8..1715c4da 100644 --- a/src/core/Cutter.h +++ b/src/core/Cutter.h @@ -187,7 +187,7 @@ public: return parseJson(name, res, cmd.isNull() ? nullptr : cmd.toLocal8Bit().constData()); } - QStringList autocomplete(const QString &cmd, RzLinePromptType promptType, size_t limit = 4096); + QStringList autocomplete(const QString &cmd, RzLinePromptType promptType); /* Functions methods */ void renameFunction(const RVA offset, const QString &newName); diff --git a/src/dialogs/VersionInfoDialog.cpp b/src/dialogs/VersionInfoDialog.cpp index dd43f23e..9cd5e03c 100644 --- a/src/dialogs/VersionInfoDialog.cpp +++ b/src/dialogs/VersionInfoDialog.cpp @@ -24,7 +24,11 @@ VersionInfoDialog::~VersionInfoDialog() {} void VersionInfoDialog::fillVersionInfo() { RzCoreLocked core(Core()); - const RzBinInfo *info = rz_bin_get_info(core->bin); + RzBinObject *bobj = rz_bin_cur_object(core->bin); + if (!bobj) { + return; + } + const RzBinInfo *info = rz_bin_object_get_info(bobj); if (!info || !info->rclass) { return; } diff --git a/src/widgets/Dashboard.cpp b/src/widgets/Dashboard.cpp index 192aab30..29a4317f 100644 --- a/src/widgets/Dashboard.cpp +++ b/src/widgets/Dashboard.cpp @@ -52,7 +52,8 @@ void Dashboard::updateContents() } // Add file hashes, analysis info and libraries - RzBinInfo *binInfo = rz_bin_get_info(core->bin); + RzBinObject *bobj = rz_bin_cur_object(core->bin); + const RzBinInfo *binInfo = bobj ? rz_bin_object_get_info(bobj) : nullptr; setPlainText(ui->fileEdit, binInfo ? binInfo->file : ""); setPlainText(ui->formatEdit, binInfo ? binInfo->rclass : ""); @@ -211,7 +212,7 @@ void Dashboard::setPlainText(QLineEdit *textBox, const QString &text) * @brief Setting boolean values of binary information in dashboard * @param RzBinInfo */ -void Dashboard::setRzBinInfo(RzBinInfo *binInfo) +void Dashboard::setRzBinInfo(const RzBinInfo *binInfo) { setPlainText(ui->vaEdit, binInfo ? setBoolText(binInfo->has_va) : ""); setPlainText(ui->canaryEdit, binInfo ? setBoolText(binInfo->has_canary) : ""); diff --git a/src/widgets/Dashboard.h b/src/widgets/Dashboard.h index a7ee5c15..758249d5 100644 --- a/src/widgets/Dashboard.h +++ b/src/widgets/Dashboard.h @@ -33,7 +33,7 @@ private slots: private: std::unique_ptr ui; void setPlainText(QLineEdit *textBox, const QString &text); - void setRzBinInfo(RzBinInfo *binInfo); + void setRzBinInfo(const RzBinInfo *binInfo); const char *setBoolText(bool value); QWidget *hashesWidget = nullptr;