mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:17:35 +00:00
AK/ByteBuffer+Everywhere: Handle errors in ByteBuffer::slice()
This commit is contained in:
parent
c0486f93d4
commit
c10d48b72c
12 changed files with 45 additions and 34 deletions
|
@ -130,7 +130,8 @@ Value ArrayBuffer::get_value(size_t byte_index, [[maybe_unused]] bool is_typed_a
|
|||
|
||||
// FIXME: Check for shared buffer
|
||||
|
||||
auto raw_value = buffer_impl().slice(byte_index, element_size);
|
||||
// FIXME: Propagate errors.
|
||||
auto raw_value = MUST(buffer_impl().slice(byte_index, element_size));
|
||||
return raw_bytes_to_numeric<T>(global_object(), move(raw_value), is_little_endian);
|
||||
}
|
||||
|
||||
|
@ -218,7 +219,8 @@ Value ArrayBuffer::get_modify_set_value(size_t byte_index, Value value, ReadWrit
|
|||
|
||||
// FIXME: Check for shared buffer
|
||||
|
||||
auto raw_bytes_read = buffer_impl().slice(byte_index, sizeof(T));
|
||||
// FIXME: Propagate errors.
|
||||
auto raw_bytes_read = MUST(buffer_impl().slice(byte_index, sizeof(T)));
|
||||
auto raw_bytes_modified = operation(raw_bytes_read, raw_bytes);
|
||||
raw_bytes_modified.span().copy_to(buffer_impl().span().slice(byte_index));
|
||||
|
||||
|
|
|
@ -246,7 +246,8 @@ static ThrowCompletionOr<Value> atomic_compare_exchange_impl(GlobalObject& globa
|
|||
// 14. Else,
|
||||
|
||||
// a. Let rawBytesRead be a List of length elementSize whose elements are the sequence of elementSize bytes starting with block[indexedPosition].
|
||||
auto raw_bytes_read = block.slice(indexed_position, sizeof(T));
|
||||
// FIXME: Propagate errors.
|
||||
auto raw_bytes_read = MUST(block.slice(indexed_position, sizeof(T)));
|
||||
|
||||
// b. If ByteListEqual(rawBytesRead, expectedBytes) is true, then
|
||||
// i. Store the individual bytes of replacementBytes into block, starting at block[indexedPosition].
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue