From: Michael Schutte Date: Sat, 25 Apr 2009 14:41:41 +0000 (+0200) Subject: Fix two problems with the keymap auto-conversion patch X-Git-Tag: 2.0.2~151^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=68cbd1ca28598ed399280e15878d75f6040b2726;p=platform%2Fupstream%2Fkbd.git Fix two problems with the keymap auto-conversion patch * Correctly resolve plain ASCII characters in codetoksym. The original auto-conversion patch handles keysyms smaller than 0x80 incorrectly if prefer_unicode is set. * Avoid a memory leak in set_charset. Signed-off-by: Michael Schutte --- diff --git a/src/ksyms.c b/src/ksyms.c index 36196f1..cf8ae24 100644 --- a/src/ksyms.c +++ b/src/ksyms.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "ksyms.h" #include "nls.h" @@ -1645,7 +1646,7 @@ struct cs { /* Functions for both dumpkeys and loadkeys. */ int prefer_unicode = 0; -static const char *chosen_charset = NULL; +static char *chosen_charset = NULL; void list_charsets(FILE *f) { @@ -1695,6 +1696,8 @@ set_charset(const char *charset) { if(p->name[0]) syms[0].table[i] = p->name; } + if (chosen_charset) + free(chosen_charset); chosen_charset = strdup(charset); return 0; } @@ -1714,6 +1717,8 @@ codetoksym(int code) { return NULL; if (code < 0x1000) { /* "traditional" keysym */ + if (code < 0x80) + return iso646_syms[code]; if (KTYP(code) == KT_META) return NULL; if (KTYP(code) == KT_LETTER)