aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2017-02-16 07:49:03 -0800
committerPaul Eggert2017-02-16 07:54:12 -0800
commit064541af6a71bf45d530fe34b7e00c8123ee93d8 (patch)
treed9bd173548eda3d477c0077cd21c638a41e5e0d8 /src
parent501ad546263ed2a902be1c9d8c1bb3af5794066b (diff)
downloademacs-064541af6a71bf45d530fe34b7e00c8123ee93d8.tar.gz
emacs-064541af6a71bf45d530fe34b7e00c8123ee93d8.zip
* src/keyboard.c (read_key_sequence): Fix integer-overflow glitch.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 0fad633581d..d2f4b504abf 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5421,26 +5421,26 @@ make_lispy_event (struct input_event *event)
5421 not. And Control+Shift+s should produce C-S-s whether 5421 not. And Control+Shift+s should produce C-S-s whether
5422 caps-lock is on or not. */ 5422 caps-lock is on or not. */
5423 if (event->modifiers & ~shift_modifier) 5423 if (event->modifiers & ~shift_modifier)
5424 { 5424 {
5425 /* This is a key chord: some non-shift modifier is 5425 /* This is a key chord: some non-shift modifier is
5426 depressed. */ 5426 depressed. */
5427 5427
5428 if (uppercasep (c) && 5428 if (uppercasep (c) &&
5429 !(event->modifiers & shift_modifier)) 5429 !(event->modifiers & shift_modifier))
5430 { 5430 {
5431 /* Got a capital letter without a shift. The caps 5431 /* Got a capital letter without a shift. The caps
5432 lock is on. Un-capitalize the letter. */ 5432 lock is on. Un-capitalize the letter. */
5433 c = downcase (c); 5433 c = downcase (c);
5434 } 5434 }
5435 else if (lowercasep (c) && 5435 else if (lowercasep (c) &&
5436 (event->modifiers & shift_modifier)) 5436 (event->modifiers & shift_modifier))
5437 { 5437 {
5438 /* Got a lower-case letter even though shift is 5438 /* Got a lower-case letter even though shift is
5439 depressed. The caps lock is on. Capitalize the 5439 depressed. The caps lock is on. Capitalize the
5440 letter. */ 5440 letter. */
5441 c = upcase (c); 5441 c = upcase (c);
5442 } 5442 }
5443 } 5443 }
5444 5444
5445 if (event->kind == ASCII_KEYSTROKE_EVENT) 5445 if (event->kind == ASCII_KEYSTROKE_EVENT)
5446 { 5446 {
@@ -9645,13 +9645,13 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9645 && INTEGERP (key)) 9645 && INTEGERP (key))
9646 { 9646 {
9647 Lisp_Object new_key; 9647 Lisp_Object new_key;
9648 int k = XINT (key); 9648 EMACS_INT k = XINT (key);
9649 9649
9650 if (k & shift_modifier) 9650 if (k & shift_modifier)
9651 XSETINT (new_key, k & ~shift_modifier); 9651 XSETINT (new_key, k & ~shift_modifier);
9652 else if (CHARACTERP (make_number (k & ~CHAR_MODIFIER_MASK))) 9652 else if (CHARACTERP (make_number (k & ~CHAR_MODIFIER_MASK)))
9653 { 9653 {
9654 int dc = downcase(k & ~CHAR_MODIFIER_MASK); 9654 int dc = downcase (k & ~CHAR_MODIFIER_MASK);
9655 if (dc == (k & ~CHAR_MODIFIER_MASK)) 9655 if (dc == (k & ~CHAR_MODIFIER_MASK))
9656 goto not_upcase; 9656 goto not_upcase;
9657 XSETINT (new_key, dc | (k & CHAR_MODIFIER_MASK)); 9657 XSETINT (new_key, dc | (k & CHAR_MODIFIER_MASK));