mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
AK: Rename span() to bytes() when appropriate.
I originally defined the bytes() method for the String class, because it made it obvious that it's a span of bytes instead of span of characters. This commit makes this more consistent by defining a bytes() method when the type of the span is known to be u8. Additionaly, the cast operator to Bytes is overloaded for ByteBuffer and such.
This commit is contained in:
parent
525d51bbb5
commit
fff581cd72
18 changed files with 51 additions and 45 deletions
|
@ -40,7 +40,7 @@ AbbreviationsMap::AbbreviationsMap(const DwarfInfo& dwarf_info, u32 offset)
|
|||
|
||||
void AbbreviationsMap::populate_map()
|
||||
{
|
||||
InputMemoryStream abbreviation_stream(m_dwarf_info.abbreviation_data().span());
|
||||
InputMemoryStream abbreviation_stream(m_dwarf_info.abbreviation_data());
|
||||
abbreviation_stream.discard_or_error(m_offset);
|
||||
|
||||
while (!abbreviation_stream.eof()) {
|
||||
|
|
|
@ -36,7 +36,7 @@ DIE::DIE(const CompilationUnit& unit, u32 offset)
|
|||
: m_compilation_unit(unit)
|
||||
, m_offset(offset)
|
||||
{
|
||||
InputMemoryStream stream(m_compilation_unit.dwarf_info().debug_info_data().span());
|
||||
InputMemoryStream stream(m_compilation_unit.dwarf_info().debug_info_data());
|
||||
stream.discard_or_error(m_offset);
|
||||
stream.read_LEB128_unsigned(m_abbreviation_code);
|
||||
m_data_offset = stream.offset();
|
||||
|
@ -181,7 +181,7 @@ DIE::AttributeValue DIE::get_attribute_value(AttributeDataForm form,
|
|||
|
||||
Optional<DIE::AttributeValue> DIE::get_attribute(const Attribute& attribute) const
|
||||
{
|
||||
InputMemoryStream stream { m_compilation_unit.dwarf_info().debug_info_data().span() };
|
||||
InputMemoryStream stream { m_compilation_unit.dwarf_info().debug_info_data() };
|
||||
stream.discard_or_error(m_data_offset);
|
||||
|
||||
auto abbreviation_info = m_compilation_unit.abbreviations_map().get(m_abbreviation_code);
|
||||
|
|
|
@ -53,7 +53,7 @@ void DwarfInfo::populate_compilation_units()
|
|||
if (m_debug_info_data.is_null())
|
||||
return;
|
||||
|
||||
InputMemoryStream stream(m_debug_info_data.span());
|
||||
InputMemoryStream stream{ m_debug_info_data };
|
||||
while (!stream.eof()) {
|
||||
auto unit_offset = stream.offset();
|
||||
CompilationUnitHeader compilation_unit_header {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue