From f2b0b9c737321fa3d5af2a65361499343b0c488f Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Tue, 24 Feb 2015 13:32:22 +0000 Subject: [PATCH] Fix Win32 build in mg_websocket_write() --- mongoose.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mongoose.c b/mongoose.c index 88ccaf3f..aa74d0b2 100644 --- a/mongoose.c +++ b/mongoose.c @@ -601,13 +601,13 @@ int ns_socketpair(sock_t sp[2]) { // TODO(lsm): use non-blocking resolver static int ns_resolve2(const char *host, struct in_addr *ina) { -#ifdef NS_ENABLE_GETADDRINFO +#ifdef NS_ENABLE_GETADDRINFO int rv = 0; struct addrinfo hints, *servinfo, *p; struct sockaddr_in *h = NULL; char *ip = NS_MALLOC(17); memset(ip, '\0', 17); - + memset(&hints, 0, sizeof hints); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; @@ -2998,9 +2998,9 @@ size_t mg_websocket_write(struct mg_connection *conn, int opcode, copy_len = 4 + data_len; } else { // 64-bit length field - copy[1] = 127; const uint32_t hi = htonl((uint32_t) ((uint64_t) data_len >> 32)); const uint32_t lo = htonl(data_len & 0xffffffff); + copy[1] = 127; memcpy(copy+2,&hi,sizeof(hi)); memcpy(copy+6,&lo,sizeof(lo)); memcpy(copy + 10, data, data_len);