From ace1712c7feb83cc6b03d31b7a8b0439b83b7212 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 24 Sep 2010 13:48:10 -0400 Subject: [PATCH] Fix int/EMACS_INT use in ccl.c, cmds.c, data.c, dispnew.c. keyboard.c (make_lispy_position): Use EMACS_INT for buffer positions. xdisp.c (redisplay_internal, try_window_id) (set_cursor_from_row, find_first_unchanged_at_end_row): Use EMACS_INT for buffer positions. dispextern.h (set_cursor_from_row, mode_line_string) (marginal_area_string): Adjust prototypes. dispnew.c (increment_matrix_positions) (increment_row_positions, copy_glyph_row_contents) (mode_line_string, marginal_area_string): Use EMACS_INT for buffer positions. dispextern.h (mode_line_string, marginal_area_string) (increment_matrix_positions, increment_row_positions): Adjust prototypes. data.c (Faref, Faset): Use EMACS_INT for string length and positions. cmds.c (internal_self_insert): Use EMACS_INT for the count of characters to insert. ccl.c (Fccl_execute_on_string): Use EMACS_INT for string position and size. --- src/ChangeLog | 28 ++++++++++++++++++++++++++++ src/ccl.c | 8 ++++---- src/cmds.c | 6 +++--- src/data.c | 11 ++++++----- src/dispextern.h | 11 ++++++----- src/dispnew.c | 17 ++++++++++++----- src/keyboard.c | 7 ++++--- src/xdisp.c | 22 +++++++++++++--------- 8 files changed, 76 insertions(+), 34 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 7c13fab36b9..49267dc405f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,33 @@ 2010-09-24 Eli Zaretskii + * keyboard.c (make_lispy_position): Use EMACS_INT for buffer + positions. + + * xdisp.c (redisplay_internal, try_window_id) + (set_cursor_from_row, find_first_unchanged_at_end_row): Use + EMACS_INT for buffer positions. + + * dispextern.h (set_cursor_from_row, mode_line_string) + (marginal_area_string): Adjust prototypes. + + * dispnew.c (increment_matrix_positions) + (increment_row_positions, copy_glyph_row_contents) + (mode_line_string, marginal_area_string): Use EMACS_INT for buffer + positions. + + * dispextern.h (mode_line_string, marginal_area_string) + (increment_matrix_positions, increment_row_positions): Adjust + prototypes. + + * data.c (Faref, Faset): Use EMACS_INT for string length and + positions. + + * cmds.c (internal_self_insert): Use EMACS_INT for the count of + characters to insert. + + * ccl.c (Fccl_execute_on_string): Use EMACS_INT for string + position and size. + * syntax.c (scan_words, update_syntax_table) (prev_char_comend_first, back_comment, skip_chars) (skip_syntaxes, Fforward_comment, Fbackward_prefix_chars): Use diff --git a/src/ccl.c b/src/ccl.c index f418c65b01e..f98897b51fa 100644 --- a/src/ccl.c +++ b/src/ccl.c @@ -2061,10 +2061,10 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY int i; int outbufsize; unsigned char *outbuf, *outp; - int str_chars, str_bytes; + EMACS_INT str_chars, str_bytes; #define CCL_EXECUTE_BUF_SIZE 1024 int source[CCL_EXECUTE_BUF_SIZE], destination[CCL_EXECUTE_BUF_SIZE]; - int consumed_chars, consumed_bytes, produced_chars; + EMACS_INT consumed_chars, consumed_bytes, produced_chars; if (setup_ccl_program (&ccl, ccl_prog) < 0) error ("Invalid CCL program"); @@ -2128,7 +2128,7 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY if (outp - outbuf + MAX_MULTIBYTE_LENGTH * ccl.produced > outbufsize) { - int offset = outp - outbuf; + EMACS_INT offset = outp - outbuf; outbufsize += MAX_MULTIBYTE_LENGTH * ccl.produced; outbuf = (unsigned char *) xrealloc (outbuf, outbufsize); outp = outbuf + offset; @@ -2140,7 +2140,7 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY { if (outp - outbuf + ccl.produced > outbufsize) { - int offset = outp - outbuf; + EMACS_INT offset = outp - outbuf; outbufsize += ccl.produced; outbuf = (unsigned char *) xrealloc (outbuf, outbufsize); outp = outbuf + offset; diff --git a/src/cmds.c b/src/cmds.c index 0647810a42c..e12d7c370d9 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -37,7 +37,7 @@ Lisp_Object Qkill_forward_chars, Qkill_backward_chars; /* A possible value for a buffer's overwrite-mode variable. */ Lisp_Object Qoverwrite_mode_binary; -static int internal_self_insert (int, int); +static int internal_self_insert (int, EMACS_INT); DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, doc: /* Return buffer position N characters after (before if N negative) point. */) @@ -304,7 +304,7 @@ After insertion, the value of `auto-fill-function' is called if the { int character = translate_char (Vtranslation_table_for_input, (int) XINT (last_command_event)); - int val = internal_self_insert (character, (int) XFASTINT (n)); + int val = internal_self_insert (character, XFASTINT (n)); if (val == 2) nonundocount = 0; frame_make_pointer_invisible (); @@ -323,7 +323,7 @@ static Lisp_Object Qexpand_abbrev; static Lisp_Object Qpost_self_insert_hook, Vpost_self_insert_hook; static int -internal_self_insert (int c, int n) +internal_self_insert (int c, EMACS_INT n) { int hairy = 0; Lisp_Object tem; diff --git a/src/data.c b/src/data.c index 630d341a20e..c28dc9b4bae 100644 --- a/src/data.c +++ b/src/data.c @@ -2082,13 +2082,14 @@ ARRAY may be a vector, a string, a char-table, a bool-vector, or a byte-code object. IDX starts at 0. */) (register Lisp_Object array, Lisp_Object idx) { - register int idxval; + register EMACS_INT idxval; CHECK_NUMBER (idx); idxval = XINT (idx); if (STRINGP (array)) { - int c, idxval_byte; + int c; + EMACS_INT idxval_byte; if (idxval < 0 || idxval >= SCHARS (array)) args_out_of_range (array, idx); @@ -2136,7 +2137,7 @@ Return NEWELT. ARRAY may be a vector, a string, a char-table or a bool-vector. IDX starts at 0. */) (register Lisp_Object array, Lisp_Object idx, Lisp_Object newelt) { - register int idxval; + register EMACS_INT idxval; CHECK_NUMBER (idx); idxval = XINT (idx); @@ -2171,7 +2172,7 @@ bool-vector. IDX starts at 0. */) } else if (STRING_MULTIBYTE (array)) { - int idxval_byte, prev_bytes, new_bytes, nbytes; + EMACS_INT idxval_byte, prev_bytes, new_bytes, nbytes; unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1; if (idxval < 0 || idxval >= SCHARS (array)) @@ -2187,7 +2188,7 @@ bool-vector. IDX starts at 0. */) if (prev_bytes != new_bytes) { /* We must relocate the string data. */ - int nchars = SCHARS (array); + EMACS_INT nchars = SCHARS (array); unsigned char *str; USE_SAFE_ALLOCA; diff --git a/src/dispextern.h b/src/dispextern.h index e4c13b58ce4..c23c1b673ad 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2929,7 +2929,8 @@ void remember_mouse_glyph (struct frame *, int, int, NativeRectangle *); void mark_window_display_accurate (Lisp_Object, int); void redisplay_preserve_echo_area (int); int set_cursor_from_row (struct window *, struct glyph_row *, - struct glyph_matrix *, int, int, int, int); + struct glyph_matrix *, EMACS_INT, EMACS_INT, + int, int); void init_iterator (struct it *, struct window *, EMACS_INT, EMACS_INT, struct glyph_row *, enum face_id); void init_iterator_to_row_start (struct it *, struct window *, @@ -3209,11 +3210,11 @@ extern Lisp_Object buffer_posn_from_coords (struct window *, Lisp_Object *, int *, int *, int *, int *); extern Lisp_Object mode_line_string (struct window *, enum window_part, - int *, int *, int *, + int *, int *, EMACS_INT *, Lisp_Object *, int *, int *, int *, int *); extern Lisp_Object marginal_area_string (struct window *, enum window_part, - int *, int *, int *, + int *, int *, EMACS_INT *, Lisp_Object *, int *, int *, int *, int *); extern void redraw_frame (struct frame *); @@ -3236,9 +3237,9 @@ void shift_glyph_matrix (struct window *, struct glyph_matrix *, int, int, int); void rotate_matrix (struct glyph_matrix *, int, int, int); void increment_matrix_positions (struct glyph_matrix *, - int, int, int, int); + int, int, EMACS_INT, EMACS_INT); void blank_row (struct window *, struct glyph_row *, int); -void increment_row_positions (struct glyph_row *, int, int); +void increment_row_positions (struct glyph_row *, EMACS_INT, EMACS_INT); void enable_glyph_matrix_rows (struct glyph_matrix *, int, int, int); void clear_glyph_row (struct glyph_row *); void prepare_desired_row (struct glyph_row *); diff --git a/src/dispnew.c b/src/dispnew.c index 0869526c01d..a2152944d24 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -849,7 +849,8 @@ rotate_matrix (struct glyph_matrix *matrix, int first, int last, int by) DELTA_BYTES. */ void -increment_matrix_positions (struct glyph_matrix *matrix, int start, int end, int delta, int delta_bytes) +increment_matrix_positions (struct glyph_matrix *matrix, int start, int end, + EMACS_INT delta, EMACS_INT delta_bytes) { /* Check that START and END are reasonable values. */ xassert (start >= 0 && start <= matrix->nrows); @@ -1088,7 +1089,8 @@ blank_row (struct window *w, struct glyph_row *row, int y) ends. */ void -increment_row_positions (struct glyph_row *row, int delta, int delta_bytes) +increment_row_positions (struct glyph_row *row, + EMACS_INT delta, EMACS_INT delta_bytes) { int area, i; @@ -1200,7 +1202,8 @@ copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from) positions in row TO by DELTA/ DELTA_BYTES. */ void -copy_glyph_row_contents (struct glyph_row *to, struct glyph_row *from, int delta, int delta_bytes) +copy_glyph_row_contents (struct glyph_row *to, struct glyph_row *from, + EMACS_INT delta, EMACS_INT delta_bytes) { int area; @@ -5498,7 +5501,9 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p *CHARPOS is set to the position in the string returned. */ Lisp_Object -mode_line_string (struct window *w, enum window_part part, int *x, int *y, int *charpos, Lisp_Object *object, int *dx, int *dy, int *width, int *height) +mode_line_string (struct window *w, enum window_part part, + int *x, int *y, EMACS_INT *charpos, Lisp_Object *object, + int *dx, int *dy, int *width, int *height) { struct glyph_row *row; struct glyph *glyph, *end; @@ -5565,7 +5570,9 @@ mode_line_string (struct window *w, enum window_part part, int *x, int *y, int * the string returned. */ Lisp_Object -marginal_area_string (struct window *w, enum window_part part, int *x, int *y, int *charpos, Lisp_Object *object, int *dx, int *dy, int *width, int *height) +marginal_area_string (struct window *w, enum window_part part, + int *x, int *y, EMACS_INT *charpos, Lisp_Object *object, + int *dx, int *dy, int *width, int *height) { struct glyph_row *row = w->current_matrix->rows; struct glyph *glyph, *end; diff --git a/src/keyboard.c b/src/keyboard.c index 4785036eda8..0c58552c013 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -5281,7 +5281,8 @@ make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, /* It's a click in window window at frame coordinates (x,y) */ struct window *w = XWINDOW (window); Lisp_Object string_info = Qnil; - int textpos = -1, rx = -1, ry = -1; + EMACS_INT textpos = -1; + int rx = -1, ry = -1; int dx = -1, dy = -1; int width = -1, height = -1; Lisp_Object object = Qnil; @@ -5300,7 +5301,7 @@ make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, /* Mode line or header line. Look for a string under the mouse that may have a `local-map' property. */ Lisp_Object string; - int charpos; + EMACS_INT charpos; posn = part == ON_MODE_LINE ? Qmode_line : Qheader_line; rx = wx, ry = wy; @@ -5324,7 +5325,7 @@ make_lispy_position (struct frame *f, Lisp_Object *x, Lisp_Object *y, else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) { Lisp_Object string; - int charpos; + EMACS_INT charpos; posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin; rx = wx, ry = wy; diff --git a/src/xdisp.c b/src/xdisp.c index 51217e3106d..7163a2c98b2 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11103,7 +11103,7 @@ int debug_dvpos, debug_dy; /* Delta in characters and bytes for try_window_id. */ -int debug_delta, debug_delta_bytes; +EMACS_INT debug_delta, debug_delta_bytes; /* Values of window_end_pos and window_end_vpos at the end of try_window_id. */ @@ -11834,7 +11834,7 @@ redisplay_internal (int preserve_echo_area) { struct glyph_row *row = MATRIX_ROW (w->current_matrix, this_line_vpos + 1); - int delta, delta_bytes; + EMACS_INT delta, delta_bytes; /* We used to distinguish between two cases here, conditioned by Z - CHARPOS (tlendpos) == ZV, for @@ -12463,7 +12463,8 @@ redisplay_window_1 (Lisp_Object window) int set_cursor_from_row (struct window *w, struct glyph_row *row, - struct glyph_matrix *matrix, int delta, int delta_bytes, + struct glyph_matrix *matrix, + EMACS_INT delta, EMACS_INT delta_bytes, int dy, int dvpos) { struct glyph *glyph = row->glyphs[TEXT_AREA]; @@ -15056,7 +15057,7 @@ try_window_reusing_current_matrix (struct window *w) static struct glyph_row *find_last_unchanged_at_beg_row (struct window *); static struct glyph_row *find_first_unchanged_at_end_row (struct window *, - int *, int *); + EMACS_INT *, EMACS_INT *); static struct glyph_row * find_last_row_displaying_text (struct glyph_matrix *, struct it *, struct glyph_row *); @@ -15151,7 +15152,8 @@ find_last_unchanged_at_beg_row (struct window *w) changes. */ static struct glyph_row * -find_first_unchanged_at_end_row (struct window *w, int *delta, int *delta_bytes) +find_first_unchanged_at_end_row (struct window *w, + EMACS_INT *delta, EMACS_INT *delta_bytes) { struct glyph_row *row; struct glyph_row *row_found = NULL; @@ -15382,13 +15384,14 @@ try_window_id (struct window *w) struct glyph_row *bottom_row; int bottom_vpos; struct it it; - int delta = 0, delta_bytes = 0, stop_pos, dvpos, dy; + EMACS_INT delta = 0, delta_bytes = 0, stop_pos; + int dvpos, dy; struct text_pos start_pos; struct run run; int first_unchanged_at_end_vpos = 0; struct glyph_row *last_text_row, *last_text_row_at_end; struct text_pos start; - int first_changed_charpos, last_changed_charpos; + EMACS_INT first_changed_charpos, last_changed_charpos; #if GLYPH_DEBUG if (inhibit_try_window_id) @@ -15515,7 +15518,7 @@ try_window_id (struct window *w) || (last_changed_charpos < CHARPOS (start) - 1 && FETCH_BYTE (BYTEPOS (start) - 1) == '\n'))) { - int Z_old, delta, Z_BYTE_old, delta_bytes; + EMACS_INT Z_old, delta, Z_BYTE_old, delta_bytes; struct glyph_row *r0; /* Compute how many chars/bytes have been added to or removed @@ -24167,7 +24170,8 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor; Lisp_Object pointer = Qnil; - int charpos, dx, dy, width, height; + int dx, dy, width, height; + EMACS_INT charpos; Lisp_Object string, object = Qnil; Lisp_Object pos, help; -- 2.39.2