comparison src/events/SDL_keyboard.c @ 2229:22342048bcb8

Fixed crash if conversion fails. Use ISO name for Latin-1
author Sam Lantinga <slouken@libsdl.org>
date Sun, 12 Aug 2007 05:48:51 +0000
parents 047245361002
children 4baee598306d
comparison
equal deleted inserted replaced
2228:bb67fd5ccfdb 2229:22342048bcb8
446 if (key < 256) { 446 if (key < 256) {
447 static char temp[4]; 447 static char temp[4];
448 char *cvt; 448 char *cvt;
449 temp[0] = (char) key; 449 temp[0] = (char) key;
450 temp[1] = '\0'; 450 temp[1] = '\0';
451 cvt = SDL_iconv_string("UTF-8", "LATIN1", temp, 1); 451 cvt = SDL_iconv_string("UTF-8", "ISO-8859-1", temp, 1);
452 SDL_strlcpy(temp, cvt, SDL_arraysize(temp)); 452 if (cvt) {
453 SDL_free(cvt); 453 SDL_strlcpy(temp, cvt, SDL_arraysize(temp));
454 SDL_free(cvt);
455 }
454 keyname = temp; 456 keyname = temp;
455 } else { 457 } else {
456 keyname = "unknown key"; 458 keyname = "unknown key";
457 } 459 }
458 } 460 }