1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +00:00

LibCore: Make MappedFile a Stream

The internal reuse of FixedMemoryStream makes this straightforward.
There alread is one user of the new API, demonstrating the need for this
change beyond what I said out to use it for :^)
This commit is contained in:
kleines Filmröllchen 2023-09-12 20:21:23 +02:00 committed by Tim Schumacher
parent 062e0db46c
commit d6571f54d8
8 changed files with 266 additions and 25 deletions

View file

@ -174,7 +174,7 @@ Icon FileIconProvider::icon_for_executable(DeprecatedString const& path)
auto& mapped_file = file_or_error.value();
if (mapped_file->size() < SELFMAG) {
if (mapped_file->size().release_value() < SELFMAG) {
app_icon_cache.set(path, s_executable_icon);
return s_executable_icon;
}
@ -184,7 +184,7 @@ Icon FileIconProvider::icon_for_executable(DeprecatedString const& path)
return s_executable_icon;
}
auto image = ELF::Image((u8 const*)mapped_file->data(), mapped_file->size());
auto image = ELF::Image((u8 const*)mapped_file->data(), mapped_file->size().release_value());
if (!image.is_valid()) {
app_icon_cache.set(path, s_executable_icon);
return s_executable_icon;