Commit d969c7e2 authored by Ryan C. Gordon's avatar Ryan C. Gordon

Minor const correctness patch to SDL_iconv.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402275
parent 8b407756
...@@ -561,17 +561,16 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char ...@@ -561,17 +561,16 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char
#define SDL_iconv_t iconv_t #define SDL_iconv_t iconv_t
#define SDL_iconv_open iconv_open #define SDL_iconv_open iconv_open
#define SDL_iconv_close iconv_close #define SDL_iconv_close iconv_close
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
#else #else
typedef struct _SDL_iconv_t *SDL_iconv_t; typedef struct _SDL_iconv_t *SDL_iconv_t;
extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode); extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode);
extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
#endif #endif
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
/* This function converts a string between encodings in one pass, returning a /* This function converts a string between encodings in one pass, returning a
string that must be freed with SDL_free() or NULL on error. string that must be freed with SDL_free() or NULL on error.
*/ */
extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, char *inbuf, size_t inbytesleft); extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft);
#define SDL_iconv_utf8_ascii(S) SDL_iconv_string("ASCII", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_ascii(S) SDL_iconv_string("ASCII", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_utf8_latin1(S) SDL_iconv_string("LATIN1", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_latin1(S) SDL_iconv_string("LATIN1", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
......
...@@ -149,11 +149,12 @@ SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode) ...@@ -149,11 +149,12 @@ SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode)
} }
size_t SDL_iconv(SDL_iconv_t cd, size_t SDL_iconv(SDL_iconv_t cd,
char **inbuf, size_t *inbytesleft, const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft) char **outbuf, size_t *outbytesleft)
{ {
/* For simplicity, we'll convert everything to and from UCS-4 */ /* For simplicity, we'll convert everything to and from UCS-4 */
char *src, *dst; const char *src;
char *dst;
size_t srclen, dstlen; size_t srclen, dstlen;
Uint32 ch = 0; Uint32 ch = 0;
size_t total; size_t total;
...@@ -755,7 +756,7 @@ int SDL_iconv_close(SDL_iconv_t cd) ...@@ -755,7 +756,7 @@ int SDL_iconv_close(SDL_iconv_t cd)
#endif /* !HAVE_ICONV */ #endif /* !HAVE_ICONV */
char *SDL_iconv_string(const char *tocode, const char *fromcode, char *inbuf, size_t inbytesleft) char *SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft)
{ {
SDL_iconv_t cd; SDL_iconv_t cd;
char *string; char *string;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment