diff options
| author | 2018-07-18 20:24:33 -0400 | |
|---|---|---|
| committer | 2018-07-18 22:26:41 -0400 | |
| commit | 1831b5ef62da69f45f6e677898c6b7be10ded804 (patch) | |
| tree | 42589b86cd8db57ba8652fce28453c74ce3fb494 /src/core/loader/nso.cpp | |
| parent | loader/nso: Resolve sign mismatch warnings (diff) | |
| download | yuzu-1831b5ef62da69f45f6e677898c6b7be10ded804.tar.gz yuzu-1831b5ef62da69f45f6e677898c6b7be10ded804.tar.xz yuzu-1831b5ef62da69f45f6e677898c6b7be10ded804.zip | |
loader/nso: Remove unnecessary vector resizes
We can just initialize these vectors directly via their constructor.
Diffstat (limited to 'src/core/loader/nso.cpp')
| -rw-r--r-- | src/core/loader/nso.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 4ae9d55dd..f7752e0e3 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -66,8 +66,7 @@ FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& file) { | |||
| 66 | 66 | ||
| 67 | static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data, | 67 | static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data, |
| 68 | const NsoSegmentHeader& header) { | 68 | const NsoSegmentHeader& header) { |
| 69 | std::vector<u8> uncompressed_data; | 69 | std::vector<u8> uncompressed_data(header.size); |
| 70 | uncompressed_data.resize(header.size); | ||
| 71 | const int bytes_uncompressed = LZ4_decompress_safe( | 70 | const int bytes_uncompressed = LZ4_decompress_safe( |
| 72 | reinterpret_cast<const char*>(compressed_data.data()), | 71 | reinterpret_cast<const char*>(compressed_data.data()), |
| 73 | reinterpret_cast<char*>(uncompressed_data.data()), compressed_data.size(), header.size); | 72 | reinterpret_cast<char*>(uncompressed_data.data()), compressed_data.size(), header.size); |
| @@ -80,8 +79,7 @@ static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data, | |||
| 80 | 79 | ||
| 81 | static std::vector<u8> ReadSegment(FileUtil::IOFile& file, const NsoSegmentHeader& header, | 80 | static std::vector<u8> ReadSegment(FileUtil::IOFile& file, const NsoSegmentHeader& header, |
| 82 | size_t compressed_size) { | 81 | size_t compressed_size) { |
| 83 | std::vector<u8> compressed_data; | 82 | std::vector<u8> compressed_data(compressed_size); |
| 84 | compressed_data.resize(compressed_size); | ||
| 85 | 83 | ||
| 86 | file.Seek(header.offset, SEEK_SET); | 84 | file.Seek(header.offset, SEEK_SET); |
| 87 | if (compressed_size != file.ReadBytes(compressed_data.data(), compressed_size)) { | 85 | if (compressed_size != file.ReadBytes(compressed_data.data(), compressed_size)) { |