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.
This commit is contained in:
Courtney Cavin 2009-07-28 16:40:52 -04:00
parent 0c66832b3b
commit 614a011845
1 changed files with 5 additions and 6 deletions

View File

@ -175,14 +175,13 @@ lastfm_xmldecode(const char *value)
unsigned int i; unsigned int i;
for (i = 0; i < sizeof(entities)/sizeof(entities[0]); ++i) { for (i = 0; i < sizeof(entities)/sizeof(entities[0]); ++i) {
char *p;
int slen = strlen(entities[i].text); int slen = strlen(entities[i].text);
char *p = strstr(txt, entities[i].text); while ((p = strstr(txt, entities[i].text))) {
if (p == NULL)
continue;
*p = entities[i].repl; *p = entities[i].repl;
g_strlcpy(p + 1, p + slen, strlen(p) - slen); g_strlcpy(p + 1, p + slen, strlen(p) - slen);
} }
}
return txt; return txt;
} }