GNOME Bugzilla – Bug 69907
isspace used on char
Last modified: 2004-12-22 21:47:04 UTC
In pango/pango-markup.c, lines 617 and 958 (and probably many more), the is* family of functions is used on char arguments. This is wrong. Don't say "isdigit(c)", but instead "isdigit((unsigned char)c)" or some such. That's quite ugly, but works.
Switching to g_ascii_isspace() would fix this since it handles signed arguments fine. However, I'm not sure if g_ascii_isspace() is the right thing. g_ascii_isspace() I believe corresponds to the XML definition of whitespace (' ' '\t' '\r' \n') but GMarkup calls g_utf8_isspace() which allows a lot more characters. (Note that to call g_ascii_isspace() on a gunichar, you need to do char < 256 && g_ascii_ssspace(char) since we have the cast to guchar in the definition.)
I think I'd like to see: static gboolean is_xml_space (gunichar c); added to pango-markup.c and then use that.I think that's cleanest.
Is GMarkup then going to be fixed to use the XML definition of whitespace?
It probably should be.
If we use the XML definition of whitespace, then we can just use g_ascii_isspace, and ignore the fact that we are processing UTF-8, since all XML whitespace characters happen to be ASCII, right?
It depends on whether the set of chars considered a space by g_ascii_isspace() is exactly the same as the set of chars considered a space by the XML specification. It may be, I just haven't looked.
I fixed all the stuff mentioned above.