1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:44:58 +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

@ -258,8 +258,7 @@ static Optional<Wasm::Module> parse(StringView filename)
return {};
}
FixedMemoryStream stream { ReadonlyBytes { result.value()->data(), result.value()->size() } };
auto parse_result = Wasm::Module::parse(stream);
auto parse_result = Wasm::Module::parse(*result.value());
if (parse_result.is_error()) {
warnln("Something went wrong, either the file is invalid, or there's a bug with LibWasm!");
warnln("The parse error was {}", Wasm::parse_error_to_deprecated_string(parse_result.error()));