diff --git a/lib/crypto/c_src/crypto_callback.c b/lib/crypto/c_src/crypto_callback.c index 53b4bbf1e0a7..e62bc17d4072 100644 --- a/lib/crypto/c_src/crypto_callback.c +++ b/lib/crypto/c_src/crypto_callback.c @@ -231,11 +231,10 @@ DLLEXPORT struct crypto_callbacks* get_crypto_callbacks(int nlocks) #ifdef HAVE_DYNAMIC_CRYPTO_LIB /* This is not really a NIF library, but we use ERL_NIF_INIT in order to * get access to the erl_nif API (on Windows). + * + * Unused 'dummy_funcv' has size 1 to avoid warning "sizeof returns 0". */ -static struct { - int dummy__; - ErlNifFunc funcv[0]; -} empty; -ERL_NIF_INIT(dummy, empty.funcv, NULL, NULL, NULL, NULL) +ErlNifFunc dummy_funcv[1]; +ERL_NIF_INIT(dummy, dummy_funcv, NULL, NULL, NULL, NULL) #endif diff --git a/lib/erl_interface/src/prog/erl_call.c b/lib/erl_interface/src/prog/erl_call.c index 6ce6ed1c732a..74750d78de8e 100644 --- a/lib/erl_interface/src/prog/erl_call.c +++ b/lib/erl_interface/src/prog/erl_call.c @@ -976,7 +976,7 @@ static DWORD WINAPI timer_thread(void *data) { } static void start_timeout(int timeout) { - if (CreateThread(NULL, 0, timer_thread, (void*)timeout, 0, NULL) == NULL) { + if (CreateThread(NULL, 0, timer_thread, (void*)(DWORD_PTR)timeout, 0, NULL) == NULL) { fprintf(stderr,"erl_call: Failed to start timer thread\n"); exit(1); } diff --git a/lib/os_mon/c_src/win32sysinfo.c b/lib/os_mon/c_src/win32sysinfo.c index 85622e00760d..bd51bf6777fb 100644 --- a/lib/os_mon/c_src/win32sysinfo.c +++ b/lib/os_mon/c_src/win32sysinfo.c @@ -150,7 +150,9 @@ void output_drive_info(char* drive){ } else if (fpGetDiskFreeSpaceEx(drive,&availbytes,&totbytes,&totbytesfree)){ - sprintf(answer,"%s DRIVE_FIXED %I64u %I64u %I64u\n",drive,availbytes,totbytes,totbytesfree); + sprintf(answer,"%s DRIVE_FIXED %I64u %I64u %I64u\n", + drive, availbytes.QuadPart, totbytes.QuadPart, + totbytesfree.QuadPart); return_answer(answer); } else { diff --git a/lib/runtime_tools/c_src/trace_ip_drv.c b/lib/runtime_tools/c_src/trace_ip_drv.c index c6f42b3b5256..1774657d1001 100644 --- a/lib/runtime_tools/c_src/trace_ip_drv.c +++ b/lib/runtime_tools/c_src/trace_ip_drv.c @@ -50,8 +50,13 @@ # define ASSERT(X) #endif -#define sock2event(s) ((ErlDrvEvent)(long)(s)) -#define event2sock(p) ((SOCKET)(long)(p)) +#ifdef __WIN32__ +# define sock2event(s) ((ErlDrvEvent)(INT_PTR)(s)) +# define event2sock(p) ((SOCKET)(INT_PTR)(p)) +#else +# define sock2event(s) ((ErlDrvEvent)(long)(s)) +# define event2sock(p) ((SOCKET)(long)(p)) +#endif #include "erl_driver.h" @@ -432,7 +437,7 @@ static void trace_ip_ready_input(ErlDrvData handle, ErlDrvEvent fd) * but better make sure. */ - if ((SOCKET)(long)fd == data->fd) { + if (event2sock(fd) == data->fd) { #ifdef __WIN32__ close_client(data); #else @@ -496,7 +501,7 @@ static void trace_ip_ready_output(ErlDrvData handle, ErlDrvEvent fd) ASSERT(!(data->flags & FLAG_LISTEN_PORT) && data->que[data->questart] != NULL && - (SOCKET)(long)fd == data->fd); + event2sock(fd) == data->fd); tim = data->que[data->questart]; towrite = tim->siz - tim->written; @@ -906,7 +911,7 @@ static int my_driver_select(TraceIpData *desc, SOCKET fd, int flags, enum MySele static void stop_select(ErlDrvEvent event, void* _) { - closesocket((SOCKET)(long)event); + closesocket(event2sock(event)); } #endif /* !__WIN32__ */