summaryrefslogtreecommitdiff
path: root/Tests/LibC
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-04-02 13:08:43 -0400
committerAndreas Kling <kling@serenityos.org>2023-04-03 15:53:49 +0200
commit15532df83da6a8bd91db1b28431e0c14d5cbce05 (patch)
tree38811376618fee5a1fa8ae4d824db02853f3b5fe /Tests/LibC
parent5c045b693427f35b13b40f586fa63bd1d08e06ed (diff)
downloadserenity-15532df83da6a8bd91db1b28431e0c14d5cbce05.zip
AK+Everywhere: Change AK::fill_with_random to accept a Bytes object
Rather than the very C-like API we currently have, accepting a void* and a length, let's take a Bytes object instead. In almost all existing cases, the compiler figures out the length.
Diffstat (limited to 'Tests/LibC')
-rw-r--r--Tests/LibC/TestSnprintf.cpp2
-rw-r--r--Tests/LibC/TestStrlcpy.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/Tests/LibC/TestSnprintf.cpp b/Tests/LibC/TestSnprintf.cpp
index c7535db722..5f2bf01551 100644
--- a/Tests/LibC/TestSnprintf.cpp
+++ b/Tests/LibC/TestSnprintf.cpp
@@ -59,7 +59,7 @@ static bool test_single(Testcase<TArg> const& testcase)
// Setup
ByteBuffer actual = ByteBuffer::create_uninitialized(SANDBOX_CANARY_SIZE + testcase.dest_n + SANDBOX_CANARY_SIZE).release_value();
- fill_with_random(actual.data(), actual.size());
+ fill_with_random(actual);
ByteBuffer expected = actual;
VERIFY(actual.offset_pointer(0) != expected.offset_pointer(0));
actual.overwrite(SANDBOX_CANARY_SIZE, testcase.dest, testcase.dest_n);
diff --git a/Tests/LibC/TestStrlcpy.cpp b/Tests/LibC/TestStrlcpy.cpp
index 01d97e45c0..98317e13a3 100644
--- a/Tests/LibC/TestStrlcpy.cpp
+++ b/Tests/LibC/TestStrlcpy.cpp
@@ -56,7 +56,7 @@ static bool test_single(Testcase const& testcase)
// Setup
ByteBuffer actual = ByteBuffer::create_uninitialized(SANDBOX_CANARY_SIZE + testcase.dest_n + SANDBOX_CANARY_SIZE).release_value();
- fill_with_random(actual.data(), actual.size());
+ fill_with_random(actual);
ByteBuffer expected = actual;
VERIFY(actual.offset_pointer(0) != expected.offset_pointer(0));
actual.overwrite(SANDBOX_CANARY_SIZE, testcase.dest, testcase.dest_n);