comparison src/stdlib/SDL_iconv.c @ 4054:64bf737873a2 SDL-1.2

Fixed iconv handling on Solaris 11
author Sam Lantinga <slouken@libsdl.org>
date Thu, 12 Jul 2007 07:47:29 +0000
parents 0aadbc81c497
children 6ed1fded55ff
comparison
equal deleted inserted replaced
4053:0aadbc81c497 4054:64bf737873a2
805 size_t outbytesleft; 805 size_t outbytesleft;
806 size_t retCode = 0; 806 size_t retCode = 0;
807 807
808 cd = SDL_iconv_open(tocode, fromcode); 808 cd = SDL_iconv_open(tocode, fromcode);
809 if ( cd == (SDL_iconv_t)-1 ) { 809 if ( cd == (SDL_iconv_t)-1 ) {
810 /* See if we can recover here (fixes iconv on Solaris 11) */
811 if ( !tocode || !*tocode ) {
812 tocode = "UTF-8";
813 }
814 if ( !fromcode || !*fromcode ) {
815 tocode = "UTF-8";
816 }
817 cd = SDL_iconv_open(tocode, fromcode);
818 }
819 if ( cd == (SDL_iconv_t)-1 ) {
810 return NULL; 820 return NULL;
811 } 821 }
812 822
813 stringsize = inbytesleft > 4 ? inbytesleft : 4; 823 stringsize = inbytesleft > 4 ? inbytesleft : 4;
814 string = SDL_malloc(stringsize); 824 string = SDL_malloc(stringsize);