More warnings eliminated on windows

This commit is contained in:
Johannes Schriewer 2018-08-05 19:00:50 +02:00
parent 57d765acd9
commit 414bf7238d
3 changed files with 6 additions and 6 deletions

View file

@ -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

View file

@ -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);

View file

@ -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;