diff --git a/src/Cutter.cpp b/src/Cutter.cpp index 905d721d..a6b06b72 100644 --- a/src/Cutter.cpp +++ b/src/Cutter.cpp @@ -1967,10 +1967,11 @@ QList CutterCore::getXRefs(RVA addr, bool to, bool whole_functi QJsonArray xrefsArray; - if (to) + if (to) { xrefsArray = cmdj("axtj@" + QString::number(addr)).array(); - else + } else { xrefsArray = cmdj("axfj@" + QString::number(addr)).array(); + } for (QJsonValue value : xrefsArray) { QJsonObject xrefObject = value.toObject(); @@ -1994,13 +1995,15 @@ QList CutterCore::getXRefs(RVA addr, bool to, bool whole_functi } } - if (!whole_function && !to && xref.from != addr) + if (!whole_function && !to && xref.from != addr) { continue; + } - if (to && !xrefObject.contains("to")) + if (to && !xrefObject.contains("to")) { xref.to = addr; - else + } else { xref.to = xrefObject["to"].toVariant().toULongLong(); + } xref.to_str = Core()->cmd("fd " + QString::number(xref.to)).trimmed(); ret << xref; @@ -2141,8 +2144,9 @@ QList CutterCore::getColorThemes() { QList r; QJsonDocument themes = cmdj("ecoj"); - for (auto s : themes.array()) + for (auto s : themes.array()) { r << s.toString(); + } return r; } diff --git a/src/CutterApplication.cpp b/src/CutterApplication.cpp index 8db7da29..155c0206 100644 --- a/src/CutterApplication.cpp +++ b/src/CutterApplication.cpp @@ -236,8 +236,9 @@ void CutterApplication::loadPlugins() pluginsDir.cdUp(); } #endif - if (!pluginsDir.cd("plugins")) + if (!pluginsDir.cd("plugins")) { return; + } foreach (QString fileName, pluginsDir.entryList(QDir::Files)) { QPluginLoader pluginLoader(pluginsDir.absoluteFilePath(fileName)); diff --git a/src/menus/DisassemblyContextMenu.cpp b/src/menus/DisassemblyContextMenu.cpp index 9ec170ae..cd84057a 100644 --- a/src/menus/DisassemblyContextMenu.cpp +++ b/src/menus/DisassemblyContextMenu.cpp @@ -274,7 +274,7 @@ void DisassemblyContextMenu::aboutToShowSlot() actionRename.setVisible(false); } - //only show retype for local vars if in a function + // Only show retype for local vars if in a function if (in_fcn) { actionSetFunctionVarTypes.setVisible(true); actionEditFunction.setVisible(true); @@ -285,7 +285,7 @@ void DisassemblyContextMenu::aboutToShowSlot() } - // only show "rename X used here" if there is something to rename + // Only show "rename X used here" if there is something to rename QJsonArray thingUsedHereArray = Core()->cmdj("anj @ " + QString::number(offset)).array(); if (!thingUsedHereArray.isEmpty()) { actionRenameUsedHere.setVisible(true); @@ -305,10 +305,10 @@ void DisassemblyContextMenu::aboutToShowSlot() actionRenameUsedHere.setVisible(false); } - // decide to show Reverse jmp option + // Decide to show Reverse jmp option showReverseJmpQuery(); - // only show debug options if we are currently debugging + // Only show debug options if we are currently debugging debugMenu->menuAction()->setVisible(Core()->currentlyDebugging); QString progCounterName = Core()->getRegisterName("PC"); actionSetPC.setText("Set " + progCounterName + " here"); @@ -390,7 +390,7 @@ void DisassemblyContextMenu::on_actionEditInstruction_triggered() if (userInstructionOpcode != oldInstructionOpcode) { Core()->editInstruction(offset, userInstructionOpcode); - // check if the write failed + // Check if the write failed auto newInstructionBytes = Core()->getInstructionBytes(offset); if (newInstructionBytes == oldInstructionBytes) { if (!writeFailed()) { diff --git a/src/widgets/Sidebar.cpp b/src/widgets/Sidebar.cpp index f0ae46a8..615d9779 100644 --- a/src/widgets/Sidebar.cpp +++ b/src/widgets/Sidebar.cpp @@ -9,7 +9,6 @@ SideBar::SideBar(MainWindow *main) : QWidget(main), ui(new Ui::SideBar), - // Radare core found in: main(main) { ui->setupUi(this); diff --git a/src/widgets/SidebarWidget.cpp b/src/widgets/SidebarWidget.cpp index 16cca483..dee80b29 100644 --- a/src/widgets/SidebarWidget.cpp +++ b/src/widgets/SidebarWidget.cpp @@ -130,10 +130,7 @@ void SidebarWidget::on_regInfoToolButton_clicked() void SidebarWidget::updateRefs(RVA addr) { - // refs = calls q hace esa funcion QList refs = Core()->getXRefs(addr, false, false); - - // xrefs = calls a esa funcion QList xrefs = Core()->getXRefs(addr, true, false); // Update disasm side bar @@ -171,12 +168,9 @@ void SidebarWidget::fillRefs(QList refs, QList tempItem->setData(0, Qt::UserRole, QVariant::fromValue(xref)); QString tooltip = Core()->cmd("pdi 10 @ " + QString::number(xref.from)).trimmed(); - // TODO wtf is this? - //tempItem->setToolTip(0, this->core->cmd("pdi 10 @ " + tooltip).trimmed()); - //tempItem->setToolTip(1, this->core->cmd("pdi 10 @ " + tooltip).trimmed()); - ui->xrefToTreeWidget->insertTopLevelItem(0, tempItem); } + // Adjust columns to content qhelpers::adjustColumns(ui->xrefToTreeWidget, 0); } diff --git a/src/widgets/StackWidget.cpp b/src/widgets/StackWidget.cpp index 6c30bc4a..a7812fbc 100644 --- a/src/widgets/StackWidget.cpp +++ b/src/widgets/StackWidget.cpp @@ -14,7 +14,7 @@ StackWidget::StackWidget(MainWindow *main, QAction *action) : { ui->setupUi(this); - // setup stack model + // Setup stack model modelStack->setHorizontalHeaderItem(0, new QStandardItem(tr("Offset"))); modelStack->setHorizontalHeaderItem(1, new QStandardItem(tr("Value"))); modelStack->setHorizontalHeaderItem(2, new QStandardItem(tr("Reference"))); @@ -97,7 +97,7 @@ void StackWidget::onDoubleClicked(const QModelIndex &index) { if (!index.isValid()) return; - // check if we are clicking on the offset or value columns and seek if it is the case + // Check if we are clicking on the offset or value columns and seek if it is the case if (index.column() <= 1) { QString item = index.data().toString(); Core()->seek(item); @@ -132,7 +132,7 @@ void StackWidget::editStack() if (e->exec()) { QString bytes = e->getInstruction(); if (bytes != oldBytes) { - Core()->editBytesEndian((RVA)offset.toULongLong(&ok, 16), bytes); + Core()->editBytesEndian(offset.toULongLong(&ok, 16), bytes); } } } diff --git a/src/widgets/StringsWidget.cpp b/src/widgets/StringsWidget.cpp index f314f421..511288fa 100644 --- a/src/widgets/StringsWidget.cpp +++ b/src/widgets/StringsWidget.cpp @@ -185,8 +185,9 @@ StringsWidget::~StringsWidget() {} void StringsWidget::on_stringsTreeView_doubleClicked(const QModelIndex &index) { - if (!index.isValid()) + if (!index.isValid()) { return; + } StringDescription str = index.data(StringsModel::StringDescriptionRole).value(); Core()->seek(str.vaddr); @@ -253,10 +254,11 @@ void StringsWidget::on_actionCopy() QModelIndex index; - if(sender() == ui->actionCopy_String) + if (sender() == ui->actionCopy_String) { index = ui->stringsTreeView->model()->index(row, 1); - else if(sender() == ui->actionCopy_Address) + } else if (sender() == ui->actionCopy_Address) { index = ui->stringsTreeView->model()->index(row, 0); + } QClipboard *clipboard = QApplication::clipboard(); clipboard->setText(index.data().toString()); diff --git a/src/widgets/SymbolsWidget.cpp b/src/widgets/SymbolsWidget.cpp index 12c6af46..7c2d5207 100644 --- a/src/widgets/SymbolsWidget.cpp +++ b/src/widgets/SymbolsWidget.cpp @@ -22,8 +22,9 @@ int SymbolsModel::columnCount(const QModelIndex &) const QVariant SymbolsModel::data(const QModelIndex &index, int role) const { - if (index.row() >= symbols->count()) + if (index.row() >= symbols->count()) { return QVariant(); + } const SymbolDescription &symbol = symbols->at(index.row()); @@ -143,8 +144,9 @@ SymbolsWidget::~SymbolsWidget() {} void SymbolsWidget::on_symbolsTreeView_doubleClicked(const QModelIndex &index) { - if (!index.isValid()) + if (!index.isValid()) { return; + } auto symbol = index.data(SymbolsModel::SymbolDescriptionRole).value(); Core()->seek(symbol.vaddr); diff --git a/src/widgets/TypesWidget.cpp b/src/widgets/TypesWidget.cpp index 1af49793..487ba4d0 100644 --- a/src/widgets/TypesWidget.cpp +++ b/src/widgets/TypesWidget.cpp @@ -130,12 +130,3 @@ void TypesWidget::setScrollMode() { qhelpers::setVerticalScrollMode(ui->typesTreeView); } - -void TypesWidget::on_typesTreeView_doubleClicked(const QModelIndex &index) -{ - if (!index.isValid()) - return; - - // TypeDescription exp = index.data(TypesModel::TypeDescriptionRole).value(); - // Core()->seek(exp.vaddr); -} diff --git a/src/widgets/TypesWidget.h b/src/widgets/TypesWidget.h index d4769a1d..3f4d8e06 100644 --- a/src/widgets/TypesWidget.h +++ b/src/widgets/TypesWidget.h @@ -69,8 +69,6 @@ public: ~TypesWidget(); private slots: - void on_typesTreeView_doubleClicked(const QModelIndex &index); - void refreshTypes(); private: diff --git a/src/widgets/VTablesWidget.cpp b/src/widgets/VTablesWidget.cpp index 66e85bca..301e366b 100644 --- a/src/widgets/VTablesWidget.cpp +++ b/src/widgets/VTablesWidget.cpp @@ -182,14 +182,16 @@ void VTablesWidget::refreshVTables() void VTablesWidget::on_vTableTreeView_doubleClicked(const QModelIndex &index) { - if (!index.isValid()) + if (!index.isValid()) { return; + } QModelIndex parent = index.parent(); - if (parent.isValid()) + if (parent.isValid()) { Core()->seek(index.data( VTableModel::VTableDescriptionRole).value().addr); - else + } else { Core()->seek(index.data( VTableModel::VTableDescriptionRole).value().addr); + } }