On Sun, Mar 1, 2009 at 11:47 PM, Nikos Balkanas <[email protected]> wrote: > Hi, > > Nope. This is the function prototype from include/iconv.h: > > extern LIBICONV_DLL_EXPORTED size_t iconv (iconv_t cd, const char* * inbuf, > size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); > > Note the 2nd argument, const char* * inbuf. This is what makes gcc 3.4.3 > (stock solaris 10) to complain. This is from iconv sources 1.12, general not > solaris or linux specific and outside any OS related preprocesor > definitions. > > Could be that newer gcc doesn't complain about (const char) -> (char) > conversions, but even if it doesn't, it doesn't hurt to be compatible to the > function declaration, and make Solaris and OSX folks happy. :-) > > BR, > Nikos
(OPS: Again but this time "replying all") Nope, Alex is right. Actually you are not looking at the sources, you are looking at the generated libraries. libiconv comes with a iconv.h.in in which the prototype is this: extern size_t iconv (iconv_t cd, @ICONV_CONST@ char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); So, the cast should be more like #ifdef __APPLE__ #define ICONV_CONST const #elif OPENBSD #define ICONV_CONST const #else #define ICONV_CONST #endif (...) ret = iconv(cd, (ICONV_CONST char**)&from_buf, &inbytes, &pointer, &outbytes); M.
