src/stdlib/SDL_iconv.c
changeset 7003 eeaf77005c30
parent 6885 700f1b25f77f
child 7349 a96c85910792
     1.1 --- a/src/stdlib/SDL_iconv.c	Fri Mar 15 01:02:30 2013 -0400
     1.2 +++ b/src/stdlib/SDL_iconv.c	Fri Mar 15 01:01:20 2013 -0400
     1.3 @@ -38,6 +38,20 @@
     1.4  
     1.5  #include <errno.h>
     1.6  
     1.7 +SDL_COMPILE_TIME_ASSERT(iconv_t, sizeof (iconv_t) <= sizeof (SDL_iconv_t));
     1.8 +
     1.9 +SDL_iconv_t
    1.10 +SDL_iconv_open(const char *tocode, const char *fromcode)
    1.11 +{
    1.12 +    return (SDL_iconv_t) ((size_t) iconv_open(tocode, fromcode));
    1.13 +}
    1.14 +
    1.15 +int
    1.16 +SDL_iconv_close(SDL_iconv_t cd)
    1.17 +{
    1.18 +    return iconv_close((iconv_t) ((size_t) cd));
    1.19 +}
    1.20 +
    1.21  size_t
    1.22  SDL_iconv(SDL_iconv_t cd,
    1.23            const char **inbuf, size_t * inbytesleft,
    1.24 @@ -45,9 +59,9 @@
    1.25  {
    1.26      size_t retCode;
    1.27  #ifdef ICONV_INBUF_NONCONST
    1.28 -    retCode = iconv(cd, (char **) inbuf, inbytesleft, outbuf, outbytesleft);
    1.29 +    retCode = iconv((iconv_t) ((size_t) cd), (char **) inbuf, inbytesleft, outbuf, outbytesleft);
    1.30  #else
    1.31 -    retCode = iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft);
    1.32 +    retCode = iconv((iconv_t) ((size_t) cd), inbuf, inbytesleft, outbuf, outbytesleft);
    1.33  #endif
    1.34      if (retCode == (size_t) - 1) {
    1.35          switch (errno) {