Remove exceptions

This commit is contained in:
Romain Thomas
2022-04-01 05:38:30 +02:00
parent f75718ccd9
commit baa023b914
54 changed files with 790 additions and 812 deletions
+9 -6
View File
@@ -19,6 +19,7 @@
#include "LIEF/ELF/hash.hpp"
#include "LIEF/ELF/Binary.hpp"
#include "pyErr.hpp"
#include "pyELF.hpp"
namespace LIEF {
@@ -400,12 +401,14 @@ void create<Binary>(py::module& m) {
py::return_value_policy::reference)
.def("virtual_address_to_offset",
&Binary::virtual_address_to_offset,
[] (const Binary& self, uint64_t address) {
return error_or(&Binary::virtual_address_to_offset, self, address);
},
"Convert the virtual address to a file offset",
"virtual_address"_a)
.def("add",
static_cast<Section& (Binary::*)(const Section&, bool)>(&Binary::add),
static_cast<Section* (Binary::*)(const Section&, bool)>(&Binary::add),
R"delim(
Add the given :class:`~lief.ELF.Section` to the binary.
@@ -416,7 +419,7 @@ void create<Binary>(py::module& m) {
py::return_value_policy::reference)
.def("add",
static_cast<Segment& (Binary::*)(const Segment&, uint64_t)>(&Binary::add),
static_cast<Segment* (Binary::*)(const Segment&, uint64_t)>(&Binary::add),
"Add a new " RST_CLASS_REF(lief.ELF.Segment) " in the binary"
"segment"_a, "base"_a = 0,
py::return_value_policy::reference)
@@ -428,7 +431,7 @@ void create<Binary>(py::module& m) {
py::return_value_policy::reference)
.def("replace",
static_cast<Segment& (Binary::*)(const Segment&, const Segment&, uint64_t)>(&Binary::replace),
static_cast<Segment* (Binary::*)(const Segment&, const Segment&, uint64_t)>(&Binary::replace),
R"delim(
Replace the :class:`~lief.ELF.Segment` given in 2nd parameter with the
:class:`~lief.ELF.Segment` given in the first parameter and return the updated segment.
@@ -441,13 +444,13 @@ void create<Binary>(py::module& m) {
py::return_value_policy::reference)
.def("extend",
static_cast<Segment& (Binary::*)(const Segment&, uint64_t)>(&Binary::extend),
static_cast<Segment* (Binary::*)(const Segment&, uint64_t)>(&Binary::extend),
"Extend the given given " RST_CLASS_REF(lief.ELF.Segment) " by the given size",
"segment"_a, "size"_a,
py::return_value_policy::reference)
.def("extend",
static_cast<Section& (Binary::*)(const Section&, uint64_t)>(&Binary::extend),
static_cast<Section* (Binary::*)(const Section&, uint64_t)>(&Binary::extend),
"Extend the given given " RST_CLASS_REF(lief.ELF.Section) " by the given size",
"segment"_a, "size"_a,
py::return_value_policy::reference)