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;
|
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)
|
*p = entities[i].repl;
|
||||||
continue;
|
g_strlcpy(p + 1, p + slen, strlen(p) - slen);
|
||||||
|
}
|
||||||
*p = entities[i].repl;
|
|
||||||
g_strlcpy(p + 1, p + slen, strlen(p) - slen);
|
|
||||||
}
|
}
|
||||||
return txt;
|
return txt;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user