After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 69907 - isspace used on char
isspace used on char
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: 1.0.0
Assigned To: Owen Taylor
Owen Taylor
Depends on:
Blocks:
 
 
Reported: 2002-01-28 18:36 UTC by Morten Welinder
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Morten Welinder 2002-01-28 18:36:08 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.
Comment 1 Owen Taylor 2002-02-01 16:31:24 UTC
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.)
Comment 2 Havoc Pennington 2002-02-01 16:53:27 UTC
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.
Comment 3 Owen Taylor 2002-02-01 17:39:34 UTC
Is GMarkup then going to be fixed to use the XML definition
of whitespace?
Comment 4 Havoc Pennington 2002-02-01 17:56:03 UTC
It probably should be.
Comment 5 Darin Adler 2002-02-09 22:32:05 UTC
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?
Comment 6 Havoc Pennington 2002-02-09 22:57:49 UTC
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.
Comment 7 Darin Adler 2002-02-10 05:57:19 UTC
I fixed all the stuff mentioned above.