From 6633c7fd42f8fc3633f5e8a82afec25f47557aca Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 20 May 2022 11:24:22 +0200 Subject: [PATCH] lib/crypto/Base64: use std::string_view --- src/lib/crypto/Base64.cxx | 5 ++--- src/lib/crypto/Base64.hxx | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/lib/crypto/Base64.cxx b/src/lib/crypto/Base64.cxx index 812e5096c..f68e35868 100644 --- a/src/lib/crypto/Base64.cxx +++ b/src/lib/crypto/Base64.cxx @@ -29,7 +29,6 @@ #include "Base64.hxx" #include "lib/ffmpeg/Error.hxx" -#include "util/StringView.hxx" extern "C" { #include @@ -38,11 +37,11 @@ extern "C" { #include size_t -DecodeBase64(std::span out, StringView in) +DecodeBase64(std::span 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()); } diff --git a/src/lib/crypto/Base64.hxx b/src/lib/crypto/Base64.hxx index a9e8d4679..3ab98ae1f 100644 --- a/src/lib/crypto/Base64.hxx +++ b/src/lib/crypto/Base64.hxx @@ -31,8 +31,7 @@ #include #include - -struct StringView; +#include 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 out, StringView in); +DecodeBase64(std::span out, std::string_view in); /** * Throws on error.