1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:37:43 +00:00

AK+Everywhere: Make UTF-8 and UTF-32 to UTF-16 converters fallible

These could fail to allocate the underlying storage needed to store the
UTF-16 data. Propagate these errors.
This commit is contained in:
Timothy Flynn 2023-01-06 13:19:34 -05:00 committed by Linus Groh
parent d8044c5358
commit 1edb96376b
13 changed files with 46 additions and 35 deletions

View file

@ -754,7 +754,7 @@ TEST_CASE(ECMA262_unicode_match)
for (auto& test : tests) {
Regex<ECMA262> re(test.pattern, (ECMAScriptFlags)regex::AllFlags::Global | test.options);
auto subject = AK::utf8_to_utf16(test.subject);
auto subject = MUST(AK::utf8_to_utf16(test.subject));
Utf16View view { subject };
if constexpr (REGEX_DEBUG) {
@ -868,7 +868,7 @@ TEST_CASE(ECMA262_property_match)
for (auto& test : tests) {
Regex<ECMA262> re(test.pattern, (ECMAScriptFlags)regex::AllFlags::Global | regex::ECMAScriptFlags::BrowserExtended | test.options);
auto subject = AK::utf8_to_utf16(test.subject);
auto subject = MUST(AK::utf8_to_utf16(test.subject));
Utf16View view { subject };
if constexpr (REGEX_DEBUG) {