]> git.kaiwu.me - nginx.git/commitdiff
Core: expose maximum values of time_t and ngx_int_t.
authorRuslan Ermilov <ru@nginx.com>
Mon, 16 Mar 2015 21:24:34 +0000 (00:24 +0300)
committerRuslan Ermilov <ru@nginx.com>
Mon, 16 Mar 2015 21:24:34 +0000 (00:24 +0300)
These are needed to detect overflows.

auto/unix
src/core/ngx_config.h
src/os/win32/ngx_win32_config.h

index 10fd3d2933481473e385e84cdf240d4c95b1f037..dfeb848321db60159d8bc93b63d1e791b891d47e 100755 (executable)
--- a/auto/unix
+++ b/auto/unix
@@ -489,6 +489,7 @@ ngx_param=NGX_OFF_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
 ngx_type="time_t"; . auto/types/sizeof
 ngx_param=NGX_TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value
 ngx_param=NGX_TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
+ngx_param=NGX_MAX_TIME_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
 
 
 # syscalls, libc calls and some features
index 1da71f8d1a176a1bc2b1abcac59fc5acea41bfae..145e43a441b12f548a88e0a5342affe948784ef3 100644 (file)
@@ -85,8 +85,11 @@ typedef intptr_t        ngx_flag_t;
 
 #if (NGX_PTR_SIZE == 4)
 #define NGX_INT_T_LEN   NGX_INT32_LEN
+#define NGX_MAX_INT_T_VALUE  2147483647
+
 #else
 #define NGX_INT_T_LEN   NGX_INT64_LEN
+#define NGX_MAX_INT_T_VALUE  9223372036854775807
 #endif
 
 
index fcbb308455e5a13e31d43d187f88aee1a7dbe457..89312ba55c45cce154f9a04a987ed31464f9ca28 100644 (file)
@@ -175,6 +175,7 @@ typedef int                 sig_atomic_t;
 #define NGX_MAX_SIZE_T_VALUE    2147483647
 #define NGX_TIME_T_LEN          (sizeof("-2147483648") - 1)
 #define NGX_TIME_T_SIZE         4
+#define NGX_MAX_TIME_T_VALUE    2147483647
 #define NGX_OFF_T_LEN           (sizeof("-9223372036854775807") - 1)
 #define NGX_MAX_OFF_T_VALUE     9223372036854775807
 #define NGX_SIG_ATOMIC_T_SIZE   4