mirror of
https://github.com/RGBCube/serenity
synced 2025-08-06 03:57:35 +00:00
LibCore: Rename Stream::read_all
to read_until_eof
This generally seems like a better name, especially if we somehow also need a better name for "read the entire buffer, but not the entire file" somewhere down the line.
This commit is contained in:
parent
5061a905ff
commit
ed4c2f2f8e
65 changed files with 88 additions and 88 deletions
|
@ -64,7 +64,7 @@ NetworkSettingsWidget::NetworkSettingsWidget()
|
|||
auto config_file = Core::ConfigFile::open_for_system("Network").release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
auto proc_net_adapters_file = Core::Stream::File::open("/sys/kernel/net/adapters"sv, Core::Stream::OpenMode::Read).release_value_but_fixme_should_propagate_errors();
|
||||
auto data = proc_net_adapters_file->read_all().release_value_but_fixme_should_propagate_errors();
|
||||
auto data = proc_net_adapters_file->read_until_eof().release_value_but_fixme_should_propagate_errors();
|
||||
JsonParser parser(data);
|
||||
JsonValue proc_net_adapters_json = parser.parse().release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ ErrorOr<NonnullOwnPtr<Presentation>> Presentation::load_from_file(StringView fil
|
|||
if (file_name.is_empty())
|
||||
return ENOENT;
|
||||
auto file = TRY(Core::Stream::File::open_file_or_standard_stream(file_name, Core::Stream::OpenMode::Read));
|
||||
auto contents = TRY(file->read_all());
|
||||
auto contents = TRY(file->read_until_eof());
|
||||
auto content_string = StringView { contents };
|
||||
auto json = TRY(JsonValue::from_string(content_string));
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ Image::Image(NonnullRefPtr<ImageDecoderClient::Client> client, NonnullRefPtr<GUI
|
|||
ErrorOr<void> Image::reload_image()
|
||||
{
|
||||
auto file = TRY(Core::Stream::File::open(m_image_path, Core::Stream::OpenMode::Read));
|
||||
auto data = TRY(file->read_all());
|
||||
auto data = TRY(file->read_until_eof());
|
||||
auto maybe_decoded = m_client->decode_image(data);
|
||||
if (!maybe_decoded.has_value() || maybe_decoded.value().frames.size() < 1)
|
||||
return Error::from_string_view("Could not decode image"sv);
|
||||
|
|
|
@ -18,7 +18,7 @@ M3UParser::M3UParser()
|
|||
NonnullOwnPtr<M3UParser> M3UParser::from_file(StringView path)
|
||||
{
|
||||
auto file_result = Core::Stream::File::open(path, Core::Stream::OpenMode::Read).release_value_but_fixme_should_propagate_errors();
|
||||
auto contents = file_result->read_all().release_value_but_fixme_should_propagate_errors();
|
||||
auto contents = file_result->read_until_eof().release_value_but_fixme_should_propagate_errors();
|
||||
auto use_utf8 = path.ends_with(".m3u8"sv, CaseSensitivity::CaseInsensitive);
|
||||
return from_memory(DeprecatedString { contents, NoChomp }, use_utf8);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ static ErrorOr<void> fill_mounts(Vector<MountInfo>& output)
|
|||
// Output info about currently mounted filesystems.
|
||||
auto file = TRY(Core::Stream::File::open("/sys/kernel/df"sv, Core::Stream::OpenMode::Read));
|
||||
|
||||
auto content = TRY(file->read_all());
|
||||
auto content = TRY(file->read_until_eof());
|
||||
auto json = TRY(JsonValue::from_string(content));
|
||||
|
||||
TRY(json.as_array().try_for_each([&output](JsonValue const& value) -> ErrorOr<void> {
|
||||
|
|
|
@ -411,7 +411,7 @@ Vector<GUI::ModelIndex> ProcessModel::matches(StringView searching, unsigned fla
|
|||
static ErrorOr<DeprecatedString> try_read_command_line(pid_t pid)
|
||||
{
|
||||
auto file = TRY(Core::Stream::File::open(DeprecatedString::formatted("/proc/{}/cmdline", pid), Core::Stream::OpenMode::Read));
|
||||
auto data = TRY(file->read_all());
|
||||
auto data = TRY(file->read_until_eof());
|
||||
auto json = TRY(JsonValue::from_string(StringView { data.bytes() }));
|
||||
auto array = json.as_array().values();
|
||||
return DeprecatedString::join(" "sv, array);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue