fix function signature in catcpadapter.c
authorHauke Mehrtens <hauke@hauke-m.de>
Sat, 3 Oct 2015 14:08:00 +0000 (16:08 +0200)
committerPatrick Lankswert <patrick.lankswert@intel.com>
Mon, 5 Oct 2015 13:25:53 +0000 (13:25 +0000)
The uint32_t and size_t type were mixed up in this file, this could
make the compiler generate code which would prepare the stack in a
different way the function expects it to be prepared and this will
cause some strange runtime problems.

Change-Id: I7665ce9e1bacc25bc367f2d64ff1775253db0454
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3451
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
resource/csdk/connectivity/src/tcp_adapter/catcpadapter.c

index 31eca32..fb8bfd8 100644 (file)
@@ -23,6 +23,9 @@
 #include <string.h>
 #include <stdint.h>
 
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
+
 #include "catcpadapter.h"
 #include "catcpinterface.h"
 #include "caqueueingthread.h"
@@ -75,7 +78,7 @@ static CANetworkChangeCallback g_networkChangeCallback = NULL;
 static CAErrorHandleCallback g_errorCallback = NULL;
 
 static void CATCPPacketReceivedCB(const CAEndpoint_t *endpoint,
-                                  const void *data, size_t dataLength);
+                                  const void *data, uint32_t dataLength);
 
 static CAResult_t CATCPInitializeQueueHandles();
 
@@ -88,7 +91,7 @@ static CATCPData *CACreateTCPData(const CAEndpoint_t *remoteEndpoint,
                                   bool isMulticast);
 void CAFreeTCPData(CATCPData *ipData);
 
-static void CADataDestroyer(void *data, size_t size);
+static void CADataDestroyer(void *data, uint32_t size);
 
 CAResult_t CATCPInitializeQueueHandles()
 {
@@ -142,7 +145,7 @@ void CATCPConnectionStateCB(const char *ipAddress, CANetworkStatus_t status)
 }
 
 void CATCPPacketReceivedCB(const CAEndpoint_t *endpoint, const void *data,
-                           size_t dataLength)
+                           uint32_t dataLength)
 {
     OIC_LOG(DEBUG, TAG, "IN");
 
@@ -159,7 +162,7 @@ void CATCPPacketReceivedCB(const CAEndpoint_t *endpoint, const void *data,
 }
 
 void CATCPErrorHandler(const CAEndpoint_t *endpoint, const void *data,
-                       size_t dataLength, CAResult_t result)
+                       uint32_t dataLength, CAResult_t result)
 {
     OIC_LOG(DEBUG, TAG, "IN");
 
@@ -428,11 +431,11 @@ void CAFreeTCPData(CATCPData *TCPData)
     OICFree(TCPData);
 }
 
-void CADataDestroyer(void *data, size_t size)
+void CADataDestroyer(void *data, uint32_t size)
 {
     if (size < sizeof(CATCPData))
     {
-        OIC_LOG_V(ERROR, TAG, "Destroy data too small %p %d", data, size);
+        OIC_LOG_V(ERROR, TAG, "Destroy data too small %p %" PRIu32, data, size);
     }
     CATCPData *TCPData = (CATCPData *) data;