From 11e4167a35c6eecfadc8e27da2dc5e8cc313a2cd Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sun, 8 Dec 2013 18:16:32 +0100 Subject: [PATCH] * grub-core/osdep/windows/emuconsole.c: Remove unsigned comparison >= 0. But ensure that the variables in question are indeed unsigned. --- ChangeLog | 5 +++++ grub-core/osdep/windows/emuconsole.c | 8 +++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index c62eeb03c..9e2ed0c60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-12-08 Vladimir Serbinenko + + * grub-core/osdep/windows/emuconsole.c: Remove unsigned comparison >= 0. + But ensure that the variables in question are indeed unsigned. + 2013-12-08 Vladimir Serbinenko * grub-core/kern/emu/lite.c: Add missing include of ../ia64/dl_helper.c. diff --git a/grub-core/osdep/windows/emuconsole.c b/grub-core/osdep/windows/emuconsole.c index 8d7483c3f..4fb3693cc 100644 --- a/grub-core/osdep/windows/emuconsole.c +++ b/grub-core/osdep/windows/emuconsole.c @@ -108,11 +108,9 @@ grub_console_getkey (struct grub_term_input *term __attribute__ ((unused))) ret = ir.Event.KeyEvent.uChar.UnicodeChar; if (ret == 0) { - if (ir.Event.KeyEvent.wVirtualKeyCode >= 0 - && ir.Event.KeyEvent.wVirtualKeyCode - < ARRAY_SIZE (windows_codes) - && windows_codes[(int) ir.Event.KeyEvent.wVirtualKeyCode]) - ret = windows_codes[(int) ir.Event.KeyEvent.wVirtualKeyCode]; + unsigned kc = ir.Event.KeyEvent.wVirtualKeyCode; + if (kc < ARRAY_SIZE (windows_codes) && windows_codes[kc]) + ret = windows_codes[kc]; else continue; if (ir.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED)