summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/nca_patch.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2020-10-15 20:49:45 +0200
committerLioncash <mathew1800@gmail.com>2020-10-18 01:50:39 +0200
commitbe1954e04cb5a0c3a526f78ed5490a5e65310280 (patch)
tree267db7ae4be88dbbc288fa605e35d4a2a13839f6 /src/core/file_sys/nca_patch.cpp
parentMerge pull request #4787 from lioncash/conversion (diff)
downloadyuzu-be1954e04cb5a0c3a526f78ed5490a5e65310280.tar
yuzu-be1954e04cb5a0c3a526f78ed5490a5e65310280.tar.gz
yuzu-be1954e04cb5a0c3a526f78ed5490a5e65310280.tar.bz2
yuzu-be1954e04cb5a0c3a526f78ed5490a5e65310280.tar.lz
yuzu-be1954e04cb5a0c3a526f78ed5490a5e65310280.tar.xz
yuzu-be1954e04cb5a0c3a526f78ed5490a5e65310280.tar.zst
yuzu-be1954e04cb5a0c3a526f78ed5490a5e65310280.zip
Diffstat (limited to 'src/core/file_sys/nca_patch.cpp')
-rw-r--r--src/core/file_sys/nca_patch.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/file_sys/nca_patch.cpp b/src/core/file_sys/nca_patch.cpp
index 5990a2fd5..6d3472447 100644
--- a/src/core/file_sys/nca_patch.cpp
+++ b/src/core/file_sys/nca_patch.cpp
@@ -25,9 +25,9 @@ std::pair<std::size_t, std::size_t> SearchBucketEntry(u64 offset, const BlockTyp
ASSERT_MSG(offset <= block.size, "Offset is out of bounds in BKTR relocation block.");
}
- std::size_t bucket_id = std::count_if(
+ const auto bucket_id = static_cast<std::size_t>(std::count_if(
block.base_offsets.begin() + 1, block.base_offsets.begin() + block.number_buckets,
- [&offset](u64 base_offset) { return base_offset <= offset; });
+ [&offset](u64 base_offset) { return base_offset <= offset; }));
const auto& bucket = buckets[bucket_id];
@@ -53,6 +53,7 @@ std::pair<std::size_t, std::size_t> SearchBucketEntry(u64 offset, const BlockTyp
}
UNREACHABLE_MSG("Offset could not be found in BKTR block.");
+ return {};
}
} // Anonymous namespace
@@ -136,7 +137,7 @@ std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const {
const auto block_offset = section_offset & 0xF;
if (block_offset != 0) {
- auto block = bktr_romfs->ReadBytes(0x10, section_offset & ~0xF);
+ auto block = bktr_romfs->ReadBytes(0x10, section_offset & ~0xFU);
cipher.Transcode(block.data(), block.size(), block.data(), Core::Crypto::Op::Decrypt);
if (length + block_offset < 0x10) {
std::memcpy(data, block.data() + block_offset, std::min(length, block.size()));