Made changes required to get the RI layer to build properly for Arduino.
authorJoseph Morrow <joseph.l.morrow@intel.com>
Thu, 19 Mar 2015 16:43:04 +0000 (12:43 -0400)
committerErich Keane <erich.keane@intel.com>
Thu, 19 Mar 2015 17:58:58 +0000 (17:58 +0000)
Changes made in the RI Code Review(49ead758a03c532e7c95f5b6eb88c1d979cd36a0)
introduced build warnings on Linux. Due to the use of an older and more
verbose compiler when building for Arduino, these warnings are errors in the
build process for Arduino. This commit enables Arduino compilation by fixing
those errors.

Change-Id: I36643b4769a65badad5fc69b6fc18dbce18e22fa
Signed-off-by: Joseph Morrow <joseph.l.morrow@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/515
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/stack/src/occollection.c
resource/csdk/stack/src/ocobserve.c
resource/csdk/stack/src/ocstack.c

index 5a8aa8a..2156ee4 100644 (file)
@@ -24,6 +24,7 @@
 #include "ocstackinternal.h"
 #include "ocresourcehandler.h"
 #include "logger.h"
+#include "ocmalloc.h"
 #include "cJSON.h"
 /// Module Name
 #include <stdio.h>
index ef5e42e..69e0c38 100644 (file)
@@ -50,7 +50,7 @@ OCQualityOfService DetermineObserverQoS(OCMethod method, ResourceObserver * reso
     if(!resourceObserver)
     {
         OC_LOG(ERROR, TAG, "DetermineObserverQoS called with invalid resourceObserver");
-        return -1;
+        return OC_NA_QOS;
     }
 
     OCQualityOfService decidedQoS = appQoS;
index 01a1424..2cc1388 100644 (file)
@@ -405,6 +405,7 @@ OCStackResult HandlePresenceResponse(const CARemoteEndpoint_t* endPoint,
     char *ipAddress = NULL;
     int presenceSubscribe = 0;
     int multicastPresenceSubscribe = 0;
+    size_t addressLen = 0;
 
     if (responseInfo->result != CA_SUCCESS)
     {
@@ -421,7 +422,7 @@ OCStackResult HandlePresenceResponse(const CARemoteEndpoint_t* endPoint,
         goto exit;
     }
 
-    size_t addressLen = strlen(endPoint->addressInfo.IP.ipAddress);
+    addressLen = strlen(endPoint->addressInfo.IP.ipAddress);
     ipAddress = (char *) OCMalloc(addressLen + 1);
 
     if(NULL == ipAddress)
@@ -3521,6 +3522,7 @@ OCStackResult getQueryFromUri(const char * uri, char** query, char ** newURI)
     {
         return OC_STACK_INVALID_PARAM;
     }
+    char* strTokPtr = NULL;
     char * leftToken = NULL;
     char * tempURI = (char *) OCMalloc(strlen(uri) + 1);
     if(!tempURI)
@@ -3528,7 +3530,7 @@ OCStackResult getQueryFromUri(const char * uri, char** query, char ** newURI)
         goto exit;
     }
     strcpy(tempURI, uri);
-    char* strTokPtr = NULL;
+    strTokPtr = NULL;
     leftToken = strtok_r(tempURI, "?", &strTokPtr);
 
     //TODO-CA: This could be simplified. Clean up required.