From 10a32c94b60087a2ae9d2c56759f2869d81ac9d9 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 1 May 2020 09:53:42 -0400 Subject: [PATCH] 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. --- src/core/file_sys/title_metadata.cpp | 2 +- src/core/file_sys/title_metadata.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/file_sys/title_metadata.cpp b/src/core/file_sys/title_metadata.cpp index 031b28b148..96bd3f0e69 100644 --- a/src/core/file_sys/title_metadata.cpp +++ b/src/core/file_sys/title_metadata.cpp @@ -33,7 +33,7 @@ Loader::ResultStatus TitleMetadata::Load(const std::string& file_path) { return result; } -Loader::ResultStatus TitleMetadata::Load(const std::vector file_data, std::size_t offset) { +Loader::ResultStatus TitleMetadata::Load(const std::vector& file_data, std::size_t offset) { std::size_t total_size = static_cast(file_data.size() - offset); if (total_size < sizeof(u32_be)) return Loader::ResultStatus::Error; diff --git a/src/core/file_sys/title_metadata.h b/src/core/file_sys/title_metadata.h index a5c926ef16..1f746f9000 100644 --- a/src/core/file_sys/title_metadata.h +++ b/src/core/file_sys/title_metadata.h @@ -85,7 +85,7 @@ public: #pragma pack(pop) Loader::ResultStatus Load(const std::string& file_path); - Loader::ResultStatus Load(const std::vector file_data, std::size_t offset = 0); + Loader::ResultStatus Load(const std::vector& file_data, std::size_t offset = 0); Loader::ResultStatus Save(const std::string& file_path); u64 GetTitleID() const;