[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[2299] 2009-06-11 Pavel Roskin <address@hidden>
From: |
Pavel Roskin |
Subject: |
[2299] 2009-06-11 Pavel Roskin <address@hidden> |
Date: |
Thu, 11 Jun 2009 16:17:45 +0000 |
Revision: 2299
http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2299
Author: proski
Date: 2009-06-11 16:17:45 +0000 (Thu, 11 Jun 2009)
Log Message:
-----------
2009-06-11 Pavel Roskin <address@hidden>
* term/i386/pc/serial.c (serial_translate_key_sequence): Avoid
casts to short - they are not portable and cause warnings. Fix
use of uninitialized values in input_buf. Use ARRAY_SIZE.
Modified Paths:
--------------
trunk/grub2/ChangeLog
trunk/grub2/term/i386/pc/serial.c
Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog 2009-06-11 16:13:39 UTC (rev 2298)
+++ trunk/grub2/ChangeLog 2009-06-11 16:17:45 UTC (rev 2299)
@@ -1,3 +1,9 @@
+2009-06-11 Pavel Roskin <address@hidden>
+
+ * term/i386/pc/serial.c (serial_translate_key_sequence): Avoid
+ casts to short - they are not portable and cause warnings. Fix
+ use of uninitialized values in input_buf. Use ARRAY_SIZE.
+
2009-06-11 Vladimir Serbinenko <address@hidden>
Drivemap fixes
Modified: trunk/grub2/term/i386/pc/serial.c
===================================================================
--- trunk/grub2/term/i386/pc/serial.c 2009-06-11 16:13:39 UTC (rev 2298)
+++ trunk/grub2/term/i386/pc/serial.c 2009-06-11 16:17:45 UTC (rev 2299)
@@ -112,6 +112,7 @@
static void
serial_translate_key_sequence (void)
{
+ unsigned int i;
static struct
{
char key;
@@ -141,34 +142,27 @@
{('6' | ('~' << 8)), 3}
};
+ if (npending < 3)
+ return;
+
/* The buffer must start with "ESC [". */
- if (*((unsigned short *) input_buf) != ('\e' | ('[' << 8)))
+ if (input_buf[0] != '\e' || input_buf[1] != '[')
return;
- if (npending >= 3)
- {
- unsigned int i;
+ for (i = 0; ARRAY_SIZE (three_code_table); i++)
+ if (three_code_table[i].key == input_buf[2])
+ {
+ input_buf[0] = three_code_table[i].ascii;
+ npending -= 2;
+ grub_memmove (input_buf + 1, input_buf + 3, npending - 1);
+ return;
+ }
- for (i = 0;
- i < sizeof (three_code_table) / sizeof (three_code_table[0]);
- i++)
- if (three_code_table[i].key == input_buf[2])
- {
- input_buf[0] = three_code_table[i].ascii;
- npending -= 2;
- grub_memmove (input_buf + 1, input_buf + 3, npending - 1);
- return;
- }
- }
-
if (npending >= 4)
{
- unsigned int i;
- short key = *((short *) (input_buf + 2));
+ short key = input_buf[3] | (input_buf[4] << 8);
- for (i = 0;
- i < sizeof (four_code_table) / sizeof (four_code_table[0]);
- i++)
+ for (i = 0; i < ARRAY_SIZE (four_code_table); i++)
if (four_code_table[i].key == key)
{
input_buf[0] = four_code_table[i].ascii;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [2299] 2009-06-11 Pavel Roskin <address@hidden>,
Pavel Roskin <=