iconv
- From: Miroslaw Dobrzanski-Neumann <mne mosaic-ag com>
- To: GTKDEV <gtk-devel-list gnome org>
- Subject: iconv
- Date: Mon, 25 Mar 2002 17:23:46 +0100
Hi,
I've just get glib compiled on solaris. Running unicode-encoding test I got SEGV
in the following context
I'm using Sun implementation of iconv from libc.so
in gconvert.c
=============
open_converter ()
{
...
g_iconv (cd, NULL, NULL, NULL, NULL);
...
}
The SEGV is due to NULL pointer passed to iconv. The iconv man page explicitly
allows only the inbuf pointer to be null.
Here an example of how to reset the context taken from the manpage
--------------------- cut ---------------------
/*
* For state-dependent encodings, changes the state of the conversion
* descriptor to initial shift state. Also, outputs the byte sequence
* to change the state to initial state.
* This code is assuming the iconv call for initializing the state
* won't fail due to lack of space in the output buffer.
*/
#define INIT_SHIFT_STATE(cd, fptr, ileft, tptr, oleft) \
{
fptr = NULL; \
ileft = 0; \
tptr = to; \
oleft = BUFSIZ; \
(void) iconv(cd, &fptr, &ileft, &tptr, &oleft); \
(void) fwrite(to, 1, BUFSIZ - oleft, stdout); \ }
--------------------- cut ---------------------
Regards
--
Miroslaw Dobrzanski-Neumann
MOSAIC SOFTWARE AG
Base Development and Research
Tel +49-2225-882-291
Fax +49-2225-882-201
Office: mne mosaic-ag com
Home: mirek-dn freenet de
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]