From cfd255a0144f906738d30b9c2446dcdfe9d7ac0a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 4 Jul 2022 14:48:45 +0200 Subject: [PATCH] lib/xiph: use std::string_view instead of StringView --- src/lib/xiph/FlacStreamMetadata.cxx | 7 ++++--- src/lib/xiph/VorbisComments.cxx | 11 +++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib/xiph/FlacStreamMetadata.cxx b/src/lib/xiph/FlacStreamMetadata.cxx index a06490d61..46a9714a5 100644 --- a/src/lib/xiph/FlacStreamMetadata.cxx +++ b/src/lib/xiph/FlacStreamMetadata.cxx @@ -28,11 +28,12 @@ #include "tag/MixRampParser.hxx" #include "tag/ReplayGainInfo.hxx" #include "tag/ReplayGainParser.hxx" -#include "util/StringView.hxx" #include -static StringView +using std::string_view_literals::operator""sv; + +static std::string_view ToStringView(const FLAC__StreamMetadata_VorbisComment_Entry &entry) noexcept { return {(const char *)entry.entry, entry.length}; @@ -106,7 +107,7 @@ Scan(const FLAC__StreamMetadata_Picture &picture, TagHandler &handler) noexcept return; if (picture.mime_type != nullptr && - StringIsEqual(picture.mime_type, "-->")) + "-->"sv == picture.mime_type) /* this is a URL, not image data */ return; diff --git a/src/lib/xiph/VorbisComments.cxx b/src/lib/xiph/VorbisComments.cxx index 8cd6472bf..994670a02 100644 --- a/src/lib/xiph/VorbisComments.cxx +++ b/src/lib/xiph/VorbisComments.cxx @@ -26,7 +26,6 @@ #include "tag/VorbisComment.hxx" #include "tag/ReplayGainInfo.hxx" #include "tag/ReplayGainParser.hxx" -#include "util/StringView.hxx" #include "decoder/Features.h" #ifndef HAVE_TREMOR @@ -44,7 +43,7 @@ ForEachUserComment(const vorbis_comment &vc, F &&f) const size_t n = vc.comments; for (size_t i = 0; i < n; ++i) - f(StringView{user_comments[i], size_t(comment_lengths[i])}); + f(std::string_view{user_comments[i], size_t(comment_lengths[i])}); } bool @@ -55,8 +54,8 @@ VorbisCommentToReplayGain(ReplayGainInfo &rgi, bool found = false; - ForEachUserComment(vc, [&](StringView s){ - if (ParseReplayGainVorbis(rgi, s.data)) + ForEachUserComment(vc, [&](std::string_view s){ + if (ParseReplayGainVorbis(rgi, s)) found = true; }); @@ -64,7 +63,7 @@ VorbisCommentToReplayGain(ReplayGainInfo &rgi, } static void -vorbis_scan_comment(StringView comment, TagHandler &handler) noexcept +vorbis_scan_comment(std::string_view comment, TagHandler &handler) noexcept { const auto picture_b64 = handler.WantPicture() ? GetVorbisCommentValue(comment, "METADATA_BLOCK_PICTURE") @@ -78,7 +77,7 @@ vorbis_scan_comment(StringView comment, TagHandler &handler) noexcept void VorbisCommentScan(const vorbis_comment &vc, TagHandler &handler) noexcept { - ForEachUserComment(vc, [&](StringView s){ + ForEachUserComment(vc, [&](std::string_view s){ vorbis_scan_comment(s, handler); }); }