On 21-3-2014 0:36, mathog wrote:
On 20-Mar-2014 15:38, Johan Engelen wrote:
Hello David, in libuemf/uemf_utf.c, there is
/** \cond */ /* iconv() has a funny cast on some older systems, on most recent ones it is just char **. This tries to work around the issue. If you build this on another funky system this code may need to be modified, or define ICONV_CAST on the compile line(but it may be tricky). */ #ifdef SOL8 #define ICONV_CAST (const char **) #endif //SOL8 #if !defined(ICONV_CAST) #define ICONV_CAST (char **) #endif //ICONV_CAST /** \endcond */
An example of the macro usage: ... status = iconv(conv, ICONV_CAST &src, &srclen, &dst, &dstlen); ...
This generates a warning because, at least on Windows, iconv expects a (const char **) and gcc complains about an unsafe cast.
It is a pain writing iconv code that compiles cleanly everywhere. However, on the systems I have in hand that is the case.
Windows:
gcc -DWIN32 -std=c99 -pedantic -Wall -g -o reademf reademf.c uemf.c uemf_endian.c \ uemf_utf.c uemf_print.c upmf.c upmf_print.c -lm -liconv
No warning generated (gcc 4.6.2 on mingw).
Linux is also clean (ubuntu 12.04LTS, gcc 4.6.3):
gcc -std=c99 -pedantic -Wall -g -o reademf reademf.c uemf.c uemf_endian.c uemf_utf.c \ uemf_print.c upmf.c upmf_print.c -lm
Solaris 8 and 9 (irrelevant for Inkscape) also compile cleanly with the appropriate compile line.
Please send the compiler line you used and the compiler version information. If it was on windows, was it missing the -DWIN32?
The reason it compiles cleanly for you is probably due to differences in iconv version. Our devlibs version is: #define _LIBICONV_VERSION 0x0109 with function signature: extern LIBICONV_DLL_EXPORTED size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
Adding a check for iconv version to adjust the cast to the proper type is the best course of action I think.
thanks, Johan