Modify incorrect conditional statements in OCParseSecurityPayload
authorleechul <chuls.lee@samsung.com>
Fri, 11 Dec 2015 01:41:03 +0000 (10:41 +0900)
committerSachin Agrawal <sachin.agrawal@intel.com>
Fri, 11 Dec 2015 05:40:33 +0000 (05:40 +0000)
Since, payload format changed as follows :

[ { rep: security payload } ]

to

{security payload}

We don't need check whether cbor value is a map.

Change-Id: I65912c4bacd9e33cee991d5ba37c8ae1b01d0f1d
Signed-off-by: leechul <chuls.lee@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/4511
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: dongik Lee <dongik.lee@samsung.com>
Reviewed-by: Sachin Agrawal <sachin.agrawal@intel.com>
resource/csdk/stack/src/ocpayloadparse.c

index 14fb921..c114efe 100644 (file)
@@ -113,19 +113,10 @@ static OCStackResult OCParseSecurityPayload(OCPayload** outPayload, CborValue* r
     bool err = false;
     char * securityData = NULL;
     CborValue map;
-    err = err || cbor_value_enter_container(rootValue, &map);
-
-    if(cbor_value_is_map(&map))
-    {
-        size_t len;
-        err = err || cbor_value_dup_text_string(&map, &securityData, &len, NULL);
-    }
-    else
-    {
-        OC_LOG(ERROR, TAG, "Cbor main value not a map");
-        return OC_STACK_MALFORMED_RESPONSE;
-    }
+    size_t len;
 
+    err = err || cbor_value_enter_container(rootValue, &map);
+    err = err || cbor_value_dup_text_string(&map, &securityData, &len, NULL);
     err = err || cbor_value_leave_container(rootValue, &map);
 
     if(err)