Skip to content

Commit f54438b

Browse files
committed
bugfix: fixed compiler warnings "comparison between signed and unsigned integer expressions" on Windows.
1 parent c040f15 commit f54438b

10 files changed

+25
-23
lines changed

src/ngx_http_lua_args.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ ngx_http_lua_ffi_req_get_uri_args_count(ngx_http_request_t *r, int max)
389389
int count;
390390
u_char *p, *last;
391391

392-
if (r->connection->fd == -1) {
392+
if (r->connection->fd == (ngx_socket_t) -1) {
393393
return NGX_HTTP_LUA_FFI_BAD_CONTEXT;
394394
}
395395

src/ngx_http_lua_headers.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ ngx_http_lua_ffi_req_get_headers_count(ngx_http_request_t *r, int max)
989989
int count;
990990
ngx_list_part_t *part;
991991

992-
if (r->connection->fd == -1) {
992+
if (r->connection->fd == (ngx_socket_t) -1) {
993993
return NGX_HTTP_LUA_FFI_BAD_CONTEXT;
994994
}
995995

@@ -1082,7 +1082,7 @@ ngx_http_lua_ffi_set_resp_header(ngx_http_request_t *r, const u_char *key_data,
10821082
return NGX_HTTP_LUA_FFI_NO_REQ_CTX;
10831083
}
10841084

1085-
if (r->connection->fd == -1) {
1085+
if (r->connection->fd == (ngx_socket_t) -1) {
10861086
return NGX_HTTP_LUA_FFI_BAD_CONTEXT;
10871087
}
10881088

@@ -1198,7 +1198,7 @@ ngx_http_lua_ffi_req_header_set_single_value(ngx_http_request_t *r,
11981198
ngx_str_t k;
11991199
ngx_str_t v;
12001200

1201-
if (r->connection->fd == -1) { /* fake request */
1201+
if (r->connection->fd == (ngx_socket_t) -1) { /* fake request */
12021202
return NGX_HTTP_LUA_FFI_BAD_CONTEXT;
12031203
}
12041204

@@ -1253,7 +1253,7 @@ ngx_http_lua_ffi_get_resp_header(ngx_http_request_t *r,
12531253

12541254
ngx_http_lua_loc_conf_t *llcf;
12551255

1256-
if (r->connection->fd == -1) {
1256+
if (r->connection->fd == (ngx_socket_t) -1) {
12571257
return NGX_HTTP_LUA_FFI_BAD_CONTEXT;
12581258
}
12591259

src/ngx_http_lua_misc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ ngx_http_lua_ngx_set(lua_State *L)
200200
int
201201
ngx_http_lua_ffi_get_resp_status(ngx_http_request_t *r)
202202
{
203-
if (r->connection->fd == -1) {
203+
if (r->connection->fd == (ngx_socket_t) -1) {
204204
return NGX_HTTP_LUA_FFI_BAD_CONTEXT;
205205
}
206206

@@ -222,7 +222,7 @@ ngx_http_lua_ffi_get_resp_status(ngx_http_request_t *r)
222222
int
223223
ngx_http_lua_ffi_set_resp_status(ngx_http_request_t *r, int status)
224224
{
225-
if (r->connection->fd == -1) {
225+
if (r->connection->fd == (ngx_socket_t) -1) {
226226
return NGX_HTTP_LUA_FFI_BAD_CONTEXT;
227227
}
228228

@@ -254,7 +254,7 @@ ngx_http_lua_ffi_set_resp_status(ngx_http_request_t *r, int status)
254254
int
255255
ngx_http_lua_ffi_is_subrequest(ngx_http_request_t *r)
256256
{
257-
if (r->connection->fd == -1) {
257+
if (r->connection->fd == (ngx_socket_t) -1) {
258258
return NGX_HTTP_LUA_FFI_BAD_CONTEXT;
259259
}
260260

@@ -272,7 +272,7 @@ ngx_http_lua_ffi_headers_sent(ngx_http_request_t *r)
272272
return NGX_HTTP_LUA_FFI_NO_REQ_CTX;
273273
}
274274

275-
if (r->connection->fd == -1) {
275+
if (r->connection->fd == (ngx_socket_t) -1) {
276276
return NGX_HTTP_LUA_FFI_BAD_CONTEXT;
277277
}
278278

src/ngx_http_lua_req_method.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ ngx_http_lua_ngx_req_set_method(lua_State *L)
149149
int
150150
ngx_http_lua_ffi_req_get_method(ngx_http_request_t *r)
151151
{
152-
if (r->connection->fd == -1) {
152+
if (r->connection->fd == (ngx_socket_t) -1) {
153153
return NGX_HTTP_LUA_FFI_BAD_CONTEXT;
154154
}
155155

@@ -161,7 +161,7 @@ int
161161
ngx_http_lua_ffi_req_get_method_name(ngx_http_request_t *r, char *buf,
162162
size_t *len)
163163
{
164-
if (r->connection->fd == -1) {
164+
if (r->connection->fd == (ngx_socket_t) -1) {
165165
return NGX_HTTP_LUA_FFI_BAD_CONTEXT;
166166
}
167167

@@ -174,7 +174,7 @@ ngx_http_lua_ffi_req_get_method_name(ngx_http_request_t *r, char *buf,
174174
int
175175
ngx_http_lua_ffi_req_set_method(ngx_http_request_t *r, int method)
176176
{
177-
if (r->connection->fd == -1) {
177+
if (r->connection->fd == (ngx_socket_t) -1) {
178178
return NGX_HTTP_LUA_FFI_BAD_CONTEXT;
179179
}
180180

src/ngx_http_lua_sleep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ ngx_http_lua_sleep_handler(ngx_event_t *ev)
102102
return;
103103
}
104104

105-
if (c->fd != -1) { /* not a fake connection */
105+
if (c->fd != (ngx_socket_t) -1) { /* not a fake connection */
106106
log_ctx = c->log->data;
107107
log_ctx->current_request = r;
108108
}

src/ngx_http_lua_socket_tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2689,7 +2689,7 @@ ngx_http_lua_socket_tcp_handler(ngx_event_t *ev)
26892689
r = u->request;
26902690
c = r->connection;
26912691

2692-
if (c->fd != -1) { /* not a fake connection */
2692+
if (c->fd != (ngx_socket_t) -1) { /* not a fake connection */
26932693
ctx = c->log->data;
26942694
ctx->current_request = r;
26952695
}

src/ngx_http_lua_socket_udp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ ngx_http_lua_socket_udp_handler(ngx_event_t *ev)
12991299
r = u->request;
13001300
c = r->connection;
13011301

1302-
if (c->fd != -1) { /* not a fake connection */
1302+
if (c->fd != (ngx_socket_t) -1) { /* not a fake connection */
13031303
ctx = c->log->data;
13041304
ctx->current_request = r;
13051305
}

src/ngx_http_lua_util.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ ngx_http_lua_request_cleanup(ngx_http_lua_ctx_t *ctx, int forcible)
926926
lmcf = ngx_http_get_module_main_conf(r, ngx_http_lua_module);
927927

928928
#if 1
929-
if (r->connection->fd == -1) {
929+
if (r->connection->fd == (ngx_socket_t) -1) {
930930
/* being a fake request */
931931
lmcf->running_timers--;
932932
}
@@ -1480,7 +1480,9 @@ ngx_http_lua_run_thread(lua_State *L, ngx_http_request_t *r,
14801480

14811481
done:
14821482

1483-
if (ctx->entered_content_phase && r->connection->fd != -1) {
1483+
if (ctx->entered_content_phase
1484+
&& r->connection->fd != (ngx_socket_t) -1)
1485+
{
14841486
rc = ngx_http_lua_send_chain_link(r, ctx,
14851487
NULL /* last_buf */);
14861488

@@ -3524,7 +3526,7 @@ ngx_http_lua_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
35243526
ngx_http_lua_cleanup_pending_operation(ctx->cur_co_ctx);
35253527
}
35263528

3527-
if (r->connection->fd != -1) {
3529+
if (r->connection->fd != (ngx_socket_t) -1) {
35283530
ngx_http_finalize_request(r, rc);
35293531
return;
35303532
}

src/ngx_http_lua_util.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ ngx_http_lua_ffi_check_context(ngx_http_lua_ctx_t *ctx, unsigned flags,
114114

115115

116116
#define ngx_http_lua_check_fake_request(L, r) \
117-
if ((r)->connection->fd == -1) { \
117+
if ((r)->connection->fd == (ngx_socket_t) -1) { \
118118
return luaL_error(L, "API disabled in the current context"); \
119119
}
120120

121121

122122
#define ngx_http_lua_check_fake_request2(L, r, ctx) \
123-
if ((r)->connection->fd == -1) { \
123+
if ((r)->connection->fd == (ngx_socket_t) -1) { \
124124
return luaL_error(L, "API disabled in the context of %s", \
125125
ngx_http_lua_context_name((ctx)->context)); \
126126
}
@@ -272,7 +272,7 @@ ngx_http_lua_create_ctx(ngx_http_request_t *r)
272272
ngx_http_set_ctx(r, ctx, ngx_http_lua_module);
273273

274274
llcf = ngx_http_get_module_loc_conf(r, ngx_http_lua_module);
275-
if (!llcf->enable_code_cache && r->connection->fd != -1) {
275+
if (!llcf->enable_code_cache && r->connection->fd != (ngx_socket_t) -1) {
276276
lmcf = ngx_http_get_module_main_conf(r, ngx_http_lua_module);
277277

278278
dd("lmcf: %p", lmcf);

src/ngx_http_lua_variable.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ ngx_http_lua_ffi_var_get(ngx_http_request_t *r, u_char *name_data,
307307
return NGX_ERROR;
308308
}
309309

310-
if ((r)->connection->fd == -1) {
310+
if ((r)->connection->fd == (ngx_socket_t) -1) {
311311
*err = "API disabled in the current context";
312312
return NGX_ERROR;
313313
}
@@ -377,7 +377,7 @@ ngx_http_lua_ffi_var_set(ngx_http_request_t *r, u_char *name_data,
377377
return NGX_ERROR;
378378
}
379379

380-
if ((r)->connection->fd == -1) {
380+
if ((r)->connection->fd == (ngx_socket_t) -1) {
381381
ngx_snprintf(errbuf, errlen, "API disabled in the current context");
382382
return NGX_ERROR;
383383
}

0 commit comments

Comments
 (0)