mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-24 02:29:20 +01:00
title_metadata: Take std::vector by const reference in Load()
This isn't modified in the implementation, so this can be a const reference to eliminate an unnecessary heap reallocation.
This commit is contained in:
parent
147073a5a0
commit
10a32c94b6
@ -33,7 +33,7 @@ Loader::ResultStatus TitleMetadata::Load(const std::string& file_path) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader::ResultStatus TitleMetadata::Load(const std::vector<u8> file_data, std::size_t offset) {
|
Loader::ResultStatus TitleMetadata::Load(const std::vector<u8>& file_data, std::size_t offset) {
|
||||||
std::size_t total_size = static_cast<std::size_t>(file_data.size() - offset);
|
std::size_t total_size = static_cast<std::size_t>(file_data.size() - offset);
|
||||||
if (total_size < sizeof(u32_be))
|
if (total_size < sizeof(u32_be))
|
||||||
return Loader::ResultStatus::Error;
|
return Loader::ResultStatus::Error;
|
||||||
|
@ -85,7 +85,7 @@ public:
|
|||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
Loader::ResultStatus Load(const std::string& file_path);
|
Loader::ResultStatus Load(const std::string& file_path);
|
||||||
Loader::ResultStatus Load(const std::vector<u8> file_data, std::size_t offset = 0);
|
Loader::ResultStatus Load(const std::vector<u8>& file_data, std::size_t offset = 0);
|
||||||
Loader::ResultStatus Save(const std::string& file_path);
|
Loader::ResultStatus Save(const std::string& file_path);
|
||||||
|
|
||||||
u64 GetTitleID() const;
|
u64 GetTitleID() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user