From: Paul Eggert Date: Wed, 21 Sep 2011 20:20:36 +0000 (-0700) Subject: * lread.c (read_filtered_event): Use duration_to_sec_usec. X-Git-Tag: emacs-24.2.90~471^2~6^2~203 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1ab7b8ac177e323b0c82b9ccdb42ba47229f4e9e;p=emacs.git * lread.c (read_filtered_event): Use duration_to_sec_usec. --- diff --git a/src/ChangeLog b/src/ChangeLog index cc0918e6030..f67d1b72bf2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -459,6 +459,8 @@ (openp): Check for out-of-range argument to 'access'. (read1): Use int, not EMACS_INT, where int is wide enough. Don't assume fixnum fits into int. + (read_filtered_event): Use duration_to_sec_usec + to do proper overflow checking on durations. * macros.c (Fstart_kbd_macro): Use xpalloc to check for overflow in size calculation. (Fexecute_kbd_macro): diff --git a/src/lread.c b/src/lread.c index 7b3e0df5e8a..e427688fdc7 100644 --- a/src/lread.c +++ b/src/lread.c @@ -608,8 +608,11 @@ read_filtered_event (int no_switch_frame, int ascii_required, int sec, usec; double duration = extract_float (seconds); - sec = (int) duration; - usec = (duration - sec) * 1000000; + if (0 < duration) + duration_to_sec_usec (duration, &sec, &usec); + else + sec = usec = 0; + EMACS_GET_TIME (end_time); EMACS_SET_SECS_USECS (wait_time, sec, usec); EMACS_ADD_TIME (end_time, end_time, wait_time);