aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2010-09-23 21:12:18 +0200
committerLars Magne Ingebrigtsen2010-09-23 21:12:18 +0200
commit0350982fc522fc98d2a9807fd1c27b7de352f6b2 (patch)
treeaeff018fcddc4e7ce133a0d48c02395d875e5f29 /src
parent6e48267a3d22e02ffa51e0c627b841628812f89c (diff)
downloademacs-0350982fc522fc98d2a9807fd1c27b7de352f6b2.tar.gz
emacs-0350982fc522fc98d2a9807fd1c27b7de352f6b2.zip
Fix EMACS_INT/int conversion errors in marker.c.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/lisp.h14
-rw-r--r--src/marker.c62
3 files changed, 49 insertions, 38 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index eb6d82ee92e..199495a6c13 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
12010-09-23 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * lisp.h: Change the definition of all marker.c functions that
4 take and return buffer stuff to be EMACS_INT instead of int.
5
6 * marker.c (buf_charpos_to_bytepos, CONSIDER, set_marker_both)
7 (buf_charpos_to_bytepos, bytepos_to_charpos)
8 (buf_bytepos_to_charpos, Fbuffer_has_markers_at)
9 (set_marker_restricted, set_marker_both): Convert int to EMACS_INT
10 for all buffer positions.
11
12010-09-23 Chong Yidong <cyd@stupidchicken.com> 122010-09-23 Chong Yidong <cyd@stupidchicken.com>
2 13
3 * intervals.c (traverse_intervals, rotate_right, rotate_left) 14 * intervals.c (traverse_intervals, rotate_right, rotate_left)
diff --git a/src/lisp.h b/src/lisp.h
index ee510e8edc9..16c92e9afe5 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3054,17 +3054,17 @@ EXFUN (Fmarker_position, 1);
3054EXFUN (Fmarker_buffer, 1); 3054EXFUN (Fmarker_buffer, 1);
3055EXFUN (Fcopy_marker, 2); 3055EXFUN (Fcopy_marker, 2);
3056EXFUN (Fset_marker, 3); 3056EXFUN (Fset_marker, 3);
3057extern int marker_position (Lisp_Object); 3057extern EMACS_INT marker_position (Lisp_Object);
3058extern int marker_byte_position (Lisp_Object); 3058extern EMACS_INT marker_byte_position (Lisp_Object);
3059extern void clear_charpos_cache (struct buffer *); 3059extern void clear_charpos_cache (struct buffer *);
3060extern int charpos_to_bytepos (int); 3060extern EMACS_INT charpos_to_bytepos (EMACS_INT);
3061extern int buf_charpos_to_bytepos (struct buffer *, int); 3061extern EMACS_INT buf_charpos_to_bytepos (struct buffer *, EMACS_INT);
3062extern int buf_bytepos_to_charpos (struct buffer *, int); 3062extern EMACS_INT buf_bytepos_to_charpos (struct buffer *, EMACS_INT);
3063extern void unchain_marker (struct Lisp_Marker *marker); 3063extern void unchain_marker (struct Lisp_Marker *marker);
3064extern Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object); 3064extern Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object);
3065extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, int, int); 3065extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, EMACS_INT, EMACS_INT);
3066extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object, 3066extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object,
3067 int, int); 3067 EMACS_INT, EMACS_INT);
3068extern void syms_of_marker (void); 3068extern void syms_of_marker (void);
3069 3069
3070/* Defined in fileio.c */ 3070/* Defined in fileio.c */
diff --git a/src/marker.c b/src/marker.c
index b5ea80562df..34d8bc4e65b 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -27,12 +27,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27/* Record one cached position found recently by 27/* Record one cached position found recently by
28 buf_charpos_to_bytepos or buf_bytepos_to_charpos. */ 28 buf_charpos_to_bytepos or buf_bytepos_to_charpos. */
29 29
30static int cached_charpos; 30static EMACS_INT cached_charpos;
31static int cached_bytepos; 31static EMACS_INT cached_bytepos;
32static struct buffer *cached_buffer; 32static struct buffer *cached_buffer;
33static int cached_modiff; 33static int cached_modiff;
34 34
35static void byte_char_debug_check (struct buffer *, int, int); 35static void byte_char_debug_check (struct buffer *, EMACS_INT, EMACS_INT);
36 36
37/* Nonzero means enable debugging checks on byte/char correspondences. */ 37/* Nonzero means enable debugging checks on byte/char correspondences. */
38 38
@@ -60,12 +60,12 @@ clear_charpos_cache (struct buffer *b)
60 60
61#define CONSIDER(CHARPOS, BYTEPOS) \ 61#define CONSIDER(CHARPOS, BYTEPOS) \
62{ \ 62{ \
63 int this_charpos = (CHARPOS); \ 63 EMACS_INT this_charpos = (CHARPOS); \
64 int changed = 0; \ 64 int changed = 0; \
65 \ 65 \
66 if (this_charpos == charpos) \ 66 if (this_charpos == charpos) \
67 { \ 67 { \
68 int value = (BYTEPOS); \ 68 EMACS_INT value = (BYTEPOS); \
69 if (byte_debug_flag) \ 69 if (byte_debug_flag) \
70 byte_char_debug_check (b, charpos, value); \ 70 byte_char_debug_check (b, charpos, value); \
71 return value; \ 71 return value; \
@@ -90,7 +90,7 @@ clear_charpos_cache (struct buffer *b)
90 { \ 90 { \
91 if (best_above - best_below == best_above_byte - best_below_byte) \ 91 if (best_above - best_below == best_above_byte - best_below_byte) \
92 { \ 92 { \
93 int value = best_below_byte + (charpos - best_below); \ 93 EMACS_INT value = best_below_byte + (charpos - best_below); \
94 if (byte_debug_flag) \ 94 if (byte_debug_flag) \
95 byte_char_debug_check (b, charpos, value); \ 95 byte_char_debug_check (b, charpos, value); \
96 return value; \ 96 return value; \
@@ -99,9 +99,9 @@ clear_charpos_cache (struct buffer *b)
99} 99}
100 100
101static void 101static void
102byte_char_debug_check (struct buffer *b, int charpos, int bytepos) 102byte_char_debug_check (struct buffer *b, EMACS_INT charpos, EMACS_INT bytepos)
103{ 103{
104 int nchars = 0; 104 EMACS_INT nchars = 0;
105 105
106 if (bytepos > BUF_GPT_BYTE (b)) 106 if (bytepos > BUF_GPT_BYTE (b))
107 { 107 {
@@ -118,18 +118,18 @@ byte_char_debug_check (struct buffer *b, int charpos, int bytepos)
118 abort (); 118 abort ();
119} 119}
120 120
121int 121EMACS_INT
122charpos_to_bytepos (int charpos) 122charpos_to_bytepos (EMACS_INT charpos)
123{ 123{
124 return buf_charpos_to_bytepos (current_buffer, charpos); 124 return buf_charpos_to_bytepos (current_buffer, charpos);
125} 125}
126 126
127int 127EMACS_INT
128buf_charpos_to_bytepos (struct buffer *b, int charpos) 128buf_charpos_to_bytepos (struct buffer *b, EMACS_INT charpos)
129{ 129{
130 struct Lisp_Marker *tail; 130 struct Lisp_Marker *tail;
131 int best_above, best_above_byte; 131 EMACS_INT best_above, best_above_byte;
132 int best_below, best_below_byte; 132 EMACS_INT best_below, best_below_byte;
133 133
134 if (charpos < BUF_BEG (b) || charpos > BUF_Z (b)) 134 if (charpos < BUF_BEG (b) || charpos > BUF_Z (b))
135 abort (); 135 abort ();
@@ -269,12 +269,12 @@ verify_bytepos (int charpos)
269 269
270#define CONSIDER(BYTEPOS, CHARPOS) \ 270#define CONSIDER(BYTEPOS, CHARPOS) \
271{ \ 271{ \
272 int this_bytepos = (BYTEPOS); \ 272 EMACS_INT this_bytepos = (BYTEPOS); \
273 int changed = 0; \ 273 int changed = 0; \
274 \ 274 \
275 if (this_bytepos == bytepos) \ 275 if (this_bytepos == bytepos) \
276 { \ 276 { \
277 int value = (CHARPOS); \ 277 EMACS_INT value = (CHARPOS); \
278 if (byte_debug_flag) \ 278 if (byte_debug_flag) \
279 byte_char_debug_check (b, value, bytepos); \ 279 byte_char_debug_check (b, value, bytepos); \
280 return value; \ 280 return value; \
@@ -299,7 +299,7 @@ verify_bytepos (int charpos)
299 { \ 299 { \
300 if (best_above - best_below == best_above_byte - best_below_byte) \ 300 if (best_above - best_below == best_above_byte - best_below_byte) \
301 { \ 301 { \
302 int value = best_below + (bytepos - best_below_byte); \ 302 EMACS_INT value = best_below + (bytepos - best_below_byte); \
303 if (byte_debug_flag) \ 303 if (byte_debug_flag) \
304 byte_char_debug_check (b, value, bytepos); \ 304 byte_char_debug_check (b, value, bytepos); \
305 return value; \ 305 return value; \
@@ -307,18 +307,18 @@ verify_bytepos (int charpos)
307 } \ 307 } \
308} 308}
309 309
310int 310EMACS_INT
311bytepos_to_charpos (int bytepos) 311bytepos_to_charpos (EMACS_INT bytepos)
312{ 312{
313 return buf_bytepos_to_charpos (current_buffer, bytepos); 313 return buf_bytepos_to_charpos (current_buffer, bytepos);
314} 314}
315 315
316int 316EMACS_INT
317buf_bytepos_to_charpos (struct buffer *b, int bytepos) 317buf_bytepos_to_charpos (struct buffer *b, EMACS_INT bytepos)
318{ 318{
319 struct Lisp_Marker *tail; 319 struct Lisp_Marker *tail;
320 int best_above, best_above_byte; 320 EMACS_INT best_above, best_above_byte;
321 int best_below, best_below_byte; 321 EMACS_INT best_below, best_below_byte;
322 322
323 if (bytepos < BUF_BEG_BYTE (b) || bytepos > BUF_Z_BYTE (b)) 323 if (bytepos < BUF_BEG_BYTE (b) || bytepos > BUF_Z_BYTE (b))
324 abort (); 324 abort ();
@@ -470,7 +470,7 @@ Then it no longer slows down editing in any buffer.
470Returns MARKER. */) 470Returns MARKER. */)
471 (Lisp_Object marker, Lisp_Object position, Lisp_Object buffer) 471 (Lisp_Object marker, Lisp_Object position, Lisp_Object buffer)
472{ 472{
473 register int charno, bytepos; 473 register EMACS_INT charno, bytepos;
474 register struct buffer *b; 474 register struct buffer *b;
475 register struct Lisp_Marker *m; 475 register struct Lisp_Marker *m;
476 476
@@ -545,7 +545,7 @@ Returns MARKER. */)
545Lisp_Object 545Lisp_Object
546set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer) 546set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer)
547{ 547{
548 register int charno, bytepos; 548 register EMACS_INT charno, bytepos;
549 register struct buffer *b; 549 register struct buffer *b;
550 register struct Lisp_Marker *m; 550 register struct Lisp_Marker *m;
551 551
@@ -618,7 +618,7 @@ set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer)
618 character position and the corresponding byte position. */ 618 character position and the corresponding byte position. */
619 619
620Lisp_Object 620Lisp_Object
621set_marker_both (Lisp_Object marker, Lisp_Object buffer, int charpos, int bytepos) 621set_marker_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT charpos, EMACS_INT bytepos)
622{ 622{
623 register struct buffer *b; 623 register struct buffer *b;
624 register struct Lisp_Marker *m; 624 register struct Lisp_Marker *m;
@@ -666,7 +666,7 @@ set_marker_both (Lisp_Object marker, Lisp_Object buffer, int charpos, int bytepo
666 be outside the visible part. */ 666 be outside the visible part. */
667 667
668Lisp_Object 668Lisp_Object
669set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, int charpos, int bytepos) 669set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT charpos, EMACS_INT bytepos)
670{ 670{
671 register struct buffer *b; 671 register struct buffer *b;
672 register struct Lisp_Marker *m; 672 register struct Lisp_Marker *m;
@@ -776,7 +776,7 @@ unchain_marker (register struct Lisp_Marker *marker)
776 776
777/* Return the char position of marker MARKER, as a C integer. */ 777/* Return the char position of marker MARKER, as a C integer. */
778 778
779int 779EMACS_INT
780marker_position (Lisp_Object marker) 780marker_position (Lisp_Object marker)
781{ 781{
782 register struct Lisp_Marker *m = XMARKER (marker); 782 register struct Lisp_Marker *m = XMARKER (marker);
@@ -790,12 +790,12 @@ marker_position (Lisp_Object marker)
790 790
791/* Return the byte position of marker MARKER, as a C integer. */ 791/* Return the byte position of marker MARKER, as a C integer. */
792 792
793int 793EMACS_INT
794marker_byte_position (Lisp_Object marker) 794marker_byte_position (Lisp_Object marker)
795{ 795{
796 register struct Lisp_Marker *m = XMARKER (marker); 796 register struct Lisp_Marker *m = XMARKER (marker);
797 register struct buffer *buf = m->buffer; 797 register struct buffer *buf = m->buffer;
798 register int i = m->bytepos; 798 register EMACS_INT i = m->bytepos;
799 799
800 if (!buf) 800 if (!buf)
801 error ("Marker does not point anywhere"); 801 error ("Marker does not point anywhere");
@@ -856,7 +856,7 @@ DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, Sbuffer_has_markers_at,
856 (Lisp_Object position) 856 (Lisp_Object position)
857{ 857{
858 register struct Lisp_Marker *tail; 858 register struct Lisp_Marker *tail;
859 register int charno; 859 register EMACS_INT charno;
860 860
861 charno = XINT (position); 861 charno = XINT (position);
862 862