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

View File

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