mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-06 16:19:40 +00:00
AK+LibJS+LibWeb+LibRegex: Replace AK::Utf16Data with AK::Utf16String
This commit is contained in:
parent
a43cb15e81
commit
9582895759
Notes:
github-actions[bot]
2025-07-18 16:46:53 +00:00
Author: https://github.com/trflynn89
Commit: 9582895759
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5388
Reviewed-by: https://github.com/shannonbooth ✅
22 changed files with 101 additions and 222 deletions
|
@ -106,11 +106,10 @@ WebIDL::ExceptionOr<FileReader::Result> FileReader::blob_package_data(JS::Realm&
|
|||
return JS::ArrayBuffer::create(realm, move(bytes));
|
||||
case Type::BinaryString:
|
||||
// Return bytes as a binary string, in which every byte is represented by a code unit of equal value [0..255].
|
||||
Utf16Data builder;
|
||||
builder.ensure_capacity(bytes.size());
|
||||
StringBuilder builder(StringBuilder::Mode::UTF16, bytes.size());
|
||||
for (auto byte : bytes.bytes())
|
||||
builder.unchecked_append(byte);
|
||||
return MUST(Utf16View { builder }.to_utf8());
|
||||
builder.append_code_unit(byte);
|
||||
return MUST(builder.utf16_string_view().to_utf8());
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue