559 |
559 |
560 #ifdef HAVE_ICONV |
560 #ifdef HAVE_ICONV |
561 #define SDL_iconv_t iconv_t |
561 #define SDL_iconv_t iconv_t |
562 #define SDL_iconv_open iconv_open |
562 #define SDL_iconv_open iconv_open |
563 #define SDL_iconv_close iconv_close |
563 #define SDL_iconv_close iconv_close |
564 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); |
|
565 #else |
564 #else |
566 typedef struct _SDL_iconv_t *SDL_iconv_t; |
565 typedef struct _SDL_iconv_t *SDL_iconv_t; |
567 extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode); |
566 extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode); |
568 extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); |
567 extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); |
569 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); |
568 #endif |
570 #endif |
569 extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); |
571 /* This function converts a string between encodings in one pass, returning a |
570 /* This function converts a string between encodings in one pass, returning a |
572 string that must be freed with SDL_free() or NULL on error. |
571 string that must be freed with SDL_free() or NULL on error. |
573 */ |
572 */ |
574 extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, char *inbuf, size_t inbytesleft); |
573 extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft); |
575 #define SDL_iconv_utf8_ascii(S) SDL_iconv_string("ASCII", "UTF-8", S, SDL_strlen(S)+1) |
574 #define SDL_iconv_utf8_ascii(S) SDL_iconv_string("ASCII", "UTF-8", S, SDL_strlen(S)+1) |
576 #define SDL_iconv_utf8_latin1(S) SDL_iconv_string("LATIN1", "UTF-8", S, SDL_strlen(S)+1) |
575 #define SDL_iconv_utf8_latin1(S) SDL_iconv_string("LATIN1", "UTF-8", S, SDL_strlen(S)+1) |
577 #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) |
576 #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) |
578 #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) |
577 #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) |
579 |
578 |