summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2001-12-28 21:52:04 +0000
committerTor Lillqvist <tml@src.gnome.org>2001-12-28 21:52:04 +0000
commit12c7fc52d8bb26222e766b1b330de855b42d1bf8 (patch)
tree8be47a02554bb073e4f42af0ce3ce4232198d8b0 /gdk
parentb18a75d869b5d4038e3a2f48472b10c95df9374d (diff)
downloadgtk+-12c7fc52d8bb26222e766b1b330de855b42d1bf8.tar.gz
Use G_N_ELEMENTS(). (unicode_classify): Don't return -1 on encountering an
2001-12-28 Tor Lillqvist <tml@iki.fi> * gdk/win32/gdkfont-win32.c: Use G_N_ELEMENTS(). (unicode_classify): Don't return -1 on encountering an unclassified character, but play it safe and return U_BASIC_LATIN.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/win32/gdkfont-win32.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/gdk/win32/gdkfont-win32.c b/gdk/win32/gdkfont-win32.c
index 1dd5ae1b87..264c160b89 100644
--- a/gdk/win32/gdkfont-win32.c
+++ b/gdk/win32/gdkfont-win32.c
@@ -695,12 +695,12 @@ static void
print_unicode_subranges (FONTSIGNATURE *fsp)
{
int i;
- gboolean checked[sizeof (utab) / sizeof (utab[0])];
+ gboolean checked[G_N_ELEMENTS (utab)];
gboolean need_comma = FALSE;
memset (checked, 0, sizeof (checked));
- for (i = 0; i < sizeof (utab) / sizeof (utab[0]); i++)
+ for (i = 0; i < G_N_ELEMENTS (utab); i++)
if (!checked[i]
&& (fsp->fsUsb[utab[i].bit/32] & (1 << (utab[i].bit % 32))))
{
@@ -1770,7 +1770,7 @@ static int
unicode_classify (wchar_t wc)
{
int min = 0;
- int max = sizeof (utab) / sizeof (utab[0]) - 1;
+ int max = G_N_ELEMENTS (utab) - 1;
int mid;
while (max >= min)
@@ -1783,10 +1783,13 @@ unicode_classify (wchar_t wc)
else if (utab[mid].low <= wc && wc <= utab[mid].high)
return utab[mid].bit;
else
- return -1;
+ break;
}
- /* NOTREACHED */
- return -1;
+ /* Fallback... returning -1 might cause problems. Returning
+ * U_BASIC_LATIN won't help handling strange characters, but won't
+ * do harm either.
+ */
+ return U_BASIC_LATIN;
}
void