playlist/xspf: concatenate multiple CharacterData fragments
Closes https://github.com/MusicPlayerDaemon/MPD/issues/781
This commit is contained in:
parent
e0a8fd398c
commit
c45f113856
2
NEWS
2
NEWS
|
@ -1,6 +1,8 @@
|
||||||
ver 0.21.21 (not yet released)
|
ver 0.21.21 (not yet released)
|
||||||
* configuration
|
* configuration
|
||||||
- fix bug in "metadata_to_use" setting
|
- fix bug in "metadata_to_use" setting
|
||||||
|
* playlist
|
||||||
|
- xspf: fix corrupt tags in the presence of XML entities
|
||||||
* archive
|
* archive
|
||||||
- iso9660: skip empty file names to work around libcdio bug
|
- iso9660: skip empty file names to work around libcdio bug
|
||||||
* decoder
|
* decoder
|
||||||
|
|
|
@ -61,6 +61,8 @@ struct XspfParser {
|
||||||
std::string location;
|
std::string location;
|
||||||
|
|
||||||
TagBuilder tag_builder;
|
TagBuilder tag_builder;
|
||||||
|
|
||||||
|
std::string value;
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr struct tag_table xspf_tag_elements[] = {
|
static constexpr struct tag_table xspf_tag_elements[] = {
|
||||||
|
@ -81,6 +83,7 @@ xspf_start_element(void *user_data, const XML_Char *element_name,
|
||||||
gcc_unused const XML_Char **atts)
|
gcc_unused const XML_Char **atts)
|
||||||
{
|
{
|
||||||
XspfParser *parser = (XspfParser *)user_data;
|
XspfParser *parser = (XspfParser *)user_data;
|
||||||
|
parser->value.clear();
|
||||||
|
|
||||||
switch (parser->state) {
|
switch (parser->state) {
|
||||||
case XspfParser::ROOT:
|
case XspfParser::ROOT:
|
||||||
|
@ -154,10 +157,21 @@ xspf_end_element(void *user_data, const XML_Char *element_name)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XspfParser::TAG:
|
case XspfParser::TAG:
|
||||||
|
if (!parser->value.empty())
|
||||||
|
parser->tag_builder.AddItem(parser->tag_type,
|
||||||
|
StringView(parser->value.data(),
|
||||||
|
parser->value.length()));
|
||||||
|
|
||||||
|
parser->state = XspfParser::TRACK;
|
||||||
|
break;
|
||||||
|
|
||||||
case XspfParser::LOCATION:
|
case XspfParser::LOCATION:
|
||||||
|
parser->location = std::move(parser->value);
|
||||||
parser->state = XspfParser::TRACK;
|
parser->state = XspfParser::TRACK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parser->value.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void XMLCALL
|
static void XMLCALL
|
||||||
|
@ -173,13 +187,8 @@ xspf_char_data(void *user_data, const XML_Char *s, int len)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XspfParser::TAG:
|
case XspfParser::TAG:
|
||||||
parser->tag_builder.AddItem(parser->tag_type,
|
|
||||||
StringView(s, len));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case XspfParser::LOCATION:
|
case XspfParser::LOCATION:
|
||||||
parser->location.assign(s, len);
|
parser->value.append(s, len);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue