mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:07:44 +00:00
LibTextCodec+Everywhere: Port Decoders to new Strings
This commit is contained in:
parent
3c5090e172
commit
2db168acc1
21 changed files with 149 additions and 123 deletions
|
@ -703,7 +703,7 @@ ErrorOr<NonnullRefPtr<MultiLocalizedUnicodeTagData>> MultiLocalizedUnicodeTagDat
|
|||
return Error::from_string_literal("ICC::Profile: multiLocalizedUnicodeType string offset out of bounds");
|
||||
|
||||
StringView utf_16be_data { bytes.data() + record.string_offset_in_bytes, record.string_length_in_bytes };
|
||||
records[i].text = TRY(String::from_deprecated_string(utf_16be_decoder.to_utf8(utf_16be_data)));
|
||||
records[i].text = TRY(utf_16be_decoder.to_utf8(utf_16be_data));
|
||||
}
|
||||
|
||||
return try_make_ref_counted<MultiLocalizedUnicodeTagData>(offset, size, move(records));
|
||||
|
@ -955,7 +955,7 @@ ErrorOr<NonnullRefPtr<TextDescriptionTagData>> TextDescriptionTagData::from_byte
|
|||
return Error::from_string_literal("ICC::Profile: textDescriptionType Unicode description not \\0-terminated");
|
||||
|
||||
StringView utf_16be_data { unicode_description_data, byte_size_without_nul };
|
||||
unicode_description = TRY(String::from_deprecated_string(TextCodec::decoder_for("utf-16be"sv)->to_utf8(utf_16be_data)));
|
||||
unicode_description = TRY(TextCodec::decoder_for("utf-16be"sv)->to_utf8(utf_16be_data));
|
||||
}
|
||||
|
||||
// ScriptCode
|
||||
|
@ -1001,7 +1001,7 @@ ErrorOr<NonnullRefPtr<TextDescriptionTagData>> TextDescriptionTagData::from_byte
|
|||
if (macintosh_description_data[macintosh_description_length - 1] != '\0')
|
||||
return Error::from_string_literal("ICC::Profile: textDescriptionType ScriptCode not \\0-terminated");
|
||||
|
||||
macintosh_description = TRY(String::from_deprecated_string(TextCodec::decoder_for("x-mac-roman"sv)->to_utf8({ macintosh_description_data, (size_t)macintosh_description_length - 1 })));
|
||||
macintosh_description = TRY(TextCodec::decoder_for("x-mac-roman"sv)->to_utf8({ macintosh_description_data, (size_t)macintosh_description_length - 1 }));
|
||||
} else {
|
||||
dbgln("TODO: ICCProfile textDescriptionType ScriptCode {}, length {}", scriptcode_code, macintosh_description_length);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue