]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/osdep/windows/emuconsole.c: Remove unsigned comparison >= 0.
authorVladimir Serbinenko <phcoder@gmail.com>
Sun, 8 Dec 2013 17:16:32 +0000 (18:16 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Sun, 8 Dec 2013 17:16:32 +0000 (18:16 +0100)
But ensure that the variables in question are indeed unsigned.

ChangeLog
grub-core/osdep/windows/emuconsole.c

index c62eeb03cdd6404b6fae301b3678543d8d541c3d..9e2ed0c60b78fa94f7f9c94edf702211e92c7bc4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-08  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * 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  <phcoder@gmail.com>
 
        * grub-core/kern/emu/lite.c: Add missing include of ../ia64/dl_helper.c.
index 8d7483c3f252bd581089efdd25ea7cf5ed16c2ee..4fb3693cc01da0374c59db03941f6f447240a9d5 100644 (file)
@@ -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)