From 9a07ed53ebe4e27ef1a14e0469037cab9fb7b1e7 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 16 May 2021 01:46:30 -0400 Subject: core: Make variable shadowing a compile-time error Now that we have most of core free of shadowing, we can enable the warning as an error to catch anything that may be remaining and also eliminate this class of logic bug entirely. --- src/core/crypto/ctr_encryption_layer.cpp | 4 ++-- src/core/crypto/ctr_encryption_layer.h | 2 +- src/core/crypto/key_manager.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core/crypto') diff --git a/src/core/crypto/ctr_encryption_layer.cpp b/src/core/crypto/ctr_encryption_layer.cpp index 5c84bb0a4..1231da8e3 100644 --- a/src/core/crypto/ctr_encryption_layer.cpp +++ b/src/core/crypto/ctr_encryption_layer.cpp @@ -10,8 +10,8 @@ namespace Core::Crypto { CTREncryptionLayer::CTREncryptionLayer(FileSys::VirtualFile base_, Key128 key_, - std::size_t base_offset) - : EncryptionLayer(std::move(base_)), base_offset(base_offset), cipher(key_, Mode::CTR) {} + std::size_t base_offset_) + : EncryptionLayer(std::move(base_)), base_offset(base_offset_), cipher(key_, Mode::CTR) {} std::size_t CTREncryptionLayer::Read(u8* data, std::size_t length, std::size_t offset) const { if (length == 0) diff --git a/src/core/crypto/ctr_encryption_layer.h b/src/core/crypto/ctr_encryption_layer.h index a2429f001..f86f01b6f 100644 --- a/src/core/crypto/ctr_encryption_layer.h +++ b/src/core/crypto/ctr_encryption_layer.h @@ -17,7 +17,7 @@ class CTREncryptionLayer : public EncryptionLayer { public: using IVData = std::array; - CTREncryptionLayer(FileSys::VirtualFile base, Key128 key, std::size_t base_offset); + CTREncryptionLayer(FileSys::VirtualFile base_, Key128 key_, std::size_t base_offset_); std::size_t Read(u8* data, std::size_t length, std::size_t offset) const override; diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index 070ed439e..a4b739c63 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp @@ -458,7 +458,7 @@ static std::array operator^(const std::array& lhs, const std::array& rhs) { std::array out; std::transform(lhs.begin(), lhs.end(), rhs.begin(), out.begin(), - [](u8 lhs, u8 rhs) { return u8(lhs ^ rhs); }); + [](u8 lhs_elem, u8 rhs_elem) { return u8(lhs_elem ^ rhs_elem); }); return out; } -- cgit v1.2.3