registered_cache: Resolve -Wmaybe_uninitialized warnings
While we're at it, we can avoid a redundant map lookup.
This commit is contained in:
parent
05781ce8c4
commit
4ca0014479
|
@ -344,15 +344,18 @@ VirtualFile RegisteredCache::GetFileAtID(NcaID id) const {
|
||||||
|
|
||||||
static std::optional<NcaID> CheckMapForContentRecord(const std::map<u64, CNMT>& map, u64 title_id,
|
static std::optional<NcaID> CheckMapForContentRecord(const std::map<u64, CNMT>& map, u64 title_id,
|
||||||
ContentRecordType type) {
|
ContentRecordType type) {
|
||||||
if (map.find(title_id) == map.end())
|
const auto cmnt_iter = map.find(title_id);
|
||||||
return {};
|
if (cmnt_iter == map.cend()) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
const auto& cnmt = map.at(title_id);
|
const auto& cnmt = cmnt_iter->second;
|
||||||
|
const auto& content_records = cnmt.GetContentRecords();
|
||||||
const auto iter = std::find_if(cnmt.GetContentRecords().begin(), cnmt.GetContentRecords().end(),
|
const auto iter = std::find_if(content_records.cbegin(), content_records.cend(),
|
||||||
[type](const ContentRecord& rec) { return rec.type == type; });
|
[type](const ContentRecord& rec) { return rec.type == type; });
|
||||||
if (iter == cnmt.GetContentRecords().end())
|
if (iter == content_records.cend()) {
|
||||||
return {};
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
return std::make_optional(iter->nca_id);
|
return std::make_optional(iter->nca_id);
|
||||||
}
|
}
|
||||||
|
@ -467,14 +470,16 @@ VirtualFile RegisteredCache::GetEntryUnparsed(u64 title_id, ContentRecordType ty
|
||||||
|
|
||||||
std::optional<u32> RegisteredCache::GetEntryVersion(u64 title_id) const {
|
std::optional<u32> RegisteredCache::GetEntryVersion(u64 title_id) const {
|
||||||
const auto meta_iter = meta.find(title_id);
|
const auto meta_iter = meta.find(title_id);
|
||||||
if (meta_iter != meta.end())
|
if (meta_iter != meta.cend()) {
|
||||||
return meta_iter->second.GetTitleVersion();
|
return meta_iter->second.GetTitleVersion();
|
||||||
|
}
|
||||||
|
|
||||||
const auto yuzu_meta_iter = yuzu_meta.find(title_id);
|
const auto yuzu_meta_iter = yuzu_meta.find(title_id);
|
||||||
if (yuzu_meta_iter != yuzu_meta.end())
|
if (yuzu_meta_iter != yuzu_meta.cend()) {
|
||||||
return yuzu_meta_iter->second.GetTitleVersion();
|
return yuzu_meta_iter->second.GetTitleVersion();
|
||||||
|
}
|
||||||
|
|
||||||
return {};
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
VirtualFile RegisteredCache::GetEntryRaw(u64 title_id, ContentRecordType type) const {
|
VirtualFile RegisteredCache::GetEntryRaw(u64 title_id, ContentRecordType type) const {
|
||||||
|
|
Reference in New Issue