Use the glib iconv wrappers.

2000-11-14  Alexander Larsson  <alexl@redhat.com>

	* modules/linux-fb/basic.c:
	Use the glib iconv wrappers.
This commit is contained in:
Alexander Larsson 2000-11-14 10:09:21 +00:00 committed by Alexander Larsson
parent 8bbd2b0f02
commit ad1906ae5e
8 changed files with 50 additions and 16 deletions

View File

@ -1,3 +1,8 @@
2000-11-14 Alexander Larsson <alexl@redhat.com>
* modules/linux-fb/basic.c:
Use the glib iconv wrappers.
2000-11-13 Havoc Pennington <hp@pobox.com>
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals

View File

@ -1,3 +1,8 @@
2000-11-14 Alexander Larsson <alexl@redhat.com>
* modules/linux-fb/basic.c:
Use the glib iconv wrappers.
2000-11-13 Havoc Pennington <hp@pobox.com>
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals

View File

@ -1,3 +1,8 @@
2000-11-14 Alexander Larsson <alexl@redhat.com>
* modules/linux-fb/basic.c:
Use the glib iconv wrappers.
2000-11-13 Havoc Pennington <hp@pobox.com>
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals

View File

@ -1,3 +1,8 @@
2000-11-14 Alexander Larsson <alexl@redhat.com>
* modules/linux-fb/basic.c:
Use the glib iconv wrappers.
2000-11-13 Havoc Pennington <hp@pobox.com>
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals

View File

@ -1,3 +1,8 @@
2000-11-14 Alexander Larsson <alexl@redhat.com>
* modules/linux-fb/basic.c:
Use the glib iconv wrappers.
2000-11-13 Havoc Pennington <hp@pobox.com>
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals

View File

@ -1,3 +1,8 @@
2000-11-14 Alexander Larsson <alexl@redhat.com>
* modules/linux-fb/basic.c:
Use the glib iconv wrappers.
2000-11-13 Havoc Pennington <hp@pobox.com>
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals

View File

@ -1,3 +1,8 @@
2000-11-14 Alexander Larsson <alexl@redhat.com>
* modules/linux-fb/basic.c:
Use the glib iconv wrappers.
2000-11-13 Havoc Pennington <hp@pobox.com>
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals

View File

@ -19,9 +19,8 @@
* Boston, MA 02111-1307, USA.
*/
#include <iconv.h>
#include <glib.h>
#include <gconvert.h>
#include <pango/pango.h>
#include <pango/pango-utils.h>
#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; i<MAX_CHARSETS; i++)
if (cache->converters[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];