From 724c19a307f31ce1122fb8047c86d5a126d0860f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 27 Apr 2021 12:05:34 -0400 Subject: loader: Resolve instances of variable shadowing Eliminates variable shadowing cases across all the loaders to bring us closer to enabling variable shadowing as an error in core. --- src/core/loader/nro.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/core/loader/nro.cpp') diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 0115ed0c4..0597cfa60 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp @@ -72,7 +72,7 @@ struct AssetHeader { }; static_assert(sizeof(AssetHeader) == 0x38, "AssetHeader has incorrect size."); -AppLoader_NRO::AppLoader_NRO(FileSys::VirtualFile file) : AppLoader(file) { +AppLoader_NRO::AppLoader_NRO(FileSys::VirtualFile file_) : AppLoader(std::move(file_)) { NroHeader nro_header{}; if (file->ReadObject(&nro_header) != sizeof(NroHeader)) { return; @@ -114,10 +114,10 @@ AppLoader_NRO::AppLoader_NRO(FileSys::VirtualFile file) : AppLoader(file) { AppLoader_NRO::~AppLoader_NRO() = default; -FileType AppLoader_NRO::IdentifyType(const FileSys::VirtualFile& file) { +FileType AppLoader_NRO::IdentifyType(const FileSys::VirtualFile& nro_file) { // Read NSO header NroHeader nro_header{}; - if (sizeof(NroHeader) != file->ReadObject(&nro_header)) { + if (sizeof(NroHeader) != nro_file->ReadObject(&nro_header)) { return FileType::Error; } if (nro_header.magic == Common::MakeMagic('N', 'R', 'O', '0')) { @@ -130,8 +130,7 @@ static constexpr u32 PageAlignSize(u32 size) { return static_cast((size + Core::Memory::PAGE_MASK) & ~Core::Memory::PAGE_MASK); } -static bool LoadNroImpl(Kernel::Process& process, const std::vector& data, - const std::string& name) { +static bool LoadNroImpl(Kernel::Process& process, const std::vector& data) { if (data.size() < sizeof(NroHeader)) { return {}; } @@ -200,8 +199,8 @@ static bool LoadNroImpl(Kernel::Process& process, const std::vector& data, return true; } -bool AppLoader_NRO::LoadNro(Kernel::Process& process, const FileSys::VfsFile& file) { - return LoadNroImpl(process, file.ReadAllBytes(), file.GetName()); +bool AppLoader_NRO::LoadNro(Kernel::Process& process, const FileSys::VfsFile& nro_file) { + return LoadNroImpl(process, nro_file.ReadAllBytes()); } AppLoader_NRO::LoadResult AppLoader_NRO::Load(Kernel::Process& process, Core::System& system) { -- cgit v1.2.3