1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 04:17:34 +00:00

AK: Change the signature of AK::encode_base64() to use Span.

This commit is contained in:
asynts 2020-07-27 14:16:33 +02:00 committed by Andreas Kling
parent 5fa0fdb219
commit abe925e4b0
5 changed files with 7 additions and 6 deletions

View file

@ -86,7 +86,7 @@ ByteBuffer decode_base64(const StringView& input)
return ByteBuffer::copy(output.data(), output.size());
}
String encode_base64(const ByteBuffer& input)
String encode_base64(ReadonlyBytes input)
{
StringBuilder output;

View file

@ -27,12 +27,13 @@
#pragma once
#include <AK/Forward.h>
#include <AK/Span.h>
namespace AK {
ByteBuffer decode_base64(const StringView&);
String encode_base64(const ByteBuffer&);
String encode_base64(ReadonlyBytes);
}

View file

@ -49,7 +49,7 @@ TEST_CASE(test_decode)
TEST_CASE(test_encode)
{
auto encode_equal = [&](const char* input, const char* expected) {
auto encoded = encode_base64(ByteBuffer::wrap(input, strlen(input)));
auto encoded = encode_base64({ input, strlen(input) });
EXPECT(encoded == String(expected));
};