diff options
| author | Léo Lam <leo@leolam.fr> | 2021-10-13 21:52:22 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-13 21:52:22 +0200 |
| commit | 023eb0b7029eb3633ce9eeb039c11d835ea7fd74 (patch) | |
| tree | 93aeabec56ac75e8d88baeb6f78e27840d09dead /Source/Core/DiscIO | |
| parent | a0a91ec4b86b16624b2da7000a0f54852cd33872 (diff) | |
| parent | 78bfd25964206a1f0a34170fdd90ca1a8ce242db (diff) | |
Merge pull request #10085 from Pokechu22/C26495
Fix all uninitialized variable warnings (C26495)
Diffstat (limited to 'Source/Core/DiscIO')
| -rw-r--r-- | Source/Core/DiscIO/CompressedBlob.cpp | 14 | ||||
| -rw-r--r-- | Source/Core/DiscIO/DirectoryBlob.h | 4 | ||||
| -rw-r--r-- | Source/Core/DiscIO/DiscScrubber.h | 2 | ||||
| -rw-r--r-- | Source/Core/DiscIO/LaggedFibonacciGenerator.h | 2 | ||||
| -rw-r--r-- | Source/Core/DiscIO/VolumeVerifier.h | 12 | ||||
| -rw-r--r-- | Source/Core/DiscIO/VolumeWii.h | 4 | ||||
| -rw-r--r-- | Source/Core/DiscIO/WIABlob.h | 19 | ||||
| -rw-r--r-- | Source/Core/DiscIO/WIACompression.h | 6 | ||||
| -rw-r--r-- | Source/Core/DiscIO/WiiEncryptionCache.h | 2 |
9 files changed, 34 insertions, 31 deletions
diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp index c39dbc64bf..70d123ccf3 100644 --- a/Source/Core/DiscIO/CompressedBlob.cpp +++ b/Source/Core/DiscIO/CompressedBlob.cpp @@ -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) diff --git a/Source/Core/DiscIO/DirectoryBlob.h b/Source/Core/DiscIO/DirectoryBlob.h index 1ec5372fa4..e4eb1b3cd3 100644 --- a/Source/Core/DiscIO/DirectoryBlob.h +++ b/Source/Core/DiscIO/DirectoryBlob.h @@ -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 diff --git a/Source/Core/DiscIO/DiscScrubber.h b/Source/Core/DiscIO/DiscScrubber.h index 35135bea61..72d50bf402 100644 --- a/Source/Core/DiscIO/DiscScrubber.h +++ b/Source/Core/DiscIO/DiscScrubber.h @@ -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; diff --git a/Source/Core/DiscIO/LaggedFibonacciGenerator.h b/Source/Core/DiscIO/LaggedFibonacciGenerator.h index d4b3a51cc4..2eace618aa 100644 --- a/Source/Core/DiscIO/LaggedFibonacciGenerator.h +++ b/Source/Core/DiscIO/LaggedFibonacciGenerator.h @@ -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; }; diff --git a/Source/Core/DiscIO/VolumeVerifier.h b/Source/Core/DiscIO/VolumeVerifier.h index a6fea8f76b..6e573880ac 100644 --- a/Source/Core/DiscIO/VolumeVerifier.h +++ b/Source/Core/DiscIO/VolumeVerifier.h @@ -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; diff --git a/Source/Core/DiscIO/VolumeWii.h b/Source/Core/DiscIO/VolumeWii.h index 1e89e63e92..f2dea1b016 100644 --- a/Source/Core/DiscIO/VolumeWii.h +++ b/Source/Core/DiscIO/VolumeWii.h @@ -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 diff --git a/Source/Core/DiscIO/WIABlob.h b/Source/Core/DiscIO/WIABlob.h index 88db70a210..d13476762b 100644 --- a/Source/Core/DiscIO/WIABlob.h +++ b/Source/Core/DiscIO/WIABlob.h @@ -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); diff --git a/Source/Core/DiscIO/WIACompression.h b/Source/Core/DiscIO/WIACompression.h index df5e9dacba..fdabedbed0 100644 --- a/Source/Core/DiscIO/WIACompression.h +++ b/Source/Core/DiscIO/WIACompression.h @@ -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; }; diff --git a/Source/Core/DiscIO/WiiEncryptionCache.h b/Source/Core/DiscIO/WiiEncryptionCache.h index 629daff2bb..3516d3b538 100644 --- a/Source/Core/DiscIO/WiiEncryptionCache.h +++ b/Source/Core/DiscIO/WiiEncryptionCache.h @@ -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 |
