Re: patch: insane code - locales


Subject: Re: patch: insane code - locales
From: Vlad Harchev (hvv@hippo.ru)
Date: Mon Apr 09 2001 - 14:33:31 CDT


On Mon, 9 Apr 2001, Patrick Lam wrote:

 Hi Patrick,

> Hi Vlad,
>
> On Mon, 9 Apr 2001, Vlad Harchev wrote:
>
> > The code is necessary - the iconv from libiconv dies in SIGSEGV sometimes if
> > all arguments beside it are not NULL (that's a valid usage for iconv). We have
> > no option beside this ugly hack or fixing iconv from libiconv by ourselves.
>
> > > - if (XAP_EncodingManager::instance->cjk_locale())
> > > - iconv(cd,const_cast<ICONV_CONST char**>((char**)NULL),NULL,NULL,NULL);
> > > + iconv(cd,const_cast<ICONV_CONST char**>((char**)NULL),NULL,NULL,NULL);
>
> So you're saying that iconv dies sometimes if all arguments are not
> NULL? In this case, all of the arguments are NULL, and this seems to be
> permitted by the manpage:
>
> A third case is when inbuf is NULL or *inbuf is NULL, and
> outbuf is NULL or *outbuf is NULL. In this case, the iconv
> function sets cd's conversion state to the initial state.

 Yes, docs say that it's a valid usage.
 
> Why is it suddenly OK to execute this code if cjk_locale() is set?

 It seems that for CJK encodings that are statefull such operation (resetting
iconv state) makes sense - that's why iconv behaves differently for them.

 So, 'if' should be left there..

> pat
>

 Best regards,
  -Vlad



This archive was generated by hypermail 2b25 : Mon Apr 09 2001 - 15:16:06 CDT