mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
mingw: libevent build fixes
This commit is contained in:
parent
a1335d672b
commit
43f94f4a8e
5 changed files with 32 additions and 28 deletions
|
@ -29,7 +29,7 @@
|
|||
#define wsi_to_priv_event(_w) ((struct lws_wsi_eventlibs_libevent *)(_w)->evlib_wsi)
|
||||
|
||||
static void
|
||||
lws_event_hrtimer_cb(int fd, short event, void *p)
|
||||
lws_event_hrtimer_cb(evutil_socket_t fd, short event, void *p)
|
||||
{
|
||||
struct lws_context_per_thread *pt = (struct lws_context_per_thread *)p;
|
||||
struct lws_pt_eventlibs_libevent *ptpr = pt_to_priv_event(pt);
|
||||
|
@ -48,7 +48,7 @@ lws_event_hrtimer_cb(int fd, short event, void *p)
|
|||
}
|
||||
|
||||
static void
|
||||
lws_event_idle_timer_cb(int fd, short event, void *p)
|
||||
lws_event_idle_timer_cb(evutil_socket_t fd, short event, void *p)
|
||||
{
|
||||
struct lws_context_per_thread *pt = (struct lws_context_per_thread *)p;
|
||||
struct lws_pt_eventlibs_libevent *ptpr = pt_to_priv_event(pt);
|
||||
|
@ -255,7 +255,7 @@ elops_accept_event(struct lws *wsi)
|
|||
struct lws_context_per_thread *pt;
|
||||
struct lws_pt_eventlibs_libevent *ptpr;
|
||||
struct lws_wsi_eventlibs_libevent *wpr = wsi_to_priv_event(wsi);
|
||||
int fd;
|
||||
evutil_socket_t fd;
|
||||
|
||||
wpr->w_read.context = context;
|
||||
wpr->w_write.context = context;
|
||||
|
@ -265,7 +265,7 @@ elops_accept_event(struct lws *wsi)
|
|||
ptpr = pt_to_priv_event(pt);
|
||||
|
||||
if (wsi->role_ops->file_handle)
|
||||
fd = wsi->desc.filefd;
|
||||
fd = (ev_intptr_t) wsi->desc.filefd;
|
||||
else
|
||||
fd = wsi->desc.sockfd;
|
||||
|
||||
|
@ -404,7 +404,7 @@ elops_init_vhost_listen_wsi_event(struct lws *wsi)
|
|||
struct lws_context_per_thread *pt;
|
||||
struct lws_pt_eventlibs_libevent *ptpr;
|
||||
struct lws_wsi_eventlibs_libevent *w;
|
||||
int fd;
|
||||
evutil_socket_t fd;
|
||||
|
||||
if (!wsi) {
|
||||
assert(0);
|
||||
|
@ -420,7 +420,7 @@ elops_init_vhost_listen_wsi_event(struct lws *wsi)
|
|||
ptpr = pt_to_priv_event(pt);
|
||||
|
||||
if (wsi->role_ops->file_handle)
|
||||
fd = wsi->desc.filefd;
|
||||
fd = (evutil_socket_t) wsi->desc.filefd;
|
||||
else
|
||||
fd = wsi->desc.sockfd;
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ if (LWS_WITH_SPAWN)
|
|||
endif()
|
||||
|
||||
if (LWS_WITH_ZLIB AND LWS_WITH_BUNDLED_ZLIB)
|
||||
set(WIN32_ZLIB_PATH "win32port/zlib")
|
||||
set(WIN32_ZLIB_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../win32port/zlib")
|
||||
set(ZLIB_SRCS
|
||||
${WIN32_ZLIB_PATH}/adler32.c
|
||||
${WIN32_ZLIB_PATH}/compress.c
|
||||
|
@ -68,7 +68,7 @@ if (LWS_WITH_ZLIB AND LWS_WITH_BUNDLED_ZLIB)
|
|||
${WIN32_ZLIB_PATH}/zutil.c)
|
||||
add_library(zlib_internal STATIC ${ZLIB_SRCS})
|
||||
set(ZLIB_INCLUDE_DIRS ${WIN32_ZLIB_PATH})
|
||||
get_property(ZLIB_LIBRARIES TARGET zlib_internal PROPERTY LOCATION)
|
||||
set(ZLIB_LIBRARIES "")
|
||||
set(ZLIB_FOUND 1)
|
||||
# Make sure zlib_internal is compiled before the libs.
|
||||
foreach (lib ${LWS_LIBRARIES})
|
||||
|
|
|
@ -197,7 +197,7 @@ lws_client_socket_service(struct lws *wsi, struct lws_pollfd *pollfd)
|
|||
|
||||
lws_set_timeout(wsi, NO_PENDING_TIMEOUT, 0);
|
||||
|
||||
/* fallthru */
|
||||
/* fallthrough */
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#include <time.h>
|
||||
#include <windows.h> //I've omitted context line
|
||||
|
||||
#include "gettimeofday.h"
|
||||
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
FILETIME ft;
|
||||
#include <time.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "gettimeofday.h"
|
||||
|
||||
#ifndef LWS_MINGW_SUPPORT
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
FILETIME ft;
|
||||
unsigned __int64 tmpres = 0;
|
||||
static int tzflag;
|
||||
|
||||
|
@ -19,11 +20,11 @@ int gettimeofday(struct timeval *tv, struct timezone *tz)
|
|||
/*converting file time to unix epoch*/
|
||||
tmpres /= 10; /*convert into microseconds*/
|
||||
tmpres -= DELTA_EPOCH_IN_MICROSECS;
|
||||
tv->tv_sec = (long)(tmpres / 1000000UL);
|
||||
tv->tv_usec = (long)(tmpres % 1000000UL);
|
||||
}
|
||||
|
||||
if (NULL != tz) {
|
||||
tv->tv_sec = (long)(tmpres / 1000000UL);
|
||||
tv->tv_usec = (long)(tmpres % 1000000UL);
|
||||
}
|
||||
|
||||
if (NULL != tz) {
|
||||
if (!tzflag) {
|
||||
_tzset();
|
||||
tzflag++;
|
||||
|
@ -31,6 +32,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz)
|
|||
tz->tz_minuteswest = _timezone / 60;
|
||||
tz->tz_dsttime = _daylight;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
#endif
|
||||
|
||||
#ifdef LWS_MINGW_SUPPORT
|
||||
#include <winsock2.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifndef _TIMEZONE_DEFINED
|
||||
struct timezone
|
||||
#ifndef _TIMEZONE_DEFINED
|
||||
struct timezone
|
||||
{
|
||||
int tz_minuteswest; /* minutes W of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
|
@ -22,6 +22,8 @@ struct timezone
|
|||
|
||||
#endif
|
||||
|
||||
#ifndef LWS_MINGW_SUPPORT
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue