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.
This commit is contained in:
Tor Lillqvist 2001-12-28 21:52:04 +00:00 committed by Tor Lillqvist
parent b18a75d869
commit 12c7fc52d8
8 changed files with 51 additions and 6 deletions

View File

@ -1,3 +1,9 @@
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.
Thu Dec 27 16:05:30 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation

View File

@ -1,3 +1,9 @@
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.
Thu Dec 27 16:05:30 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation

View File

@ -1,3 +1,9 @@
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.
Thu Dec 27 16:05:30 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation

View File

@ -1,3 +1,9 @@
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.
Thu Dec 27 16:05:30 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation

View File

@ -1,3 +1,9 @@
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.
Thu Dec 27 16:05:30 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation

View File

@ -1,3 +1,9 @@
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.
Thu Dec 27 16:05:30 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation

View File

@ -1,3 +1,9 @@
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.
Thu Dec 27 16:05:30 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkarrow.c gtk/gtkimage.c gtkpixmap.c: Make interpretation

View File

@ -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