diff --git a/src/createnewdialog.cpp b/src/createnewdialog.cpp index 33dbf579..a7e4e56a 100644 --- a/src/createnewdialog.cpp +++ b/src/createnewdialog.cpp @@ -65,7 +65,6 @@ void createNewDialog::on_buttonCreate_clicked() bool created = false; QString arch = ui->comboArch->currentText(); - int bits = atoi (ui->comboBits->currentText().toUtf8().constData()); int fsize = r_num_math (NULL, ui->entrySize->text().toUtf8().constData()); QString format = ui->comboFormat->currentText(); diff --git a/src/dialogs/xrefsdialog.cpp b/src/dialogs/xrefsdialog.cpp index f072a863..3689397f 100644 --- a/src/dialogs/xrefsdialog.cpp +++ b/src/dialogs/xrefsdialog.cpp @@ -64,6 +64,8 @@ void XrefsDialog::fillRefs(QList refs, QList xrefs) { void XrefsDialog::on_fromTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column) { + QNOTUSED(column); + QString offset = item->text(0); RAnalFunction *fcn = this->main->core->functionAt(offset.toLongLong(0, 16)); //this->add_debug_output( fcn->name ); @@ -73,6 +75,8 @@ void XrefsDialog::on_fromTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int void XrefsDialog::on_toTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column) { + QNOTUSED(column); + QString offset = item->text(0); RAnalFunction *fcn = this->main->core->functionAt(offset.toLongLong(0, 16)); //this->add_debug_output( fcn->name ); @@ -118,7 +122,8 @@ void XrefsDialog::on_fromTreeWidget_itemSelectionChanged() QString offset = item->text(0); ui->previewTextEdit->setPlainText( this->main->core->cmd("pdf @ " + offset).trimmed() ); ui->previewTextEdit->moveCursor(QTextCursor::End); - int pos = ui->previewTextEdit->find( this->normalizeAddr(offset), QTextDocument::FindBackward); + // Does it make any sense? + ui->previewTextEdit->find( this->normalizeAddr(offset), QTextDocument::FindBackward); ui->previewTextEdit->moveCursor(QTextCursor::StartOfWord, QTextCursor::MoveAnchor); } @@ -128,7 +133,9 @@ void XrefsDialog::on_toTreeWidget_itemSelectionChanged() QString offset = item->text(0); ui->previewTextEdit->setPlainText( this->main->core->cmd("pdf @ " + offset).trimmed() ); ui->previewTextEdit->moveCursor(QTextCursor::End); - int pos = ui->previewTextEdit->find( this->normalizeAddr(offset), QTextDocument::FindBackward); + // Again, does it make any sense? + // Also, this code should be refactored and shared instead of copied & pasted + ui->previewTextEdit->find( this->normalizeAddr(offset), QTextDocument::FindBackward); ui->previewTextEdit->moveCursor(QTextCursor::StartOfWord, QTextCursor::MoveAnchor); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a94b9d0c..33d44299 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -36,22 +36,18 @@ #include -namespace +static void registerCustomFonts() { - void registerCustomFonts() - { - int ret = QFontDatabase::addApplicationFont(":/new/prefix1/fonts/Anonymous Pro.ttf"); - assert(-1 != ret && "unable to register Anonymous Pro.ttf"); + int ret = QFontDatabase::addApplicationFont(":/new/prefix1/fonts/Anonymous Pro.ttf"); + assert(-1 != ret && "unable to register Anonymous Pro.ttf"); - ret = QFontDatabase::addApplicationFont(":/new/prefix1/fonts/Inconsolata-Regular.ttf"); - assert(-1 != ret && "unable to register Inconsolata-Regular.ttf"); + ret = QFontDatabase::addApplicationFont(":/new/prefix1/fonts/Inconsolata-Regular.ttf"); + assert(-1 != ret && "unable to register Inconsolata-Regular.ttf"); - // do not issue a warning in release - Q_UNUSED(ret) - } + // do not issue a warning in release + Q_UNUSED(ret) } - MainWindow::MainWindow(QWidget *parent, QRCore *kore) : QMainWindow(parent), core(kore), @@ -752,26 +748,27 @@ void MainWindow::on_consoleInputLineEdit_returnPressed() ui->consoleOutputTextEdit->verticalScrollBar()->setValue(ui->consoleOutputTextEdit->verticalScrollBar()->maximum()); // Add new command to history QCompleter *completer = ui->consoleInputLineEdit->completer(); - /* - * TODO: FIXME: Crashed the fucking app - * ballessay: yes this will crash if no completer is set -> nullptr - */ - //QStringListModel *completerModel = (QStringListModel*)(completer->model()); - //completerModel->setStringList(completerModel->stringList() << input); + if ( completer != NULL ) { + QStringListModel *completerModel = (QStringListModel*)(completer->model()); + if ( completerModel != NULL ) + completerModel->setStringList(completerModel->stringList() << input); + } + ui->consoleInputLineEdit->setText(""); - // TODO: add checkbox to enable/disable updating the whole ui or just update the list widgets, not disasm/hex - //this->updateFrames(); } } void MainWindow::on_showHistoToolButton_clicked() { + QCompleter *completer = ui->consoleInputLineEdit->completer(); + if (completer == NULL) + return; + if (ui->showHistoToolButton->isChecked()) { - QCompleter *completer = ui->consoleInputLineEdit->completer(); completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion); + // Uhm... shouldn't it be called always? completer->complete(); } else { - QCompleter *completer = ui->consoleInputLineEdit->completer(); completer->setCompletionMode(QCompleter::PopupCompletion); } } diff --git a/src/newfiledialog.cpp b/src/newfiledialog.cpp index a1731bda..557b3de9 100644 --- a/src/newfiledialog.cpp +++ b/src/newfiledialog.cpp @@ -11,6 +11,8 @@ const int NewFileDialog::MaxRecentFiles; static QColor getColorFor(QString str, int pos) { + QNOTUSED(str); + QList Colors; Colors << QColor(29, 188, 156); // Turquoise Colors << QColor(52, 152, 219); // Blue diff --git a/src/qrcore.cpp b/src/qrcore.cpp index aa15313e..f2b57b56 100644 --- a/src/qrcore.cpp +++ b/src/qrcore.cpp @@ -149,6 +149,10 @@ QString QRCore::cmd(const QString &str) { } bool QRCore::loadFile(QString path, uint64_t loadaddr=0LL, uint64_t mapaddr=0LL, bool rw=false, int va=0, int bits = 0, int idx, bool loadbin) { + + QNOTUSED(loadaddr); + QNOTUSED(idx); + RCoreFile *f; if (va==0 || va == 2) r_config_set_i (core->config, "io.va", va); @@ -455,9 +459,9 @@ int QRCore::fcnEndBbs(QString addr) { QString endbbs = tmp.split(": ")[1]; return endbbs.toInt(); } - } else { - return 0; } + + return 0; } QString QRCore::itoa(ut64 num, int rdx) { @@ -483,6 +487,8 @@ int QRCore::config(const QString &k, int v) { } void QRCore::setOptions(QString key) { + QNOTUSED(key); + // va // lowercase // show bytes diff --git a/src/qrcore.h b/src/qrcore.h index 43fcbf8d..decf4365 100644 --- a/src/qrcore.h +++ b/src/qrcore.h @@ -27,6 +27,7 @@ #define __alert(x) QMessageBox::question (this, "Alert", QString(x), QMessageBox::Ok) #define __question(x) (QMessageBox::Yes==QMessageBox::question (this, "Alert", QString(x), QMessageBox::Yes| QMessageBox::No)) +#define QNOTUSED(x) do { (void)(x); } while ( 0 ); class QRCore : public QObject { diff --git a/src/qrdisasm.cpp b/src/qrdisasm.cpp index ae7a50a4..c0caffb5 100644 --- a/src/qrdisasm.cpp +++ b/src/qrdisasm.cpp @@ -9,6 +9,10 @@ QRDisasm::QRDisasm(QRCore *core) } bool QRDisasm::disassembleAt (ut64 addr, QRDisasmOption opt, QRDisasmRow &dr) { + QNOTUSED(addr); + QNOTUSED(opt); + QNOTUSED(dr); + printf ("FUCK\n"); return false; } diff --git a/src/widgets/codegraphic.cpp b/src/widgets/codegraphic.cpp index b5585afa..8634824a 100644 --- a/src/widgets/codegraphic.cpp +++ b/src/widgets/codegraphic.cpp @@ -13,6 +13,8 @@ GraphicsBar::GraphicsBar(MainWindow *main, QWidget *parent) : QToolBar(main) { + QNOTUSED(parent); + setObjectName("codeGraphics"); setWindowTitle("Code bar"); // setMovable(false); @@ -40,9 +42,11 @@ GraphicsBar::GraphicsBar(MainWindow *main, QWidget *parent) : } void GraphicsBar::paintEvent(QPaintEvent *event) { - QPainter painter(this); - this->fillData(); - } + QNOTUSED(event); + + QPainter painter(this); + this->fillData(); +} void GraphicsBar::fillData() { @@ -61,7 +65,6 @@ void GraphicsBar::fillData() { // Parse JSON data QString jsonData = this->main->core->cmd("p-j"); - QJsonParseError *err = new QJsonParseError(); QJsonDocument doc = QJsonDocument::fromJson(jsonData.toUtf8()); if (doc.isNull()) { diff --git a/src/widgets/commentswidget.cpp b/src/widgets/commentswidget.cpp index 71dc6c2d..acfeb995 100644 --- a/src/widgets/commentswidget.cpp +++ b/src/widgets/commentswidget.cpp @@ -38,6 +38,8 @@ CommentsWidget::~CommentsWidget() void CommentsWidget::on_commentsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column) { + QNOTUSED(column); + // Get offset and name of item double clicked // TODO: use this info to change disasm contents QString offset = item->text(1); diff --git a/src/widgets/dashboard.cpp b/src/widgets/dashboard.cpp index d308cae8..0f467d59 100644 --- a/src/widgets/dashboard.cpp +++ b/src/widgets/dashboard.cpp @@ -133,9 +133,6 @@ void Dashboard::updateContents() { // Get stats for the graphs QStringList stats = this->main->core->getStats(); - // Calculate total amount flags all + imports - int total = stats[6].toInt() + stats[1].toInt(); - // Add data to HTML graphs (stats) QFile html(":/html/stats.html"); if(!html.open(QIODevice::ReadOnly)) { diff --git a/src/widgets/flagswidget.cpp b/src/widgets/flagswidget.cpp index 5966ba7d..e6c19bd0 100644 --- a/src/widgets/flagswidget.cpp +++ b/src/widgets/flagswidget.cpp @@ -23,6 +23,8 @@ FlagsWidget::~FlagsWidget() void FlagsWidget::on_flagsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column) { + QNOTUSED(column); + QString offset = item->text(2); QString name = item->text(3); this->main->seek(offset, name); @@ -30,5 +32,7 @@ void FlagsWidget::on_flagsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, in void FlagsWidget::on_flagspaceCombo_currentTextChanged(const QString &arg1) { + QNOTUSED(arg1); + this->main->refreshFlags(); } diff --git a/src/widgets/functionswidget.cpp b/src/widgets/functionswidget.cpp index c94f904a..c2b6cfaa 100644 --- a/src/widgets/functionswidget.cpp +++ b/src/widgets/functionswidget.cpp @@ -94,6 +94,8 @@ void FunctionsWidget::fillFunctions() { void FunctionsWidget::on_functionsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column) { + QNOTUSED(column); + QString offset = item->text(1); QString name = item->text(3); this->main->seek(offset, name); @@ -281,7 +283,6 @@ void FunctionsWidget::on_action_References_triggered() x->setWindowTitle("X-Refs for function " + QString::fromUtf8(fcn->name)); // Get Refs and Xrefs - bool ok; QList ret_refs; QList ret_xrefs; @@ -353,6 +354,8 @@ void FunctionsWidget::on_actionVertical_triggered() void FunctionsWidget::on_nestedFunctionsTree_itemDoubleClicked(QTreeWidgetItem *item, int column) { + QNOTUSED(column); + //QString offset = item->text(1); QString name = item->text(0); QString offset = item->child(0)->text(0).split(":")[1]; diff --git a/src/widgets/notepad.cpp b/src/widgets/notepad.cpp index b3074f02..205660da 100644 --- a/src/widgets/notepad.cpp +++ b/src/widgets/notepad.cpp @@ -147,8 +147,6 @@ void Notepad::on_searchEdit_returnPressed() QString searchString = ui->searchEdit->text(); QTextDocument *document = ui->notepadTextEdit->document(); - bool found = false; - if (isFirstTime == false) document->undo(); @@ -167,7 +165,6 @@ void Notepad::on_searchEdit_returnPressed() highlightCursor = document->find(searchString, highlightCursor, QTextDocument::FindWholeWords); if (!highlightCursor.isNull()) { - found = true; highlightCursor.movePosition(QTextCursor::WordRight, QTextCursor::KeepAnchor); highlightCursor.mergeCharFormat(colorFormat); @@ -176,23 +173,16 @@ void Notepad::on_searchEdit_returnPressed() cursor.endEditBlock(); isFirstTime = false; - - /* - if (found == false) { - QMessageBox::information(this, tr("Word Not Found"), - "Sorry, the word cannot be found."); - } - */ } } void Notepad::on_searchEdit_textEdited(const QString &arg1) { + QNOTUSED(arg1); + QString searchString = ui->searchEdit->text(); QTextDocument *document = ui->notepadTextEdit->document(); - bool found = false; - if (isFirstTime == false) document->undo(); @@ -211,7 +201,6 @@ void Notepad::on_searchEdit_textEdited(const QString &arg1) highlightCursor = document->find(searchString, highlightCursor); if (!highlightCursor.isNull()) { - found = true; //highlightCursor.movePosition(QTextCursor::WordRight, // QTextCursor::KeepAnchor); highlightCursor.mergeCharFormat(colorFormat); @@ -225,11 +214,11 @@ void Notepad::on_searchEdit_textEdited(const QString &arg1) void Notepad::on_searchEdit_textChanged(const QString &arg1) { + QNOTUSED(arg1); + QString searchString = ui->searchEdit->text(); QTextDocument *document = ui->notepadTextEdit->document(); - bool found = false; - if (isFirstTime == false) document->undo(); @@ -248,7 +237,6 @@ void Notepad::on_searchEdit_textChanged(const QString &arg1) highlightCursor = document->find(searchString, highlightCursor); if (!highlightCursor.isNull()) { - found = true; //highlightCursor.movePosition(QTextCursor::WordRight, // QTextCursor::KeepAnchor); highlightCursor.mergeCharFormat(colorFormat); diff --git a/src/widgets/omnibar.cpp b/src/widgets/omnibar.cpp index 552ed13d..41984d4c 100644 --- a/src/widgets/omnibar.cpp +++ b/src/widgets/omnibar.cpp @@ -92,7 +92,7 @@ void Omnibar::clearContents() { void Omnibar::on_gotoEntry_returnPressed() { QString str = this->text(); - if (str.length()>0) + if (str.length()>0) { if (str.contains(": ")) { if (str.contains("Lock")){ this->main->on_actionLock_triggered(); @@ -128,6 +128,8 @@ void Omnibar::on_gotoEntry_returnPressed() QString off = this->main->core->cmd("afo " + this->text()); this->main->seek(off.trimmed(), this->text()); } + } + // check which tab is open? update all tabs? hex, graph? //refreshMem( this->gotoEntry->text() ); this->setText(""); diff --git a/src/widgets/pieview.cpp b/src/widgets/pieview.cpp index 70913b97..83069b0b 100644 --- a/src/widgets/pieview.cpp +++ b/src/widgets/pieview.cpp @@ -46,6 +46,7 @@ #define M_PI 3.1415927 #endif +#include "qrcore.h" #include "pieview.h" PieView::PieView(QWidget *parent) @@ -450,6 +451,8 @@ void PieView::scrollTo(const QModelIndex &index, ScrollHint) void PieView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) { + QNOTUSED(command); + // Use content widget coordinates because we will use the itemRegion() // function to check for intersections. diff --git a/src/widgets/relocswidget.cpp b/src/widgets/relocswidget.cpp index a239dc45..9a5bc474 100644 --- a/src/widgets/relocswidget.cpp +++ b/src/widgets/relocswidget.cpp @@ -21,6 +21,8 @@ RelocsWidget::~RelocsWidget() void RelocsWidget::on_relocsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column) { + QNOTUSED(column); + // Get offset and name of item double clicked // TODO: use this info to change disasm contents QString offset = item->text(1); diff --git a/src/widgets/sectionswidget.cpp b/src/widgets/sectionswidget.cpp index 22c6992a..b4ece08e 100644 --- a/src/widgets/sectionswidget.cpp +++ b/src/widgets/sectionswidget.cpp @@ -9,6 +9,8 @@ SectionsWidget::SectionsWidget(MainWindow *main, QWidget *parent) : QSplitter(main) { + QNOTUSED(parent); + this->main = main; //setupModel(); setupViews(); diff --git a/src/widgets/stringswidget.cpp b/src/widgets/stringswidget.cpp index a86c10e8..730b1db2 100644 --- a/src/widgets/stringswidget.cpp +++ b/src/widgets/stringswidget.cpp @@ -22,6 +22,8 @@ StringsWidget::~StringsWidget() void StringsWidget::on_stringsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column) { + QNOTUSED(column); + // Get offset and name of item double clicked // TODO: use this info to change disasm contents QString offset = item->text(1); diff --git a/src/widgets/symbolswidget.cpp b/src/widgets/symbolswidget.cpp index 20effed7..4eff3f2b 100644 --- a/src/widgets/symbolswidget.cpp +++ b/src/widgets/symbolswidget.cpp @@ -29,6 +29,8 @@ void SymbolsWidget::fillSymbols() { void SymbolsWidget::on_symbolsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int column) { + QNOTUSED(column); + // Get offset and name of item double clicked // TODO: use this info to change disasm contents QString offset = item->text(1);