# HG changeset patch # User Sam Lantinga # Date 1183523267 0 # Node ID 6a4f3a32c2e6e596a70b131d226b7a8b1a09a3d5 # Parent 5f463dddee3608efb08de0fa225b7544d9082dfe Fixed bug #349 Solaris doesn't support the LATIN1 character set alias. diff -r 5f463dddee36 -r 6a4f3a32c2e6 include/SDL_stdinc.h --- a/include/SDL_stdinc.h Tue Jul 03 09:53:26 2007 +0000 +++ b/include/SDL_stdinc.h Wed Jul 04 04:27:47 2007 +0000 @@ -584,8 +584,8 @@ 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, 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_latin1(S) SDL_iconv_string("LATIN1", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_ascii(S) SDL_iconv_string("646", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_latin1(S) SDL_iconv_string("8859-1", "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_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) diff -r 5f463dddee36 -r 6a4f3a32c2e6 src/stdlib/SDL_iconv.c --- a/src/stdlib/SDL_iconv.c Tue Jul 03 09:53:26 2007 +0000 +++ b/src/stdlib/SDL_iconv.c Wed Jul 04 04:27:47 2007 +0000 @@ -107,9 +107,11 @@ const char *name; int format; } encodings[] = { + { "646", ENCODING_ASCII }, { "ASCII", ENCODING_ASCII }, { "US-ASCII", ENCODING_ASCII }, { "LATIN1", ENCODING_LATIN1 }, + { "8859-1", ENCODING_LATIN1 }, { "ISO-8859-1", ENCODING_LATIN1 }, { "UTF8", ENCODING_UTF8 }, { "UTF-8", ENCODING_UTF8 }, diff -r 5f463dddee36 -r 6a4f3a32c2e6 test/testiconv.c --- a/test/testiconv.c Tue Jul 03 09:53:26 2007 +0000 +++ b/test/testiconv.c Wed Jul 04 04:27:47 2007 +0000 @@ -53,12 +53,16 @@ for ( i = 0; i < SDL_arraysize(formats); ++i ) { test[0] = SDL_iconv_string(formats[i], "UCS-4", ucs4, len); test[1] = SDL_iconv_string("UCS-4", formats[i], test[0], len); - if ( SDL_memcmp(test[1], ucs4, len) != 0 ) { + if ( !test[1] || SDL_memcmp(test[1], ucs4, len) != 0 ) { fprintf(stderr, "FAIL: %s\n", formats[i]); ++errors; } - SDL_free(test[0]); - SDL_free(test[1]); + if ( test[0] ) { + SDL_free(test[0]); + } + if ( test[1] ) { + SDL_free(test[1]); + } } test[0] = SDL_iconv_string("UTF-8", "UCS-4", ucs4, len); SDL_free(ucs4);