From 1ff5607e5d9dde1dc1a590f66cb4c36d6fd31062 Mon Sep 17 00:00:00 2001 From: Stephan Eberle Date: Tue, 26 Apr 2016 22:05:19 +0200 Subject: [PATCH] Fixes for building with MinGW Added fixes to avoid compile errors and warnings when building under Windows using MinGW --- CMakeLists.txt | 1 + lib/lws-plat-win.c | 1 - lib/server.c | 1 - win32port/win32helpers/gettimeofday.h | 2 ++ 4 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d4efa96b3..589bd4760 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/lib/lws-plat-win.c b/lib/lws-plat-win.c index 67c3c120c..dd3e95a3e 100644 --- a/lib/lws-plat-win.c +++ b/lib/lws-plat-win.c @@ -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; diff --git a/lib/server.c b/lib/server.c index 5fd151751..a0194c463 100644 --- a/lib/server.c +++ b/lib/server.c @@ -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); diff --git a/win32port/win32helpers/gettimeofday.h b/win32port/win32helpers/gettimeofday.h index 720cb1093..003806232 100644 --- a/win32port/win32helpers/gettimeofday.h +++ b/win32port/win32helpers/gettimeofday.h @@ -7,6 +7,8 @@ #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL #endif +#include + #ifndef _TIMEZONE_DEFINED struct timezone {