Skip to content

Commit

Permalink
Fix const-ness
Browse files Browse the repository at this point in the history
  • Loading branch information
romainthomas committed May 4, 2024
1 parent be3fc43 commit 2a26324
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/LIEF/PE/Binary.hpp
Expand Up @@ -150,11 +150,11 @@ class LIEF_API Binary : public LIEF::Binary {
//!
//! The conversion is performed by looking for the section that
//! encompasses the provided RVA.
uint64_t rva_to_offset(uint64_t RVA);
uint64_t rva_to_offset(uint64_t RVA) const;

//! Convert the **absolute** virtual address into an offset.
//! @see rva_to_offset
uint64_t va_to_offset(uint64_t VA);
uint64_t va_to_offset(uint64_t VA) const;

//! Convert the given offset into a virtual address.
//!
Expand Down
4 changes: 2 additions & 2 deletions src/PE/Binary.cpp
Expand Up @@ -139,7 +139,7 @@ void Binary::tls(const TLS& tls) {
tls_ = std::make_unique<TLS>(tls);
}

uint64_t Binary::va_to_offset(uint64_t VA) {
uint64_t Binary::va_to_offset(uint64_t VA) const {

//TODO: add checks relocation/va < imagebase
uint64_t rva = VA - optional_header().imagebase();
Expand Down Expand Up @@ -168,7 +168,7 @@ result<uint64_t> Binary::offset_to_virtual_address(uint64_t offset, uint64_t sli
return base_rva + offset;
}

uint64_t Binary::rva_to_offset(uint64_t RVA) {
uint64_t Binary::rva_to_offset(uint64_t RVA) const {
const auto it_section = std::find_if(std::begin(sections_), std::end(sections_),
[RVA] (const std::unique_ptr<Section>& section) {
const auto vsize_adj = std::max<uint64_t>(section->virtual_size(), section->sizeof_raw_data());
Expand Down

0 comments on commit 2a26324

Please sign in to comment.