ocpayload: Adding OCByteString support in representation
Add Bytestring handling in OCRepPayloadClone()
along arrays/vectors of them.
Also added in native java (JNI) part for android
inspired by existing code, note for later,
original code might be double checked for potential MLK
regarding local references to allocated objects within loops.
Maybe those unref are not mandatory
as they "are freed automatically after the native method returns."
http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html
Improved tests, it is assumed that contents of OCByteString
are not duplicated when not wanted,
plus style cleanup on surrounding code.
Note of my understanding of this design mixing C++ and C paradigms :
- As OCByteString is a C structure there is no destructor
- If assigned (no deep copy) into Payload class
bytes will be freed by Payload's destructor as it "owns" it.
- If contents are deep copied anywhere else
then bytes should be also freed manually
(in other classes' destructor ? like Payload).
Bug: https://jira.iotivity.org/browse/IOT-983
Change-Id: Icfa0657df9b332b4d11b737731636c8fb2a80001
Credits-to: youngman <yman.jung@samsung.com>
Origin: https://gerrit.iotivity.org/gerrit/#/c/8931/
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8931
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
(cherry picked from commit
f2059ea75cb7f8966f59132fb05962b2f52e352b)
Reviewed-on: https://gerrit.iotivity.org/gerrit/12611
Reviewed-by: Uze Choi <uzchoi@samsung.com>