aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-04-01 13:14:03 -0700
committerPaul Eggert2011-04-01 13:14:03 -0700
commit0b918413f336dbfa9a9c266ae857bce103556c57 (patch)
tree3d184b612b0acf8185088284137b200c1d2bb6f2 /src
parent9ae848fc4a017cbb0bfd22ebc5c11c2fe9e232a0 (diff)
downloademacs-0b918413f336dbfa9a9c266ae857bce103556c57.tar.gz
emacs-0b918413f336dbfa9a9c266ae857bce103556c57.zip
* xterm.c (scroll_bar_windows_size): Now size_t, not int.
(x_send_scroll_bar_event): Use size_t, not int, for sizes. Check for overflow.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/xterm.c8
2 files changed, 8 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6a7f35f64f8..99447fd8748 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -2,6 +2,9 @@
2 2
3 * xterm.c (x_scroll_bar_to_input_event) [!USE_GTK]: 3 * xterm.c (x_scroll_bar_to_input_event) [!USE_GTK]:
4 Remove var that is set but not used. 4 Remove var that is set but not used.
5 (scroll_bar_windows_size): Now size_t, not int.
6 (x_send_scroll_bar_event): Use size_t, not int, for sizes.
7 Check for overflow.
5 8
6 * xfaces.c (realize_named_face): Remove vars that are set but not used. 9 * xfaces.c (realize_named_face): Remove vars that are set but not used.
7 (map_tty_color) [!defined MSDOS]: Likewise. 10 (map_tty_color) [!defined MSDOS]: Likewise.
diff --git a/src/xterm.c b/src/xterm.c
index 6bfe503c97e..92df7ae8746 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4165,7 +4165,7 @@ xt_action_hook (Widget widget, XtPointer client_data, String action_name,
4165 x_send_scroll_bar_event and x_scroll_bar_to_input_event. */ 4165 x_send_scroll_bar_event and x_scroll_bar_to_input_event. */
4166 4166
4167static struct window **scroll_bar_windows; 4167static struct window **scroll_bar_windows;
4168static int scroll_bar_windows_size; 4168static size_t scroll_bar_windows_size;
4169 4169
4170 4170
4171/* Send a client message with message type Xatom_Scrollbar for a 4171/* Send a client message with message type Xatom_Scrollbar for a
@@ -4180,7 +4180,7 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole)
4180 XClientMessageEvent *ev = (XClientMessageEvent *) &event; 4180 XClientMessageEvent *ev = (XClientMessageEvent *) &event;
4181 struct window *w = XWINDOW (window); 4181 struct window *w = XWINDOW (window);
4182 struct frame *f = XFRAME (w->frame); 4182 struct frame *f = XFRAME (w->frame);
4183 int i; 4183 size_t i;
4184 4184
4185 BLOCK_INPUT; 4185 BLOCK_INPUT;
4186 4186
@@ -4201,10 +4201,12 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole)
4201 4201
4202 if (i == scroll_bar_windows_size) 4202 if (i == scroll_bar_windows_size)
4203 { 4203 {
4204 int new_size = max (10, 2 * scroll_bar_windows_size); 4204 size_t new_size = max (10, 2 * scroll_bar_windows_size);
4205 size_t nbytes = new_size * sizeof *scroll_bar_windows; 4205 size_t nbytes = new_size * sizeof *scroll_bar_windows;
4206 size_t old_nbytes = scroll_bar_windows_size * sizeof *scroll_bar_windows; 4206 size_t old_nbytes = scroll_bar_windows_size * sizeof *scroll_bar_windows;
4207 4207
4208 if ((size_t) -1 / sizeof *scroll_bar_windows < new_size)
4209 memory_full ();
4208 scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows, 4210 scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows,
4209 nbytes); 4211 nbytes);
4210 memset (&scroll_bar_windows[i], 0, nbytes - old_nbytes); 4212 memset (&scroll_bar_windows[i], 0, nbytes - old_nbytes);