Fixes for building with MinGW
authorStephan Eberle <stephaneberle9@gmail.com>
Tue, 26 Apr 2016 20:05:19 +0000 (22:05 +0200)
committerAndy Green <andy@warmcat.com>
Tue, 26 Apr 2016 23:31:22 +0000 (07:31 +0800)
Added fixes to avoid compile errors and warnings when building under
Windows using MinGW

CMakeLists.txt
lib/lws-plat-win.c
lib/server.c
win32port/win32helpers/gettimeofday.h

index d4efa96b35fb3cb8cf99f8bdbb442d22aff8b1bf..589bd47604f3cff9a7af1016977e0de95c79b486 100644 (file)
@@ -49,6 +49,7 @@ if(GIT_EXECUTABLE)
     OUTPUT_VARIABLE GIT_HOST
     OUTPUT_STRIP_TRAILING_WHITESPACE
     )
+       string(REGEX REPLACE "([^\\])[\\]([^\\])" "\\1\\\\\\\\\\2" GIT_USER ${GIT_USER})
     set(LWS_BUILD_HASH ${GIT_USER}@${GIT_HOST}-${GIT_HASH})
     message("Git commit hash: ${LWS_BUILD_HASH}")
 endif()
index 67c3c120c00bb6b7740111745d318efedc090ba8..dd3e95a3e71e6aa5a61cfab296c7052caba33a0c 100644 (file)
@@ -541,7 +541,6 @@ _lws_plat_file_read(struct lws *wsi, lws_filefd_type fd, unsigned long *amount,
 {
        DWORD _amount;
 
-       (void *)wsi;
        if (!ReadFile((HANDLE)fd, buf, (DWORD)len, &_amount, NULL)) {
                *amount = 0;
 
index 5fd15175188fefad92caa636cef233bab6d46a77..a0194c463638697f1a649fd61c2fd4438217238f 100644 (file)
@@ -233,7 +233,6 @@ int lws_http_serve(struct lws *wsi, char *uri, const char *origin)
        char path[256], sym[256];
        unsigned char *p = (unsigned char *)sym + 32 + LWS_PRE, *start = p;
        unsigned char *end = p + sizeof(sym) - 32 - LWS_PRE;
-       size_t len;
        int n, spin = 0;
 
        snprintf(path, sizeof(path) - 1, "%s/%s", origin, uri);
index 720cb10932547aa186652ce36c6a8ebcc7472da8..0038062326cd77e71ee93ef06d5347aa4733296a 100644 (file)
@@ -7,6 +7,8 @@
   #define DELTA_EPOCH_IN_MICROSECS  11644473600000000ULL
 #endif
 
+#include <winsock2.h>
+
 #ifndef _TIMEZONE_DEFINED 
 struct timezone 
 {