Commit graph

6 commits

Author SHA1 Message Date
Timothy Flynn 507a5d8a07 AK: Add an option to zero-fill ByteBuffer data upon growth
This is to avoid UB in cases where we need to be able to read from the
buffer immediately after resizing it.
2023-12-27 19:30:39 +01:00
Luke Wilde d9d556fbab AK: Allow Vector<ByteBuffer>::contains_slow to accept (Readonly)Bytes
This is done by providing Traits<ByteBuffer>::equals functions for
(Readonly)Bytes, as the base GenericTraits<T>::equals is unable to
convert the ByteBuffer to (Readonly)Bytes to then use Span::operator==

This allows us to check if a Vector<ByteBuffer> contains a
(Readonly)Bytes without having to making a copy of it into a ByteBuffer
first. The initial use of this is in LibWeb with CORS-preflight, where
we check the split contents of the Access-Control headers with
Fetch::Infrastructure::Request::method() and static StringViews
such as "*"sv.bytes().
2023-02-10 22:18:19 +00:00
Ben Wiederhake e147d0b572 AK: Fix all quadratic-time append-loops over ByteBuffer 2023-01-31 16:58:25 +01:00
Sam Atkins 45cf40653a Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOr
Apologies for the enormous commit, but I don't see a way to split this
up nicely. In the vast majority of cases it's a simple change. A few
extra places can use TRY instead of manual error checking though. :^)
2022-01-24 22:36:09 +01:00
Ali Mohammad Pur 97e97bccab Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe 2021-09-06 01:53:26 +02:00
Brian Gianforcaro 67322b0702 Tests: Move AK tests to Tests/AK 2021-05-06 17:54:28 +02:00
Renamed from AK/Tests/TestByteBuffer.cpp (Browse further)