1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

solve compilation problems on vs2012

This commit is contained in:
hjfbswb 2019-07-31 16:31:22 +08:00 committed by Andy Green
parent a60e60bc29
commit 119fddbacb
4 changed files with 23 additions and 3 deletions

View file

@ -807,6 +807,7 @@ CHECK_INCLUDE_FILE(vfork.h LWS_HAVE_VFORK_H)
CHECK_INCLUDE_FILE(sys/capability.h LWS_HAVE_SYS_CAPABILITY_H)
CHECK_INCLUDE_FILE(malloc.h LWS_HAVE_MALLOC_H)
CHECK_INCLUDE_FILE(pthread.h LWS_HAVE_PTHREAD_H)
CHECK_INCLUDE_FILE(inttypes.h LWS_HAVE_INTTYPES_H)
CHECK_LIBRARY_EXISTS(cap cap_set_flag "" LWS_HAVE_LIBCAP)

View file

@ -119,3 +119,8 @@
#cmakedefine LWS_WITH_ZLIB
#cmakedefine LWS_HAS_PTHREAD_SETNAME_NP
/* Defined if you have the <inttypes.h> header file. */
#cmakedefine LWS_HAVE_INTTYPES_H
#cmakedefine LWS_HAVE_SNPRINTF
#cmakedefine LWS_HAVE__SNPRINTF

View file

@ -40,7 +40,21 @@
#include <ctype.h>
#include <limits.h>
#include <stdarg.h>
#ifdef LWS_HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if defined(WIN32) || defined(_WIN32)
#ifndef LWS_HAVE_SNPRINTF // no snprintf
#ifdef LWS_HAVE__SNPRINTF // has _snprintf
#define snprintf _snprintf
#else
#error "no snprintf to use"
#endif
#endif
#endif
#include <assert.h>
#ifdef LWS_HAVE_SYS_TYPES_H

View file

@ -35,6 +35,8 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
unsigned int i;
DWORD ev;
int n;
unsigned int eIdx;
int interrupt_requested;
/* stay dead once we are dead */
if (context == NULL || !context->vhost_list)
@ -138,7 +140,7 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
ev = WSAWaitForMultipleEvents(1, &pt->events, FALSE, timeout_ms, FALSE);
if (ev == WSA_WAIT_EVENT_0) {
EnterCriticalSection(&pt->interrupt_lock);
const int interrupt_requested = pt->interrupt_requested;
interrupt_requested = pt->interrupt_requested;
pt->interrupt_requested = 0;
LeaveCriticalSection(&pt->interrupt_lock);
if(interrupt_requested) {
@ -146,8 +148,6 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
return 0;
}
unsigned int eIdx;
#if defined(LWS_WITH_TLS)
if (pt->context->tls_ops &&
pt->context->tls_ops->fake_POLLIN_for_buffered)