Avoid signed integer overflow when converting Time to ptrdiff_t.
commit203a9eb0ec0e1f28958df5fa1a49c5a7e3f4cae8
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 24 Sep 2014 20:30:28 +0000 (24 13:30 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 24 Sep 2014 20:30:28 +0000 (24 13:30 -0700)
tree52781d0a379ff1927d2461265bd0b94f68254454
parent0e176389a723f7eec072af62cde12314de7f70e2
Avoid signed integer overflow when converting Time to ptrdiff_t.

* keyboard.c (INPUT_EVENT_POS_MAX, INPUT_EVENT_POS_MIN):
New macros.
(position_to_Time, Time_to_position): New functions.
(gen_help_event, kbd_buffer_get_event): Use them.
* systime.h (Time) [emacs && !HAVE_X_WINDOWS]:
Go back to plain 'unsigned long', so that 'Time' is the same
for both X and non-X builds; this is less likely to cause surprise.
* termhooks.h: Remove compile-time check that Time and ptrdiff_t
are the same size; this is no longer required.
src/ChangeLog
src/keyboard.c
src/systime.h
src/termhooks.h