From 02fe857755836ce8a9f5ecfcb3f57681b0672f49 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 30 Jun 2022 20:31:23 +0200 Subject: [PATCH] util/IterableSplitString: return std::string_view --- src/lib/curl/Escape.cxx | 2 +- src/util/IterableSplitString.hxx | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/lib/curl/Escape.cxx b/src/lib/curl/Escape.cxx index e97e0bd56..7ccb53ba8 100644 --- a/src/lib/curl/Escape.cxx +++ b/src/lib/curl/Escape.cxx @@ -38,7 +38,7 @@ CurlEscapeUriPath(CURL *curl, std::string_view src) noexcept std::string dest; for (const auto i : IterableSplitString(src, '/')) { - CurlString escaped(curl_easy_escape(curl, i.data, i.size)); + CurlString escaped(curl_easy_escape(curl, i.data(), i.size())); if (!dest.empty()) dest.push_back('/'); dest += escaped.c_str(); diff --git a/src/util/IterableSplitString.hxx b/src/util/IterableSplitString.hxx index 9b9350ee9..d57742c43 100644 --- a/src/util/IterableSplitString.hxx +++ b/src/util/IterableSplitString.hxx @@ -30,9 +30,9 @@ #pragma once #include "StringSplit.hxx" -#include "StringView.hxx" #include +#include /** * Split a string at a certain separator character into sub strings @@ -47,8 +47,6 @@ class BasicIterableSplitString { using string_view = std::basic_string_view; using value_type = typename string_view::value_type; - using StringView = BasicStringView; - string_view s; value_type separator; @@ -100,11 +98,11 @@ public: return !(*this == other); } - constexpr StringView operator*() const noexcept { + constexpr string_view operator*() const noexcept { return current; } - constexpr const StringView *operator->() const noexcept { + constexpr const string_view *operator->() const noexcept { return ¤t; } };