| diff -Naur libplist-2.1.0-orig/include/plist/plist.h libplist-2.1.0/include/plist/plist.h |
| --- libplist-2.1.0-orig/include/plist/plist.h 2019-11-07 07:14:43.000000000 +0300 |
| +++ libplist-2.1.0/include/plist/plist.h 2019-11-10 00:13:14.568641300 +0300 |
| @@ -44,6 +44,21 @@ |
| #include <stdint.h> |
| #endif |
| |
| + |
| +#ifdef _WIN32 |
| + #ifdef DLL_EXPORT |
| + #define PLIST_API __declspec( dllexport ) |
| + #else |
| + #define PLIST_API |
| + #endif |
| +#else |
| + #ifdef HAVE_FVISIBILITY |
| + #define PLIST_API __attribute__((visibility("default"))) |
| + #else |
| + #define PLIST_API |
| + #endif |
| +#endif |
| + |
| #ifdef __llvm__ |
| #if defined(__has_extension) |
| #if (__has_extension(attribute_deprecated_with_message)) |
| @@ -129,7 +144,7 @@ |
| * @return the created plist |
| * @sa #plist_type |
| */ |
| - plist_t plist_new_dict(void); |
| + PLIST_API plist_t plist_new_dict(void); |
| |
| /** |
| * Create a new root plist_t type #PLIST_ARRAY |
| @@ -137,7 +152,7 @@ |
| * @return the created plist |
| * @sa #plist_type |
| */ |
| - plist_t plist_new_array(void); |
| + PLIST_API plist_t plist_new_array(void); |
| |
| /** |
| * Create a new plist_t type #PLIST_STRING |
| @@ -146,7 +161,7 @@ |
| * @return the created item |
| * @sa #plist_type |
| */ |
| - plist_t plist_new_string(const char *val); |
| + PLIST_API plist_t plist_new_string(const char *val); |
| |
| /** |
| * Create a new plist_t type #PLIST_BOOLEAN |
| @@ -155,7 +170,7 @@ |
| * @return the created item |
| * @sa #plist_type |
| */ |
| - plist_t plist_new_bool(uint8_t val); |
| + PLIST_API plist_t plist_new_bool(uint8_t val); |
| |
| /** |
| * Create a new plist_t type #PLIST_UINT |
| @@ -164,7 +179,7 @@ |
| * @return the created item |
| * @sa #plist_type |
| */ |
| - plist_t plist_new_uint(uint64_t val); |
| + PLIST_API plist_t plist_new_uint(uint64_t val); |
| |
| /** |
| * Create a new plist_t type #PLIST_REAL |
| @@ -173,7 +188,7 @@ |
| * @return the created item |
| * @sa #plist_type |
| */ |
| - plist_t plist_new_real(double val); |
| + PLIST_API plist_t plist_new_real(double val); |
| |
| /** |
| * Create a new plist_t type #PLIST_DATA |
| @@ -183,7 +198,7 @@ |
| * @return the created item |
| * @sa #plist_type |
| */ |
| - plist_t plist_new_data(const char *val, uint64_t length); |
| + PLIST_API plist_t plist_new_data(const char *val, uint64_t length); |
| |
| /** |
| * Create a new plist_t type #PLIST_DATE |
| @@ -193,7 +208,7 @@ |
| * @return the created item |
| * @sa #plist_type |
| */ |
| - plist_t plist_new_date(int32_t sec, int32_t usec); |
| + PLIST_API plist_t plist_new_date(int32_t sec, int32_t usec); |
| |
| /** |
| * Create a new plist_t type #PLIST_UID |
| @@ -202,14 +217,14 @@ |
| * @return the created item |
| * @sa #plist_type |
| */ |
| - plist_t plist_new_uid(uint64_t val); |
| + PLIST_API plist_t plist_new_uid(uint64_t val); |
| |
| /** |
| * Destruct a plist_t node and all its children recursively |
| * |
| * @param plist the plist to free |
| */ |
| - void plist_free(plist_t plist); |
| + PLIST_API void plist_free(plist_t plist); |
| |
| /** |
| * Return a copy of passed node and it's children |
| @@ -217,7 +232,7 @@ |
| * @param node the plist to copy |
| * @return copied plist |
| */ |
| - plist_t plist_copy(plist_t node); |
| + PLIST_API plist_t plist_copy(plist_t node); |
| |
| |
| /******************************************** |
| @@ -232,7 +247,7 @@ |
| * @param node the node of type #PLIST_ARRAY |
| * @return size of the #PLIST_ARRAY node |
| */ |
| - uint32_t plist_array_get_size(plist_t node); |
| + PLIST_API uint32_t plist_array_get_size(plist_t node); |
| |
| /** |
| * Get the nth item in a #PLIST_ARRAY node. |
| @@ -241,7 +256,7 @@ |
| * @param n the index of the item to get. Range is [0, array_size[ |
| * @return the nth item or NULL if node is not of type #PLIST_ARRAY |
| */ |
| - plist_t plist_array_get_item(plist_t node, uint32_t n); |
| + PLIST_API plist_t plist_array_get_item(plist_t node, uint32_t n); |
| |
| /** |
| * Get the index of an item. item must be a member of a #PLIST_ARRAY node. |
| @@ -249,7 +264,7 @@ |
| * @param node the node |
| * @return the node index or UINT_MAX if node index can't be determined |
| */ |
| - uint32_t plist_array_get_item_index(plist_t node); |
| + PLIST_API uint32_t plist_array_get_item_index(plist_t node); |
| |
| /** |
| * Set the nth item in a #PLIST_ARRAY node. |
| @@ -259,7 +274,7 @@ |
| * @param item the new item at index n. The array is responsible for freeing item when it is no longer needed. |
| * @param n the index of the item to get. Range is [0, array_size[. Assert if n is not in range. |
| */ |
| - void plist_array_set_item(plist_t node, plist_t item, uint32_t n); |
| + PLIST_API void plist_array_set_item(plist_t node, plist_t item, uint32_t n); |
| |
| /** |
| * Append a new item at the end of a #PLIST_ARRAY node. |
| @@ -267,7 +282,7 @@ |
| * @param node the node of type #PLIST_ARRAY |
| * @param item the new item. The array is responsible for freeing item when it is no longer needed. |
| */ |
| - void plist_array_append_item(plist_t node, plist_t item); |
| + PLIST_API void plist_array_append_item(plist_t node, plist_t item); |
| |
| /** |
| * Insert a new item at position n in a #PLIST_ARRAY node. |
| @@ -276,7 +291,7 @@ |
| * @param item the new item to insert. The array is responsible for freeing item when it is no longer needed. |
| * @param n The position at which the node will be stored. Range is [0, array_size[. Assert if n is not in range. |
| */ |
| - void plist_array_insert_item(plist_t node, plist_t item, uint32_t n); |
| + PLIST_API void plist_array_insert_item(plist_t node, plist_t item, uint32_t n); |
| |
| /** |
| * Remove an existing position in a #PLIST_ARRAY node. |
| @@ -285,7 +300,7 @@ |
| * @param node the node of type #PLIST_ARRAY |
| * @param n The position to remove. Range is [0, array_size[. Assert if n is not in range. |
| */ |
| - void plist_array_remove_item(plist_t node, uint32_t n); |
| + PLIST_API void plist_array_remove_item(plist_t node, uint32_t n); |
| |
| /** |
| * Remove a node that is a child node of a #PLIST_ARRAY node. |
| @@ -293,7 +308,7 @@ |
| * |
| * @param node The node to be removed from its #PLIST_ARRAY parent. |
| */ |
| - void plist_array_item_remove(plist_t node); |
| + PLIST_API void plist_array_item_remove(plist_t node); |
| |
| /** |
| * Create an iterator of a #PLIST_ARRAY node. |
| @@ -302,7 +317,7 @@ |
| * @param node The node of type #PLIST_ARRAY |
| * @param iter Location to store the iterator for the array. |
| */ |
| - void plist_array_new_iter(plist_t node, plist_array_iter *iter); |
| + PLIST_API void plist_array_new_iter(plist_t node, plist_array_iter *iter); |
| |
| /** |
| * Increment iterator of a #PLIST_ARRAY node. |
| @@ -313,7 +328,7 @@ |
| * returned item. Will be set to NULL when no more items are left |
| * to iterate. |
| */ |
| - void plist_array_next_item(plist_t node, plist_array_iter iter, plist_t *item); |
| + PLIST_API void plist_array_next_item(plist_t node, plist_array_iter iter, plist_t *item); |
| |
| |
| /******************************************** |
| @@ -328,7 +343,7 @@ |
| * @param node the node of type #PLIST_DICT |
| * @return size of the #PLIST_DICT node |
| */ |
| - uint32_t plist_dict_get_size(plist_t node); |
| + PLIST_API uint32_t plist_dict_get_size(plist_t node); |
| |
| /** |
| * Create an iterator of a #PLIST_DICT node. |
| @@ -337,7 +352,7 @@ |
| * @param node The node of type #PLIST_DICT. |
| * @param iter Location to store the iterator for the dictionary. |
| */ |
| - void plist_dict_new_iter(plist_t node, plist_dict_iter *iter); |
| + PLIST_API void plist_dict_new_iter(plist_t node, plist_dict_iter *iter); |
| |
| /** |
| * Increment iterator of a #PLIST_DICT node. |
| @@ -350,7 +365,7 @@ |
| * free the returned value. Will be set to NULL when no more |
| * key/value pairs are left to iterate. |
| */ |
| - void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val); |
| + PLIST_API void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val); |
| |
| /** |
| * Get key associated key to an item. Item must be member of a dictionary. |
| @@ -358,7 +373,7 @@ |
| * @param node the item |
| * @param key a location to store the key. The caller is responsible for freeing the returned string. |
| */ |
| - void plist_dict_get_item_key(plist_t node, char **key); |
| + PLIST_API void plist_dict_get_item_key(plist_t node, char **key); |
| |
| /** |
| * Get the nth item in a #PLIST_DICT node. |
| @@ -368,7 +383,7 @@ |
| * @return the item or NULL if node is not of type #PLIST_DICT. The caller should not free |
| * the returned node. |
| */ |
| - plist_t plist_dict_get_item(plist_t node, const char* key); |
| + PLIST_API plist_t plist_dict_get_item(plist_t node, const char* key); |
| |
| /** |
| * Get key node associated to an item. Item must be member of a dictionary. |
| @@ -376,7 +391,7 @@ |
| * @param node the item |
| * @return the key node of the given item, or NULL. |
| */ |
| - plist_t plist_dict_item_get_key(plist_t node); |
| + PLIST_API plist_t plist_dict_item_get_key(plist_t node); |
| |
| /** |
| * Set item identified by key in a #PLIST_DICT node. |
| @@ -387,7 +402,7 @@ |
| * @param item the new item associated to key |
| * @param key the identifier of the item to set. |
| */ |
| - void plist_dict_set_item(plist_t node, const char* key, plist_t item); |
| + PLIST_API void plist_dict_set_item(plist_t node, const char* key, plist_t item); |
| |
| /** |
| * Insert a new item into a #PLIST_DICT node. |
| @@ -399,7 +414,7 @@ |
| * @param key The identifier of the item to insert. |
| */ |
| PLIST_WARN_DEPRECATED("use plist_dict_set_item instead") |
| - void plist_dict_insert_item(plist_t node, const char* key, plist_t item); |
| + PLIST_API void plist_dict_insert_item(plist_t node, const char* key, plist_t item); |
| |
| /** |
| * Remove an existing position in a #PLIST_DICT node. |
| @@ -408,7 +423,7 @@ |
| * @param node the node of type #PLIST_DICT |
| * @param key The identifier of the item to remove. Assert if identifier is not present. |
| */ |
| - void plist_dict_remove_item(plist_t node, const char* key); |
| + PLIST_API void plist_dict_remove_item(plist_t node, const char* key); |
| |
| /** |
| * Merge a dictionary into another. This will add all key/value pairs |
| @@ -418,7 +433,7 @@ |
| * @param target pointer to an existing node of type #PLIST_DICT |
| * @param source node of type #PLIST_DICT that should be merged into target |
| */ |
| - void plist_dict_merge(plist_t *target, plist_t source); |
| + PLIST_API void plist_dict_merge(plist_t *target, plist_t source); |
| |
| |
| /******************************************** |
| @@ -432,7 +447,7 @@ |
| * |
| * @param node the parent (NULL if node is root) |
| */ |
| - plist_t plist_get_parent(plist_t node); |
| + PLIST_API plist_t plist_get_parent(plist_t node); |
| |
| /** |
| * Get the #plist_type of a node. |
| @@ -440,7 +455,7 @@ |
| * @param node the node |
| * @return the type of the node |
| */ |
| - plist_type plist_get_node_type(plist_t node); |
| + PLIST_API plist_type plist_get_node_type(plist_t node); |
| |
| /** |
| * Get the value of a #PLIST_KEY node. |
| @@ -450,7 +465,7 @@ |
| * @param val a pointer to a C-string. This function allocates the memory, |
| * caller is responsible for freeing it. |
| */ |
| - void plist_get_key_val(plist_t node, char **val); |
| + PLIST_API void plist_get_key_val(plist_t node, char **val); |
| |
| /** |
| * Get the value of a #PLIST_STRING node. |
| @@ -460,7 +475,7 @@ |
| * @param val a pointer to a C-string. This function allocates the memory, |
| * caller is responsible for freeing it. Data is UTF-8 encoded. |
| */ |
| - void plist_get_string_val(plist_t node, char **val); |
| + PLIST_API void plist_get_string_val(plist_t node, char **val); |
| |
| /** |
| * Get a pointer to the buffer of a #PLIST_STRING node. |
| @@ -473,7 +488,7 @@ |
| * |
| * @return Pointer to the NULL-terminated buffer. |
| */ |
| - const char* plist_get_string_ptr(plist_t node, uint64_t* length); |
| + PLIST_API const char* plist_get_string_ptr(plist_t node, uint64_t* length); |
| |
| /** |
| * Get the value of a #PLIST_BOOLEAN node. |
| @@ -482,7 +497,7 @@ |
| * @param node the node |
| * @param val a pointer to a uint8_t variable. |
| */ |
| - void plist_get_bool_val(plist_t node, uint8_t * val); |
| + PLIST_API void plist_get_bool_val(plist_t node, uint8_t * val); |
| |
| /** |
| * Get the value of a #PLIST_UINT node. |
| @@ -491,7 +506,7 @@ |
| * @param node the node |
| * @param val a pointer to a uint64_t variable. |
| */ |
| - void plist_get_uint_val(plist_t node, uint64_t * val); |
| + PLIST_API void plist_get_uint_val(plist_t node, uint64_t * val); |
| |
| /** |
| * Get the value of a #PLIST_REAL node. |
| @@ -500,7 +515,7 @@ |
| * @param node the node |
| * @param val a pointer to a double variable. |
| */ |
| - void plist_get_real_val(plist_t node, double *val); |
| + PLIST_API void plist_get_real_val(plist_t node, double *val); |
| |
| /** |
| * Get the value of a #PLIST_DATA node. |
| @@ -511,7 +526,7 @@ |
| * caller is responsible for freeing it. |
| * @param length the length of the buffer |
| */ |
| - void plist_get_data_val(plist_t node, char **val, uint64_t * length); |
| + PLIST_API void plist_get_data_val(plist_t node, char **val, uint64_t * length); |
| |
| /** |
| * Get a pointer to the data buffer of a #PLIST_DATA node. |
| @@ -524,7 +539,7 @@ |
| * |
| * @return Pointer to the buffer |
| */ |
| - const char* plist_get_data_ptr(plist_t node, uint64_t* length); |
| + PLIST_API const char* plist_get_data_ptr(plist_t node, uint64_t* length); |
| |
| /** |
| * Get the value of a #PLIST_DATE node. |
| @@ -534,7 +549,7 @@ |
| * @param sec a pointer to an int32_t variable. Represents the number of seconds since 01/01/2001. |
| * @param usec a pointer to an int32_t variable. Represents the number of microseconds |
| */ |
| - void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec); |
| + PLIST_API void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec); |
| |
| /** |
| * Get the value of a #PLIST_UID node. |
| @@ -543,7 +558,7 @@ |
| * @param node the node |
| * @param val a pointer to a uint64_t variable. |
| */ |
| - void plist_get_uid_val(plist_t node, uint64_t * val); |
| + PLIST_API void plist_get_uid_val(plist_t node, uint64_t * val); |
| |
| |
| /******************************************** |
| @@ -559,7 +574,7 @@ |
| * @param node the node |
| * @param val the key value |
| */ |
| - void plist_set_key_val(plist_t node, const char *val); |
| + PLIST_API void plist_set_key_val(plist_t node, const char *val); |
| |
| /** |
| * Set the value of a node. |
| @@ -569,7 +584,7 @@ |
| * @param val the string value. The string is copied when set and will be |
| * freed by the node. |
| */ |
| - void plist_set_string_val(plist_t node, const char *val); |
| + PLIST_API void plist_set_string_val(plist_t node, const char *val); |
| |
| /** |
| * Set the value of a node. |
| @@ -578,7 +593,7 @@ |
| * @param node the node |
| * @param val the boolean value |
| */ |
| - void plist_set_bool_val(plist_t node, uint8_t val); |
| + PLIST_API void plist_set_bool_val(plist_t node, uint8_t val); |
| |
| /** |
| * Set the value of a node. |
| @@ -587,7 +602,7 @@ |
| * @param node the node |
| * @param val the unsigned integer value |
| */ |
| - void plist_set_uint_val(plist_t node, uint64_t val); |
| + PLIST_API void plist_set_uint_val(plist_t node, uint64_t val); |
| |
| /** |
| * Set the value of a node. |
| @@ -596,7 +611,7 @@ |
| * @param node the node |
| * @param val the real value |
| */ |
| - void plist_set_real_val(plist_t node, double val); |
| + PLIST_API void plist_set_real_val(plist_t node, double val); |
| |
| /** |
| * Set the value of a node. |
| @@ -607,7 +622,7 @@ |
| * be freed by the node. |
| * @param length the length of the buffer |
| */ |
| - 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 char *val, uint64_t length); |
| |
| /** |
| * Set the value of a node. |
| @@ -617,7 +632,7 @@ |
| * @param sec the number of seconds since 01/01/2001 |
| * @param usec the number of microseconds |
| */ |
| - void plist_set_date_val(plist_t node, int32_t sec, int32_t usec); |
| + PLIST_API void plist_set_date_val(plist_t node, int32_t sec, int32_t usec); |
| |
| /** |
| * Set the value of a node. |
| @@ -626,7 +641,7 @@ |
| * @param node the node |
| * @param val the unsigned integer value |
| */ |
| - void plist_set_uid_val(plist_t node, uint64_t val); |
| + PLIST_API void plist_set_uid_val(plist_t node, uint64_t val); |
| |
| |
| /******************************************** |
| @@ -643,14 +658,14 @@ |
| * caller is responsible for freeing it. Data is UTF-8 encoded. |
| * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer. |
| */ |
| - void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length); |
| + PLIST_API void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length); |
| |
| /** |
| * Frees the memory allocated by plist_to_xml(). |
| * |
| * @param plist_xml The buffer allocated by plist_to_xml(). |
| */ |
| - void plist_to_xml_free(char *plist_xml); |
| + PLIST_API void plist_to_xml_free(char *plist_xml); |
| |
| /** |
| * Export the #plist_t structure to binary format. |
| @@ -660,14 +675,14 @@ |
| * caller is responsible for freeing it. |
| * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer. |
| */ |
| - void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length); |
| + PLIST_API void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length); |
| |
| /** |
| * Frees the memory allocated by plist_to_bin(). |
| * |
| * @param plist_bin The buffer allocated by plist_to_bin(). |
| */ |
| - void plist_to_bin_free(char *plist_bin); |
| + PLIST_API void plist_to_bin_free(char *plist_bin); |
| |
| /** |
| * Import the #plist_t structure from XML format. |
| @@ -676,7 +691,7 @@ |
| * @param length length of the buffer to read. |
| * @param plist a pointer to the imported plist. |
| */ |
| - void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist); |
| + PLIST_API void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist); |
| |
| /** |
| * Import the #plist_t structure from binary format. |
| @@ -685,7 +700,7 @@ |
| * @param length length of the buffer to read. |
| * @param plist a pointer to the imported plist. |
| */ |
| - void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist); |
| + PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist); |
| |
| /** |
| * Import the #plist_t structure from memory data. |
| @@ -696,7 +711,7 @@ |
| * @param length length of the buffer to read. |
| * @param plist a pointer to the imported plist. |
| */ |
| - void plist_from_memory(const char *plist_data, uint32_t length, plist_t * plist); |
| + PLIST_API void plist_from_memory(const char *plist_data, uint32_t length, plist_t * plist); |
| |
| /** |
| * Test if in-memory plist data is binary or XML |
| @@ -710,7 +725,7 @@ |
| * @param length length of the buffer to read. |
| * @return 1 if the buffer is a binary plist, 0 otherwise. |
| */ |
| - int plist_is_binary(const char *plist_data, uint32_t length); |
| + PLIST_API int plist_is_binary(const char *plist_data, uint32_t length); |
| |
| /******************************************** |
| * * |
| @@ -727,7 +742,7 @@ |
| * @param length length of the path to access |
| * @return the value to access. |
| */ |
| - plist_t plist_access_path(plist_t plist, uint32_t length, ...); |
| + PLIST_API plist_t plist_access_path(plist_t plist, uint32_t length, ...); |
| |
| /** |
| * Variadic version of #plist_access_path. |
| @@ -737,7 +752,7 @@ |
| * @param v list of array's index and dic'st key |
| * @return the value to access. |
| */ |
| - plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v); |
| + PLIST_API plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v); |
| |
| /** |
| * Compare two node values |
| @@ -746,7 +761,7 @@ |
| * @param node_r rigth node to compare |
| * @return TRUE is type and value match, FALSE otherwise. |
| */ |
| - char plist_compare_node_value(plist_t node_l, plist_t node_r); |
| + PLIST_API char plist_compare_node_value(plist_t node_l, plist_t node_r); |
| |
| #define _PLIST_IS_TYPE(__plist, __plist_type) (__plist && (plist_get_node_type(__plist) == PLIST_##__plist_type)) |
| |
| diff -Naur libplist-2.1.0-orig/src/bplist.c libplist-2.1.0/src/bplist.c |
| --- libplist-2.1.0-orig/src/bplist.c 2019-11-07 07:14:43.000000000 +0300 |
| +++ libplist-2.1.0/src/bplist.c 2019-11-09 23:58:20.649512100 +0300 |
| @@ -767,7 +767,7 @@ |
| return plist; |
| } |
| |
| -PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist) |
| +void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist) |
| { |
| bplist_trailer_t *trailer = NULL; |
| uint8_t offset_size = 0; |
| @@ -1158,7 +1158,7 @@ |
| return ret; |
| } |
| |
| -PLIST_API void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length) |
| +void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length) |
| { |
| ptrarray_t* objects = NULL; |
| hashtable_t* ref_table = NULL; |
| @@ -1380,7 +1380,7 @@ |
| byte_array_free(bplist_buff); |
| } |
| |
| -PLIST_API void plist_to_bin_free(char *plist_bin) |
| +void plist_to_bin_free(char *plist_bin) |
| { |
| free(plist_bin); |
| } |
| diff -Naur libplist-2.2.0-orig/src/plist.c libplist-2.2.0/src/plist.c |
| --- libplist-2.2.0-orig/src/plist.c 2019-11-09 23:34:55.209125500 +0300 |
| +++ libplist-2.2.0/src/plist.c 2019-11-09 23:55:35.675076100 +0300 |
| @@ -166,7 +166,7 @@ |
| } |
| #endif |
| |
| -PLIST_API int plist_is_binary(const char *plist_data, uint32_t length) |
| +int plist_is_binary(const char *plist_data, uint32_t length) |
| { |
| if (length < 8) { |
| return 0; |
| @@ -176,7 +176,7 @@ |
| } |
| |
| |
| -PLIST_API void plist_from_memory(const char *plist_data, uint32_t length, plist_t * plist) |
| +void plist_from_memory(const char *plist_data, uint32_t length, plist_t * plist) |
| { |
| if (length < 8) { |
| *plist = NULL; |
| @@ -279,14 +279,14 @@ |
| return node_index; |
| } |
| |
| -PLIST_API plist_t plist_new_dict(void) |
| +plist_t plist_new_dict(void) |
| { |
| plist_data_t data = plist_new_plist_data(); |
| data->type = PLIST_DICT; |
| return plist_new_node(data); |
| } |
| |
| -PLIST_API plist_t plist_new_array(void) |
| +plist_t plist_new_array(void) |
| { |
| plist_data_t data = plist_new_plist_data(); |
| data->type = PLIST_ARRAY; |
| @@ -303,7 +303,7 @@ |
| return plist_new_node(data); |
| } |
| |
| -PLIST_API plist_t plist_new_string(const char *val) |
| +plist_t plist_new_string(const char *val) |
| { |
| plist_data_t data = plist_new_plist_data(); |
| data->type = PLIST_STRING; |
| @@ -312,7 +312,7 @@ |
| return plist_new_node(data); |
| } |
| |
| -PLIST_API plist_t plist_new_bool(uint8_t val) |
| +plist_t plist_new_bool(uint8_t val) |
| { |
| plist_data_t data = plist_new_plist_data(); |
| data->type = PLIST_BOOLEAN; |
| @@ -321,7 +321,7 @@ |
| return plist_new_node(data); |
| } |
| |
| -PLIST_API plist_t plist_new_uint(uint64_t val) |
| +plist_t plist_new_uint(uint64_t val) |
| { |
| plist_data_t data = plist_new_plist_data(); |
| data->type = PLIST_UINT; |
| @@ -330,7 +330,7 @@ |
| return plist_new_node(data); |
| } |
| |
| -PLIST_API plist_t plist_new_uid(uint64_t val) |
| +plist_t plist_new_uid(uint64_t val) |
| { |
| plist_data_t data = plist_new_plist_data(); |
| data->type = PLIST_UID; |
| @@ -339,7 +339,7 @@ |
| return plist_new_node(data); |
| } |
| |
| -PLIST_API plist_t plist_new_real(double val) |
| +plist_t plist_new_real(double val) |
| { |
| plist_data_t data = plist_new_plist_data(); |
| data->type = PLIST_REAL; |
| @@ -348,7 +348,7 @@ |
| return plist_new_node(data); |
| } |
| |
| -PLIST_API plist_t plist_new_data(const char *val, uint64_t length) |
| +plist_t plist_new_data(const char *val, uint64_t length) |
| { |
| plist_data_t data = plist_new_plist_data(); |
| data->type = PLIST_DATA; |
| @@ -358,7 +358,7 @@ |
| return plist_new_node(data); |
| } |
| |
| -PLIST_API plist_t plist_new_date(int32_t sec, int32_t usec) |
| +plist_t plist_new_date(int32_t sec, int32_t usec) |
| { |
| plist_data_t data = plist_new_plist_data(); |
| data->type = PLIST_DATE; |
| @@ -367,7 +367,7 @@ |
| return plist_new_node(data); |
| } |
| |
| -PLIST_API void plist_free(plist_t plist) |
| +void plist_free(plist_t plist) |
| { |
| if (plist) |
| { |
| @@ -443,12 +443,12 @@ |
| return newnode; |
| } |
| |
| -PLIST_API plist_t plist_copy(plist_t node) |
| +plist_t plist_copy(plist_t node) |
| { |
| return node ? plist_copy_node(node) : NULL; |
| } |
| |
| -PLIST_API uint32_t plist_array_get_size(plist_t node) |
| +uint32_t plist_array_get_size(plist_t node) |
| { |
| uint32_t ret = 0; |
| if (node && PLIST_ARRAY == plist_get_node_type(node)) |
| @@ -458,7 +458,7 @@ |
| return ret; |
| } |
| |
| -PLIST_API plist_t plist_array_get_item(plist_t node, uint32_t n) |
| +plist_t plist_array_get_item(plist_t node, uint32_t n) |
| { |
| plist_t ret = NULL; |
| if (node && PLIST_ARRAY == plist_get_node_type(node) && n < INT_MAX) |
| @@ -473,7 +473,7 @@ |
| return ret; |
| } |
| |
| -PLIST_API uint32_t plist_array_get_item_index(plist_t node) |
| +uint32_t plist_array_get_item_index(plist_t node) |
| { |
| plist_t father = plist_get_parent(node); |
| if (PLIST_ARRAY == plist_get_node_type(father)) |
| @@ -505,7 +505,7 @@ |
| } |
| } |
| |
| -PLIST_API void plist_array_set_item(plist_t node, plist_t item, uint32_t n) |
| +void plist_array_set_item(plist_t node, plist_t item, uint32_t n) |
| { |
| if (node && PLIST_ARRAY == plist_get_node_type(node) && n < INT_MAX) |
| { |
| @@ -527,7 +527,7 @@ |
| } |
| } |
| |
| -PLIST_API void plist_array_append_item(plist_t node, plist_t item) |
| +void plist_array_append_item(plist_t node, plist_t item) |
| { |
| if (node && PLIST_ARRAY == plist_get_node_type(node)) |
| { |
| @@ -536,7 +536,7 @@ |
| } |
| } |
| |
| -PLIST_API void plist_array_insert_item(plist_t node, plist_t item, uint32_t n) |
| +void plist_array_insert_item(plist_t node, plist_t item, uint32_t n) |
| { |
| if (node && PLIST_ARRAY == plist_get_node_type(node) && n < INT_MAX) |
| { |
| @@ -545,7 +545,7 @@ |
| } |
| } |
| |
| -PLIST_API void plist_array_remove_item(plist_t node, uint32_t n) |
| +void plist_array_remove_item(plist_t node, uint32_t n) |
| { |
| if (node && PLIST_ARRAY == plist_get_node_type(node) && n < INT_MAX) |
| { |
| @@ -561,7 +561,7 @@ |
| } |
| } |
| |
| -PLIST_API void plist_array_item_remove(plist_t node) |
| +void plist_array_item_remove(plist_t node) |
| { |
| plist_t father = plist_get_parent(node); |
| if (PLIST_ARRAY == plist_get_node_type(father)) |
| @@ -576,7 +576,7 @@ |
| } |
| } |
| |
| -PLIST_API void plist_array_new_iter(plist_t node, plist_array_iter *iter) |
| +void plist_array_new_iter(plist_t node, plist_array_iter *iter) |
| { |
| if (iter) |
| { |
| @@ -585,7 +585,7 @@ |
| } |
| } |
| |
| -PLIST_API void plist_array_next_item(plist_t node, plist_array_iter iter, plist_t *item) |
| +void plist_array_next_item(plist_t node, plist_array_iter iter, plist_t *item) |
| { |
| node_t** iter_node = (node_t**)iter; |
| |
| @@ -604,7 +604,7 @@ |
| } |
| } |
| |
| -PLIST_API uint32_t plist_dict_get_size(plist_t node) |
| +uint32_t plist_dict_get_size(plist_t node) |
| { |
| uint32_t ret = 0; |
| if (node && PLIST_DICT == plist_get_node_type(node)) |
| @@ -614,7 +614,7 @@ |
| return ret; |
| } |
| |
| -PLIST_API void plist_dict_new_iter(plist_t node, plist_dict_iter *iter) |
| +void plist_dict_new_iter(plist_t node, plist_dict_iter *iter) |
| { |
| if (iter) |
| { |
| @@ -623,7 +623,7 @@ |
| } |
| } |
| |
| -PLIST_API void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val) |
| +void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val) |
| { |
| node_t** iter_node = (node_t**)iter; |
| |
| @@ -651,7 +651,7 @@ |
| } |
| } |
| |
| -PLIST_API void plist_dict_get_item_key(plist_t node, char **key) |
| +void plist_dict_get_item_key(plist_t node, char **key) |
| { |
| plist_t father = plist_get_parent(node); |
| if (PLIST_DICT == plist_get_node_type(father)) |
| @@ -660,7 +660,7 @@ |
| } |
| } |
| |
| -PLIST_API plist_t plist_dict_item_get_key(plist_t node) |
| +plist_t plist_dict_item_get_key(plist_t node) |
| { |
| plist_t ret = NULL; |
| plist_t father = plist_get_parent(node); |
| @@ -671,7 +671,7 @@ |
| return ret; |
| } |
| |
| -PLIST_API plist_t plist_dict_get_item(plist_t node, const char* key) |
| +plist_t plist_dict_get_item(plist_t node, const char* key) |
| { |
| plist_t ret = NULL; |
| |
| @@ -704,7 +704,7 @@ |
| return ret; |
| } |
| |
| -PLIST_API void plist_dict_set_item(plist_t node, const char* key, plist_t item) |
| +void plist_dict_set_item(plist_t node, const char* key, plist_t item) |
| { |
| if (node && PLIST_DICT == plist_get_node_type(node)) { |
| node_t* old_item = plist_dict_get_item(node, key); |
| @@ -746,12 +746,12 @@ |
| } |
| } |
| |
| -PLIST_API void plist_dict_insert_item(plist_t node, const char* key, plist_t item) |
| +void plist_dict_insert_item(plist_t node, const char* key, plist_t item) |
| { |
| plist_dict_set_item(node, key, item); |
| } |
| |
| -PLIST_API void plist_dict_remove_item(plist_t node, const char* key) |
| +void plist_dict_remove_item(plist_t node, const char* key) |
| { |
| if (node && PLIST_DICT == plist_get_node_type(node)) |
| { |
| @@ -769,7 +769,7 @@ |
| } |
| } |
| |
| -PLIST_API void plist_dict_merge(plist_t *target, plist_t source) |
| +void plist_dict_merge(plist_t *target, plist_t source) |
| { |
| if (!target || !*target || (plist_get_node_type(*target) != PLIST_DICT) || !source || (plist_get_node_type(source) != PLIST_DICT)) |
| return; |
| @@ -793,7 +793,7 @@ |
| free(it); |
| } |
| |
| -PLIST_API plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v) |
| +plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v) |
| { |
| plist_t current = plist; |
| plist_type type = PLIST_NONE; |
| @@ -817,7 +817,7 @@ |
| return current; |
| } |
| |
| -PLIST_API plist_t plist_access_path(plist_t plist, uint32_t length, ...) |
| +plist_t plist_access_path(plist_t plist, uint32_t length, ...) |
| { |
| plist_t ret = NULL; |
| va_list v; |
| @@ -868,12 +868,12 @@ |
| } |
| } |
| |
| -PLIST_API plist_t plist_get_parent(plist_t node) |
| +plist_t plist_get_parent(plist_t node) |
| { |
| return node ? (plist_t) ((node_t*) node)->parent : NULL; |
| } |
| |
| -PLIST_API plist_type plist_get_node_type(plist_t node) |
| +plist_type plist_get_node_type(plist_t node) |
| { |
| if (node) |
| { |
| @@ -884,7 +884,7 @@ |
| return PLIST_NONE; |
| } |
| |
| -PLIST_API void plist_get_key_val(plist_t node, char **val) |
| +void plist_get_key_val(plist_t node, char **val) |
| { |
| if (!node || !val) |
| return; |
| @@ -898,7 +898,7 @@ |
| assert(length == strlen(*val)); |
| } |
| |
| -PLIST_API void plist_get_string_val(plist_t node, char **val) |
| +void plist_get_string_val(plist_t node, char **val) |
| { |
| if (!node || !val) |
| return; |
| @@ -912,7 +912,7 @@ |
| assert(length == strlen(*val)); |
| } |
| |
| -PLIST_API const char* plist_get_string_ptr(plist_t node, uint64_t* length) |
| +const char* plist_get_string_ptr(plist_t node, uint64_t* length) |
| { |
| if (!node) |
| return NULL; |
| @@ -925,7 +925,7 @@ |
| return (const char*)data->strval; |
| } |
| |
| -PLIST_API void plist_get_bool_val(plist_t node, uint8_t * val) |
| +void plist_get_bool_val(plist_t node, uint8_t * val) |
| { |
| if (!node || !val) |
| return; |
| @@ -937,7 +937,7 @@ |
| assert(length == sizeof(uint8_t)); |
| } |
| |
| -PLIST_API void plist_get_uint_val(plist_t node, uint64_t * val) |
| +void plist_get_uint_val(plist_t node, uint64_t * val) |
| { |
| if (!node || !val) |
| return; |
| @@ -949,7 +949,7 @@ |
| assert(length == sizeof(uint64_t) || length == 16); |
| } |
| |
| -PLIST_API void plist_get_uid_val(plist_t node, uint64_t * val) |
| +void plist_get_uid_val(plist_t node, uint64_t * val) |
| { |
| if (!node || !val) |
| return; |
| @@ -961,7 +961,7 @@ |
| assert(length == sizeof(uint64_t)); |
| } |
| |
| -PLIST_API void plist_get_real_val(plist_t node, double *val) |
| +void plist_get_real_val(plist_t node, double *val) |
| { |
| if (!node || !val) |
| return; |
| @@ -973,7 +973,7 @@ |
| assert(length == sizeof(double)); |
| } |
| |
| -PLIST_API void plist_get_data_val(plist_t node, char **val, uint64_t * length) |
| +void plist_get_data_val(plist_t node, char **val, uint64_t * length) |
| { |
| if (!node || !val || !length) |
| return; |
| @@ -983,7 +983,7 @@ |
| plist_get_type_and_value(node, &type, (void *) val, length); |
| } |
| |
| -PLIST_API const char* plist_get_data_ptr(plist_t node, uint64_t* length) |
| +const char* plist_get_data_ptr(plist_t node, uint64_t* length) |
| { |
| if (!node || !length) |
| return NULL; |
| @@ -995,7 +995,7 @@ |
| return (const char*)data->buff; |
| } |
| |
| -PLIST_API void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec) |
| +void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec) |
| { |
| if (!node) |
| return; |
| @@ -1071,7 +1071,7 @@ |
| return FALSE; |
| } |
| |
| -PLIST_API char plist_compare_node_value(plist_t node_l, plist_t node_r) |
| +char plist_compare_node_value(plist_t node_l, plist_t node_r) |
| { |
| return plist_data_compare(node_l, node_r); |
| } |
| @@ -1130,7 +1130,7 @@ |
| } |
| } |
| |
| -PLIST_API void plist_set_key_val(plist_t node, const char *val) |
| +void plist_set_key_val(plist_t node, const char *val) |
| { |
| plist_t father = plist_get_parent(node); |
| plist_t item = plist_dict_get_item(father, val); |
| @@ -1140,37 +1140,37 @@ |
| plist_set_element_val(node, PLIST_KEY, val, strlen(val)); |
| } |
| |
| -PLIST_API void plist_set_string_val(plist_t node, const char *val) |
| +void plist_set_string_val(plist_t node, const char *val) |
| { |
| plist_set_element_val(node, PLIST_STRING, val, strlen(val)); |
| } |
| |
| -PLIST_API void plist_set_bool_val(plist_t node, uint8_t val) |
| +void plist_set_bool_val(plist_t node, uint8_t val) |
| { |
| plist_set_element_val(node, PLIST_BOOLEAN, &val, sizeof(uint8_t)); |
| } |
| |
| -PLIST_API void plist_set_uint_val(plist_t node, uint64_t val) |
| +void plist_set_uint_val(plist_t node, uint64_t val) |
| { |
| plist_set_element_val(node, PLIST_UINT, &val, sizeof(uint64_t)); |
| } |
| |
| -PLIST_API void plist_set_uid_val(plist_t node, uint64_t val) |
| +void plist_set_uid_val(plist_t node, uint64_t val) |
| { |
| plist_set_element_val(node, PLIST_UID, &val, sizeof(uint64_t)); |
| } |
| |
| -PLIST_API void plist_set_real_val(plist_t node, double val) |
| +void plist_set_real_val(plist_t node, double val) |
| { |
| plist_set_element_val(node, PLIST_REAL, &val, sizeof(double)); |
| } |
| |
| -PLIST_API void plist_set_data_val(plist_t node, const char *val, uint64_t length) |
| +void plist_set_data_val(plist_t node, const char *val, uint64_t length) |
| { |
| plist_set_element_val(node, PLIST_DATA, val, length); |
| } |
| |
| -PLIST_API void plist_set_date_val(plist_t node, int32_t sec, int32_t usec) |
| +void plist_set_date_val(plist_t node, int32_t sec, int32_t usec) |
| { |
| double val = (double)sec + (double)usec / 1000000; |
| plist_set_element_val(node, PLIST_DATE, &val, sizeof(struct timeval)); |
| diff -Naur libplist-2.1.0-orig/src/plist.h libplist-2.1.0/src/plist.h |
| --- libplist-2.1.0-orig/src/plist.h 2019-11-07 07:14:43.000000000 +0300 |
| +++ libplist-2.1.0/src/plist.h 2019-11-10 00:11:44.205472900 +0300 |
| @@ -37,16 +37,6 @@ |
| #pragma warning(disable:4244) |
| #endif |
| |
| -#ifdef WIN32 |
| - #define PLIST_API __declspec( dllexport ) |
| -#else |
| - #ifdef HAVE_FVISIBILITY |
| - #define PLIST_API __attribute__((visibility("default"))) |
| - #else |
| - #define PLIST_API |
| - #endif |
| -#endif |
| - |
| struct plist_data_s |
| { |
| union |
| diff -Naur libplist-2.1.0-orig/src/xplist.c libplist-2.1.0/src/xplist.c |
| --- libplist-2.1.0-orig/src/xplist.c 2019-11-07 07:14:43.000000000 +0300 |
| +++ libplist-2.1.0/src/xplist.c 2019-11-09 23:58:08.974844300 +0300 |
| @@ -512,7 +512,7 @@ |
| } |
| } |
| |
| -PLIST_API void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length) |
| +void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length) |
| { |
| uint64_t size = 0; |
| node_estimate_size(plist, &size, 0); |
| @@ -533,7 +533,7 @@ |
| str_buf_free(outbuf); |
| } |
| |
| -PLIST_API void plist_to_xml_free(char *plist_xml) |
| +void plist_to_xml_free(char *plist_xml) |
| { |
| free(plist_xml); |
| } |
| @@ -1424,7 +1424,7 @@ |
| } |
| } |
| |
| -PLIST_API void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist) |
| +void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist) |
| { |
| if (!plist_xml || (length == 0)) { |
| *plist = NULL; |