# HG changeset patch # User Eli Zaretskii # Date 1285751213 14400 # Node ID 7d7a02c19d8c4cb0aa90b67080dbf4f19f3ebfbe # Parent 22d8ea06b8c70c6624f0909bcdb4df4b292406ef Fix int/EMACS_INT use in xdisp.c and print.c. print.c (print_object): Fix format string and argument types for printing a Lisp_Misc_Marker. xdisp.c (pos_visible_p, c_string_pos, number_of_chars) (load_overlay_strings, get_overlay_strings_1) (get_overlay_strings, forward_to_next_line_start) (back_to_previous_visible_line_start, reseat, reseat_to_string) (get_next_display_element, next_element_from_string) (next_element_from_c_string, next_element_from_buffer) (move_it_vertically_backward, move_it_by_lines, add_to_log) (message_dolog, message_log_check_duplicate, message2_nolog) (message3, message3_nolog, vmessage, set_message, set_message_1) (hscroll_window_tree, text_outside_line_unchanged_p) (set_cursor_from_row, set_vertical_scroll_bar, redisplay_window) (find_last_unchanged_at_beg_row) (find_first_unchanged_at_end_row, row_containing_pos) (trailing_whitespace_p, display_mode_element, decode_mode_spec) (display_count_lines, x_produce_glyphs, note_mouse_highlight): Use EMACS_INT for buffer and string positions. dispextern.h (struct it) : Declare EMACS_INT. (row_containing_pos): Adjust prototype. lisp.h (pos_visible_p, message2, message2_nolog, message3) (message2_nolog, set_message): Adjust prototypes. diff -r 22d8ea06b8c7 -r 7d7a02c19d8c src/ChangeLog --- a/src/ChangeLog Wed Sep 29 17:36:38 2010 +0900 +++ b/src/ChangeLog Wed Sep 29 05:06:53 2010 -0400 @@ -1,3 +1,31 @@ +2010-09-29 Eli Zaretskii + + * print.c (print_object): Fix format string and argument types for + printing a Lisp_Misc_Marker. + + * xdisp.c (pos_visible_p, c_string_pos, number_of_chars) + (load_overlay_strings, get_overlay_strings_1) + (get_overlay_strings, forward_to_next_line_start) + (back_to_previous_visible_line_start, reseat, reseat_to_string) + (get_next_display_element, next_element_from_string) + (next_element_from_c_string, next_element_from_buffer) + (move_it_vertically_backward, move_it_by_lines, add_to_log) + (message_dolog, message_log_check_duplicate, message2_nolog) + (message3, message3_nolog, vmessage, set_message, set_message_1) + (hscroll_window_tree, text_outside_line_unchanged_p) + (set_cursor_from_row, set_vertical_scroll_bar, redisplay_window) + (find_last_unchanged_at_beg_row) + (find_first_unchanged_at_end_row, row_containing_pos) + (trailing_whitespace_p, display_mode_element, decode_mode_spec) + (display_count_lines, x_produce_glyphs, note_mouse_highlight): Use + EMACS_INT for buffer and string positions. + + * dispextern.h (struct it) : Declare EMACS_INT. + (row_containing_pos): Adjust prototype. + + * lisp.h (pos_visible_p, message2, message2_nolog, message3) + (message2_nolog, set_message): Adjust prototypes. + 2010-09-28 Stefan Monnier * gnutls.c (Fgnutls_boot): Remove unused vars `data' and `srp_cred'. diff -r 22d8ea06b8c7 -r 7d7a02c19d8c src/dispextern.h --- a/src/dispextern.h Wed Sep 29 17:36:38 2010 +0900 +++ b/src/dispextern.h Wed Sep 29 05:06:53 2010 -0400 @@ -2067,7 +2067,7 @@ /* Number of characters in the string (s, or it->string) we iterate over. */ - int string_nchars; + EMACS_INT string_nchars; /* Start and end of a visible region; -1 if the region is not visible in the window. */ @@ -2914,7 +2914,7 @@ /* Defined in xdisp.c */ -struct glyph_row *row_containing_pos (struct window *, int, +struct glyph_row *row_containing_pos (struct window *, EMACS_INT, struct glyph_row *, struct glyph_row *, int); EMACS_INT string_buffer_position (struct window *, Lisp_Object, diff -r 22d8ea06b8c7 -r 7d7a02c19d8c src/lisp.h --- a/src/lisp.h Wed Sep 29 17:36:38 2010 +0900 +++ b/src/lisp.h Wed Sep 29 05:06:53 2010 -0400 @@ -2657,16 +2657,16 @@ extern void pop_message (void); extern void restore_message (void); extern Lisp_Object current_message (void); -extern void set_message (const char *s, Lisp_Object, int, int); +extern void set_message (const char *s, Lisp_Object, EMACS_INT, int); extern void clear_message (int, int); extern void message (const char *, ...); extern void message_nolog (const char *, ...); extern void message1 (const char *); extern void message1_nolog (const char *); -extern void message2 (const char *, int, int); -extern void message2_nolog (const char *, int, int); -extern void message3 (Lisp_Object, int, int); -extern void message3_nolog (Lisp_Object, int, int); +extern void message2 (const char *, EMACS_INT, int); +extern void message2_nolog (const char *, EMACS_INT, int); +extern void message3 (Lisp_Object, EMACS_INT, int); +extern void message3_nolog (Lisp_Object, EMACS_INT, int); 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); @@ -2682,7 +2682,7 @@ extern void syms_of_xdisp (void); extern void init_xdisp (void); extern Lisp_Object safe_eval (Lisp_Object); -extern int pos_visible_p (struct window *, int, int *, +extern int pos_visible_p (struct window *, EMACS_INT, int *, int *, int *, int *, int *, int *); /* Defined in xsettings.c */ diff -r 22d8ea06b8c7 -r 7d7a02c19d8c src/print.c --- a/src/print.c Wed Sep 29 17:36:38 2010 +0900 +++ b/src/print.c Wed Sep 29 05:06:53 2010 -0400 @@ -2185,7 +2185,7 @@ strout ("in no buffer", -1, -1, printcharfun, 0); else { - sprintf (buf, "at %d", marker_position (obj)); + sprintf (buf, "at %ld", (long)marker_position (obj)); strout (buf, -1, -1, printcharfun, 0); strout (" in ", -1, -1, printcharfun, 0); print_string (XMARKER (obj)->buffer->name, printcharfun); @@ -2199,9 +2199,9 @@ strout ("in no buffer", -1, -1, printcharfun, 0); else { - sprintf (buf, "from %d to %d in ", - marker_position (OVERLAY_START (obj)), - marker_position (OVERLAY_END (obj))); + sprintf (buf, "from %ld to %ld in ", + (long)marker_position (OVERLAY_START (obj)), + (long)marker_position (OVERLAY_END (obj))); strout (buf, -1, -1, printcharfun, 0); print_string (XMARKER (OVERLAY_START (obj))->buffer->name, printcharfun); diff -r 22d8ea06b8c7 -r 7d7a02c19d8c src/xdisp.c --- a/src/xdisp.c Wed Sep 29 17:36:38 2010 +0900 +++ b/src/xdisp.c Wed Sep 29 05:06:53 2010 -0400 @@ -956,7 +956,8 @@ static struct text_pos run_window_scroll_functions (Lisp_Object, struct text_pos); static void reconsider_clip_changes (struct window *, struct buffer *); -static int text_outside_line_unchanged_p (struct window *, int, int); +static int text_outside_line_unchanged_p (struct window *, + EMACS_INT, EMACS_INT); static void store_mode_line_noprop_char (char); static int store_mode_line_noprop (const unsigned char *, int, int); static void x_consider_frame_title (Lisp_Object); @@ -991,8 +992,9 @@ static int cursor_row_fully_visible_p (struct window *, int, int); static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int); static int try_cursor_movement (Lisp_Object, struct text_pos, int *); -static int trailing_whitespace_p (int); -static int message_log_check_duplicate (int, int, int, int); +static int trailing_whitespace_p (EMACS_INT); +static int message_log_check_duplicate (EMACS_INT, EMACS_INT, + EMACS_INT, EMACS_INT); static void push_it (struct it *); static void pop_it (struct it *); static void sync_frame_with_window_matrix_rows (struct window *); @@ -1015,13 +1017,14 @@ static const char *decode_mode_spec (struct window *, int, int, int, Lisp_Object *); static void display_menu_bar (struct window *); -static int display_count_lines (int, int, int, int, int *); +static int display_count_lines (EMACS_INT, EMACS_INT, EMACS_INT, int, + EMACS_INT *); static int display_string (const unsigned char *, Lisp_Object, Lisp_Object, EMACS_INT, EMACS_INT, struct it *, int, int, int, int); static void compute_line_metrics (struct it *); static void run_redisplay_end_trigger_hook (struct it *); -static int get_overlay_strings (struct it *, int); -static int get_overlay_strings_1 (struct it *, int, int); +static int get_overlay_strings (struct it *, EMACS_INT); +static int get_overlay_strings_1 (struct it *, EMACS_INT, int); static void next_overlay_string (struct it *); static void reseat (struct it *, struct text_pos, int); static void reseat_1 (struct it *, struct text_pos, int); @@ -1036,11 +1039,11 @@ static int next_element_from_composition (struct it *); static int next_element_from_image (struct it *); static int next_element_from_stretch (struct it *); -static void load_overlay_strings (struct it *, int); +static void load_overlay_strings (struct it *, EMACS_INT); static int init_from_display_pos (struct it *, struct window *, struct display_pos *); static void reseat_to_string (struct it *, const unsigned char *, - Lisp_Object, int, int, int, int); + Lisp_Object, EMACS_INT, EMACS_INT, int, int); static enum move_it_result move_it_in_display_line_to (struct it *, EMACS_INT, int, enum move_operation_enum); @@ -1054,8 +1057,8 @@ static struct text_pos string_pos_nchars_ahead (struct text_pos, Lisp_Object, EMACS_INT); static struct text_pos string_pos (EMACS_INT, Lisp_Object); -static struct text_pos c_string_pos (int, const unsigned char *, int); -static int number_of_chars (const unsigned char *, int); +static struct text_pos c_string_pos (EMACS_INT, const unsigned char *, int); +static EMACS_INT number_of_chars (const unsigned char *, int); static void compute_stop_pos (struct it *); static void compute_string_pos (struct text_pos *, struct text_pos, Lisp_Object); @@ -1362,7 +1365,7 @@ Set *ROWH and *VPOS to row's visible height and VPOS (row number). */ int -pos_visible_p (struct window *w, int charpos, int *x, int *y, +pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y, int *rtop, int *rbot, int *rowh, int *vpos) { struct it it; @@ -1567,7 +1570,7 @@ means recognize multibyte characters. */ static struct text_pos -c_string_pos (int charpos, const unsigned char *s, int multibyte_p) +c_string_pos (EMACS_INT charpos, const unsigned char *s, int multibyte_p) { struct text_pos pos; @@ -1576,7 +1579,8 @@ if (multibyte_p) { - int rest = strlen (s), len; + EMACS_INT rest = strlen (s); + int len; SET_TEXT_POS (pos, 0, 0); while (charpos--) @@ -1598,14 +1602,15 @@ /* Value is the number of characters in C string S. MULTIBYTE_P non-zero means recognize multibyte characters. */ -static int +static EMACS_INT number_of_chars (const unsigned char *s, int multibyte_p) { - int nchars; + EMACS_INT nchars; if (multibyte_p) { - int rest = strlen (s), len; + EMACS_INT rest = strlen (s); + int len; unsigned char *p = (unsigned char *) s; for (nchars = 0; rest > 0; ++nchars) @@ -3624,7 +3629,6 @@ if (STRING_MULTIBYTE (it->string)) { const unsigned char *p = SDATA (it->string) + BYTEPOS (pos); - EMACS_INT rest = SBYTES (it->string) - BYTEPOS (pos); int c, len; struct face *face = FACE_FROM_ID (it->f, face_id); @@ -4873,11 +4877,11 @@ compare_overlay_entries. */ static void -load_overlay_strings (struct it *it, int charpos) +load_overlay_strings (struct it *it, EMACS_INT charpos) { Lisp_Object overlay, window, str, invisible; struct Lisp_Overlay *ov; - int start, end; + EMACS_INT start, end; int size = 20; int n = 0, i, j, invis_p; struct overlay_entry *entries @@ -5023,7 +5027,7 @@ least one overlay string was found. */ static int -get_overlay_strings_1 (struct it *it, int charpos, int compute_stop_p) +get_overlay_strings_1 (struct it *it, EMACS_INT charpos, int compute_stop_p) { /* Get the first OVERLAY_STRING_CHUNK_SIZE overlay strings to process. This fills IT->overlay_strings with strings, and sets @@ -5074,7 +5078,7 @@ } static int -get_overlay_strings (struct it *it, int charpos) +get_overlay_strings (struct it *it, EMACS_INT charpos) { it->string = Qnil; it->method = GET_FROM_BUFFER; @@ -5320,8 +5324,8 @@ short-cut. */ if (!newline_found_p) { - int start = IT_CHARPOS (*it); - int limit = find_next_newline_no_quit (start, 1); + EMACS_INT start = IT_CHARPOS (*it); + EMACS_INT limit = find_next_newline_no_quit (start, 1); Lisp_Object pos; xassert (!STRINGP (it->string)); @@ -5392,7 +5396,7 @@ { struct it it2; - int pos; + EMACS_INT pos; EMACS_INT beg, end; Lisp_Object val, overlay; @@ -5514,7 +5518,7 @@ static void reseat (struct it *it, struct text_pos pos, int force_p) { - int original_pos = IT_CHARPOS (*it); + EMACS_INT original_pos = IT_CHARPOS (*it); reseat_1 (it, pos, 0); @@ -5611,7 +5615,8 @@ static void reseat_to_string (struct it *it, const unsigned char *s, Lisp_Object string, - int charpos, int precision, int field_width, int multibyte) + EMACS_INT charpos, EMACS_INT precision, int field_width, + int multibyte) { /* No region in strings. */ it->region_beg_charpos = it->region_end_charpos = -1; @@ -6014,9 +6019,9 @@ } else { - int pos = (it->s ? -1 - : STRINGP (it->string) ? IT_STRING_CHARPOS (*it) - : IT_CHARPOS (*it)); + EMACS_INT pos = (it->s ? -1 + : STRINGP (it->string) ? IT_STRING_CHARPOS (*it) + : IT_CHARPOS (*it)); it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display, pos, it->string); @@ -6449,7 +6454,6 @@ } else if (STRING_MULTIBYTE (it->string)) { - int remaining = SBYTES (it->string) - IT_STRING_BYTEPOS (*it); const unsigned char *s = (SDATA (it->string) + IT_STRING_BYTEPOS (*it)); it->c = string_char_and_length (s, &it->len); @@ -6485,7 +6489,6 @@ } else if (STRING_MULTIBYTE (it->string)) { - int maxlen = SBYTES (it->string) - IT_STRING_BYTEPOS (*it); const unsigned char *s = (SDATA (it->string) + IT_STRING_BYTEPOS (*it)); it->c = string_char_and_length (s, &it->len); @@ -6538,13 +6541,7 @@ BYTEPOS (it->position) = CHARPOS (it->position) = -1; } else if (it->multibyte_p) - { - /* Implementation note: The calls to strlen apparently aren't a - performance problem because there is no noticeable performance - difference between Emacs running in unibyte or multibyte mode. */ - int maxlen = strlen (it->s) - IT_BYTEPOS (*it); - it->c = string_char_and_length (it->s + IT_BYTEPOS (*it), &it->len); - } + it->c = string_char_and_length (it->s + IT_BYTEPOS (*it), &it->len); else it->c = it->s[IT_BYTEPOS (*it)], it->len = 1; @@ -6684,7 +6681,7 @@ } else { - int orig_bytepos = IT_BYTEPOS (*it); + EMACS_INT orig_bytepos = IT_BYTEPOS (*it); /* We need to prime the bidi iterator starting at the line's beginning, before we will be able to produce the next @@ -7668,7 +7665,7 @@ { int nlines, h; struct it it2, it3; - int start_pos; + EMACS_INT start_pos; move_further_back: xassert (dy >= 0); @@ -7829,12 +7826,12 @@ void move_it_by_lines (struct it *it, int dvpos, int need_y_p) { - struct position pos; /* The commented-out optimization uses vmotion on terminals. This gives bad results, because elements like it->what, on which callers such as pos_visible_p rely, aren't updated. */ - /* if (!FRAME_WINDOW_P (it->f)) + /* struct position pos; + if (!FRAME_WINDOW_P (it->f)) { struct text_pos textpos; @@ -7863,7 +7860,7 @@ else { struct it it2; - int start_charpos, i; + EMACS_INT start_charpos, i; /* Start at the beginning of the screen line containing IT's position. This may actually move vertically backwards, @@ -7943,7 +7940,7 @@ Lisp_Object args[3]; Lisp_Object msg, fmt; char *buffer; - int len; + EMACS_INT len; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; USE_SAFE_ALLOCA; @@ -8002,8 +7999,8 @@ struct buffer *oldbuf; Lisp_Object oldpoint, oldbegv, oldzv; int old_windows_or_buffers_changed = windows_or_buffers_changed; - int point_at_end = 0; - int zv_at_end = 0; + EMACS_INT point_at_end = 0; + EMACS_INT zv_at_end = 0; Lisp_Object old_deactivate_mark, tem; struct gcpro gcpro1; @@ -8036,7 +8033,8 @@ if (multibyte && NILP (current_buffer->enable_multibyte_characters)) { - int i, c, char_bytes; + EMACS_INT i; + int c, char_bytes; unsigned char work[1]; /* Convert a multibyte string to single-byte @@ -8053,7 +8051,8 @@ else if (! multibyte && ! NILP (current_buffer->enable_multibyte_characters)) { - int i, c, char_bytes; + EMACS_INT i; + int c, char_bytes; unsigned char *msg = (unsigned char *) m; unsigned char str[MAX_MULTIBYTE_LENGTH]; /* Convert a single-byte string to multibyte @@ -8071,7 +8070,8 @@ if (nlflag) { - int this_bol, this_bol_byte, prev_bol, prev_bol_byte, dup; + EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte; + int dup; insert_1 ("\n", 1, 1, 0, 0); scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); @@ -8162,11 +8162,11 @@ value N > 1 if we should also append " [N times]". */ static int -message_log_check_duplicate (int prev_bol, int prev_bol_byte, - int this_bol, int this_bol_byte) -{ - int i; - int len = Z_BYTE - 1 - this_bol_byte; +message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte, + EMACS_INT this_bol, EMACS_INT this_bol_byte) +{ + EMACS_INT i; + EMACS_INT len = Z_BYTE - 1 - this_bol_byte; int seen_dots = 0; unsigned char *p1 = BUF_BYTE_ADDRESS (current_buffer, prev_bol_byte); unsigned char *p2 = BUF_BYTE_ADDRESS (current_buffer, this_bol_byte); @@ -8201,7 +8201,7 @@ This may GC, so the buffer M must NOT point to a Lisp string. */ void -message2 (const char *m, int nbytes, int multibyte) +message2 (const char *m, EMACS_INT nbytes, int multibyte) { /* First flush out any partial line written with print. */ message_log_maybe_newline (); @@ -8214,7 +8214,7 @@ /* The non-logging counterpart of message2. */ void -message2_nolog (const char *m, int nbytes, int multibyte) +message2_nolog (const char *m, EMACS_INT nbytes, int multibyte) { struct frame *sf = SELECTED_FRAME (); message_enable_multibyte = multibyte; @@ -8276,7 +8276,7 @@ This function cancels echoing. */ void -message3 (Lisp_Object m, int nbytes, int multibyte) +message3 (Lisp_Object m, EMACS_INT nbytes, int multibyte) { struct gcpro gcpro1; @@ -8308,7 +8308,7 @@ and make this cancel echoing. */ void -message3_nolog (Lisp_Object m, int nbytes, int multibyte) +message3_nolog (Lisp_Object m, EMACS_INT nbytes, int multibyte) { struct frame *sf = SELECTED_FRAME (); message_enable_multibyte = multibyte; @@ -8494,7 +8494,7 @@ { if (m) { - int len; + EMACS_INT len; len = doprnt (FRAME_MESSAGE_BUF (f), FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, ap); @@ -9238,7 +9238,8 @@ */ void -set_message (const char *s, Lisp_Object string, int nbytes, int multibyte_p) +set_message (const char *s, Lisp_Object string, + EMACS_INT nbytes, int multibyte_p) { message_enable_multibyte = ((s && multibyte_p) @@ -9274,7 +9275,7 @@ if (STRINGP (string)) { - int nchars; + EMACS_INT nchars; if (nbytes == 0) nbytes = SBYTES (string); @@ -9293,7 +9294,8 @@ if (multibyte_p && NILP (current_buffer->enable_multibyte_characters)) { /* Convert from multi-byte to single-byte. */ - int i, c, n; + EMACS_INT i; + int c, n; unsigned char work[1]; /* Convert a multibyte string to single-byte. */ @@ -9310,7 +9312,8 @@ && !NILP (current_buffer->enable_multibyte_characters)) { /* Convert from single-byte to multi-byte. */ - int i, c, n; + EMACS_INT i; + int c, n; const unsigned char *msg = (const unsigned char *) s; unsigned char str[MAX_MULTIBYTE_LENGTH]; @@ -10992,7 +10995,7 @@ struct it it; int hscroll; struct buffer *saved_current_buffer; - int pt; + EMACS_INT pt; int wanted_x; /* Find point in a display of infinite width. */ @@ -11157,7 +11160,8 @@ redisplay_internal for display optimization. */ static INLINE int -text_outside_line_unchanged_p (struct window *w, int start, int end) +text_outside_line_unchanged_p (struct window *w, + EMACS_INT start, EMACS_INT end) { int unchanged_p = 1; @@ -12473,7 +12477,7 @@ struct glyph *end = glyph + row->used[TEXT_AREA]; struct glyph *cursor = NULL; /* The last known character position in row. */ - int last_pos = MATRIX_ROW_START_CHARPOS (row) + delta; + EMACS_INT last_pos = MATRIX_ROW_START_CHARPOS (row) + delta; int x = row->x; EMACS_INT pt_old = PT - delta; EMACS_INT pos_before = MATRIX_ROW_START_CHARPOS (row) + delta; @@ -12610,7 +12614,7 @@ else if (STRINGP (glyph->object)) { Lisp_Object chprop; - int glyph_pos = glyph->charpos; + EMACS_INT glyph_pos = glyph->charpos; chprop = Fget_char_property (make_number (glyph_pos), Qcursor, glyph->object); @@ -12677,7 +12681,7 @@ else if (STRINGP (glyph->object)) { Lisp_Object chprop; - int glyph_pos = glyph->charpos; + EMACS_INT glyph_pos = glyph->charpos; chprop = Fget_char_property (make_number (glyph_pos), Qcursor, glyph->object); @@ -12795,7 +12799,7 @@ be a character in the string with the `cursor' property, which means display cursor on that character's glyph. */ - int strpos = glyph->charpos; + EMACS_INT strpos = glyph->charpos; cursor = glyph; for (glyph += incr; @@ -12804,7 +12808,7 @@ glyph += incr) { Lisp_Object cprop; - int gpos = glyph->charpos; + EMACS_INT gpos = glyph->charpos; cprop = Fget_char_property (make_number (gpos), Qcursor, @@ -13694,7 +13698,7 @@ void set_vertical_scroll_bar (struct window *w) { - int start, end, whole; + EMACS_INT start, end, whole; /* Calculate the start and end positions for the current window. At some point, it would be nice to choose between scrollbars @@ -13758,7 +13762,7 @@ int rc; int centering_position = -1; int last_line_misfit = 0; - int beg_unchanged, end_unchanged; + EMACS_INT beg_unchanged, end_unchanged; SET_TEXT_POS (lpoint, PT, PT_BYTE); opoint = lpoint; @@ -13900,8 +13904,8 @@ window, set up appropriate value. */ if (!EQ (window, selected_window)) { - int new_pt = XMARKER (w->pointm)->charpos; - int new_pt_byte = marker_byte_position (w->pointm); + EMACS_INT new_pt = XMARKER (w->pointm)->charpos; + EMACS_INT new_pt_byte = marker_byte_position (w->pointm); if (new_pt < BEGV) { new_pt = BEGV; @@ -15107,7 +15111,7 @@ static struct glyph_row * find_last_unchanged_at_beg_row (struct window *w) { - int first_changed_pos = BEG + BEG_UNCHANGED; + EMACS_INT first_changed_pos = BEG + BEG_UNCHANGED; struct glyph_row *row; struct glyph_row *row_found = NULL; int yb = window_text_bottom_y (w); @@ -15183,9 +15187,11 @@ corresponds to window_end_pos. This allows us to translate buffer positions in the current matrix to current buffer positions for characters not in changed text. */ - int Z_old = MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos); - int Z_BYTE_old = MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; - int last_unchanged_pos, last_unchanged_pos_old; + EMACS_INT Z_old = + MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos); + EMACS_INT Z_BYTE_old = + MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; + EMACS_INT last_unchanged_pos, last_unchanged_pos_old; struct glyph_row *first_text_row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); @@ -15272,8 +15278,8 @@ containing CHARPOS or null. */ struct glyph_row * -row_containing_pos (struct window *w, int charpos, struct glyph_row *start, - struct glyph_row *end, int dy) +row_containing_pos (struct window *w, EMACS_INT charpos, + struct glyph_row *start, struct glyph_row *end, int dy) { struct glyph_row *row = start; struct glyph_row *best_row = NULL; @@ -16904,9 +16910,9 @@ trailing whitespace. */ static int -trailing_whitespace_p (int charpos) -{ - int bytepos = CHAR_TO_BYTE (charpos); +trailing_whitespace_p (EMACS_INT charpos) +{ + EMACS_INT bytepos = CHAR_TO_BYTE (charpos); int c = 0; while (bytepos < ZV_BYTE @@ -18556,7 +18562,7 @@ else if (c != 0) { int multibyte; - int bytepos, charpos; + EMACS_INT bytepos, charpos; const unsigned char *spec; Lisp_Object string; @@ -18830,7 +18836,7 @@ store_mode_line_string (const char *string, Lisp_Object lisp_string, int copy_string, int field_width, int precision, Lisp_Object props) { - int len; + EMACS_INT len; int n = 0; if (string != NULL) @@ -19375,22 +19381,23 @@ case 'i': { - int size = ZV - BEGV; + EMACS_INT size = ZV - BEGV; pint2str (decode_mode_spec_buf, field_width, size); return decode_mode_spec_buf; } case 'I': { - int size = ZV - BEGV; + EMACS_INT size = ZV - BEGV; pint2hrstr (decode_mode_spec_buf, field_width, size); return decode_mode_spec_buf; } case 'l': { - int startpos, startpos_byte, line, linepos, linepos_byte; - int topline, nlines, junk, height; + EMACS_INT startpos, startpos_byte, line, linepos, linepos_byte; + int topline, nlines, height; + EMACS_INT junk; /* %c and %l are ignored in `frame-title-format'. */ if (mode_line_target == MODE_LINE_TITLE) @@ -19451,9 +19458,9 @@ else if (nlines < height + 25 || nlines > height * 3 + 50 || linepos == BUF_BEGV (b)) { - int limit = BUF_BEGV (b); - int limit_byte = BUF_BEGV_BYTE (b); - int position; + EMACS_INT limit = BUF_BEGV (b); + EMACS_INT limit_byte = BUF_BEGV_BYTE (b); + EMACS_INT position; int distance = (height * 2 + 30) * line_number_display_limit_width; if (startpos - distance > limit) @@ -19515,8 +19522,8 @@ case 'p': { - int pos = marker_position (w->start); - int total = BUF_ZV (b) - BUF_BEGV (b); + EMACS_INT pos = marker_position (w->start); + EMACS_INT total = BUF_ZV (b) - BUF_BEGV (b); if (XFASTINT (w->window_end_pos) <= BUF_Z (b) - BUF_ZV (b)) { @@ -19538,7 +19545,7 @@ so get us a 2-digit number that is close. */ if (total == 100) total = 99; - sprintf (decode_mode_spec_buf, "%2d%%", total); + sprintf (decode_mode_spec_buf, "%2ld%%", (long)total); return decode_mode_spec_buf; } } @@ -19546,9 +19553,9 @@ /* Display percentage of size above the bottom of the screen. */ case 'P': { - int toppos = marker_position (w->start); - int botpos = BUF_Z (b) - XFASTINT (w->window_end_pos); - int total = BUF_ZV (b) - BUF_BEGV (b); + EMACS_INT toppos = marker_position (w->start); + EMACS_INT botpos = BUF_Z (b) - XFASTINT (w->window_end_pos); + EMACS_INT total = BUF_ZV (b) - BUF_BEGV (b); if (botpos >= BUF_ZV (b)) { @@ -19569,9 +19576,9 @@ if (total == 100) total = 99; if (toppos <= BUF_BEGV (b)) - sprintf (decode_mode_spec_buf, "Top%2d%%", total); + sprintf (decode_mode_spec_buf, "Top%2ld%%", (long)total); else - sprintf (decode_mode_spec_buf, "%2d%%", total); + sprintf (decode_mode_spec_buf, "%2ld%%", (long)total); return decode_mode_spec_buf; } } @@ -19662,8 +19669,9 @@ Set *BYTE_POS_PTR to 1 if we found COUNT lines, 0 if we hit LIMIT. */ static int -display_count_lines (int start, int start_byte, int limit_byte, int count, - int *byte_pos_ptr) +display_count_lines (EMACS_INT start, EMACS_INT start_byte, + EMACS_INT limit_byte, int count, + EMACS_INT *byte_pos_ptr) { register unsigned char *cursor; unsigned char *base; @@ -21920,11 +21928,7 @@ it2 = *it; if (it->multibyte_p) - { - int maxlen = ((IT_BYTEPOS (*it) >= GPT ? ZV : GPT) - - IT_BYTEPOS (*it)); - it2.c = it2.char_to_display = STRING_CHAR_AND_LENGTH (p, it2.len); - } + it2.c = it2.char_to_display = STRING_CHAR_AND_LENGTH (p, it2.len); else { it2.c = it2.char_to_display = *p, it2.len = 1; @@ -22410,7 +22414,7 @@ XChar2b char2b; struct font_metrics *pcm; int font_not_found_p; - int pos; + EMACS_INT pos; for (glyph_len = cmp->glyph_len; glyph_len > 0; glyph_len--) if ((c = COMPOSITION_GLYPH (cmp, glyph_len - 1)) != '\t') @@ -24504,7 +24508,8 @@ Lisp_Object *overlay_vec = NULL; int noverlays; struct buffer *obuf; - int obegv, ozv, same_region; + EMACS_INT obegv, ozv; + int same_region; /* Find the glyph under X/Y. */ glyph = x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, &dx, &dy, &area); @@ -24690,7 +24695,7 @@ /* If we are on a display string with no mouse-face, check if the text under it has one. */ struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); - int start = MATRIX_ROW_START_CHARPOS (r); + EMACS_INT start = MATRIX_ROW_START_CHARPOS (r); pos = string_buffer_position (w, object, start); if (pos > 0) { @@ -24769,7 +24774,7 @@ else { Lisp_Object object = glyph->object; - int charpos = glyph->charpos; + EMACS_INT charpos = glyph->charpos; /* Try text properties. */ if (STRINGP (object) @@ -24784,7 +24789,7 @@ see if the buffer text ``under'' it does. */ struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); - int start = MATRIX_ROW_START_CHARPOS (r); + EMACS_INT start = MATRIX_ROW_START_CHARPOS (r); EMACS_INT pos = string_buffer_position (w, object, start); if (pos > 0) { @@ -24824,7 +24829,7 @@ if (NILP (pointer)) { Lisp_Object object = glyph->object; - int charpos = glyph->charpos; + EMACS_INT charpos = glyph->charpos; /* Try text properties. */ if (STRINGP (object) @@ -24839,7 +24844,7 @@ see if the buffer text ``under'' it does. */ struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); - int start = MATRIX_ROW_START_CHARPOS (r); + EMACS_INT start = MATRIX_ROW_START_CHARPOS (r); EMACS_INT pos = string_buffer_position (w, object, start); if (pos > 0)