Update PE parser interface

This commit is contained in:
Romain Thomas
2022-02-14 06:40:06 +01:00
parent b775ebec03
commit 274d887e17
3 changed files with 20 additions and 18 deletions
+4 -2
View File
@@ -32,7 +32,7 @@ void create<Parser>(py::module& m) {
py::return_value_policy::take_ownership);
m.def("parse",
static_cast<std::unique_ptr<Binary> (*) (const std::vector<uint8_t>&, const std::string&)>(&Parser::parse),
static_cast<std::unique_ptr<Binary> (*) (std::vector<uint8_t>, const std::string&)>(&Parser::parse),
"Parse the PE binary from the given **list of bytes** and return a :class:`lief.PE.Binary` object",
"raw"_a, "name"_a = "",
py::return_value_policy::take_ownership);
@@ -65,9 +65,11 @@ void create<Parser>(py::module& m) {
}
std::string raw_str = static_cast<py::bytes>(rawio.attr("readall")());
std::vector<uint8_t> raw = {
std::make_move_iterator(std::begin(raw_str)),
std::make_move_iterator(std::end(raw_str))};
std::make_move_iterator(std::end(raw_str))
};
return LIEF::PE::Parser::parse(std::move(raw), name);
},