Merge pull request #6835 from lioncash/move

Boot: Make BootExecutableReader's constructor take a std::vector by value
This commit is contained in:
Léo Lam 2018-05-12 23:52:30 +02:00 committed by GitHub
commit ecfb9d6691
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 9 deletions

View File

@ -12,6 +12,7 @@
#include <optional>
#include <string>
#include <unordered_set>
#include <utility>
#include <vector>
#include <zlib.h>
@ -456,7 +457,7 @@ BootExecutableReader::BootExecutableReader(File::IOFile file)
file.ReadBytes(m_bytes.data(), m_bytes.size());
}
BootExecutableReader::BootExecutableReader(const std::vector<u8>& bytes) : m_bytes(bytes)
BootExecutableReader::BootExecutableReader(std::vector<u8> bytes) : m_bytes(std::move(bytes))
{
}

View File

@ -124,7 +124,7 @@ class BootExecutableReader
public:
explicit BootExecutableReader(const std::string& file_name);
explicit BootExecutableReader(File::IOFile file);
explicit BootExecutableReader(const std::vector<u8>& buffer);
explicit BootExecutableReader(std::vector<u8> buffer);
virtual ~BootExecutableReader();
virtual u32 GetEntryPoint() const = 0;

View File

@ -10,13 +10,12 @@
#include <vector>
#include "Common/File.h"
#include "Common/FileUtil.h"
#include "Common/Swap.h"
#include "Core/HW/Memmap.h"
DolReader::DolReader(const std::vector<u8>& buffer) : BootExecutableReader(buffer)
DolReader::DolReader(std::vector<u8> buffer) : BootExecutableReader(std::move(buffer))
{
m_is_valid = Initialize(buffer);
m_is_valid = Initialize(m_bytes);
}
DolReader::DolReader(File::IOFile file) : BootExecutableReader(std::move(file))

View File

@ -20,7 +20,7 @@ class DolReader final : public BootExecutableReader
public:
explicit DolReader(const std::string& filename);
explicit DolReader(File::IOFile file);
explicit DolReader(const std::vector<u8>& buffer);
explicit DolReader(std::vector<u8> buffer);
~DolReader();
bool IsValid() const override { return m_is_valid; }

View File

@ -8,7 +8,7 @@
#include <utility>
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/File.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Common/Swap.h"
@ -68,7 +68,7 @@ static void byteswapSection(Elf32_Shdr& sec)
bswap(sec.sh_type);
}
ElfReader::ElfReader(const std::vector<u8>& buffer) : BootExecutableReader(buffer)
ElfReader::ElfReader(std::vector<u8> buffer) : BootExecutableReader(std::move(buffer))
{
Initialize(m_bytes.data());
}

View File

@ -28,7 +28,7 @@ class ElfReader final : public BootExecutableReader
public:
explicit ElfReader(const std::string& filename);
explicit ElfReader(File::IOFile file);
explicit ElfReader(const std::vector<u8>& buffer);
explicit ElfReader(std::vector<u8> buffer);
~ElfReader();
u32 Read32(int off) const { return base32[off >> 2]; }
// Quick accessors