summaryrefslogtreecommitdiff
path: root/AK/Utf16View.h
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-01-06 13:19:34 -0500
committerLinus Groh <mail@linusgroh.de>2023-01-08 12:13:15 +0100
commit1edb96376b51519fe9a7aff2d281f243ca19fd45 (patch)
tree6c1cafa408e6640a02f64d1c626c796a42bc95ea /AK/Utf16View.h
parentd8044c5358ab8440286f39c3d1efe2c5f39bc115 (diff)
downloadserenity-1edb96376b51519fe9a7aff2d281f243ca19fd45.zip
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.
Diffstat (limited to 'AK/Utf16View.h')
-rw-r--r--AK/Utf16View.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/AK/Utf16View.h b/AK/Utf16View.h
index cb43660b01..101f4e4892 100644
--- a/AK/Utf16View.h
+++ b/AK/Utf16View.h
@@ -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;