Commit 8e0d8109 authored by Max Kellermann's avatar Max Kellermann

tag/MixRamp: use StringView in ParseMixRampTagTemplate()

parent 0f1e13d9
......@@ -21,6 +21,7 @@
#include "VorbisComment.hxx"
#include "MixRampInfo.hxx"
#include "util/ASCII.hxx"
#include "util/StringView.hxx"
#include <assert.h>
......@@ -28,17 +29,19 @@ template<typename T>
static bool
ParseMixRampTagTemplate(MixRampInfo &info, const T t)
{
const char *value;
if ((value = t["mixramp_start"]) != nullptr) {
info.SetStart(value);
const auto start = t["mixramp_start"];
if (!start.IsNull()) {
info.SetStart(std::string(start.data, start.size));
return true;
} else if ((value = t["mixramp_end"]) != nullptr) {
info.SetEnd(value);
}
const auto end = t["mixramp_end"];
if (!start.IsNull()) {
info.SetEnd(std::string(end.data, end.size));
return true;
} else
return false;
}
return false;
}
bool
......@@ -52,7 +55,7 @@ ParseMixRampTag(MixRampInfo &info, const char *name, const char *value)
const char *value;
gcc_pure
const char *operator[](const char *n) const noexcept {
StringView operator[](const char *n) const noexcept {
return StringEqualsCaseASCII(name, n)
? value
: nullptr;
......@@ -69,7 +72,7 @@ ParseMixRampVorbis(MixRampInfo &info, const char *entry)
const char *entry;
gcc_pure
const char *operator[](const char *n) const noexcept {
StringView operator[](const char *n) const noexcept {
return vorbis_comment_value(entry, n);
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment