diff --git a/CMakeLists.txt b/CMakeLists.txt index 7807873..4104cd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ configure_file ( # if (UNIX) set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wextra -Wno-unused-parameter -fprofile-arcs -ftest-coverage -O0 -pthread -DDEBUG=1") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -Wno-unused-parameter -fvisibility=hidden -fvisibility-inlines-hidden -Os -pthread") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -Wno-unused-parameter -fvisibility=hidden -Os -pthread") set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-lgcov") endif() # UNIX diff --git a/platform/platform.h b/platform/platform.h index 0dc23c8..7a72483 100644 --- a/platform/platform.h +++ b/platform/platform.h @@ -5,10 +5,10 @@ /* Sadly we have to have a Windows-ism here */ #if MSVC - typedef uint32_t (__stdcall *PlatformTask)(void *context); + typedef unsigned long (__stdcall *PlatformTask)(void *context); // Use this to define the PlatformTask callback functions to be cross platform - #define PlatformTaskFunc(_name) uint32_t __stdcall _name(void *context) + #define PlatformTaskFunc(_name) unsigned long __stdcall _name(void *context) #else typedef void *(*PlatformTask)(void *context); diff --git a/platform/windows.c b/platform/windows.c index 538d785..2188cdd 100644 --- a/platform/windows.c +++ b/platform/windows.c @@ -61,7 +61,7 @@ PlatformTaskFunc(timer_task) { PlatformStatusCode platform_init(MQTTHandle *handle) { handle->platform = (PlatformData *)calloc(1, sizeof(struct _PlatformData)); - handle->platform->sock = -1; + handle->platform->sock = INVALID_SOCKET; handle->platform->timer_task = -1; if (!handle->platform) { return PlatformStatusError; @@ -257,10 +257,10 @@ PlatformStatusCode platform_write(MQTTHandle *handle, Buffer *buffer) { PlatformStatusCode platform_disconnect(MQTTHandle *handle) { PlatformData *p = handle->platform; - if (p->sock >= 0) { + if (p->sock != INVALID_SOCKET) { closesocket(p->sock); WSACleanup(); - p->sock = -1; + p->sock = INVALID_SOCKET; } return PlatformStatusOk;