mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-20 20:07:36 +00:00
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.
This commit is contained in:
commit
39bc618abb
6 changed files with 31 additions and 15 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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); \
|
||||
} \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
|||
14
src/keymap.c
14
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue