diff -Nuard galeon-1.3.9.orig/embed/global-history.c galeon-1.3.9/embed/global-history.c --- galeon-1.3.9.orig/embed/global-history.c 2003-09-06 00:58:46.000000000 +0200 +++ galeon-1.3.9/embed/global-history.c 2003-09-16 23:13:42.000000000 +0200 @@ -171,8 +171,8 @@ static char * xml_decode_entity (const unsigned char *encoded) { - gchar *buffer; - gint i, j, length; + char *buffer; + char *src, *dst; if (encoded == NULL) { @@ -183,54 +183,53 @@ /* Optimize for case where no escape codes are found, otherwise * use the first found code as the starting index */ - if ((i = (char *) strstr (buffer, "&") - buffer) < 0) + if ((src = strchr (buffer, '&')) == NULL) { return buffer; } - - length = strlen (buffer); - for (j = i; i < length; i++) + + for (dst = src; *src != '\0'; src++) { - if (encoded[i] == '&') + if (*src == '&') { - if (strncmp (encoded + i + 1, "amp;", 4) == 0) + if (strncmp (src + 1, "amp;", 4) == 0) { - buffer[j++] = '&'; - i += 4; + *dst++ = '&'; + src += 4; } - else if (strncmp (encoded + i + 1, "lt;", 3) == 0) + else if (strncmp (src + 1, "lt;", 3) == 0) { - buffer[j++] = '<'; - i += 3; + *dst++ = '<'; + src += 3; } - else if (strncmp (encoded + i + 1, "gt;", 3) == 0) + else if (strncmp (src + 1, "gt;", 3) == 0) { - buffer[j++] = '>'; - i += 3; + *dst++ = '>'; + src += 3; } - else if (strncmp (encoded + i + 1, "quot;", 5) == 0) + else if (strncmp (src + 1, "quot;", 5) == 0) { - buffer[j++] = '"'; - i += 5; + *dst++ = '"'; + src += 5; } - else if (strncmp (encoded + i + 1, "apos;", 5) == 0) + else if (strncmp (src + 1, "apos;", 5) == 0) { - buffer[j++] = '\''; - i += 5; + *dst++ = '\''; + src += 5; } - else if (encoded[i + 1] == '#') + else if (src[1] == '#') { - buffer[j++] = atoi (encoded + i + 2); - i += 5; + *dst++ = atoi (src + 2); + src += 5; } } else { - buffer[j++] = encoded[i]; + *dst++ = *src; } } - buffer[j] = '\0'; + *dst++ = '\0'; return buffer; }