lib/curl/Escape: use std::string_view instead of StringView

This commit is contained in:
Max Kellermann 2022-05-31 13:22:14 +02:00
parent c074338f4c
commit 759da033fc
2 changed files with 10 additions and 11 deletions

View File

@ -33,7 +33,7 @@
#include "util/IterableSplitString.hxx"
std::string
CurlEscapeUriPath(CURL *curl, StringView src) noexcept
CurlEscapeUriPath(CURL *curl, std::string_view src) noexcept
{
std::string dest;
@ -48,23 +48,23 @@ CurlEscapeUriPath(CURL *curl, StringView src) noexcept
}
std::string
CurlEscapeUriPath(StringView src) noexcept
CurlEscapeUriPath(std::string_view src) noexcept
{
CurlEasy easy;
return CurlEscapeUriPath(easy.Get(), src);
}
std::string
CurlUnescape(CURL *curl, StringView src) noexcept
CurlUnescape(CURL *curl, std::string_view src) noexcept
{
int outlength;
CurlString tmp(curl_easy_unescape(curl, src.data, src.size,
CurlString tmp(curl_easy_unescape(curl, src.data(), src.size(),
&outlength));
return {tmp.c_str(), size_t(outlength)};
}
std::string
CurlUnescape(StringView src) noexcept
CurlUnescape(std::string_view src) noexcept
{
CurlEasy easy;
return CurlUnescape(easy.Get(), src);

View File

@ -33,19 +33,18 @@
#include <curl/curl.h>
#include <string>
struct StringView;
#include <string_view>
std::string
CurlEscapeUriPath(CURL *curl, StringView src) noexcept;
CurlEscapeUriPath(CURL *curl, std::string_view src) noexcept;
std::string
CurlEscapeUriPath(StringView src) noexcept;
CurlEscapeUriPath(std::string_view src) noexcept;
std::string
CurlUnescape(CURL *curl, StringView src) noexcept;
CurlUnescape(CURL *curl, std::string_view src) noexcept;
std::string
CurlUnescape(StringView src) noexcept;
CurlUnescape(std::string_view src) noexcept;
#endif