From 9d50306e2f071420fa850bddef777e4d3d7da3ae Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 1 Jul 2022 11:30:11 +0200 Subject: [PATCH] lib/xiph/ScanVorbisComment: use std::string_view --- src/lib/xiph/ScanVorbisComment.cxx | 8 ++++---- src/lib/xiph/ScanVorbisComment.hxx | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib/xiph/ScanVorbisComment.cxx b/src/lib/xiph/ScanVorbisComment.cxx index e4132919d..cff465f7e 100644 --- a/src/lib/xiph/ScanVorbisComment.cxx +++ b/src/lib/xiph/ScanVorbisComment.cxx @@ -22,7 +22,7 @@ #include "tag/Table.hxx" #include "tag/Handler.hxx" #include "tag/VorbisComment.hxx" -#include "util/StringView.hxx" +#include "util/StringSplit.hxx" /** * Check if the comment's name equals the passed name, and if so, copy @@ -43,11 +43,11 @@ vorbis_copy_comment(std::string_view comment, } void -ScanVorbisComment(StringView comment, TagHandler &handler) noexcept +ScanVorbisComment(std::string_view comment, TagHandler &handler) noexcept { if (handler.WantPair()) { - const auto split = comment.Split('='); - if (!split.first.empty() && !split.second.IsNull()) + const auto split = Split(comment, '='); + if (!split.first.empty() && split.second.data() != nullptr) handler.OnPair(split.first, split.second); } diff --git a/src/lib/xiph/ScanVorbisComment.hxx b/src/lib/xiph/ScanVorbisComment.hxx index 8f843ab80..30e6487fc 100644 --- a/src/lib/xiph/ScanVorbisComment.hxx +++ b/src/lib/xiph/ScanVorbisComment.hxx @@ -20,10 +20,11 @@ #ifndef MPD_SCAN_VORBIS_COMMENT_HXX #define MPD_SCAN_VORBIS_COMMENT_HXX -struct StringView; +#include + class TagHandler; void -ScanVorbisComment(StringView comment, TagHandler &handler) noexcept; +ScanVorbisComment(std::string_view comment, TagHandler &handler) noexcept; #endif