Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed bug #349

Solaris doesn't support the LATIN1 character set alias.

Merged from 1.2 svn revision 3133f
  • Loading branch information
slouken committed Jul 4, 2007
1 parent 78e9b86 commit ef4d11fbd2e20f2a969e22d71c6918e12c25ee31
Showing with 36 additions and 28 deletions.
  1. +2 −2 include/SDL_stdinc.h
  2. +27 −23 src/stdlib/SDL_iconv.c
  3. +7 −3 test/testiconv.c
@@ -656,8 +656,8 @@ 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)

@@ -110,29 +110,33 @@ static struct
const char *name;
int format;
} encodings[] = {
{
"ASCII", ENCODING_ASCII}, {
"US-ASCII", ENCODING_ASCII}, {
"LATIN1", ENCODING_LATIN1}, {
"ISO-8859-1", ENCODING_LATIN1}, {
"UTF8", ENCODING_UTF8}, {
"UTF-8", ENCODING_UTF8}, {
"UTF16", ENCODING_UTF16}, {
"UTF-16", ENCODING_UTF16}, {
"UTF16BE", ENCODING_UTF16BE}, {
"UTF-16BE", ENCODING_UTF16BE}, {
"UTF16LE", ENCODING_UTF16LE}, {
"UTF-16LE", ENCODING_UTF16LE}, {
"UTF32", ENCODING_UTF32}, {
"UTF-32", ENCODING_UTF32}, {
"UTF32BE", ENCODING_UTF32BE}, {
"UTF-32BE", ENCODING_UTF32BE}, {
"UTF32LE", ENCODING_UTF32LE}, {
"UTF-32LE", ENCODING_UTF32LE}, {
"UCS2", ENCODING_UCS2}, {
"UCS-2", ENCODING_UCS2}, {
"UCS4", ENCODING_UCS4}, {
"UCS-4", ENCODING_UCS4},};
/* *INDENT-OFF* */
{ "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 },
{ "UTF16", ENCODING_UTF16 },
{ "UTF-16", ENCODING_UTF16 },
{ "UTF16BE", ENCODING_UTF16BE },
{ "UTF-16BE", ENCODING_UTF16BE },
{ "UTF16LE", ENCODING_UTF16LE },
{ "UTF-16LE", ENCODING_UTF16LE },
{ "UTF32", ENCODING_UTF32 },
{ "UTF-32", ENCODING_UTF32 },
{ "UTF32BE", ENCODING_UTF32BE },
{ "UTF-32BE", ENCODING_UTF32BE },
{ "UTF32LE", ENCODING_UTF32LE },
{ "UTF-32LE", ENCODING_UTF32LE },
{ "UCS2", ENCODING_UCS2 },
{ "UCS-2", ENCODING_UCS2 },
{ "UCS4", ENCODING_UCS4 },
{ "UCS-4", ENCODING_UCS4 },
/* *INDENT-ON* */
};

SDL_iconv_t
SDL_iconv_open(const char *tocode, const char *fromcode)
@@ -57,12 +57,16 @@ main(int argc, char *argv[])
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);

0 comments on commit ef4d11f

Please sign in to comment.