Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1746417185, "reponame":"libwebsockets", "desc":"libwebsockets lightweight C networking library", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets", "f":3, "items": [ {"schema":"libjg2-1", "cid":"6aacf83668d708cc0ff22a59573704f5", "commit": {"type":"commit", "time": 1552176122, "time_ofs": 480, "oid_tree": { "oid": "e778d532e57324f3b1bcbe1e09f2f325c4208401", "alias": []}, "oid":{ "oid": "f8cd973f85278b29955c88f684dec8a4a9ba8f34", "alias": []}, "msg": "mingw: windows: make minimal examples build", "sig_commit": { "git_time": { "time": 1552176122, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }, "sig_author": { "git_time": { "time": 1552016613, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }}, "body": "mingw: windows: make minimal examples build" , "diff": "diff --git a/READMEs/README.build.md b/READMEs/README.build.md\nindex 7558010..43ed887 100644\n--- a/READMEs/README.build.md\n+++ b/READMEs/README.build.md\n@@ -214,72 +214,47 @@ deleting build/CMakeCache.txt may be enough.\n \n @section cmwmgw Building on Windows (MinGW)\n \n-1. Install MinGW: http://sourceforge.net/projects/mingw/files\n+1. Install MinGW\n \n- (**NOTE**: Preferably in the default location C:\u005cMinGW)\n+ For Fedora, it's, eg, `dnf install mingw64-gcc`\n \n-2. Fix up MinGW headers\n+2. Install current CMake package\n \n- a) If still necessary, sdd the following lines to C:\u005cMinGW\u005cinclude\u005cwinsock2.h:\n-```\n- #if(_WIN32_WINNT \u003e\u003d 0x0600)\n+ For Fedora, it's `dnf install cmake`\n \n- typedef struct pollfd {\n+3. Instal mingw-built OpenSSL pieces\n \n- SOCKET fd;\n- SHORT events;\n- SHORT revents;\n+ For Fedora, it's `mingw64-openssl.noarch mingw64-openssl-static.noarch`\n \n- } WSAPOLLFD, *PWSAPOLLFD, FAR *LPWSAPOLLFD;\n+ mingw64-cmake as described below will auto-find the libs and includes\n+ for build. But to execute the apps, they either need to go into the same\n+ `/usr/x86_64-w64-mingw32/sys-root/mingw/bin/` as the dlls are installed to,\n+ or the dlls have to be copied into the same dir as your app executable.\n \n- WINSOCK_API_LINKAGE int WSAAPI WSAPoll(LPWSAPOLLFD fdArray, ULONG fds, INT timeout);\n+4. Generate the build files (default is Make files) using MSYS shell.\n \n- #endif // (_WIN32_WINNT \u003e\u003d 0x0600)\n-```\n+ For Fedora, they provide a `mingw64-cmake` wrapper in the package\n+ `mingw64-filesystem`, with this you can run that instead of cmake directly\n+ and don't have to get involved with setting the cmake generator.\n \n- Update crtdefs.h line 47 to say:\n+ Otherwise doing it by hand is like this:\n \n ```\n- typedef __int64 ssize_t;\n-```\n-\n- b) Create C:\u005cMinGW\u005cinclude\u005cmstcpip.h and copy and paste the content from following link into it:\n-\n- https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-headers/include/mstcpip.h\n-\n-3. Install CMake 2.6 or greater: http://cmake.org/cmake/resources/software.html\n-\n-4. Install OpenSSL binaries. https://wiki.openssl.org/index.php/Binaries\n-\n- (**NOTE**: Preferably in the default location to make it easier for CMake to find them)\n-\n- **NOTE2**: \n- Be sure that OPENSSL_CONF environment variable is defined and points at \n- \u003cOpenSSL install location\u003e\u005cbin\u005copenssl.cfg\n-\n-5. Generate the build files (default is Make files) using MSYS shell:\n-```\n $ cd /drive/path/to/src\n $ mkdir build\n $ cd build\n $ cmake -G \u0022MSYS Makefiles\u0022 -DCMAKE_INSTALL_PREFIX\u003dC:/MinGW ..\n ```\n- (**NOTE**: The `build/`` directory can have any name and be located anywhere\n- on your filesystem, and that the argument `..` given to cmake is simply\n- the source directory of **libwebsockets** containing the [CMakeLists.txt](../CMakeLists.txt)\n- project file. All examples in this file assumes you use \u0022..\u0022)\n \n- **NOTE2**:\n To generate build files allowing to create libwebsockets binaries with debug information\n set the CMAKE_BUILD_TYPE flag to DEBUG:\n ```\n $ cmake -G \u0022MSYS Makefiles\u0022 -DCMAKE_INSTALL_PREFIX\u003dC:/MinGW -DCMAKE_BUILD_TYPE\u003dDEBUG ..\n ```\n-6. Finally you can build using the generated Makefile and get the results deployed into your MinGW installation:\n+5. Finally you can build using the generated Makefile and get the results deployed into your MinGW installation:\n \n ```\n- $ make\n- $ make install\n+ $ make \u0026\u0026 make install\n ```\n \n @section distro Selecting CMake options useful for distros\ndiff --git a/include/libwebsockets.h b/include/libwebsockets.h\nindex 980c60a..6ab91d8 100644\n--- a/include/libwebsockets.h\n+++ b/include/libwebsockets.h\n@@ -85,6 +85,7 @@ typedef unsigned long long lws_intptr_t;\n #endif\n \n #define LWS_INVALID_FILE INVALID_HANDLE_VALUE\n+#define LWS_SOCK_INVALID (INVALID_SOCKET)\n #define LWS_O_RDONLY _O_RDONLY\n #define LWS_O_WRONLY _O_WRONLY\n #define LWS_O_CREAT _O_CREAT\n@@ -115,12 +116,15 @@ typedef unsigned long long lws_intptr_t;\n #include \u003cpoll.h\u003e\n #include \u003cnetdb.h\u003e\n #define LWS_INVALID_FILE -1\n+#define LWS_SOCK_INVALID (-1)\n #else\n #define getdtablesize() (30)\n #if defined(LWS_WITH_ESP32)\n #define LWS_INVALID_FILE NULL\n+#define LWS_SOCK_INVALID (-1)\n #else\n #define LWS_INVALID_FILE NULL\n+#define LWS_SOCK_INVALID (-1)\n #endif\n #endif\n \ndiff --git a/lib/core-net/adopt.c b/lib/core-net/adopt.c\nindex 4b632ba..4d5e6fd 100644\n--- a/lib/core-net/adopt.c\n+++ b/lib/core-net/adopt.c\n@@ -168,12 +168,15 @@ lws_adopt_descriptor_vhost(struct lws_vhost *vh, lws_adoption_type type,\n \t\t\t\t __func__);\n \t\t\tgoto bail;\n \t\t}\n-\t} else\n+\t}\n+#if !defined(WIN32)\n+\telse\n \t\tif (lws_plat_set_nonblocking(fd.filefd)) {\n \t\t\tlwsl_err(\u0022%s: unable to set filefd nonblocking\u005cn\u0022,\n \t\t\t\t __func__);\n \t\t\tgoto bail;\n \t\t}\n+#endif\n \n \tnew_wsi-\u003edesc \u003d fd;\n \ndiff --git a/lib/plat/esp32/private.h b/lib/plat/esp32/private.h\nindex 29c0c0c..4726dfa 100644\n--- a/lib/plat/esp32/private.h\n+++ b/lib/plat/esp32/private.h\n@@ -64,8 +64,6 @@\n \n #define lws_set_blocking_send(wsi)\n \n- #define LWS_SOCK_INVALID (-1)\n-\n #ifndef LWS_NO_FORK\n #ifdef LWS_HAVE_SYS_PRCTL_H\n #include \u003csys/prctl.h\u003e\ndiff --git a/lib/plat/optee/private.h b/lib/plat/optee/private.h\nindex f670b77..256289f 100644\n--- a/lib/plat/optee/private.h\n+++ b/lib/plat/optee/private.h\n@@ -36,8 +36,6 @@\n \n #define lws_set_blocking_send(wsi)\n \n- #define LWS_SOCK_INVALID (-1)\n-\n #define compatible_close(x) close(x)\n #define lws_plat_socket_offset() (0)\n #define wsi_from_fd(A,B) A-\u003elws_lookup[B - lws_plat_socket_offset()]\ndiff --git a/lib/plat/windows/private.h b/lib/plat/windows/private.h\nindex 980028c..5b1b887 100644\n--- a/lib/plat/windows/private.h\n+++ b/lib/plat/windows/private.h\n@@ -49,7 +49,6 @@\n \n #define compatible_close(fd) closesocket(fd)\n #define lws_set_blocking_send(wsi) wsi-\u003esock_send_blocking \u003d 1\n- #define LWS_SOCK_INVALID (INVALID_SOCKET)\n \n #include \u003cwinsock2.h\u003e\n #include \u003cws2tcpip.h\u003e\ndiff --git a/lib/tls/private.h b/lib/tls/private.h\nindex 5f51b84..fa854b0 100644\n--- a/lib/tls/private.h\n+++ b/lib/tls/private.h\n@@ -161,7 +161,7 @@ lws_gencrypto_destroy_elements(struct lws_gencrypto_keyelem *el, int m);\n struct lws_gencrypto_keyelem;\n struct lws_ec_curves;\n \n-LWS_EXTERN const struct lws_ec_curves lws_ec_curves[];\n+LWS_EXTERN const struct lws_ec_curves *lws_ec_curves;\n const struct lws_ec_curves *\n lws_genec_curve(const struct lws_ec_curves *table, const char *name);\n LWS_VISIBLE void\ndiff --git a/minimal-examples/http-client/minimal-http-client-multi/minimal-http-client-multi.c b/minimal-examples/http-client/minimal-http-client-multi/minimal-http-client-multi.c\nindex 3d3d750..a21e200 100644\n--- a/minimal-examples/http-client/minimal-http-client-multi/minimal-http-client-multi.c\n+++ b/minimal-examples/http-client/minimal-http-client-multi/minimal-http-client-multi.c\n@@ -147,6 +147,29 @@ sigint_handler(int sig)\n \tinterrupted \u003d 1;\n }\n \n+#if defined(WIN32)\n+int gettimeofday(struct timeval * tp, struct timezone * tzp)\n+{\n+ // Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's\n+ // This magic number is the number of 100 nanosecond intervals since January 1, 1601 (UTC)\n+ // until 00:00:00 January 1, 1970 \n+ static const uint64_t EPOCH \u003d ((uint64_t) 116444736000000000ULL);\n+\n+ SYSTEMTIME system_time;\n+ FILETIME file_time;\n+ uint64_t time;\n+\n+ GetSystemTime( \u0026system_time );\n+ SystemTimeToFileTime( \u0026system_time, \u0026file_time );\n+ time \u003d ((uint64_t)file_time.dwLowDateTime ) ;\n+ time +\u003d ((uint64_t)file_time.dwHighDateTime) \u003c\u003c 32;\n+\n+ tp-\u003etv_sec \u003d (long) ((time - EPOCH) / 10000000L);\n+ tp-\u003etv_usec \u003d (long) (system_time.wMilliseconds * 1000);\n+ return 0;\n+}\n+#endif\n+\n unsigned long long us(void)\n {\n \tstruct timeval t;\ndiff --git a/minimal-examples/http-server/minimal-http-server-form-post-file/minimal-http-server-form-post-file.c b/minimal-examples/http-server/minimal-http-server-form-post-file/minimal-http-server-form-post-file.c\nindex a9d8007..0abc714 100644\n--- a/minimal-examples/http-server/minimal-http-server-form-post-file/minimal-http-server-form-post-file.c\n+++ b/minimal-examples/http-server/minimal-http-server-form-post-file/minimal-http-server-form-post-file.c\n@@ -58,7 +58,7 @@ file_upload_cb(void *data, const char *name, const char *filename,\n \t\tlws_filename_purify_inplace(pss-\u003efilename);\n \t\t/* open a file of that name for write in the cwd */\n \t\tpss-\u003efd \u003d lws_open(pss-\u003efilename, O_CREAT | O_TRUNC | O_RDWR, 0600);\n-\t\tif (pss-\u003efd \u003d\u003d LWS_INVALID_FILE) {\n+\t\tif (pss-\u003efd \u003d\u003d -1) {\n \t\t\tlwsl_notice(\u0022Failed to open output file %s\u005cn\u0022,\n \t\t\t\t pss-\u003efilename);\n \t\t\treturn 1;\n@@ -86,7 +86,7 @@ file_upload_cb(void *data, const char *name, const char *filename,\n \t\t\t pss-\u003efile_length, pss-\u003efilename);\n \n \t\tclose(pss-\u003efd);\n-\t\tpss-\u003efd \u003d LWS_INVALID_FILE;\n+\t\tpss-\u003efd \u003d -1;\n \t\tbreak;\n \t}\n \ndiff --git a/minimal-examples/http-server/minimal-http-server-smp/minimal-http-server-smp.c b/minimal-examples/http-server/minimal-http-server-smp/minimal-http-server-smp.c\nindex d6f51b4..507d96e 100644\n--- a/minimal-examples/http-server/minimal-http-server-smp/minimal-http-server-smp.c\n+++ b/minimal-examples/http-server/minimal-http-server-smp/minimal-http-server-smp.c\n@@ -56,6 +56,8 @@ void *thread_service(void *threadid)\n \t\t;\n \n \tpthread_exit(NULL);\n+\n+\treturn NULL;\n }\n \n void sigint_handler(int sig)\ndiff --git a/minimal-examples/http-server/minimal-http-server-sse-ring/minimal-http-server-sse-ring.c b/minimal-examples/http-server/minimal-http-server-sse-ring/minimal-http-server-sse-ring.c\nindex ac9d34f..bdf87a8 100644\n--- a/minimal-examples/http-server/minimal-http-server-sse-ring/minimal-http-server-sse-ring.c\n+++ b/minimal-examples/http-server/minimal-http-server-sse-ring/minimal-http-server-sse-ring.c\n@@ -20,6 +20,7 @@\n #include \u003cstdlib.h\u003e\n #include \u003csignal.h\u003e\n #include \u003cpthread.h\u003e\n+#include \u003ctime.h\u003e\n \n /* one of these created for each message in the ringbuffer */\n \n@@ -56,6 +57,11 @@ struct vhd {\n \n static int interrupted;\n \n+#if defined(WIN32)\n+static void usleep(unsigned long l) { Sleep(l / 1000); }\n+#endif\n+\n+\n /* destroys the message when everyone has had a copy of it */\n \n static void\n@@ -128,6 +134,8 @@ wait:\n \tlwsl_notice(\u0022thread_spam %p exiting\u005cn\u0022, (void *)pthread_self());\n \n \tpthread_exit(NULL);\n+\n+\treturn NULL;\n }\n \n \ndiff --git a/minimal-examples/raw/minimal-raw-adopt-tcp/minimal-raw-adopt-tcp.c b/minimal-examples/raw/minimal-raw-adopt-tcp/minimal-raw-adopt-tcp.c\nindex 6344fd6..34c7e32 100644\n--- a/minimal-examples/raw/minimal-raw-adopt-tcp/minimal-raw-adopt-tcp.c\n+++ b/minimal-examples/raw/minimal-raw-adopt-tcp/minimal-raw-adopt-tcp.c\n@@ -21,16 +21,18 @@\n #include \u003clibwebsockets.h\u003e\n #include \u003cstring.h\u003e\n #include \u003csignal.h\u003e\n+#if !defined(WIN32)\n #include \u003csys/socket.h\u003e\n-#include \u003csys/types.h\u003e\n #include \u003cnetinet/in.h\u003e\n #include \u003cnetdb.h\u003e\n+#include \u003carpa/inet.h\u003e\n+#endif\n+#include \u003csys/types.h\u003e\n #include \u003cstdio.h\u003e\n #include \u003cstring.h\u003e\n #include \u003cstdlib.h\u003e\n #include \u003cunistd.h\u003e\n #include \u003cerrno.h\u003e\n-#include \u003carpa/inet.h\u003e \n \n static int\n callback_raw_test(struct lws *wsi, enum lws_callback_reasons reason,\n@@ -147,7 +149,7 @@ int main(int argc, const char **argv)\n \n \tfor (rp \u003d r; rp; rp \u003d rp-\u003eai_next) {\n \t\tsock.sockfd \u003d socket(rp-\u003eai_family, rp-\u003eai_socktype, rp-\u003eai_protocol);\n-\t\tif (sock.sockfd \u003e\u003d 0)\n+\t\tif (sock.sockfd !\u003d LWS_SOCK_INVALID)\n \t\t\tbreak;\n \t}\n \tif (!rp) {\ndiff --git a/minimal-examples/raw/minimal-raw-adopt-udp/minimal-raw-adopt-udp.c b/minimal-examples/raw/minimal-raw-adopt-udp/minimal-raw-adopt-udp.c\nindex 23a9c5a..0aea5b8 100644\n--- a/minimal-examples/raw/minimal-raw-adopt-udp/minimal-raw-adopt-udp.c\n+++ b/minimal-examples/raw/minimal-raw-adopt-udp/minimal-raw-adopt-udp.c\n@@ -18,16 +18,18 @@\n #include \u003clibwebsockets.h\u003e\n #include \u003cstring.h\u003e\n #include \u003csignal.h\u003e\n+#if !defined(WIN32)\n #include \u003csys/socket.h\u003e\n-#include \u003csys/types.h\u003e\n #include \u003cnetinet/in.h\u003e\n #include \u003cnetdb.h\u003e\n+#include \u003carpa/inet.h\u003e\n+#endif\n+#include \u003csys/types.h\u003e\n #include \u003cstdio.h\u003e\n #include \u003cstring.h\u003e\n #include \u003cstdlib.h\u003e\n #include \u003cunistd.h\u003e\n #include \u003cerrno.h\u003e\n-#include \u003carpa/inet.h\u003e\n \n static uint8_t sendbuf[4096];\n static size_t sendlen;\n@@ -96,7 +98,11 @@ callback_raw_test(struct lws *wsi, enum lws_callback_reasons reason,\n \t\t *\n \t\t * For clarity partial sends just drop the remainder here.\n \t\t */\n-\t\tn \u003d sendto(fd, sendbuf, sendlen, 0, \u0026udp.sa, udp.salen);\n+\t\tn \u003d sendto(fd,\n+#if defined(WIN32)\n+\t\t\t\t(const char *)\n+#endif\n+\t\t\tsendbuf, sendlen, 0, \u0026udp.sa, udp.salen);\n \t\tif (n \u003c (ssize_t)len)\n \t\t\tlwsl_notice(\u0022%s: send returned %d\u005cn\u0022, __func__, (int)n);\n \t\tbreak;\ndiff --git a/minimal-examples/raw/minimal-raw-file/minimal-raw-file.c b/minimal-examples/raw/minimal-raw-file/minimal-raw-file.c\nindex b350554..96ca3e0 100644\n--- a/minimal-examples/raw/minimal-raw-file/minimal-raw-file.c\n+++ b/minimal-examples/raw/minimal-raw-file/minimal-raw-file.c\n@@ -18,7 +18,8 @@\n #include \u003cfcntl.h\u003e\n \n struct raw_vhd {\n-\tlws_sock_file_fd_type u;\n+//\tlws_sock_file_fd_type u;\n+\tint filefd;\n };\n \n static char filepath[256];\n@@ -29,6 +30,7 @@ callback_raw_test(struct lws *wsi, enum lws_callback_reasons reason,\n {\n \tstruct raw_vhd *vhd \u003d (struct raw_vhd *)lws_protocol_vh_priv_get(\n \t\t\t\t lws_get_vhost(wsi), lws_get_protocol(wsi));\n+\tlws_sock_file_fd_type u;\n \tuint8_t buf[1024];\n \tint n;\n \n@@ -36,26 +38,27 @@ callback_raw_test(struct lws *wsi, enum lws_callback_reasons reason,\n \tcase LWS_CALLBACK_PROTOCOL_INIT:\n \t\tvhd \u003d lws_protocol_vh_priv_zalloc(lws_get_vhost(wsi),\n \t\t\t\tlws_get_protocol(wsi), sizeof(struct raw_vhd));\n-\t\tvhd-\u003eu.filefd \u003d lws_open(filepath, O_RDWR);\n-\t\tif (vhd-\u003eu.filefd \u003d\u003d -1) {\n+\t\tvhd-\u003efilefd \u003d lws_open(filepath, O_RDWR);\n+\t\tif (vhd-\u003efilefd \u003d\u003d -1) {\n \t\t\tlwsl_err(\u0022Unable to open %s\u005cn\u0022, filepath);\n \n \t\t\treturn 1;\n \t\t}\n+\t\tu.filefd \u003d (lws_filefd_type)(long long)vhd-\u003efilefd;\n \t\tif (!lws_adopt_descriptor_vhost(lws_get_vhost(wsi),\n-\t\t\t\t\t\tLWS_ADOPT_RAW_FILE_DESC, vhd-\u003eu,\n+\t\t\t\t\t\tLWS_ADOPT_RAW_FILE_DESC, u,\n \t\t\t\t\t\t\u0022raw-test\u0022, NULL)) {\n \t\t\tlwsl_err(\u0022Failed to adopt fifo descriptor\u005cn\u0022);\n-\t\t\tclose(vhd-\u003eu.filefd);\n-\t\t\tvhd-\u003eu.filefd \u003d -1;\n+\t\t\tclose(vhd-\u003efilefd);\n+\t\t\tvhd-\u003efilefd \u003d -1;\n \n \t\t\treturn 1;\n \t\t}\n \t\tbreak;\n \n \tcase LWS_CALLBACK_PROTOCOL_DESTROY:\n-\t\tif (vhd \u0026\u0026 vhd-\u003eu.filefd !\u003d -1)\n-\t\t\tclose(vhd-\u003eu.filefd);\n+\t\tif (vhd \u0026\u0026 vhd-\u003efilefd !\u003d -1)\n+\t\t\tclose(vhd-\u003efilefd);\n \t\tbreak;\n \n \t/* callbacks related to raw file descriptor */\n@@ -66,7 +69,7 @@ callback_raw_test(struct lws *wsi, enum lws_callback_reasons reason,\n \n \tcase LWS_CALLBACK_RAW_RX_FILE:\n \t\tlwsl_notice(\u0022LWS_CALLBACK_RAW_RX_FILE\u005cn\u0022);\n-\t\tn \u003d read(vhd-\u003eu.filefd, buf, sizeof(buf));\n+\t\tn \u003d read(vhd-\u003efilefd, buf, sizeof(buf));\n \t\tif (n \u003c 0) {\n \t\t\tlwsl_err(\u0022Reading from %s failed\u005cn\u0022, filepath);\n \ndiff --git a/minimal-examples/raw/minimal-raw-netcat/minimal-raw-netcat.c b/minimal-examples/raw/minimal-raw-netcat/minimal-raw-netcat.c\nindex ab5b061..5c1f117 100644\n--- a/minimal-examples/raw/minimal-raw-netcat/minimal-raw-netcat.c\n+++ b/minimal-examples/raw/minimal-raw-netcat/minimal-raw-netcat.c\n@@ -16,16 +16,18 @@\n #include \u003clibwebsockets.h\u003e\n #include \u003cstring.h\u003e\n #include \u003csignal.h\u003e\n+#if !defined(WIN32)\n #include \u003csys/socket.h\u003e\n #include \u003csys/types.h\u003e\n #include \u003cnetinet/in.h\u003e\n #include \u003cnetdb.h\u003e\n+#include \u003carpa/inet.h\u003e\n+#endif\n #include \u003cstdio.h\u003e\n #include \u003cstring.h\u003e\n #include \u003cstdlib.h\u003e\n #include \u003cunistd.h\u003e\n #include \u003cerrno.h\u003e\n-#include \u003carpa/inet.h\u003e\n \n static struct lws *raw_wsi, *stdin_wsi;\n static uint8_t buf[LWS_PRE + 4096];\n@@ -202,7 +204,7 @@ int main(int argc, const char **argv)\n \tfor (rp \u003d r; rp; rp \u003d rp-\u003eai_next) {\n \t\tsock.sockfd \u003d socket(rp-\u003eai_family, rp-\u003eai_socktype,\n \t\t\t\t rp-\u003eai_protocol);\n-\t\tif (sock.sockfd \u003e\u003d 0)\n+\t\tif (sock.sockfd !\u003d LWS_SOCK_INVALID)\n \t\t\tbreak;\n \t}\n \tif (!rp) {\ndiff --git a/minimal-examples/ws-client/minimal-ws-client-tx/minimal-ws-client.c b/minimal-examples/ws-client/minimal-ws-client-tx/minimal-ws-client.c\nindex bb7dc8c..00590c4 100644\n--- a/minimal-examples/ws-client/minimal-ws-client-tx/minimal-ws-client.c\n+++ b/minimal-examples/ws-client/minimal-ws-client-tx/minimal-ws-client.c\n@@ -50,6 +50,10 @@ struct per_vhost_data__minimal {\n \tchar established;\n };\n \n+#if defined(WIN32)\n+static void usleep(unsigned long l) { Sleep(l / 1000); }\n+#endif\n+\n static void\n __minimal_destroy_message(void *_msg)\n {\n@@ -113,6 +117,8 @@ wait:\n \tlwsl_notice(\u0022thread_spam %p exiting\u005cn\u0022, (void *)pthread_self());\n \n \tpthread_exit(NULL);\n+\n+\treturn NULL;\n }\n \n static int\ndiff --git a/minimal-examples/ws-server/minimal-ws-server-threads-smp/minimal-ws-server.c b/minimal-examples/ws-server/minimal-ws-server-threads-smp/minimal-ws-server.c\nindex 6e652df..8e454af 100644\n--- a/minimal-examples/ws-server/minimal-ws-server-threads-smp/minimal-ws-server.c\n+++ b/minimal-examples/ws-server/minimal-ws-server-threads-smp/minimal-ws-server.c\n@@ -88,6 +88,8 @@ void *thread_service(void *threadid)\n \t\t;\n \n \tpthread_exit(NULL);\n+\n+\treturn NULL;\n }\n \n void sigint_handler(int sig)\ndiff --git a/minimal-examples/ws-server/minimal-ws-server-threads-smp/protocol_lws_minimal.c b/minimal-examples/ws-server/minimal-ws-server-threads-smp/protocol_lws_minimal.c\nindex 2dbe34d..e3ce9e5 100644\n--- a/minimal-examples/ws-server/minimal-ws-server-threads-smp/protocol_lws_minimal.c\n+++ b/minimal-examples/ws-server/minimal-ws-server-threads-smp/protocol_lws_minimal.c\n@@ -51,6 +51,10 @@ struct per_vhost_data__minimal {\n \tchar finished;\n };\n \n+#if defined(WIN32)\n+static void usleep(unsigned long l) { Sleep(l / 1000); }\n+#endif\n+\n /*\n * This runs under both lws service and \u0022spam threads\u0022 contexts.\n * Access is serialized by vhd-\u003elock_ring.\n@@ -126,6 +130,8 @@ wait:\n \tlwsl_notice(\u0022thread_spam %p exiting\u005cn\u0022, (void *)pthread_self());\n \n \tpthread_exit(NULL);\n+\n+\treturn NULL;\n }\n \n /* this runs under the lws service thread context only */\ndiff --git a/minimal-examples/ws-server/minimal-ws-server-threads/protocol_lws_minimal.c b/minimal-examples/ws-server/minimal-ws-server-threads/protocol_lws_minimal.c\nindex 0537d0c..5e3829b 100644\n--- a/minimal-examples/ws-server/minimal-ws-server-threads/protocol_lws_minimal.c\n+++ b/minimal-examples/ws-server/minimal-ws-server-threads/protocol_lws_minimal.c\n@@ -51,6 +51,10 @@ struct per_vhost_data__minimal {\n \tchar finished;\n };\n \n+#if defined(WIN32)\n+static void usleep(unsigned long l) { Sleep(l / 1000); }\n+#endif\n+\n /*\n * This runs under both lws service and \u0022spam threads\u0022 contexts.\n * Access is serialized by vhd-\u003elock_ring.\n@@ -126,6 +130,8 @@ wait:\n \tlwsl_notice(\u0022thread_spam %p exiting\u005cn\u0022, (void *)pthread_self());\n \n \tpthread_exit(NULL);\n+\n+\treturn NULL;\n }\n \n /* this runs under the lws service thread context only */\ndiff --git a/plugins/deaddrop/protocol_lws_deaddrop.c b/plugins/deaddrop/protocol_lws_deaddrop.c\nindex 9e5c997..9fa851b 100644\n--- a/plugins/deaddrop/protocol_lws_deaddrop.c\n+++ b/plugins/deaddrop/protocol_lws_deaddrop.c\n@@ -259,7 +259,11 @@ file_upload_cb(void *data, const char *name, const char *filename,\n \t\t\tlws_filename_purify_inplace(pss-\u003euser);\n \t\t\tlws_snprintf(pss-\u003efilename, sizeof(pss-\u003efilename),\n \t\t\t\t \u0022%s/%s\u0022, pss-\u003evhd-\u003eupload_dir, pss-\u003euser);\n-\t\t\tif (mkdir(pss-\u003efilename, 0700) \u003c 0)\n+\t\t\tif (mkdir(pss-\u003efilename\n+#if !defined(WIN32)\n+\t\t\t\t, 0700\n+#endif\n+\t\t\t\t) \u003c 0)\n \t\t\t\tlwsl_debug(\u0022%s: mkdir failed\u005cn\u0022, __func__);\n \t\t\tlws_snprintf(pss-\u003efilename, sizeof(pss-\u003efilename),\n \t\t\t\t \u0022%s/%s/%s~\u0022, pss-\u003evhd-\u003eupload_dir,\n@@ -271,7 +275,7 @@ file_upload_cb(void *data, const char *name, const char *filename,\n \n \t\tpss-\u003efd \u003d (lws_filefd_type)(long long)lws_open(pss-\u003efilename,\n \t\t\t O_CREAT | O_TRUNC | O_RDWR, 0600);\n-\t\tif (pss-\u003efd \u003d\u003d -1) {\n+\t\tif (pss-\u003efd \u003d\u003d LWS_INVALID_FILE) {\n \t\t\tpss-\u003eresponse_code \u003d HTTP_STATUS_INTERNAL_SERVER_ERROR;\n \t\t\tlwsl_err(\u0022%s: unable to open %s (errno %d)\u005cn\u0022, __func__,\n \t\t\t\t\tpss-\u003efilename, errno);\n@@ -305,7 +309,7 @@ file_upload_cb(void *data, const char *name, const char *filename,\n \t\tif (state \u003d\u003d LWS_UFS_CONTENT)\n \t\t\tbreak;\n \n-\t\tif ((int)(long long)pss-\u003efd \u003e\u003d 0)\n+\t\tif (pss-\u003efd !\u003d LWS_INVALID_FILE)\n \t\t\tclose((int)(long long)pss-\u003efd);\n \n \t\t/* the temp filename without the ~ */\ndiff --git a/plugins/protocol_lws_status.c b/plugins/protocol_lws_status.c\nindex d77b25a..9003d21 100644\n--- a/plugins/protocol_lws_status.c\n+++ b/plugins/protocol_lws_status.c\n@@ -181,7 +181,7 @@ callback_lws_status(struct lws *wsi, enum lws_callback_reasons reason,\n \t\tcase WALK_FINAL:\n walk_final:\n \t\t\tn \u003d LWS_WRITE_CONTINUATION;\n-\t\t\tp +\u003d sprintf(p, \u0022]}\u0022);\n+\t\t\tp +\u003d lws_snprintf(p, 4, \u0022]}\u0022);\n \t\t\tif (pss-\u003echanged_partway) {\n \t\t\t\tpss-\u003echanged_partway \u003d 0;\n \t\t\t\tpss-\u003esubsequent \u003d 0;\n","s":{"c":1746417185,"u": 7990}} ],"g": 10493,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}