From 0ca064884d1fe5ce273f69ffa14f80caceeb6e88 Mon Sep 17 00:00:00 2001 From: jay Date: Fri, 22 Oct 2004 19:05:19 +0000 Subject: [PATCH] Fix for compilation (on AIX 4.3) with GCC 2.x. --- find/parser.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/find/parser.c b/find/parser.c index 81de72f..c03230e 100644 --- a/find/parser.c +++ b/find/parser.c @@ -1679,14 +1679,21 @@ insert_time (char **argv, int *arg_ptr, PFB pred) t = ( cur_day_start - num_days * DAYSECS + ((c_type == COMP_GT) ? DAYSECS - 1 : 0)); #if 1 - intmax_t val = ( (intmax_t)cur_day_start - num_days * DAYSECS - + ((c_type == COMP_GT) ? DAYSECS - 1 : 0)); - t = val; - - /* Check for possibility of an overflow */ - if ( (intmax_t)t != val ) + if (1) { - error (1, 0, "arithmetic overflow while converting %s days to a number of seconds", argv[*arg_ptr]); + /* We introduce a scope in which 'val' can be declared, for the + * benefit of compilers that are really C89 compilers + * which support intmax_t because config.h #defines it + */ + intmax_t val = ( (intmax_t)cur_day_start - num_days * DAYSECS + + ((c_type == COMP_GT) ? DAYSECS - 1 : 0)); + t = val; + + /* Check for possibility of an overflow */ + if ( (intmax_t)t != val ) + { + error (1, 0, "arithmetic overflow while converting %s days to a number of seconds", argv[*arg_ptr]); + } } #endif -- 2.11.4.GIT