Skip to content
Permalink
Browse files

C++11 standardization

  • Loading branch information...
Dax89 committed May 4, 2019
1 parent 26f48ce commit 05d22684aa834a2a163e7a61b0cef137b4961873
Submodule LibREDasm updated 48 files
+3 −3 redasm/assemblers/avr8/avr8.h
+1 −1 redasm/assemblers/avr8/avr8_printer.h
+3 −3 redasm/assemblers/chip8/chip8.h
+1 −1 redasm/assemblers/chip8/chip8_printer.h
+1 −1 redasm/assemblers/cil/cil.h
+3 −3 redasm/assemblers/dalvik/dalvik.h
+10 −10 redasm/assemblers/dalvik/dalvik_algorithm.h
+3 −3 redasm/assemblers/dalvik/dalvik_printer.h
+4 −4 redasm/assemblers/metaarm/arm.h
+1 −1 redasm/assemblers/metaarm/arm_common.h
+7 −7 redasm/assemblers/metaarm/metaarm.h
+6 −6 redasm/assemblers/metaarm/metaarm_algorithm.h
+2 −2 redasm/assemblers/metaarm/metaarm_emulator.h
+2 −2 redasm/assemblers/metaarm/metaarm_printer.h
+6 −6 redasm/assemblers/mips/mips.h
+2 −2 redasm/assemblers/mips/mips_printer.h
+2 −2 redasm/assemblers/x86/x86.h
+9 −9 redasm/disassembler/disassembler.h
+30 −30 redasm/disassembler/disassemblerbase.h
+2 −2 redasm/disassembler/listing/instructioncache.h
+2 −2 redasm/disassembler/listing/listingdocument.h
+2 −2 redasm/disassembler/types/referencetable.h
+2 −2 redasm/disassembler/types/symboltable.h
+1 −1 redasm/emulator/emulator_alu.h
+2 −2 redasm/emulator/emulator_base.h
+1 −1 redasm/emulator/emulator_type.h
+3 −3 redasm/loaders/binary/binary.h
+2 −2 redasm/loaders/chip8/chip8.h
+2 −2 redasm/loaders/dex/dex.h
+3 −3 redasm/loaders/elf/elf.h
+1 −1 redasm/loaders/elf/elf_analyzer.h
+2 −2 redasm/loaders/gba/gba.h
+1 −1 redasm/loaders/ihex/ihex.h
+2 −2 redasm/loaders/mscoff/mscoff.h
+3 −3 redasm/loaders/n64/n64.h
+1 −1 redasm/loaders/n64/n64_analyzer.h
+3 −3 redasm/loaders/pe/pe.h
+1 −1 redasm/loaders/pe/pe_analyzer.h
+1 −1 redasm/loaders/pe/vb/vb_analyzer.h
+3 −3 redasm/loaders/psxexe/psxexe.h
+1 −1 redasm/loaders/psxexe/psxexe_analyzer.h
+2 −2 redasm/loaders/xbe/xbe.h
+2 −2 redasm/plugins/assembler/algorithm/algorithm.h
+3 −3 redasm/plugins/assembler/algorithm/controlflow.h
+1 −1 redasm/plugins/assembler/algorithm/linearsweep.h
+1 −1 redasm/plugins/base.h
+2 −2 redasm/support/containers/cache_map.h
+3 −3 redasm/types/buffer/memorybuffer.h
@@ -398,7 +398,7 @@ void MainWindow::closeFile()

QWidget* oldwidget = ui->stackView->currentWidget();

if(oldwidget != NULL)
if(oldwidget != nullptr)
{
ui->stackView->removeWidget(oldwidget);
oldwidget->deleteLater();
@@ -512,7 +512,7 @@ REDasm::DisassemblerAPI *MainWindow::currentDisassembler() const
DisassemblerView* currdv = this->currentDisassemblerView();

if(!currdv)
return NULL;
return nullptr;

return currdv->disassembler();
}
@@ -23,11 +23,11 @@ class MainWindow : public QMainWindow
~MainWindow();

protected:
virtual void closeEvent(QCloseEvent* e);
virtual void dragEnterEvent(QDragEnterEvent* e);
virtual void dragMoveEvent(QDragMoveEvent* e);
virtual void dropEvent(QDropEvent* e);
bool eventFilter(QObject* obj, QEvent* e);
void closeEvent(QCloseEvent* e) override;
void dragEnterEvent(QDragEnterEvent* e) override;
void dragMoveEvent(QDragMoveEvent* e) override;
void dropEvent(QDropEvent* e) override;
bool eventFilter(QObject* obj, QEvent* e) override;

private slots:
void onOpenClicked();
@@ -4,7 +4,7 @@
#include <QFontDatabase>
#include <QColor>

CallGraphModel::CallGraphModel(QObject *parent) : QAbstractItemModel(parent), m_disassembler(NULL), m_root(NULL) { }
CallGraphModel::CallGraphModel(QObject *parent) : QAbstractItemModel(parent), m_disassembler(nullptr), m_root(nullptr) { }

void CallGraphModel::setDisassembler(const REDasm::DisassemblerPtr &disassembler)
{
@@ -23,15 +23,15 @@ void CallGraphModel::initializeGraph(address_t address)
{
m_root = it->get();
m_depths[m_root] = 0;
m_parents[m_root] = NULL;
m_parents[m_root] = nullptr;
this->populate(m_root);
}
}

void CallGraphModel::clearGraph()
{
this->beginResetModel();
m_root = NULL;
m_root = nullptr;
m_depths.clear();
m_children.clear();
m_parents.clear();
@@ -27,13 +27,13 @@ class CallGraphModel : public QAbstractItemModel
int getParentIndex(REDasm::ListingItem *parentitem) const;

public:
virtual bool hasChildren(const QModelIndex& parentindex) const;
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const;
virtual QModelIndex parent(const QModelIndex &child) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
virtual QVariant data(const QModelIndex &index, int role) const;
virtual int columnCount(const QModelIndex& parent) const;
virtual int rowCount(const QModelIndex& parent) const;
bool hasChildren(const QModelIndex& parentindex) const override;
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
QModelIndex parent(const QModelIndex &child) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
QVariant data(const QModelIndex &index, int role) const override;
int columnCount(const QModelIndex& parent) const override;
int rowCount(const QModelIndex& parent) const override;

private:
REDasm::PrinterPtr m_printer;
@@ -1,6 +1,6 @@
#include "disassemblermodel.h"

DisassemblerModel::DisassemblerModel(QObject *parent) : QAbstractListModel(parent), m_disassembler(NULL) { }
DisassemblerModel::DisassemblerModel(QObject *parent) : QAbstractListModel(parent), m_disassembler(nullptr) { }
void DisassemblerModel::setDisassembler(const REDasm::DisassemblerPtr &disassembler) { m_disassembler = disassembler; }

QVariant DisassemblerModel::headerData(int section, Qt::Orientation orientation, int role) const
@@ -12,11 +12,11 @@ class DisassemblerModel : public QAbstractListModel
Q_OBJECT

public:
explicit DisassemblerModel(QObject *parent = NULL);
explicit DisassemblerModel(QObject *parent = nullptr);

public:
virtual void setDisassembler(const REDasm::DisassemblerPtr& disassembler);
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;

protected:
REDasm::DisassemblerPtr m_disassembler;
@@ -12,17 +12,17 @@ class GotoModel : public ListingItemModel
~GotoModel();

public:
virtual QVariant data(const QModelIndex &index, int role) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
virtual int columnCount(const QModelIndex&) const;
QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
int columnCount(const QModelIndex&) const override;

private:
QColor itemColor(const REDasm::ListingItem* item) const;
QString itemName(const REDasm::ListingItem* item) const;
QString itemType(const REDasm::ListingItem* item) const;

protected:
virtual bool isItemAllowed(const REDasm::ListingItem* item) const;
bool isItemAllowed(const REDasm::ListingItem* item) const override;
};

#endif // GOTOMODEL_H
@@ -16,10 +16,10 @@ class ListingFilterModel : public QIdentityProxyModel
void clearFilter();

public:
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
virtual QModelIndex index(int row, int column, const QModelIndex& = QModelIndex()) const;
virtual QModelIndex mapFromSource(const QModelIndex& sourceindex) const;
virtual QModelIndex mapToSource(const QModelIndex& proxyindex) const;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QModelIndex index(int row, int column, const QModelIndex& = QModelIndex()) const override;
QModelIndex mapFromSource(const QModelIndex& sourceindex) const override;
QModelIndex mapToSource(const QModelIndex& proxyindex) const override;

private:
void updateFiltering();
@@ -10,15 +10,15 @@ class ListingItemModel : public DisassemblerModel
Q_OBJECT

public:
explicit ListingItemModel(size_t itemtype, QObject *parent = NULL);
virtual void setDisassembler(const REDasm::DisassemblerPtr &disassembler);
explicit ListingItemModel(size_t itemtype, QObject *parent = nullptr);
void setDisassembler(const REDasm::DisassemblerPtr &disassembler) override;

public:
virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
virtual int rowCount(const QModelIndex& = QModelIndex()) const;
virtual int columnCount(const QModelIndex& = QModelIndex()) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
virtual QVariant data(const QModelIndex &index, int role) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
int rowCount(const QModelIndex& = QModelIndex()) const override;
int columnCount(const QModelIndex& = QModelIndex()) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
QVariant data(const QModelIndex &index, int role) const override;

protected:
virtual bool isItemAllowed(const REDasm::ListingItem *item) const;
@@ -11,15 +11,15 @@ class ReferencesModel : public DisassemblerModel

public:
explicit ReferencesModel(QObject *parent = 0);
virtual void setDisassembler(const REDasm::DisassemblerPtr& disassembler);
void setDisassembler(const REDasm::DisassemblerPtr& disassembler) override;
void xref(address_t address);

public:
virtual QModelIndex index(int row, int column, const QModelIndex &) const;
virtual QVariant data(const QModelIndex &index, int role) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
virtual int rowCount(const QModelIndex&) const;
virtual int columnCount(const QModelIndex&) const;
QModelIndex index(int row, int column, const QModelIndex &) const override;
QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
int rowCount(const QModelIndex&) const override;
int columnCount(const QModelIndex&) const override;

public slots:
void clear();
@@ -8,12 +8,12 @@ class SegmentsModel : public ListingItemModel
Q_OBJECT

public:
explicit SegmentsModel(QObject *parent = NULL);
explicit SegmentsModel(QObject *parent = nullptr);

public:
virtual QVariant data(const QModelIndex &index, int role) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
virtual int columnCount(const QModelIndex&) const;
QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
int columnCount(const QModelIndex&) const override;

private:
static QString segmentFlags(const REDasm::Segment* segment);
@@ -22,10 +22,10 @@ class SignatureFilesModel : public QAbstractListModel
void mark(const QModelIndex& index);

public:
virtual QVariant data(const QModelIndex &index, int role) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
virtual int rowCount(const QModelIndex& = QModelIndex()) const;
virtual int columnCount(const QModelIndex& = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
int rowCount(const QModelIndex& = QModelIndex()) const override;
int columnCount(const QModelIndex& = QModelIndex()) const override;

private:
QList< QPair<std::string, std::string> > m_signaturefiles;
@@ -13,10 +13,10 @@ class SignaturesModel : public QAbstractListModel
void setSignature(const REDasm::SignatureDB* sigdb);

public:
virtual QVariant data(const QModelIndex &index, int role) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
virtual int rowCount(const QModelIndex& = QModelIndex()) const;
virtual int columnCount(const QModelIndex& = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
int rowCount(const QModelIndex& = QModelIndex()) const override;
int columnCount(const QModelIndex& = QModelIndex()) const override;

private:
const REDasm::SignatureDB* m_signaturedb;
@@ -8,7 +8,7 @@ class SymbolTableModel : public ListingItemModel
Q_OBJECT

public:
explicit SymbolTableModel(size_t itemtype, QObject *parent = NULL);
explicit SymbolTableModel(size_t itemtype, QObject *parent = nullptr);
void setSymbolFlags(u32 symbolflags);

protected:
@@ -11,7 +11,7 @@ class REDasmSettings : public QSettings
Q_OBJECT

public:
explicit REDasmSettings(QObject *parent = NULL);
explicit REDasmSettings(QObject *parent = nullptr);
QStringList recentFiles() const;
QString currentTheme() const;
QFont currentFont() const;
@@ -11,10 +11,10 @@ class CheckedItemsModel : public QAbstractListModel
void uncheckAll();

public:
Qt::ItemFlags flags(const QModelIndex &index) const;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
Qt::ItemFlags flags(const QModelIndex &index) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;

private:
REDasm::UI::CheckList& m_items;
@@ -9,8 +9,8 @@ class REDasmUI: public REDasm::AbstractUI
public:
REDasmUI(QMainWindow* mainwindow);
virtual ~REDasmUI() = default;
virtual void checkList(const std::string& title, const std::string& text, std::deque<REDasm::UI::CheckListItem>& items);
virtual bool askYN(const std::string& title, const std::string& text);
void checkList(const std::string& title, const std::string& text, std::deque<REDasm::UI::CheckListItem>& items) override;
bool askYN(const std::string& title, const std::string& text) override;

private:
QMainWindow* m_mainwindow;
@@ -28,14 +28,14 @@
#define TEST_SYMBOL_NAME(s, sym, exp, n) TEST_SYMBOL(s, sym, TEST_NAME(sym, n) && exp)

#define ADD_TEST(t, cb) m_tests[t] = std::bind(&DisassemblerTest::cb, this)
#define ADD_TEST_NULL(t, cb) m_tests[t] = NULL;
#define ADD_TEST_NULL(t, cb) m_tests[t] = nullptr;
#define ADD_TEST_PATH(t, cb) m_tests[TEST_PATH(t)] = std::bind(&DisassemblerTest::cb, this)
#define ADD_TEST_PATH_NULL(t, cb) m_tests[TEST_PATH(t)] = NULL;
#define ADD_TEST_PATH_NULL(t, cb) m_tests[TEST_PATH(t)] = nullptr;

using namespace std;
using namespace REDasm;

DisassemblerTest::DisassemblerTest(): m_buffer(NULL)
DisassemblerTest::DisassemblerTest(): m_buffer(nullptr)
{
ADD_TEST("/home/davide/Programmazione/Cavia.exe", testCavia);

@@ -51,7 +51,7 @@ DisassemblerTest::DisassemblerTest(): m_buffer(NULL)
ADD_TEST_PATH("ELF Test/jmptable", testJmpTable);
ADD_TEST_PATH("ELF Test/pwrctl_be", testPwrCtlBE);

ADD_TEST_PATH_NULL("PE Test/CorruptedIT.exe", NULL);
ADD_TEST_PATH_NULL("PE Test/CorruptedIT.exe", nullptr);

ContextSettings ctxsettings;
ctxsettings.tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation).toStdString();
@@ -2,7 +2,7 @@
#include "../../themeprovider.h"
#include <QPainter>

DisassemblerColumnView::DisassemblerColumnView(QWidget *parent) : QWidget(parent), m_disassembler(NULL), m_first(-1), m_last(-1)
DisassemblerColumnView::DisassemblerColumnView(QWidget *parent) : QWidget(parent), m_disassembler(nullptr), m_first(-1), m_last(-1)
{
this->setBackgroundRole(QPalette::Base);
this->setAutoFillBackground(true);
@@ -3,7 +3,7 @@
#include "../../redasmsettings.h"
#include <QScrollBar>

DisassemblerListingView::DisassemblerListingView(QWidget *parent): QSplitter(parent), m_disassembler(NULL)
DisassemblerListingView::DisassemblerListingView(QWidget *parent): QSplitter(parent), m_disassembler(nullptr)
{
this->setOrientation(Qt::Horizontal);
this->setStyleSheet("QSplitter::handle { background-color: " + THEME_VALUE_COLOR("seek") + "; }");
@@ -32,22 +32,20 @@ class DisassemblerTextView : public QAbstractScrollArea
void renderLine(u64 line);

protected:
virtual void scrollContentsBy(int dx, int dy);
virtual void paintEvent(QPaintEvent* e);
virtual void resizeEvent(QResizeEvent* e);
virtual void mousePressEvent(QMouseEvent* e);
virtual void mouseMoveEvent(QMouseEvent* e);
virtual void mouseReleaseEvent(QMouseEvent* e);
virtual void mouseDoubleClickEvent(QMouseEvent* e);
virtual void wheelEvent(QWheelEvent *e);
virtual void keyPressEvent(QKeyEvent *e);
virtual void timerEvent(QTimerEvent* e);
virtual bool event(QEvent* e);

protected:
virtual void paintLines(QPainter* painter, u64 first, u64 last);
void scrollContentsBy(int dx, int dy) override;
void paintEvent(QPaintEvent* e) override;
void resizeEvent(QResizeEvent* e) override;
void mousePressEvent(QMouseEvent* e) override;
void mouseMoveEvent(QMouseEvent* e) override;
void mouseReleaseEvent(QMouseEvent* e) override;
void mouseDoubleClickEvent(QMouseEvent* e) override;
void wheelEvent(QWheelEvent *e) override;
void keyPressEvent(QKeyEvent *e) override;
void timerEvent(QTimerEvent* e) override;
bool event(QEvent* e) override;

private:
void paintLines(QPainter* painter, u64 first, u64 last);
void onDocumentChanged(const REDasm::ListingDocumentChanged* ldc);
REDasm::ListingDocument& currentDocument();
const REDasm::ListingDocument& currentDocument() const;
@@ -15,8 +15,8 @@ class DisassemblerPopup : public QWidget
void popup(const std::string& word, int line);

protected:
virtual void mouseMoveEvent(QMouseEvent *e);
virtual void wheelEvent(QWheelEvent* e);
void mouseMoveEvent(QMouseEvent *e) override;
void wheelEvent(QWheelEvent* e) override;

private:
void updateGeometry();
@@ -24,7 +24,7 @@ class DisassemblerView : public QWidget
Q_OBJECT

public:
explicit DisassemblerView(QLineEdit* lefilter, QWidget *parent = NULL);
explicit DisassemblerView(QLineEdit* lefilter, QWidget *parent = nullptr);
virtual ~DisassemblerView();
REDasm::DisassemblerAPI *disassembler();
void setDisassembler(REDasm::DisassemblerAPI *disassembler);
@@ -13,7 +13,7 @@ class DisassemblerViewActions : public QObject
enum { BackAction = 0, ForwardAction, GotoAction, GraphListingAction };

public:
explicit DisassemblerViewActions(QObject *parent = NULL);
explicit DisassemblerViewActions(QObject *parent = nullptr);
virtual ~DisassemblerViewActions();
void setIcon(int actionid, const QIcon& icon);
void setEnabled(int actionid, bool b);
Oops, something went wrong.

0 comments on commit 05d2268

Please sign in to comment.
You can’t perform that action at this time.