* xterm.c (x_scroll_bar_to_input_event) [!USE_GTK]:
Remove var that is set but not used.
+ (scroll_bar_windows_size): Now size_t, not int.
+ (x_send_scroll_bar_event): Use size_t, not int, for sizes.
+ Check for overflow.
* xfaces.c (realize_named_face): Remove vars that are set but not used.
(map_tty_color) [!defined MSDOS]: Likewise.
x_send_scroll_bar_event and x_scroll_bar_to_input_event. */
static struct window **scroll_bar_windows;
-static int scroll_bar_windows_size;
+static size_t scroll_bar_windows_size;
/* Send a client message with message type Xatom_Scrollbar for a
XClientMessageEvent *ev = (XClientMessageEvent *) &event;
struct window *w = XWINDOW (window);
struct frame *f = XFRAME (w->frame);
- int i;
+ size_t i;
BLOCK_INPUT;
if (i == scroll_bar_windows_size)
{
- int new_size = max (10, 2 * scroll_bar_windows_size);
+ size_t new_size = max (10, 2 * scroll_bar_windows_size);
size_t nbytes = new_size * sizeof *scroll_bar_windows;
size_t old_nbytes = scroll_bar_windows_size * sizeof *scroll_bar_windows;
+ if ((size_t) -1 / sizeof *scroll_bar_windows < new_size)
+ memory_full ();
scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows,
nbytes);
memset (&scroll_bar_windows[i], 0, nbytes - old_nbytes);