lib/crypto/Base64: use std::string_view
This commit is contained in:
parent
01b32d5ee0
commit
6633c7fd42
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include "Base64.hxx"
|
||||
#include "lib/ffmpeg/Error.hxx"
|
||||
#include "util/StringView.hxx"
|
||||
|
||||
extern "C" {
|
||||
#include <libavutil/base64.h>
|
||||
|
@ -38,11 +37,11 @@ extern "C" {
|
|||
#include <string>
|
||||
|
||||
size_t
|
||||
DecodeBase64(std::span<std::byte> out, StringView in)
|
||||
DecodeBase64(std::span<std::byte> out, std::string_view in)
|
||||
{
|
||||
/* since av_base64_decode() wants a null-terminated string, we
|
||||
need to make a copy here and null-terminate it */
|
||||
const std::string copy(in.data, in.size);
|
||||
const std::string copy{in};
|
||||
return DecodeBase64(out, copy.c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,7 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
|
||||
struct StringView;
|
||||
#include <string_view>
|
||||
|
||||
constexpr size_t
|
||||
CalculateBase64OutputSize(size_t in_size) noexcept
|
||||
|
@ -44,7 +43,7 @@ CalculateBase64OutputSize(size_t in_size) noexcept
|
|||
* Throws on error.
|
||||
*/
|
||||
size_t
|
||||
DecodeBase64(std::span<std::byte> out, StringView in);
|
||||
DecodeBase64(std::span<std::byte> out, std::string_view in);
|
||||
|
||||
/**
|
||||
* Throws on error.
|
||||
|
|
Loading…
Reference in New Issue