diff options
| author | Paul Eggert | 2011-06-03 11:11:17 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-06-03 11:11:17 -0700 |
| commit | 39bc618abbfc4805d4d7dec195826577ef71da77 (patch) | |
| tree | c2fdf181a953d6168200c03c497a2b2f1f5aa132 | |
| parent | ea9fafe0937ebd99780610a7c1451ca08b013702 (diff) | |
| parent | 369b7e5ac5a6609433fc017d09e1f31750f033a7 (diff) | |
| download | emacs-39bc618abbfc4805d4d7dec195826577ef71da77.tar.gz emacs-39bc618abbfc4805d4d7dec195826577ef71da77.zip | |
Minor fixes for signed vs unsigned integers.
* character.h (MAYBE_UNIFY_CHAR):
* charset.c (maybe_unify_char):
* keyboard.c (read_char, reorder_modifiers):
XINT -> XFASTINT, since the integer must be nonnegative.
* ftfont.c (ftfont_spec_pattern):
* keymap.c (access_keymap, silly_event_symbol_error):
XUINT -> XFASTINT, since the integer must be nonnegative.
(Fsingle_key_description, preferred_sequence_p): XUINT -> XINT,
since it makes no difference and we prefer signed.
* keyboard.c (record_char): Use XUINT when all the neighbors do.
(access_keymap): NATNUMP -> INTEGERP, since the integer must be
nonnegative.
| -rw-r--r-- | src/ChangeLog | 16 | ||||
| -rw-r--r-- | src/character.h | 2 | ||||
| -rw-r--r-- | src/charset.c | 4 | ||||
| -rw-r--r-- | src/ftfont.c | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 8 | ||||
| -rw-r--r-- | src/keymap.c | 14 |
6 files changed, 31 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 45d8e38738a..431bd2acdb5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,19 @@ | |||
| 1 | 2011-06-03 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Minor fixes for signed vs unsigned integers. | ||
| 4 | * character.h (MAYBE_UNIFY_CHAR): | ||
| 5 | * charset.c (maybe_unify_char): | ||
| 6 | * keyboard.c (read_char, reorder_modifiers): | ||
| 7 | XINT -> XFASTINT, since the integer must be nonnegative. | ||
| 8 | * ftfont.c (ftfont_spec_pattern): | ||
| 9 | * keymap.c (access_keymap, silly_event_symbol_error): | ||
| 10 | XUINT -> XFASTINT, since the integer must be nonnegative. | ||
| 11 | (Fsingle_key_description, preferred_sequence_p): XUINT -> XINT, | ||
| 12 | since it makes no difference and we prefer signed. | ||
| 13 | * keyboard.c (record_char): Use XUINT when all the neighbors do. | ||
| 14 | (access_keymap): NATNUMP -> INTEGERP, since the integer must be | ||
| 15 | nonnegative. | ||
| 16 | |||
| 1 | 2011-06-02 Paul Eggert <eggert@cs.ucla.edu> | 17 | 2011-06-02 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 18 | ||
| 3 | Malloc failure behavior now depends on size of allocation. | 19 | Malloc failure behavior now depends on size of allocation. |
diff --git a/src/character.h b/src/character.h index 31e3b0a9416..884833775de 100644 --- a/src/character.h +++ b/src/character.h | |||
| @@ -544,7 +544,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 544 | Lisp_Object val; \ | 544 | Lisp_Object val; \ |
| 545 | val = CHAR_TABLE_REF (Vchar_unify_table, c); \ | 545 | val = CHAR_TABLE_REF (Vchar_unify_table, c); \ |
| 546 | if (INTEGERP (val)) \ | 546 | if (INTEGERP (val)) \ |
| 547 | c = XINT (val); \ | 547 | c = XFASTINT (val); \ |
| 548 | else if (! NILP (val)) \ | 548 | else if (! NILP (val)) \ |
| 549 | c = maybe_unify_char (c, val); \ | 549 | c = maybe_unify_char (c, val); \ |
| 550 | } \ | 550 | } \ |
diff --git a/src/charset.c b/src/charset.c index 0af21b48ad2..bfebe02f52e 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -1637,7 +1637,7 @@ maybe_unify_char (int c, Lisp_Object val) | |||
| 1637 | struct charset *charset; | 1637 | struct charset *charset; |
| 1638 | 1638 | ||
| 1639 | if (INTEGERP (val)) | 1639 | if (INTEGERP (val)) |
| 1640 | return XINT (val); | 1640 | return XFASTINT (val); |
| 1641 | if (NILP (val)) | 1641 | if (NILP (val)) |
| 1642 | return c; | 1642 | return c; |
| 1643 | 1643 | ||
| @@ -1647,7 +1647,7 @@ maybe_unify_char (int c, Lisp_Object val) | |||
| 1647 | { | 1647 | { |
| 1648 | val = CHAR_TABLE_REF (Vchar_unify_table, c); | 1648 | val = CHAR_TABLE_REF (Vchar_unify_table, c); |
| 1649 | if (! NILP (val)) | 1649 | if (! NILP (val)) |
| 1650 | c = XINT (val); | 1650 | c = XFASTINT (val); |
| 1651 | } | 1651 | } |
| 1652 | else | 1652 | else |
| 1653 | { | 1653 | { |
diff --git a/src/ftfont.c b/src/ftfont.c index 47425e853da..cd8829a3e51 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -815,7 +815,7 @@ ftfont_spec_pattern (Lisp_Object spec, char *otlayout, struct OpenTypeSpec **ots | |||
| 815 | goto err; | 815 | goto err; |
| 816 | for (chars = XCDR (chars); CONSP (chars); chars = XCDR (chars)) | 816 | for (chars = XCDR (chars); CONSP (chars); chars = XCDR (chars)) |
| 817 | if (CHARACTERP (XCAR (chars)) | 817 | if (CHARACTERP (XCAR (chars)) |
| 818 | && ! FcCharSetAddChar (charset, XUINT (XCAR (chars)))) | 818 | && ! FcCharSetAddChar (charset, XFASTINT (XCAR (chars)))) |
| 819 | goto err; | 819 | goto err; |
| 820 | } | 820 | } |
| 821 | } | 821 | } |
diff --git a/src/keyboard.c b/src/keyboard.c index 7bc406aab31..179557080ce 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -2395,8 +2395,8 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event | |||
| 2395 | 2395 | ||
| 2396 | c = Faref (Vexecuting_kbd_macro, make_number (executing_kbd_macro_index)); | 2396 | c = Faref (Vexecuting_kbd_macro, make_number (executing_kbd_macro_index)); |
| 2397 | if (STRINGP (Vexecuting_kbd_macro) | 2397 | if (STRINGP (Vexecuting_kbd_macro) |
| 2398 | && (XINT (c) & 0x80) && (XUINT (c) <= 0xff)) | 2398 | && (XFASTINT (c) & 0x80) && (XFASTINT (c) <= 0xff)) |
| 2399 | XSETFASTINT (c, CHAR_META | (XINT (c) & ~0x80)); | 2399 | XSETFASTINT (c, CHAR_META | (XFASTINT (c) & ~0x80)); |
| 2400 | 2400 | ||
| 2401 | executing_kbd_macro_index++; | 2401 | executing_kbd_macro_index++; |
| 2402 | 2402 | ||
| @@ -3321,7 +3321,7 @@ record_char (Lisp_Object c) | |||
| 3321 | if (INTEGERP (c)) | 3321 | if (INTEGERP (c)) |
| 3322 | { | 3322 | { |
| 3323 | if (XUINT (c) < 0x100) | 3323 | if (XUINT (c) < 0x100) |
| 3324 | putc (XINT (c), dribble); | 3324 | putc (XUINT (c), dribble); |
| 3325 | else | 3325 | else |
| 3326 | fprintf (dribble, " 0x%"pI"x", XUINT (c)); | 3326 | fprintf (dribble, " 0x%"pI"x", XUINT (c)); |
| 3327 | } | 3327 | } |
| @@ -6370,7 +6370,7 @@ reorder_modifiers (Lisp_Object symbol) | |||
| 6370 | Lisp_Object parsed; | 6370 | Lisp_Object parsed; |
| 6371 | 6371 | ||
| 6372 | parsed = parse_modifiers (symbol); | 6372 | parsed = parse_modifiers (symbol); |
| 6373 | return apply_modifiers ((int) XINT (XCAR (XCDR (parsed))), | 6373 | return apply_modifiers (XFASTINT (XCAR (XCDR (parsed))), |
| 6374 | XCAR (parsed)); | 6374 | XCAR (parsed)); |
| 6375 | } | 6375 | } |
| 6376 | 6376 | ||
diff --git a/src/keymap.c b/src/keymap.c index 79481833bde..6ef2a716b6d 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -462,7 +462,7 @@ access_keymap (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int au | |||
| 462 | XSETFASTINT (idx, XINT (idx) & (CHAR_META | (CHAR_META - 1))); | 462 | XSETFASTINT (idx, XINT (idx) & (CHAR_META | (CHAR_META - 1))); |
| 463 | 463 | ||
| 464 | /* Handle the special meta -> esc mapping. */ | 464 | /* Handle the special meta -> esc mapping. */ |
| 465 | if (INTEGERP (idx) && XUINT (idx) & meta_modifier) | 465 | if (INTEGERP (idx) && XFASTINT (idx) & meta_modifier) |
| 466 | { | 466 | { |
| 467 | /* See if there is a meta-map. If there's none, there is | 467 | /* See if there is a meta-map. If there's none, there is |
| 468 | no binding for IDX, unless a default binding exists in MAP. */ | 468 | no binding for IDX, unless a default binding exists in MAP. */ |
| @@ -480,7 +480,7 @@ access_keymap (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int au | |||
| 480 | if (CONSP (event_meta_map)) | 480 | if (CONSP (event_meta_map)) |
| 481 | { | 481 | { |
| 482 | map = event_meta_map; | 482 | map = event_meta_map; |
| 483 | idx = make_number (XUINT (idx) & ~meta_modifier); | 483 | idx = make_number (XFASTINT (idx) & ~meta_modifier); |
| 484 | } | 484 | } |
| 485 | else if (t_ok) | 485 | else if (t_ok) |
| 486 | /* Set IDX to t, so that we only find a default binding. */ | 486 | /* Set IDX to t, so that we only find a default binding. */ |
| @@ -529,7 +529,7 @@ access_keymap (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int au | |||
| 529 | } | 529 | } |
| 530 | else if (VECTORP (binding)) | 530 | else if (VECTORP (binding)) |
| 531 | { | 531 | { |
| 532 | if (NATNUMP (idx) && XFASTINT (idx) < ASIZE (binding)) | 532 | if (INTEGERP (idx) && XFASTINT (idx) < ASIZE (binding)) |
| 533 | val = AREF (binding, XFASTINT (idx)); | 533 | val = AREF (binding, XFASTINT (idx)); |
| 534 | } | 534 | } |
| 535 | else if (CHAR_TABLE_P (binding)) | 535 | else if (CHAR_TABLE_P (binding)) |
| @@ -537,7 +537,7 @@ access_keymap (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int au | |||
| 537 | /* Character codes with modifiers | 537 | /* Character codes with modifiers |
| 538 | are not included in a char-table. | 538 | are not included in a char-table. |
| 539 | All character codes without modifiers are included. */ | 539 | All character codes without modifiers are included. */ |
| 540 | if (NATNUMP (idx) && (XFASTINT (idx) & CHAR_MODIFIER_MASK) == 0) | 540 | if (INTEGERP (idx) && (XFASTINT (idx) & CHAR_MODIFIER_MASK) == 0) |
| 541 | { | 541 | { |
| 542 | val = Faref (binding, idx); | 542 | val = Faref (binding, idx); |
| 543 | /* `nil' has a special meaning for char-tables, so | 543 | /* `nil' has a special meaning for char-tables, so |
| @@ -1357,7 +1357,7 @@ silly_event_symbol_error (Lisp_Object c) | |||
| 1357 | int modifiers; | 1357 | int modifiers; |
| 1358 | 1358 | ||
| 1359 | parsed = parse_modifiers (c); | 1359 | parsed = parse_modifiers (c); |
| 1360 | modifiers = (int) XUINT (XCAR (XCDR (parsed))); | 1360 | modifiers = XFASTINT (XCAR (XCDR (parsed))); |
| 1361 | base = XCAR (parsed); | 1361 | base = XCAR (parsed); |
| 1362 | name = Fsymbol_name (base); | 1362 | name = Fsymbol_name (base); |
| 1363 | /* This alist includes elements such as ("RET" . "\\r"). */ | 1363 | /* This alist includes elements such as ("RET" . "\\r"). */ |
| @@ -2416,7 +2416,7 @@ around function keys and event symbols. */) | |||
| 2416 | { | 2416 | { |
| 2417 | char tem[KEY_DESCRIPTION_SIZE]; | 2417 | char tem[KEY_DESCRIPTION_SIZE]; |
| 2418 | 2418 | ||
| 2419 | *push_key_description (XUINT (key), tem, 1) = 0; | 2419 | *push_key_description (XINT (key), tem, 1) = 0; |
| 2420 | return build_string (tem); | 2420 | return build_string (tem); |
| 2421 | } | 2421 | } |
| 2422 | else if (SYMBOLP (key)) /* Function key or event-symbol */ | 2422 | else if (SYMBOLP (key)) /* Function key or event-symbol */ |
| @@ -2515,7 +2515,7 @@ preferred_sequence_p (Lisp_Object seq) | |||
| 2515 | return 0; | 2515 | return 0; |
| 2516 | else | 2516 | else |
| 2517 | { | 2517 | { |
| 2518 | int modifiers = XUINT (elt) & (CHAR_MODIFIER_MASK & ~CHAR_META); | 2518 | int modifiers = XINT (elt) & (CHAR_MODIFIER_MASK & ~CHAR_META); |
| 2519 | if (modifiers == where_is_preferred_modifier) | 2519 | if (modifiers == where_is_preferred_modifier) |
| 2520 | result = 2; | 2520 | result = 2; |
| 2521 | else if (modifiers) | 2521 | else if (modifiers) |