comparison src/os/win32/ngx_win32_config.h @ 6861:e4590dfd97ff

Win32: support 64-bit compilation with MSVC. There are lots of C4244 warnings (conversion from 'type1' to 'type2', possible loss of data), so they were disabled. The same applies to C4267 warnings (conversion from 'size_t' to 'type', possible loss of data), most notably - conversion from ngx_str_t.len to ngx_variable_value_t.len (which is unsigned:28). Additionally, there is at least one case when it is not possible to fix the warning properly without introducing win32-specific code: recv() on win32 uses "int len", while POSIX defines "size_t len". The ssize_t type now properly defined for 64-bit compilation with MSVC. Caught by warning C4305 (truncation from '__int64' to 'ssize_t'), on "cutoff = NGX_MAX_SIZE_T_VALUE / 10" in ngx_atosz()). Several C4334 warnings (result of 32-bit shift implicitly converted to 64 bits) were fixed by adding explicit conversions. Several C4214 warnings (nonstandard extension used: bit field types other than int) in ngx_http_script.h fixed by changing bit field types from uintptr_t to unsigned.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 24 Dec 2016 18:01:14 +0300
parents f18c285c2e59
children abb0a4189cf7
comparison
equal deleted inserted replaced
6860:f18c285c2e59 6861:e4590dfd97ff
92 #pragma warning(disable:4100) 92 #pragma warning(disable:4100)
93 93
94 /* FD_SET() and FD_CLR(): conditional expression is constant */ 94 /* FD_SET() and FD_CLR(): conditional expression is constant */
95 #pragma warning(disable:4127) 95 #pragma warning(disable:4127)
96 96
97 /* conversion from 'type1' to 'type2', possible loss of data */
98 #pragma warning(disable:4244)
99
100 /* conversion from 'size_t' to 'type', possible loss of data */
101 #pragma warning(disable:4267)
102
97 /* array is too small to include a terminating null character */ 103 /* array is too small to include a terminating null character */
98 #pragma warning(disable:4295) 104 #pragma warning(disable:4295)
99 105
100 #endif 106 #endif
101 107
187 193
188 #endif 194 #endif
189 195
190 196
191 #ifndef __GNUC__ 197 #ifndef __GNUC__
198 #ifdef _WIN64
199 typedef __int64 ssize_t;
200 #else
192 typedef int ssize_t; 201 typedef int ssize_t;
202 #endif
193 #endif 203 #endif
194 204
195 205
196 typedef uint32_t in_addr_t; 206 typedef uint32_t in_addr_t;
197 typedef u_short in_port_t; 207 typedef u_short in_port_t;