mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:24:57 +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:
parent
062e0db46c
commit
d6571f54d8
8 changed files with 266 additions and 25 deletions
|
@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
// FIXME: Figure out how to do this sanely from stdin
|
||||
auto file = TRY(Core::MappedFile::map(filename));
|
||||
|
||||
if (file->size() < sizeof(DeviceTree::FlattenedDeviceTreeHeader)) {
|
||||
if (TRY(file->size()) < sizeof(DeviceTree::FlattenedDeviceTreeHeader)) {
|
||||
warnln("Not enough data in {} to contain a device tree header!", filename);
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue