aboutsummaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
authorCourtney Cavin <ccavin@gmail.com>2009-07-28 16:40:52 -0400
committerCourtney Cavin <ccavin@gmail.com>2009-07-28 16:40:52 -0400
commit614a01184577eda5f24517bec9609f0ea6d7e97b (patch)
tree46484ab45e4cc9bde1e990077eea0479080608a0 /src/input
parent0c66832b3b20b67c759c5b513b7722a1a52ee9cf (diff)
downloadmpd-614a01184577eda5f24517bec9609f0ea6d7e97b.tar.gz
mpd-614a01184577eda5f24517bec9609f0ea6d7e97b.tar.xz
mpd-614a01184577eda5f24517bec9609f0ea6d7e97b.zip
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.
Diffstat (limited to 'src/input')
-rw-r--r--src/input/lastfm_input_plugin.c11
1 files 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;
}