From 2f4a83215c4db75d00d262e09658620b73c4a188 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 23 Jan 2023 18:23:04 -0500 Subject: [PATCH] LibGfx: Move TagTableEntry into read_tag_table It's now used only there. --- Userland/Libraries/LibGfx/ICCProfile.cpp | 22 ++++++++++------------ Userland/Libraries/LibGfx/ICCProfile.h | 4 ---- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/Userland/Libraries/LibGfx/ICCProfile.cpp b/Userland/Libraries/LibGfx/ICCProfile.cpp index 92aa0a54f6..a6e5a14807 100644 --- a/Userland/Libraries/LibGfx/ICCProfile.cpp +++ b/Userland/Libraries/LibGfx/ICCProfile.cpp @@ -116,17 +116,7 @@ struct ICCHeader { u8 reserved[28]; }; static_assert(sizeof(ICCHeader) == 128); -} -// ICC V4, 7.3 Tag table, Table 24 - Tag table structure -struct Detail::TagTableEntry { - BigEndian tag_signature; - BigEndian offset_to_beginning_of_tag_data_element; - BigEndian size_of_tag_data_element; -}; -static_assert(sizeof(Detail::TagTableEntry) == 12); - -namespace { ErrorOr parse_size(ICCHeader const& header, ReadonlyBytes icc_bytes) { // ICC v4, 7.2.2 Profile size field @@ -983,10 +973,18 @@ ErrorOr Profile::read_tag_table(ReadonlyBytes bytes) return Error::from_string_literal("ICC::Profile: Not enough data for tag count"); auto tag_count = *bit_cast const*>(tag_table_bytes.data()); + // ICC V4, 7.3 Tag table, Table 24 - Tag table structure + struct TagTableEntry { + BigEndian tag_signature; + BigEndian offset_to_beginning_of_tag_data_element; + BigEndian size_of_tag_data_element; + }; + static_assert(sizeof(TagTableEntry) == 12); + tag_table_bytes = tag_table_bytes.slice(sizeof(u32)); - if (tag_table_bytes.size() < tag_count * sizeof(Detail::TagTableEntry)) + if (tag_table_bytes.size() < tag_count * sizeof(TagTableEntry)) return Error::from_string_literal("ICC::Profile: Not enough data for tag table entries"); - auto tag_table_entries = bit_cast(tag_table_bytes.data()); + auto tag_table_entries = bit_cast(tag_table_bytes.data()); for (u32 i = 0; i < tag_count; ++i) { // FIXME: optionally ignore tags with unknown signature diff --git a/Userland/Libraries/LibGfx/ICCProfile.h b/Userland/Libraries/LibGfx/ICCProfile.h index fb8296d34f..207c008228 100644 --- a/Userland/Libraries/LibGfx/ICCProfile.h +++ b/Userland/Libraries/LibGfx/ICCProfile.h @@ -495,10 +495,6 @@ private: Vector m_xyzs; }; -namespace Detail { -struct TagTableEntry; -} - class Profile : public RefCounted { public: static ErrorOr> try_load_from_externally_owned_memory(ReadonlyBytes);