BAN: Modify Span constructors to keep constness correctly
This commit is contained in:
@@ -21,8 +21,8 @@ namespace Kernel
|
||||
const uint8_t* glyph(uint32_t) const;
|
||||
|
||||
private:
|
||||
static BAN::ErrorOr<Font> parse_psf1(const BAN::Span<uint8_t>);
|
||||
static BAN::ErrorOr<Font> parse_psf2(const BAN::Span<uint8_t>);
|
||||
static BAN::ErrorOr<Font> parse_psf1(BAN::Span<const uint8_t>);
|
||||
static BAN::ErrorOr<Font> parse_psf2(BAN::Span<const uint8_t>);
|
||||
|
||||
private:
|
||||
BAN::HashMap<uint32_t, uint32_t> m_glyph_offsets;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Kernel
|
||||
BAN::ErrorOr<Font> Font::prefs()
|
||||
{
|
||||
size_t font_data_size = _binary_font_prefs_psf_end - _binary_font_prefs_psf_start;
|
||||
BAN::Span<uint8_t> font_data(_binary_font_prefs_psf_start, font_data_size);
|
||||
BAN::Span<const uint8_t> font_data(_binary_font_prefs_psf_start, font_data_size);
|
||||
return parse_psf1(font_data);
|
||||
}
|
||||
|
||||
@@ -57,8 +57,7 @@ namespace Kernel
|
||||
return BAN::Error::from_c_string("Unsupported font format");
|
||||
}
|
||||
|
||||
|
||||
BAN::ErrorOr<Font> Font::parse_psf1(const BAN::Span<uint8_t> font_data)
|
||||
BAN::ErrorOr<Font> Font::parse_psf1(BAN::Span<const uint8_t> font_data)
|
||||
{
|
||||
if (font_data.size() < 4)
|
||||
return BAN::Error::from_c_string("Font file is too small");
|
||||
@@ -139,7 +138,7 @@ namespace Kernel
|
||||
return result;
|
||||
}
|
||||
|
||||
BAN::ErrorOr<Font> Font::parse_psf2(const BAN::Span<uint8_t> font_data)
|
||||
BAN::ErrorOr<Font> Font::parse_psf2(BAN::Span<const uint8_t> font_data)
|
||||
{
|
||||
struct PSF2Header
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Kernel
|
||||
BAN::LittleEndian<uint64_t> ending_lba;
|
||||
BAN::LittleEndian<uint64_t> attributes;
|
||||
BAN::LittleEndian<uint16_t> partition_name[36];
|
||||
} __attribute__((packed));
|
||||
};
|
||||
|
||||
static uint32_t crc32_table[256] =
|
||||
{
|
||||
@@ -167,7 +167,6 @@ namespace Kernel
|
||||
for (uint32_t i = 0; i < header.partition_entry_count; i++)
|
||||
{
|
||||
const PartitionEntry& entry = *(const PartitionEntry*)(entry_array.data() + header.partition_entry_size * i);
|
||||
ASSERT((uintptr_t)&entry % 2 == 0);
|
||||
|
||||
char utf8_name[36 * 4 + 1];
|
||||
BAN::UTF8::from_codepoints(entry.partition_name, 36, utf8_name);
|
||||
|
||||
Reference in New Issue
Block a user