From 614a01184577eda5f24517bec9609f0ea6d7e97b Mon Sep 17 00:00:00 2001 From: Courtney Cavin Date: Tue, 28 Jul 2009 16:40:52 -0400 Subject: [PATCH] input/lastfm: Ensure multiple identical xml entities are decoded. Previously, if two identical entities appeared in one string, only the first would get decoded. This fixes that bug. --- src/input/lastfm_input_plugin.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/input/lastfm_input_plugin.c b/src/input/lastfm_input_plugin.c index 41882b00e..4de62dc3b 100644 --- a/src/input/lastfm_input_plugin.c +++ b/src/input/lastfm_input_plugin.c @@ -175,13 +175,12 @@ lastfm_xmldecode(const char *value) unsigned int i; for (i = 0; i < sizeof(entities)/sizeof(entities[0]); ++i) { + char *p; int slen = strlen(entities[i].text); - char *p = strstr(txt, entities[i].text); - if (p == NULL) - continue; - - *p = entities[i].repl; - g_strlcpy(p + 1, p + slen, strlen(p) - slen); + while ((p = strstr(txt, entities[i].text))) { + *p = entities[i].repl; + g_strlcpy(p + 1, p + slen, strlen(p) - slen); + } } return txt; }