/* 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 */
#include "private-libwebsockets.h"
#ifdef WIN32
-
+#include <tchar.h>
+#include <io.h>
#else
#include <ifaddrs.h>
#include <sys/un.h>
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';
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",
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");
}