1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:17:46 +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:
Andrew Kaster 2023-02-17 10:25:55 -07:00 committed by Linus Groh
parent 01f32a22b4
commit 895f54f487
3 changed files with 28 additions and 26 deletions

View file

@ -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;
}