diff options
author | Hwankyu Jhun <h.jhun@samsung.com> | 2019-08-07 17:57:31 +0900 |
---|---|---|
committer | Hwankyu Jhun <h.jhun@samsung.com> | 2019-08-07 19:39:12 +0900 |
commit | 7d2c8c06f01c5213b85b73f96578467e36efb8ae (patch) | |
tree | 582b4707ad4c902c87307f1276c8d673eebedeb6 | |
parent | 579f95aea3ffd962e67b7e43513f8fe6fa932f8c (diff) | |
download | bundle-7d2c8c06f01c5213b85b73f96578467e36efb8ae.tar.gz bundle-7d2c8c06f01c5213b85b73f96578467e36efb8ae.tar.bz2 bundle-7d2c8c06f01c5213b85b73f96578467e36efb8ae.zip |
Add a new internal function
Adds:
- bundle_init_byte_array()
Change-Id: I7c190b53c69f528dbaf4fb97a95da143b300fe07
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rwxr-xr-x | include/bundle_internal.h | 20 | ||||
-rw-r--r-- | src/bundle.c | 5 |
2 files changed, 25 insertions, 0 deletions
diff --git a/include/bundle_internal.h b/include/bundle_internal.h index 8817b13..59499b2 100755 --- a/include/bundle_internal.h +++ b/include/bundle_internal.h @@ -506,6 +506,26 @@ API int bundle_from_json(const char *json, bundle **b); */ API int bundle_compare(bundle *b1, bundle *b2); +/** + * @brief Initializes a byte array type key-value pair into a bundle. + * @details To set the value of the byte array element, you should use bundle_set_byte_array_element(). + * This function is only for creating a buffer of the byte array. + * @since_tizen 5.5 + * + * @param[in] b The bundle object + * @param[in] key The key + * @param[in] len The length of the array to be created + * @return @c 0 on success, + * otherwise a negative error value + * @retval #BUNDLE_ERROR_NONE Successful + * @retval #BUNDLE_ERROR_INVALID_PARAMETEr Invalid parameter + * @retval #BUNDLE_ERROR_KEY_EXISTS Key already exists + * @retval #BUNDLE_ERROR_OUT_OF_MEMORY Out of memory + * + * @see bundle_set_byte_array_element() + */ +API int bundle_init_byte_array(bundle *b, const char *key, const unsigned int len); + #ifdef __cplusplus } #endif diff --git a/src/bundle.c b/src/bundle.c index 2afa47f..4513486 100644 --- a/src/bundle.c +++ b/src/bundle.c @@ -1077,6 +1077,11 @@ int bundle_add_byte_array(bundle *b, const char *key, void **byte_array, BUNDLE_TYPE_BYTE_ARRAY, len); } +int bundle_init_byte_array(bundle *b, const char *key, const unsigned int len) +{ + return _bundle_add_kv(b, key, NULL, 0, BUNDLE_TYPE_BYTE_ARRAY, len); +} + int bundle_get_byte_array(bundle *b, const char *key, void ***byte_array, unsigned int *len, unsigned int **array_element_size) { |