diff options
author | Max Kellermann <max@musicpd.org> | 2020-03-12 20:39:08 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2020-03-12 20:42:16 +0100 |
commit | 33694642bda981aa69f818fdc331f405df622443 (patch) | |
tree | 0a628bca285f79f554c50a46ada51337ca182246 | |
parent | c71242d74362671af2da4bbfb3d92f69ee86f97d (diff) |
playlist/asx: add State::TAG
-rw-r--r-- | src/playlist/plugins/AsxPlaylistPlugin.cxx | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/playlist/plugins/AsxPlaylistPlugin.cxx b/src/playlist/plugins/AsxPlaylistPlugin.cxx index b4a198815..daaaa18dd 100644 --- a/src/playlist/plugins/AsxPlaylistPlugin.cxx +++ b/src/playlist/plugins/AsxPlaylistPlugin.cxx @@ -42,6 +42,7 @@ struct AsxParser { */ enum { ROOT, ENTRY, + TAG, } state; /** @@ -82,7 +83,6 @@ asx_start_element(void *user_data, const XML_Char *element_name, if (StringEqualsCaseASCII(element_name, "entry")) { parser->state = AsxParser::ENTRY; parser->location.clear(); - parser->tag_type = TAG_NUM_OF_ITEM_TYPES; } break; @@ -93,10 +93,16 @@ asx_start_element(void *user_data, const XML_Char *element_name, ExpatParser::GetAttributeCase(atts, "href"); if (href != nullptr) parser->location = href; - } else + } else { parser->tag_type = tag_table_lookup_i(asx_tag_elements, element_name); + if (parser->tag_type != TAG_NUM_OF_ITEM_TYPES) + parser->state = AsxParser::TAG; + } + + break; + case AsxParser::TAG: break; } } @@ -117,10 +123,13 @@ asx_end_element(void *user_data, const XML_Char *element_name) parser->tag_builder.Commit()); parser->state = AsxParser::ROOT; - } else - parser->tag_type = TAG_NUM_OF_ITEM_TYPES; + } break; + + case AsxParser::TAG: + parser->state = AsxParser::ENTRY; + break; } } @@ -131,13 +140,12 @@ asx_char_data(void *user_data, const XML_Char *s, int len) switch (parser->state) { case AsxParser::ROOT: - break; - case AsxParser::ENTRY: - if (parser->tag_type != TAG_NUM_OF_ITEM_TYPES) - parser->tag_builder.AddItem(parser->tag_type, - StringView(s, len)); + break; + case AsxParser::TAG: + parser->tag_builder.AddItem(parser->tag_type, + StringView(s, len)); break; } } |