Fix compiler and cppcheck warnings

This commit is contained in:
ballessay 2017-04-13 17:01:18 +02:00 committed by C. Balles
parent b32fd4cef2
commit 3bdb0b2aba
10 changed files with 16 additions and 18 deletions

View File

@ -13,7 +13,7 @@ class AsciiHighlighter : public QSyntaxHighlighter
Q_OBJECT
public:
AsciiHighlighter(QTextDocument *parent = 0);
explicit AsciiHighlighter(QTextDocument *parent = 0);
protected:
void highlightBlock(const QString &text);

View File

@ -13,7 +13,7 @@ class HexHighlighter : public QSyntaxHighlighter
Q_OBJECT
public:
HexHighlighter(QTextDocument *parent = 0);
explicit HexHighlighter(QTextDocument *parent = 0);
protected:
void highlightBlock(const QString &text);

View File

@ -13,7 +13,7 @@ class MdHighlighter : public QSyntaxHighlighter
Q_OBJECT
public:
MdHighlighter(QTextDocument *parent = 0);
explicit MdHighlighter(QTextDocument *parent = 0);
protected:
void highlightBlock(const QString &text);

View File

@ -228,7 +228,7 @@ QJsonDocument QRCore::cmdj(const QString &str)
return doc;
}
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)
bool QRCore::loadFile(QString path, uint64_t loadaddr, uint64_t mapaddr, bool rw, int va, int bits, int idx, bool loadbin)
{
QNOTUSED(loadaddr);
QNOTUSED(idx);
@ -291,7 +291,7 @@ bool QRCore::loadFile(QString path, uint64_t loadaddr = 0LL, uint64_t mapaddr =
}
#if HAVE_MULTIPLE_RBIN_FILES_INSIDE_SELECT_WHICH_ONE
if (!r_core_file_open(core, path.toUtf8(), R_IO_READ | rw ? R_IO_WRITE : 0, mapaddr))
if (!r_core_file_open(core, path.toUtf8(), R_IO_READ | (rw ? R_IO_WRITE : 0, mapaddr)))
{
eprintf("Cannot open file\n");
}
@ -392,6 +392,7 @@ QMap<QString, QList<QList<QString>>> QRCore::getNestedComments()
tmp << fields[1].split("\"")[1].trimmed();
tmp << fields[0].trimmed();
QString fcn_name = this->cmdFunctionAt(fields[0].trimmed());
// Why test if you do the same thing?
if (ret.contains(fcn_name))
{
ret[fcn_name].append(tmp);
@ -840,7 +841,6 @@ QStringList QRCore::getStats()
QString QRCore::getSimpleGraph(QString function)
{
// New styles
QString graph = "graph [bgcolor=invis, splines=polyline];";
QString node = "node [style=\"filled\" fillcolor=\"#4183D7\" shape=box fontname=\"Courier\" fontsize=\"8\" color=\"#4183D7\" fontcolor=\"white\"];";

View File

@ -66,7 +66,7 @@ public:
QList<QList<QString>> getComments();
QMap<QString, QList<QList<QString>>> getNestedComments();
void setOptions(QString key);
bool loadFile(QString path, uint64_t loadaddr, uint64_t mapaddr, bool rw, int va, int bits, int idx = 0, bool loadbin = false);
bool loadFile(QString path, uint64_t loadaddr = 0LL, uint64_t mapaddr = 0LL, bool rw = false, int va = 0, int bits = 0, int idx = 0, bool loadbin = false);
bool tryFile(QString path, bool rw);
void analyze(int level);
void seek(QString addr);

View File

@ -65,7 +65,7 @@ class QRDisasm
QRCore *core;
Sdb *db;
public:
QRDisasm(QRCore *core);
explicit QRDisasm(QRCore *core);
bool disassembleAt(ut64 addr, QRDisasmOption opt, QRDisasmRow &dr);
// high level api for the disasm thing to manage comments, xrefs, etc
//next();

View File

@ -34,7 +34,7 @@ private:
class CMyDelegate : public QStyledItemDelegate
{
public:
CMyDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
explicit CMyDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
};

View File

@ -1482,8 +1482,7 @@ void MemoryWidget::fill_refs(QList<QStringList> refs, QList<QStringList> xrefs,
void MemoryWidget::fillOffsetInfo(QString off)
{
ui->offsetTreeWidget->clear();
QString raw = "";
raw = this->main->core->getOffsetInfo(off);
QString raw = this->main->core->getOffsetInfo(off);
QList<QString> lines = raw.split("\n", QString::SkipEmptyParts);
foreach (QString line, lines)
{
@ -1769,14 +1768,13 @@ bool MemoryWidget::eventFilter(QObject *obj, QEvent *event)
QString ele = eles.isEmpty() ? "" : eles[0];
if (ele.contains("0x"))
{
QString jump = "";
jump = this->main->core->getOffsetJump(ele);
if (jump != "")
QString jump = this->main->core->getOffsetJump(ele);
if (!jump.isEmpty())
{
if (jump.contains("0x"))
{
QString fcn = this->main->core->cmdFunctionAt(jump);
if (fcn != "")
if (!fcn.isEmpty())
{
this->main->seek(jump.trimmed(), fcn);
}

View File

@ -61,7 +61,7 @@ public slots:
void refreshHexdump(const QString &where = QString());
void fill_refs(QList<QStringList> list, QList<QStringList> xrefs, QList<int> graph_data);
void fill_refs(QList<QStringList> refs, QList<QStringList> xrefs, QList<int> graph_data);
void fillOffsetInfo(QString off);

View File

@ -49,7 +49,7 @@ class PieView : public QAbstractItemView
Q_OBJECT
public:
PieView(QWidget *parent = 0);
explicit PieView(QWidget *parent = 0);
QRect visualRect(const QModelIndex &index) const;
void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible);
@ -85,7 +85,7 @@ protected:
QRegion visualRegionForSelection(const QItemSelection &selection) const;
private:
QRect itemRect(const QModelIndex &item) const;
QRect itemRect(const QModelIndex &index) const;
QRegion itemRegion(const QModelIndex &index) const;
int rows(const QModelIndex &index = QModelIndex()) const;
void updateGeometries();