[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Qemu-trivial] [PATCH 3/3] qemu-char: add support for U

From: Michael Tokarev
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH 3/3] qemu-char: add support for U-prefixed symbols
Date: Sun, 01 Sep 2013 19:23:39 +0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130827 Icedove/17.0.8

27.08.2013 19:14, 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.

Signed-off-by: Jan Krupa <address@hidden>
  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) == 5 && name[0] == 'U') {
+        return (int)strtol(name + 1, NULL, 16);
+    }

How about something like

  if (sscanf(name, "U%04x", &temp) == 1)

instead, to ensure it actually is a valid hex number?
Because this code will behave in interesting way
given, eg, "U" or "UU"... ;)  But I don't think this
really matters much...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]