summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AK/Base64.cpp2
-rw-r--r--AK/Base64.h3
-rw-r--r--AK/Tests/TestBase64.cpp2
-rw-r--r--Libraries/LibWeb/Bindings/WindowObject.cpp4
-rw-r--r--Userland/base64.cpp2
5 files changed, 7 insertions, 6 deletions
diff --git a/AK/Base64.cpp b/AK/Base64.cpp
index 91e067c2a0..950407e26b 100644
--- a/AK/Base64.cpp
+++ b/AK/Base64.cpp
@@ -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;
diff --git a/AK/Base64.h b/AK/Base64.h
index dc3b9c4975..758e78547d 100644
--- a/AK/Base64.h
+++ b/AK/Base64.h
@@ -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);
}
diff --git a/AK/Tests/TestBase64.cpp b/AK/Tests/TestBase64.cpp
index 9e65c03a83..5b19bcd544 100644
--- a/AK/Tests/TestBase64.cpp
+++ b/AK/Tests/TestBase64.cpp
@@ -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));
};
diff --git a/Libraries/LibWeb/Bindings/WindowObject.cpp b/Libraries/LibWeb/Bindings/WindowObject.cpp
index 6e604ec2f1..de382cf9ba 100644
--- a/Libraries/LibWeb/Bindings/WindowObject.cpp
+++ b/Libraries/LibWeb/Bindings/WindowObject.cpp
@@ -28,8 +28,8 @@
#include <AK/ByteBuffer.h>
#include <AK/FlyString.h>
#include <AK/Function.h>
-#include <AK/Utf8View.h>
#include <AK/String.h>
+#include <AK/Utf8View.h>
#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/Error.h>
#include <LibJS/Runtime/Function.h>
@@ -278,7 +278,7 @@ JS_DEFINE_NATIVE_FUNCTION(WindowObject::btoa)
byte_string.append(codepoint);
}
- auto encoded = encode_base64(ByteBuffer::wrap(byte_string.data(), byte_string.size()));
+ auto encoded = encode_base64(byte_string.span());
return JS::js_string(interpreter, move(encoded));
}
diff --git a/Userland/base64.cpp b/Userland/base64.cpp
index 0af7a684a4..a91275a0c8 100644
--- a/Userland/base64.cpp
+++ b/Userland/base64.cpp
@@ -75,6 +75,6 @@ int main(int argc, char** argv)
return 0;
}
- auto encoded = encode_base64(buffer);
+ auto encoded = encode_base64(buffer.span());
printf("%s\n", encoded.characters());
}