aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-09-29 05:06:53 -0400
committerEli Zaretskii2010-09-29 05:06:53 -0400
commitd585695f3abcb487716a35d66d9322a68f003da1 (patch)
tree2e6c7ad90427a9951247559681cc822c522310c3 /src
parentb9476c045fab8bd69e446335ee350c56768f8196 (diff)
downloademacs-d585695f3abcb487716a35d66d9322a68f003da1.tar.gz
emacs-d585695f3abcb487716a35d66d9322a68f003da1.zip
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) <string_nchars>: Declare EMACS_INT. (row_containing_pos): Adjust prototype. lisp.h (pos_visible_p, message2, message2_nolog, message3) (message2_nolog, set_message): Adjust prototypes.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog28
-rw-r--r--src/dispextern.h4
-rw-r--r--src/lisp.h12
-rw-r--r--src/print.c8
-rw-r--r--src/xdisp.c229
5 files changed, 157 insertions, 124 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 269483f1625..2443a4585b9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,31 @@
12010-09-29 Eli Zaretskii <eliz@gnu.org>
2
3 * print.c (print_object): Fix format string and argument types for
4 printing a Lisp_Misc_Marker.
5
6 * xdisp.c (pos_visible_p, c_string_pos, number_of_chars)
7 (load_overlay_strings, get_overlay_strings_1)
8 (get_overlay_strings, forward_to_next_line_start)
9 (back_to_previous_visible_line_start, reseat, reseat_to_string)
10 (get_next_display_element, next_element_from_string)
11 (next_element_from_c_string, next_element_from_buffer)
12 (move_it_vertically_backward, move_it_by_lines, add_to_log)
13 (message_dolog, message_log_check_duplicate, message2_nolog)
14 (message3, message3_nolog, vmessage, set_message, set_message_1)
15 (hscroll_window_tree, text_outside_line_unchanged_p)
16 (set_cursor_from_row, set_vertical_scroll_bar, redisplay_window)
17 (find_last_unchanged_at_beg_row)
18 (find_first_unchanged_at_end_row, row_containing_pos)
19 (trailing_whitespace_p, display_mode_element, decode_mode_spec)
20 (display_count_lines, x_produce_glyphs, note_mouse_highlight): Use
21 EMACS_INT for buffer and string positions.
22
23 * dispextern.h (struct it) <string_nchars>: Declare EMACS_INT.
24 (row_containing_pos): Adjust prototype.
25
26 * lisp.h (pos_visible_p, message2, message2_nolog, message3)
27 (message2_nolog, set_message): Adjust prototypes.
28
12010-09-28 Stefan Monnier <monnier@iro.umontreal.ca> 292010-09-28 Stefan Monnier <monnier@iro.umontreal.ca>
2 30
3 * gnutls.c (Fgnutls_boot): Remove unused vars `data' and `srp_cred'. 31 * gnutls.c (Fgnutls_boot): Remove unused vars `data' and `srp_cred'.
diff --git a/src/dispextern.h b/src/dispextern.h
index 71276fbe950..20e074d2393 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2067,7 +2067,7 @@ struct it
2067 2067
2068 /* Number of characters in the string (s, or it->string) we iterate 2068 /* Number of characters in the string (s, or it->string) we iterate
2069 over. */ 2069 over. */
2070 int string_nchars; 2070 EMACS_INT string_nchars;
2071 2071
2072 /* Start and end of a visible region; -1 if the region is not 2072 /* Start and end of a visible region; -1 if the region is not
2073 visible in the window. */ 2073 visible in the window. */
@@ -2914,7 +2914,7 @@ extern int bidi_mirror_char (int);
2914 2914
2915/* Defined in xdisp.c */ 2915/* Defined in xdisp.c */
2916 2916
2917struct glyph_row *row_containing_pos (struct window *, int, 2917struct glyph_row *row_containing_pos (struct window *, EMACS_INT,
2918 struct glyph_row *, 2918 struct glyph_row *,
2919 struct glyph_row *, int); 2919 struct glyph_row *, int);
2920EMACS_INT string_buffer_position (struct window *, Lisp_Object, 2920EMACS_INT string_buffer_position (struct window *, Lisp_Object,
diff --git a/src/lisp.h b/src/lisp.h
index d4ff47630d7..a630eeec1f3 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2657,16 +2657,16 @@ extern Lisp_Object restore_message_unwind (Lisp_Object);
2657extern void pop_message (void); 2657extern void pop_message (void);
2658extern void restore_message (void); 2658extern void restore_message (void);
2659extern Lisp_Object current_message (void); 2659extern Lisp_Object current_message (void);
2660extern void set_message (const char *s, Lisp_Object, int, int); 2660extern void set_message (const char *s, Lisp_Object, EMACS_INT, int);
2661extern void clear_message (int, int); 2661extern void clear_message (int, int);
2662extern void message (const char *, ...); 2662extern void message (const char *, ...);
2663extern void message_nolog (const char *, ...); 2663extern void message_nolog (const char *, ...);
2664extern void message1 (const char *); 2664extern void message1 (const char *);
2665extern void message1_nolog (const char *); 2665extern void message1_nolog (const char *);
2666extern void message2 (const char *, int, int); 2666extern void message2 (const char *, EMACS_INT, int);
2667extern void message2_nolog (const char *, int, int); 2667extern void message2_nolog (const char *, EMACS_INT, int);
2668extern void message3 (Lisp_Object, int, int); 2668extern void message3 (Lisp_Object, EMACS_INT, int);
2669extern void message3_nolog (Lisp_Object, int, int); 2669extern void message3_nolog (Lisp_Object, EMACS_INT, int);
2670extern void message_dolog (const char *, EMACS_INT, int, int); 2670extern void message_dolog (const char *, EMACS_INT, int, int);
2671extern void message_with_string (const char *, Lisp_Object, int); 2671extern void message_with_string (const char *, Lisp_Object, int);
2672extern void message_log_maybe_newline (void); 2672extern void message_log_maybe_newline (void);
@@ -2682,7 +2682,7 @@ void set_frame_cursor_types (struct frame *, Lisp_Object);
2682extern void syms_of_xdisp (void); 2682extern void syms_of_xdisp (void);
2683extern void init_xdisp (void); 2683extern void init_xdisp (void);
2684extern Lisp_Object safe_eval (Lisp_Object); 2684extern Lisp_Object safe_eval (Lisp_Object);
2685extern int pos_visible_p (struct window *, int, int *, 2685extern int pos_visible_p (struct window *, EMACS_INT, int *,
2686 int *, int *, int *, int *, int *); 2686 int *, int *, int *, int *, int *);
2687 2687
2688/* Defined in xsettings.c */ 2688/* Defined in xsettings.c */
diff --git a/src/print.c b/src/print.c
index 46132ff1e47..1c34f6e27e4 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2185,7 +2185,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2185 strout ("in no buffer", -1, -1, printcharfun, 0); 2185 strout ("in no buffer", -1, -1, printcharfun, 0);
2186 else 2186 else
2187 { 2187 {
2188 sprintf (buf, "at %d", marker_position (obj)); 2188 sprintf (buf, "at %ld", (long)marker_position (obj));
2189 strout (buf, -1, -1, printcharfun, 0); 2189 strout (buf, -1, -1, printcharfun, 0);
2190 strout (" in ", -1, -1, printcharfun, 0); 2190 strout (" in ", -1, -1, printcharfun, 0);
2191 print_string (XMARKER (obj)->buffer->name, printcharfun); 2191 print_string (XMARKER (obj)->buffer->name, printcharfun);
@@ -2199,9 +2199,9 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
2199 strout ("in no buffer", -1, -1, printcharfun, 0); 2199 strout ("in no buffer", -1, -1, printcharfun, 0);
2200 else 2200 else
2201 { 2201 {
2202 sprintf (buf, "from %d to %d in ", 2202 sprintf (buf, "from %ld to %ld in ",
2203 marker_position (OVERLAY_START (obj)), 2203 (long)marker_position (OVERLAY_START (obj)),
2204 marker_position (OVERLAY_END (obj))); 2204 (long)marker_position (OVERLAY_END (obj)));
2205 strout (buf, -1, -1, printcharfun, 0); 2205 strout (buf, -1, -1, printcharfun, 0);
2206 print_string (XMARKER (OVERLAY_START (obj))->buffer->name, 2206 print_string (XMARKER (OVERLAY_START (obj))->buffer->name,
2207 printcharfun); 2207 printcharfun);
diff --git a/src/xdisp.c b/src/xdisp.c
index 809a5d24ef2..7107bc5d9cd 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -956,7 +956,8 @@ static void pint2hrstr (char *, int, int);
956static struct text_pos run_window_scroll_functions (Lisp_Object, 956static struct text_pos run_window_scroll_functions (Lisp_Object,
957 struct text_pos); 957 struct text_pos);
958static void reconsider_clip_changes (struct window *, struct buffer *); 958static void reconsider_clip_changes (struct window *, struct buffer *);
959static int text_outside_line_unchanged_p (struct window *, int, int); 959static int text_outside_line_unchanged_p (struct window *,
960 EMACS_INT, EMACS_INT);
960static void store_mode_line_noprop_char (char); 961static void store_mode_line_noprop_char (char);
961static int store_mode_line_noprop (const unsigned char *, int, int); 962static int store_mode_line_noprop (const unsigned char *, int, int);
962static void x_consider_frame_title (Lisp_Object); 963static void x_consider_frame_title (Lisp_Object);
@@ -991,8 +992,9 @@ static int append_space_for_newline (struct it *, int);
991static int cursor_row_fully_visible_p (struct window *, int, int); 992static int cursor_row_fully_visible_p (struct window *, int, int);
992static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int); 993static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int);
993static int try_cursor_movement (Lisp_Object, struct text_pos, int *); 994static int try_cursor_movement (Lisp_Object, struct text_pos, int *);
994static int trailing_whitespace_p (int); 995static int trailing_whitespace_p (EMACS_INT);
995static int message_log_check_duplicate (int, int, int, int); 996static int message_log_check_duplicate (EMACS_INT, EMACS_INT,
997 EMACS_INT, EMACS_INT);
996static void push_it (struct it *); 998static void push_it (struct it *);
997static void pop_it (struct it *); 999static void pop_it (struct it *);
998static void sync_frame_with_window_matrix_rows (struct window *); 1000static void sync_frame_with_window_matrix_rows (struct window *);
@@ -1015,13 +1017,14 @@ static int store_mode_line_string (const char *, Lisp_Object, int, int, int, Lis
1015static const char *decode_mode_spec (struct window *, int, int, int, 1017static const char *decode_mode_spec (struct window *, int, int, int,
1016 Lisp_Object *); 1018 Lisp_Object *);
1017static void display_menu_bar (struct window *); 1019static void display_menu_bar (struct window *);
1018static int display_count_lines (int, int, int, int, int *); 1020static int display_count_lines (EMACS_INT, EMACS_INT, EMACS_INT, int,
1021 EMACS_INT *);
1019static int display_string (const unsigned char *, Lisp_Object, Lisp_Object, 1022static int display_string (const unsigned char *, Lisp_Object, Lisp_Object,
1020 EMACS_INT, EMACS_INT, struct it *, int, int, int, int); 1023 EMACS_INT, EMACS_INT, struct it *, int, int, int, int);
1021static void compute_line_metrics (struct it *); 1024static void compute_line_metrics (struct it *);
1022static void run_redisplay_end_trigger_hook (struct it *); 1025static void run_redisplay_end_trigger_hook (struct it *);
1023static int get_overlay_strings (struct it *, int); 1026static int get_overlay_strings (struct it *, EMACS_INT);
1024static int get_overlay_strings_1 (struct it *, int, int); 1027static int get_overlay_strings_1 (struct it *, EMACS_INT, int);
1025static void next_overlay_string (struct it *); 1028static void next_overlay_string (struct it *);
1026static void reseat (struct it *, struct text_pos, int); 1029static void reseat (struct it *, struct text_pos, int);
1027static void reseat_1 (struct it *, struct text_pos, int); 1030static void reseat_1 (struct it *, struct text_pos, int);
@@ -1036,11 +1039,11 @@ static int next_element_from_buffer (struct it *);
1036static int next_element_from_composition (struct it *); 1039static int next_element_from_composition (struct it *);
1037static int next_element_from_image (struct it *); 1040static int next_element_from_image (struct it *);
1038static int next_element_from_stretch (struct it *); 1041static int next_element_from_stretch (struct it *);
1039static void load_overlay_strings (struct it *, int); 1042static void load_overlay_strings (struct it *, EMACS_INT);
1040static int init_from_display_pos (struct it *, struct window *, 1043static int init_from_display_pos (struct it *, struct window *,
1041 struct display_pos *); 1044 struct display_pos *);
1042static void reseat_to_string (struct it *, const unsigned char *, 1045static void reseat_to_string (struct it *, const unsigned char *,
1043 Lisp_Object, int, int, int, int); 1046 Lisp_Object, EMACS_INT, EMACS_INT, int, int);
1044static enum move_it_result 1047static enum move_it_result
1045 move_it_in_display_line_to (struct it *, EMACS_INT, int, 1048 move_it_in_display_line_to (struct it *, EMACS_INT, int,
1046 enum move_operation_enum); 1049 enum move_operation_enum);
@@ -1054,8 +1057,8 @@ static int forward_to_next_line_start (struct it *, int *);
1054static struct text_pos string_pos_nchars_ahead (struct text_pos, 1057static struct text_pos string_pos_nchars_ahead (struct text_pos,
1055 Lisp_Object, EMACS_INT); 1058 Lisp_Object, EMACS_INT);
1056static struct text_pos string_pos (EMACS_INT, Lisp_Object); 1059static struct text_pos string_pos (EMACS_INT, Lisp_Object);
1057static struct text_pos c_string_pos (int, const unsigned char *, int); 1060static struct text_pos c_string_pos (EMACS_INT, const unsigned char *, int);
1058static int number_of_chars (const unsigned char *, int); 1061static EMACS_INT number_of_chars (const unsigned char *, int);
1059static void compute_stop_pos (struct it *); 1062static void compute_stop_pos (struct it *);
1060static void compute_string_pos (struct text_pos *, struct text_pos, 1063static void compute_string_pos (struct text_pos *, struct text_pos,
1061 Lisp_Object); 1064 Lisp_Object);
@@ -1362,7 +1365,7 @@ line_bottom_y (struct it *it)
1362 Set *ROWH and *VPOS to row's visible height and VPOS (row number). */ 1365 Set *ROWH and *VPOS to row's visible height and VPOS (row number). */
1363 1366
1364int 1367int
1365pos_visible_p (struct window *w, int charpos, int *x, int *y, 1368pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
1366 int *rtop, int *rbot, int *rowh, int *vpos) 1369 int *rtop, int *rbot, int *rowh, int *vpos)
1367{ 1370{
1368 struct it it; 1371 struct it it;
@@ -1567,7 +1570,7 @@ string_pos (EMACS_INT charpos, Lisp_Object string)
1567 means recognize multibyte characters. */ 1570 means recognize multibyte characters. */
1568 1571
1569static struct text_pos 1572static struct text_pos
1570c_string_pos (int charpos, const unsigned char *s, int multibyte_p) 1573c_string_pos (EMACS_INT charpos, const unsigned char *s, int multibyte_p)
1571{ 1574{
1572 struct text_pos pos; 1575 struct text_pos pos;
1573 1576
@@ -1576,7 +1579,8 @@ c_string_pos (int charpos, const unsigned char *s, int multibyte_p)
1576 1579
1577 if (multibyte_p) 1580 if (multibyte_p)
1578 { 1581 {
1579 int rest = strlen (s), len; 1582 EMACS_INT rest = strlen (s);
1583 int len;
1580 1584
1581 SET_TEXT_POS (pos, 0, 0); 1585 SET_TEXT_POS (pos, 0, 0);
1582 while (charpos--) 1586 while (charpos--)
@@ -1598,14 +1602,15 @@ c_string_pos (int charpos, const unsigned char *s, int multibyte_p)
1598/* Value is the number of characters in C string S. MULTIBYTE_P 1602/* Value is the number of characters in C string S. MULTIBYTE_P
1599 non-zero means recognize multibyte characters. */ 1603 non-zero means recognize multibyte characters. */
1600 1604
1601static int 1605static EMACS_INT
1602number_of_chars (const unsigned char *s, int multibyte_p) 1606number_of_chars (const unsigned char *s, int multibyte_p)
1603{ 1607{
1604 int nchars; 1608 EMACS_INT nchars;
1605 1609
1606 if (multibyte_p) 1610 if (multibyte_p)
1607 { 1611 {
1608 int rest = strlen (s), len; 1612 EMACS_INT rest = strlen (s);
1613 int len;
1609 unsigned char *p = (unsigned char *) s; 1614 unsigned char *p = (unsigned char *) s;
1610 1615
1611 for (nchars = 0; rest > 0; ++nchars) 1616 for (nchars = 0; rest > 0; ++nchars)
@@ -3624,7 +3629,6 @@ face_before_or_after_it_pos (struct it *it, int before_p)
3624 if (STRING_MULTIBYTE (it->string)) 3629 if (STRING_MULTIBYTE (it->string))
3625 { 3630 {
3626 const unsigned char *p = SDATA (it->string) + BYTEPOS (pos); 3631 const unsigned char *p = SDATA (it->string) + BYTEPOS (pos);
3627 EMACS_INT rest = SBYTES (it->string) - BYTEPOS (pos);
3628 int c, len; 3632 int c, len;
3629 struct face *face = FACE_FROM_ID (it->f, face_id); 3633 struct face *face = FACE_FROM_ID (it->f, face_id);
3630 3634
@@ -4873,11 +4877,11 @@ compare_overlay_entries (const void *e1, const void *e2)
4873 compare_overlay_entries. */ 4877 compare_overlay_entries. */
4874 4878
4875static void 4879static void
4876load_overlay_strings (struct it *it, int charpos) 4880load_overlay_strings (struct it *it, EMACS_INT charpos)
4877{ 4881{
4878 Lisp_Object overlay, window, str, invisible; 4882 Lisp_Object overlay, window, str, invisible;
4879 struct Lisp_Overlay *ov; 4883 struct Lisp_Overlay *ov;
4880 int start, end; 4884 EMACS_INT start, end;
4881 int size = 20; 4885 int size = 20;
4882 int n = 0, i, j, invis_p; 4886 int n = 0, i, j, invis_p;
4883 struct overlay_entry *entries 4887 struct overlay_entry *entries
@@ -5023,7 +5027,7 @@ load_overlay_strings (struct it *it, int charpos)
5023 least one overlay string was found. */ 5027 least one overlay string was found. */
5024 5028
5025static int 5029static int
5026get_overlay_strings_1 (struct it *it, int charpos, int compute_stop_p) 5030get_overlay_strings_1 (struct it *it, EMACS_INT charpos, int compute_stop_p)
5027{ 5031{
5028 /* Get the first OVERLAY_STRING_CHUNK_SIZE overlay strings to 5032 /* Get the first OVERLAY_STRING_CHUNK_SIZE overlay strings to
5029 process. This fills IT->overlay_strings with strings, and sets 5033 process. This fills IT->overlay_strings with strings, and sets
@@ -5074,7 +5078,7 @@ get_overlay_strings_1 (struct it *it, int charpos, int compute_stop_p)
5074} 5078}
5075 5079
5076static int 5080static int
5077get_overlay_strings (struct it *it, int charpos) 5081get_overlay_strings (struct it *it, EMACS_INT charpos)
5078{ 5082{
5079 it->string = Qnil; 5083 it->string = Qnil;
5080 it->method = GET_FROM_BUFFER; 5084 it->method = GET_FROM_BUFFER;
@@ -5320,8 +5324,8 @@ forward_to_next_line_start (struct it *it, int *skipped_p)
5320 short-cut. */ 5324 short-cut. */
5321 if (!newline_found_p) 5325 if (!newline_found_p)
5322 { 5326 {
5323 int start = IT_CHARPOS (*it); 5327 EMACS_INT start = IT_CHARPOS (*it);
5324 int limit = find_next_newline_no_quit (start, 1); 5328 EMACS_INT limit = find_next_newline_no_quit (start, 1);
5325 Lisp_Object pos; 5329 Lisp_Object pos;
5326 5330
5327 xassert (!STRINGP (it->string)); 5331 xassert (!STRINGP (it->string));
@@ -5392,7 +5396,7 @@ back_to_previous_visible_line_start (struct it *it)
5392 5396
5393 { 5397 {
5394 struct it it2; 5398 struct it it2;
5395 int pos; 5399 EMACS_INT pos;
5396 EMACS_INT beg, end; 5400 EMACS_INT beg, end;
5397 Lisp_Object val, overlay; 5401 Lisp_Object val, overlay;
5398 5402
@@ -5514,7 +5518,7 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p)
5514static void 5518static void
5515reseat (struct it *it, struct text_pos pos, int force_p) 5519reseat (struct it *it, struct text_pos pos, int force_p)
5516{ 5520{
5517 int original_pos = IT_CHARPOS (*it); 5521 EMACS_INT original_pos = IT_CHARPOS (*it);
5518 5522
5519 reseat_1 (it, pos, 0); 5523 reseat_1 (it, pos, 0);
5520 5524
@@ -5611,7 +5615,8 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p)
5611 5615
5612static void 5616static void
5613reseat_to_string (struct it *it, const unsigned char *s, Lisp_Object string, 5617reseat_to_string (struct it *it, const unsigned char *s, Lisp_Object string,
5614 int charpos, int precision, int field_width, int multibyte) 5618 EMACS_INT charpos, EMACS_INT precision, int field_width,
5619 int multibyte)
5615{ 5620{
5616 /* No region in strings. */ 5621 /* No region in strings. */
5617 it->region_beg_charpos = it->region_end_charpos = -1; 5622 it->region_beg_charpos = it->region_end_charpos = -1;
@@ -6014,9 +6019,9 @@ get_next_display_element (struct it *it)
6014 } 6019 }
6015 else 6020 else
6016 { 6021 {
6017 int pos = (it->s ? -1 6022 EMACS_INT pos = (it->s ? -1
6018 : STRINGP (it->string) ? IT_STRING_CHARPOS (*it) 6023 : STRINGP (it->string) ? IT_STRING_CHARPOS (*it)
6019 : IT_CHARPOS (*it)); 6024 : IT_CHARPOS (*it));
6020 6025
6021 it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display, pos, 6026 it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display, pos,
6022 it->string); 6027 it->string);
@@ -6449,7 +6454,6 @@ next_element_from_string (struct it *it)
6449 } 6454 }
6450 else if (STRING_MULTIBYTE (it->string)) 6455 else if (STRING_MULTIBYTE (it->string))
6451 { 6456 {
6452 int remaining = SBYTES (it->string) - IT_STRING_BYTEPOS (*it);
6453 const unsigned char *s = (SDATA (it->string) 6457 const unsigned char *s = (SDATA (it->string)
6454 + IT_STRING_BYTEPOS (*it)); 6458 + IT_STRING_BYTEPOS (*it));
6455 it->c = string_char_and_length (s, &it->len); 6459 it->c = string_char_and_length (s, &it->len);
@@ -6485,7 +6489,6 @@ next_element_from_string (struct it *it)
6485 } 6489 }
6486 else if (STRING_MULTIBYTE (it->string)) 6490 else if (STRING_MULTIBYTE (it->string))
6487 { 6491 {
6488 int maxlen = SBYTES (it->string) - IT_STRING_BYTEPOS (*it);
6489 const unsigned char *s = (SDATA (it->string) 6492 const unsigned char *s = (SDATA (it->string)
6490 + IT_STRING_BYTEPOS (*it)); 6493 + IT_STRING_BYTEPOS (*it));
6491 it->c = string_char_and_length (s, &it->len); 6494 it->c = string_char_and_length (s, &it->len);
@@ -6538,13 +6541,7 @@ next_element_from_c_string (struct it *it)
6538 BYTEPOS (it->position) = CHARPOS (it->position) = -1; 6541 BYTEPOS (it->position) = CHARPOS (it->position) = -1;
6539 } 6542 }
6540 else if (it->multibyte_p) 6543 else if (it->multibyte_p)
6541 { 6544 it->c = string_char_and_length (it->s + IT_BYTEPOS (*it), &it->len);
6542 /* Implementation note: The calls to strlen apparently aren't a
6543 performance problem because there is no noticeable performance
6544 difference between Emacs running in unibyte or multibyte mode. */
6545 int maxlen = strlen (it->s) - IT_BYTEPOS (*it);
6546 it->c = string_char_and_length (it->s + IT_BYTEPOS (*it), &it->len);
6547 }
6548 else 6545 else
6549 it->c = it->s[IT_BYTEPOS (*it)], it->len = 1; 6546 it->c = it->s[IT_BYTEPOS (*it)], it->len = 1;
6550 6547
@@ -6684,7 +6681,7 @@ next_element_from_buffer (struct it *it)
6684 } 6681 }
6685 else 6682 else
6686 { 6683 {
6687 int orig_bytepos = IT_BYTEPOS (*it); 6684 EMACS_INT orig_bytepos = IT_BYTEPOS (*it);
6688 6685
6689 /* We need to prime the bidi iterator starting at the line's 6686 /* We need to prime the bidi iterator starting at the line's
6690 beginning, before we will be able to produce the next 6687 beginning, before we will be able to produce the next
@@ -7668,7 +7665,7 @@ move_it_vertically_backward (struct it *it, int dy)
7668{ 7665{
7669 int nlines, h; 7666 int nlines, h;
7670 struct it it2, it3; 7667 struct it it2, it3;
7671 int start_pos; 7668 EMACS_INT start_pos;
7672 7669
7673 move_further_back: 7670 move_further_back:
7674 xassert (dy >= 0); 7671 xassert (dy >= 0);
@@ -7829,12 +7826,12 @@ move_it_past_eol (struct it *it)
7829void 7826void
7830move_it_by_lines (struct it *it, int dvpos, int need_y_p) 7827move_it_by_lines (struct it *it, int dvpos, int need_y_p)
7831{ 7828{
7832 struct position pos;
7833 7829
7834 /* The commented-out optimization uses vmotion on terminals. This 7830 /* The commented-out optimization uses vmotion on terminals. This
7835 gives bad results, because elements like it->what, on which 7831 gives bad results, because elements like it->what, on which
7836 callers such as pos_visible_p rely, aren't updated. */ 7832 callers such as pos_visible_p rely, aren't updated. */
7837 /* if (!FRAME_WINDOW_P (it->f)) 7833 /* struct position pos;
7834 if (!FRAME_WINDOW_P (it->f))
7838 { 7835 {
7839 struct text_pos textpos; 7836 struct text_pos textpos;
7840 7837
@@ -7863,7 +7860,7 @@ move_it_by_lines (struct it *it, int dvpos, int need_y_p)
7863 else 7860 else
7864 { 7861 {
7865 struct it it2; 7862 struct it it2;
7866 int start_charpos, i; 7863 EMACS_INT start_charpos, i;
7867 7864
7868 /* Start at the beginning of the screen line containing IT's 7865 /* Start at the beginning of the screen line containing IT's
7869 position. This may actually move vertically backwards, 7866 position. This may actually move vertically backwards,
@@ -7943,7 +7940,7 @@ add_to_log (const char *format, Lisp_Object arg1, Lisp_Object arg2)
7943 Lisp_Object args[3]; 7940 Lisp_Object args[3];
7944 Lisp_Object msg, fmt; 7941 Lisp_Object msg, fmt;
7945 char *buffer; 7942 char *buffer;
7946 int len; 7943 EMACS_INT len;
7947 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 7944 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
7948 USE_SAFE_ALLOCA; 7945 USE_SAFE_ALLOCA;
7949 7946
@@ -8002,8 +7999,8 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
8002 struct buffer *oldbuf; 7999 struct buffer *oldbuf;
8003 Lisp_Object oldpoint, oldbegv, oldzv; 8000 Lisp_Object oldpoint, oldbegv, oldzv;
8004 int old_windows_or_buffers_changed = windows_or_buffers_changed; 8001 int old_windows_or_buffers_changed = windows_or_buffers_changed;
8005 int point_at_end = 0; 8002 EMACS_INT point_at_end = 0;
8006 int zv_at_end = 0; 8003 EMACS_INT zv_at_end = 0;
8007 Lisp_Object old_deactivate_mark, tem; 8004 Lisp_Object old_deactivate_mark, tem;
8008 struct gcpro gcpro1; 8005 struct gcpro gcpro1;
8009 8006
@@ -8036,7 +8033,8 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
8036 if (multibyte 8033 if (multibyte
8037 && NILP (current_buffer->enable_multibyte_characters)) 8034 && NILP (current_buffer->enable_multibyte_characters))
8038 { 8035 {
8039 int i, c, char_bytes; 8036 EMACS_INT i;
8037 int c, char_bytes;
8040 unsigned char work[1]; 8038 unsigned char work[1];
8041 8039
8042 /* Convert a multibyte string to single-byte 8040 /* Convert a multibyte string to single-byte
@@ -8053,7 +8051,8 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
8053 else if (! multibyte 8051 else if (! multibyte
8054 && ! NILP (current_buffer->enable_multibyte_characters)) 8052 && ! NILP (current_buffer->enable_multibyte_characters))
8055 { 8053 {
8056 int i, c, char_bytes; 8054 EMACS_INT i;
8055 int c, char_bytes;
8057 unsigned char *msg = (unsigned char *) m; 8056 unsigned char *msg = (unsigned char *) m;
8058 unsigned char str[MAX_MULTIBYTE_LENGTH]; 8057 unsigned char str[MAX_MULTIBYTE_LENGTH];
8059 /* Convert a single-byte string to multibyte 8058 /* Convert a single-byte string to multibyte
@@ -8071,7 +8070,8 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
8071 8070
8072 if (nlflag) 8071 if (nlflag)
8073 { 8072 {
8074 int this_bol, this_bol_byte, prev_bol, prev_bol_byte, dup; 8073 EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte;
8074 int dup;
8075 insert_1 ("\n", 1, 1, 0, 0); 8075 insert_1 ("\n", 1, 1, 0, 0);
8076 8076
8077 scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); 8077 scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0);
@@ -8162,11 +8162,11 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
8162 value N > 1 if we should also append " [N times]". */ 8162 value N > 1 if we should also append " [N times]". */
8163 8163
8164static int 8164static int
8165message_log_check_duplicate (int prev_bol, int prev_bol_byte, 8165message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte,
8166 int this_bol, int this_bol_byte) 8166 EMACS_INT this_bol, EMACS_INT this_bol_byte)
8167{ 8167{
8168 int i; 8168 EMACS_INT i;
8169 int len = Z_BYTE - 1 - this_bol_byte; 8169 EMACS_INT len = Z_BYTE - 1 - this_bol_byte;
8170 int seen_dots = 0; 8170 int seen_dots = 0;
8171 unsigned char *p1 = BUF_BYTE_ADDRESS (current_buffer, prev_bol_byte); 8171 unsigned char *p1 = BUF_BYTE_ADDRESS (current_buffer, prev_bol_byte);
8172 unsigned char *p2 = BUF_BYTE_ADDRESS (current_buffer, this_bol_byte); 8172 unsigned char *p2 = BUF_BYTE_ADDRESS (current_buffer, this_bol_byte);
@@ -8201,7 +8201,7 @@ message_log_check_duplicate (int prev_bol, int prev_bol_byte,
8201 This may GC, so the buffer M must NOT point to a Lisp string. */ 8201 This may GC, so the buffer M must NOT point to a Lisp string. */
8202 8202
8203void 8203void
8204message2 (const char *m, int nbytes, int multibyte) 8204message2 (const char *m, EMACS_INT nbytes, int multibyte)
8205{ 8205{
8206 /* First flush out any partial line written with print. */ 8206 /* First flush out any partial line written with print. */
8207 message_log_maybe_newline (); 8207 message_log_maybe_newline ();
@@ -8214,7 +8214,7 @@ message2 (const char *m, int nbytes, int multibyte)
8214/* The non-logging counterpart of message2. */ 8214/* The non-logging counterpart of message2. */
8215 8215
8216void 8216void
8217message2_nolog (const char *m, int nbytes, int multibyte) 8217message2_nolog (const char *m, EMACS_INT nbytes, int multibyte)
8218{ 8218{
8219 struct frame *sf = SELECTED_FRAME (); 8219 struct frame *sf = SELECTED_FRAME ();
8220 message_enable_multibyte = multibyte; 8220 message_enable_multibyte = multibyte;
@@ -8276,7 +8276,7 @@ message2_nolog (const char *m, int nbytes, int multibyte)
8276 This function cancels echoing. */ 8276 This function cancels echoing. */
8277 8277
8278void 8278void
8279message3 (Lisp_Object m, int nbytes, int multibyte) 8279message3 (Lisp_Object m, EMACS_INT nbytes, int multibyte)
8280{ 8280{
8281 struct gcpro gcpro1; 8281 struct gcpro gcpro1;
8282 8282
@@ -8308,7 +8308,7 @@ message3 (Lisp_Object m, int nbytes, int multibyte)
8308 and make this cancel echoing. */ 8308 and make this cancel echoing. */
8309 8309
8310void 8310void
8311message3_nolog (Lisp_Object m, int nbytes, int multibyte) 8311message3_nolog (Lisp_Object m, EMACS_INT nbytes, int multibyte)
8312{ 8312{
8313 struct frame *sf = SELECTED_FRAME (); 8313 struct frame *sf = SELECTED_FRAME ();
8314 message_enable_multibyte = multibyte; 8314 message_enable_multibyte = multibyte;
@@ -8494,7 +8494,7 @@ vmessage (const char *m, va_list ap)
8494 { 8494 {
8495 if (m) 8495 if (m)
8496 { 8496 {
8497 int len; 8497 EMACS_INT len;
8498 8498
8499 len = doprnt (FRAME_MESSAGE_BUF (f), 8499 len = doprnt (FRAME_MESSAGE_BUF (f),
8500 FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, ap); 8500 FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, ap);
@@ -9238,7 +9238,8 @@ truncate_message_1 (EMACS_INT nchars, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4
9238 */ 9238 */
9239 9239
9240void 9240void
9241set_message (const char *s, Lisp_Object string, int nbytes, int multibyte_p) 9241set_message (const char *s, Lisp_Object string,
9242 EMACS_INT nbytes, int multibyte_p)
9242{ 9243{
9243 message_enable_multibyte 9244 message_enable_multibyte
9244 = ((s && multibyte_p) 9245 = ((s && multibyte_p)
@@ -9274,7 +9275,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
9274 9275
9275 if (STRINGP (string)) 9276 if (STRINGP (string))
9276 { 9277 {
9277 int nchars; 9278 EMACS_INT nchars;
9278 9279
9279 if (nbytes == 0) 9280 if (nbytes == 0)
9280 nbytes = SBYTES (string); 9281 nbytes = SBYTES (string);
@@ -9293,7 +9294,8 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
9293 if (multibyte_p && NILP (current_buffer->enable_multibyte_characters)) 9294 if (multibyte_p && NILP (current_buffer->enable_multibyte_characters))
9294 { 9295 {
9295 /* Convert from multi-byte to single-byte. */ 9296 /* Convert from multi-byte to single-byte. */
9296 int i, c, n; 9297 EMACS_INT i;
9298 int c, n;
9297 unsigned char work[1]; 9299 unsigned char work[1];
9298 9300
9299 /* Convert a multibyte string to single-byte. */ 9301 /* Convert a multibyte string to single-byte. */
@@ -9310,7 +9312,8 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
9310 && !NILP (current_buffer->enable_multibyte_characters)) 9312 && !NILP (current_buffer->enable_multibyte_characters))
9311 { 9313 {
9312 /* Convert from single-byte to multi-byte. */ 9314 /* Convert from single-byte to multi-byte. */
9313 int i, c, n; 9315 EMACS_INT i;
9316 int c, n;
9314 const unsigned char *msg = (const unsigned char *) s; 9317 const unsigned char *msg = (const unsigned char *) s;
9315 unsigned char str[MAX_MULTIBYTE_LENGTH]; 9318 unsigned char str[MAX_MULTIBYTE_LENGTH];
9316 9319
@@ -10992,7 +10995,7 @@ hscroll_window_tree (Lisp_Object window)
10992 struct it it; 10995 struct it it;
10993 int hscroll; 10996 int hscroll;
10994 struct buffer *saved_current_buffer; 10997 struct buffer *saved_current_buffer;
10995 int pt; 10998 EMACS_INT pt;
10996 int wanted_x; 10999 int wanted_x;
10997 11000
10998 /* Find point in a display of infinite width. */ 11001 /* Find point in a display of infinite width. */
@@ -11157,7 +11160,8 @@ debug_method_add (w, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9)
11157 redisplay_internal for display optimization. */ 11160 redisplay_internal for display optimization. */
11158 11161
11159static INLINE int 11162static INLINE int
11160text_outside_line_unchanged_p (struct window *w, int start, int end) 11163text_outside_line_unchanged_p (struct window *w,
11164 EMACS_INT start, EMACS_INT end)
11161{ 11165{
11162 int unchanged_p = 1; 11166 int unchanged_p = 1;
11163 11167
@@ -12473,7 +12477,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12473 struct glyph *end = glyph + row->used[TEXT_AREA]; 12477 struct glyph *end = glyph + row->used[TEXT_AREA];
12474 struct glyph *cursor = NULL; 12478 struct glyph *cursor = NULL;
12475 /* The last known character position in row. */ 12479 /* The last known character position in row. */
12476 int last_pos = MATRIX_ROW_START_CHARPOS (row) + delta; 12480 EMACS_INT last_pos = MATRIX_ROW_START_CHARPOS (row) + delta;
12477 int x = row->x; 12481 int x = row->x;
12478 EMACS_INT pt_old = PT - delta; 12482 EMACS_INT pt_old = PT - delta;
12479 EMACS_INT pos_before = MATRIX_ROW_START_CHARPOS (row) + delta; 12483 EMACS_INT pos_before = MATRIX_ROW_START_CHARPOS (row) + delta;
@@ -12610,7 +12614,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12610 else if (STRINGP (glyph->object)) 12614 else if (STRINGP (glyph->object))
12611 { 12615 {
12612 Lisp_Object chprop; 12616 Lisp_Object chprop;
12613 int glyph_pos = glyph->charpos; 12617 EMACS_INT glyph_pos = glyph->charpos;
12614 12618
12615 chprop = Fget_char_property (make_number (glyph_pos), Qcursor, 12619 chprop = Fget_char_property (make_number (glyph_pos), Qcursor,
12616 glyph->object); 12620 glyph->object);
@@ -12677,7 +12681,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12677 else if (STRINGP (glyph->object)) 12681 else if (STRINGP (glyph->object))
12678 { 12682 {
12679 Lisp_Object chprop; 12683 Lisp_Object chprop;
12680 int glyph_pos = glyph->charpos; 12684 EMACS_INT glyph_pos = glyph->charpos;
12681 12685
12682 chprop = Fget_char_property (make_number (glyph_pos), Qcursor, 12686 chprop = Fget_char_property (make_number (glyph_pos), Qcursor,
12683 glyph->object); 12687 glyph->object);
@@ -12795,7 +12799,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12795 be a character in the string with the 12799 be a character in the string with the
12796 `cursor' property, which means display 12800 `cursor' property, which means display
12797 cursor on that character's glyph. */ 12801 cursor on that character's glyph. */
12798 int strpos = glyph->charpos; 12802 EMACS_INT strpos = glyph->charpos;
12799 12803
12800 cursor = glyph; 12804 cursor = glyph;
12801 for (glyph += incr; 12805 for (glyph += incr;
@@ -12804,7 +12808,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12804 glyph += incr) 12808 glyph += incr)
12805 { 12809 {
12806 Lisp_Object cprop; 12810 Lisp_Object cprop;
12807 int gpos = glyph->charpos; 12811 EMACS_INT gpos = glyph->charpos;
12808 12812
12809 cprop = Fget_char_property (make_number (gpos), 12813 cprop = Fget_char_property (make_number (gpos),
12810 Qcursor, 12814 Qcursor,
@@ -13694,7 +13698,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
13694void 13698void
13695set_vertical_scroll_bar (struct window *w) 13699set_vertical_scroll_bar (struct window *w)
13696{ 13700{
13697 int start, end, whole; 13701 EMACS_INT start, end, whole;
13698 13702
13699 /* Calculate the start and end positions for the current window. 13703 /* Calculate the start and end positions for the current window.
13700 At some point, it would be nice to choose between scrollbars 13704 At some point, it would be nice to choose between scrollbars
@@ -13758,7 +13762,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
13758 int rc; 13762 int rc;
13759 int centering_position = -1; 13763 int centering_position = -1;
13760 int last_line_misfit = 0; 13764 int last_line_misfit = 0;
13761 int beg_unchanged, end_unchanged; 13765 EMACS_INT beg_unchanged, end_unchanged;
13762 13766
13763 SET_TEXT_POS (lpoint, PT, PT_BYTE); 13767 SET_TEXT_POS (lpoint, PT, PT_BYTE);
13764 opoint = lpoint; 13768 opoint = lpoint;
@@ -13900,8 +13904,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
13900 window, set up appropriate value. */ 13904 window, set up appropriate value. */
13901 if (!EQ (window, selected_window)) 13905 if (!EQ (window, selected_window))
13902 { 13906 {
13903 int new_pt = XMARKER (w->pointm)->charpos; 13907 EMACS_INT new_pt = XMARKER (w->pointm)->charpos;
13904 int new_pt_byte = marker_byte_position (w->pointm); 13908 EMACS_INT new_pt_byte = marker_byte_position (w->pointm);
13905 if (new_pt < BEGV) 13909 if (new_pt < BEGV)
13906 { 13910 {
13907 new_pt = BEGV; 13911 new_pt = BEGV;
@@ -15107,7 +15111,7 @@ find_last_row_displaying_text (struct glyph_matrix *matrix, struct it *it,
15107static struct glyph_row * 15111static struct glyph_row *
15108find_last_unchanged_at_beg_row (struct window *w) 15112find_last_unchanged_at_beg_row (struct window *w)
15109{ 15113{
15110 int first_changed_pos = BEG + BEG_UNCHANGED; 15114 EMACS_INT first_changed_pos = BEG + BEG_UNCHANGED;
15111 struct glyph_row *row; 15115 struct glyph_row *row;
15112 struct glyph_row *row_found = NULL; 15116 struct glyph_row *row_found = NULL;
15113 int yb = window_text_bottom_y (w); 15117 int yb = window_text_bottom_y (w);
@@ -15183,9 +15187,11 @@ find_first_unchanged_at_end_row (struct window *w,
15183 corresponds to window_end_pos. This allows us to translate 15187 corresponds to window_end_pos. This allows us to translate
15184 buffer positions in the current matrix to current buffer 15188 buffer positions in the current matrix to current buffer
15185 positions for characters not in changed text. */ 15189 positions for characters not in changed text. */
15186 int Z_old = MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos); 15190 EMACS_INT Z_old =
15187 int Z_BYTE_old = MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; 15191 MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos);
15188 int last_unchanged_pos, last_unchanged_pos_old; 15192 EMACS_INT Z_BYTE_old =
15193 MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos;
15194 EMACS_INT last_unchanged_pos, last_unchanged_pos_old;
15189 struct glyph_row *first_text_row 15195 struct glyph_row *first_text_row
15190 = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 15196 = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
15191 15197
@@ -15272,8 +15278,8 @@ sync_frame_with_window_matrix_rows (struct window *w)
15272 containing CHARPOS or null. */ 15278 containing CHARPOS or null. */
15273 15279
15274struct glyph_row * 15280struct glyph_row *
15275row_containing_pos (struct window *w, int charpos, struct glyph_row *start, 15281row_containing_pos (struct window *w, EMACS_INT charpos,
15276 struct glyph_row *end, int dy) 15282 struct glyph_row *start, struct glyph_row *end, int dy)
15277{ 15283{
15278 struct glyph_row *row = start; 15284 struct glyph_row *row = start;
15279 struct glyph_row *best_row = NULL; 15285 struct glyph_row *best_row = NULL;
@@ -16904,9 +16910,9 @@ extend_face_to_end_of_line (struct it *it)
16904 trailing whitespace. */ 16910 trailing whitespace. */
16905 16911
16906static int 16912static int
16907trailing_whitespace_p (int charpos) 16913trailing_whitespace_p (EMACS_INT charpos)
16908{ 16914{
16909 int bytepos = CHAR_TO_BYTE (charpos); 16915 EMACS_INT bytepos = CHAR_TO_BYTE (charpos);
16910 int c = 0; 16916 int c = 0;
16911 16917
16912 while (bytepos < ZV_BYTE 16918 while (bytepos < ZV_BYTE
@@ -18556,7 +18562,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
18556 else if (c != 0) 18562 else if (c != 0)
18557 { 18563 {
18558 int multibyte; 18564 int multibyte;
18559 int bytepos, charpos; 18565 EMACS_INT bytepos, charpos;
18560 const unsigned char *spec; 18566 const unsigned char *spec;
18561 Lisp_Object string; 18567 Lisp_Object string;
18562 18568
@@ -18830,7 +18836,7 @@ static int
18830store_mode_line_string (const char *string, Lisp_Object lisp_string, int copy_string, 18836store_mode_line_string (const char *string, Lisp_Object lisp_string, int copy_string,
18831 int field_width, int precision, Lisp_Object props) 18837 int field_width, int precision, Lisp_Object props)
18832{ 18838{
18833 int len; 18839 EMACS_INT len;
18834 int n = 0; 18840 int n = 0;
18835 18841
18836 if (string != NULL) 18842 if (string != NULL)
@@ -19375,22 +19381,23 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19375 19381
19376 case 'i': 19382 case 'i':
19377 { 19383 {
19378 int size = ZV - BEGV; 19384 EMACS_INT size = ZV - BEGV;
19379 pint2str (decode_mode_spec_buf, field_width, size); 19385 pint2str (decode_mode_spec_buf, field_width, size);
19380 return decode_mode_spec_buf; 19386 return decode_mode_spec_buf;
19381 } 19387 }
19382 19388
19383 case 'I': 19389 case 'I':
19384 { 19390 {
19385 int size = ZV - BEGV; 19391 EMACS_INT size = ZV - BEGV;
19386 pint2hrstr (decode_mode_spec_buf, field_width, size); 19392 pint2hrstr (decode_mode_spec_buf, field_width, size);
19387 return decode_mode_spec_buf; 19393 return decode_mode_spec_buf;
19388 } 19394 }
19389 19395
19390 case 'l': 19396 case 'l':
19391 { 19397 {
19392 int startpos, startpos_byte, line, linepos, linepos_byte; 19398 EMACS_INT startpos, startpos_byte, line, linepos, linepos_byte;
19393 int topline, nlines, junk, height; 19399 int topline, nlines, height;
19400 EMACS_INT junk;
19394 19401
19395 /* %c and %l are ignored in `frame-title-format'. */ 19402 /* %c and %l are ignored in `frame-title-format'. */
19396 if (mode_line_target == MODE_LINE_TITLE) 19403 if (mode_line_target == MODE_LINE_TITLE)
@@ -19451,9 +19458,9 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19451 else if (nlines < height + 25 || nlines > height * 3 + 50 19458 else if (nlines < height + 25 || nlines > height * 3 + 50
19452 || linepos == BUF_BEGV (b)) 19459 || linepos == BUF_BEGV (b))
19453 { 19460 {
19454 int limit = BUF_BEGV (b); 19461 EMACS_INT limit = BUF_BEGV (b);
19455 int limit_byte = BUF_BEGV_BYTE (b); 19462 EMACS_INT limit_byte = BUF_BEGV_BYTE (b);
19456 int position; 19463 EMACS_INT position;
19457 int distance = (height * 2 + 30) * line_number_display_limit_width; 19464 int distance = (height * 2 + 30) * line_number_display_limit_width;
19458 19465
19459 if (startpos - distance > limit) 19466 if (startpos - distance > limit)
@@ -19515,8 +19522,8 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19515 19522
19516 case 'p': 19523 case 'p':
19517 { 19524 {
19518 int pos = marker_position (w->start); 19525 EMACS_INT pos = marker_position (w->start);
19519 int total = BUF_ZV (b) - BUF_BEGV (b); 19526 EMACS_INT total = BUF_ZV (b) - BUF_BEGV (b);
19520 19527
19521 if (XFASTINT (w->window_end_pos) <= BUF_Z (b) - BUF_ZV (b)) 19528 if (XFASTINT (w->window_end_pos) <= BUF_Z (b) - BUF_ZV (b))
19522 { 19529 {
@@ -19538,7 +19545,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19538 so get us a 2-digit number that is close. */ 19545 so get us a 2-digit number that is close. */
19539 if (total == 100) 19546 if (total == 100)
19540 total = 99; 19547 total = 99;
19541 sprintf (decode_mode_spec_buf, "%2d%%", total); 19548 sprintf (decode_mode_spec_buf, "%2ld%%", (long)total);
19542 return decode_mode_spec_buf; 19549 return decode_mode_spec_buf;
19543 } 19550 }
19544 } 19551 }
@@ -19546,9 +19553,9 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19546 /* Display percentage of size above the bottom of the screen. */ 19553 /* Display percentage of size above the bottom of the screen. */
19547 case 'P': 19554 case 'P':
19548 { 19555 {
19549 int toppos = marker_position (w->start); 19556 EMACS_INT toppos = marker_position (w->start);
19550 int botpos = BUF_Z (b) - XFASTINT (w->window_end_pos); 19557 EMACS_INT botpos = BUF_Z (b) - XFASTINT (w->window_end_pos);
19551 int total = BUF_ZV (b) - BUF_BEGV (b); 19558 EMACS_INT total = BUF_ZV (b) - BUF_BEGV (b);
19552 19559
19553 if (botpos >= BUF_ZV (b)) 19560 if (botpos >= BUF_ZV (b))
19554 { 19561 {
@@ -19569,9 +19576,9 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19569 if (total == 100) 19576 if (total == 100)
19570 total = 99; 19577 total = 99;
19571 if (toppos <= BUF_BEGV (b)) 19578 if (toppos <= BUF_BEGV (b))
19572 sprintf (decode_mode_spec_buf, "Top%2d%%", total); 19579 sprintf (decode_mode_spec_buf, "Top%2ld%%", (long)total);
19573 else 19580 else
19574 sprintf (decode_mode_spec_buf, "%2d%%", total); 19581 sprintf (decode_mode_spec_buf, "%2ld%%", (long)total);
19575 return decode_mode_spec_buf; 19582 return decode_mode_spec_buf;
19576 } 19583 }
19577 } 19584 }
@@ -19662,8 +19669,9 @@ decode_mode_spec (struct window *w, register int c, int field_width,
19662 Set *BYTE_POS_PTR to 1 if we found COUNT lines, 0 if we hit LIMIT. */ 19669 Set *BYTE_POS_PTR to 1 if we found COUNT lines, 0 if we hit LIMIT. */
19663 19670
19664static int 19671static int
19665display_count_lines (int start, int start_byte, int limit_byte, int count, 19672display_count_lines (EMACS_INT start, EMACS_INT start_byte,
19666 int *byte_pos_ptr) 19673 EMACS_INT limit_byte, int count,
19674 EMACS_INT *byte_pos_ptr)
19667{ 19675{
19668 register unsigned char *cursor; 19676 register unsigned char *cursor;
19669 unsigned char *base; 19677 unsigned char *base;
@@ -21920,11 +21928,7 @@ produce_stretch_glyph (struct it *it)
21920 21928
21921 it2 = *it; 21929 it2 = *it;
21922 if (it->multibyte_p) 21930 if (it->multibyte_p)
21923 { 21931 it2.c = it2.char_to_display = STRING_CHAR_AND_LENGTH (p, it2.len);
21924 int maxlen = ((IT_BYTEPOS (*it) >= GPT ? ZV : GPT)
21925 - IT_BYTEPOS (*it));
21926 it2.c = it2.char_to_display = STRING_CHAR_AND_LENGTH (p, it2.len);
21927 }
21928 else 21932 else
21929 { 21933 {
21930 it2.c = it2.char_to_display = *p, it2.len = 1; 21934 it2.c = it2.char_to_display = *p, it2.len = 1;
@@ -22410,7 +22414,7 @@ x_produce_glyphs (struct it *it)
22410 XChar2b char2b; 22414 XChar2b char2b;
22411 struct font_metrics *pcm; 22415 struct font_metrics *pcm;
22412 int font_not_found_p; 22416 int font_not_found_p;
22413 int pos; 22417 EMACS_INT pos;
22414 22418
22415 for (glyph_len = cmp->glyph_len; glyph_len > 0; glyph_len--) 22419 for (glyph_len = cmp->glyph_len; glyph_len > 0; glyph_len--)
22416 if ((c = COMPOSITION_GLYPH (cmp, glyph_len - 1)) != '\t') 22420 if ((c = COMPOSITION_GLYPH (cmp, glyph_len - 1)) != '\t')
@@ -24504,7 +24508,8 @@ note_mouse_highlight (struct frame *f, int x, int y)
24504 Lisp_Object *overlay_vec = NULL; 24508 Lisp_Object *overlay_vec = NULL;
24505 int noverlays; 24509 int noverlays;
24506 struct buffer *obuf; 24510 struct buffer *obuf;
24507 int obegv, ozv, same_region; 24511 EMACS_INT obegv, ozv;
24512 int same_region;
24508 24513
24509 /* Find the glyph under X/Y. */ 24514 /* Find the glyph under X/Y. */
24510 glyph = x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, &dx, &dy, &area); 24515 glyph = x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, &dx, &dy, &area);
@@ -24690,7 +24695,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
24690 /* If we are on a display string with no mouse-face, 24695 /* If we are on a display string with no mouse-face,
24691 check if the text under it has one. */ 24696 check if the text under it has one. */
24692 struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); 24697 struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos);
24693 int start = MATRIX_ROW_START_CHARPOS (r); 24698 EMACS_INT start = MATRIX_ROW_START_CHARPOS (r);
24694 pos = string_buffer_position (w, object, start); 24699 pos = string_buffer_position (w, object, start);
24695 if (pos > 0) 24700 if (pos > 0)
24696 { 24701 {
@@ -24769,7 +24774,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
24769 else 24774 else
24770 { 24775 {
24771 Lisp_Object object = glyph->object; 24776 Lisp_Object object = glyph->object;
24772 int charpos = glyph->charpos; 24777 EMACS_INT charpos = glyph->charpos;
24773 24778
24774 /* Try text properties. */ 24779 /* Try text properties. */
24775 if (STRINGP (object) 24780 if (STRINGP (object)
@@ -24784,7 +24789,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
24784 see if the buffer text ``under'' it does. */ 24789 see if the buffer text ``under'' it does. */
24785 struct glyph_row *r 24790 struct glyph_row *r
24786 = MATRIX_ROW (w->current_matrix, vpos); 24791 = MATRIX_ROW (w->current_matrix, vpos);
24787 int start = MATRIX_ROW_START_CHARPOS (r); 24792 EMACS_INT start = MATRIX_ROW_START_CHARPOS (r);
24788 EMACS_INT pos = string_buffer_position (w, object, start); 24793 EMACS_INT pos = string_buffer_position (w, object, start);
24789 if (pos > 0) 24794 if (pos > 0)
24790 { 24795 {
@@ -24824,7 +24829,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
24824 if (NILP (pointer)) 24829 if (NILP (pointer))
24825 { 24830 {
24826 Lisp_Object object = glyph->object; 24831 Lisp_Object object = glyph->object;
24827 int charpos = glyph->charpos; 24832 EMACS_INT charpos = glyph->charpos;
24828 24833
24829 /* Try text properties. */ 24834 /* Try text properties. */
24830 if (STRINGP (object) 24835 if (STRINGP (object)
@@ -24839,7 +24844,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
24839 see if the buffer text ``under'' it does. */ 24844 see if the buffer text ``under'' it does. */
24840 struct glyph_row *r 24845 struct glyph_row *r
24841 = MATRIX_ROW (w->current_matrix, vpos); 24846 = MATRIX_ROW (w->current_matrix, vpos);
24842 int start = MATRIX_ROW_START_CHARPOS (r); 24847 EMACS_INT start = MATRIX_ROW_START_CHARPOS (r);
24843 EMACS_INT pos = string_buffer_position (w, object, 24848 EMACS_INT pos = string_buffer_position (w, object,
24844 start); 24849 start);
24845 if (pos > 0) 24850 if (pos > 0)