mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +00:00
LibGfx: Move ICC::Profile towards "Fallible Constructors" pattern
Not quite there yet due to check_required_tags() / check_tag_types(), but getting closer :^)
This commit is contained in:
parent
db614b47dd
commit
9ba3c8e36d
2 changed files with 11 additions and 4 deletions
|
@ -1377,10 +1377,11 @@ ErrorOr<void> Profile::check_tag_types()
|
|||
|
||||
ErrorOr<NonnullRefPtr<Profile>> Profile::try_load_from_externally_owned_memory(ReadonlyBytes bytes)
|
||||
{
|
||||
auto profile = TRY(try_make_ref_counted<Profile>());
|
||||
profile->m_header = TRY(read_header(bytes));
|
||||
bytes = bytes.trim(profile->on_disk_size());
|
||||
profile->m_tag_table = TRY(read_tag_table(bytes));
|
||||
auto header = TRY(read_header(bytes));
|
||||
bytes = bytes.trim(header.on_disk_size);
|
||||
auto tag_table = TRY(read_tag_table(bytes));
|
||||
|
||||
auto profile = TRY(try_make_ref_counted<Profile>(header, move(tag_table)));
|
||||
|
||||
TRY(profile->check_required_tags());
|
||||
TRY(profile->check_tag_types());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue