From 0c1253ba4921c2f176e6d20bbd757ad9fb1fca0e Mon Sep 17 00:00:00 2001 From: Daniel Ferguson Date: Wed, 6 Jul 2016 10:58:13 -0700 Subject: [PATCH] Fix warnings in caipserver.c Change-Id: Ibda0f4201d7127043fa66d3d39df6f421f8f7caa Signed-off-by: Daniel Ferguson Reviewed-on: https://gerrit.iotivity.org/gerrit/9199 Tested-by: jenkins-iotivity Reviewed-by: David Antler Reviewed-by: Dave Thaler Reviewed-by: Jon A. Cruz --- resource/csdk/connectivity/api/cacommon.h | 2 +- .../connectivity/src/ip_adapter/caipserver.c | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/resource/csdk/connectivity/api/cacommon.h b/resource/csdk/connectivity/api/cacommon.h index 130c3da1f..58f8744d3 100644 --- a/resource/csdk/connectivity/api/cacommon.h +++ b/resource/csdk/connectivity/api/cacommon.h @@ -139,7 +139,7 @@ typedef char *CAToken_t; #ifdef HAVE_WINSOCK2_H # define OC_SOCKET_ERROR SOCKET_ERROR # define OC_INVALID_SOCKET INVALID_SOCKET -typedef HANDLE CASocketFd_t; +typedef SOCKET CASocketFd_t; #else // HAVE_WINSOCK2_H # define OC_SOCKET_ERROR (-1) # define OC_INVALID_SOCKET (-1) diff --git a/resource/csdk/connectivity/src/ip_adapter/caipserver.c b/resource/csdk/connectivity/src/ip_adapter/caipserver.c index 7e9d2ccf5..360d449a1 100644 --- a/resource/csdk/connectivity/src/ip_adapter/caipserver.c +++ b/resource/csdk/connectivity/src/ip_adapter/caipserver.c @@ -361,7 +361,7 @@ static void CAFindReadyMessage() PUSH_IP_SOCKET(m4, eventArray, socketArray, arraySize); PUSH_IP_SOCKET(m4s, eventArray, socketArray, arraySize); - if (-1 != caglobals.ip.shutdownEvent) + if (WSA_INVALID_EVENT != caglobals.ip.shutdownEvent) { INSERT_SOCKET(OC_INVALID_SOCKET, socketArray, arraySize); PUSH_HANDLE(caglobals.ip.shutdownEvent, eventArray, arraySize); @@ -400,7 +400,7 @@ static void CAFindReadyMessage() } // Break out if shutdownEvent is triggered - if ((caglobals.ip.shutdownEvent != -1) && + if ((caglobals.ip.shutdownEvent != WSA_INVALID_EVENT) && (caglobals.ip.shutdownEvent == eventArray[eventIndex])) { break; @@ -427,7 +427,7 @@ static void CAFindReadyMessage() if (caglobals.ip.terminate) { - caglobals.ip.shutdownEvent = -1; + caglobals.ip.shutdownEvent = WSA_INVALID_EVENT; WSACleanup(); } } @@ -559,7 +559,7 @@ static CAResult_t CAReceiveMessage(CASocketFd_t fd, CATransportFlags_t flags) } WSABUF iov = {.len = sizeof (recvBuffer), .buf = recvBuffer}; - WSAMSG msg = {.name = &srcAddr, + WSAMSG msg = {.name = (PSOCKADDR)&srcAddr, .namelen = namelen, .lpBuffers = &iov, .dwBufferCount = 1, @@ -800,14 +800,8 @@ static void CAInitializeFastShutdownMechanism() caglobals.ip.selectTimeout = -1; // don't poll for shutdown int ret = -1; #if defined(WSA_WAIT_EVENT_0) - caglobals.ip.shutdownEvent = -1; caglobals.ip.shutdownEvent = WSACreateEvent(); - - if (caglobals.ip.shutdownEvent == WSA_INVALID_EVENT) - { - caglobals.ip.shutdownEvent = -1; - } - else + if (WSA_INVALID_EVENT != caglobals.ip.shutdownEvent) { ret = 0; } -- 2.34.1