From a91f5740d100414a76959714b819422ee5b2d8a8 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sun, 14 Apr 2024 18:19:14 +0200 Subject: Change API around #PLIST_DATA to use uint8_t instead of char arrays This makes it more obvious that it is arbitrary data and not necessarily a string value. --- include/plist/Data.h | 6 +++--- include/plist/plist.h | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'include/plist') diff --git a/include/plist/Data.h b/include/plist/Data.h index b566a6c..3f1c329 100644 --- a/include/plist/Data.h +++ b/include/plist/Data.h @@ -35,13 +35,13 @@ public : Data(plist_t node, Node* parent = NULL); Data(const Data& d); Data& operator=(const Data& b); - Data(const std::vector& buff); + Data(const std::vector& buff); virtual ~Data(); Node* Clone() const; - void SetValue(const std::vector& buff); - std::vector GetValue() const; + void SetValue(const std::vector& buff); + std::vector GetValue() const; }; }; diff --git a/include/plist/plist.h b/include/plist/plist.h index 46aca16..dcc4a04 100644 --- a/include/plist/plist.h +++ b/include/plist/plist.h @@ -258,7 +258,7 @@ extern "C" * @return the created item * @sa #plist_type */ - PLIST_API plist_t plist_new_data(const char *val, uint64_t length); + PLIST_API plist_t plist_new_data(const uint8_t *val, uint64_t length); /** * Create a new plist_t type #PLIST_DATE @@ -445,7 +445,7 @@ extern "C" PLIST_API void plist_dict_get_item_key(plist_t node, char **key); /** - * Get the nth item in a #PLIST_DICT node. + * Get the item for given key in a #PLIST_DICT node. * * @param node the node of type #PLIST_DICT * @param key the identifier of the item to get. @@ -595,7 +595,7 @@ extern "C" * @param length the length of the buffer * @note Use plist_mem_free() to free the allocated memory. */ - PLIST_API void plist_get_data_val(plist_t node, char **val, uint64_t * length); + PLIST_API void plist_get_data_val(plist_t node, uint8_t **val, uint64_t * length); /** * Get a pointer to the data buffer of a #PLIST_DATA node. @@ -608,7 +608,7 @@ extern "C" * * @return Pointer to the buffer */ - PLIST_API const char* plist_get_data_ptr(plist_t node, uint64_t* length); + PLIST_API const uint8_t* plist_get_data_ptr(plist_t node, uint64_t * length); /** * Get the value of a #PLIST_DATE node. @@ -700,7 +700,7 @@ extern "C" * be freed by the node. * @param length the length of the buffer */ - PLIST_API void plist_set_data_val(plist_t node, const char *val, uint64_t length); + PLIST_API void plist_set_data_val(plist_t node, const uint8_t *val, uint64_t length); /** * Set the value of a node. -- cgit v1.1-32-gdbae