From f7c7e14438315442df818cb0c350e7d88657e1ce Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 19 Jul 2017 20:20:35 -0700 Subject: [PATCH] Casting --- src/core/ext/filters/max_age/max_age_filter.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/ext/filters/max_age/max_age_filter.c b/src/core/ext/filters/max_age/max_age_filter.c index 2a785efc045..62b28d7cc9a 100644 --- a/src/core/ext/filters/max_age/max_age_filter.c +++ b/src/core/ext/filters/max_age/max_age_filter.c @@ -254,8 +254,9 @@ add_random_max_connection_age_jitter_and_convert_to_grpc_millis(int value) { double result = multiplier * value; /* INT_MAX - 0.5 converts the value to float, so that result will not be cast to int implicitly before the comparison. */ - return result > GRPC_MILLIS_INF_FUTURE - 0.5 ? GRPC_MILLIS_INF_FUTURE - : (int)result; + return result > ((double)GRPC_MILLIS_INF_FUTURE) - 0.5 + ? GRPC_MILLIS_INF_FUTURE + : (grpc_millis)result; } /* Constructor for call_data. */