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);
}
void MainWindow::setFilename(QString fn)
void MainWindow::setFilename(const QString &fn)
{
// Add file name to window title
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```");
}

View File

@ -54,7 +54,7 @@ public:
void start_web_server();
void closeEvent(QCloseEvent *event);
void readSettings();
void setFilename(QString fn);
void setFilename(const QString &fn);
//void setCore(QRCore *core);
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);
@ -64,7 +64,7 @@ public:
void get_refs(const QString &offset);
void add_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 raiseMemoryDock();
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();
QList<CommentDescription> ret;

View File

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

View File

@ -14,16 +14,16 @@
#include <QResource>
FunctionModel::FunctionModel(QList<FunctionDescription> *functions, QSet<RVA> *import_addresses, bool nested, QFont default_font, QFont highlight_font, MainWindow *main, QObject *parent)
: functions(functions),
import_addresses(import_addresses),
: QAbstractItemModel(parent),
main(main),
nested(nested),
default_font(default_font),
functions(functions),
import_addresses(import_addresses),
highlight_font(highlight_font),
QAbstractItemModel(parent)
{
current_index = -1;
default_font(default_font),
nested(nested),
current_index(-1)
{
connect(main, SIGNAL(cursorAddressChanged(RVA)), this, SLOT(cursorAddressChanged(RVA)));
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;
}
int FunctionModel::columnCount(const QModelIndex &parent) const
int FunctionModel::columnCount(const QModelIndex &/*parent*/) const
{
if (nested)
return 1;
@ -238,7 +238,7 @@ void FunctionModel::updateCurrentIndex()
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++)
{

View File

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

View File

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