Skip to content

Commit

Permalink
- removed some warnings in windows HAL code
Browse files Browse the repository at this point in the history
  • Loading branch information
mzillgith committed Dec 16, 2023
1 parent c83bad2 commit 6f557c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions hal/filesystem/win32/file_provider_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* See COPYING file for the complete license text.
*/

#define _CRT_SECURE_NO_WARNINGS

#include <stdbool.h>
#include <stdint.h>
#include <string.h>
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions hal/socket/win32/socket_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {

Expand Down Expand Up @@ -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 */

Expand Down
6 changes: 5 additions & 1 deletion hal/thread/win32/thread_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* for libiec61850, libmms, and lib60870.
*/

#define _CRT_SECURE_NO_WARNINGS

#include <windows.h>
#include "lib_memory.h"
#include "hal_thread.h"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6f557c4

Please sign in to comment.