diff --git a/src/hexascii_highlighter.h b/src/hexascii_highlighter.h index f007da4e..8ccf5018 100644 --- a/src/hexascii_highlighter.h +++ b/src/hexascii_highlighter.h @@ -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); diff --git a/src/hexhighlighter.h b/src/hexhighlighter.h index 01b74711..89eeff0d 100644 --- a/src/hexhighlighter.h +++ b/src/hexhighlighter.h @@ -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); diff --git a/src/mdhighlighter.h b/src/mdhighlighter.h index 1a5ceca9..60b8fa0b 100644 --- a/src/mdhighlighter.h +++ b/src/mdhighlighter.h @@ -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); diff --git a/src/qrcore.cpp b/src/qrcore.cpp index 08c6640a..038a7ff4 100644 --- a/src/qrcore.cpp +++ b/src/qrcore.cpp @@ -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>> 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\"];"; diff --git a/src/qrcore.h b/src/qrcore.h index fe661571..2190fe27 100644 --- a/src/qrcore.h +++ b/src/qrcore.h @@ -66,7 +66,7 @@ public: QList> getComments(); QMap>> 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); diff --git a/src/qrdisasm.h b/src/qrdisasm.h index 8754a5c5..9143e773 100644 --- a/src/qrdisasm.h +++ b/src/qrdisasm.h @@ -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(); diff --git a/src/widgets/importswidget.h b/src/widgets/importswidget.h index 850d59e0..3cfb00b0 100644 --- a/src/widgets/importswidget.h +++ b/src/widgets/importswidget.h @@ -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; }; diff --git a/src/widgets/memorywidget.cpp b/src/widgets/memorywidget.cpp index 0dbdd326..60683552 100644 --- a/src/widgets/memorywidget.cpp +++ b/src/widgets/memorywidget.cpp @@ -1482,8 +1482,7 @@ void MemoryWidget::fill_refs(QList refs, QList 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 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); } diff --git a/src/widgets/memorywidget.h b/src/widgets/memorywidget.h index 7faab875..d3d223d9 100644 --- a/src/widgets/memorywidget.h +++ b/src/widgets/memorywidget.h @@ -61,7 +61,7 @@ public slots: void refreshHexdump(const QString &where = QString()); - void fill_refs(QList list, QList xrefs, QList graph_data); + void fill_refs(QList refs, QList xrefs, QList graph_data); void fillOffsetInfo(QString off); diff --git a/src/widgets/pieview.h b/src/widgets/pieview.h index 0ada5525..435d06d5 100644 --- a/src/widgets/pieview.h +++ b/src/widgets/pieview.h @@ -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();