Fix CutterCore::getBinPluginDescriptions() args (#2777)

This commit is contained in:
Florian Märkl 2021-09-24 10:16:35 +02:00 committed by GitHub
parent 01dc1c2337
commit 9ddc19fcc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 20 deletions

View File

@ -2731,28 +2731,32 @@ QStringList CutterCore::getAnalysisPluginNames()
return ret; return ret;
} }
QList<RzBinPluginDescription> CutterCore::getRBinPluginDescriptions(const QString &type) QList<RzBinPluginDescription> CutterCore::getBinPluginDescriptions(bool bin, bool xtr)
{ {
CORE_LOCK(); CORE_LOCK();
QList<RzBinPluginDescription> ret; QList<RzBinPluginDescription> ret;
RzListIter *it; RzListIter *it;
RzBinPlugin *bp; if (bin) {
CutterRzListForeach (core->bin->plugins, it, RzBinPlugin, bp) { RzBinPlugin *bp;
RzBinPluginDescription desc; CutterRzListForeach (core->bin->plugins, it, RzBinPlugin, bp) {
desc.name = bp->name ? bp->name : ""; RzBinPluginDescription desc;
desc.description = bp->desc ? bp->desc : ""; desc.name = bp->name ? bp->name : "";
desc.license = bp->license ? bp->license : ""; desc.description = bp->desc ? bp->desc : "";
desc.type = "bin"; desc.license = bp->license ? bp->license : "";
ret.append(desc); desc.type = "bin";
ret.append(desc);
}
} }
RzBinXtrPlugin *bx; if (xtr) {
CutterRzListForeach (core->bin->binxtrs, it, RzBinXtrPlugin, bx) { RzBinXtrPlugin *bx;
RzBinPluginDescription desc; CutterRzListForeach (core->bin->binxtrs, it, RzBinXtrPlugin, bx) {
desc.name = bx->name ? bx->name : ""; RzBinPluginDescription desc;
desc.description = bx->desc ? bx->desc : ""; desc.name = bx->name ? bx->name : "";
desc.license = bx->license ? bx->license : ""; desc.description = bx->desc ? bx->desc : "";
desc.type = "xtr"; desc.license = bx->license ? bx->license : "";
ret.append(desc); desc.type = "xtr";
ret.append(desc);
}
} }
return ret; return ret;
} }

View File

@ -534,7 +534,7 @@ public:
QStringList getAnalysisPluginNames(); QStringList getAnalysisPluginNames();
/* Widgets */ /* Widgets */
QList<RzBinPluginDescription> getRBinPluginDescriptions(const QString &type = QString()); QList<RzBinPluginDescription> getBinPluginDescriptions(bool bin = true, bool xtr = true);
QList<RzIOPluginDescription> getRIOPluginDescriptions(); QList<RzIOPluginDescription> getRIOPluginDescriptions();
QList<RzCorePluginDescription> getRCorePluginDescriptions(); QList<RzCorePluginDescription> getRCorePluginDescriptions();
QList<RzAsmPluginDescription> getRAsmPluginDescriptions(); QList<RzAsmPluginDescription> getRAsmPluginDescriptions();

View File

@ -47,7 +47,7 @@ InitialOptionsDialog::InitialOptionsDialog(MainWindow *main)
setTooltipWithConfigHelp(ui->kernelComboBox, "asm.os"); setTooltipWithConfigHelp(ui->kernelComboBox, "asm.os");
setTooltipWithConfigHelp(ui->bitsComboBox, "asm.bits"); setTooltipWithConfigHelp(ui->bitsComboBox, "asm.bits");
for (const auto &plugin : core->getRBinPluginDescriptions("bin")) { for (const auto &plugin : core->getBinPluginDescriptions(true, false)) {
ui->formatComboBox->addItem(plugin.name, QVariant::fromValue(plugin)); ui->formatComboBox->addItem(plugin.name, QVariant::fromValue(plugin));
} }

View File

@ -10,7 +10,7 @@ RizinPluginsDialog::RizinPluginsDialog(QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
for (const auto &plugin : Core()->getRBinPluginDescriptions()) { for (const auto &plugin : Core()->getBinPluginDescriptions()) {
QTreeWidgetItem *item = new QTreeWidgetItem(); QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, plugin.name); item->setText(0, plugin.name);
item->setText(1, plugin.description); item->setText(1, plugin.description);