comparison test/testiconv.c @ 2142:ca80c942e69c

Fixed bug #349 Solaris doesn't support the LATIN1 character set alias. Merged from 1.2 svn revision 3133f
author Sam Lantinga <slouken@libsdl.org>
date Wed, 04 Jul 2007 07:08:16 +0000
parents c121d94672cb
children e906da4414a3
comparison
equal deleted inserted replaced
2141:e1a70460c354 2142:ca80c942e69c
55 SDL_strlen(buffer) + 1); 55 SDL_strlen(buffer) + 1);
56 len = (widelen(ucs4) + 1) * 4; 56 len = (widelen(ucs4) + 1) * 4;
57 for (i = 0; i < SDL_arraysize(formats); ++i) { 57 for (i = 0; i < SDL_arraysize(formats); ++i) {
58 test[0] = SDL_iconv_string(formats[i], "UCS-4", ucs4, len); 58 test[0] = SDL_iconv_string(formats[i], "UCS-4", ucs4, len);
59 test[1] = SDL_iconv_string("UCS-4", formats[i], test[0], len); 59 test[1] = SDL_iconv_string("UCS-4", formats[i], test[0], len);
60 if (SDL_memcmp(test[1], ucs4, len) != 0) { 60 if (!test[1] || SDL_memcmp(test[1], ucs4, len) != 0) {
61 fprintf(stderr, "FAIL: %s\n", formats[i]); 61 fprintf(stderr, "FAIL: %s\n", formats[i]);
62 ++errors; 62 ++errors;
63 } 63 }
64 SDL_free(test[0]); 64 if(test[0]) {
65 SDL_free(test[1]); 65 SDL_free(test[0]);
66 }
67 if(test[1]) {
68 SDL_free(test[1]);
69 }
66 } 70 }
67 test[0] = SDL_iconv_string("UTF-8", "UCS-4", ucs4, len); 71 test[0] = SDL_iconv_string("UTF-8", "UCS-4", ucs4, len);
68 SDL_free(ucs4); 72 SDL_free(ucs4);
69 fputs(test[0], stdout); 73 fputs(test[0], stdout);
70 SDL_free(test[0]); 74 SDL_free(test[0]);