Fix new warnings

- Fix compiler and cppcheck warning
- format with astyle
This commit is contained in:
ballessay 2017-04-28 15:38:01 +02:00 committed by C. Balles
parent ebe33ffe8e
commit f586ab2d4e
11 changed files with 151 additions and 153 deletions

View File

@ -338,7 +338,7 @@ void MainWindow::refreshOmniBar(const QStringList &flags)
omnibar->refresh(flags); omnibar->refresh(flags);
} }
void MainWindow::setFilename(QString fn) void MainWindow::setFilename(const QString &fn)
{ {
// Add file name to window title // Add file name to window title
this->filename = fn; this->filename = fn;
@ -905,7 +905,7 @@ void MainWindow::on_actionhide_bottomPannel_triggered()
} }
} }
void MainWindow::send_to_notepad(QString txt) void MainWindow::send_to_notepad(const QString &txt)
{ {
this->notepadDock->appendPlainText("```\n" + txt + "\n```"); this->notepadDock->appendPlainText("```\n" + txt + "\n```");
} }

View File

@ -54,7 +54,7 @@ public:
void start_web_server(); void start_web_server();
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
void readSettings(); void readSettings();
void setFilename(QString fn); void setFilename(const QString &fn);
//void setCore(QRCore *core); //void setCore(QRCore *core);
void seek(const QString &offset, const QString &name = NULL, bool raise_memory_dock = false); void seek(const QString &offset, const QString &name = NULL, bool raise_memory_dock = false);
void seek(const RVA offset, const QString &name = NULL, bool raise_memory_dock = false); void seek(const RVA offset, const QString &name = NULL, bool raise_memory_dock = false);
@ -64,7 +64,7 @@ public:
void get_refs(const QString &offset); void get_refs(const QString &offset);
void add_output(QString msg); void add_output(QString msg);
void add_debug_output(QString msg); void add_debug_output(QString msg);
void send_to_notepad(QString txt); void send_to_notepad(const QString &txt);
void setWebServerState(bool start); void setWebServerState(bool start);
void raiseMemoryDock(); void raiseMemoryDock();
void toggleSideBarTheme(); void toggleSideBarTheme();

View File

@ -951,7 +951,7 @@ QList<SymbolDescription> QRCore::getAllSymbols()
} }
QList<CommentDescription> QRCore::getAllComments(QString filterType) QList<CommentDescription> QRCore::getAllComments(const QString &filterType)
{ {
CORE_LOCK(); CORE_LOCK();
QList<CommentDescription> ret; QList<CommentDescription> ret;

View File

@ -178,7 +178,7 @@ public:
QList<FunctionDescription> getAllFunctions(); QList<FunctionDescription> getAllFunctions();
QList<ImportDescription> getAllImports(); QList<ImportDescription> getAllImports();
QList<SymbolDescription> getAllSymbols(); QList<SymbolDescription> getAllSymbols();
QList<CommentDescription> getAllComments(QString type); QList<CommentDescription> getAllComments(const QString &filterType);
QList<RelocDescription> getAllRelocs(); QList<RelocDescription> getAllRelocs();
QList<StringDescription> getAllStrings(); QList<StringDescription> getAllStrings();

View File

@ -14,16 +14,16 @@
#include <QResource> #include <QResource>
FunctionModel::FunctionModel(QList<FunctionDescription> *functions, QSet<RVA> *import_addresses, bool nested, QFont default_font, QFont highlight_font, MainWindow *main, QObject *parent) FunctionModel::FunctionModel(QList<FunctionDescription> *functions, QSet<RVA> *import_addresses, bool nested, QFont default_font, QFont highlight_font, MainWindow *main, QObject *parent)
: functions(functions), : QAbstractItemModel(parent),
import_addresses(import_addresses),
main(main), main(main),
nested(nested), functions(functions),
default_font(default_font), import_addresses(import_addresses),
highlight_font(highlight_font), highlight_font(highlight_font),
QAbstractItemModel(parent) default_font(default_font),
{ nested(nested),
current_index = -1; current_index(-1)
{
connect(main, SIGNAL(cursorAddressChanged(RVA)), this, SLOT(cursorAddressChanged(RVA))); connect(main, SIGNAL(cursorAddressChanged(RVA)), this, SLOT(cursorAddressChanged(RVA)));
connect(main->core, SIGNAL(functionRenamed(QString, QString)), this, SLOT(functionRenamed(QString, QString))); connect(main->core, SIGNAL(functionRenamed(QString, QString)), this, SLOT(functionRenamed(QString, QString)));
} }
@ -62,7 +62,7 @@ int FunctionModel::rowCount(const QModelIndex &parent) const
return 0; return 0;
} }
int FunctionModel::columnCount(const QModelIndex &parent) const int FunctionModel::columnCount(const QModelIndex &/*parent*/) const
{ {
if (nested) if (nested)
return 1; return 1;
@ -238,7 +238,7 @@ void FunctionModel::updateCurrentIndex()
current_index = index; current_index = index;
} }
void FunctionModel::functionRenamed(QString prev_name, QString new_name) void FunctionModel::functionRenamed(const QString &prev_name, const QString &new_name)
{ {
for (int i = 0; i < functions->count(); i++) for (int i = 0; i < functions->count(); i++)
{ {

View File

@ -57,7 +57,7 @@ public:
private slots: private slots:
void cursorAddressChanged(RVA addr); void cursorAddressChanged(RVA addr);
void functionRenamed(QString prev_name, QString new_name); void functionRenamed(const QString &prev_name, const QString &new_name);
}; };

View File

@ -310,7 +310,7 @@ void MemoryWidget::highlightHexCurrentLine()
highlightHexWords(cursor.selectedText()); highlightHexWords(cursor.selectedText());
} }
void MemoryWidget::highlightHexWords(QString str) void MemoryWidget::highlightHexWords(const QString &str)
{ {
QString searchString = str; QString searchString = str;
QTextDocument *document = ui->hexHexText_2->document(); QTextDocument *document = ui->hexHexText_2->document();
@ -1582,12 +1582,10 @@ QString MemoryWidget::normalize_addr(QString addr)
void MemoryWidget::setFcnName(RVA addr) void MemoryWidget::setFcnName(RVA addr)
{ {
RAnalFunction *fcn; RAnalFunction *fcn;
bool ok;
QString addr_string; QString addr_string;
fcn = this->main->core->functionAt(addr); fcn = this->main->core->functionAt(addr);
if (ok && fcn) if (fcn)
{ {
QString segment = this->main->core->cmd("S. @ " + QString::number(addr)).split(" ").last(); QString segment = this->main->core->cmd("S. @ " + QString::number(addr)).split(" ").last();
addr_string = segment.trimmed() + ":" + fcn->name; addr_string = segment.trimmed() + ":" + fcn->name;

View File

@ -116,7 +116,7 @@ private:
void setScrollMode(); void setScrollMode();
private slots: private slots:
void on_cursorAddressChanged(RVA offset); void on_cursorAddressChanged(RVA addr);
void highlightCurrentLine(); void highlightCurrentLine();
@ -125,7 +125,7 @@ private slots:
void highlightDecoCurrentLine(); void highlightDecoCurrentLine();
void setFonts(QFont font); void setFonts(QFont font);
void highlightHexWords(QString str); void highlightHexWords(const QString &str);
void on_showInfoButton_2_clicked(); void on_showInfoButton_2_clicked();
void on_actionSettings_menu_1_triggered(); void on_actionSettings_menu_1_triggered();
void on_actionHideDisasm_side_panel_triggered(); void on_actionHideDisasm_side_panel_triggered();