Minor const correctness patch to SDL_iconv. SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Fri, 16 Feb 2007 03:50:42 +0000
branchSDL-1.2
changeset 3918f16c15f3bc2b
parent 3917 8a3a0f1179f3
child 3919 d13618a935a2
Minor const correctness patch to SDL_iconv.
include/SDL_stdinc.h
src/stdlib/SDL_iconv.c
     1.1 --- a/include/SDL_stdinc.h	Thu Feb 15 23:50:45 2007 +0000
     1.2 +++ b/include/SDL_stdinc.h	Fri Feb 16 03:50:42 2007 +0000
     1.3 @@ -561,17 +561,16 @@
     1.4  #define SDL_iconv_t     iconv_t
     1.5  #define SDL_iconv_open  iconv_open
     1.6  #define SDL_iconv_close iconv_close
     1.7 -extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
     1.8  #else
     1.9  typedef struct _SDL_iconv_t *SDL_iconv_t;
    1.10  extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode);
    1.11  extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
    1.12 -extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
    1.13  #endif
    1.14 +extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
    1.15  /* This function converts a string between encodings in one pass, returning a
    1.16     string that must be freed with SDL_free() or NULL on error.
    1.17  */
    1.18 -extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, char *inbuf, size_t inbytesleft);
    1.19 +extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft);
    1.20  #define SDL_iconv_utf8_ascii(S)		SDL_iconv_string("ASCII", "UTF-8", S, SDL_strlen(S)+1)
    1.21  #define SDL_iconv_utf8_latin1(S)	SDL_iconv_string("LATIN1", "UTF-8", S, SDL_strlen(S)+1)
    1.22  #define SDL_iconv_utf8_ucs2(S)		(Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
     2.1 --- a/src/stdlib/SDL_iconv.c	Thu Feb 15 23:50:45 2007 +0000
     2.2 +++ b/src/stdlib/SDL_iconv.c	Fri Feb 16 03:50:42 2007 +0000
     2.3 @@ -149,11 +149,12 @@
     2.4  }
     2.5  
     2.6  size_t SDL_iconv(SDL_iconv_t cd,
     2.7 -                 char **inbuf, size_t *inbytesleft,
     2.8 +                 const char **inbuf, size_t *inbytesleft,
     2.9                   char **outbuf, size_t *outbytesleft)
    2.10  {
    2.11  	/* For simplicity, we'll convert everything to and from UCS-4 */
    2.12 -	char *src, *dst;
    2.13 +	const char *src;
    2.14 +	char *dst;
    2.15  	size_t srclen, dstlen;
    2.16  	Uint32 ch = 0;
    2.17  	size_t total;
    2.18 @@ -755,7 +756,7 @@
    2.19  
    2.20  #endif /* !HAVE_ICONV */
    2.21  
    2.22 -char *SDL_iconv_string(const char *tocode, const char *fromcode, char *inbuf, size_t inbytesleft)
    2.23 +char *SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft)
    2.24  {
    2.25  	SDL_iconv_t cd;
    2.26  	char *string;