comparison test/testiconv.c @ 1516:4d241ea8a1cd

Updated MacOS Classic build
author Sam Lantinga <slouken@libsdl.org>
date Mon, 13 Mar 2006 05:36:42 +0000
parents d403a39389da
children ff3322d66771
comparison
equal deleted inserted replaced
1515:1e18097b1d7a 1516:4d241ea8a1cd
42 "UCS-4", 42 "UCS-4",
43 }; 43 };
44 char buffer[BUFSIZ]; 44 char buffer[BUFSIZ];
45 char *ucs4; 45 char *ucs4;
46 char *test[2]; 46 char *test[2];
47 int i, j, index = 0; 47 int i, index = 0;
48 FILE *file; 48 FILE *file;
49 int errors = 0; 49 int errors = 0;
50 50
51 if ( !argv[1] ) { 51 if ( !argv[1] ) {
52 argv[1] = "utf8.txt"; 52 argv[1] = "utf8.txt";
57 return (1); 57 return (1);
58 } 58 }
59 59
60 while ( fgets(buffer, sizeof(buffer), file) ) { 60 while ( fgets(buffer, sizeof(buffer), file) ) {
61 /* Convert to UCS-4 */ 61 /* Convert to UCS-4 */
62 size_t len;
62 ucs4 = SDL_iconv_string("UCS-4", "UTF-8", buffer, SDL_strlen(buffer)+1); 63 ucs4 = SDL_iconv_string("UCS-4", "UTF-8", buffer, SDL_strlen(buffer)+1);
63 size_t len = (widelen(ucs4)+1)*4; 64 len = (widelen(ucs4)+1)*4;
64 for ( i = 0; i < SDL_arraysize(formats); ++i ) { 65 for ( i = 0; i < SDL_arraysize(formats); ++i ) {
65 if ( (SDL_strncasecmp(formats[i], "UTF16", 5) == 0 || 66 if ( (SDL_strncasecmp(formats[i], "UTF16", 5) == 0 ||
66 SDL_strncasecmp(formats[i], "UTF-16", 6) == 0 || 67 SDL_strncasecmp(formats[i], "UTF-16", 6) == 0 ||
67 SDL_strncasecmp(formats[i], "UTF32", 5) == 0 || 68 SDL_strncasecmp(formats[i], "UTF32", 5) == 0 ||
68 SDL_strncasecmp(formats[i], "UTF-32", 6) == 0) && 69 SDL_strncasecmp(formats[i], "UTF-32", 6) == 0) &&