Fix all uninitialized variable warnings (C26495)

This commit is contained in:
Pokechu22
2021-09-03 21:43:19 -07:00
parent 525e6b2194
commit 78bfd25964
111 changed files with 638 additions and 651 deletions

View File

@ -173,17 +173,17 @@ struct CompressThreadState
struct CompressParameters
{
std::vector<u8> data;
u32 block_number;
u64 inpos;
std::vector<u8> data{};
u32 block_number = 0;
u64 inpos = 0;
};
struct OutputParameters
{
std::vector<u8> data;
u32 block_number;
bool compressed;
u64 inpos;
std::vector<u8> data{};
u32 block_number = 0;
bool compressed = false;
u64 inpos = 0;
};
static ConversionResultCode SetUpCompressThreadState(CompressThreadState* state)

View File

@ -132,14 +132,14 @@ private:
std::vector<u8> m_apploader;
std::vector<u8> m_fst_data;
std::array<u8, VolumeWii::AES_KEY_SIZE> m_key;
std::array<u8, VolumeWii::AES_KEY_SIZE> m_key{};
std::string m_root_directory;
bool m_is_wii = false;
// GameCube has no shift, Wii has 2 bit shift
u32 m_address_shift = 0;
u64 m_data_size;
u64 m_data_size = 0;
};
class DirectoryBlobReader : public BlobReader

View File

@ -46,7 +46,7 @@ private:
bool ParsePartitionData(const Partition& partition);
void ParseFileSystemData(u64 partition_data_offset, const FileInfo& directory);
const Volume* m_disc;
const Volume* m_disc = nullptr;
std::vector<u8> m_free_table;
u64 m_file_size = 0;

View File

@ -43,7 +43,7 @@ private:
static constexpr size_t LFG_K = 521;
static constexpr size_t LFG_J = 32;
std::array<u32, LFG_K> m_buffer;
std::array<u32, LFG_K> m_buffer{};
size_t m_position_bytes = 0;
};

View File

@ -78,7 +78,7 @@ private:
struct PotentialMatch
{
u64 size;
u64 size = 0;
Hashes<std::vector<u8>> hashes;
};
@ -87,9 +87,9 @@ private:
std::vector<PotentialMatch> ScanDatfile(const std::vector<u8>& data, const std::string& system);
std::string m_game_id;
u16 m_revision;
u8 m_disc_number;
u64 m_size;
u16 m_revision = 0;
u8 m_disc_number = 0;
u64 m_size = 0;
std::future<std::vector<PotentialMatch>> m_future;
Result m_result;
@ -173,8 +173,8 @@ private:
Hashes<bool> m_hashes_to_calculate{};
bool m_calculating_any_hash = false;
unsigned long m_crc32_context = 0;
mbedtls_md5_context m_md5_context;
mbedtls_sha1_context m_sha1_context;
mbedtls_md5_context m_md5_context{};
mbedtls_sha1_context m_sha1_context{};
u64 m_excess_bytes = 0;
std::vector<u8> m_data;

View File

@ -122,7 +122,7 @@ private:
Common::Lazy<std::vector<u8>> h3_table;
Common::Lazy<std::unique_ptr<FileSystem>> file_system;
Common::Lazy<u64> data_offset;
u32 type;
u32 type = 0;
};
std::unique_ptr<BlobReader> m_reader;
@ -131,7 +131,7 @@ private:
bool m_encrypted;
mutable u64 m_last_decrypted_block;
mutable u8 m_last_decrypted_block_data[BLOCK_DATA_SIZE];
mutable u8 m_last_decrypted_block_data[BLOCK_DATA_SIZE]{};
};
} // namespace DiscIO

View File

@ -168,7 +168,10 @@ private:
bool is_partition;
u8 partition_data_index;
DataEntry(size_t index_) : index(static_cast<u32>(index_)), is_partition(false) {}
DataEntry(size_t index_)
: index(static_cast<u32>(index_)), is_partition(false), partition_data_index(0)
{
}
DataEntry(size_t index_, size_t partition_data_index_)
: index(static_cast<u32>(index_)), is_partition(true),
partition_data_index(static_cast<u8>(partition_data_index_))
@ -281,11 +284,11 @@ private:
struct CompressParameters
{
std::vector<u8> data;
const DataEntry* data_entry;
u64 data_offset;
u64 bytes_read;
size_t group_index;
std::vector<u8> data{};
const DataEntry* data_entry = nullptr;
u64 data_offset = 0;
u64 bytes_read = 0;
size_t group_index = 0;
};
struct WIAOutputParametersEntry
@ -312,8 +315,8 @@ private:
struct OutputParameters
{
std::vector<OutputParametersEntry> entries;
u64 bytes_read;
size_t group_index;
u64 bytes_read = 0;
size_t group_index = 0;
};
static bool PadTo4(File::IOFile* file, u64* bytes_written);

View File

@ -141,7 +141,7 @@ private:
u32 m_rvz_packed_size;
u32 m_size = 0;
bool m_junk;
bool m_junk = false;
LaggedFibonacciGenerator m_lfg;
};
@ -178,7 +178,7 @@ public:
private:
std::vector<u8> m_buffer;
size_t m_bytes_written;
size_t m_bytes_written = 0;
mbedtls_sha1_context m_sha1_context;
};
@ -244,7 +244,7 @@ private:
void ExpandBuffer(size_t bytes_to_add);
ZSTD_CStream* m_stream;
ZSTD_outBuffer m_out_buffer;
ZSTD_outBuffer m_out_buffer{};
std::vector<u8> m_buffer;
};

View File

@ -50,7 +50,7 @@ public:
private:
BlobReader* m_blob;
std::unique_ptr<std::array<u8, VolumeWii::GROUP_TOTAL_SIZE>> m_cache;
u64 m_cached_offset;
u64 m_cached_offset = 0;
};
} // namespace DiscIO