From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdiTV-0005eL-Pg for qemu-devel@nongnu.org; Tue, 05 Nov 2013 10:23:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VdiTP-0005KE-La for qemu-devel@nongnu.org; Tue, 05 Nov 2013 10:23:25 -0500 Received: from cantor2.suse.de ([195.135.220.15]:56146 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdiTP-0005Jw-Cc for qemu-devel@nongnu.org; Tue, 05 Nov 2013 10:23:19 -0500 Message-ID: <52790DAF.1090206@suse.com> Date: Tue, 05 Nov 2013 16:24:31 +0100 From: Jan Krupa MIME-Version: 1.0 References: <52737B75.9080004@msgid.tls.msk.ru> <52739068.7090304@msgid.tls.msk.ru> In-Reply-To: <52739068.7090304@msgid.tls.msk.ru> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [v2, 3/4] qemu-char: add support for U-prefixed symbols List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: qemu-devel@nongnu.org, Anthony Liguori On 11/01/2013 12:28 PM, Michael Tokarev wrote: > 01.11.2013 13:59, Michael Tokarev =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> 16.10.2013 16:40, Jan Krupa wrote: >>> This patch adds support for Unicode symbols in keymap files. This >>> feature was already used in some keyboard layouts in QEMU generated >>> from XKB (e.g. Arabic) but it wasn't implemented in QEMU source code. >>> >>> There is no need for check of validity of the hex string after U >>> character >>> because strtol returns 0 in case the conversion was unsuccessful. >>> >>> Signed-off-by: Jan Krupa >>> >>> --- >>> ui/keymaps.c | 3 +++ >>> 1 files changed, 3 insertions(+), 0 deletions(-) >>> >>> diff --git a/ui/keymaps.c b/ui/keymaps.c >>> index f373cc5..426a893 100644 >>> --- a/ui/keymaps.c >>> +++ b/ui/keymaps.c >>> @@ -33,6 +33,9 @@ static int get_keysym(const name2keysym_t *table, >>> if (!strcmp(p->name, name)) >>> return p->keysym; >>> } >>> + if (strlen(name) =3D=3D 5 && name[0] =3D=3D 'U') { >>> + return (int)strtol(name + 1, NULL, 16); >>> + } >>> return 0; >>> } >>> >> >> I still dislike this. People already complained that the keysyms >> should be case-insensitive. And there might be many words starting >> with "u" and of 5 chars long. >> >> How about this: >> >> Author: Jan Krupa >> Date: Wed Oct 16 14:40:05 2013 +0200 >> >> qemu-char: add support for U-prefixed symbols >> >> This patch adds support for Unicode symbols in keymap files. This >> feature was already used in some keyboard layouts in QEMU generat= ed >> from XKB (e.g. Arabic) but it wasn't implemented in QEMU source >> code. >> >> There is no need for check of validity of the hex string after U >> character >> because strtol returns 0 in case the conversion was unsuccessful. >> >> Signed-off-by: Jan Krupa >> Signed-off-by: Michael Tokarev >> >> diff --git a/ui/keymaps.c b/ui/keymaps.c >> index f373cc5..80d658d 100644 >> --- a/ui/keymaps.c >> +++ b/ui/keymaps.c >> @@ -33,6 +33,12 @@ static int get_keysym(const name2keysym_t *table, >> if (!strcmp(p->name, name)) >> return p->keysym; >> } >> + if (name[0] =3D=3D 'U' && strlen(name) =3D=3D 5) { /* try unicode= Uxxxx */ >> + char *end; >> + int ret =3D (int)strtoul(name + 1, &end, 16); >=20 > Maybe strtol() here as in original.. On my system, both work > the same anyway :) Hi Michael, Thanks for the review! Your change looks good. Agree with adding it this way. Jan