mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54: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:
parent
062e0db46c
commit
d6571f54d8
8 changed files with 266 additions and 25 deletions
|
@ -29,13 +29,13 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
args_parser.add_positional_argument(path, "Path to i386 binary file", "path");
|
||||
args_parser.parse(args);
|
||||
|
||||
OwnPtr<Core::MappedFile const> file;
|
||||
OwnPtr<Core::MappedFile> file;
|
||||
u8 const* asm_data = nullptr;
|
||||
size_t asm_size = 0;
|
||||
if ((TRY(Core::System::stat(path))).st_size > 0) {
|
||||
file = TRY(Core::MappedFile::map(path));
|
||||
asm_data = static_cast<u8 const*>(file->data());
|
||||
asm_size = file->size();
|
||||
asm_size = MUST(file->size());
|
||||
}
|
||||
|
||||
struct Symbol {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue