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:
Lioncash 2020-05-01 09:53:42 -04:00
parent 147073a5a0
commit 10a32c94b6
2 changed files with 2 additions and 2 deletions

View File

@ -33,7 +33,7 @@ Loader::ResultStatus TitleMetadata::Load(const std::string& file_path) {
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);
if (total_size < sizeof(u32_be))
return Loader::ResultStatus::Error;

View File

@ -85,7 +85,7 @@ public:
#pragma pack(pop)
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);
u64 GetTitleID() const;