Compare commits

...

2 Commits

Author SHA1 Message Date
Mat M
27760e20d8 Merge 1cd5ccfe89 into 924c473bb3 2018-07-18 22:50:17 +00:00
Lioncash
1cd5ccfe89 program_metadata: Take std::vector by const reference in Load()
This is only ever read from in the function itself, it's not moved or
copied anywhere else, so this is kind of wasteful. Given it has a const
qualifier, it was likely intended to be a reference anyways, however the
ampersand was forgotten.
2018-07-18 18:48:22 -04:00
2 changed files with 2 additions and 2 deletions

View File

@@ -26,7 +26,7 @@ Loader::ResultStatus ProgramMetadata::Load(const std::string& file_path) {
return result;
}
Loader::ResultStatus ProgramMetadata::Load(const std::vector<u8> file_data, size_t offset) {
Loader::ResultStatus ProgramMetadata::Load(const std::vector<u8>& file_data, size_t offset) {
size_t total_size = static_cast<size_t>(file_data.size() - offset);
if (total_size < sizeof(Header))
return Loader::ResultStatus::Error;

View File

@@ -38,7 +38,7 @@ enum class ProgramFilePermission : u64 {
class ProgramMetadata {
public:
Loader::ResultStatus Load(const std::string& file_path);
Loader::ResultStatus Load(const std::vector<u8> file_data, size_t offset = 0);
Loader::ResultStatus Load(const std::vector<u8>& file_data, size_t offset = 0);
bool Is64BitProgram() const;
ProgramAddressSpaceType GetAddressSpaceType() const;