Robert Shearman rob@codeweavers.com writes:
/* hexadecimal entity */
while ((*p >= '0' && *p <= '9') || (*p >= 'a' && *p <= 'f') ||
(*p >= 'A' && *p <= 'F') || (*p == ';'))
p++;
You should exit the loop at the first ';'. Also you have to increment p first.
while (isalpha(*p))
p++;
You can't use ASCII ctype functions on Unicode chars.
for (i = 0; i < sizeof(char_refs)/sizeof(char_refs[0]); i++)
if (p - start - 1 <= sizeof(char_refs[i].name))
{
if (!strncmpW(char_refs[i].name, start + 1, p - start - 1))
break;
}
The sizeof check doesn't make much sense, especially inside the loop. What you need is to check that you reached the end of the string if the strncmpW succeeded.