Fixed static analysis issues in RI. 33/13133/6
authorJaehong Jo <jaehong.jo@samsung.com>
Wed, 12 Oct 2016 07:18:39 +0000 (16:18 +0900)
committerAshok Babu Channa <ashok.channa@samsung.com>
Mon, 24 Oct 2016 09:27:28 +0000 (09:27 +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>
resource/csdk/connectivity/src/caretransmission.c
resource/csdk/resource-directory/src/rd_client.c
resource/csdk/stack/src/ocstack.c

index 0d58a0d..4dd74d4 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 eb2ac3b..9997bde 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 fff4c24..9869efe 100644 (file)
@@ -5026,7 +5026,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)
@@ -5043,11 +5043,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]);
     }