Fix warnings in caipserver.c
authorDaniel Ferguson <daniel.j.ferguson@intel.com>
Wed, 6 Jul 2016 17:58:13 +0000 (10:58 -0700)
committerJon A. Cruz <jon@joncruz.org>
Thu, 14 Jul 2016 20:52:14 +0000 (20:52 +0000)
Change-Id: Ibda0f4201d7127043fa66d3d39df6f421f8f7caa
Signed-off-by: Daniel Ferguson <daniel.j.ferguson@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/9199
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: David Antler <david.a.antler@intel.com>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
Reviewed-by: Jon A. Cruz <jon@joncruz.org>
resource/csdk/connectivity/api/cacommon.h
resource/csdk/connectivity/src/ip_adapter/caipserver.c

index 130c3da1f01642e68144d1cb0a16321c3d79d9e6..58f8744d37193ad959afa6163e9d9615faf55652 100644 (file)
@@ -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)
index 7e9d2ccf51452d5ead32dfece044b1fdcf715418..360d449a1d1fe02362b82c2bf59165cb5f9b8c7a 100644 (file)
@@ -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;
     }