Browse Source

LibGfx: Move ICC ProfileFileSignature into a constant in BinaryFormat.h

...so that it can be used by ICC writing code too.
Nico Weber 2 years ago
parent
commit
0ca620a286

+ 4 - 0
Userland/Libraries/LibGfx/ICC/BinaryFormat.h

@@ -75,6 +75,10 @@ struct ICCHeader {
 };
 };
 static_assert(AssertSize<ICCHeader, 128>());
 static_assert(AssertSize<ICCHeader, 128>());
 
 
+// ICC v4, 7.2.9 Profile file signature field
+// "The profile file signature field shall contain the value “acsp” (61637370h) as a profile file signature."
+constexpr u32 ProfileFileSignature = 0x61637370;
+
 // Common bits of ICC v4, Table 40 — lut16Type encoding and Table 44 — lut8Type encoding
 // Common bits of ICC v4, Table 40 — lut16Type encoding and Table 44 — lut8Type encoding
 struct LUTHeader {
 struct LUTHeader {
     u8 number_of_input_channels;
     u8 number_of_input_channels;

+ 1 - 2
Userland/Libraries/LibGfx/ICC/Profile.cpp

@@ -179,8 +179,7 @@ ErrorOr<time_t> parse_creation_date_time(ICCHeader const& header)
 ErrorOr<void> parse_file_signature(ICCHeader const& header)
 ErrorOr<void> parse_file_signature(ICCHeader const& header)
 {
 {
     // ICC v4, 7.2.9 Profile file signature field
     // ICC v4, 7.2.9 Profile file signature field
-    // "The profile file signature field shall contain the value “acsp” (61637370h) as a profile file signature."
-    if (header.profile_file_signature != 0x61637370)
+    if (header.profile_file_signature != ProfileFileSignature)
         return Error::from_string_literal("ICC::Profile: profile file signature not 'acsp'");
         return Error::from_string_literal("ICC::Profile: profile file signature not 'acsp'");
     return {};
     return {};
 }
 }