1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:27:45 +00:00

LibAudio: Remove try_ prefix from fallible LoaderPlugin methods

This commit is contained in:
Linus Groh 2023-01-28 20:12:17 +00:00 committed by Jelle Raaijmakers
parent ee0297d9ec
commit 3a9225608a
2 changed files with 6 additions and 6 deletions

View file

@ -21,7 +21,7 @@ Loader::Loader(NonnullOwnPtr<LoaderPlugin> plugin)
{ {
} }
Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> Loader::try_create(StringView path) Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> Loader::create_plugin(StringView path)
{ {
{ {
auto plugin = WavLoaderPlugin::create(path); auto plugin = WavLoaderPlugin::create(path);
@ -44,7 +44,7 @@ Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> Loader::try_create(StringView p
return LoaderError { "No loader plugin available" }; return LoaderError { "No loader plugin available" };
} }
Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> Loader::try_create(Bytes buffer) Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> Loader::create_plugin(Bytes buffer)
{ {
{ {
auto plugin = WavLoaderPlugin::create(buffer); auto plugin = WavLoaderPlugin::create(buffer);

View file

@ -65,8 +65,8 @@ protected:
class Loader : public RefCounted<Loader> { class Loader : public RefCounted<Loader> {
public: public:
static Result<NonnullRefPtr<Loader>, LoaderError> create(StringView path) { return adopt_ref(*new Loader(TRY(try_create(path)))); } static Result<NonnullRefPtr<Loader>, LoaderError> create(StringView path) { return adopt_ref(*new Loader(TRY(create_plugin(path)))); }
static Result<NonnullRefPtr<Loader>, LoaderError> create(Bytes buffer) { return adopt_ref(*new Loader(TRY(try_create(buffer)))); } static Result<NonnullRefPtr<Loader>, LoaderError> create(Bytes buffer) { return adopt_ref(*new Loader(TRY(create_plugin(buffer)))); }
LoaderSamples get_more_samples(size_t max_samples_to_read_from_input = 128 * KiB) const { return m_plugin->get_more_samples(max_samples_to_read_from_input); } LoaderSamples get_more_samples(size_t max_samples_to_read_from_input = 128 * KiB) const { return m_plugin->get_more_samples(max_samples_to_read_from_input); }
@ -82,8 +82,8 @@ public:
Vector<PictureData> const& pictures() const { return m_plugin->pictures(); }; Vector<PictureData> const& pictures() const { return m_plugin->pictures(); };
private: private:
static Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> try_create(StringView path); static Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> create_plugin(StringView path);
static Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> try_create(Bytes buffer); static Result<NonnullOwnPtr<LoaderPlugin>, LoaderError> create_plugin(Bytes buffer);
explicit Loader(NonnullOwnPtr<LoaderPlugin>); explicit Loader(NonnullOwnPtr<LoaderPlugin>);