diff options
| author | Paul Eggert | 2012-05-25 13:30:19 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-05-25 13:30:19 -0700 |
| commit | 024811862b8929f91fcaac280eaac8dd8719e7e1 (patch) | |
| tree | 48b2ecd7061fe3963ce5773d4e2307e8496c981a /src | |
| parent | 23d10a2703c40fc6676a74a249f266942627225e (diff) | |
| download | emacs-024811862b8929f91fcaac280eaac8dd8719e7e1.tar.gz emacs-024811862b8929f91fcaac280eaac8dd8719e7e1.zip | |
* src/buffer.c (Fmove_overflay): Clip instead of trying to fix bug 9642.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/buffer.c | 25 |
2 files changed, 16 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 611e095daa9..cd058207ed8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,8 +1,6 @@ | |||
| 1 | 2012-05-25 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2012-05-25 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Fix integer width and related bugs (Bug#9874). | 3 | Fix integer width and related bugs (Bug#9874). |
| 4 | * process.h (struct Lisp_Process): Members tick and update_tick | ||
| 5 | are now of type EMACS_INT, not int. | ||
| 6 | * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp): | 4 | * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp): |
| 7 | (allocate_vectorlike, buffer_memory_full, struct sdata, SDATA_SIZE) | 5 | (allocate_vectorlike, buffer_memory_full, struct sdata, SDATA_SIZE) |
| 8 | (string_bytes, check_sblock, allocate_string_data): | 6 | (string_bytes, check_sblock, allocate_string_data): |
| @@ -46,6 +44,7 @@ | |||
| 46 | (Foverlays_at, Fnext_overlay_change, Fprevious_overlay_change): | 44 | (Foverlays_at, Fnext_overlay_change, Fprevious_overlay_change): |
| 47 | Omit pointer cast, which isn't needed anyway, and doesn't work | 45 | Omit pointer cast, which isn't needed anyway, and doesn't work |
| 48 | after the EMACS_INT -> ptrdiff_t change. | 46 | after the EMACS_INT -> ptrdiff_t change. |
| 47 | (Fmove_overlay): Clip BEG and END to ptrdiff_t to avoid overflow. | ||
| 49 | * buffer.h: Adjust decls to match defn changes elsewhere. | 48 | * buffer.h: Adjust decls to match defn changes elsewhere. |
| 50 | (struct buffer_text, struct buffer): | 49 | (struct buffer_text, struct buffer): |
| 51 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | 50 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. |
| @@ -587,6 +586,8 @@ | |||
| 587 | overflow checking on durations. | 586 | overflow checking on durations. |
| 588 | (emacs_get_tty_pgrp, Fprocess_running_child_p, process_send_signal): | 587 | (emacs_get_tty_pgrp, Fprocess_running_child_p, process_send_signal): |
| 589 | Don't assume pid_t fits in int. | 588 | Don't assume pid_t fits in int. |
| 589 | * process.h (struct Lisp_Process): Members tick and update_tick | ||
| 590 | are now of type EMACS_INT, not int. | ||
| 590 | * puresize.h (PURESIZE_RATIO): Shrink this to 8/6 on 32-bit hosts | 591 | * puresize.h (PURESIZE_RATIO): Shrink this to 8/6 on 32-bit hosts |
| 591 | configured --with-wide-int. | 592 | configured --with-wide-int. |
| 592 | * scroll.c (calculate_scrolling, calculate_direct_scrolling) | 593 | * scroll.c (calculate_scrolling, calculate_direct_scrolling) |
diff --git a/src/buffer.c b/src/buffer.c index dbaa9f0cc82..5d431f21a70 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -3697,21 +3697,18 @@ buffer. */) | |||
| 3697 | 3697 | ||
| 3698 | CHECK_NUMBER_COERCE_MARKER (beg); | 3698 | CHECK_NUMBER_COERCE_MARKER (beg); |
| 3699 | CHECK_NUMBER_COERCE_MARKER (end); | 3699 | CHECK_NUMBER_COERCE_MARKER (end); |
| 3700 | 3700 | n_beg = clip_to_bounds (PTRDIFF_MIN, XINT (beg), PTRDIFF_MAX); | |
| 3701 | if (XINT (beg) > XINT (end)) | 3701 | n_end = clip_to_bounds (PTRDIFF_MIN, XINT (end), PTRDIFF_MAX); |
| 3702 | { | ||
| 3703 | Lisp_Object temp; | ||
| 3704 | temp = beg; beg = end; end = temp; | ||
| 3705 | } | ||
| 3706 | |||
| 3707 | Fset_marker (OVERLAY_START (overlay), beg, buffer); | ||
| 3708 | Fset_marker (OVERLAY_END (overlay), end, buffer); | ||
| 3709 | n_beg = marker_position (OVERLAY_START (overlay)); | ||
| 3710 | n_end = marker_position (OVERLAY_END (overlay)); | ||
| 3711 | 3702 | ||
| 3712 | if (n_beg == n_end && ! NILP (Foverlay_get (overlay, Qevaporate))) | 3703 | if (n_beg == n_end && ! NILP (Foverlay_get (overlay, Qevaporate))) |
| 3713 | return Fdelete_overlay (overlay); | 3704 | return Fdelete_overlay (overlay); |
| 3714 | 3705 | ||
| 3706 | if (n_beg > n_end) | ||
| 3707 | { | ||
| 3708 | ptrdiff_t temp; | ||
| 3709 | temp = n_beg; n_beg = n_end; n_end = temp; | ||
| 3710 | } | ||
| 3711 | |||
| 3715 | specbind (Qinhibit_quit, Qt); | 3712 | specbind (Qinhibit_quit, Qt); |
| 3716 | 3713 | ||
| 3717 | obuffer = Fmarker_buffer (OVERLAY_START (overlay)); | 3714 | obuffer = Fmarker_buffer (OVERLAY_START (overlay)); |
| @@ -3761,8 +3758,12 @@ buffer. */) | |||
| 3761 | eassert (XOVERLAY (overlay)->next == NULL); | 3758 | eassert (XOVERLAY (overlay)->next == NULL); |
| 3762 | } | 3759 | } |
| 3763 | 3760 | ||
| 3761 | Fset_marker (OVERLAY_START (overlay), beg, buffer); | ||
| 3762 | Fset_marker (OVERLAY_END (overlay), end, buffer); | ||
| 3763 | |||
| 3764 | /* Put the overlay on the wrong list. */ | 3764 | /* Put the overlay on the wrong list. */ |
| 3765 | if (n_end < b->overlay_center) | 3765 | end = OVERLAY_END (overlay); |
| 3766 | if (OVERLAY_POSITION (end) < b->overlay_center) | ||
| 3766 | { | 3767 | { |
| 3767 | XOVERLAY (overlay)->next = b->overlays_after; | 3768 | XOVERLAY (overlay)->next = b->overlays_after; |
| 3768 | b->overlays_after = XOVERLAY (overlay); | 3769 | b->overlays_after = XOVERLAY (overlay); |