1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:07:45 +00:00

Refactor: Expose const_cast by removing ByteBuffer::warp(const void*, size_t)

This function did a const_cast internally which made the call side look
"safe". This method is removed completely and call sites are replaced
with ByteBuffer::wrap(const_cast<void*>(data), size) which makes the
behaviour obvious.
This commit is contained in:
asynts 2020-08-05 14:09:38 +02:00 committed by Andreas Kling
parent ac9f6fd1f8
commit b3d1a05261
15 changed files with 42 additions and 36 deletions

View file

@ -66,7 +66,7 @@ public:
{
}
~Symbol() {}
~Symbol() { }
StringView name() const { return m_image.table_string(m_sym.st_name); }
unsigned section_index() const { return m_sym.st_shndx; }
@ -92,7 +92,7 @@ public:
, m_program_header_index(program_header_index)
{
}
~ProgramHeader() {}
~ProgramHeader() { }
unsigned index() const { return m_program_header_index; }
u32 type() const { return m_program_header.p_type; }
@ -122,7 +122,7 @@ public:
, m_section_index(sectionIndex)
{
}
~Section() {}
~Section() { }
StringView name() const { return m_image.section_header_table_string(m_section_header.sh_name); }
unsigned type() const { return m_section_header.sh_type; }
@ -132,7 +132,7 @@ public:
unsigned entry_count() const { return !entry_size() ? 0 : size() / entry_size(); }
u32 address() const { return m_section_header.sh_addr; }
const char* raw_data() const { return m_image.raw_data(m_section_header.sh_offset); }
ByteBuffer wrapping_byte_buffer() { return ByteBuffer::wrap(reinterpret_cast<const u8*>(raw_data()), size()); }
ByteBuffer wrapping_byte_buffer() { return ByteBuffer::wrap(const_cast<char*>(raw_data()), size()); }
bool is_undefined() const { return m_section_index == SHN_UNDEF; }
const RelocationSection relocations() const;
u32 flags() const { return m_section_header.sh_flags; }
@ -166,7 +166,7 @@ public:
{
}
~Relocation() {}
~Relocation() { }
unsigned offset() const { return m_rel.r_offset; }
unsigned type() const { return ELF32_R_TYPE(m_rel.r_info); }