mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-29 13:46:31 +00:00
AK: Add a couple of validation-skipping UTF-16 string factories
String and FlyString are known to be valid UTF-8, so we can skip validation when constructing a UTF-16 string from them.
This commit is contained in:
parent
782f8c381c
commit
cd276235d7
Notes:
github-actions[bot]
2025-08-05 11:08:38 +00:00
Author: https://github.com/trflynn89
Commit: cd276235d7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5698
2 changed files with 7 additions and 0 deletions
|
@ -21,6 +21,8 @@ public:
|
||||||
constexpr Utf16FlyString() = default;
|
constexpr Utf16FlyString() = default;
|
||||||
|
|
||||||
static Utf16FlyString from_utf8(StringView);
|
static Utf16FlyString from_utf8(StringView);
|
||||||
|
static Utf16FlyString from_utf8(String const& string) { return from_utf8_without_validation(string); }
|
||||||
|
static Utf16FlyString from_utf8(FlyString const& string) { return from_utf8_without_validation(string); }
|
||||||
static Utf16FlyString from_utf8_without_validation(StringView);
|
static Utf16FlyString from_utf8_without_validation(StringView);
|
||||||
static Utf16FlyString from_utf8_but_should_be_ported_to_utf16(StringView string) { return from_utf8_without_validation(string); }
|
static Utf16FlyString from_utf8_but_should_be_ported_to_utf16(StringView string) { return from_utf8_without_validation(string); }
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,11 @@ public:
|
||||||
return from_utf8_without_validation(utf8_string);
|
return from_utf8_without_validation(utf8_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ALWAYS_INLINE static Utf16String from_utf8(FlyString const& utf8_string)
|
||||||
|
{
|
||||||
|
return from_utf8_without_validation(utf8_string);
|
||||||
|
}
|
||||||
|
|
||||||
enum class WithBOMHandling {
|
enum class WithBOMHandling {
|
||||||
No,
|
No,
|
||||||
Yes,
|
Yes,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue