Fixed compiler warnings on Windows. 36/2836/1
authorDavid Galeano <davidgaleano@turbulenz.biz>
Wed, 9 Jan 2013 07:29:00 +0000 (15:29 +0800)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Thu, 7 Mar 2013 21:01:21 +0000 (13:01 -0800)
lib/handshake.c
lib/libwebsockets.c

index 70fe3a8..fda50b5 100644 (file)
@@ -151,14 +151,14 @@ handshake_00(struct libwebsocket_context *context, struct libwebsocket *wsi)
 
        /* lay them out in network byte order (MSB first */
 
-       sum[0] = key1 >> 24;
-       sum[1] = key1 >> 16;
-       sum[2] = key1 >> 8;
-       sum[3] = key1;
-       sum[4] = key2 >> 24;
-       sum[5] = key2 >> 16;
-       sum[6] = key2 >> 8;
-       sum[7] = key2;
+       sum[0] = (unsigned char)(key1 >> 24);
+       sum[1] = (unsigned char)(key1 >> 16);
+       sum[2] = (unsigned char)(key1 >> 8);
+       sum[3] = (unsigned char)(key1);
+       sum[4] = (unsigned char)(key2 >> 24);
+       sum[5] = (unsigned char)(key2 >> 16);
+       sum[6] = (unsigned char)(key2 >> 8);
+       sum[7] = (unsigned char)(key2);
 
        /* follow them with the challenge token we were sent */
 
index 9912aa5..ef4a3c5 100644 (file)
@@ -22,7 +22,8 @@
 #include "private-libwebsockets.h"
 
 #ifdef WIN32
-
+#include <tchar.h>
+#include <io.h>
 #else
 #include <ifaddrs.h>
 #include <sys/un.h>
@@ -444,7 +445,9 @@ libwebsockets_get_peer_addresses(int fd, char *name, int name_len,
        char ip[128];
        unsigned char *p;
        int n;
-       struct sockaddr_un *un;
+#ifdef AF_LOCAL
+    struct sockaddr_un *un;
+#endif
 
        rip[0] = '\0';
        name[0] = '\0';
@@ -948,7 +951,7 @@ libwebsockets_generate_client_handshake(struct libwebsocket_context *context,
        p += strlen(wsi->key_b64);
        p += sprintf(p, "\x0d\x0a");
        if (wsi->c_origin)
-               p += sprintf(p, "Sec-WebSocket-Origin: %s\x0d\x0a",
+                   p += sprintf(p, "Sec-WebSocket-Origin: %s\x0d\x0a",
                                                         wsi->c_origin);
        if (wsi->c_protocol)
                p += sprintf(p, "Sec-WebSocket-Protocol: %s\x0d\x0a",
@@ -2557,7 +2560,7 @@ libwebsocket_create_context(int port, const char *interf,
                poll = emulated_poll;
 
                /* if windows socket lib available, use his WSAPoll */
-               wsdll = GetModuleHandle("Ws2_32.dll");
+               wsdll = GetModuleHandle(_T("Ws2_32.dll"));
                if (wsdll)
                        poll = (PFNWSAPOLL)GetProcAddress(wsdll, "WSAPoll");
        }