lib/xiph/ScanVorbisComment: use std::string_view

This commit is contained in:
Max Kellermann 2022-07-01 11:30:11 +02:00
parent 96f99aeb8f
commit 9d50306e2f
2 changed files with 7 additions and 6 deletions

View File

@ -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);
}

View File

@ -20,10 +20,11 @@
#ifndef MPD_SCAN_VORBIS_COMMENT_HXX
#define MPD_SCAN_VORBIS_COMMENT_HXX
struct StringView;
#include <string_view>
class TagHandler;
void
ScanVorbisComment(StringView comment, TagHandler &handler) noexcept;
ScanVorbisComment(std::string_view comment, TagHandler &handler) noexcept;
#endif