Fixed static analysis issues in RI.
authorJaehong Jo <jaehong.jo@samsung.com>
Wed, 12 Oct 2016 07:18:39 +0000 (16:18 +0900)
committerHabib Virji <habib.virji@samsung.com>
Fri, 28 Oct 2016 13:46:00 +0000 (13:46 +0000)
Change-Id: Id6a1b8edb41b3863ba722db43285d28e264dfda8
Signed-off-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13133
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Habib Virji <habib.virji@samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
(cherry picked from commit 07dbd388c00fb4aa122f13d59b5373854a64176f)
Reviewed-on: https://gerrit.iotivity.org/gerrit/13823

resource/csdk/connectivity/src/caretransmission.c
resource/csdk/resource-directory/src/rd_client.c
resource/csdk/stack/src/ocstack.c

index 7101b4c..c8b2b08 100644 (file)
@@ -157,7 +157,7 @@ static bool CACheckTimeout(uint64_t currentTime, CARetransmissionData_t *retData
     }
 #else
     // #1. calculate timeout
-    uint64_t timeOut = (2 << retData->triedCount) * 1000000;
+    uint64_t timeOut = (2 << retData->triedCount) * (uint64_t) 1000000;
 
     if (currentTime >= retData->timeStamp + timeOut)
     {
index 7107649..c63b749 100644 (file)
@@ -84,13 +84,12 @@ OCStackResult OCRDPublishWithDeviceId(const char *host, const unsigned char *id,
     OIC_LOG_V(DEBUG, TAG, "Publish Resource to RD with device id [%s]", id);
 
     OCResourceHandle *pubResHandle = resourceHandles;
+    OCResourceHandle defaultResHandles[OIC_RD_DEFAULT_RESOURCE] = { 0 };
     uint8_t nPubResHandles = nHandles;
 
     // if resource handles is null, "/oic/p" and "/oic/d" resource will be published to RD.
-    if (!pubResHandle && !nPubResHandles)
+    if (!pubResHandle)
     {
-        OCResourceHandle defaultResHandles[OIC_RD_DEFAULT_RESOURCE] = { 0 };
-
         // get "/oic/d" and "/oic/p" resource handle from stack.
         defaultResHandles[0] = OCGetResourceHandleAtUri(OC_RSRVD_DEVICE_URI);
         defaultResHandles[1] = OCGetResourceHandleAtUri(OC_RSRVD_PLATFORM_URI);
index e3dcef8..a3a47f4 100644 (file)
@@ -4990,7 +4990,7 @@ void OCSetNetworkMonitorHandler(CAAdapterStateChangedCB adapterHandler,
 OCStackResult OCGetDeviceId(OCUUIdentity *deviceId)
 {
     OicUuid_t oicUuid;
-    OCStackResult ret;
+    OCStackResult ret = OC_STACK_ERROR;
 
     ret = GetDoxmDeviceID(&oicUuid);
     if (OC_STACK_OK == ret)
@@ -5007,11 +5007,10 @@ OCStackResult OCGetDeviceId(OCUUIdentity *deviceId)
 OCStackResult OCSetDeviceId(const OCUUIdentity *deviceId)
 {
     OicUuid_t oicUuid;
-    OCStackResult ret;
-    OIC_LOG(ERROR, TAG, "Set deviceId DOXM");
+    OCStackResult ret = OC_STACK_ERROR;
 
     memcpy(&oicUuid, deviceId, UUID_LENGTH);
-    for(int i=0;i < UUID_LENGTH; i++)
+    for (int i = 0; i < UUID_LENGTH; i++)
     {
         OIC_LOG_V(INFO, TAG, "Set Device Id %x", oicUuid.id[i]);
     }