diff src/core/ngx_connection.c @ 5360:3d2d3e1cf427

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 04 Sep 2013 20:48:28 +0400
parents 6d73e0dc4f64
children 91bd62a9627e
line wrap: on
line diff
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -297,7 +297,7 @@ ngx_open_listening_sockets(ngx_cycle_t *
                 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 *
 
             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;
     }