mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:17:35 +00:00
LibDeviceTree: Refactor dump() to return ErrorOr, and use ReadonlyBytes
ReadonlyBytes is much nicer to use than a u8 const* + size_t.
This commit is contained in:
parent
01f32a22b4
commit
895f54f487
3 changed files with 28 additions and 26 deletions
|
@ -29,9 +29,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
auto* fdt_header = reinterpret_cast<DeviceTree::FlattenedDeviceTreeHeader const*>(file->data());
|
||||
auto const* fdt_header = reinterpret_cast<DeviceTree::FlattenedDeviceTreeHeader const*>(file->data());
|
||||
auto bytes = ReadonlyBytes { file->data(), file->size() };
|
||||
|
||||
bool valid = DeviceTree::dump(*fdt_header, static_cast<u8 const*>(file->data()), file->size());
|
||||
TRY(DeviceTree::dump(*fdt_header, bytes));
|
||||
|
||||
return valid ? 0 : 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue