summaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2013-09-04 20:48:28 +0400
committerMaxim Dounin <mdounin@mdounin.ru>2013-09-04 20:48:28 +0400
commit48d96ced6ff6cea533d56d0d09129f6632a19e4d (patch)
treef3196223e3dd9173aaf91dff959498799c0e3ea2 /src/core
parent74b7a910137a99b5fb073e7c27858c019f96a8cc (diff)
downloadnginx-48d96ced6ff6cea533d56d0d09129f6632a19e4d.tar.gz
nginx-48d96ced6ff6cea533d56d0d09129f6632a19e4d.tar.bz2
Win32: MinGW GCC compatibility.
Several warnings silenced, notably (ngx_socket_t) -1 is now checked on socket operations instead of -1, as ngx_socket_t is unsigned on win32 and gcc complains on comparison. With this patch, it's now possible to compile nginx using mingw gcc, with options we normally compile on win32.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ngx_connection.c6
-rw-r--r--src/core/ngx_cycle.c6
-rw-r--r--src/core/ngx_resolver.c2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index e12d3efc0..28bf6ba06 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -297,7 +297,7 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
continue;
}
- if (ls[i].fd != -1) {
+ if (ls[i].fd != (ngx_socket_t) -1) {
continue;
}
@@ -312,7 +312,7 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
s = ngx_socket(ls[i].sockaddr->sa_family, ls[i].type, 0);
- if (s == -1) {
+ if (s == (ngx_socket_t) -1) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
ngx_socket_n " %V failed", &ls[i].addr_text);
return NGX_ERROR;
@@ -863,7 +863,7 @@ ngx_close_connection(ngx_connection_t *c)
ngx_uint_t log_error, level;
ngx_socket_t fd;
- if (c->fd == -1) {
+ if (c->fd == (ngx_socket_t) -1) {
ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed");
return;
}
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index 2c006bcb2..eb39ab253 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -543,7 +543,7 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
}
}
- if (nls[n].fd == -1) {
+ if (nls[n].fd == (ngx_socket_t) -1) {
nls[n].open = 1;
}
}
@@ -649,7 +649,7 @@ old_shm_zone_done:
ls = old_cycle->listening.elts;
for (i = 0; i < old_cycle->listening.nelts; i++) {
- if (ls[i].remain || ls[i].fd == -1) {
+ if (ls[i].remain || ls[i].fd == (ngx_socket_t) -1) {
continue;
}
@@ -813,7 +813,7 @@ failed:
ls = cycle->listening.elts;
for (i = 0; i < cycle->listening.nelts; i++) {
- if (ls[i].fd == -1 || !ls[i].open) {
+ if (ls[i].fd == (ngx_socket_t) -1 || !ls[i].open) {
continue;
}
diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c
index d59d0c471..d94477a9c 100644
--- a/src/core/ngx_resolver.c
+++ b/src/core/ngx_resolver.c
@@ -2221,7 +2221,7 @@ ngx_udp_connect(ngx_udp_connection_t *uc)
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, &uc->log, 0, "UDP socket %d", s);
- if (s == -1) {
+ if (s == (ngx_socket_t) -1) {
ngx_log_error(NGX_LOG_ALERT, &uc->log, ngx_socket_errno,
ngx_socket_n " failed");
return NGX_ERROR;