diff options
| author | Joakim Verona | 2011-08-27 19:45:48 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-08-27 19:45:48 +0200 |
| commit | 9fb7b0cab34a48a4c7b66abb6b8edc4ee20467b4 (patch) | |
| tree | e94476d49f15747fcb9409d773702e88201855a4 /src/keyboard.c | |
| parent | c7489583c30031c0ecfae9d20b20c149ca1935e9 (diff) | |
| parent | b75258b32810f3690442bddef2e10eef126d2d25 (diff) | |
| download | emacs-9fb7b0cab34a48a4c7b66abb6b8edc4ee20467b4.tar.gz emacs-9fb7b0cab34a48a4c7b66abb6b8edc4ee20467b4.zip | |
upstream
Diffstat (limited to 'src/keyboard.c')
| -rw-r--r-- | src/keyboard.c | 101 |
1 files changed, 49 insertions, 52 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 95f64847a4f..054cd3e9a20 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -438,16 +438,16 @@ static void (*keyboard_init_hook) (void); | |||
| 438 | static int read_avail_input (int); | 438 | static int read_avail_input (int); |
| 439 | static void get_input_pending (int *, int); | 439 | static void get_input_pending (int *, int); |
| 440 | static int readable_events (int); | 440 | static int readable_events (int); |
| 441 | static Lisp_Object read_char_x_menu_prompt (int, Lisp_Object *, | 441 | static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *, |
| 442 | Lisp_Object, int *); | 442 | Lisp_Object, int *); |
| 443 | static Lisp_Object read_char_minibuf_menu_prompt (int, int, | 443 | static Lisp_Object read_char_minibuf_menu_prompt (int, ptrdiff_t, |
| 444 | Lisp_Object *); | 444 | Lisp_Object *); |
| 445 | static Lisp_Object make_lispy_event (struct input_event *); | 445 | static Lisp_Object make_lispy_event (struct input_event *); |
| 446 | #if defined (HAVE_MOUSE) || defined (HAVE_GPM) | 446 | #if defined (HAVE_MOUSE) || defined (HAVE_GPM) |
| 447 | static Lisp_Object make_lispy_movement (struct frame *, Lisp_Object, | 447 | static Lisp_Object make_lispy_movement (struct frame *, Lisp_Object, |
| 448 | enum scroll_bar_part, | 448 | enum scroll_bar_part, |
| 449 | Lisp_Object, Lisp_Object, | 449 | Lisp_Object, Lisp_Object, |
| 450 | unsigned long); | 450 | Time); |
| 451 | #endif | 451 | #endif |
| 452 | static Lisp_Object modify_event_symbol (EMACS_INT, unsigned, Lisp_Object, | 452 | static Lisp_Object modify_event_symbol (EMACS_INT, unsigned, Lisp_Object, |
| 453 | Lisp_Object, const char *const *, | 453 | Lisp_Object, const char *const *, |
| @@ -1303,7 +1303,7 @@ some_mouse_moved (void) | |||
| 1303 | /* This is the actual command reading loop, | 1303 | /* This is the actual command reading loop, |
| 1304 | sans error-handling encapsulation. */ | 1304 | sans error-handling encapsulation. */ |
| 1305 | 1305 | ||
| 1306 | static int read_key_sequence (Lisp_Object *, size_t, Lisp_Object, | 1306 | static int read_key_sequence (Lisp_Object *, int, Lisp_Object, |
| 1307 | int, int, int); | 1307 | int, int, int); |
| 1308 | void safe_run_hooks (Lisp_Object); | 1308 | void safe_run_hooks (Lisp_Object); |
| 1309 | static void adjust_point_for_property (EMACS_INT, int); | 1309 | static void adjust_point_for_property (EMACS_INT, int); |
| @@ -2270,7 +2270,8 @@ do { if (polling_stopped_here) start_polling (); \ | |||
| 2270 | Value is t if we showed a menu and the user rejected it. */ | 2270 | Value is t if we showed a menu and the user rejected it. */ |
| 2271 | 2271 | ||
| 2272 | Lisp_Object | 2272 | Lisp_Object |
| 2273 | read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event, | 2273 | read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, |
| 2274 | Lisp_Object prev_event, | ||
| 2274 | int *used_mouse_menu, struct timeval *end_time) | 2275 | int *used_mouse_menu, struct timeval *end_time) |
| 2275 | { | 2276 | { |
| 2276 | volatile Lisp_Object c; | 2277 | volatile Lisp_Object c; |
| @@ -7421,7 +7422,7 @@ menu_bar_items (Lisp_Object old) | |||
| 7421 | { | 7422 | { |
| 7422 | /* The number of keymaps we're scanning right now, and the number of | 7423 | /* The number of keymaps we're scanning right now, and the number of |
| 7423 | keymaps we have allocated space for. */ | 7424 | keymaps we have allocated space for. */ |
| 7424 | int nmaps; | 7425 | ptrdiff_t nmaps; |
| 7425 | 7426 | ||
| 7426 | /* maps[0..nmaps-1] are the prefix definitions of KEYBUF[0..t-1] | 7427 | /* maps[0..nmaps-1] are the prefix definitions of KEYBUF[0..t-1] |
| 7427 | in the current keymaps, or nil where it is not a prefix. */ | 7428 | in the current keymaps, or nil where it is not a prefix. */ |
| @@ -7429,7 +7430,7 @@ menu_bar_items (Lisp_Object old) | |||
| 7429 | 7430 | ||
| 7430 | Lisp_Object def, tail; | 7431 | Lisp_Object def, tail; |
| 7431 | 7432 | ||
| 7432 | int mapno; | 7433 | ptrdiff_t mapno; |
| 7433 | Lisp_Object oquit; | 7434 | Lisp_Object oquit; |
| 7434 | 7435 | ||
| 7435 | /* In order to build the menus, we need to call the keymap | 7436 | /* In order to build the menus, we need to call the keymap |
| @@ -7474,7 +7475,7 @@ menu_bar_items (Lisp_Object old) | |||
| 7474 | recognized when the menu-bar (or mode-line) is updated, | 7475 | recognized when the menu-bar (or mode-line) is updated, |
| 7475 | which does not normally happen after every command. */ | 7476 | which does not normally happen after every command. */ |
| 7476 | Lisp_Object tem; | 7477 | Lisp_Object tem; |
| 7477 | int nminor; | 7478 | ptrdiff_t nminor; |
| 7478 | nminor = current_minor_maps (NULL, &tmaps); | 7479 | nminor = current_minor_maps (NULL, &tmaps); |
| 7479 | maps = (Lisp_Object *) alloca ((nminor + 3) * sizeof (maps[0])); | 7480 | maps = (Lisp_Object *) alloca ((nminor + 3) * sizeof (maps[0])); |
| 7480 | nmaps = 0; | 7481 | nmaps = 0; |
| @@ -7978,7 +7979,7 @@ Lisp_Object | |||
| 7978 | tool_bar_items (Lisp_Object reuse, int *nitems) | 7979 | tool_bar_items (Lisp_Object reuse, int *nitems) |
| 7979 | { | 7980 | { |
| 7980 | Lisp_Object *maps; | 7981 | Lisp_Object *maps; |
| 7981 | int nmaps, i; | 7982 | ptrdiff_t nmaps, i; |
| 7982 | Lisp_Object oquit; | 7983 | Lisp_Object oquit; |
| 7983 | Lisp_Object *tmaps; | 7984 | Lisp_Object *tmaps; |
| 7984 | 7985 | ||
| @@ -8018,7 +8019,7 @@ tool_bar_items (Lisp_Object reuse, int *nitems) | |||
| 8018 | recognized when the tool-bar (or mode-line) is updated, | 8019 | recognized when the tool-bar (or mode-line) is updated, |
| 8019 | which does not normally happen after every command. */ | 8020 | which does not normally happen after every command. */ |
| 8020 | Lisp_Object tem; | 8021 | Lisp_Object tem; |
| 8021 | int nminor; | 8022 | ptrdiff_t nminor; |
| 8022 | nminor = current_minor_maps (NULL, &tmaps); | 8023 | nminor = current_minor_maps (NULL, &tmaps); |
| 8023 | maps = (Lisp_Object *) alloca ((nminor + 3) * sizeof (maps[0])); | 8024 | maps = (Lisp_Object *) alloca ((nminor + 3) * sizeof (maps[0])); |
| 8024 | nmaps = 0; | 8025 | nmaps = 0; |
| @@ -8290,10 +8291,11 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) | |||
| 8290 | Lisp_Object tcapt = PROP (TOOL_BAR_ITEM_CAPTION); | 8291 | Lisp_Object tcapt = PROP (TOOL_BAR_ITEM_CAPTION); |
| 8291 | const char *label = SYMBOLP (tkey) ? SSDATA (SYMBOL_NAME (tkey)) : ""; | 8292 | const char *label = SYMBOLP (tkey) ? SSDATA (SYMBOL_NAME (tkey)) : ""; |
| 8292 | const char *capt = STRINGP (tcapt) ? SSDATA (tcapt) : ""; | 8293 | const char *capt = STRINGP (tcapt) ? SSDATA (tcapt) : ""; |
| 8293 | EMACS_INT max_lbl = 2 * tool_bar_max_label_size; | 8294 | ptrdiff_t max_lbl = |
| 8295 | 2 * max (0, min (tool_bar_max_label_size, STRING_BYTES_BOUND / 2)); | ||
| 8294 | char *buf = (char *) xmalloc (max_lbl + 1); | 8296 | char *buf = (char *) xmalloc (max_lbl + 1); |
| 8295 | Lisp_Object new_lbl; | 8297 | Lisp_Object new_lbl; |
| 8296 | size_t caption_len = strlen (capt); | 8298 | ptrdiff_t caption_len = strlen (capt); |
| 8297 | 8299 | ||
| 8298 | if (caption_len <= max_lbl && capt[0] != '\0') | 8300 | if (caption_len <= max_lbl && capt[0] != '\0') |
| 8299 | { | 8301 | { |
| @@ -8306,7 +8308,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item) | |||
| 8306 | 8308 | ||
| 8307 | if (strlen (label) <= max_lbl && label[0] != '\0') | 8309 | if (strlen (label) <= max_lbl && label[0] != '\0') |
| 8308 | { | 8310 | { |
| 8309 | int j; | 8311 | ptrdiff_t j; |
| 8310 | if (label != buf) | 8312 | if (label != buf) |
| 8311 | strcpy (buf, label); | 8313 | strcpy (buf, label); |
| 8312 | 8314 | ||
| @@ -8415,10 +8417,10 @@ append_tool_bar_item (void) | |||
| 8415 | and do auto-saving in the inner call of read_char. */ | 8417 | and do auto-saving in the inner call of read_char. */ |
| 8416 | 8418 | ||
| 8417 | static Lisp_Object | 8419 | static Lisp_Object |
| 8418 | read_char_x_menu_prompt (int nmaps, Lisp_Object *maps, Lisp_Object prev_event, | 8420 | read_char_x_menu_prompt (ptrdiff_t nmaps, Lisp_Object *maps, |
| 8419 | int *used_mouse_menu) | 8421 | Lisp_Object prev_event, int *used_mouse_menu) |
| 8420 | { | 8422 | { |
| 8421 | int mapno; | 8423 | ptrdiff_t mapno; |
| 8422 | 8424 | ||
| 8423 | if (used_mouse_menu) | 8425 | if (used_mouse_menu) |
| 8424 | *used_mouse_menu = 0; | 8426 | *used_mouse_menu = 0; |
| @@ -8446,7 +8448,7 @@ read_char_x_menu_prompt (int nmaps, Lisp_Object *maps, Lisp_Object prev_event, | |||
| 8446 | Lisp_Object *realmaps | 8448 | Lisp_Object *realmaps |
| 8447 | = (Lisp_Object *) alloca (nmaps * sizeof (Lisp_Object)); | 8449 | = (Lisp_Object *) alloca (nmaps * sizeof (Lisp_Object)); |
| 8448 | Lisp_Object value; | 8450 | Lisp_Object value; |
| 8449 | int nmaps1 = 0; | 8451 | ptrdiff_t nmaps1 = 0; |
| 8450 | 8452 | ||
| 8451 | /* Use the maps that are not nil. */ | 8453 | /* Use the maps that are not nil. */ |
| 8452 | for (mapno = 0; mapno < nmaps; mapno++) | 8454 | for (mapno = 0; mapno < nmaps; mapno++) |
| @@ -8497,17 +8499,18 @@ read_char_x_menu_prompt (int nmaps, Lisp_Object *maps, Lisp_Object prev_event, | |||
| 8497 | We make this bigger when necessary, and never free it. */ | 8499 | We make this bigger when necessary, and never free it. */ |
| 8498 | static char *read_char_minibuf_menu_text; | 8500 | static char *read_char_minibuf_menu_text; |
| 8499 | /* Size of that buffer. */ | 8501 | /* Size of that buffer. */ |
| 8500 | static int read_char_minibuf_menu_width; | 8502 | static ptrdiff_t read_char_minibuf_menu_width; |
| 8501 | 8503 | ||
| 8502 | static Lisp_Object | 8504 | static Lisp_Object |
| 8503 | read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) | 8505 | read_char_minibuf_menu_prompt (int commandflag, |
| 8506 | ptrdiff_t nmaps, Lisp_Object *maps) | ||
| 8504 | { | 8507 | { |
| 8505 | int mapno; | 8508 | ptrdiff_t mapno; |
| 8506 | register Lisp_Object name; | 8509 | register Lisp_Object name; |
| 8507 | int nlength; | 8510 | ptrdiff_t nlength; |
| 8508 | /* FIXME: Use the minibuffer's frame width. */ | 8511 | /* FIXME: Use the minibuffer's frame width. */ |
| 8509 | int width = FRAME_COLS (SELECTED_FRAME ()) - 4; | 8512 | ptrdiff_t width = FRAME_COLS (SELECTED_FRAME ()) - 4; |
| 8510 | int idx = -1; | 8513 | ptrdiff_t idx = -1; |
| 8511 | int nobindings = 1; | 8514 | int nobindings = 1; |
| 8512 | Lisp_Object rest, vector; | 8515 | Lisp_Object rest, vector; |
| 8513 | char *menu; | 8516 | char *menu; |
| @@ -8532,16 +8535,13 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) | |||
| 8532 | 8535 | ||
| 8533 | /* Make sure we have a big enough buffer for the menu text. */ | 8536 | /* Make sure we have a big enough buffer for the menu text. */ |
| 8534 | width = max (width, SBYTES (name)); | 8537 | width = max (width, SBYTES (name)); |
| 8535 | if (read_char_minibuf_menu_text == 0) | 8538 | if (STRING_BYTES_BOUND - 4 < width) |
| 8539 | memory_full (SIZE_MAX); | ||
| 8540 | if (width + 4 > read_char_minibuf_menu_width) | ||
| 8536 | { | 8541 | { |
| 8537 | read_char_minibuf_menu_width = width + 4; | ||
| 8538 | read_char_minibuf_menu_text = (char *) xmalloc (width + 4); | ||
| 8539 | } | ||
| 8540 | else if (width + 4 > read_char_minibuf_menu_width) | ||
| 8541 | { | ||
| 8542 | read_char_minibuf_menu_width = width + 4; | ||
| 8543 | read_char_minibuf_menu_text | 8542 | read_char_minibuf_menu_text |
| 8544 | = (char *) xrealloc (read_char_minibuf_menu_text, width + 4); | 8543 | = (char *) xrealloc (read_char_minibuf_menu_text, width + 4); |
| 8544 | read_char_minibuf_menu_width = width + 4; | ||
| 8545 | } | 8545 | } |
| 8546 | menu = read_char_minibuf_menu_text; | 8546 | menu = read_char_minibuf_menu_text; |
| 8547 | 8547 | ||
| @@ -8560,7 +8560,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) | |||
| 8560 | while (1) | 8560 | while (1) |
| 8561 | { | 8561 | { |
| 8562 | int notfirst = 0; | 8562 | int notfirst = 0; |
| 8563 | int i = nlength; | 8563 | ptrdiff_t i = nlength; |
| 8564 | Lisp_Object obj; | 8564 | Lisp_Object obj; |
| 8565 | Lisp_Object orig_defn_macro; | 8565 | Lisp_Object orig_defn_macro; |
| 8566 | 8566 | ||
| @@ -8659,7 +8659,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) | |||
| 8659 | < width | 8659 | < width |
| 8660 | || !notfirst) | 8660 | || !notfirst) |
| 8661 | { | 8661 | { |
| 8662 | int thiswidth; | 8662 | ptrdiff_t thiswidth; |
| 8663 | 8663 | ||
| 8664 | /* Punctuate between strings. */ | 8664 | /* Punctuate between strings. */ |
| 8665 | if (notfirst) | 8665 | if (notfirst) |
| @@ -8675,9 +8675,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) | |||
| 8675 | if (! char_matches) | 8675 | if (! char_matches) |
| 8676 | { | 8676 | { |
| 8677 | /* Add as much of string as fits. */ | 8677 | /* Add as much of string as fits. */ |
| 8678 | thiswidth = SCHARS (desc); | 8678 | thiswidth = min (SCHARS (desc), width - i); |
| 8679 | if (thiswidth + i > width) | ||
| 8680 | thiswidth = width - i; | ||
| 8681 | memcpy (menu + i, SDATA (desc), thiswidth); | 8679 | memcpy (menu + i, SDATA (desc), thiswidth); |
| 8682 | i += thiswidth; | 8680 | i += thiswidth; |
| 8683 | strcpy (menu + i, " = "); | 8681 | strcpy (menu + i, " = "); |
| @@ -8685,9 +8683,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) | |||
| 8685 | } | 8683 | } |
| 8686 | 8684 | ||
| 8687 | /* Add as much of string as fits. */ | 8685 | /* Add as much of string as fits. */ |
| 8688 | thiswidth = SCHARS (s); | 8686 | thiswidth = min (SCHARS (s), width - i); |
| 8689 | if (thiswidth + i > width) | ||
| 8690 | thiswidth = width - i; | ||
| 8691 | memcpy (menu + i, SDATA (s), thiswidth); | 8687 | memcpy (menu + i, SDATA (s), thiswidth); |
| 8692 | i += thiswidth; | 8688 | i += thiswidth; |
| 8693 | menu[i] = 0; | 8689 | menu[i] = 0; |
| @@ -8762,10 +8758,10 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) | |||
| 8762 | NEXT may be the same array as CURRENT. */ | 8758 | NEXT may be the same array as CURRENT. */ |
| 8763 | 8759 | ||
| 8764 | static int | 8760 | static int |
| 8765 | follow_key (Lisp_Object key, int nmaps, Lisp_Object *current, Lisp_Object *defs, | 8761 | follow_key (Lisp_Object key, ptrdiff_t nmaps, Lisp_Object *current, |
| 8766 | Lisp_Object *next) | 8762 | Lisp_Object *defs, Lisp_Object *next) |
| 8767 | { | 8763 | { |
| 8768 | int i, first_binding; | 8764 | ptrdiff_t i, first_binding; |
| 8769 | 8765 | ||
| 8770 | first_binding = nmaps; | 8766 | first_binding = nmaps; |
| 8771 | for (i = nmaps - 1; i >= 0; i--) | 8767 | for (i = nmaps - 1; i >= 0; i--) |
| @@ -8865,7 +8861,7 @@ access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt, | |||
| 8865 | The return value is non-zero if the remapping actually took place. */ | 8861 | The return value is non-zero if the remapping actually took place. */ |
| 8866 | 8862 | ||
| 8867 | static int | 8863 | static int |
| 8868 | keyremap_step (Lisp_Object *keybuf, size_t bufsize, volatile keyremap *fkey, | 8864 | keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey, |
| 8869 | int input, int doit, int *diff, Lisp_Object prompt) | 8865 | int input, int doit, int *diff, Lisp_Object prompt) |
| 8870 | { | 8866 | { |
| 8871 | Lisp_Object next, key; | 8867 | Lisp_Object next, key; |
| @@ -8887,7 +8883,7 @@ keyremap_step (Lisp_Object *keybuf, size_t bufsize, volatile keyremap *fkey, | |||
| 8887 | 8883 | ||
| 8888 | *diff = len - (fkey->end - fkey->start); | 8884 | *diff = len - (fkey->end - fkey->start); |
| 8889 | 8885 | ||
| 8890 | if (input + *diff >= bufsize) | 8886 | if (bufsize - input <= *diff) |
| 8891 | error ("Key sequence too long"); | 8887 | error ("Key sequence too long"); |
| 8892 | 8888 | ||
| 8893 | /* Shift the keys that follow fkey->end. */ | 8889 | /* Shift the keys that follow fkey->end. */ |
| @@ -8958,7 +8954,7 @@ keyremap_step (Lisp_Object *keybuf, size_t bufsize, volatile keyremap *fkey, | |||
| 8958 | from the selected window's buffer. */ | 8954 | from the selected window's buffer. */ |
| 8959 | 8955 | ||
| 8960 | static int | 8956 | static int |
| 8961 | read_key_sequence (Lisp_Object *keybuf, size_t bufsize, Lisp_Object prompt, | 8957 | read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, |
| 8962 | int dont_downcase_last, int can_return_switch_frame, | 8958 | int dont_downcase_last, int can_return_switch_frame, |
| 8963 | int fix_current_buffer) | 8959 | int fix_current_buffer) |
| 8964 | { | 8960 | { |
| @@ -8975,8 +8971,8 @@ read_key_sequence (Lisp_Object *keybuf, size_t bufsize, Lisp_Object prompt, | |||
| 8975 | 8971 | ||
| 8976 | /* The number of keymaps we're scanning right now, and the number of | 8972 | /* The number of keymaps we're scanning right now, and the number of |
| 8977 | keymaps we have allocated space for. */ | 8973 | keymaps we have allocated space for. */ |
| 8978 | int nmaps; | 8974 | ptrdiff_t nmaps; |
| 8979 | int nmaps_allocated = 0; | 8975 | ptrdiff_t nmaps_allocated = 0; |
| 8980 | 8976 | ||
| 8981 | /* defs[0..nmaps-1] are the definitions of KEYBUF[0..t-1] in | 8977 | /* defs[0..nmaps-1] are the definitions of KEYBUF[0..t-1] in |
| 8982 | the current keymaps. */ | 8978 | the current keymaps. */ |
| @@ -9000,7 +8996,7 @@ read_key_sequence (Lisp_Object *keybuf, size_t bufsize, Lisp_Object prompt, | |||
| 9000 | /* The index in submaps[] of the first keymap that has a binding for | 8996 | /* The index in submaps[] of the first keymap that has a binding for |
| 9001 | this key sequence. In other words, the lowest i such that | 8997 | this key sequence. In other words, the lowest i such that |
| 9002 | submaps[i] is non-nil. */ | 8998 | submaps[i] is non-nil. */ |
| 9003 | int first_binding; | 8999 | ptrdiff_t first_binding; |
| 9004 | /* Index of the first key that has no binding. | 9000 | /* Index of the first key that has no binding. |
| 9005 | It is useless to try fkey.start larger than that. */ | 9001 | It is useless to try fkey.start larger than that. */ |
| 9006 | int first_unbound; | 9002 | int first_unbound; |
| @@ -9161,8 +9157,8 @@ read_key_sequence (Lisp_Object *keybuf, size_t bufsize, Lisp_Object prompt, | |||
| 9161 | } | 9157 | } |
| 9162 | else | 9158 | else |
| 9163 | { | 9159 | { |
| 9164 | int nminor; | 9160 | ptrdiff_t nminor; |
| 9165 | int total; | 9161 | ptrdiff_t total; |
| 9166 | Lisp_Object *maps; | 9162 | Lisp_Object *maps; |
| 9167 | 9163 | ||
| 9168 | nminor = current_minor_maps (0, &maps); | 9164 | nminor = current_minor_maps (0, &maps); |
| @@ -9228,7 +9224,8 @@ read_key_sequence (Lisp_Object *keybuf, size_t bufsize, Lisp_Object prompt, | |||
| 9228 | echo_local_start and keys_local_start allow us to throw away | 9224 | echo_local_start and keys_local_start allow us to throw away |
| 9229 | just one key. */ | 9225 | just one key. */ |
| 9230 | int echo_local_start IF_LINT (= 0); | 9226 | int echo_local_start IF_LINT (= 0); |
| 9231 | int keys_local_start, local_first_binding; | 9227 | int keys_local_start; |
| 9228 | ptrdiff_t local_first_binding; | ||
| 9232 | 9229 | ||
| 9233 | eassert (indec.end == t || (indec.end > t && indec.end <= mock_input)); | 9230 | eassert (indec.end == t || (indec.end > t && indec.end <= mock_input)); |
| 9234 | eassert (indec.start <= indec.end); | 9231 | eassert (indec.start <= indec.end); |
| @@ -9565,7 +9562,7 @@ read_key_sequence (Lisp_Object *keybuf, size_t bufsize, Lisp_Object prompt, | |||
| 9565 | && (NILP (fake_prefixed_keys) | 9562 | && (NILP (fake_prefixed_keys) |
| 9566 | || NILP (Fmemq (key, fake_prefixed_keys)))) | 9563 | || NILP (Fmemq (key, fake_prefixed_keys)))) |
| 9567 | { | 9564 | { |
| 9568 | if (t + 1 >= bufsize) | 9565 | if (bufsize - t <= 1) |
| 9569 | error ("Key sequence too long"); | 9566 | error ("Key sequence too long"); |
| 9570 | 9567 | ||
| 9571 | keybuf[t] = posn; | 9568 | keybuf[t] = posn; |
| @@ -9646,7 +9643,7 @@ read_key_sequence (Lisp_Object *keybuf, size_t bufsize, Lisp_Object prompt, | |||
| 9646 | insert the dummy prefix event `menu-bar'. */ | 9643 | insert the dummy prefix event `menu-bar'. */ |
| 9647 | if (EQ (posn, Qmenu_bar) || EQ (posn, Qtool_bar)) | 9644 | if (EQ (posn, Qmenu_bar) || EQ (posn, Qtool_bar)) |
| 9648 | { | 9645 | { |
| 9649 | if (t + 1 >= bufsize) | 9646 | if (bufsize - t <= 1) |
| 9650 | error ("Key sequence too long"); | 9647 | error ("Key sequence too long"); |
| 9651 | keybuf[t] = posn; | 9648 | keybuf[t] = posn; |
| 9652 | keybuf[t+1] = key; | 9649 | keybuf[t+1] = key; |