IcyMetaDataParser: pass StringView to icy_add_item()

This commit is contained in:
Max Kellermann 2019-07-05 17:17:44 +02:00
parent d663f81420
commit d8bcdca7ff

View File

@ -67,18 +67,16 @@ IcyMetaDataParser::Data(size_t length) noexcept
}
static void
icy_add_item(TagBuilder &tag, TagType type, const char *value) noexcept
icy_add_item(TagBuilder &tag, TagType type, StringView value) noexcept
{
size_t length = strlen(value);
if (length >= 2 && value[0] == '\'' && value[length - 1] == '\'') {
if (value.size >= 2 && value.front() == '\'' && value.back() == '\'') {
/* strip the single quotes */
++value;
length -= 2;
++value.data;
value.size -= 2;
}
if (length > 0)
tag.AddItem(type, {value, length});
if (value.size > 0)
tag.AddItem(type, value);
}
static void