diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 17 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d491d089514..a9f3e3a5b70 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2011-03-22 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-03-22 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * xdisp.c (message_log_check_duplicate): Return unsigned long, not int. | ||
| 4 | This is less likely to overflow, and avoids undefined behavior if | ||
| 5 | overflow does occur. All callers changed. Use strtoul to scan | ||
| 6 | for the unsigned long integer. | ||
| 7 | |||
| 3 | * scroll.c (do_scrolling): Work around GCC bug 48228. | 8 | * scroll.c (do_scrolling): Work around GCC bug 48228. |
| 4 | See <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48228>. | 9 | See <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48228>. |
| 5 | 10 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index a7955f41e0c..93bc8c9479e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -802,8 +802,8 @@ static int cursor_row_fully_visible_p (struct window *, int, int); | |||
| 802 | static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int); | 802 | static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int); |
| 803 | static int try_cursor_movement (Lisp_Object, struct text_pos, int *); | 803 | static int try_cursor_movement (Lisp_Object, struct text_pos, int *); |
| 804 | static int trailing_whitespace_p (EMACS_INT); | 804 | static int trailing_whitespace_p (EMACS_INT); |
| 805 | static int message_log_check_duplicate (EMACS_INT, EMACS_INT, | 805 | static unsigned long int message_log_check_duplicate (EMACS_INT, EMACS_INT, |
| 806 | EMACS_INT, EMACS_INT); | 806 | EMACS_INT, EMACS_INT); |
| 807 | static void push_it (struct it *); | 807 | static void push_it (struct it *); |
| 808 | static void pop_it (struct it *); | 808 | static void pop_it (struct it *); |
| 809 | static void sync_frame_with_window_matrix_rows (struct window *); | 809 | static void sync_frame_with_window_matrix_rows (struct window *); |
| @@ -7973,7 +7973,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | |||
| 7973 | if (nlflag) | 7973 | if (nlflag) |
| 7974 | { | 7974 | { |
| 7975 | EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte; | 7975 | EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte; |
| 7976 | int dups; | 7976 | unsigned long int dups; |
| 7977 | insert_1 ("\n", 1, 1, 0, 0); | 7977 | insert_1 ("\n", 1, 1, 0, 0); |
| 7978 | 7978 | ||
| 7979 | scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); | 7979 | scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); |
| @@ -8001,7 +8001,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | |||
| 8001 | 8001 | ||
| 8002 | /* If you change this format, don't forget to also | 8002 | /* If you change this format, don't forget to also |
| 8003 | change message_log_check_duplicate. */ | 8003 | change message_log_check_duplicate. */ |
| 8004 | sprintf (dupstr, " [%d times]", dups); | 8004 | sprintf (dupstr, " [%lu times]", dups); |
| 8005 | duplen = strlen (dupstr); | 8005 | duplen = strlen (dupstr); |
| 8006 | TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); | 8006 | TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); |
| 8007 | insert_1 (dupstr, duplen, 1, 0, 1); | 8007 | insert_1 (dupstr, duplen, 1, 0, 1); |
| @@ -8063,7 +8063,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | |||
| 8063 | Return 0 if different, 1 if the new one should just replace it, or a | 8063 | Return 0 if different, 1 if the new one should just replace it, or a |
| 8064 | value N > 1 if we should also append " [N times]". */ | 8064 | value N > 1 if we should also append " [N times]". */ |
| 8065 | 8065 | ||
| 8066 | static int | 8066 | static unsigned long int |
| 8067 | message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte, | 8067 | message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte, |
| 8068 | EMACS_INT this_bol, EMACS_INT this_bol_byte) | 8068 | EMACS_INT this_bol, EMACS_INT this_bol_byte) |
| 8069 | { | 8069 | { |
| @@ -8085,10 +8085,9 @@ message_log_check_duplicate (EMACS_INT prev_bol, EMACS_INT prev_bol_byte, | |||
| 8085 | return 2; | 8085 | return 2; |
| 8086 | if (*p1++ == ' ' && *p1++ == '[') | 8086 | if (*p1++ == ' ' && *p1++ == '[') |
| 8087 | { | 8087 | { |
| 8088 | int n = 0; | 8088 | char *pend; |
| 8089 | while (*p1 >= '0' && *p1 <= '9') | 8089 | unsigned long int n = strtoul ((char *) p1, &pend, 10); |
| 8090 | n = n * 10 + *p1++ - '0'; | 8090 | if (strncmp (pend, " times]\n", 8) == 0) |
| 8091 | if (strncmp ((char *) p1, " times]\n", 8) == 0) | ||
| 8092 | return n+1; | 8091 | return n+1; |
| 8093 | } | 8092 | } |
| 8094 | return 0; | 8093 | return 0; |