src/stdlib/SDL_iconv.c
branchSDL-1.2
changeset 3986 4f73308bbb32
parent 3985 2f8efcf14c83
child 3987 00486a9c2893
equal deleted inserted replaced
3985:2f8efcf14c83 3986:4f73308bbb32
    37 	size_t retCode;
    37 	size_t retCode;
    38 #ifdef ICONV_REALLY_MODIFIES_INBUF
    38 #ifdef ICONV_REALLY_MODIFIES_INBUF
    39 	if ( inbuf && *inbuf && inbytesleft ) {
    39 	if ( inbuf && *inbuf && inbytesleft ) {
    40 		char *tmp = SDL_stack_alloc(char, *inbytesleft);
    40 		char *tmp = SDL_stack_alloc(char, *inbytesleft);
    41 		char *ptr = tmp;
    41 		char *ptr = tmp;
       
    42 		SDL_memcpy(tmp, inbuf, *inbytesleft);
    42 		retCode = iconv(cd, &ptr, inbytesleft, outbuf, outbytesleft);
    43 		retCode = iconv(cd, &ptr, inbytesleft, outbuf, outbytesleft);
    43 		inbuf += (ptr - tmp);
    44 		inbuf += (ptr - tmp);
    44 		SDL_stack_free(tmp);
    45 		SDL_stack_free(tmp);
    45 	} else {
    46 	} else {
    46 		retCode = iconv(cd, NULL, inbytesleft, outbuf, outbytesleft);
    47 		retCode = iconv(cd, NULL, inbytesleft, outbuf, outbytesleft);