[Resource-encapsulation] Static analyzer fixes. 13/21213/2
authorJay Sharma <jay.sharma@samsung.com>
Mon, 3 Jul 2017 13:58:26 +0000 (19:28 +0530)
committerUze Choi <uzchoi@samsung.com>
Tue, 11 Jul 2017 04:54:22 +0000 (04:54 +0000)
Change-Id: Ia714da5a98b1b6d5acd09e9c3f5e96b8a119f955
Signed-off-by: Jay Sharma <jay.sharma@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21213
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: JungYong KIM <jyong2.kim@samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/resource-encapsulation/examples/tizen/NestedAttributeClientApp/src/reclient.cpp
service/resource-encapsulation/examples/tizen/RESampleClientApp/src/reclient.cpp
service/resource-encapsulation/src/resourceBroker/src/ResourceBroker.cpp
service/resource-encapsulation/src/resourceCache/src/ResourceCacheManager.cpp

index b9c4049..7015b49 100644 (file)
@@ -89,7 +89,7 @@ void *updateGroupLog(void *data)
 
 nestedAtrribute createNestedAttribute(int fanSpeed, int airSpeed)
 {
-    nestedAtrribute *acServer = new nestedAtrribute();
+    nestedAtrribute acServer;
 
     model["model"] = "SamsungAC";
 
@@ -129,19 +129,13 @@ nestedAtrribute createNestedAttribute(int fanSpeed, int airSpeed)
     light.push_back(red);
     light.push_back(green);
 
-    if (nullptr == acServer)
-    {
-        dlog_print(DLOG_ERROR, LOG_TAG, "#### NULL nestedAtrribute");
-        return *acServer;
-    }
-
-    acServer->push_back(generalInfo);
-    acServer->push_back(fan);
-    acServer->push_back(tempSensor);
-    acServer->push_back(efficiency);
-    acServer->push_back(light);
+    acServer.push_back(generalInfo);
+    acServer.push_back(fan);
+    acServer.push_back(tempSensor);
+    acServer.push_back(efficiency);
+    acServer.push_back(light);
 
-    return *acServer;
+    return acServer;
 }
 
 static void onDestroy()
index 9e74134..892d410 100644 (file)
@@ -587,7 +587,7 @@ popup_set_clicked_cb(void *data, Evas_Object *obj, void *event_info)
     }
     else
     {
-        if (NULL == attributeString || 1 > len)
+        if (1 > len)
         {
             invalidFlag = 1;
             dlog_print(DLOG_INFO, LOG_TAG, "#### Read NULL attribute Value");
index 62d9cfe..970db5f 100644 (file)
@@ -64,7 +64,7 @@ namespace OIC
         BrokerID ResourceBroker::hostResource(PrimitiveResourcePtr pResource, BrokerCB cb)
         {
             OIC_LOG_V(DEBUG, BROKER_TAG, "hostResource().");
-            if(pResource == nullptr || cb == nullptr || cb == NULL)
+            if(pResource == nullptr || cb == nullptr)
             {
                 throw InvalidParameterException("[hostResource] input parameter(PrimitiveResource or BrokerCB) is Invalid");
             }
index 107e0ce..fc88a53 100644 (file)
@@ -75,7 +75,7 @@ namespace OIC
 
             if (cm == CACHE_METHOD::OBSERVE_ONLY)
             {
-                if (func == NULL || func == nullptr)
+                if (func == nullptr)
                 {
                     throw RCSInvalidParameterException {"[requestResourceCache] CacheCB is invaild"};
                 }
@@ -97,7 +97,7 @@ namespace OIC
 
             if (rf != REPORT_FREQUENCY::NONE)
             {
-                if (func == NULL || func == nullptr)
+                if (func == nullptr)
                 {
                     throw RCSInvalidParameterException {"[requestResourceCache] CacheCB is invaild"};
                 }