Skip to content

Commit

Permalink
Address hicpp-member-init warnings.
Browse files Browse the repository at this point in the history
```
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:142:3: warning: uninitialized record type: 'local' [hicpp-member-init]
  142 |   struct iovec local;
      |   ^
      |                     {}
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:143:3: warning: uninitialized record type: 'remote' [hicpp-member-init]
  143 |   struct iovec remote;
      |   ^
      |                      {}
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:211:3: warning: uninitialized record type: 'local' [hicpp-member-init]
  211 |   struct iovec local;
      |   ^
      |                     {}
/w/dolphin-memory-engine/Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp:212:3: warning: uninitialized record type: 'remote' [hicpp-member-init]
  212 |   struct iovec remote;
      |   ^
      |                      {}
/w/dolphin-memory-engine/Source/GUI/MainWindow.cpp:19:1: warning: constructor does not initialize these fields: m_watcher, m_scanner, m_viewer, m_copier, m_lblDolphinStatus, m_lblMem2Status, m_menuFile, m_menuEdit, m_menuDolphin, m_menuView, m_menuHelp, m_actOpenWatchList, m_actSaveWatchList, m_actSaveAsWatchList, m_actClearWatchList, m_actImportFromCT, m_actExportAsCSV, m_actSettings, m_actAutoHook, m_actHook, m_actUnhook, m_actMemoryViewer, m_actCopyMemory, m_actQuit, m_actAbout [hicpp-member-init]
   19 | MainWindow::MainWindow()
      | ^
/w/dolphin-memory-engine/Source/GUI/MemScanner/MemScanWidget.cpp:14:1: warning: constructor does not initialize these fields: m_memScanner, m_resultsListModel, m_txbSearchRange1, m_txbSearchRange2, m_btnFirstScan, m_btnNextScan, m_btnResetScan, m_btnUndoScan, m_btnAddSelection, m_btnAddAll, m_btnRemoveSelection, m_txbSearchTerm1, m_txbSearchTerm2, m_searchTerm2Widget, m_currentValuesUpdateTimer, m_cmbScanFilter, m_cmbScanType, m_lblResultCount, m_chkSignedScan, m_chkEnforceMemAlignment, m_btnGroupScanBase, m_rdbBaseDecimal, m_rdbBaseHexadecimal, m_rdbBaseOctal, m_rdbBaseBinary, m_groupScanBase, m_tblResulstList, m_variableLengthType [hicpp-member-init]
   14 | MemScanWidget::MemScanWidget()
      | ^
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewer.cpp:25:1: warning: constructor does not initialize these fields: m_curosrRect [hicpp-member-init]
   25 | MemViewer::MemViewer(QWidget* parent) : QAbstractScrollArea(parent)
      | ^
/w/dolphin-memory-engine/Source/GUI/MemViewer/MemViewerWidget.cpp:10:1: warning: constructor does not initialize these fields: m_txtJumpAddress, m_btnGoToMEM1Start, m_btnGoToSecondaryRAMStart, m_updateMemoryTimer, m_memViewer [hicpp-member-init]
   10 | MemViewerWidget::MemViewerWidget(QWidget* const parent) : QWidget(parent)
      | ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/Dialogs/DlgAddWatchEntry.cpp:13:1: warning: constructor does not initialize these fields: m_entry, m_txbAddress, m_offsetsLayout, m_chkBoundToPointer, m_lblValuePreview, m_txbLabel, m_cmbTypes, m_spnLength, m_pointerWidget, m_btnAddOffset, m_btnRemoveOffset [hicpp-member-init]
   13 | DlgAddWatchEntry::DlgAddWatchEntry(const bool newEntry, MemWatchEntry* const entry,
      | ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/Dialogs/DlgChangeType.cpp:11:1: warning: constructor does not initialize these fields: m_cmbTypes, m_spnLength, m_lengthSelection [hicpp-member-init]
   11 | DlgChangeType::DlgChangeType(QWidget* parent, const int typeIndex, const size_t length)
      | ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/Dialogs/DlgImportCTFile.cpp:11:1: warning: constructor does not initialize these fields: m_useDolphinPointers, m_txbFileName, m_btnBrowseFiles, m_txbCommonBase, m_btnGroupImportAddressMethod, m_rdbUseDolphinPointers, m_rdbUseCommonBase, m_groupImportAddressMethod, m_widgetAddressMethod [hicpp-member-init]
   11 | DlgImportCTFile::DlgImportCTFile(QWidget* const parent) : QDialog(parent)
      | ^
/w/dolphin-memory-engine/Source/GUI/MemWatcher/MemWatchWidget.cpp:31:1: warning: constructor does not initialize these fields: m_watchView, m_watchModel, m_watchDelegate, m_btnAddGroup, m_btnAddWatchEntry, m_updateTimer, m_freezeTimer [hicpp-member-init]
   31 | MemWatchWidget::MemWatchWidget(QWidget* parent) : QWidget(parent)
      | ^
/w/dolphin-memory-engine/Source/MemoryScanner/MemoryScanner.cpp:30:1: warning: constructor does not initialize these fields: m_memSize [hicpp-member-init]
   30 | MemScanner::MemScanner() = default;
      | ^
```
  • Loading branch information
cristian64 committed May 12, 2024
1 parent 0583567 commit 2070819
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 99 deletions.
22 changes: 14 additions & 8 deletions Source/DolphinProcess/Linux/LinuxDolphinProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ bool LinuxDolphinProcess::findPID()
bool LinuxDolphinProcess::readFromRAM(const u32 offset, char* buffer, const size_t size,
const bool withBSwap)
{
struct iovec local;
struct iovec remote;
size_t nread;
u64 RAMAddress = 0;
if (m_ARAMAccessible)
{
Expand All @@ -159,13 +156,22 @@ bool LinuxDolphinProcess::readFromRAM(const u32 offset, char* buffer, const size
RAMAddress = m_emuRAMAddressStart + offset;
}

iovec local{};
local.iov_base = buffer;
local.iov_len = size;

iovec remote{};
remote.iov_base = reinterpret_cast<void*>(RAMAddress);
remote.iov_len = size;

nread = process_vm_readv(m_PID, &local, 1, &remote, 1, 0);
if (nread != size)
const ssize_t nread{process_vm_readv(m_PID, &local, 1, &remote, 1, 0)};
if (nread == -1)
{
// A more specific error type should be available in `errno` (if ever interested).
return false;
}

if (static_cast<size_t>(nread) != size)
return false;

if (withBSwap)
Expand Down Expand Up @@ -208,9 +214,6 @@ bool LinuxDolphinProcess::readFromRAM(const u32 offset, char* buffer, const size
bool LinuxDolphinProcess::writeToRAM(const u32 offset, const char* buffer, const size_t size,
const bool withBSwap)
{
struct iovec local;
struct iovec remote;

u64 RAMAddress = 0;
if (m_ARAMAccessible)
{
Expand All @@ -231,8 +234,11 @@ bool LinuxDolphinProcess::writeToRAM(const u32 offset, const char* buffer, const
char* bufferCopy = new char[size];
std::memcpy(bufferCopy, buffer, size);

iovec local{};
local.iov_base = bufferCopy;
local.iov_len = size;

iovec remote{};
remote.iov_base = reinterpret_cast<void*>(RAMAddress);
remote.iov_len = size;

Expand Down
50 changes: 25 additions & 25 deletions Source/GUI/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,34 +58,34 @@ class MainWindow : public QMainWindow

QSplitter* m_splitter{};

MemWatchWidget* m_watcher;
MemScanWidget* m_scanner;
MemViewerWidget* m_viewer;
DlgCopy* m_copier;
MemWatchWidget* m_watcher{};
MemScanWidget* m_scanner{};
MemViewerWidget* m_viewer{};
DlgCopy* m_copier{};

QTimer m_autoHookTimer;

QLabel* m_lblDolphinStatus;
QLabel* m_lblMem2Status;
QLabel* m_lblDolphinStatus{};
QLabel* m_lblMem2Status{};

QMenu* m_menuFile;
QMenu* m_menuEdit;
QMenu* m_menuDolphin;
QMenu* m_menuView;
QMenu* m_menuHelp;
QAction* m_actOpenWatchList;
QAction* m_actSaveWatchList;
QAction* m_actSaveAsWatchList;
QAction* m_actClearWatchList;
QAction* m_actImportFromCT;
QAction* m_actExportAsCSV;
QAction* m_actSettings;
QAction* m_actAutoHook;
QAction* m_actHook;
QAction* m_actUnhook;
QAction* m_actMemoryViewer;
QAction* m_actCopyMemory;
QMenu* m_menuFile{};
QMenu* m_menuEdit{};
QMenu* m_menuDolphin{};
QMenu* m_menuView{};
QMenu* m_menuHelp{};
QAction* m_actOpenWatchList{};
QAction* m_actSaveWatchList{};
QAction* m_actSaveAsWatchList{};
QAction* m_actClearWatchList{};
QAction* m_actImportFromCT{};
QAction* m_actExportAsCSV{};
QAction* m_actSettings{};
QAction* m_actAutoHook{};
QAction* m_actHook{};
QAction* m_actUnhook{};
QAction* m_actMemoryViewer{};
QAction* m_actCopyMemory{};
QAction* m_actScanner{};
QAction* m_actQuit;
QAction* m_actAbout;
QAction* m_actQuit{};
QAction* m_actAbout{};
};
56 changes: 28 additions & 28 deletions Source/GUI/MemScanner/MemScanWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,33 +58,33 @@ class MemScanWidget : public QWidget
void updateScanFilterChoices();
void updateTypeAdditionalOptions();

MemScanner* m_memScanner;
ResultsListModel* m_resultsListModel;
QLineEdit* m_txbSearchRange1;
QLineEdit* m_txbSearchRange2;
QPushButton* m_btnFirstScan;
QPushButton* m_btnNextScan;
QPushButton* m_btnResetScan;
QPushButton* m_btnUndoScan;
QPushButton* m_btnAddSelection;
QPushButton* m_btnAddAll;
QPushButton* m_btnRemoveSelection;
QLineEdit* m_txbSearchTerm1;
QLineEdit* m_txbSearchTerm2;
QWidget* m_searchTerm2Widget;
QTimer* m_currentValuesUpdateTimer;
QComboBox* m_cmbScanFilter;
QComboBox* m_cmbScanType;
QLabel* m_lblResultCount;
QCheckBox* m_chkSignedScan;
QCheckBox* m_chkEnforceMemAlignment;
QButtonGroup* m_btnGroupScanBase;
QRadioButton* m_rdbBaseDecimal;
QRadioButton* m_rdbBaseHexadecimal;
QRadioButton* m_rdbBaseOctal;
QRadioButton* m_rdbBaseBinary;
QGroupBox* m_groupScanBase;
QTableView* m_tblResulstList;
bool m_variableLengthType;
MemScanner* m_memScanner{};
ResultsListModel* m_resultsListModel{};
QLineEdit* m_txbSearchRange1{};
QLineEdit* m_txbSearchRange2{};
QPushButton* m_btnFirstScan{};
QPushButton* m_btnNextScan{};
QPushButton* m_btnResetScan{};
QPushButton* m_btnUndoScan{};
QPushButton* m_btnAddSelection{};
QPushButton* m_btnAddAll{};
QPushButton* m_btnRemoveSelection{};
QLineEdit* m_txbSearchTerm1{};
QLineEdit* m_txbSearchTerm2{};
QWidget* m_searchTerm2Widget{};
QTimer* m_currentValuesUpdateTimer{};
QComboBox* m_cmbScanFilter{};
QComboBox* m_cmbScanType{};
QLabel* m_lblResultCount{};
QCheckBox* m_chkSignedScan{};
QCheckBox* m_chkEnforceMemAlignment{};
QButtonGroup* m_btnGroupScanBase{};
QRadioButton* m_rdbBaseDecimal{};
QRadioButton* m_rdbBaseHexadecimal{};
QRadioButton* m_rdbBaseOctal{};
QRadioButton* m_rdbBaseBinary{};
QGroupBox* m_groupScanBase{};
QTableView* m_tblResulstList{};
bool m_variableLengthType{};
size_t m_showThreshold{};
};
4 changes: 2 additions & 2 deletions Source/GUI/MemViewer/MemViewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class MemViewer : public QAbstractScrollArea
u32 m_currentFirstAddress = 0;
u32 m_memViewStart = 0;
u32 m_memViewEnd = 0;
QRect* m_curosrRect;
QShortcut* m_copyShortcut;
QRect* m_curosrRect{};
QShortcut* m_copyShortcut{};
QElapsedTimer m_elapsedTimer;
};
10 changes: 5 additions & 5 deletions Source/GUI/MemViewer/MemViewerWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class MemViewerWidget : public QWidget
void initialiseWidgets();
void makeLayouts();

QLineEdit* m_txtJumpAddress;
QPushButton* m_btnGoToMEM1Start;
QPushButton* m_btnGoToSecondaryRAMStart;
QTimer* m_updateMemoryTimer;
MemViewer* m_memViewer;
QLineEdit* m_txtJumpAddress{};
QPushButton* m_btnGoToMEM1Start{};
QPushButton* m_btnGoToSecondaryRAMStart{};
QTimer* m_updateMemoryTimer{};
MemViewer* m_memViewer{};
};
22 changes: 11 additions & 11 deletions Source/GUI/MemWatcher/Dialogs/DlgAddWatchEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ class DlgAddWatchEntry : public QDialog
void removePointerOffset();
void removeAllPointerOffset();

MemWatchEntry* m_entry;
QLineEdit* m_txbAddress;
MemWatchEntry* m_entry{};
QLineEdit* m_txbAddress{};
QVector<QLineEdit*> m_offsets;
QVector<QLabel*> m_addressPath;
QGridLayout* m_offsetsLayout;
QCheckBox* m_chkBoundToPointer;
QLineEdit* m_lblValuePreview;
QLineEdit* m_txbLabel;
QComboBox* m_cmbTypes;
QSpinBox* m_spnLength;
QGroupBox* m_pointerWidget;
QPushButton* m_btnAddOffset;
QPushButton* m_btnRemoveOffset;
QGridLayout* m_offsetsLayout{};
QCheckBox* m_chkBoundToPointer{};
QLineEdit* m_lblValuePreview{};
QLineEdit* m_txbLabel{};
QComboBox* m_cmbTypes{};
QSpinBox* m_spnLength{};
QGroupBox* m_pointerWidget{};
QPushButton* m_btnAddOffset{};
QPushButton* m_btnRemoveOffset{};
};
6 changes: 3 additions & 3 deletions Source/GUI/MemWatcher/Dialogs/DlgChangeType.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DlgChangeType : public QDialog

int m_typeIndex;
size_t m_length;
QComboBox* m_cmbTypes;
QSpinBox* m_spnLength;
QWidget* m_lengthSelection;
QComboBox* m_cmbTypes{};
QSpinBox* m_spnLength{};
QWidget* m_lengthSelection{};
};
18 changes: 9 additions & 9 deletions Source/GUI/MemWatcher/Dialogs/DlgImportCTFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ class DlgImportCTFile : public QDialog
void accept() override;

private:
bool m_useDolphinPointers;
bool m_useDolphinPointers{};
u32 m_commonBase = 0;
QString m_strFileName;
QLineEdit* m_txbFileName;
QPushButton* m_btnBrowseFiles;
QLineEdit* m_txbCommonBase;
QButtonGroup* m_btnGroupImportAddressMethod;
QRadioButton* m_rdbUseDolphinPointers;
QRadioButton* m_rdbUseCommonBase;
QGroupBox* m_groupImportAddressMethod;
QWidget* m_widgetAddressMethod;
QLineEdit* m_txbFileName{};
QPushButton* m_btnBrowseFiles{};
QLineEdit* m_txbCommonBase{};
QButtonGroup* m_btnGroupImportAddressMethod{};
QRadioButton* m_rdbUseDolphinPointers{};
QRadioButton* m_rdbUseCommonBase{};
QGroupBox* m_groupImportAddressMethod{};
QWidget* m_widgetAddressMethod{};
};
14 changes: 7 additions & 7 deletions Source/GUI/MemWatcher/MemWatchWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ class MemWatchWidget : public QWidget
void initialiseWidgets();
void makeLayouts();

QTreeView* m_watchView;
MemWatchModel* m_watchModel;
MemWatchDelegate* m_watchDelegate;
QPushButton* m_btnAddGroup;
QPushButton* m_btnAddWatchEntry;
QTimer* m_updateTimer;
QTimer* m_freezeTimer;
QTreeView* m_watchView{};
MemWatchModel* m_watchModel{};
MemWatchDelegate* m_watchDelegate{};
QPushButton* m_btnAddGroup{};
QPushButton* m_btnAddWatchEntry{};
QTimer* m_updateTimer{};
QTimer* m_freezeTimer{};
QString m_watchListFile = "";
bool m_hasUnsavedChanges = false;

Expand Down
2 changes: 1 addition & 1 deletion Source/MemoryScanner/MemoryScanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class MemScanner

Common::MemType m_memType = Common::MemType::type_byte;
Common::MemBase m_memBase = Common::MemBase::base_decimal;
size_t m_memSize;
size_t m_memSize{};
bool m_enforceMemAlignment = true;
bool m_memIsSigned = false;

Expand Down

0 comments on commit 2070819

Please sign in to comment.