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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user