From: Eli Zaretskii Date: Sat, 23 Jun 2012 19:40:50 +0000 (+0300) Subject: Avoid compiler warnings in comparing time_t. X-Git-Tag: emacs-24.2.90~1199^2~374 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b82c175521ddd7d7ae8183c62fc87587b8b615e5;p=emacs.git Avoid compiler warnings in comparing time_t. src/dispnew.c (sit_for, Fsleep_for): src/keyboard.c (kbd_buffer_get_event): src/process.c (Faccept_process_output): Avoid compiler warnings when comparing a 32-bit time_t with a 64-bit INTMAX_MAX. --- diff --git a/src/ChangeLog b/src/ChangeLog index d0b6f145227..40073d32834 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-06-23 Eli Zaretskii + + * dispnew.c (sit_for, Fsleep_for): + * keyboard.c (kbd_buffer_get_event): + * process.c (Faccept_process_output): Avoid compiler warnings when + comparing a 32-bit time_t with a 64-bit INTMAX_MAX. + 2012-06-23 Juanma Barranquero * makefile.w32-in: Update dependencies. diff --git a/src/dispnew.c b/src/dispnew.c index 5582607ff6a..e18fca6f122 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5957,7 +5957,9 @@ additional wait period, in milliseconds; this is for backwards compatibility. if (0 < duration) { EMACS_TIME t = EMACS_TIME_FROM_DOUBLE (duration); - wait_reading_process_output (min (EMACS_SECS (t), INTMAX_MAX), + intmax_t secs = EMACS_SECS (t); + + wait_reading_process_output (min (secs, INTMAX_MAX), EMACS_NSECS (t), 0, 0, Qnil, NULL, 0); } @@ -6005,7 +6007,8 @@ sit_for (Lisp_Object timeout, int reading, int do_display) else { EMACS_TIME t = EMACS_TIME_FROM_DOUBLE (seconds); - sec = min (EMACS_SECS (t), INTMAX_MAX); + sec = EMACS_SECS (t); + sec = min (sec, INTMAX_MAX); nsec = EMACS_NSECS (t); } } diff --git a/src/keyboard.c b/src/keyboard.c index 0e8d22c2b1c..38b05c22063 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -3857,9 +3857,11 @@ kbd_buffer_get_event (KBOARD **kbp, return Qnil; /* finished waiting */ else { + intmax_t secs; + EMACS_SUB_TIME (duration, *end_time, duration); - wait_reading_process_output (min (EMACS_SECS (duration), - INTMAX_MAX), + secs = EMACS_SECS (duration); + wait_reading_process_output (min (secs, INTMAX_MAX), EMACS_NSECS (duration), -1, 1, Qnil, NULL, 0); } diff --git a/src/process.c b/src/process.c index 0ee0e499d6e..b41a77f58fd 100644 --- a/src/process.c +++ b/src/process.c @@ -3996,7 +3996,9 @@ Return non-nil if we received any output before the timeout expired. */) if (0 < XFLOAT_DATA (seconds)) { EMACS_TIME t = EMACS_TIME_FROM_DOUBLE (XFLOAT_DATA (seconds)); - secs = min (EMACS_SECS (t), INTMAX_MAX); + + secs = EMACS_SECS (t); + secs = min (secs, INTMAX_MAX); nsecs = EMACS_NSECS (t); } }