Clean compilar warnings
authorGeorge Nash <george.nash@intel.com>
Fri, 5 Aug 2016 18:40:34 +0000 (11:40 -0700)
committerJon A. Cruz <jon@joncruz.org>
Thu, 25 Aug 2016 21:57:22 +0000 (21:57 +0000)
[unused-variable] warning removed from
    policyengine.c
    caipserver.c
    ocresource.c
[unused-but-set-variable] warning removed from
    psinterface.c
    policyengine.c
[return-type] warning removed from
    psinterface.c
[sign-compare] warning removed from
    doxmresource.c

Change-Id: I44b633871e78a2baf9d0595dff926834581160c9
Signed-off-by: George Nash <george.nash@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10087
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jon A. Cruz <jon@joncruz.org>
resource/csdk/connectivity/src/ip_adapter/caipserver.c
resource/csdk/security/src/credresource.c
resource/csdk/security/src/doxmresource.c
resource/csdk/security/src/policyengine.c
resource/csdk/security/src/psinterface.c
resource/csdk/stack/src/ocresource.c

index 2cd8e00..e922634 100644 (file)
@@ -1206,6 +1206,7 @@ static void sendData(int fd, const CAEndpoint_t *endpoint,
 
     char *secure = (endpoint->flags & CA_SECURE) ? "secure " : "";
 
+    (void)secure; // eliminates unused-variable waring when built in release mode
     (void)cast;  // eliminates release warning
     (void)fam;
 
index 2f32092..47d1aed 100644 (file)
@@ -1382,6 +1382,7 @@ static OCEntityHandlerResult HandlePostRequest(const OCEntityHandlerRequest * eh
          * list and updating svr database.
          */
         ret = (OC_STACK_OK == AddCredential(cred))? OC_EH_CHANGED : OC_EH_ERROR;
+        OC_UNUSED(previousMsgId);
 #endif//__WITH_DTLS__
     }
 
index ccd98ec..9aac585 100644 (file)
@@ -414,8 +414,7 @@ static OCStackResult CBORPayloadToDoxmBin(const uint8_t *cborPayload, size_t siz
         doxm->oxm = (OicSecOxm_t *) OICCalloc(gDoxm->oxmLen, sizeof(*doxm->oxm));
         VERIFY_NON_NULL(TAG, doxm->oxm, ERROR);
         doxm->oxmLen = gDoxm->oxmLen;
-        int i;
-        for (i = 0; i < gDoxm->oxmLen; i++)
+        for (size_t i = 0; i < gDoxm->oxmLen; i++)
         {
             doxm->oxm[i] = gDoxm->oxm[i];
         }
index 2f93169..3dd424d 100644 (file)
@@ -125,7 +125,6 @@ void SetPolicyEngineState(PEContext_t *context, const PEState_t state)
 static bool IsRequestFromDevOwner(PEContext_t *context)
 {
     bool retVal = false;
-    OicUuid_t ownerid;
 
     if(NULL == context)
     {
@@ -158,18 +157,21 @@ static bool IsRequestFromDevOwner(PEContext_t *context)
 
 OCStackResult GetCrlRownerId(OicUuid_t *rowner)
 {
+    OC_UNUSED(rowner);
     rowner = NULL;
     return OC_STACK_ERROR;
 }
 
 OCStackResult GetSaclRownerId(OicUuid_t *rowner)
 {
+    OC_UNUSED(rowner);
     rowner = NULL;
     return OC_STACK_ERROR;
 }
 
 OCStackResult GetSvcRownerId(OicUuid_t *rowner)
 {
+    OC_UNUSED(rowner);
     rowner = NULL;
     return OC_STACK_ERROR;
 }
index c24ecde..d660058 100644 (file)
@@ -558,6 +558,7 @@ exit:
     OICFree(pstatCbor);
     OICFree(doxmCbor);
     OICFree(resetPfCbor);
+    return ret;
 }
 
 /**
index ff04990..e5323e6 100755 (executable)
@@ -342,8 +342,8 @@ OCStackResult BuildVirtualResourceResponse(const OCResource *resourcePtr,
         securePort = devAddr->port;
     }
 
-    uint16_t tcpPort = 0;
 #ifdef TCP_ADAPTER
+    uint16_t tcpPort = 0;
     if (GetTCPPortInfo(devAddr, &tcpPort) != OC_STACK_OK)
     {
         tcpPort = 0;