diff options
| author | Chong Yidong | 2008-08-23 02:11:56 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-08-23 02:11:56 +0000 |
| commit | 63007aca6be703bd7446df6d76262269909ba4db (patch) | |
| tree | 66c1671b17d8ed86008ab35e8154f15dcad93ed7 /src | |
| parent | 4b7e0869636a04f8c892dbf51cb55ec7edc07df5 (diff) | |
| download | emacs-63007aca6be703bd7446df6d76262269909ba4db.tar.gz emacs-63007aca6be703bd7446df6d76262269909ba4db.zip | |
(try_scrolling): Check INT_MAX instead of MOST_POSITIVE_FIXNUM for
maximum integer value. Include limits.h to obtain INT_MAX.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index ec3d31a3532..a04e5e95b70 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -167,6 +167,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 167 | 167 | ||
| 168 | #include <config.h> | 168 | #include <config.h> |
| 169 | #include <stdio.h> | 169 | #include <stdio.h> |
| 170 | #include <limits.h> | ||
| 170 | 171 | ||
| 171 | #include "lisp.h" | 172 | #include "lisp.h" |
| 172 | #include "keyboard.h" | 173 | #include "keyboard.h" |
| @@ -12641,6 +12642,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, | |||
| 12641 | int dy = 0, amount_to_scroll = 0, scroll_down_p = 0; | 12642 | int dy = 0, amount_to_scroll = 0, scroll_down_p = 0; |
| 12642 | int extra_scroll_margin_lines = last_line_misfit ? 1 : 0; | 12643 | int extra_scroll_margin_lines = last_line_misfit ? 1 : 0; |
| 12643 | Lisp_Object aggressive; | 12644 | Lisp_Object aggressive; |
| 12645 | int scroll_limit = INT_MAX / FRAME_LINE_HEIGHT (f); | ||
| 12644 | 12646 | ||
| 12645 | #if GLYPH_DEBUG | 12647 | #if GLYPH_DEBUG |
| 12646 | debug_method_add (w, "try_scrolling"); | 12648 | debug_method_add (w, "try_scrolling"); |
| @@ -12658,26 +12660,28 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, | |||
| 12658 | else | 12660 | else |
| 12659 | this_scroll_margin = 0; | 12661 | this_scroll_margin = 0; |
| 12660 | 12662 | ||
| 12661 | /* Force scroll_conservatively to have a reasonable value so it doesn't | 12663 | /* Force scroll_conservatively to have a reasonable value, to avoid |
| 12662 | cause an overflow while computing how much to scroll. */ | 12664 | overflow while computing how much to scroll. Note that it's |
| 12663 | if (scroll_conservatively) | 12665 | fairly common for users to supply scroll-conservatively equal to |
| 12664 | scroll_conservatively = min (scroll_conservatively, | 12666 | `most-positive-fixnum', which can be larger than INT_MAX. */ |
| 12665 | MOST_POSITIVE_FIXNUM / FRAME_LINE_HEIGHT (f)); | 12667 | if (scroll_conservatively > scroll_limit) |
| 12666 | 12668 | { | |
| 12667 | /* Compute how much we should try to scroll maximally to bring point | 12669 | scroll_conservatively = scroll_limit; |
| 12668 | into view. */ | 12670 | scroll_max = INT_MAX; |
| 12669 | if (scroll_step || scroll_conservatively || temp_scroll_step) | 12671 | } |
| 12670 | scroll_max = max (scroll_step, | 12672 | else if (scroll_step || scroll_conservatively || temp_scroll_step) |
| 12671 | max (scroll_conservatively, temp_scroll_step)); | 12673 | /* Compute how much we should try to scroll maximally to bring |
| 12674 | point into view. */ | ||
| 12675 | scroll_max = (max (scroll_step, | ||
| 12676 | max (scroll_conservatively, temp_scroll_step)) | ||
| 12677 | * FRAME_LINE_HEIGHT (f)); | ||
| 12672 | else if (NUMBERP (current_buffer->scroll_down_aggressively) | 12678 | else if (NUMBERP (current_buffer->scroll_down_aggressively) |
| 12673 | || NUMBERP (current_buffer->scroll_up_aggressively)) | 12679 | || NUMBERP (current_buffer->scroll_up_aggressively)) |
| 12674 | /* We're trying to scroll because of aggressive scrolling | 12680 | /* We're trying to scroll because of aggressive scrolling but no |
| 12675 | but no scroll_step is set. Choose an arbitrary one. Maybe | 12681 | scroll_step is set. Choose an arbitrary one. */ |
| 12676 | there should be a variable for this. */ | 12682 | scroll_max = 10 * FRAME_LINE_HEIGHT (f); |
| 12677 | scroll_max = 10; | ||
| 12678 | else | 12683 | else |
| 12679 | scroll_max = 0; | 12684 | scroll_max = 0; |
| 12680 | scroll_max *= FRAME_LINE_HEIGHT (f); | ||
| 12681 | 12685 | ||
| 12682 | too_near_end: | 12686 | too_near_end: |
| 12683 | 12687 | ||