From 2095e2529f3310f6ad0a59f1b6c5bd54c47b10d6 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 24 Jan 2023 15:24:39 -0500 Subject: [PATCH] icc: Print each tag signature's spec name The spec names are still a bit cryptic ("deviceMfgDescTag" for "device manufacturer description"), but less cryptic than just the fourcc. There's a private tag area, so this will only print the spec name of tags in the current spec. Private tags are in active use, e.g.: $ icc /Library/ColorSync/Profiles/WebSafeColors.icc ... Unknown tag ('dscm'): type 'mluc', offset 312, size 1490 (That's a v2 file. In v2, 'desc' has that strange textDescriptionType. In v4, 'desc' has type 'mluc' -- but in v2, it didn't yet, so Apple invented the private 'dscm' tag which has the description as an 'mluc'.) --- Userland/Libraries/LibGfx/ICCProfile.h | 2 +- Userland/Utilities/icc.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGfx/ICCProfile.h b/Userland/Libraries/LibGfx/ICCProfile.h index 954461e2931..2b787c4264a 100644 --- a/Userland/Libraries/LibGfx/ICCProfile.h +++ b/Userland/Libraries/LibGfx/ICCProfile.h @@ -114,7 +114,7 @@ URL device_model_url(DeviceModel); TAG(viewingCondDescTag, 0x76756564 /* 'vued' */) \ TAG(viewingConditionsTag, 0x76696577 /* 'view' */) -#define TAG(name, id) constexpr TagSignature name { id }; +#define TAG(name, id) constexpr inline TagSignature name { id }; ENUMERATE_TAG_SIGNATURES(TAG) #undef TAG diff --git a/Userland/Utilities/icc.cpp b/Userland/Utilities/icc.cpp index 57c338813fa..c965ba0d18c 100644 --- a/Userland/Utilities/icc.cpp +++ b/Userland/Utilities/icc.cpp @@ -93,7 +93,11 @@ ErrorOr serenity_main(Main::Arguments arguments) outln("tags:"); HashMap tag_data_to_first_signature; profile->for_each_tag([&tag_data_to_first_signature](auto tag_signature, auto tag_data) { - outln("{}: {}, offset {}, size {}", tag_signature, tag_data->type(), tag_data->offset(), tag_data->size()); + if (auto name = tag_signature_spec_name(tag_signature); name.has_value()) + out("{} ({}): ", *name, tag_signature); + else + out("Unknown tag ({}): ", tag_signature); + outln("type {}, offset {}, size {}", tag_data->type(), tag_data->offset(), tag_data->size()); // Print tag data only the first time it's seen. // (Different sigatures can refer to the same data.)