From 6f557c490f0b46ab5d7ef1b01bb3bc9fab3f442f Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Sat, 16 Dec 2023 07:38:48 +0000 Subject: [PATCH] - removed some warnings in windows HAL code --- hal/filesystem/win32/file_provider_win32.c | 6 ++++-- hal/socket/win32/socket_win32.c | 6 +++--- hal/thread/win32/thread_win32.c | 6 +++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/hal/filesystem/win32/file_provider_win32.c b/hal/filesystem/win32/file_provider_win32.c index b51a1a456..f5db69a44 100644 --- a/hal/filesystem/win32/file_provider_win32.c +++ b/hal/filesystem/win32/file_provider_win32.c @@ -21,6 +21,8 @@ * See COPYING file for the complete license text. */ +#define _CRT_SECURE_NO_WARNINGS + #include #include #include @@ -62,13 +64,13 @@ FileSystem_openFile(char* fileName, bool readWrite) int FileSystem_readFile(FileHandle handle, uint8_t* buffer, int maxSize) { - return fread(buffer, 1, maxSize, (FILE*) handle); + return (int)fread(buffer, 1, maxSize, (FILE*) handle); } int FileSystem_writeFile(FileHandle handle, uint8_t* buffer, int size) { - return fwrite(buffer, 1, size, (FILE*) handle); + return (int)fwrite(buffer, 1, size, (FILE*) handle); } void diff --git a/hal/socket/win32/socket_win32.c b/hal/socket/win32/socket_win32.c index 65be99d7e..46a40d49a 100644 --- a/hal/socket/win32/socket_win32.c +++ b/hal/socket/win32/socket_win32.c @@ -105,7 +105,7 @@ Handleset_waitReady(HandleSet self, unsigned int timeoutMs) memcpy((void*)&handles, &(self->handles), sizeof(fd_set)); - result = select(self->maxHandle + 1, &handles, NULL, NULL, &timeout); + result = select(0, &handles, NULL, NULL, &timeout); } else { result = -1; } @@ -436,7 +436,7 @@ Socket_checkAsyncConnectState(Socket self) FD_ZERO(&fdSet); FD_SET(self->fd, &fdSet); - int selectVal = select(self->fd + 1, NULL, &fdSet , NULL, &timeout); + int selectVal = select(0, NULL, &fdSet , NULL, &timeout); if (selectVal == 1) { @@ -489,7 +489,7 @@ Socket_connect(Socket self, const char* address, int port) FD_ZERO(&fdSet); FD_SET(self->fd, &fdSet); - if (select(self->fd + 1, NULL, &fdSet , NULL, &timeout) == 1) { + if (select(0, NULL, &fdSet , NULL, &timeout) == 1) { /* Check if connection is established */ diff --git a/hal/thread/win32/thread_win32.c b/hal/thread/win32/thread_win32.c index 7b17401de..33e7f0919 100644 --- a/hal/thread/win32/thread_win32.c +++ b/hal/thread/win32/thread_win32.c @@ -7,6 +7,8 @@ * for libiec61850, libmms, and lib60870. */ +#define _CRT_SECURE_NO_WARNINGS + #include #include "lib_memory.h" #include "hal_thread.h" @@ -38,7 +40,9 @@ threadRunner(LPVOID parameter) { Thread thread = (Thread) parameter; - return (UINT) thread->function(thread->parameter); + thread->function(thread->parameter); + + return (DWORD)0; } Thread