Merge pull request #6835 from lioncash/move
Boot: Make BootExecutableReader's constructor take a std::vector by value
This commit is contained in:
commit
ecfb9d6691
|
@ -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))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue