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:
parent
8bbd2b0f02
commit
ad1906ae5e
@ -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>
|
2000-11-13 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals
|
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals
|
||||||
|
@ -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>
|
2000-11-13 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals
|
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals
|
||||||
|
@ -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>
|
2000-11-13 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals
|
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals
|
||||||
|
@ -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>
|
2000-11-13 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals
|
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals
|
||||||
|
@ -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>
|
2000-11-13 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals
|
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals
|
||||||
|
@ -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>
|
2000-11-13 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals
|
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals
|
||||||
|
@ -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>
|
2000-11-13 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals
|
* demos/gtk-demo/textview.c: spiff up the demo a bit; reveals
|
||||||
|
@ -19,9 +19,8 @@
|
|||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iconv.h>
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <gconvert.h>
|
||||||
#include <pango/pango.h>
|
#include <pango/pango.h>
|
||||||
#include <pango/pango-utils.h>
|
#include <pango/pango-utils.h>
|
||||||
#include "gdkprivate-fb.h"
|
#include "gdkprivate-fb.h"
|
||||||
@ -63,7 +62,7 @@ struct _CharCache
|
|||||||
#if 0
|
#if 0
|
||||||
MaskTable *mask_tables[256];
|
MaskTable *mask_tables[256];
|
||||||
#endif
|
#endif
|
||||||
iconv_t converters[MAX_CHARSETS];
|
GIConv converters[MAX_CHARSETS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Charset
|
struct _Charset
|
||||||
@ -143,7 +142,7 @@ char_cache_new (void)
|
|||||||
result = g_new0 (CharCache, 1);
|
result = g_new0 (CharCache, 1);
|
||||||
|
|
||||||
for (i=0; i < MAX_CHARSETS; i++)
|
for (i=0; i < MAX_CHARSETS; i++)
|
||||||
result->converters[i] = (iconv_t)-1;
|
result->converters[i] = (GIConv)-1;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -165,8 +164,8 @@ char_cache_free (CharCache *cache)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i=0; i<MAX_CHARSETS; i++)
|
for (i=0; i<MAX_CHARSETS; i++)
|
||||||
if (cache->converters[i] != (iconv_t)-1)
|
if (cache->converters[i] != (GIConv)-1)
|
||||||
iconv_close (cache->converters[i]);
|
g_iconv_close (cache->converters[i]);
|
||||||
|
|
||||||
g_free (cache);
|
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;
|
glyphs->glyphs[i].geometry.width = logical_rect.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
static iconv_t
|
static GIConv
|
||||||
find_converter (CharCache *cache, Charset *charset)
|
find_converter (CharCache *cache, Charset *charset)
|
||||||
{
|
{
|
||||||
iconv_t cd = cache->converters[charset->index];
|
GIConv cd = cache->converters[charset->index];
|
||||||
if (cd == (iconv_t)-1)
|
if (cd == (GIConv)-1)
|
||||||
{
|
{
|
||||||
cd = iconv_open (charset->id, "UTF-8");
|
cd = g_iconv_open (charset->id, "UTF-8");
|
||||||
g_assert (cd != (iconv_t)-1);
|
g_assert (cd != (GIConv)-1);
|
||||||
cache->converters[charset->index] = cd;
|
cache->converters[charset->index] = cd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +211,7 @@ conv_8bit (CharCache *cache,
|
|||||||
Charset *charset,
|
Charset *charset,
|
||||||
const char *input)
|
const char *input)
|
||||||
{
|
{
|
||||||
iconv_t cd;
|
GIConv cd;
|
||||||
char outbuf;
|
char outbuf;
|
||||||
|
|
||||||
const char *inptr = input;
|
const char *inptr = input;
|
||||||
@ -224,7 +223,7 @@ conv_8bit (CharCache *cache,
|
|||||||
|
|
||||||
cd = find_converter (cache, charset);
|
cd = find_converter (cache, charset);
|
||||||
|
|
||||||
iconv (cd, (const char **)&inptr, &inbytesleft, &outptr, &outbytesleft);
|
g_iconv (cd, (gchar **)&inptr, &inbytesleft, &outptr, &outbytesleft);
|
||||||
|
|
||||||
return (guchar)outbuf;
|
return (guchar)outbuf;
|
||||||
}
|
}
|
||||||
@ -234,7 +233,7 @@ conv_euc (CharCache *cache,
|
|||||||
Charset *charset,
|
Charset *charset,
|
||||||
const char *input)
|
const char *input)
|
||||||
{
|
{
|
||||||
iconv_t cd;
|
GIConv cd;
|
||||||
char outbuf[2];
|
char outbuf[2];
|
||||||
|
|
||||||
const char *inptr = input;
|
const char *inptr = input;
|
||||||
@ -246,7 +245,7 @@ conv_euc (CharCache *cache,
|
|||||||
|
|
||||||
cd = find_converter (cache, charset);
|
cd = find_converter (cache, charset);
|
||||||
|
|
||||||
iconv (cd, &inptr, &inbytesleft, &outptr, &outbytesleft);
|
g_iconv (cd, (gchar **)&inptr, &inbytesleft, &outptr, &outbytesleft);
|
||||||
|
|
||||||
if ((guchar)outbuf[0] < 128)
|
if ((guchar)outbuf[0] < 128)
|
||||||
return outbuf[0];
|
return outbuf[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user