From a25c5b982a4406851ee1de18f09061a30d078b5b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 19 Jul 2018 20:49:27 -0400 Subject: [PATCH 1/2] nso: Remove unused function ReadSegment() --- src/core/loader/nso.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index c66561bf4..b25810e07 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp @@ -79,19 +79,6 @@ static std::vector DecompressSegment(const std::vector& compressed_data, return uncompressed_data; } -static std::vector ReadSegment(FileUtil::IOFile& file, const NsoSegmentHeader& header, - size_t compressed_size) { - std::vector 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; } From 364b950515c37f56809697d36212ea8ceb676c6c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 19 Jul 2018 20:51:15 -0400 Subject: [PATCH 2/2] nso: Silence implicit sign conversion warnings --- src/core/loader/nso.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index b25810e07..06b1b33f4 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp @@ -69,11 +69,13 @@ FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& file) { static std::vector DecompressSegment(const std::vector& compressed_data, const NsoSegmentHeader& header) { std::vector uncompressed_data(header.size); - const int bytes_uncompressed = LZ4_decompress_safe( - reinterpret_cast(compressed_data.data()), - reinterpret_cast(uncompressed_data.data()), compressed_data.size(), header.size); + const int bytes_uncompressed = + LZ4_decompress_safe(reinterpret_cast(compressed_data.data()), + reinterpret_cast(uncompressed_data.data()), + static_cast(compressed_data.size()), header.size); - ASSERT_MSG(bytes_uncompressed == header.size && bytes_uncompressed == uncompressed_data.size(), + ASSERT_MSG(bytes_uncompressed == static_cast(header.size) && + bytes_uncompressed == static_cast(uncompressed_data.size()), "{} != {} != {}", bytes_uncompressed, header.size, uncompressed_data.size()); return uncompressed_data;