From ca46b4d7a710c9c1300461e05dc9fdf9c1c7ec86 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 1 Jul 2022 11:06:37 +0200 Subject: [PATCH] util/MimeType: use std::string_view --- src/util/MimeType.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/util/MimeType.cxx b/src/util/MimeType.cxx index cd752a2c0..0436b67b6 100644 --- a/src/util/MimeType.cxx +++ b/src/util/MimeType.cxx @@ -29,25 +29,25 @@ #include "MimeType.hxx" #include "IterableSplitString.hxx" -#include "StringView.hxx" +#include "util/StringSplit.hxx" +#include "util/StringStrip.hxx" std::string_view GetMimeTypeBase(std::string_view s) noexcept { - return StringView(s).Split(';').first; + return Split(s, ';').first; } std::map ParseMimeTypeParameters(std::string_view mime_type) noexcept { /* discard the first segment (the base MIME type) */ - const auto params = StringView(mime_type).Split(';').second; + const auto params = Split(mime_type, ';').second; std::map result; - for (auto i : IterableSplitString(params, ';')) { - i.Strip(); - auto s = i.Split('='); - if (!s.second.IsNull()) + for (const std::string_view i : IterableSplitString(params, ';')) { + const auto s = Split(Strip(i), '='); + if (!s.first.empty() && s.second.data() != nullptr) result.emplace(s); }