1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:57:35 +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

@ -7,6 +7,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/Error.h>
#include <AK/Format.h>
#include <AK/Forward.h>
#include <AK/Optional.h>
@ -18,10 +19,10 @@ namespace AK {
using Utf16Data = Vector<u16, 1>;
Utf16Data utf8_to_utf16(StringView);
Utf16Data utf8_to_utf16(Utf8View const&);
Utf16Data utf32_to_utf16(Utf32View const&);
void code_point_to_utf16(Utf16Data&, u32);
ErrorOr<Utf16Data> utf8_to_utf16(StringView);
ErrorOr<Utf16Data> utf8_to_utf16(Utf8View const&);
ErrorOr<Utf16Data> utf32_to_utf16(Utf32View const&);
ErrorOr<void> code_point_to_utf16(Utf16Data&, u32);
class Utf16View;