Allow empty array in OCRepPayloadSetIntArray
authorAbhishek Pandey <abhi.siso@samsung.com>
Mon, 24 Jul 2017 12:00:14 +0000 (17:30 +0530)
committerAshok Babu Channa <ashok.channa@samsung.com>
Mon, 31 Jul 2017 07:05:57 +0000 (07:05 +0000)
commit5c7e5002d4429d234683f8eb9b9e74151c780d79
tree7cf14c7434ef72952eb96d0e9ed824f3c982d8da
parent0d511009c8c2e0082ed66359c11cc1f1967b5896
Allow empty array in OCRepPayloadSetIntArray

[IOT-2458] OCRepPayloadSetIntArray() did not allow empty
array.  Fixed by not returning false when dimTotal is 0
and instead letting the function to get executed when input
array is NULL & dimTotal is 0.

Also fixed the usage of API in easy setup enrollee code.
Now using OCRepPayloadSetIntArrayAsOwner() instead of
OCRepPayloadSetIntArray() as the later duplicates the
memory which can be avoided "by giving payload ownership
to stack".

Added unit test in cbortests to test new API behavior.

Change-Id: If5352b1faf5a9355dd0f8a22882a6af545df6d29
Signed-off-by: Abhishek Pandey <abhi.siso@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/21591
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Reviewed-by: Todd Malsbary <todd.malsbary@intel.com>
Reviewed-by: Harish Marappa <h.marappa@samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
resource/csdk/stack/src/ocpayload.c
resource/csdk/stack/test/cbortests.cpp
service/easy-setup/enrollee/src/resourcehandler.c