From f0538915a63326d3c21a0250981a8c2100e5daee Mon Sep 17 00:00:00 2001 From: Georg Schwab Date: Wed, 20 Oct 2021 11:56:18 +0200 Subject: [PATCH 1/2] fixed some compilation errors when compiling using clang-cl under Windows --- osal/win32/osal.c | 8 ++++---- osal/win32/osal_win32.h | 1 + oshw/win32/oshw.c | 1 - oshw/win32/wpcap/Include/pcap-stdinc.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osal/win32/osal.c b/osal/win32/osal.c index d744fea7..9b635ca1 100644 --- a/osal/win32/osal.c +++ b/osal/win32/osal.c @@ -130,9 +130,9 @@ void osal_free(void *ptr) free(ptr); } -int osal_thread_create(void **thandle, int stacksize, void *func, void *param) +int osal_thread_create(void *thandle, int stacksize, void *func, void *param) { - *thandle = CreateThread(NULL, stacksize, func, param, 0, NULL); + *(void **)thandle = CreateThread(NULL, stacksize, func, param, 0, NULL); if(!thandle) { return 0; @@ -140,13 +140,13 @@ int osal_thread_create(void **thandle, int stacksize, void *func, void *param) return 1; } -int osal_thread_create_rt(void **thandle, int stacksize, void *func, void *param) +int osal_thread_create_rt(void *thandle, int stacksize, void *func, void *param) { int ret; ret = osal_thread_create(thandle, stacksize, func, param); if (ret) { - ret = SetThreadPriority(*thandle, THREAD_PRIORITY_TIME_CRITICAL); + ret = SetThreadPriority(*(void **)thandle, THREAD_PRIORITY_TIME_CRITICAL); } return ret; } diff --git a/osal/win32/osal_win32.h b/osal/win32/osal_win32.h index b1c87ffc..2b89f1fe 100644 --- a/osal/win32/osal_win32.h +++ b/osal/win32/osal_win32.h @@ -29,6 +29,7 @@ } \ } while (0) +struct timezone; int osal_gettimeofday (struct timeval *tv, struct timezone *tz); #endif diff --git a/oshw/win32/oshw.c b/oshw/win32/oshw.c index c217baa9..247887ec 100644 --- a/oshw/win32/oshw.c +++ b/oshw/win32/oshw.c @@ -35,7 +35,6 @@ uint16 oshw_ntohs (uint16 network) ec_adaptert * oshw_find_adapters (void) { int i = 0; - int ret = 0; pcap_if_t *alldevs; pcap_if_t *d; ec_adaptert * adapter; diff --git a/oshw/win32/wpcap/Include/pcap-stdinc.h b/oshw/win32/wpcap/Include/pcap-stdinc.h index 46100ccc..c48d77ec 100644 --- a/oshw/win32/wpcap/Include/pcap-stdinc.h +++ b/oshw/win32/wpcap/Include/pcap-stdinc.h @@ -55,7 +55,7 @@ #include #ifndef __MINGW32__ -#include "IP6_misc.h" +#include "ip6_misc.h" #endif #define caddr_t char* From 183e395f81fef8739b934d4be2ec328cf39d0dd6 Mon Sep 17 00:00:00 2001 From: Adit Makwana Date: Wed, 26 Oct 2022 10:41:54 +0200 Subject: [PATCH 2/2] add suggested fix --- osal/win32/osal.c | 10 ++++++---- osal/win32/osal_win32.h | 3 --- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/osal/win32/osal.c b/osal/win32/osal.c index 9b635ca1..fe0fd04b 100644 --- a/osal/win32/osal.c +++ b/osal/win32/osal.c @@ -132,8 +132,9 @@ void osal_free(void *ptr) int osal_thread_create(void *thandle, int stacksize, void *func, void *param) { - *(void **)thandle = CreateThread(NULL, stacksize, func, param, 0, NULL); - if(!thandle) + PHANDLE phandle = thandle; + *phandle = CreateThread(NULL, stacksize, func, param, 0, NULL); + if(*phandle != NULL) { return 0; } @@ -143,10 +144,11 @@ int osal_thread_create(void *thandle, int stacksize, void *func, void *param) int osal_thread_create_rt(void *thandle, int stacksize, void *func, void *param) { int ret; - ret = osal_thread_create(thandle, stacksize, func, param); + PHANDLE phandle = thandle; + ret = osal_thread_create(phandle, stacksize, func, param); if (ret) { - ret = SetThreadPriority(*(void **)thandle, THREAD_PRIORITY_TIME_CRITICAL); + ret = SetThreadPriority(*phandle, THREAD_PRIORITY_TIME_CRITICAL); } return ret; } diff --git a/osal/win32/osal_win32.h b/osal/win32/osal_win32.h index 2b89f1fe..d17d20d0 100644 --- a/osal/win32/osal_win32.h +++ b/osal/win32/osal_win32.h @@ -29,7 +29,4 @@ } \ } while (0) -struct timezone; -int osal_gettimeofday (struct timeval *tv, struct timezone *tz); - #endif