Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
0857-Fix-various-Windows-compile-warnings.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0857-Fix-various-Windows-compile-warnings.patch of Package erlang
From 386e91ba9c2826292b3ff5afb41b642a126a8a6f Mon Sep 17 00:00:00 2001 From: Sverker Eriksson <sverker@erlang.org> Date: Thu, 14 Sep 2023 16:33:05 +0200 Subject: [PATCH] Fix various Windows compile warnings --- lib/crypto/c_src/crypto_callback.c | 9 ++++----- lib/erl_interface/src/prog/erl_call.c | 2 +- lib/os_mon/c_src/win32sysinfo.c | 4 +++- lib/runtime_tools/c_src/trace_ip_drv.c | 15 ++++++++++----- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/lib/crypto/c_src/crypto_callback.c b/lib/crypto/c_src/crypto_callback.c index 53b4bbf1e0..e62bc17d40 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 6ce6ed1c73..74750d78de 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 85622e0076..bd51bf6777 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 c6f42b3b52..1774657d10 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__ */ -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor