1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

LibTLS+Userland: Remove all uses of ByteBuffer::slice_view()

This was another way to get a non-owning ByteBuffer wrapper.
This commit is contained in:
Andreas Kling 2020-12-19 18:19:15 +01:00
parent d5600e966a
commit b30acdb4b7
4 changed files with 21 additions and 21 deletions

View file

@ -85,9 +85,9 @@ static bool test_single(const Testcase& testcase)
// Checking the results:
bool return_ok = actual_return == testcase.expected_return;
bool canary_1_ok = actual.slice_view(0, SANDBOX_CANARY_SIZE) == expected.slice_view(0, SANDBOX_CANARY_SIZE);
bool main_ok = actual.slice_view(SANDBOX_CANARY_SIZE, testcase.dest_n) == expected.slice_view(SANDBOX_CANARY_SIZE, testcase.dest_n);
bool canary_2_ok = actual.slice_view(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE) == expected.slice_view(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE);
bool canary_1_ok = actual.slice(0, SANDBOX_CANARY_SIZE) == expected.slice(0, SANDBOX_CANARY_SIZE);
bool main_ok = actual.slice(SANDBOX_CANARY_SIZE, testcase.dest_n) == expected.slice(SANDBOX_CANARY_SIZE, testcase.dest_n);
bool canary_2_ok = actual.slice(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE) == expected.slice(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE);
bool buf_ok = actual == expected;
// Evaluate gravity:
@ -98,20 +98,20 @@ static bool test_single(const Testcase& testcase)
if (!canary_1_ok) {
warnln("Canary 1 overwritten: Expected {}\n"
" instead got {}",
show(expected.slice_view(0, SANDBOX_CANARY_SIZE)),
show(actual.slice_view(0, SANDBOX_CANARY_SIZE)));
show(expected.slice(0, SANDBOX_CANARY_SIZE)),
show(actual.slice(0, SANDBOX_CANARY_SIZE)));
}
if (!main_ok) {
warnln("Wrong output: Expected {}\n"
" instead, got {}",
show(expected.slice_view(SANDBOX_CANARY_SIZE, testcase.dest_n)),
show(actual.slice_view(SANDBOX_CANARY_SIZE, testcase.dest_n)));
show(expected.slice(SANDBOX_CANARY_SIZE, testcase.dest_n)),
show(actual.slice(SANDBOX_CANARY_SIZE, testcase.dest_n)));
}
if (!canary_2_ok) {
warnln("Canary 2 overwritten: Expected {}\n"
" instead, got {}",
show(expected.slice_view(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE)),
show(actual.slice_view(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE)));
show(expected.slice(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE)),
show(actual.slice(SANDBOX_CANARY_SIZE + testcase.dest_n, SANDBOX_CANARY_SIZE)));
}
if (!return_ok) {
warnln("Wrong return value: Expected {}, got {} instead!", testcase.expected_return, actual_return);