diff options
| author | Eli Zaretskii | 2010-09-25 09:21:20 -0400 |
|---|---|---|
| committer | Eli Zaretskii | 2010-09-25 09:21:20 -0400 |
| commit | 2452438f0cc613f65a944d7043fa6abe32ec17a0 (patch) | |
| tree | fa732a5082977a0d909cc057c5ac630671ae247e /src/textprop.c | |
| parent | e70153eb2fec2f9af9089feb98739b8f9385250d (diff) | |
| download | emacs-2452438f0cc613f65a944d7043fa6abe32ec17a0.tar.gz emacs-2452438f0cc613f65a944d7043fa6abe32ec17a0.zip | |
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.
Diffstat (limited to 'src/textprop.c')
| -rw-r--r-- | src/textprop.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/src/textprop.c b/src/textprop.c index 0e398e41e4a..88e869b13e9 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -125,7 +125,7 @@ INTERVAL | |||
| 125 | validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *end, int force) | 125 | validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *end, int force) |
| 126 | { | 126 | { |
| 127 | register INTERVAL i; | 127 | register INTERVAL i; |
| 128 | int searchpos; | 128 | EMACS_INT searchpos; |
| 129 | 129 | ||
| 130 | CHECK_STRING_OR_BUFFER (object); | 130 | CHECK_STRING_OR_BUFFER (object); |
| 131 | CHECK_NUMBER_COERCE_MARKER (*begin); | 131 | CHECK_NUMBER_COERCE_MARKER (*begin); |
| @@ -161,7 +161,7 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en | |||
| 161 | } | 161 | } |
| 162 | else | 162 | else |
| 163 | { | 163 | { |
| 164 | int len = SCHARS (object); | 164 | EMACS_INT len = SCHARS (object); |
| 165 | 165 | ||
| 166 | if (! (0 <= XINT (*begin) && XINT (*begin) <= XINT (*end) | 166 | if (! (0 <= XINT (*begin) && XINT (*begin) <= XINT (*end) |
| 167 | && XINT (*end) <= len)) | 167 | && XINT (*end) <= len)) |
| @@ -519,7 +519,7 @@ INTERVAL | |||
| 519 | interval_of (int position, Lisp_Object object) | 519 | interval_of (int position, Lisp_Object object) |
| 520 | { | 520 | { |
| 521 | register INTERVAL i; | 521 | register INTERVAL i; |
| 522 | int beg, end; | 522 | EMACS_INT beg, end; |
| 523 | 523 | ||
| 524 | if (NILP (object)) | 524 | if (NILP (object)) |
| 525 | XSETBUFFER (object, current_buffer); | 525 | XSETBUFFER (object, current_buffer); |
| @@ -984,7 +984,7 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | |||
| 984 | /* Return 1 if there's a change in some property between BEG and END. */ | 984 | /* Return 1 if there's a change in some property between BEG and END. */ |
| 985 | 985 | ||
| 986 | int | 986 | int |
| 987 | property_change_between_p (int beg, int end) | 987 | property_change_between_p (EMACS_INT beg, EMACS_INT end) |
| 988 | { | 988 | { |
| 989 | register INTERVAL i, next; | 989 | register INTERVAL i, next; |
| 990 | Lisp_Object object, pos; | 990 | Lisp_Object object, pos; |
| @@ -1173,7 +1173,8 @@ Return t if any property value actually changed, nil otherwise. */) | |||
| 1173 | (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) | 1173 | (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) |
| 1174 | { | 1174 | { |
| 1175 | register INTERVAL i, unchanged; | 1175 | register INTERVAL i, unchanged; |
| 1176 | register int s, len, modified = 0; | 1176 | register EMACS_INT s, len; |
| 1177 | register int modified = 0; | ||
| 1177 | struct gcpro gcpro1; | 1178 | struct gcpro gcpro1; |
| 1178 | 1179 | ||
| 1179 | properties = validate_plist (properties); | 1180 | properties = validate_plist (properties); |
| @@ -1202,7 +1203,7 @@ Return t if any property value actually changed, nil otherwise. */) | |||
| 1202 | skip it. */ | 1203 | skip it. */ |
| 1203 | if (interval_has_all_properties (properties, i)) | 1204 | if (interval_has_all_properties (properties, i)) |
| 1204 | { | 1205 | { |
| 1205 | int got = (LENGTH (i) - (s - i->position)); | 1206 | EMACS_INT got = (LENGTH (i) - (s - i->position)); |
| 1206 | if (got >= len) | 1207 | if (got >= len) |
| 1207 | RETURN_UNGCPRO (Qnil); | 1208 | RETURN_UNGCPRO (Qnil); |
| 1208 | len -= got; | 1209 | len -= got; |
| @@ -1377,7 +1378,7 @@ void | |||
| 1377 | set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object buffer, INTERVAL i) | 1378 | set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object buffer, INTERVAL i) |
| 1378 | { | 1379 | { |
| 1379 | register INTERVAL prev_changed = NULL_INTERVAL; | 1380 | register INTERVAL prev_changed = NULL_INTERVAL; |
| 1380 | register int s, len; | 1381 | register EMACS_INT s, len; |
| 1381 | INTERVAL unchanged; | 1382 | INTERVAL unchanged; |
| 1382 | 1383 | ||
| 1383 | s = XINT (start); | 1384 | s = XINT (start); |
| @@ -1466,7 +1467,8 @@ Use `set-text-properties' if you want to remove all text properties. */) | |||
| 1466 | (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) | 1467 | (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) |
| 1467 | { | 1468 | { |
| 1468 | register INTERVAL i, unchanged; | 1469 | register INTERVAL i, unchanged; |
| 1469 | register int s, len, modified = 0; | 1470 | register EMACS_INT s, len; |
| 1471 | register int modified = 0; | ||
| 1470 | 1472 | ||
| 1471 | if (NILP (object)) | 1473 | if (NILP (object)) |
| 1472 | XSETBUFFER (object, current_buffer); | 1474 | XSETBUFFER (object, current_buffer); |
| @@ -1484,7 +1486,7 @@ Use `set-text-properties' if you want to remove all text properties. */) | |||
| 1484 | it covers the entire region. */ | 1486 | it covers the entire region. */ |
| 1485 | if (! interval_has_some_properties (properties, i)) | 1487 | if (! interval_has_some_properties (properties, i)) |
| 1486 | { | 1488 | { |
| 1487 | int got = (LENGTH (i) - (s - i->position)); | 1489 | EMACS_INT got = (LENGTH (i) - (s - i->position)); |
| 1488 | if (got >= len) | 1490 | if (got >= len) |
| 1489 | return Qnil; | 1491 | return Qnil; |
| 1490 | len -= got; | 1492 | len -= got; |
| @@ -1551,7 +1553,8 @@ Return t if any property was actually removed, nil otherwise. */) | |||
| 1551 | (Lisp_Object start, Lisp_Object end, Lisp_Object list_of_properties, Lisp_Object object) | 1553 | (Lisp_Object start, Lisp_Object end, Lisp_Object list_of_properties, Lisp_Object object) |
| 1552 | { | 1554 | { |
| 1553 | register INTERVAL i, unchanged; | 1555 | register INTERVAL i, unchanged; |
| 1554 | register int s, len, modified = 0; | 1556 | register EMACS_INT s, len; |
| 1557 | register int modified = 0; | ||
| 1555 | Lisp_Object properties; | 1558 | Lisp_Object properties; |
| 1556 | properties = list_of_properties; | 1559 | properties = list_of_properties; |
| 1557 | 1560 | ||
| @@ -1571,7 +1574,7 @@ Return t if any property was actually removed, nil otherwise. */) | |||
| 1571 | it covers the entire region. */ | 1574 | it covers the entire region. */ |
| 1572 | if (! interval_has_some_properties_list (properties, i)) | 1575 | if (! interval_has_some_properties_list (properties, i)) |
| 1573 | { | 1576 | { |
| 1574 | int got = (LENGTH (i) - (s - i->position)); | 1577 | EMACS_INT got = (LENGTH (i) - (s - i->position)); |
| 1575 | if (got >= len) | 1578 | if (got >= len) |
| 1576 | return Qnil; | 1579 | return Qnil; |
| 1577 | len -= got; | 1580 | len -= got; |
| @@ -1658,7 +1661,7 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */ | |||
| 1658 | (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) | 1661 | (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) |
| 1659 | { | 1662 | { |
| 1660 | register INTERVAL i; | 1663 | register INTERVAL i; |
| 1661 | register int e, pos; | 1664 | register EMACS_INT e, pos; |
| 1662 | 1665 | ||
| 1663 | if (NILP (object)) | 1666 | if (NILP (object)) |
| 1664 | XSETBUFFER (object, current_buffer); | 1667 | XSETBUFFER (object, current_buffer); |
| @@ -1694,7 +1697,7 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */ | |||
| 1694 | (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) | 1697 | (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) |
| 1695 | { | 1698 | { |
| 1696 | register INTERVAL i; | 1699 | register INTERVAL i; |
| 1697 | register int s, e; | 1700 | register EMACS_INT s, e; |
| 1698 | 1701 | ||
| 1699 | if (NILP (object)) | 1702 | if (NILP (object)) |
| 1700 | XSETBUFFER (object, current_buffer); | 1703 | XSETBUFFER (object, current_buffer); |
| @@ -1806,7 +1809,8 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_ | |||
| 1806 | Lisp_Object res; | 1809 | Lisp_Object res; |
| 1807 | Lisp_Object stuff; | 1810 | Lisp_Object stuff; |
| 1808 | Lisp_Object plist; | 1811 | Lisp_Object plist; |
| 1809 | int s, e, e2, p, len, modified = 0; | 1812 | EMACS_INT s, e, e2, p, len; |
| 1813 | int modified = 0; | ||
| 1810 | struct gcpro gcpro1, gcpro2; | 1814 | struct gcpro gcpro1, gcpro2; |
| 1811 | 1815 | ||
| 1812 | i = validate_interval_range (src, &start, &end, soft); | 1816 | 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 | i = validate_interval_range (object, &start, &end, soft); | 1906 | i = validate_interval_range (object, &start, &end, soft); |
| 1903 | if (!NULL_INTERVAL_P (i)) | 1907 | if (!NULL_INTERVAL_P (i)) |
| 1904 | { | 1908 | { |
| 1905 | int s = XINT (start); | 1909 | EMACS_INT s = XINT (start); |
| 1906 | int e = XINT (end); | 1910 | EMACS_INT e = XINT (end); |
| 1907 | 1911 | ||
| 1908 | while (s < e) | 1912 | while (s < e) |
| 1909 | { | 1913 | { |
| 1910 | int interval_end, len; | 1914 | EMACS_INT interval_end, len; |
| 1911 | Lisp_Object plist; | 1915 | Lisp_Object plist; |
| 1912 | 1916 | ||
| 1913 | interval_end = i->position + LENGTH (i); | 1917 | interval_end = i->position + LENGTH (i); |
| @@ -1985,7 +1989,7 @@ Lisp_Object | |||
| 1985 | extend_property_ranges (Lisp_Object list, Lisp_Object new_end) | 1989 | extend_property_ranges (Lisp_Object list, Lisp_Object new_end) |
| 1986 | { | 1990 | { |
| 1987 | Lisp_Object prev = Qnil, head = list; | 1991 | Lisp_Object prev = Qnil, head = list; |
| 1988 | int max = XINT (new_end); | 1992 | EMACS_INT max = XINT (new_end); |
| 1989 | 1993 | ||
| 1990 | for (; CONSP (list); prev = list, list = XCDR (list)) | 1994 | for (; CONSP (list); prev = list, list = XCDR (list)) |
| 1991 | { | 1995 | { |
| @@ -2059,7 +2063,7 @@ verify_interval_modification (struct buffer *buf, int start, int end) | |||
| 2059 | 2063 | ||
| 2060 | if (start > end) | 2064 | if (start > end) |
| 2061 | { | 2065 | { |
| 2062 | int temp = start; | 2066 | EMACS_INT temp = start; |
| 2063 | start = end; | 2067 | start = end; |
| 2064 | end = temp; | 2068 | end = temp; |
| 2065 | } | 2069 | } |