This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
iconv calling convention
- To: libc-alpha at sourceware dot cygnus dot com
- Subject: iconv calling convention
- From: Bruno Haible <haible at ilog dot fr>
- Date: Mon, 20 Dec 1999 16:58:08 +0100 (MET)
If one wants to reset an iconv_t conversion descriptor to the initial state,
one needs to call iconv with two NULL pointers instead of char** pointers.
I expected that
iconv(cd,NULL,NULL,NULL,NULL);
would do it, because if there is no input and output buffer, no "inbytesleft"
and "outbytesleft" counts need to be updated. But glibc-2.1.1 crashes on this.
It requires that I write
size_t dummy;
iconv(cd,NULL,NULL,NULL,&dummy);
Here is a patch which presumably fixes this.
Bruno
*** iconv.c.bak Wed Mar 17 22:03:42 1999
--- iconv.c Mon Dec 20 00:04:13 1999
***************
*** 38,46 ****
if (inbuf == NULL || *inbuf == NULL)
{
! result = __gconv (gcd, NULL, NULL, (unsigned char **) outbuf,
! (unsigned char *) (outstart + *outbytesleft),
! &converted);
}
else
{
--- 38,49 ----
if (inbuf == NULL || *inbuf == NULL)
{
! if (outbuf == NULL || *outbuf == NULL)
! result = __gconv (gcd, NULL, NULL, NULL, NULL, &converted);
! else
! result = __gconv (gcd, NULL, NULL, (unsigned char **) outbuf,
! (unsigned char *) (outstart + *outbytesleft),
! &converted);
}
else
{