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/Common | |
| parent | a0a91ec4b86b16624b2da7000a0f54852cd33872 (diff) | |
| parent | 78bfd25964206a1f0a34170fdd90ca1a8ce242db (diff) | |
Merge pull request #10085 from Pokechu22/C26495
Fix all uninitialized variable warnings (C26495)
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/Config/ConfigInfo.h | 2 | ||||
| -rw-r--r-- | Source/Core/Common/FileUtil.h | 6 | ||||
| -rw-r--r-- | Source/Core/Common/FixedSizeQueue.h | 2 | ||||
| -rw-r--r-- | Source/Core/Common/IOFile.h | 13 | ||||
| -rw-r--r-- | Source/Core/Common/LinearDiskCache.h | 4 | ||||
| -rw-r--r-- | Source/Core/Common/Logging/ConsoleListener.h | 2 | ||||
| -rw-r--r-- | Source/Core/Common/SPSCQueue.h | 2 |
7 files changed, 22 insertions, 9 deletions
diff --git a/Source/Core/Common/Config/ConfigInfo.h b/Source/Core/Common/Config/ConfigInfo.h index 824947cfb6..e59239b881 100644 --- a/Source/Core/Common/Config/ConfigInfo.h +++ b/Source/Core/Common/Config/ConfigInfo.h @@ -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; diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h index e2021bdab4..9c1116943c 100644 --- a/Source/Core/Common/FileUtil.h +++ b/Source/Core/Common/FileUtil.h @@ -85,11 +85,11 @@ enum namespace File { -// FileSystem tree node/ +// FileSystem tree node struct FSTEntry { - bool isDirectory; - u64 size; // File length, or for directories, recursive count of children + bool isDirectory = false; + u64 size = 0; // 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; diff --git a/Source/Core/Common/FixedSizeQueue.h b/Source/Core/Common/FixedSizeQueue.h index a303cce4cd..dc58aab865 100644 --- a/Source/Core/Common/FixedSizeQueue.h +++ b/Source/Core/Common/FixedSizeQueue.h @@ -78,7 +78,7 @@ public: 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. diff --git a/Source/Core/Common/IOFile.h b/Source/Core/Common/IOFile.h index 27285ce0df..873c4c2af5 100644 --- a/Source/Core/Common/IOFile.h +++ b/Source/Core/Common/IOFile.h @@ -3,6 +3,7 @@ #pragma once +#include <array> #include <cstddef> #include <cstdio> #include <string> @@ -57,6 +58,18 @@ public: return m_good; } + template <typename T, std::size_t N> + bool ReadArray(std::array<T, N>* elements, size_t* num_read = nullptr) + { + return ReadArray(elements->data(), elements->size(), num_read); + } + + template <typename T, std::size_t N> + bool WriteArray(const std::array<T, N>& elements) + { + return WriteArray(elements.data(), elements.size()); + } + bool ReadBytes(void* data, size_t length) { return ReadArray(reinterpret_cast<char*>(data), length); diff --git a/Source/Core/Common/LinearDiskCache.h b/Source/Core/Common/LinearDiskCache.h index e6a1b29557..5f9f7589d4 100644 --- a/Source/Core/Common/LinearDiskCache.h +++ b/Source/Core/Common/LinearDiskCache.h @@ -153,7 +153,7 @@ private: 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] = {}; @@ -161,5 +161,5 @@ private: } m_header; File::IOFile m_file; - u32 m_num_entries; + u32 m_num_entries = 0; }; diff --git a/Source/Core/Common/Logging/ConsoleListener.h b/Source/Core/Common/Logging/ConsoleListener.h index cd1984af6d..7310204377 100644 --- a/Source/Core/Common/Logging/ConsoleListener.h +++ b/Source/Core/Common/Logging/ConsoleListener.h @@ -14,5 +14,5 @@ public: void Log(Common::Log::LOG_LEVELS level, const char* text) override; private: - bool m_use_color; + bool m_use_color = false; }; diff --git a/Source/Core/Common/SPSCQueue.h b/Source/Core/Common/SPSCQueue.h index 96f5b90eeb..27a0a8f282 100644 --- a/Source/Core/Common/SPSCQueue.h +++ b/Source/Core/Common/SPSCQueue.h @@ -98,7 +98,7 @@ private: delete next_ptr; } - T current; + T current{}; std::atomic<ElementPtr*> next; }; |
