diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2011-06-03 11:11:17 -0700 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-06-03 11:11:17 -0700 |
| commit | 39bc618abbfc4805d4d7dec195826577ef71da77 (patch) | |
| tree | c2fdf181a953d6168200c03c497a2b2f1f5aa132 /src | |
| parent | ea9fafe0937ebd99780610a7c1451ca08b013702 (diff) | |
| parent | 369b7e5ac5a6609433fc017d09e1f31750f033a7 (diff) | |
| download | emacs-39bc618abbfc4805d4d7dec195826577ef71da77.tar.gz | |
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.
Diffstat (limited to 'src')
| -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 @@ +2011-06-03 Paul Eggert <eggert@cs.ucla.edu> + + 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. + 2011-06-02 Paul Eggert <eggert@cs.ucla.edu> 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/>. */ Lisp_Object val; \ val = CHAR_TABLE_REF (Vchar_unify_table, c); \ if (INTEGERP (val)) \ - c = XINT (val); \ + c = XFASTINT (val); \ else if (! NILP (val)) \ c = maybe_unify_char (c, val); \ } \ 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) struct charset *charset; if (INTEGERP (val)) - return XINT (val); + return XFASTINT (val); if (NILP (val)) return c; @@ -1647,7 +1647,7 @@ maybe_unify_char (int c, Lisp_Object val) { val = CHAR_TABLE_REF (Vchar_unify_table, c); if (! NILP (val)) - c = XINT (val); + c = XFASTINT (val); } else { 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 goto err; for (chars = XCDR (chars); CONSP (chars); chars = XCDR (chars)) if (CHARACTERP (XCAR (chars)) - && ! FcCharSetAddChar (charset, XUINT (XCAR (chars)))) + && ! FcCharSetAddChar (charset, XFASTINT (XCAR (chars)))) goto err; } } 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 c = Faref (Vexecuting_kbd_macro, make_number (executing_kbd_macro_index)); if (STRINGP (Vexecuting_kbd_macro) - && (XINT (c) & 0x80) && (XUINT (c) <= 0xff)) - XSETFASTINT (c, CHAR_META | (XINT (c) & ~0x80)); + && (XFASTINT (c) & 0x80) && (XFASTINT (c) <= 0xff)) + XSETFASTINT (c, CHAR_META | (XFASTINT (c) & ~0x80)); executing_kbd_macro_index++; @@ -3321,7 +3321,7 @@ record_char (Lisp_Object c) if (INTEGERP (c)) { if (XUINT (c) < 0x100) - putc (XINT (c), dribble); + putc (XUINT (c), dribble); else fprintf (dribble, " 0x%"pI"x", XUINT (c)); } @@ -6370,7 +6370,7 @@ reorder_modifiers (Lisp_Object symbol) Lisp_Object parsed; parsed = parse_modifiers (symbol); - return apply_modifiers ((int) XINT (XCAR (XCDR (parsed))), + return apply_modifiers (XFASTINT (XCAR (XCDR (parsed))), XCAR (parsed)); } 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 XSETFASTINT (idx, XINT (idx) & (CHAR_META | (CHAR_META - 1))); /* Handle the special meta -> esc mapping. */ - if (INTEGERP (idx) && XUINT (idx) & meta_modifier) + if (INTEGERP (idx) && XFASTINT (idx) & meta_modifier) { /* See if there is a meta-map. If there's none, there is 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 if (CONSP (event_meta_map)) { map = event_meta_map; - idx = make_number (XUINT (idx) & ~meta_modifier); + idx = make_number (XFASTINT (idx) & ~meta_modifier); } else if (t_ok) /* 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 } else if (VECTORP (binding)) { - if (NATNUMP (idx) && XFASTINT (idx) < ASIZE (binding)) + if (INTEGERP (idx) && XFASTINT (idx) < ASIZE (binding)) val = AREF (binding, XFASTINT (idx)); } 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 /* Character codes with modifiers are not included in a char-table. All character codes without modifiers are included. */ - if (NATNUMP (idx) && (XFASTINT (idx) & CHAR_MODIFIER_MASK) == 0) + if (INTEGERP (idx) && (XFASTINT (idx) & CHAR_MODIFIER_MASK) == 0) { val = Faref (binding, idx); /* `nil' has a special meaning for char-tables, so @@ -1357,7 +1357,7 @@ silly_event_symbol_error (Lisp_Object c) int modifiers; parsed = parse_modifiers (c); - modifiers = (int) XUINT (XCAR (XCDR (parsed))); + modifiers = XFASTINT (XCAR (XCDR (parsed))); base = XCAR (parsed); name = Fsymbol_name (base); /* This alist includes elements such as ("RET" . "\\r"). */ @@ -2416,7 +2416,7 @@ around function keys and event symbols. */) { char tem[KEY_DESCRIPTION_SIZE]; - *push_key_description (XUINT (key), tem, 1) = 0; + *push_key_description (XINT (key), tem, 1) = 0; return build_string (tem); } else if (SYMBOLP (key)) /* Function key or event-symbol */ @@ -2515,7 +2515,7 @@ preferred_sequence_p (Lisp_Object seq) return 0; else { - int modifiers = XUINT (elt) & (CHAR_MODIFIER_MASK & ~CHAR_META); + int modifiers = XINT (elt) & (CHAR_MODIFIER_MASK & ~CHAR_META); if (modifiers == where_is_preferred_modifier) result = 2; else if (modifiers) |
