CFactoryMgr: Resolve variable shadowing warning in MakeObjectFromMemory()

Resolvable with a trivial variable renaming.
This commit is contained in:
Lioncash 2020-03-09 12:19:55 -04:00
parent 91a2562fff
commit 0a158af0cb
1 changed files with 10 additions and 9 deletions

View File

@ -37,30 +37,31 @@ CFactoryFnReturn CFactoryMgr::MakeObjectFromMemory(const SObjectTag& tag, std::u
CObjectReference* selfRef) { CObjectReference* selfRef) {
std::unique_ptr<u8[]> localBuf = std::move(buf); std::unique_ptr<u8[]> localBuf = std::move(buf);
auto search = m_memFactories.find(tag.type); const auto memFactoryIter = m_memFactories.find(tag.type);
if (search != m_memFactories.cend()) { if (memFactoryIter != m_memFactories.cend()) {
if (compressed) { if (compressed) {
std::unique_ptr<CInputStream> compRead = std::make_unique<athena::io::MemoryReader>(localBuf.get(), size); std::unique_ptr<CInputStream> compRead = std::make_unique<athena::io::MemoryReader>(localBuf.get(), size);
u32 decompLen = compRead->readUint32Big(); const u32 decompLen = compRead->readUint32Big();
CZipInputStream r(std::move(compRead)); CZipInputStream r(std::move(compRead));
std::unique_ptr<u8[]> decompBuf = r.readUBytes(decompLen); std::unique_ptr<u8[]> decompBuf = r.readUBytes(decompLen);
return search->second(tag, std::move(decompBuf), decompLen, paramXfer, selfRef); return memFactoryIter->second(tag, std::move(decompBuf), decompLen, paramXfer, selfRef);
} else { } else {
return search->second(tag, std::move(localBuf), size, paramXfer, selfRef); return memFactoryIter->second(tag, std::move(localBuf), size, paramXfer, selfRef);
} }
} else { } else {
auto search = m_factories.find(tag.type); const auto factoryIter = m_factories.find(tag.type);
if (search == m_factories.end()) if (factoryIter == m_factories.end()) {
return {}; return {};
}
if (compressed) { if (compressed) {
std::unique_ptr<CInputStream> compRead = std::make_unique<athena::io::MemoryReader>(localBuf.get(), size); std::unique_ptr<CInputStream> compRead = std::make_unique<athena::io::MemoryReader>(localBuf.get(), size);
compRead->readUint32Big(); compRead->readUint32Big();
CZipInputStream r(std::move(compRead)); CZipInputStream r(std::move(compRead));
return search->second(tag, r, paramXfer, selfRef); return factoryIter->second(tag, r, paramXfer, selfRef);
} else { } else {
CMemoryInStream r(localBuf.get(), size); CMemoryInStream r(localBuf.get(), size);
return search->second(tag, r, paramXfer, selfRef); return factoryIter->second(tag, r, paramXfer, selfRef);
} }
} }
} }