Skip to content

Commit

Permalink
Update code to ease Python stub files (related #650)
Browse files Browse the repository at this point in the history
  • Loading branch information
romainthomas committed Feb 4, 2023
1 parent 7101b7f commit c91b7c2
Show file tree
Hide file tree
Showing 19 changed files with 100 additions and 87 deletions.
6 changes: 4 additions & 2 deletions api/python/DEX/objects/pyMapList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ using setter_t = void (MapList::*)(T);
template<>
void create<MapList>(py::module& m) {

init_ref_iterator<MapList::it_items_t>(m, "lief.DEX.MapList.it_items_t");
py::class_<MapList, LIEF::Object> map_list(m, "MapList", "DEX MapList representation");

py::class_<MapList, LIEF::Object>(m, "MapList", "DEX MapList representation")
init_ref_iterator<MapList::it_items_t>(map_list, "it_items_t");

map_list
.def_property_readonly("items",
static_cast<no_const_getter_t<MapList::it_items_t>>(&MapList::items),
"Iterator over " RST_CLASS_REF(lief.DEX.MapItem) "")
Expand Down
7 changes: 5 additions & 2 deletions api/python/DEX/objects/pyPrototype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ using setter_t = void (Prototype::*)(T);
template<>
void create<Prototype>(py::module& m) {

init_ref_iterator<Prototype::it_params>(m, "lief.DEX.Prototype.it_params");

py::class_<Prototype, LIEF::Object>(m, "Prototype", "DEX Prototype representation")
py::class_<Prototype, LIEF::Object> proto(m, "Prototype", "DEX Prototype representation");

init_ref_iterator<Prototype::it_params>(proto, "it_params");

proto
.def_property_readonly("return_type",
static_cast<no_const_getter_t<Type*>>(&Prototype::return_type),
"" RST_CLASS_REF(lief.DEX.Type) " returned",
Expand Down
67 changes: 34 additions & 33 deletions api/python/ELF/objects/NoteDetails/core/pyCoreAuxv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,39 @@ template<>
void create<CoreAuxv>(py::module& m) {

py::class_<CoreAuxv, NoteDetails> cls(m, "CoreAuxv");
LIEF::enum_<AUX_TYPE>(cls, "TYPES")
.value(PY_ENUM(AUX_TYPE::AT_NULL))
.value(PY_ENUM(AUX_TYPE::AT_IGNORE))
.value(PY_ENUM(AUX_TYPE::AT_EXECFD))
.value(PY_ENUM(AUX_TYPE::AT_PHDR))
.value(PY_ENUM(AUX_TYPE::AT_PHENT))
.value(PY_ENUM(AUX_TYPE::AT_PHNUM))
.value(PY_ENUM(AUX_TYPE::AT_PAGESZ))
.value(PY_ENUM(AUX_TYPE::AT_BASE))
.value(PY_ENUM(AUX_TYPE::AT_FLAGS))
.value(PY_ENUM(AUX_TYPE::AT_ENTRY))
.value(PY_ENUM(AUX_TYPE::AT_NOTELF))
.value(PY_ENUM(AUX_TYPE::AT_UID))
.value(PY_ENUM(AUX_TYPE::AT_EUID))
.value(PY_ENUM(AUX_TYPE::AT_GID))
.value(PY_ENUM(AUX_TYPE::AT_EGID))
.value(PY_ENUM(AUX_TYPE::AT_CLKTCK))
.value(PY_ENUM(AUX_TYPE::AT_PLATFORM))
.value(PY_ENUM(AUX_TYPE::AT_HWCAP))
.value(PY_ENUM(AUX_TYPE::AT_HWCAP2))
.value(PY_ENUM(AUX_TYPE::AT_FPUCW))
.value(PY_ENUM(AUX_TYPE::AT_DCACHEBSIZE))
.value(PY_ENUM(AUX_TYPE::AT_ICACHEBSIZE))
.value(PY_ENUM(AUX_TYPE::AT_UCACHEBSIZE))
.value(PY_ENUM(AUX_TYPE::AT_IGNOREPPC))
.value(PY_ENUM(AUX_TYPE::AT_SECURE))
.value(PY_ENUM(AUX_TYPE::AT_BASE_PLATFORM))
.value(PY_ENUM(AUX_TYPE::AT_RANDOM))
.value(PY_ENUM(AUX_TYPE::AT_EXECFN))
.value(PY_ENUM(AUX_TYPE::AT_SYSINFO))
.value(PY_ENUM(AUX_TYPE::AT_SYSINFO_EHDR))
.value(PY_ENUM(AUX_TYPE::AT_L1I_CACHESHAPE))
.value(PY_ENUM(AUX_TYPE::AT_L1D_CACHESHAPE));

cls
.def_property("values",
Expand Down Expand Up @@ -101,39 +134,7 @@ void create<CoreAuxv>(py::module& m) {
});


LIEF::enum_<AUX_TYPE>(cls, "TYPES")
.value(PY_ENUM(AUX_TYPE::AT_NULL))
.value(PY_ENUM(AUX_TYPE::AT_IGNORE))
.value(PY_ENUM(AUX_TYPE::AT_EXECFD))
.value(PY_ENUM(AUX_TYPE::AT_PHDR))
.value(PY_ENUM(AUX_TYPE::AT_PHENT))
.value(PY_ENUM(AUX_TYPE::AT_PHNUM))
.value(PY_ENUM(AUX_TYPE::AT_PAGESZ))
.value(PY_ENUM(AUX_TYPE::AT_BASE))
.value(PY_ENUM(AUX_TYPE::AT_FLAGS))
.value(PY_ENUM(AUX_TYPE::AT_ENTRY))
.value(PY_ENUM(AUX_TYPE::AT_NOTELF))
.value(PY_ENUM(AUX_TYPE::AT_UID))
.value(PY_ENUM(AUX_TYPE::AT_EUID))
.value(PY_ENUM(AUX_TYPE::AT_GID))
.value(PY_ENUM(AUX_TYPE::AT_EGID))
.value(PY_ENUM(AUX_TYPE::AT_CLKTCK))
.value(PY_ENUM(AUX_TYPE::AT_PLATFORM))
.value(PY_ENUM(AUX_TYPE::AT_HWCAP))
.value(PY_ENUM(AUX_TYPE::AT_HWCAP2))
.value(PY_ENUM(AUX_TYPE::AT_FPUCW))
.value(PY_ENUM(AUX_TYPE::AT_DCACHEBSIZE))
.value(PY_ENUM(AUX_TYPE::AT_ICACHEBSIZE))
.value(PY_ENUM(AUX_TYPE::AT_UCACHEBSIZE))
.value(PY_ENUM(AUX_TYPE::AT_IGNOREPPC))
.value(PY_ENUM(AUX_TYPE::AT_SECURE))
.value(PY_ENUM(AUX_TYPE::AT_BASE_PLATFORM))
.value(PY_ENUM(AUX_TYPE::AT_RANDOM))
.value(PY_ENUM(AUX_TYPE::AT_EXECFN))
.value(PY_ENUM(AUX_TYPE::AT_SYSINFO))
.value(PY_ENUM(AUX_TYPE::AT_SYSINFO_EHDR))
.value(PY_ENUM(AUX_TYPE::AT_L1I_CACHESHAPE))
.value(PY_ENUM(AUX_TYPE::AT_L1D_CACHESHAPE));



}
Expand Down
5 changes: 3 additions & 2 deletions api/python/ELF/objects/NoteDetails/core/pyCoreFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ using setter_t = void (CoreFile::*)(T);
template<>
void create<CoreFile>(py::module& m) {

py::bind_vector<CoreFile::files_t>(m, "CoreFile.files_t");

py::class_<CoreFile, NoteDetails>(m, "CoreFile")
py::class_<CoreFile, NoteDetails> cls(m, "CoreFile");
py::bind_vector<CoreFile::files_t>(cls, "files_t");

cls
.def_property("files",
static_cast<getter_t<const CoreFile::files_t&>>(&CoreFile::files),
static_cast<setter_t<const CoreFile::files_t&>>(&CoreFile::files),
Expand Down
2 changes: 1 addition & 1 deletion api/python/ELF/objects/NoteDetails/core/pyCorePrStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void create<CorePrStatus>(py::module& m) {
.def_readwrite("sec", &CorePrStatus::timeval_t::sec)
.def_readwrite("usec", &CorePrStatus::timeval_t::usec);

py::class_<CorePrStatus::siginfo_t>(cls, "siginfo")
py::class_<CorePrStatus::siginfo_t>(cls, "siginfo_t")
.def_readwrite("sicode", &CorePrStatus::siginfo_t::si_code)
.def_readwrite("errno", &CorePrStatus::siginfo_t::si_errno)
.def_readwrite("signo", &CorePrStatus::siginfo_t::si_signo);
Expand Down
2 changes: 1 addition & 1 deletion api/python/ELF/objects/pyBinary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ void create<Binary>(py::module& m) {

.def_property_readonly("eof_offset",
&Binary::eof_offset,
"Return the last offset used by the ELF binary according to both: the sections table "
"Return the last offset used by the ELF binary according to both, the sections table "
"and the segments table.")

.def_property_readonly("has_overlay",
Expand Down
2 changes: 1 addition & 1 deletion api/python/ELF/objects/pyHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void create<Header>(py::module& m) {
.def_property("identity_data",
static_cast<getter_t<ELF_DATA>>(&Header::identity_data),
static_cast<setter_t<ELF_DATA>>(&Header::identity_data),
"Specify the data encoding: " RST_CLASS_REF(lief.ELF.ELF_DATA) "."
"Specify the data encoding (" RST_CLASS_REF(lief.ELF.ELF_DATA) ")"
)

.def_property("identity_version",
Expand Down
2 changes: 1 addition & 1 deletion api/python/ELF/objects/pySymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void create<Symbol>(py::module& m) {
.def_property("other",
static_cast<getter_t<uint8_t>>(&Symbol::other),
static_cast<setter_t<uint8_t>>(&Symbol::other),
"Alias for: " RST_ATTR_REF(lief.ELF.Symbol.visibility) "")
"Alias for " RST_ATTR_REF(lief.ELF.Symbol.visibility) "")

.def_property("visibility",
static_cast<getter_t<ELF_SYMBOL_VISIBILITY>>(&Symbol::visibility),
Expand Down
4 changes: 4 additions & 0 deletions api/python/MachO/objects/pyBinary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ void create<Binary>(py::module& m) {
init_ref_iterator<Binary::it_libraries>(bin, "it_libraries");
init_ref_iterator<Binary::it_relocations>(bin, "it_relocations");

py::class_<Binary::range_t>(bin, "range_t")
.def_readwrite("start", &Binary::range_t::start)
.def_readwrite("end", &Binary::range_t::end);

// --> Already registered with FatMachO (same container)
//init_ref_iterator<Binary::it_fileset_binaries>(bin, "it_fileset_binaries");

Expand Down
2 changes: 1 addition & 1 deletion api/python/MachO/objects/pyDyldChainedFixups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void create<DyldChainedFixups>(py::module& m) {

.def_property_readonly("chained_starts_in_segments",
py::overload_cast<>(&DyldChainedFixups::chained_starts_in_segments),
"Iterator over the chained fixup metadata: " RST_CLASS_REF(lief.MachO.DyldChainedFixups.chained_starts_in_segment) "")
"Iterator over the chained fixup metadata, " RST_CLASS_REF(lief.MachO.DyldChainedFixups.chained_starts_in_segment) "")

.def_property("fixups_version",
py::overload_cast<>(&DyldChainedFixups::fixups_version, py::const_),
Expand Down
2 changes: 1 addition & 1 deletion api/python/OAT/objects/pyHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void create<Header>(py::module& m) {

.def_property_readonly("magic",
static_cast<getter_t<Header::magic_t>>(&Header::magic),
"Magic number: ``oat\\x0A``")
"Magic number which shoud be ``oat\\x0A``")

.def_property_readonly("version",
static_cast<getter_t<oat_version_t>>(&Header::version),
Expand Down
6 changes: 3 additions & 3 deletions api/python/OAT/pyUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ void init_utils(py::module& m) {

m.def("is_oat",
static_cast<bool (*)(const LIEF::ELF::Binary&)>(&is_oat),
"Check if the " RST_CLASS_REF(lief.ELF.Binary) " given in parameter is a OAT one",
"Check if the " RST_CLASS_REF(lief.ELF.Binary) " given in parameter is an OAT",
"binary"_a);

m.def("is_oat",
static_cast<bool (*)(const std::string&)>(&is_oat),
"Check if the **file** given in parameter is a OAT one",
"Check if the **file** given in parameter is an OAT",
"path"_a);

m.def("is_oat",
static_cast<bool (*)(const std::vector<uint8_t>&)>(&is_oat),
"Check if the **raw data** given in parameter is a OAT one",
"Check if the **raw data** given in parameter is an OAT",
"raw"_a);


Expand Down
2 changes: 1 addition & 1 deletion api/python/PE/objects/pyHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void create<Header>(py::module& m) {
.def_property("machine",
static_cast<getter_t<MACHINE_TYPES>>(&Header::machine),
static_cast<setter_t<MACHINE_TYPES>>(&Header::machine),
"The target machine architecture: " RST_CLASS_REF(lief.PE.MACHINE_TYPES) "")
"The target machine architecture (" RST_CLASS_REF(lief.PE.MACHINE_TYPES) ")")

.def_property("numberof_sections",
static_cast<getter_t<uint16_t>>(&Header::numberof_sections),
Expand Down
2 changes: 1 addition & 1 deletion api/python/PE/objects/signature/pySignature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void create<Signature>(py::module& m) {

.def_property_readonly("signers",
&Signature::signers,
"Return an iterator over the signers: " RST_CLASS_REF(lief.PE.SignerInfo) "",
"Return an iterator over the signers (" RST_CLASS_REF(lief.PE.SignerInfo) ")",
py::return_value_policy::reference)

.def("find_crt",
Expand Down
38 changes: 19 additions & 19 deletions api/python/PE/pyEnums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,25 +233,25 @@ void init_enums(py::module& m) {


LIEF::enum_<RELOCATIONS_BASE_TYPES>(m, "RELOCATIONS_BASE_TYPES")
.value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_ABSOLUTE))
.value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_HIGH))
.value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_LOW))
.value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_HIGHLOW))
.value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_HIGHADJ))
.value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_MIPS_JMPADDR))
.value("ARM_MOV32A", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_ARM_MOV32A)
.value("ARM_MOV32", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_ARM_MOV32)
.value("RISCV_HI20", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_RISCV_HI20)
.value("ARM_MOV32T", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_ARM_MOV32T)
.value("THUMB_MOV32", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_THUMB_MOV32)
.value("RISCV_LOW12I", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_RISCV_LOW12I)
.value("RISCV_LOW12S", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_RISCV_LOW12S)
.value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_SECTION))
.value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_REL))
.value("MIPS_JMPADDR16", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_MIPS_JMPADDR16)
.value("IA64_IMM64", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_IA64_IMM64)
.value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_DIR64))
.value(PY_ENUM(RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_HIGH3ADJ));
.value("ABSOLUTE", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_ABSOLUTE)
.value("HIGH", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_HIGH)
.value("LOW", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_LOW)
.value("HIGHLOW", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_HIGHLOW)
.value("HIGHADJ", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_HIGHADJ)
.value("MIPS_JMPADDR", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_MIPS_JMPADDR)
.value("ARM_MOV32A", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_ARM_MOV32A)
.value("ARM_MOV32", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_ARM_MOV32)
.value("RISCV_HI20", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_RISCV_HI20)
.value("ARM_MOV32T", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_ARM_MOV32T)
.value("THUMB_MOV32", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_THUMB_MOV32)
.value("RISCV_LOW12I", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_RISCV_LOW12I)
.value("RISCV_LOW12S", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_RISCV_LOW12S)
.value("SECTION", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_SECTION)
.value("REL", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_REL)
.value("MIPS_JMPADDR16", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_MIPS_JMPADDR16)
.value("IA64_IMM64", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_IA64_IMM64)
.value("DIR64", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_DIR64)
.value("HIGH3ADJ", RELOCATIONS_BASE_TYPES::IMAGE_REL_BASED_HIGH3ADJ);


LIEF::enum_<DEBUG_TYPES>(m, "DEBUG_TYPES")
Expand Down
4 changes: 2 additions & 2 deletions api/python/PE/pyPE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ void init_python_module(py::module& m) {


// Opaque containers
py::bind_vector<std::vector<LangCodeItem>>(m, "ListLangCodeItem");
py::bind_map<dict_langcode_item>(m, "DictStringVersion");
py::bind_vector<std::vector<LangCodeItem>>(LIEF_PE_module, "ListLangCodeItem");
py::bind_map<dict_langcode_item>(LIEF_PE_module, "DictStringVersion");
}

void init_objects(py::module& m) {
Expand Down
2 changes: 1 addition & 1 deletion api/python/PE/pyUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void init_utils(py::module& m) {

"The ``strict`` boolean parameter enables to throw a " RST_CLASS_REF(lief.not_found) " exception "
"if the ordinal can't be resolved. Otherwise it skips the entry.",
"import"_a, "strict"_a = false, "use_std"_a = false,
"imp"_a, "strict"_a = false, "use_std"_a = false,
py::return_value_policy::copy);
}

Expand Down
29 changes: 15 additions & 14 deletions src/MachO/EnumToString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,16 @@ const char* to_string(PPC_RELOCATION e) {

const char* to_string(ARM_RELOCATION e) {
CONST_MAP(ARM_RELOCATION, const char*, 10) enumStrings {
{ ARM_RELOCATION::ARM_RELOC_VANILLA, "VANILLA" },
{ ARM_RELOCATION::ARM_RELOC_PAIR, "PAIR" },
{ ARM_RELOCATION::ARM_RELOC_SECTDIFF, "SECTDIFF" },
{ ARM_RELOCATION::ARM_RELOC_LOCAL_SECTDIFF, "LOCAL_SECTDIFF" },
{ ARM_RELOCATION::ARM_RELOC_PB_LA_PTR, "PB_LA_PTR" },
{ ARM_RELOCATION::ARM_RELOC_BR24, "BR24" },
{ ARM_RELOCATION::ARM_THUMB_RELOC_BR22, "RELOC_BR22" },
{ ARM_RELOCATION::ARM_THUMB_32BIT_BRANCH, "32BIT_BRANCH" },
{ ARM_RELOCATION::ARM_RELOC_HALF, "HALF" },
{ ARM_RELOCATION::ARM_RELOC_HALF_SECTDIFF, "HALF_SECTDIFF" },
{ ARM_RELOCATION::ARM_RELOC_VANILLA, "VANILLA" },
{ ARM_RELOCATION::ARM_RELOC_PAIR, "PAIR" },
{ ARM_RELOCATION::ARM_RELOC_SECTDIFF, "SECTDIFF" },
{ ARM_RELOCATION::ARM_RELOC_LOCAL_SECTDIFF, "LOCAL_SECTDIFF" },
{ ARM_RELOCATION::ARM_RELOC_PB_LA_PTR, "PB_LA_PTR" },
{ ARM_RELOCATION::ARM_RELOC_BR24, "BR24" },
{ ARM_RELOCATION::ARM_THUMB_RELOC_BR22, "THUMB_RELOC_BR22" },
{ ARM_RELOCATION::ARM_THUMB_32BIT_BRANCH, "THUMB_32BIT_BRANCH" },
{ ARM_RELOCATION::ARM_RELOC_HALF, "HALF" },
{ ARM_RELOCATION::ARM_RELOC_HALF_SECTDIFF, "HALF_SECTDIFF" },
};
const auto it = enumStrings.find(e);
return it == enumStrings.end() ? "Out of range" : it->second;
Expand All @@ -352,10 +352,11 @@ const char* to_string(ARM64_RELOCATION e) {
}

const char* to_string(RELOCATION_ORIGINS e) {
CONST_MAP(RELOCATION_ORIGINS, const char*, 3) enumStrings {
{ RELOCATION_ORIGINS::ORIGIN_UNKNOWN, "UNKNOWN" },
{ RELOCATION_ORIGINS::ORIGIN_DYLDINFO, "DYLDINFO" },
{ RELOCATION_ORIGINS::ORIGIN_RELOC_TABLE, "RELOC_TABLE" },
CONST_MAP(RELOCATION_ORIGINS, const char*, 4) enumStrings {
{ RELOCATION_ORIGINS::ORIGIN_UNKNOWN, "UNKNOWN" },
{ RELOCATION_ORIGINS::ORIGIN_DYLDINFO, "DYLDINFO" },
{ RELOCATION_ORIGINS::ORIGIN_RELOC_TABLE, "RELOC_TABLE" },
{ RELOCATION_ORIGINS::ORIGIN_CHAINED_FIXUPS, "CHAINED_FIXUPS" },
};
const auto it = enumStrings.find(e);
return it == enumStrings.end() ? "Out of range" : it->second;
Expand Down
3 changes: 2 additions & 1 deletion src/PE/EnumToString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ const char* to_string(RESOURCE_LANGS e) {
}

const char* to_string(RESOURCE_SUBLANGS e) {
CONST_MAP(RESOURCE_SUBLANGS, const char*, 229) enumStrings {
CONST_MAP(RESOURCE_SUBLANGS, const char*, 230) enumStrings {
{ RESOURCE_SUBLANGS::SUBLANG_AFRIKAANS_SOUTH_AFRICA, "AFRIKAANS_SOUTH_AFRICA" },
{ RESOURCE_SUBLANGS::SUBLANG_ALBANIAN_ALBANIA, "ALBANIAN_ALBANIA" },
{ RESOURCE_SUBLANGS::SUBLANG_ALSATIAN_FRANCE, "ALSATIAN_FRANCE" },
Expand Down Expand Up @@ -785,6 +785,7 @@ const char* to_string(RESOURCE_SUBLANGS e) {
{ RESOURCE_SUBLANGS::SUBLANG_TIGRINYA_ETHIOPIA, "TIGRINYA_ETHIOPIA" },
{ RESOURCE_SUBLANGS::SUBLANG_TIGRINYA_ERITREA, "TIGRINYA_ERITREA" },
{ RESOURCE_SUBLANGS::SUBLANG_VALENCIAN_VALENCIA, "VALENCIAN_VALENCIA" },
{ RESOURCE_SUBLANGS::SUBLANG_PULAR_SENEGAL, "PULAR_SENEGAL" },
};

const auto it = enumStrings.find(e);
Expand Down

0 comments on commit c91b7c2

Please sign in to comment.