Am Sonntag, 29. Oktober 2006 18:26 schrieb Abdelrazak Younes:
> Georg Baum wrote:
> > Which static variable do you mean?
> 
> This invalid_cd is declared static in all the conversion function:
> 
>       static int cd = -1;
> 
> But is not used at all except that it is tested at the beginning of 
> iconv_convert().

Sure it is used: It stores the iconv conversion descriptor between calls. 
You changed iconv_convert to take a reference instead of a pointer, and it 
calls iconv_open if cd is invalid. Because of the reference it is not so 
visible anymore than with the pointer version.
I stumbled over cases like this several times already.

> > Sorry, I was unclear. That has nothing to with your changes but was a 
> > general comment (and I did not mean that _you_ should fix that 
problem): 
> > The static buffer ist still there in the other iconv_convert. 
> 
> Yes but I don't use that in my new utf8_to_ucs4() in docstring.[Ch] and 
> I propose that we do the same for conversion.

We can't, because we don't know the length of the resulting string. For 
utf8 -> ucs4 we know that the result is at most as long as the input (and 
in many cases only a few bytes shorter, at least for european languages). 
For ucs4 -> utf8 we would have to use a result string with a length of 6 
times the input length, with the average length close to the inpurt length 
if we want to be able to convert everything. That is probably too much to 
be efficient.

> >> Come one, it is only used in docstring. I can remove it from the 
> >> unicode.h and declare it as extern in docstring.C if you prefer.
> > 
> > That would be worse IMO.
> 
> Then my poposal in my other mail (move that to docstring.C) would fits 
you?

Not really, because it duplicates code. Leave it as is for know, I guess 
that Lars will request some changes anyway, because he always had a strong 
point for the existing interface in unicode.h in the past.


Georg

Reply via email to