Klaus Demo nginx / 1c2c11f
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. Maxim Dounin 3 years ago
4 changed file(s) with 28 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
100100 }
101101 /**/
102102
103 pool->min_size = 1 << pool->min_shift;
103 pool->min_size = (size_t) 1 << pool->min_shift;
104104
105105 slots = ngx_slab_slots(pool);
106106
472472 case NGX_SLAB_SMALL:
473473
474474 shift = slab & NGX_SLAB_SHIFT_MASK;
475 size = 1 << shift;
475 size = (size_t) 1 << shift;
476476
477477 if ((uintptr_t) p & (size - 1)) {
478478 goto wrong_chunk;
567567 case NGX_SLAB_BIG:
568568
569569 shift = slab & NGX_SLAB_SHIFT_MASK;
570 size = 1 << shift;
570 size = (size_t) 1 << shift;
571571
572572 if ((uintptr_t) p & (size - 1)) {
573573 goto wrong_chunk;
355355
356356 n = sc->source->data[i] - '0';
357357
358 if (sc->captures_mask & (1 << n)) {
358 if (sc->captures_mask & ((ngx_uint_t) 1 << n)) {
359359 sc->dup_capture = 1;
360360 }
361361
362 sc->captures_mask |= 1 << n;
362 sc->captures_mask |= (ngx_uint_t) 1 << n;
363363
364364 if (ngx_http_script_add_capture_code(sc, n) != NGX_OK) {
365365 return NGX_ERROR;
120120 uintptr_t status;
121121 uintptr_t next;
122122
123 uintptr_t test:1;
124 uintptr_t negative_test:1;
125 uintptr_t uri:1;
126 uintptr_t args:1;
123 unsigned test:1;
124 unsigned negative_test:1;
125 unsigned uri:1;
126 unsigned args:1;
127127
128128 /* add the r->args to the new arguments */
129 uintptr_t add_args:1;
130
131 uintptr_t redirect:1;
132 uintptr_t break_cycle:1;
129 unsigned add_args:1;
130
131 unsigned redirect:1;
132 unsigned break_cycle:1;
133133
134134 ngx_str_t name;
135135 } ngx_http_script_regex_code_t;
138138 typedef struct {
139139 ngx_http_script_code_pt code;
140140
141 uintptr_t uri:1;
142 uintptr_t args:1;
141 unsigned uri:1;
142 unsigned args:1;
143143
144144 /* add the r->args to the new arguments */
145 uintptr_t add_args:1;
146
147 uintptr_t redirect:1;
145 unsigned add_args:1;
146
147 unsigned redirect:1;
148148 } ngx_http_script_regex_end_code_t;
149149
150150 #endif
9393 /* FD_SET() and FD_CLR(): conditional expression is constant */
9494 #pragma warning(disable:4127)
9595
96 /* conversion from 'type1' to 'type2', possible loss of data */
97 #pragma warning(disable:4244)
98
99 /* conversion from 'size_t' to 'type', possible loss of data */
100 #pragma warning(disable:4267)
101
96102 /* array is too small to include a terminating null character */
97103 #pragma warning(disable:4295)
98104
188194
189195
190196 #ifndef __GNUC__
197 #ifdef _WIN64
198 typedef __int64 ssize_t;
199 #else
191200 typedef int ssize_t;
201 #endif
192202 #endif
193203
194204