mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-30 10:42:47 +01:00
loader/nso: Remove unnecessary vector resizes
We can just initialize these vectors directly via their constructor.
This commit is contained in:
parent
e3a30ccc7c
commit
1831b5ef62
1 changed files with 2 additions and 4 deletions
|
@ -66,8 +66,7 @@ FileType AppLoader_NSO::IdentifyType(const FileSys::VirtualFile& file) {
|
||||||
|
|
||||||
static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data,
|
static std::vector<u8> DecompressSegment(const std::vector<u8>& compressed_data,
|
||||||
const NsoSegmentHeader& header) {
|
const NsoSegmentHeader& header) {
|
||||||
std::vector<u8> uncompressed_data;
|
std::vector<u8> uncompressed_data(header.size);
|
||||||
uncompressed_data.resize(header.size);
|
|
||||||
const int bytes_uncompressed = LZ4_decompress_safe(
|
const int bytes_uncompressed = LZ4_decompress_safe(
|
||||||
reinterpret_cast<const char*>(compressed_data.data()),
|
reinterpret_cast<const char*>(compressed_data.data()),
|
||||||
reinterpret_cast<char*>(uncompressed_data.data()), compressed_data.size(), header.size);
|
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,
|
||||||
|
|
||||||
static std::vector<u8> ReadSegment(FileUtil::IOFile& file, const NsoSegmentHeader& header,
|
static std::vector<u8> ReadSegment(FileUtil::IOFile& file, const NsoSegmentHeader& header,
|
||||||
size_t compressed_size) {
|
size_t compressed_size) {
|
||||||
std::vector<u8> compressed_data;
|
std::vector<u8> compressed_data(compressed_size);
|
||||||
compressed_data.resize(compressed_size);
|
|
||||||
|
|
||||||
file.Seek(header.offset, SEEK_SET);
|
file.Seek(header.offset, SEEK_SET);
|
||||||
if (compressed_size != file.ReadBytes(compressed_data.data(), compressed_size)) {
|
if (compressed_size != file.ReadBytes(compressed_data.data(), compressed_size)) {
|
||||||
|
|
Loading…
Reference in a new issue