Commit 2452438f authored by Eli Zaretskii's avatar Eli Zaretskii

Fix int/EMACS_INT use in textprop.c and window.c.

 window.c (Fpos_visible_in_window_p, Fdelete_other_windows)
 (Fselect_window, window_scroll_pixel_based)
 (window_scroll_line_based, Frecenter, Fset_window_configuration):
 Use EMACS_INT for buffer positions.
 textprop.c (validate_interval_range, interval_of)
 (property_change_between_p, Fadd_text_properties)
 (set_text_properties_1, Fremove_text_properties)
 (Fremove_list_of_text_properties, Ftext_property_any)
 (Ftext_property_not_all, copy_text_properties)
 (text_property_list, extend_property_ranges)
 (verify_interval_modification): Use EMACS_INT for buffer
 positions.
parent e70153eb
2010-09-25 Eli Zaretskii <eliz@gnu.org> 2010-09-25 Eli Zaretskii <eliz@gnu.org>
* window.c (Fpos_visible_in_window_p, Fdelete_other_windows)
(Fselect_window, window_scroll_pixel_based)
(window_scroll_line_based, Frecenter, Fset_window_configuration):
Use EMACS_INT for buffer positions.
* textprop.c (validate_interval_range, interval_of)
(property_change_between_p, Fadd_text_properties)
(set_text_properties_1, Fremove_text_properties)
(Fremove_list_of_text_properties, Ftext_property_any)
(Ftext_property_not_all, copy_text_properties)
(text_property_list, extend_property_ranges)
(verify_interval_modification): Use EMACS_INT for buffer
positions.
* term.c (fast_find_position, term_mouse_highlight): Use EMACS_INT * term.c (fast_find_position, term_mouse_highlight): Use EMACS_INT
for buffer positions. for buffer positions.
......
...@@ -125,7 +125,7 @@ INTERVAL ...@@ -125,7 +125,7 @@ INTERVAL
validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *end, int force) validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *end, int force)
{ {
register INTERVAL i; register INTERVAL i;
int searchpos; EMACS_INT searchpos;
CHECK_STRING_OR_BUFFER (object); CHECK_STRING_OR_BUFFER (object);
CHECK_NUMBER_COERCE_MARKER (*begin); CHECK_NUMBER_COERCE_MARKER (*begin);
...@@ -161,7 +161,7 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en ...@@ -161,7 +161,7 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en
} }
else else
{ {
int len = SCHARS (object); EMACS_INT len = SCHARS (object);
if (! (0 <= XINT (*begin) && XINT (*begin) <= XINT (*end) if (! (0 <= XINT (*begin) && XINT (*begin) <= XINT (*end)
&& XINT (*end) <= len)) && XINT (*end) <= len))
...@@ -519,7 +519,7 @@ INTERVAL ...@@ -519,7 +519,7 @@ INTERVAL
interval_of (int position, Lisp_Object object) interval_of (int position, Lisp_Object object)
{ {
register INTERVAL i; register INTERVAL i;
int beg, end; EMACS_INT beg, end;
if (NILP (object)) if (NILP (object))
XSETBUFFER (object, current_buffer); XSETBUFFER (object, current_buffer);
...@@ -984,7 +984,7 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) ...@@ -984,7 +984,7 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */)
/* Return 1 if there's a change in some property between BEG and END. */ /* Return 1 if there's a change in some property between BEG and END. */
int int
property_change_between_p (int beg, int end) property_change_between_p (EMACS_INT beg, EMACS_INT end)
{ {
register INTERVAL i, next; register INTERVAL i, next;
Lisp_Object object, pos; Lisp_Object object, pos;
...@@ -1173,7 +1173,8 @@ Return t if any property value actually changed, nil otherwise. */) ...@@ -1173,7 +1173,8 @@ Return t if any property value actually changed, nil otherwise. */)
(Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object)
{ {
register INTERVAL i, unchanged; register INTERVAL i, unchanged;
register int s, len, modified = 0; register EMACS_INT s, len;
register int modified = 0;
struct gcpro gcpro1; struct gcpro gcpro1;
properties = validate_plist (properties); properties = validate_plist (properties);
...@@ -1202,7 +1203,7 @@ Return t if any property value actually changed, nil otherwise. */) ...@@ -1202,7 +1203,7 @@ Return t if any property value actually changed, nil otherwise. */)
skip it. */ skip it. */
if (interval_has_all_properties (properties, i)) if (interval_has_all_properties (properties, i))
{ {
int got = (LENGTH (i) - (s - i->position)); EMACS_INT got = (LENGTH (i) - (s - i->position));
if (got >= len) if (got >= len)
RETURN_UNGCPRO (Qnil); RETURN_UNGCPRO (Qnil);
len -= got; len -= got;
...@@ -1377,7 +1378,7 @@ void ...@@ -1377,7 +1378,7 @@ void
set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object buffer, INTERVAL i) set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object buffer, INTERVAL i)
{ {
register INTERVAL prev_changed = NULL_INTERVAL; register INTERVAL prev_changed = NULL_INTERVAL;
register int s, len; register EMACS_INT s, len;
INTERVAL unchanged; INTERVAL unchanged;
s = XINT (start); s = XINT (start);
...@@ -1466,7 +1467,8 @@ Use `set-text-properties' if you want to remove all text properties. */) ...@@ -1466,7 +1467,8 @@ Use `set-text-properties' if you want to remove all text properties. */)
(Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object)
{ {
register INTERVAL i, unchanged; register INTERVAL i, unchanged;
register int s, len, modified = 0; register EMACS_INT s, len;
register int modified = 0;
if (NILP (object)) if (NILP (object))
XSETBUFFER (object, current_buffer); XSETBUFFER (object, current_buffer);
...@@ -1484,7 +1486,7 @@ Use `set-text-properties' if you want to remove all text properties. */) ...@@ -1484,7 +1486,7 @@ Use `set-text-properties' if you want to remove all text properties. */)
it covers the entire region. */ it covers the entire region. */
if (! interval_has_some_properties (properties, i)) if (! interval_has_some_properties (properties, i))
{ {
int got = (LENGTH (i) - (s - i->position)); EMACS_INT got = (LENGTH (i) - (s - i->position));
if (got >= len) if (got >= len)
return Qnil; return Qnil;
len -= got; len -= got;
...@@ -1551,7 +1553,8 @@ Return t if any property was actually removed, nil otherwise. */) ...@@ -1551,7 +1553,8 @@ Return t if any property was actually removed, nil otherwise. */)
(Lisp_Object start, Lisp_Object end, Lisp_Object list_of_properties, Lisp_Object object) (Lisp_Object start, Lisp_Object end, Lisp_Object list_of_properties, Lisp_Object object)
{ {
register INTERVAL i, unchanged; register INTERVAL i, unchanged;
register int s, len, modified = 0; register EMACS_INT s, len;
register int modified = 0;
Lisp_Object properties; Lisp_Object properties;
properties = list_of_properties; properties = list_of_properties;
...@@ -1571,7 +1574,7 @@ Return t if any property was actually removed, nil otherwise. */) ...@@ -1571,7 +1574,7 @@ Return t if any property was actually removed, nil otherwise. */)
it covers the entire region. */ it covers the entire region. */
if (! interval_has_some_properties_list (properties, i)) if (! interval_has_some_properties_list (properties, i))
{ {
int got = (LENGTH (i) - (s - i->position)); EMACS_INT got = (LENGTH (i) - (s - i->position));
if (got >= len) if (got >= len)
return Qnil; return Qnil;
len -= got; len -= got;
...@@ -1658,7 +1661,7 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */ ...@@ -1658,7 +1661,7 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */
(Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object)
{ {
register INTERVAL i; register INTERVAL i;
register int e, pos; register EMACS_INT e, pos;
if (NILP (object)) if (NILP (object))
XSETBUFFER (object, current_buffer); XSETBUFFER (object, current_buffer);
...@@ -1694,7 +1697,7 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */ ...@@ -1694,7 +1697,7 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */
(Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object)
{ {
register INTERVAL i; register INTERVAL i;
register int s, e; register EMACS_INT s, e;
if (NILP (object)) if (NILP (object))
XSETBUFFER (object, current_buffer); XSETBUFFER (object, current_buffer);
...@@ -1806,7 +1809,8 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_ ...@@ -1806,7 +1809,8 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_
Lisp_Object res; Lisp_Object res;
Lisp_Object stuff; Lisp_Object stuff;
Lisp_Object plist; Lisp_Object plist;
int s, e, e2, p, len, modified = 0; EMACS_INT s, e, e2, p, len;
int modified = 0;
struct gcpro gcpro1, gcpro2; struct gcpro gcpro1, gcpro2;
i = validate_interval_range (src, &start, &end, soft); i = validate_interval_range (src, &start, &end, soft);
...@@ -1902,12 +1906,12 @@ text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp ...@@ -1902,12 +1906,12 @@ text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp
i = validate_interval_range (object, &start, &end, soft); i = validate_interval_range (object, &start, &end, soft);
if (!NULL_INTERVAL_P (i)) if (!NULL_INTERVAL_P (i))
{ {
int s = XINT (start); EMACS_INT s = XINT (start);
int e = XINT (end); EMACS_INT e = XINT (end);
while (s < e) while (s < e)
{ {
int interval_end, len; EMACS_INT interval_end, len;
Lisp_Object plist; Lisp_Object plist;
interval_end = i->position + LENGTH (i); interval_end = i->position + LENGTH (i);
...@@ -1985,7 +1989,7 @@ Lisp_Object ...@@ -1985,7 +1989,7 @@ Lisp_Object
extend_property_ranges (Lisp_Object list, Lisp_Object new_end) extend_property_ranges (Lisp_Object list, Lisp_Object new_end)
{ {
Lisp_Object prev = Qnil, head = list; Lisp_Object prev = Qnil, head = list;
int max = XINT (new_end); EMACS_INT max = XINT (new_end);
for (; CONSP (list); prev = list, list = XCDR (list)) for (; CONSP (list); prev = list, list = XCDR (list))
{ {
...@@ -2059,7 +2063,7 @@ verify_interval_modification (struct buffer *buf, int start, int end) ...@@ -2059,7 +2063,7 @@ verify_interval_modification (struct buffer *buf, int start, int end)
if (start > end) if (start > end)
{ {
int temp = start; EMACS_INT temp = start;
start = end; start = end;
end = temp; end = temp;
} }
......
...@@ -311,7 +311,7 @@ display row, and VPOS is the row number (0-based) containing POS. */) ...@@ -311,7 +311,7 @@ display row, and VPOS is the row number (0-based) containing POS. */)
(Lisp_Object pos, Lisp_Object window, Lisp_Object partially) (Lisp_Object pos, Lisp_Object window, Lisp_Object partially)
{ {
register struct window *w; register struct window *w;
register int posint; register EMACS_INT posint;
register struct buffer *buf; register struct buffer *buf;
struct text_pos top; struct text_pos top;
Lisp_Object in_window = Qnil; Lisp_Object in_window = Qnil;
...@@ -2500,7 +2500,7 @@ window-start value is reasonable when this function is called. */) ...@@ -2500,7 +2500,7 @@ window-start value is reasonable when this function is called. */)
(Lisp_Object window) (Lisp_Object window)
{ {
struct window *w; struct window *w;
int startpos; EMACS_INT startpos;
int top, new_top; int top, new_top;
if (NILP (window)) if (NILP (window))
...@@ -3629,7 +3629,7 @@ selected window before each command. */) ...@@ -3629,7 +3629,7 @@ selected window before each command. */)
redisplay_window has altered point after scrolling, redisplay_window has altered point after scrolling,
because it makes the change only in the window. */ because it makes the change only in the window. */
{ {
register int new_point = marker_position (w->pointm); register EMACS_INT new_point = marker_position (w->pointm);
if (new_point < BEGV) if (new_point < BEGV)
SET_PT (BEGV); SET_PT (BEGV);
else if (new_point > ZV) else if (new_point > ZV)
...@@ -4848,7 +4848,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) ...@@ -4848,7 +4848,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
/* Maybe modify window start instead of scrolling. */ /* Maybe modify window start instead of scrolling. */
if (rbot > 0 || w->vscroll < 0) if (rbot > 0 || w->vscroll < 0)
{ {
int spos; EMACS_INT spos;
Fset_window_vscroll (window, make_number (0), Qt); Fset_window_vscroll (window, make_number (0), Qt);
/* If there are other text lines above the current row, /* If there are other text lines above the current row,
...@@ -4902,7 +4902,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) ...@@ -4902,7 +4902,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
start_display (&it, w, start); start_display (&it, w, start);
if (whole) if (whole)
{ {
int start_pos = IT_CHARPOS (it); EMACS_INT start_pos = IT_CHARPOS (it);
int dy = WINDOW_FRAME_LINE_HEIGHT (w); int dy = WINDOW_FRAME_LINE_HEIGHT (w);
dy = max ((window_box_height (w) dy = max ((window_box_height (w)
- next_screen_context_lines * dy), - next_screen_context_lines * dy),
...@@ -4981,8 +4981,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) ...@@ -4981,8 +4981,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
if (! vscrolled) if (! vscrolled)
{ {
int pos = IT_CHARPOS (it); EMACS_INT pos = IT_CHARPOS (it);
int bytepos; EMACS_INT bytepos;
/* If in the middle of a multi-glyph character move forward to /* If in the middle of a multi-glyph character move forward to
the next character. */ the next character. */
...@@ -5052,7 +5052,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) ...@@ -5052,7 +5052,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
} }
else if (n < 0) else if (n < 0)
{ {
int charpos, bytepos; EMACS_INT charpos, bytepos;
int partial_p; int partial_p;
/* Save our position, for the /* Save our position, for the
...@@ -5122,13 +5122,13 @@ static void ...@@ -5122,13 +5122,13 @@ static void
window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
{ {
register struct window *w = XWINDOW (window); register struct window *w = XWINDOW (window);
register int opoint = PT, opoint_byte = PT_BYTE; register EMACS_INT opoint = PT, opoint_byte = PT_BYTE;
register int pos, pos_byte; register EMACS_INT pos, pos_byte;
register int ht = window_internal_height (w); register int ht = window_internal_height (w);
register Lisp_Object tem; register Lisp_Object tem;
int lose; int lose;
Lisp_Object bolp; Lisp_Object bolp;
int startpos; EMACS_INT startpos;
Lisp_Object original_pos = Qnil; Lisp_Object original_pos = Qnil;
/* If scrolling screen-fulls, compute the number of lines to /* If scrolling screen-fulls, compute the number of lines to
...@@ -5573,7 +5573,7 @@ and redisplay normally--don't erase and redraw the frame. */) ...@@ -5573,7 +5573,7 @@ and redisplay normally--don't erase and redraw the frame. */)
struct buffer *buf = XBUFFER (w->buffer); struct buffer *buf = XBUFFER (w->buffer);
struct buffer *obuf = current_buffer; struct buffer *obuf = current_buffer;
int center_p = 0; int center_p = 0;
int charpos, bytepos; EMACS_INT charpos, bytepos;
int iarg; int iarg;
int this_scroll_margin; int this_scroll_margin;
...@@ -5914,7 +5914,7 @@ the return value is nil. Otherwise the value is t. */) ...@@ -5914,7 +5914,7 @@ the return value is nil. Otherwise the value is t. */)
Lisp_Object new_current_buffer; Lisp_Object new_current_buffer;
Lisp_Object frame; Lisp_Object frame;
FRAME_PTR f; FRAME_PTR f;
int old_point = -1; EMACS_INT old_point = -1;
CHECK_WINDOW_CONFIGURATION (configuration); CHECK_WINDOW_CONFIGURATION (configuration);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment