From ad1906ae5ee01caac88354acaa12395aa3839aeb Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Tue, 14 Nov 2000 10:09:21 +0000 Subject: [PATCH] Use the glib iconv wrappers. 2000-11-14 Alexander Larsson * modules/linux-fb/basic.c: Use the glib iconv wrappers. --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ modules/linux-fb/basic.c | 31 +++++++++++++++---------------- 8 files changed, 50 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c27276af4..fd3876c633 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-11-14 Alexander Larsson + + * modules/linux-fb/basic.c: + Use the glib iconv wrappers. + 2000-11-13 Havoc Pennington * demos/gtk-demo/textview.c: spiff up the demo a bit; reveals diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 1c27276af4..fd3876c633 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +2000-11-14 Alexander Larsson + + * modules/linux-fb/basic.c: + Use the glib iconv wrappers. + 2000-11-13 Havoc Pennington * demos/gtk-demo/textview.c: spiff up the demo a bit; reveals diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 1c27276af4..fd3876c633 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2000-11-14 Alexander Larsson + + * modules/linux-fb/basic.c: + Use the glib iconv wrappers. + 2000-11-13 Havoc Pennington * demos/gtk-demo/textview.c: spiff up the demo a bit; reveals diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 1c27276af4..fd3876c633 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +2000-11-14 Alexander Larsson + + * modules/linux-fb/basic.c: + Use the glib iconv wrappers. + 2000-11-13 Havoc Pennington * demos/gtk-demo/textview.c: spiff up the demo a bit; reveals diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 1c27276af4..fd3876c633 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +2000-11-14 Alexander Larsson + + * modules/linux-fb/basic.c: + Use the glib iconv wrappers. + 2000-11-13 Havoc Pennington * demos/gtk-demo/textview.c: spiff up the demo a bit; reveals diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 1c27276af4..fd3876c633 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2000-11-14 Alexander Larsson + + * modules/linux-fb/basic.c: + Use the glib iconv wrappers. + 2000-11-13 Havoc Pennington * demos/gtk-demo/textview.c: spiff up the demo a bit; reveals diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 1c27276af4..fd3876c633 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2000-11-14 Alexander Larsson + + * modules/linux-fb/basic.c: + Use the glib iconv wrappers. + 2000-11-13 Havoc Pennington * demos/gtk-demo/textview.c: spiff up the demo a bit; reveals diff --git a/modules/linux-fb/basic.c b/modules/linux-fb/basic.c index 38c6841dec..b4b8b14a0a 100644 --- a/modules/linux-fb/basic.c +++ b/modules/linux-fb/basic.c @@ -19,9 +19,8 @@ * Boston, MA 02111-1307, USA. */ -#include - #include +#include #include #include #include "gdkprivate-fb.h" @@ -29,7 +28,7 @@ PangoGlyph pango_fb_get_unknown_glyph(PangoFont *font) { - return FT_Get_Char_Index(PANGO_FB_FONT(font)->ftf, '~'); + return FT_Get_Char_Index (PANGO_FB_FONT (font)->ftf, '~'); } typedef struct _CharRange CharRange; @@ -63,7 +62,7 @@ struct _CharCache #if 0 MaskTable *mask_tables[256]; #endif - iconv_t converters[MAX_CHARSETS]; + GIConv converters[MAX_CHARSETS]; }; struct _Charset @@ -143,7 +142,7 @@ char_cache_new (void) result = g_new0 (CharCache, 1); for (i=0; i < MAX_CHARSETS; i++) - result->converters[i] = (iconv_t)-1; + result->converters[i] = (GIConv)-1; return result; } @@ -165,8 +164,8 @@ char_cache_free (CharCache *cache) #endif for (i=0; iconverters[i] != (iconv_t)-1) - iconv_close (cache->converters[i]); + if (cache->converters[i] != (GIConv)-1) + g_iconv_close (cache->converters[i]); g_free (cache); } @@ -193,14 +192,14 @@ set_glyph (PangoFont *font, PangoGlyphString *glyphs, int i, int offset, PangoGl glyphs->glyphs[i].geometry.width = logical_rect.width; } -static iconv_t +static GIConv find_converter (CharCache *cache, Charset *charset) { - iconv_t cd = cache->converters[charset->index]; - if (cd == (iconv_t)-1) + GIConv cd = cache->converters[charset->index]; + if (cd == (GIConv)-1) { - cd = iconv_open (charset->id, "UTF-8"); - g_assert (cd != (iconv_t)-1); + cd = g_iconv_open (charset->id, "UTF-8"); + g_assert (cd != (GIConv)-1); cache->converters[charset->index] = cd; } @@ -212,7 +211,7 @@ conv_8bit (CharCache *cache, Charset *charset, const char *input) { - iconv_t cd; + GIConv cd; char outbuf; const char *inptr = input; @@ -224,7 +223,7 @@ conv_8bit (CharCache *cache, cd = find_converter (cache, charset); - iconv (cd, (const char **)&inptr, &inbytesleft, &outptr, &outbytesleft); + g_iconv (cd, (gchar **)&inptr, &inbytesleft, &outptr, &outbytesleft); return (guchar)outbuf; } @@ -234,7 +233,7 @@ conv_euc (CharCache *cache, Charset *charset, const char *input) { - iconv_t cd; + GIConv cd; char outbuf[2]; const char *inptr = input; @@ -246,7 +245,7 @@ conv_euc (CharCache *cache, cd = find_converter (cache, charset); - iconv (cd, &inptr, &inbytesleft, &outptr, &outbytesleft); + g_iconv (cd, (gchar **)&inptr, &inbytesleft, &outptr, &outbytesleft); if ((guchar)outbuf[0] < 128) return outbuf[0];