diff options
author | Lioncash <[email protected]> | 2021-05-16 01:46:30 -0400 |
---|---|---|
committer | Lioncash <[email protected]> | 2021-05-16 03:43:16 -0400 |
commit | 9a07ed53ebe4e27ef1a14e0469037cab9fb7b1e7 (patch) | |
tree | 54d6c5a6b319a10522b068caf2b0600c8f27876a /src/core/loader | |
parent | 06c410ee882885e67260b963c3b86f4cf3c7de98 (diff) | |
download | yuzu-android-9a07ed53ebe4e27ef1a14e0469037cab9fb7b1e7.tar.gz yuzu-android-9a07ed53ebe4e27ef1a14e0469037cab9fb7b1e7.zip |
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.
Diffstat (limited to 'src/core/loader')
-rw-r--r-- | src/core/loader/deconstructed_rom_directory.cpp | 23 | ||||
-rw-r--r-- | src/core/loader/deconstructed_rom_directory.h | 4 | ||||
-rw-r--r-- | src/core/loader/loader.cpp | 2 | ||||
-rw-r--r-- | src/core/loader/loader.h | 2 |
4 files changed, 15 insertions, 16 deletions
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp index 42f023258..022885c1b 100644 --- a/src/core/loader/deconstructed_rom_directory.cpp +++ b/src/core/loader/deconstructed_rom_directory.cpp @@ -22,8 +22,8 @@ namespace Loader { AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile file_, - bool override_update) - : AppLoader(std::move(file_)), override_update(override_update) { + bool override_update_) + : AppLoader(std::move(file_)), override_update(override_update_) { const auto file_dir = file->GetContainingDirectory(); // Title ID @@ -48,9 +48,9 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys // Any png, jpeg, or bmp file const auto& files = file_dir->GetFiles(); const auto icon_iter = - std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& file) { - return file->GetExtension() == "png" || file->GetExtension() == "jpg" || - file->GetExtension() == "bmp" || file->GetExtension() == "jpeg"; + std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& f) { + return f->GetExtension() == "png" || f->GetExtension() == "jpg" || + f->GetExtension() == "bmp" || f->GetExtension() == "jpeg"; }); if (icon_iter != files.end()) icon_data = (*icon_iter)->ReadAllBytes(); @@ -61,9 +61,8 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys if (nacp_file == nullptr) { const auto& files = file_dir->GetFiles(); const auto nacp_iter = - std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& file) { - return file->GetExtension() == "nacp"; - }); + std::find_if(files.begin(), files.end(), + [](const FileSys::VirtualFile& f) { return f->GetExtension() == "nacp"; }); if (nacp_iter != files.end()) nacp_file = *nacp_iter; } @@ -75,9 +74,9 @@ AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory(FileSys } AppLoader_DeconstructedRomDirectory::AppLoader_DeconstructedRomDirectory( - FileSys::VirtualDir directory, bool override_update) + FileSys::VirtualDir directory, bool override_update_) : AppLoader(directory->GetFile("main")), dir(std::move(directory)), - override_update(override_update) {} + override_update(override_update_) {} FileType AppLoader_DeconstructedRomDirectory::IdentifyType(const FileSys::VirtualFile& dir_file) { if (FileSys::IsDirectoryExeFS(dir_file->GetContainingDirectory())) { @@ -184,8 +183,8 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect // Find the RomFS by searching for a ".romfs" file in this directory const auto& files = dir->GetFiles(); const auto romfs_iter = - std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& file) { - return file->GetName().find(".romfs") != std::string::npos; + std::find_if(files.begin(), files.end(), [](const FileSys::VirtualFile& f) { + return f->GetName().find(".romfs") != std::string::npos; }); // Register the RomFS if a ".romfs" file was found diff --git a/src/core/loader/deconstructed_rom_directory.h b/src/core/loader/deconstructed_rom_directory.h index a49a8b001..79a4d4db5 100644 --- a/src/core/loader/deconstructed_rom_directory.h +++ b/src/core/loader/deconstructed_rom_directory.h @@ -24,11 +24,11 @@ namespace Loader { class AppLoader_DeconstructedRomDirectory final : public AppLoader { public: explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualFile main_file, - bool override_update = false); + bool override_update_ = false); // Overload to accept exefs directory. Must contain 'main' and 'main.npdm' explicit AppLoader_DeconstructedRomDirectory(FileSys::VirtualDir directory, - bool override_update = false); + bool override_update_ = false); /** * Identifies whether or not the given file is a deconstructed ROM directory. diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index 11b2d0837..d4808fb5b 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp @@ -194,7 +194,7 @@ std::ostream& operator<<(std::ostream& os, ResultStatus status) { return os; } -AppLoader::AppLoader(FileSys::VirtualFile file) : file(std::move(file)) {} +AppLoader::AppLoader(FileSys::VirtualFile file_) : file(std::move(file_)) {} AppLoader::~AppLoader() = default; /** diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 9eac11dec..edc8bb257 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h @@ -147,7 +147,7 @@ public: }; using LoadResult = std::pair<ResultStatus, std::optional<LoadParameters>>; - explicit AppLoader(FileSys::VirtualFile file); + explicit AppLoader(FileSys::VirtualFile file_); virtual ~AppLoader(); /** |