diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-09-12 21:06:25 +0100 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2022-09-20 07:48:45 -0400 |
commit | 183b054695ef1c63ae9c4fbb1e6423de229cefb0 (patch) | |
tree | 0dced5cc58d3a325addf4c7cb7d57f91495dc6fc /Userland | |
parent | 684c3efc04711d4b352f0e10dd9543c61acc7a16 (diff) | |
download | serenity-183b054695ef1c63ae9c4fbb1e6423de229cefb0.zip |
SoundPlayer: Port M3UParser to Core::Stream
Also make the path parameter a StringView, since that's what gets passed
in.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/SoundPlayer/M3UParser.cpp | 9 | ||||
-rw-r--r-- | Userland/Applications/SoundPlayer/M3UParser.h | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/Userland/Applications/SoundPlayer/M3UParser.cpp b/Userland/Applications/SoundPlayer/M3UParser.cpp index a09a40caa5..8f8a066d30 100644 --- a/Userland/Applications/SoundPlayer/M3UParser.cpp +++ b/Userland/Applications/SoundPlayer/M3UParser.cpp @@ -9,17 +9,16 @@ #include <AK/RefPtr.h> #include <AK/ScopeGuard.h> #include <AK/Utf8View.h> -#include <LibCore/File.h> +#include <LibCore/Stream.h> M3UParser::M3UParser() { } -NonnullOwnPtr<M3UParser> M3UParser::from_file(const String path) +NonnullOwnPtr<M3UParser> M3UParser::from_file(StringView path) { - auto file_result = Core::File::open(path, Core::OpenMode::ReadOnly); - VERIFY(!file_result.is_error()); - auto contents = file_result.value()->read_all(); + 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 use_utf8 = path.ends_with(".m3u8"sv, CaseSensitivity::CaseInsensitive); return from_memory(String { contents, NoChomp }, use_utf8); } diff --git a/Userland/Applications/SoundPlayer/M3UParser.h b/Userland/Applications/SoundPlayer/M3UParser.h index 31d3a7d71e..6965fe8fb3 100644 --- a/Userland/Applications/SoundPlayer/M3UParser.h +++ b/Userland/Applications/SoundPlayer/M3UParser.h @@ -32,7 +32,7 @@ struct M3UEntry { class M3UParser { public: - static NonnullOwnPtr<M3UParser> from_file(String path); + static NonnullOwnPtr<M3UParser> from_file(StringView path); static NonnullOwnPtr<M3UParser> from_memory(String const& m3u_contents, bool utf8); NonnullOwnPtr<Vector<M3UEntry>> parse(bool include_extended_info); |