Commit 4f01f101 authored by Igor Okulist's avatar Igor Okulist

Compile on Win32

parent 518b3aa7
...@@ -1507,7 +1507,7 @@ int mg_printf(struct mg_connection *conn, const char *fmt, ...) { ...@@ -1507,7 +1507,7 @@ int mg_printf(struct mg_connection *conn, const char *fmt, ...) {
// vsnprintf() error, give up // vsnprintf() error, give up
len = -1; len = -1;
cry(conn, "%s(%s, ...): vsnprintf() error", __func__, fmt); cry(conn, "%s(%s, ...): vsnprintf() error", __func__, fmt);
} else if (len > (int) sizeof(mem) && (buf = malloc(len + 1)) != NULL) { } else if (len > (int) sizeof(mem) && (buf = (char *) malloc(len + 1)) != NULL) {
// Local buffer is not large enough, allocate big buffer on heap // Local buffer is not large enough, allocate big buffer on heap
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(buf, len + 1, fmt, ap); vsnprintf(buf, len + 1, fmt, ap);
...@@ -3630,7 +3630,7 @@ static int set_ports_option(struct mg_context *ctx) { ...@@ -3630,7 +3630,7 @@ static int set_ports_option(struct mg_context *ctx) {
// handshake will figure out that the client is down and // handshake will figure out that the client is down and
// will close the server end. // will close the server end.
// Thanks to Igor Klopov who suggested the patch. // Thanks to Igor Klopov who suggested the patch.
setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void *) &on, setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char *) &on,
sizeof(on)) != 0 || sizeof(on)) != 0 ||
bind(sock, &so.lsa.sa, sizeof(so.lsa)) != 0 || bind(sock, &so.lsa.sa, sizeof(so.lsa)) != 0 ||
listen(sock, SOMAXCONN) != 0) { listen(sock, SOMAXCONN) != 0) {
...@@ -3949,7 +3949,7 @@ static void close_socket_gracefully(struct mg_connection *conn) { ...@@ -3949,7 +3949,7 @@ static void close_socket_gracefully(struct mg_connection *conn) {
// ephemeral port exhaust problem under high QPS. // ephemeral port exhaust problem under high QPS.
linger.l_onoff = 1; linger.l_onoff = 1;
linger.l_linger = 1; linger.l_linger = 1;
setsockopt(sock, SOL_SOCKET, SO_LINGER, (void *) &linger, sizeof(linger)); setsockopt(sock, SOL_SOCKET, SO_LINGER, (char *) &linger, sizeof(linger));
// Send FIN to the client // Send FIN to the client
(void) shutdown(sock, SHUT_WR); (void) shutdown(sock, SHUT_WR);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment