summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-20 09:14:10 -0700
committerGitHub <noreply@github.com>2018-07-20 09:14:10 -0700
commit86d1649b32f636bb91a3333843c45d4decd5a164 (patch)
tree24b855b62c595af879812f8febaac6f4234ac59d /src
parent204d707ce74f27b29dc5a8de8bec11b3578b8e4e (diff)
parent364b950515c37f56809697d36212ea8ceb676c6c (diff)
Merge pull request #732 from lioncash/unused
nso: Minor changes
Diffstat (limited to 'src')
-rw-r--r--src/core/loader/nso.cpp23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index c66561bf4..06b1b33f4 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -69,29 +69,18 @@ FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& file) {
static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data,
const NsoSegmentHeader& header) {
std::vector<u8> uncompressed_data(header.size);
- const int bytes_uncompressed = LZ4_decompress_safe(
- reinterpret_cast<const char*>(compressed_data.data()),
- reinterpret_cast<char*>(uncompressed_data.data()), compressed_data.size(), header.size);
+ const int bytes_uncompressed =
+ LZ4_decompress_safe(reinterpret_cast<const char*>(compressed_data.data()),
+ reinterpret_cast<char*>(uncompressed_data.data()),
+ static_cast<int>(compressed_data.size()), header.size);
- ASSERT_MSG(bytes_uncompressed == header.size && bytes_uncompressed == uncompressed_data.size(),
+ ASSERT_MSG(bytes_uncompressed == static_cast<int>(header.size) &&
+ bytes_uncompressed == static_cast<int>(uncompressed_data.size()),
"{} != {} != {}", bytes_uncompressed, header.size, uncompressed_data.size());
return uncompressed_data;
}
-static std::vector<u8> ReadSegment(FileUtil::IOFile& file, const NsoSegmentHeader& header,
- size_t compressed_size) {
- std::vector<u8> compressed_data(compressed_size);
-
- file.Seek(header.offset, SEEK_SET);
- if (compressed_size != file.ReadBytes(compressed_data.data(), compressed_size)) {
- LOG_CRITICAL(Loader, "Failed to read {} NSO LZ4 compressed bytes", compressed_size);
- return {};
- }
-
- return DecompressSegment(compressed_data, header);
-}
-
static constexpr u32 PageAlignSize(u32 size) {
return (size + Memory::PAGE_MASK) & ~Memory::PAGE_MASK;
}