Skip to content

Commit

Permalink
Fix all uninitialized variable warnings (C26495)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pokechu22 committed Sep 4, 2021
1 parent 1b912cb commit 83f34d3
Show file tree
Hide file tree
Showing 108 changed files with 637 additions and 628 deletions.
2 changes: 1 addition & 1 deletion Source/Core/AudioCommon/Mixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Mixer final
bool m_is_stretching = false;
AudioCommon::AudioStretcher m_stretcher;
AudioCommon::SurroundDecoder m_surround_decoder;
std::array<short, MAX_SAMPLES * 2> m_scratch_buffer;
std::array<short, MAX_SAMPLES * 2> m_scratch_buffer{};

WaveFileWriter m_wave_writer_dtk;
WaveFileWriter m_wave_writer_dsp;
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/AudioCommon/OpenALStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ class OpenALStream final : public SoundStream
Common::Flag m_run_thread;

std::vector<short> m_realtime_buffer;
std::array<ALuint, OAL_BUFFERS> m_buffers;
std::array<ALuint, OAL_BUFFERS> m_buffers{};
ALuint m_source;
ALfloat m_volume;
ALfloat m_volume{};

#endif // _WIN32
};
2 changes: 1 addition & 1 deletion Source/Core/Common/Config/ConfigInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using UnderlyingType = typename std::enable_if_t<std::is_enum<T>{}, std::underly

struct Location
{
System system;
System system{};
std::string section;
std::string key;

Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Common/FileUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ namespace File
// FileSystem tree node/
struct FSTEntry
{
bool isDirectory;
u64 size; // File length, or for directories, recursive count of children
bool isDirectory{};
u64 size{}; // File length, or for directories, recursive count of children
std::string physicalName; // Name on disk
std::string virtualName; // Name in FST names table
std::vector<FSTEntry> children;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/FixedSizeQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class FixedSizeQueue
bool empty() const noexcept { return size() == 0; }

private:
std::array<T, N> storage;
std::array<T, N> storage{};
int head = 0;
int tail = 0;
// Sacrifice 4 bytes for a simpler implementation. may optimize away in the future.
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Common/LinearDiskCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ class LinearDiskCache
std::min(Common::scm_rev_git_str.size(), sizeof(ver)));
}

u32 id;
u32 id = 0;
const u16 key_t_size = sizeof(K);
const u16 value_t_size = sizeof(V);
char ver[40] = {};

} m_header;

File::IOFile m_file;
u32 m_num_entries;
u32 m_num_entries = 0;
};
2 changes: 1 addition & 1 deletion Source/Core/Common/Logging/ConsoleListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ class ConsoleListener : public Common::Log::LogListener
void Log(Common::Log::LOG_LEVELS level, const char* text) override;

private:
bool m_use_color;
bool m_use_color = false;
};
2 changes: 1 addition & 1 deletion Source/Core/Common/SPSCQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class SPSCQueue
delete next_ptr;
}

T current;
T current{};
std::atomic<ElementPtr*> next;
};

Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Core/ActionReplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ namespace ActionReplay
{
struct AREntry
{
AREntry() {}
AREntry() = default;
AREntry(u32 _addr, u32 _value) : cmd_addr(_addr), value(_value) {}
u32 cmd_addr;
u32 value;
u32 cmd_addr = 0;
u32 value = 0;
};
constexpr bool operator==(const AREntry& left, const AREntry& right)
{
Expand Down
64 changes: 32 additions & 32 deletions Source/Core/Core/BootManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,42 +64,42 @@ struct ConfigCache

// These store if the relevant setting should be reset back later (true) or if it should be left
// alone on restore (false)
bool bSetEmulationSpeed;
bool bSetVolume;
std::array<bool, MAX_BBMOTES> bSetWiimoteSource;
std::array<bool, SerialInterface::MAX_SI_CHANNELS> bSetPads;
std::array<bool, ExpansionInterface::MAX_EXI_CHANNELS> bSetEXIDevice;
bool bSetEmulationSpeed = false;
bool bSetVolume = false;
std::array<bool, MAX_BBMOTES> bSetWiimoteSource{};
std::array<bool, SerialInterface::MAX_SI_CHANNELS> bSetPads{};
std::array<bool, ExpansionInterface::MAX_EXI_CHANNELS> bSetEXIDevice{};

private:
bool valid;
bool bCPUThread;
bool bJITFollowBranch;
bool bSyncGPUOnSkipIdleHack;
bool bFPRF;
bool bAccurateNaNs;
bool bMMU;
bool bLowDCBZHack;
bool bDisableICache;
bool m_EnableJIT;
bool bSyncGPU;
int iSyncGpuMaxDistance;
int iSyncGpuMinDistance;
float fSyncGpuOverclock;
bool bFastDiscSpeed;
bool bDSPHLE;
bool bHLE_BS2;
int iSelectedLanguage;
PowerPC::CPUCore cpu_core;
int Volume;
float m_EmulationSpeed;
float m_OCFactor;
bool m_OCEnable;
bool m_bt_passthrough_enabled;
bool valid = false;
bool bCPUThread = false;
bool bJITFollowBranch = false;
bool bSyncGPUOnSkipIdleHack = false;
bool bFPRF = false;
bool bAccurateNaNs = false;
bool bMMU = false;
bool bLowDCBZHack = false;
bool bDisableICache = false;
bool m_EnableJIT = false;
bool bSyncGPU = false;
int iSyncGpuMaxDistance = false;
int iSyncGpuMinDistance = false;
float fSyncGpuOverclock = false;
bool bFastDiscSpeed = false;
bool bDSPHLE = false;
bool bHLE_BS2 = false;
int iSelectedLanguage = false;
PowerPC::CPUCore cpu_core = PowerPC::CPUCore::Interpreter;
int Volume = 0;
float m_EmulationSpeed = 0;
float m_OCFactor = 0;
bool m_OCEnable = false;
bool m_bt_passthrough_enabled = false;
std::string sBackend;
std::string m_strGPUDeterminismMode;
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource;
std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads;
std::array<ExpansionInterface::TEXIDevices, ExpansionInterface::MAX_EXI_CHANNELS> m_EXIDevice;
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource{};
std::array<SerialInterface::SIDevices, SerialInterface::MAX_SI_CHANNELS> Pads{};
std::array<ExpansionInterface::TEXIDevices, ExpansionInterface::MAX_EXI_CHANNELS> m_EXIDevice{};
};

void ConfigCache::SaveConfig(const SConfig& config)
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/DSP/DSPCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,10 @@ struct DSP_Regs
struct DSPInitOptions
{
// DSP IROM blob, which is where the DSP boots from. Embedded into the DSP.
std::array<u16, DSP_IROM_SIZE> irom_contents;
std::array<u16, DSP_IROM_SIZE> irom_contents = {};

// DSP DROM blob, which contains resampling coefficients.
std::array<u16, DSP_COEF_SIZE> coef_contents;
std::array<u16, DSP_COEF_SIZE> coef_contents = {};

// Core used to emulate the DSP.
// Default: JIT64.
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ DSPJitRegCache::DSPJitRegCache(DSPEmitter& emitter)

DSPJitRegCache::DSPJitRegCache(const DSPJitRegCache& cache)
: m_regs(cache.m_regs), m_xregs(cache.m_xregs), m_emitter(cache.m_emitter),
m_is_temporary(true), m_is_merged(false)
m_is_temporary(true), m_is_merged(false), m_use_ctr(0)
{
}

Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/DSP/Jit/x64/DSPJitRegCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ class DSPJitRegCache
void MovToMemory(size_t reg);
void FlushMemBackedRegs();

std::array<DynamicReg, 37> m_regs;
std::array<X64CachedReg, 16> m_xregs;
std::array<DynamicReg, 37> m_regs = {};
std::array<X64CachedReg, 16> m_xregs = {};

DSPEmitter& m_emitter;
bool m_is_temporary;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Debugger/Debugger_SymbolMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Dolphin_Debugger
struct CallstackEntry
{
std::string Name;
u32 vAddress;
u32 vAddress = 0;
};

bool GetCallstack(std::vector<CallstackEntry>& output);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Debugger/Dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "Common/CommonTypes.h"
#include "Common/IOFile.h"

CDump::CDump(const std::string& filename) : m_pData(nullptr)
CDump::CDump(const std::string& filename) : m_size(0), m_pData(nullptr)
{
File::IOFile pStream(filename, "rb");
if (pStream)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Debugger/RSO.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class RSOHeaderView
u32 GetImportsNameTable() const;

private:
RSOHeader m_header;
RSOHeader m_header{};
std::string m_name;
u32 m_address = 0;
};
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/FifoPlayer/FifoAnalyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ struct CPMemory
{
TVtxDesc vtxDesc;
std::array<VAT, CP_NUM_VAT_REG> vtxAttr;
std::array<u32, CP_NUM_ARRAYS> arrayBases;
std::array<u32, CP_NUM_ARRAYS> arrayStrides;
std::array<u32, CP_NUM_ARRAYS> arrayBases{};
std::array<u32, CP_NUM_ARRAYS> arrayStrides{};
};

void LoadCPReg(u32 subCmd, u32 value, CPMemory& cpMem);
Expand Down
26 changes: 11 additions & 15 deletions Source/Core/Core/FifoPlayer/FifoDataFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ static_assert(sizeof(FileMemoryUpdate) == 24, "FileMemoryUpdate should be 24 byt

#pragma pack(pop)

FifoDataFile::FifoDataFile() = default;

FifoDataFile::~FifoDataFile() = default;

bool FifoDataFile::ShouldGenerateFakeVIUpdates() const
{
return true;
Expand Down Expand Up @@ -120,19 +116,19 @@ bool FifoDataFile::Save(const std::string& filename)
PadFile(m_Frames.size() * sizeof(FileFrameInfo), file);

u64 bpMemOffset = file.Tell();
file.WriteArray(m_BPMem, BP_MEM_SIZE);
file.WriteArray(m_BPMem);

u64 cpMemOffset = file.Tell();
file.WriteArray(m_CPMem, CP_MEM_SIZE);
file.WriteArray(m_CPMem);

u64 xfMemOffset = file.Tell();
file.WriteArray(m_XFMem, XF_MEM_SIZE);
file.WriteArray(m_XFMem);

u64 xfRegsOffset = file.Tell();
file.WriteArray(m_XFRegs, XF_REGS_SIZE);
file.WriteArray(m_XFRegs);

u64 texMemOffset = file.Tell();
file.WriteArray(m_TexMem, TEX_MEM_SIZE);
file.WriteArray(m_TexMem);

// Write header
FileHeader header;
Expand Down Expand Up @@ -285,27 +281,27 @@ std::unique_ptr<FifoDataFile> FifoDataFile::Load(const std::string& filename, bo

u32 size = std::min<u32>(BP_MEM_SIZE, header.bpMemSize);
file.Seek(header.bpMemOffset, SEEK_SET);
file.ReadArray(dataFile->m_BPMem, size);
file.ReadArray(dataFile->m_BPMem);

size = std::min<u32>(CP_MEM_SIZE, header.cpMemSize);
file.Seek(header.cpMemOffset, SEEK_SET);
file.ReadArray(dataFile->m_CPMem, size);
file.ReadArray(dataFile->m_CPMem);

size = std::min<u32>(XF_MEM_SIZE, header.xfMemSize);
file.Seek(header.xfMemOffset, SEEK_SET);
file.ReadArray(dataFile->m_XFMem, size);
file.ReadArray(dataFile->m_XFMem);

size = std::min<u32>(XF_REGS_SIZE, header.xfRegsSize);
file.Seek(header.xfRegsOffset, SEEK_SET);
file.ReadArray(dataFile->m_XFRegs, size);
file.ReadArray(dataFile->m_XFRegs);

// Texture memory saving was added in version 4.
std::memset(dataFile->m_TexMem, 0, TEX_MEM_SIZE);
dataFile->m_TexMem.fill(0);
if (dataFile->m_Version >= 4)
{
size = std::min<u32>(TEX_MEM_SIZE, header.texMemSize);
file.Seek(header.texMemOffset, SEEK_SET);
file.ReadArray(dataFile->m_TexMem, size);
file.ReadArray(dataFile->m_TexMem);
}

if (!file.IsGood())
Expand Down
39 changes: 20 additions & 19 deletions Source/Core/Core/FifoPlayer/FifoDataFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include <array>
#include <memory>
#include <string>
#include <vector>
Expand All @@ -25,18 +26,18 @@ struct MemoryUpdate
TMEM = 0x08,
};

u32 fifoPosition;
u32 address;
u32 fifoPosition = 0;
u32 address = 0;
std::vector<u8> data;
Type type;
Type type{};
};

struct FifoFrameInfo
{
std::vector<u8> fifoData;

u32 fifoStart;
u32 fifoEnd;
u32 fifoStart = 0;
u32 fifoEnd = 0;

// Must be sorted by fifoPosition
std::vector<MemoryUpdate> memoryUpdates;
Expand All @@ -55,19 +56,19 @@ class FifoDataFile
};
static_assert((XF_MEM_SIZE + XF_REGS_SIZE) * sizeof(u32) == sizeof(XFMemory));

FifoDataFile();
~FifoDataFile();
FifoDataFile() = default;
~FifoDataFile() = default;

void SetIsWii(bool isWii);
bool GetIsWii() const;
bool HasBrokenEFBCopies() const;
bool ShouldGenerateFakeVIUpdates() const;

u32* GetBPMem() { return m_BPMem; }
u32* GetCPMem() { return m_CPMem; }
u32* GetXFMem() { return m_XFMem; }
u32* GetXFRegs() { return m_XFRegs; }
u8* GetTexMem() { return m_TexMem; }
u32* GetBPMem() { return m_BPMem.data(); }
u32* GetCPMem() { return m_CPMem.data(); }
u32* GetXFMem() { return m_XFMem.data(); }
u32* GetXFRegs() { return m_XFRegs.data(); }
u8* GetTexMem() { return m_TexMem.data(); }
u32 GetRamSizeReal() { return m_ram_size_real; }
u32 GetExRamSizeReal() { return m_exram_size_real; }

Expand All @@ -93,13 +94,13 @@ class FifoDataFile
static void ReadMemoryUpdates(u64 fileOffset, u32 numUpdates,
std::vector<MemoryUpdate>& memUpdates, File::IOFile& file);

u32 m_BPMem[BP_MEM_SIZE];
u32 m_CPMem[CP_MEM_SIZE];
u32 m_XFMem[XF_MEM_SIZE];
u32 m_XFRegs[XF_REGS_SIZE];
u8 m_TexMem[TEX_MEM_SIZE];
u32 m_ram_size_real;
u32 m_exram_size_real;
std::array<u32, BP_MEM_SIZE> m_BPMem;
std::array<u32, CP_MEM_SIZE> m_CPMem;
std::array<u32, XF_MEM_SIZE> m_XFMem;
std::array<u32, XF_REGS_SIZE> m_XFRegs;
std::array<u8, TEX_MEM_SIZE> m_TexMem;
u32 m_ram_size_real = 0;
u32 m_exram_size_real = 0;

u32 m_Flags = 0;
u32 m_Version = 0;
Expand Down
Loading

0 comments on commit 83f34d3

Please sign in to comment.