From d8bcdca7ff43fcfb4f7866e2411eb74311b15a6f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 5 Jul 2019 17:17:44 +0200 Subject: [PATCH] IcyMetaDataParser: pass StringView to icy_add_item() --- src/IcyMetaDataParser.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/IcyMetaDataParser.cxx b/src/IcyMetaDataParser.cxx index e41d9e1e5..66aec8dac 100644 --- a/src/IcyMetaDataParser.cxx +++ b/src/IcyMetaDataParser.cxx @@ -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