From 41118bd30dd303cf60a70990c5347a6cfdfca1ef Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 25 Sep 2010 05:36:36 -0400 Subject: [PATCH] Fix int/EMACS_INT use in keyboard.c. keyboard.c : Declare EMACS_INT. (echo_truncate, adjust_point_for_property, read_char) (gen_help_event, make_lispy_event, modify_event_symbol) (Fexecute_extended_command, stuff_buffered_input): Use EMACS_INT for buffer positions and string length. keyboard.h (gen_help_event): Adjust prototype. termhooks.h : Make `code' member EMACS_INT. commands.h : Declare EMACS_INT. xdisp.c : Define as EMACS_INT. (truncate_echo_area): Accept EMACS_INT argument. dispextern.h : Declare EMACS_INT. lisp.h (truncate_echo_area): Adjust prototype. composite.c (composition_adjust_point): Return EMACS_INT. composite.h (composition_adjust_point): Adjust prototype. --- src/ChangeLog | 26 ++++++++++++++++++++++++++ src/commands.h | 2 +- src/composite.c | 2 +- src/composite.h | 2 +- src/dispextern.h | 2 +- src/keyboard.c | 45 ++++++++++++++++++++++----------------------- src/keyboard.h | 2 +- src/lisp.h | 2 +- src/termhooks.h | 6 ++++-- src/xdisp.c | 4 ++-- 10 files changed, 60 insertions(+), 33 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4f458809e77..df066ac9a4d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,29 @@ +2010-09-25 Eli Zaretskii + + * keyboard.c : Declare + EMACS_INT. + (echo_truncate, adjust_point_for_property, read_char) + (gen_help_event, make_lispy_event, modify_event_symbol) + (Fexecute_extended_command, stuff_buffered_input): Use EMACS_INT + for buffer positions and string length. + + * keyboard.h (gen_help_event): Adjust prototype. + + * termhooks.h : Make `code' member EMACS_INT. + + * commands.h : Declare EMACS_INT. + + * xdisp.c : Define as EMACS_INT. + (truncate_echo_area): Accept EMACS_INT argument. + + * dispextern.h : Declare EMACS_INT. + + * lisp.h (truncate_echo_area): Adjust prototype. + + * composite.c (composition_adjust_point): Return EMACS_INT. + + * composite.h (composition_adjust_point): Adjust prototype. + 2010-09-25 Juanma Barranquero * process.c (Fmake_network_process): When arg :host is 'local, diff --git a/src/commands.h b/src/commands.h index 52136428eee..6b22da8ba15 100644 --- a/src/commands.h +++ b/src/commands.h @@ -74,7 +74,7 @@ extern Lisp_Object Vthis_command; extern Lisp_Object unread_switch_frame; /* The value of point when the last command was started. */ -extern int last_point_position; +extern EMACS_INT last_point_position; /* The buffer that was current when the last command was started. */ extern Lisp_Object last_point_position_buffer; diff --git a/src/composite.c b/src/composite.c index 8849f5274b0..be9aafbeacc 100644 --- a/src/composite.c +++ b/src/composite.c @@ -1662,7 +1662,7 @@ find_automatic_composition (EMACS_INT pos, EMACS_INT limit, EMACS_INT *start, EM /* Return the adjusted point provided that point is moved from LAST_PT to NEW_PT. */ -int +EMACS_INT composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt) { EMACS_INT charpos, bytepos, startpos, beg, end, pos; diff --git a/src/composite.h b/src/composite.h index 157d90caf05..5c8ade39596 100644 --- a/src/composite.h +++ b/src/composite.h @@ -320,7 +320,7 @@ extern int composition_reseat_it (struct composition_it *, extern int composition_update_it (struct composition_it *, EMACS_INT, EMACS_INT, Lisp_Object); -extern int composition_adjust_point (EMACS_INT, EMACS_INT); +extern EMACS_INT composition_adjust_point (EMACS_INT, EMACS_INT); EXFUN (Fcompose_region_internal, 4); EXFUN (Fcompose_string_internal, 5); diff --git a/src/dispextern.h b/src/dispextern.h index c23c1b673ad..8c73117a4e7 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2957,7 +2957,7 @@ extern int help_echo_showing_p; extern int current_mode_line_height, current_header_line_height; extern Lisp_Object help_echo_string, help_echo_window; extern Lisp_Object help_echo_object, previous_help_echo_string; -extern int help_echo_pos; +extern EMACS_INT help_echo_pos; extern struct frame *last_mouse_frame; extern int last_tool_bar_item; extern Lisp_Object Vmouse_autoselect_window; diff --git a/src/keyboard.c b/src/keyboard.c index 0c58552c013..7321fa4e7a9 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -304,7 +304,7 @@ EMACS_INT extra_keyboard_modifiers; Lisp_Object meta_prefix_char; /* Last size recorded for a current buffer which is not a minibuffer. */ -static int last_non_minibuf_size; +static EMACS_INT last_non_minibuf_size; /* Number of idle seconds before an auto-save and garbage collection. */ static Lisp_Object Vauto_save_timeout; @@ -337,7 +337,7 @@ Lisp_Object real_this_command; Lisp_Object Vthis_original_command; /* The value of point when the last command was started. */ -int last_point_position; +EMACS_INT last_point_position; /* The buffer that was current when the last command was started. */ Lisp_Object last_point_position_buffer; @@ -621,7 +621,7 @@ static Lisp_Object make_lispy_movement (struct frame *, Lisp_Object, Lisp_Object, Lisp_Object, unsigned long); #endif -static Lisp_Object modify_event_symbol (int, unsigned, Lisp_Object, +static Lisp_Object modify_event_symbol (EMACS_INT, unsigned, Lisp_Object, Lisp_Object, const char **, Lisp_Object *, unsigned); static Lisp_Object make_lispy_switch_frame (Lisp_Object); @@ -867,7 +867,7 @@ echo_length (void) switches frames while entering a key sequence. */ static void -echo_truncate (int nchars) +echo_truncate (EMACS_INT nchars) { if (STRINGP (current_kboard->echo_string)) current_kboard->echo_string @@ -1480,7 +1480,7 @@ some_mouse_moved (void) static int read_key_sequence (Lisp_Object *, int, Lisp_Object, int, int, int); void safe_run_hooks (Lisp_Object); -static void adjust_point_for_property (int, int); +static void adjust_point_for_property (EMACS_INT, int); /* Cancel hourglass from protect_unwind. ARG is not used. */ @@ -1870,7 +1870,7 @@ command_loop_1 (void) LAST_PT is the last position of point. */ static void -adjust_point_for_property (int last_pt, int modified) +adjust_point_for_property (EMACS_INT last_pt, int modified) { EMACS_INT beg, end; Lisp_Object val, overlay, tmp; @@ -1879,7 +1879,7 @@ adjust_point_for_property (int last_pt, int modified) user can keep inserting another character at point or keep deleting characters around point. */ int check_composition = ! modified, check_display = 1, check_invisible = 1; - int orig_pt = PT; + EMACS_INT orig_pt = PT; /* FIXME: cycling is probably not necessary because these properties can't be usefully combined anyway. */ @@ -2782,7 +2782,8 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event if (INTERACTIVE && NILP (c)) { - int delay_level, buffer_size; + int delay_level; + EMACS_INT buffer_size; /* Slow down auto saves logarithmically in size of current buffer, and garbage collect while we're at it. */ @@ -3796,22 +3797,20 @@ kbd_buffer_unget_event (register struct input_event *event) } -/* Generate HELP_EVENT input_events in BUFP which has room for - SIZE events. If there's not enough room in BUFP, ignore this - event. +/* Generate a HELP_EVENT input_event and store it in the keyboard + buffer. HELP is the help form. - FRAME is the frame on which the help is generated. OBJECT is the - Lisp object where the help was found (a buffer, a string, an - overlay, or nil if neither from a string nor from a buffer. POS is - the position within OBJECT where the help was found. - - Value is the number of input_events generated. */ + FRAME and WINDOW are the frame and windoiw where the help is + generated. OBJECT is the Lisp object where the help was found (a + buffer, a string, an overlay, or nil if neither from a string nor + from a buffer). POS is the position within OBJECT where the help + was found. */ void gen_help_event (Lisp_Object help, Lisp_Object frame, Lisp_Object window, - Lisp_Object object, int pos) + Lisp_Object object, EMACS_INT pos) { struct input_event event; @@ -5460,7 +5459,7 @@ make_lispy_event (struct input_event *event) case MULTIBYTE_CHAR_KEYSTROKE_EVENT: { Lisp_Object lispy_c; - int c = event->code; + EMACS_INT c = event->code; if (event->kind == ASCII_KEYSTROKE_EVENT) { c &= 0377; @@ -6584,7 +6583,7 @@ reorder_modifiers (Lisp_Object symbol) in the symbol's name. */ static Lisp_Object -modify_event_symbol (int symbol_num, unsigned int modifiers, Lisp_Object symbol_kind, +modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object symbol_kind, Lisp_Object name_alist_or_stem, const char **name_table, Lisp_Object *symbol_table, unsigned int table_size) { @@ -6648,7 +6647,7 @@ modify_event_symbol (int symbol_num, unsigned int modifiers, Lisp_Object symbol_ if (NILP (value)) { char buf[20]; - sprintf (buf, "key-%d", symbol_num); + sprintf (buf, "key-%ld", (long)symbol_num); value = intern (buf); } @@ -10354,7 +10353,7 @@ give to the command you invoke, if it asks for an argument. */) (Lisp_Object prefixarg) { Lisp_Object function; - int saved_last_point_position; + EMACS_INT saved_last_point_position; Lisp_Object saved_keys, saved_last_point_position_buffer; Lisp_Object bindings, value; struct gcpro gcpro1, gcpro2, gcpro3; @@ -10822,7 +10821,7 @@ stuff_buffered_input (Lisp_Object stuffstring) if (STRINGP (stuffstring)) { - register int count; + register EMACS_INT count; p = SDATA (stuffstring); count = SBYTES (stuffstring); diff --git a/src/keyboard.h b/src/keyboard.h index a3bb46f4454..9fd3b48eba9 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -524,7 +524,7 @@ extern void poll_for_input_1 (void); extern void show_help_echo (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, int); extern void gen_help_event (Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object, int); + Lisp_Object, EMACS_INT); extern void kbd_buffer_store_help_event (Lisp_Object, Lisp_Object); extern Lisp_Object menu_item_eval_property (Lisp_Object); extern int kbd_buffer_events_waiting (int); diff --git a/src/lisp.h b/src/lisp.h index 1d499e88cf4..f1d4dd9a330 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2671,7 +2671,7 @@ extern void message_dolog (const char *, EMACS_INT, int, int); extern void message_with_string (const char *, Lisp_Object, int); extern void message_log_maybe_newline (void); extern void update_echo_area (void); -extern void truncate_echo_area (int); +extern void truncate_echo_area (EMACS_INT); extern void redisplay (void); extern int check_point_in_composition (struct buffer *, EMACS_INT, struct buffer *, EMACS_INT); diff --git a/src/termhooks.h b/src/termhooks.h index 7762dd15efe..b16c36f9551 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -228,9 +228,11 @@ struct input_event /* For an ASCII_KEYSTROKE_EVENT and MULTIBYTE_CHAR_KEYSTROKE_EVENT, this is the character. For a NON_ASCII_KEYSTROKE_EVENT, this is the keysym code. - For a mouse event, this is the button number. */ + For a mouse event, this is the button number. + For a HELP_EVENT, this is the position within the object + (stored in ARG below) where the help was found. */ /* In WindowsNT, for a mouse wheel event, this is the delta. */ - int code; + EMACS_INT code; enum scroll_bar_part part; int modifiers; /* See enum below for interpretation. */ diff --git a/src/xdisp.c b/src/xdisp.c index 7163a2c98b2..942e8f9d22b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -907,7 +907,7 @@ Lisp_Object Qinhibit_free_realized_faces; Lisp_Object help_echo_string; Lisp_Object help_echo_window; Lisp_Object help_echo_object; -int help_echo_pos; +EMACS_INT help_echo_pos; /* Temporary variable for XTread_socket. */ @@ -9189,7 +9189,7 @@ check_message_stack (void) time we display it---but don't redisplay it now. */ void -truncate_echo_area (int nchars) +truncate_echo_area (EMACS_INT nchars) { if (nchars == 0) echo_area_buffer[0] = Qnil; -- 2.39.5