Merge pull request #5568 from lioncash/boot

Boot: Make BootExecutableReader hierarchy constructors explicit
This commit is contained in:
Leo Lam 2017-06-07 09:27:04 +02:00 committed by GitHub
commit 6ee2227ba2
4 changed files with 9 additions and 7 deletions

View File

@ -109,8 +109,8 @@ private:
class BootExecutableReader
{
public:
BootExecutableReader(const std::string& file_name);
BootExecutableReader(const std::vector<u8>& buffer);
explicit BootExecutableReader(const std::string& file_name);
explicit BootExecutableReader(const std::vector<u8>& buffer);
virtual ~BootExecutableReader();
virtual u32 GetEntryPoint() const = 0;

View File

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

View File

@ -76,6 +76,8 @@ ElfReader::ElfReader(const std::string& filename) : BootExecutableReader(filenam
Initialize(m_bytes.data());
}
ElfReader::~ElfReader() = default;
void ElfReader::Initialize(u8* ptr)
{
base = (char*)ptr;

View File

@ -21,9 +21,9 @@ typedef int SectionID;
class ElfReader final : public BootExecutableReader
{
public:
ElfReader(const std::string& filename);
ElfReader(const std::vector<u8>& buffer);
~ElfReader() {}
explicit ElfReader(const std::string& filename);
explicit ElfReader(const std::vector<u8>& buffer);
~ElfReader();
u32 Read32(int off) const { return base32[off >> 2]; }
// Quick accessors
ElfType GetType() const { return (ElfType)(header->e_type); }