From f877c546db4d53d4076715323bd151ab6c3347a5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 25 Sep 2010 08:31:15 -0400 Subject: [PATCH] Fix int/EMACS_INT use in process.c and term.c. term.c (fast_find_position, term_mouse_highlight): Use EMACS_INT for buffer positions. process.c (read_process_output, send_process) (Fprocess_send_region, status_notify): Use EMACS_INT for buffer and string positions and size. --- src/ChangeLog | 7 +++++++ src/process.c | 26 +++++++++++++------------- src/term.c | 13 ++++++++----- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index cbdc3706076..08e0adb7999 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2010-09-25 Eli Zaretskii + * term.c (fast_find_position, term_mouse_highlight): Use EMACS_INT + for buffer positions. + + * process.c (read_process_output, send_process) + (Fprocess_send_region, status_notify): Use EMACS_INT for buffer + and string positions and size. + * print.c (print_object, print_string, strout): Use EMACS_INT for string indices. diff --git a/src/process.c b/src/process.c index ac82f12debb..048e2858e9f 100644 --- a/src/process.c +++ b/src/process.c @@ -5075,7 +5075,7 @@ read_process_output (Lisp_Object proc, register int channel) char *chars; register Lisp_Object outstream; register struct Lisp_Process *p = XPROCESS (proc); - register int opoint; + register EMACS_INT opoint; struct coding_system *coding = proc_decode_coding_system[channel]; int carryover = p->decoding_carryover; int readmax = 4096; @@ -5265,10 +5265,10 @@ read_process_output (Lisp_Object proc, register int channel) else if (!NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name)) { Lisp_Object old_read_only; - int old_begv, old_zv; - int old_begv_byte, old_zv_byte; - int before, before_byte; - int opoint_byte; + EMACS_INT old_begv, old_zv; + EMACS_INT old_begv_byte, old_zv_byte; + EMACS_INT before, before_byte; + EMACS_INT opoint_byte; Lisp_Object text; struct buffer *b; @@ -5405,11 +5405,11 @@ send_process_trap (int ignore) static void send_process (volatile Lisp_Object proc, const unsigned char *volatile buf, - volatile int len, volatile Lisp_Object object) + volatile EMACS_INT len, volatile Lisp_Object object) { /* Use volatile to protect variables from being clobbered by longjmp. */ struct Lisp_Process *p = XPROCESS (proc); - int rv; + EMACS_INT rv; struct coding_system *coding; struct gcpro gcpro1; SIGTYPE (*volatile old_sigpipe) (int); @@ -5466,8 +5466,8 @@ send_process (volatile Lisp_Object proc, const unsigned char *volatile buf, coding->dst_object = Qt; if (BUFFERP (object)) { - int from_byte, from, to; - int save_pt, save_pt_byte; + EMACS_INT from_byte, from, to; + EMACS_INT save_pt, save_pt_byte; struct buffer *cur = current_buffer; set_buffer_internal (XBUFFER (object)); @@ -5519,7 +5519,7 @@ send_process (volatile Lisp_Object proc, const unsigned char *volatile buf, process_sent_to = proc; while (len > 0) { - int this = len; + EMACS_INT this = len; /* Send this batch, using one or more write calls. */ while (this > 0) @@ -5653,7 +5653,7 @@ Output from processes can arrive in between bunches. */) (Lisp_Object process, Lisp_Object start, Lisp_Object end) { Lisp_Object proc; - int start1, end1; + EMACS_INT start1, end1; proc = get_process (process); validate_region (&start, &end); @@ -6594,8 +6594,8 @@ status_notify (struct Lisp_Process *deleting_process) { Lisp_Object tem; struct buffer *old = current_buffer; - int opoint, opoint_byte; - int before, before_byte; + EMACS_INT opoint, opoint_byte; + EMACS_INT before, before_byte; /* Avoid error if buffer is deleted (probably that's why the process is dead, too) */ diff --git a/src/term.c b/src/term.c index 2deca1014e8..1b4484470e0 100644 --- a/src/term.c +++ b/src/term.c @@ -2618,9 +2618,10 @@ term_clear_mouse_face (void) If POS is after end of W, return end of last line in W. - taken from msdos.c */ static int -fast_find_position (struct window *w, int pos, int *hpos, int *vpos) +fast_find_position (struct window *w, EMACS_INT pos, int *hpos, int *vpos) { - int i, lastcol, line_start_position, maybe_next_line_p = 0; + int i, lastcol, maybe_next_line_p = 0; + EMACS_INT line_start_position; int yb = window_text_bottom_y (w); struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row; @@ -2658,7 +2659,7 @@ fast_find_position (struct window *w, int pos, int *hpos, int *vpos) for (i = 0; i < row->used[TEXT_AREA]; i++) { struct glyph *glyph = row->glyphs[TEXT_AREA] + i; - int charpos; + EMACS_INT charpos; charpos = glyph->charpos; if (charpos == pos) @@ -2719,7 +2720,8 @@ term_mouse_highlight (struct frame *f, int x, int y) && XFASTINT (w->last_modified) == BUF_MODIFF (b) && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b)) { - int pos, i, nrows = w->current_matrix->nrows; + int i, nrows = w->current_matrix->nrows; + EMACS_INT pos; struct glyph_row *row; struct glyph *glyph; @@ -2763,7 +2765,8 @@ term_mouse_highlight (struct frame *f, int x, int y) /* Check for mouse-face. */ { Lisp_Object mouse_face, overlay, position, *overlay_vec; - int noverlays, obegv, ozv; + int noverlays; + EMACS_INT obegv, ozv; struct buffer *obuf; /* If we get an out-of-range value, return now; avoid an error. */ -- 2.39.5