fix svace issues 60/100660/1 accepted/tizen/3.0/common/20161129.103611 accepted/tizen/3.0/ivi/20161129.064018 accepted/tizen/3.0/mobile/20161129.063915 accepted/tizen/3.0/tv/20161129.063934 accepted/tizen/3.0/wearable/20161129.063957 submit/tizen_3.0/20161129.040539
authorJooseok Park <jooseok.park@samsung.com>
Tue, 29 Nov 2016 02:09:01 +0000 (11:09 +0900)
committerJooseok Park <jooseok.park@samsung.com>
Tue, 29 Nov 2016 02:09:57 +0000 (11:09 +0900)
Change-Id: Iefe1536980d6594957c942557044a3748f7905f1

src/ic-ioty-convert.c
src/ic-ioty-ocprocess.c
src/ic-types.c
test/iotcon-test-basic-client.c
test/iotcon-test-encap-client.c

index 002a8b6..55dc40d 100644 (file)
@@ -406,7 +406,7 @@ static int _icl_ioty_fill_oic_rep_payload_value_array(OCRepPayload *payload,
                        if (NULL == attributes_arr[i]) {
                                ERR("OCRepPayloadCreate() Fail");
                                free(attributes_arr);
-                               return ret;
+                               return IOTCON_ERROR_OUT_OF_MEMORY;
                        }
                        ret = _icl_ioty_fill_oic_rep_payload_value(attributes_arr[i],
                                        ((icl_val_attributes_s*)node->data)->attributes);
index a9fe77f..f3a390a 100644 (file)
@@ -851,7 +851,7 @@ OCEntityHandlerResult icl_ioty_ocprocess_lite_request_cb(OCEntityHandlerFlag fla
        FN_CALL;
        iotcon_request_type_e req_type;
        iotcon_lite_resource_h resource = user_data;
-       iotcon_representation_h repr;
+       iotcon_representation_h repr = NULL;
        iotcon_response_h res = NULL;
 
        RETV_IF(NULL == resource, OC_EH_ERROR);
@@ -868,8 +868,6 @@ OCEntityHandlerResult icl_ioty_ocprocess_lite_request_cb(OCEntityHandlerFlag fla
        /* representation */
        if (request->payload)
                ic_ioty_parse_oic_rep_payload((OCRepPayload*)request->payload, true, &repr);
-       else
-               repr = NULL;
 
        res = calloc(1, sizeof(struct icl_resource_response));
        if (NULL == res) {
@@ -886,6 +884,10 @@ OCEntityHandlerResult icl_ioty_ocprocess_lite_request_cb(OCEntityHandlerFlag fla
                g_idle_add(_icl_ioty_ocprocess_lite_resource_response_idle_cb, res);
                break;
        case IOTCON_REQUEST_POST:
+               if(NULL == repr) {
+                       ERR("repr is NULL!!");
+                       break;
+               }
                if (resource->cb) {
                        if (false == resource->cb(resource, repr->attributes, resource->cb_data)) {
                                res->result = IOTCON_RESPONSE_ERROR;
index 8b4799d..a823997 100644 (file)
@@ -156,7 +156,7 @@ int icl_create_presence_cb_data(iotcon_presence_h presence,
        RETV_IF(NULL == presence_cb_data, IOTCON_ERROR_INVALID_PARAMETER);
 
        cd = calloc(1, sizeof(icl_presence_cb_s));
-       if (NULL == presence_cb_data) {
+       if (NULL == cd) {
                ERR("calloc() Fail(%d)", errno);
                return IOTCON_ERROR_OUT_OF_MEMORY;
        }
index 75f5f7c..92b5a00 100644 (file)
@@ -71,16 +71,10 @@ static void _on_observe(iotcon_remote_resource_h resource, iotcon_error_e err,
        }
 
        INFO("notify_cb information");
-       switch (opened) {
-       case true:
+       if(opened)
                INFO("[Door] opened.");
-               break;
-       case false:
+       else
                INFO("[Door] closed.");
-               break;
-       default:
-               break;
-       }
 
        if (5 == i++) {
                iotcon_remote_resource_observe_deregister(resource);
index 7d7ab90..61feaaf 100644 (file)
@@ -86,16 +86,10 @@ static void _representation_changed_cb(iotcon_remote_resource_h resource,
                return;
        }
 
-       switch (opened) {
-       case true:
-               INFO("door is opened");
-               break;
-       case false:
-               INFO("door is closed");
-               break;
-       default:
-               break;
-       }
+       if(opened)
+               INFO("[Door] opened.");
+       else
+               INFO("[Door] closed.");
 }
 
 static bool _found_resource(iotcon_remote_resource_h resource, iotcon_error_e result,