From b7a120c47ed5cbdafb8244e3e87d78c536b08723 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 22 Mar 2024 21:25:16 -0400 Subject: [PATCH] LibGfx/ISOBMFF: Remove Box::read_from_stream() This doesn't have to be a virtual method: it's called from various create_from_stream() methods that have a static type that's created. There's no point in the virtual call here, and it makes it harder to add additional parameters to read_from_stream() in some subclasses. --- Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/Boxes.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/Boxes.h b/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/Boxes.h index 436c5adfb5e..f2be661a453 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/Boxes.h +++ b/Userland/Libraries/LibGfx/ImageFormats/ISOBMFF/Boxes.h @@ -31,7 +31,6 @@ ErrorOr read_box_header(BoxStream& stream); struct Box { Box() = default; virtual ~Box() = default; - virtual ErrorOr read_from_stream(BoxStream&) { return {}; } virtual BoxType box_type() const { return BoxType::None; } virtual void dump(String const& prepend = {}) const; }; @@ -39,7 +38,7 @@ struct Box { using BoxList = Vector>; struct FullBox : public Box { - virtual ErrorOr read_from_stream(BoxStream& stream) override; + ErrorOr read_from_stream(BoxStream& stream); virtual void dump(String const& prepend = {}) const override; u8 version { 0 }; @@ -59,7 +58,7 @@ struct UnknownBox final : public Box { { } virtual ~UnknownBox() override = default; - virtual ErrorOr read_from_stream(BoxStream&) override; + ErrorOr read_from_stream(BoxStream&); virtual BoxType box_type() const override { return m_box_type; } virtual void dump(String const& prepend = {}) const override; @@ -77,7 +76,7 @@ private: } \ BoxName() = default; \ virtual ~BoxName() override = default; \ - virtual ErrorOr read_from_stream(BoxStream& stream) override; \ + ErrorOr read_from_stream(BoxStream& stream); \ virtual BoxType box_type() const override \ { \ return BoxType::BoxName; \ @@ -96,7 +95,7 @@ struct FileTypeBox final : public Box { // A box that contains other boxes. struct SuperBox : public Box { SuperBox() = default; - virtual ErrorOr read_from_stream(BoxStream&) override; + ErrorOr read_from_stream(BoxStream&); virtual void dump(String const& prepend = {}) const override; private: