Commit 62813daf authored by Nikias Bassen's avatar Nikias Bassen

Avoid exporting non-public symbols

parent eab599c1
...@@ -102,9 +102,14 @@ fi ...@@ -102,9 +102,14 @@ fi
AM_CONDITIONAL([HAVE_CYTHON],[test "x$CYTHON_SUB" = "xcython"]) AM_CONDITIONAL([HAVE_CYTHON],[test "x$CYTHON_SUB" = "xcython"])
AC_SUBST([CYTHON_SUB]) AC_SUBST([CYTHON_SUB])
AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter") AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -fvisibility=hidden")
AC_SUBST(GLOBAL_CFLAGS) AC_SUBST(GLOBAL_CFLAGS)
case "$GLOBAL_CFLAGS" in
*-fvisibility=hidden*)
AC_DEFINE([HAVE_FVISIBILITY], [1], [Define if compiled with -fvisibility=hidden])
esac
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_OUTPUT([ AC_OUTPUT([
......
...@@ -39,15 +39,8 @@ extern "C" ...@@ -39,15 +39,8 @@ extern "C"
typedef unsigned __int32 uint32_t; typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t; typedef unsigned __int64 uint64_t;
#ifdef plist_EXPORTS
#define PLIST_API __declspec( dllexport )
#else
#define PLIST_API __declspec( dllimport )
#endif
#else #else
#include <stdint.h> #include <stdint.h>
#define PLIST_API
#endif #endif
#ifdef __llvm__ #ifdef __llvm__
...@@ -130,7 +123,7 @@ extern "C" ...@@ -130,7 +123,7 @@ extern "C"
* @return the created plist * @return the created plist
* @sa #plist_type * @sa #plist_type
*/ */
PLIST_API plist_t plist_new_dict(void); plist_t plist_new_dict(void);
/** /**
* Create a new root plist_t type #PLIST_ARRAY * Create a new root plist_t type #PLIST_ARRAY
...@@ -138,7 +131,7 @@ extern "C" ...@@ -138,7 +131,7 @@ extern "C"
* @return the created plist * @return the created plist
* @sa #plist_type * @sa #plist_type
*/ */
PLIST_API plist_t plist_new_array(void); plist_t plist_new_array(void);
/** /**
* Create a new plist_t type #PLIST_STRING * Create a new plist_t type #PLIST_STRING
...@@ -147,7 +140,7 @@ extern "C" ...@@ -147,7 +140,7 @@ extern "C"
* @return the created item * @return the created item
* @sa #plist_type * @sa #plist_type
*/ */
PLIST_API plist_t plist_new_string(const char *val); plist_t plist_new_string(const char *val);
/** /**
* Create a new plist_t type #PLIST_BOOLEAN * Create a new plist_t type #PLIST_BOOLEAN
...@@ -156,7 +149,7 @@ extern "C" ...@@ -156,7 +149,7 @@ extern "C"
* @return the created item * @return the created item
* @sa #plist_type * @sa #plist_type
*/ */
PLIST_API plist_t plist_new_bool(uint8_t val); plist_t plist_new_bool(uint8_t val);
/** /**
* Create a new plist_t type #PLIST_UINT * Create a new plist_t type #PLIST_UINT
...@@ -165,7 +158,7 @@ extern "C" ...@@ -165,7 +158,7 @@ extern "C"
* @return the created item * @return the created item
* @sa #plist_type * @sa #plist_type
*/ */
PLIST_API plist_t plist_new_uint(uint64_t val); plist_t plist_new_uint(uint64_t val);
/** /**
* Create a new plist_t type #PLIST_REAL * Create a new plist_t type #PLIST_REAL
...@@ -174,7 +167,7 @@ extern "C" ...@@ -174,7 +167,7 @@ extern "C"
* @return the created item * @return the created item
* @sa #plist_type * @sa #plist_type
*/ */
PLIST_API plist_t plist_new_real(double val); plist_t plist_new_real(double val);
/** /**
* Create a new plist_t type #PLIST_DATA * Create a new plist_t type #PLIST_DATA
...@@ -184,7 +177,7 @@ extern "C" ...@@ -184,7 +177,7 @@ extern "C"
* @return the created item * @return the created item
* @sa #plist_type * @sa #plist_type
*/ */
PLIST_API plist_t plist_new_data(const char *val, uint64_t length); plist_t plist_new_data(const char *val, uint64_t length);
/** /**
* Create a new plist_t type #PLIST_DATE * Create a new plist_t type #PLIST_DATE
...@@ -194,7 +187,7 @@ extern "C" ...@@ -194,7 +187,7 @@ extern "C"
* @return the created item * @return the created item
* @sa #plist_type * @sa #plist_type
*/ */
PLIST_API plist_t plist_new_date(int32_t sec, int32_t usec); plist_t plist_new_date(int32_t sec, int32_t usec);
/** /**
* Create a new plist_t type #PLIST_UID * Create a new plist_t type #PLIST_UID
...@@ -203,14 +196,14 @@ extern "C" ...@@ -203,14 +196,14 @@ extern "C"
* @return the created item * @return the created item
* @sa #plist_type * @sa #plist_type
*/ */
PLIST_API plist_t plist_new_uid(uint64_t val); plist_t plist_new_uid(uint64_t val);
/** /**
* Destruct a plist_t node and all its children recursively * Destruct a plist_t node and all its children recursively
* *
* @param plist the plist to free * @param plist the plist to free
*/ */
PLIST_API void plist_free(plist_t plist); void plist_free(plist_t plist);
/** /**
* Return a copy of passed node and it's children * Return a copy of passed node and it's children
...@@ -218,7 +211,7 @@ extern "C" ...@@ -218,7 +211,7 @@ extern "C"
* @param node the plist to copy * @param node the plist to copy
* @return copied plist * @return copied plist
*/ */
PLIST_API plist_t plist_copy(plist_t node); plist_t plist_copy(plist_t node);
/******************************************** /********************************************
...@@ -233,7 +226,7 @@ extern "C" ...@@ -233,7 +226,7 @@ extern "C"
* @param node the node of type #PLIST_ARRAY * @param node the node of type #PLIST_ARRAY
* @return size of the #PLIST_ARRAY node * @return size of the #PLIST_ARRAY node
*/ */
PLIST_API uint32_t plist_array_get_size(plist_t node); uint32_t plist_array_get_size(plist_t node);
/** /**
* Get the nth item in a #PLIST_ARRAY node. * Get the nth item in a #PLIST_ARRAY node.
...@@ -242,7 +235,7 @@ extern "C" ...@@ -242,7 +235,7 @@ extern "C"
* @param n the index of the item to get. Range is [0, array_size[ * @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 * @return the nth item or NULL if node is not of type #PLIST_ARRAY
*/ */
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);
/** /**
* Get the index of an item. item must be a member of a #PLIST_ARRAY node. * Get the index of an item. item must be a member of a #PLIST_ARRAY node.
...@@ -250,7 +243,7 @@ extern "C" ...@@ -250,7 +243,7 @@ extern "C"
* @param node the node * @param node the node
* @return the node index * @return the node index
*/ */
PLIST_API uint32_t plist_array_get_item_index(plist_t node); uint32_t plist_array_get_item_index(plist_t node);
/** /**
* Set the nth item in a #PLIST_ARRAY node. * Set the nth item in a #PLIST_ARRAY node.
...@@ -260,7 +253,7 @@ extern "C" ...@@ -260,7 +253,7 @@ extern "C"
* @param item the new item at index n. The array is responsible for freeing item when it is no longer needed. * @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. * @param n the index of the item to get. Range is [0, array_size[. Assert if n is not in range.
*/ */
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);
/** /**
* Append a new item at the end of a #PLIST_ARRAY node. * Append a new item at the end of a #PLIST_ARRAY node.
...@@ -268,7 +261,7 @@ extern "C" ...@@ -268,7 +261,7 @@ extern "C"
* @param node the node of type #PLIST_ARRAY * @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. * @param item the new item. The array is responsible for freeing item when it is no longer needed.
*/ */
PLIST_API void plist_array_append_item(plist_t node, plist_t item); void plist_array_append_item(plist_t node, plist_t item);
/** /**
* Insert a new item at position n in a #PLIST_ARRAY node. * Insert a new item at position n in a #PLIST_ARRAY node.
...@@ -277,7 +270,7 @@ extern "C" ...@@ -277,7 +270,7 @@ extern "C"
* @param item the new item to insert. The array is responsible for freeing item when it is no longer needed. * @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. * @param n The position at which the node will be stored. Range is [0, array_size[. Assert if n is not in range.
*/ */
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);
/** /**
* Remove an existing position in a #PLIST_ARRAY node. * Remove an existing position in a #PLIST_ARRAY node.
...@@ -286,7 +279,7 @@ extern "C" ...@@ -286,7 +279,7 @@ extern "C"
* @param node the node of type #PLIST_ARRAY * @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. * @param n The position to remove. Range is [0, array_size[. Assert if n is not in range.
*/ */
PLIST_API void plist_array_remove_item(plist_t node, uint32_t n); void plist_array_remove_item(plist_t node, uint32_t n);
/******************************************** /********************************************
* * * *
...@@ -300,7 +293,7 @@ extern "C" ...@@ -300,7 +293,7 @@ extern "C"
* @param node the node of type #PLIST_DICT * @param node the node of type #PLIST_DICT
* @return size of the #PLIST_DICT node * @return size of the #PLIST_DICT node
*/ */
PLIST_API uint32_t plist_dict_get_size(plist_t node); uint32_t plist_dict_get_size(plist_t node);
/** /**
* Create an iterator of a #PLIST_DICT node. * Create an iterator of a #PLIST_DICT node.
...@@ -309,7 +302,7 @@ extern "C" ...@@ -309,7 +302,7 @@ extern "C"
* @param node the node of type #PLIST_DICT * @param node the node of type #PLIST_DICT
* @param iter iterator of the #PLIST_DICT node * @param iter iterator of the #PLIST_DICT node
*/ */
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);
/** /**
* Increment iterator of a #PLIST_DICT node. * Increment iterator of a #PLIST_DICT node.
...@@ -321,7 +314,7 @@ extern "C" ...@@ -321,7 +314,7 @@ extern "C"
* @param val a location to store the value, or NULL. The caller should *not* * @param val a location to store the value, or NULL. The caller should *not*
* free the returned value. * free the returned value.
*/ */
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);
/** /**
* Get key associated to an item. Item must be member of a dictionary * Get key associated to an item. Item must be member of a dictionary
...@@ -329,7 +322,7 @@ extern "C" ...@@ -329,7 +322,7 @@ extern "C"
* @param node the node * @param node the node
* @param key a location to store the key. The caller is responsible for freeing the returned string. * @param key a location to store the key. The caller is responsible for freeing the returned string.
*/ */
PLIST_API void plist_dict_get_item_key(plist_t node, char **key); void plist_dict_get_item_key(plist_t node, char **key);
/** /**
* Get the nth item in a #PLIST_DICT node. * Get the nth item in a #PLIST_DICT node.
...@@ -339,7 +332,7 @@ extern "C" ...@@ -339,7 +332,7 @@ extern "C"
* @return the item or NULL if node is not of type #PLIST_DICT. The caller should not free * @return the item or NULL if node is not of type #PLIST_DICT. The caller should not free
* the returned node. * the returned node.
*/ */
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);
/** /**
* Set item identified by key in a #PLIST_DICT node. * Set item identified by key in a #PLIST_DICT node.
...@@ -350,7 +343,7 @@ extern "C" ...@@ -350,7 +343,7 @@ extern "C"
* @param item the new item associated to key * @param item the new item associated to key
* @param key the identifier of the item to set. * @param key the identifier of the item to set.
*/ */
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);
/** /**
* Insert a new item into a #PLIST_DICT node. * Insert a new item into a #PLIST_DICT node.
...@@ -362,7 +355,7 @@ extern "C" ...@@ -362,7 +355,7 @@ extern "C"
* @param key The identifier of the item to insert. * @param key The identifier of the item to insert.
*/ */
PLIST_WARN_DEPRECATED("use plist_dict_set_item instead") PLIST_WARN_DEPRECATED("use plist_dict_set_item instead")
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);
/** /**
* Remove an existing position in a #PLIST_DICT node. * Remove an existing position in a #PLIST_DICT node.
...@@ -371,7 +364,7 @@ extern "C" ...@@ -371,7 +364,7 @@ extern "C"
* @param node the node of type #PLIST_DICT * @param node the node of type #PLIST_DICT
* @param key The identifier of the item to remove. Assert if identifier is not present. * @param key The identifier of the item to remove. Assert if identifier is not present.
*/ */
PLIST_API void plist_dict_remove_item(plist_t node, const char* key); void plist_dict_remove_item(plist_t node, const char* key);
/** /**
* Merge a dictionary into another. This will add all key/value pairs * Merge a dictionary into another. This will add all key/value pairs
...@@ -381,7 +374,7 @@ extern "C" ...@@ -381,7 +374,7 @@ extern "C"
* @param target pointer to an existing node of type #PLIST_DICT * @param target pointer to an existing node of type #PLIST_DICT
* @param source node of type #PLIST_DICT that should be merged into target * @param source node of type #PLIST_DICT that should be merged into target
*/ */
PLIST_API void plist_dict_merge(plist_t *target, plist_t source); void plist_dict_merge(plist_t *target, plist_t source);
/******************************************** /********************************************
...@@ -395,7 +388,7 @@ extern "C" ...@@ -395,7 +388,7 @@ extern "C"
* *
* @param node the parent (NULL if node is root) * @param node the parent (NULL if node is root)
*/ */
PLIST_API plist_t plist_get_parent(plist_t node); plist_t plist_get_parent(plist_t node);
/** /**
* Get the #plist_type of a node. * Get the #plist_type of a node.
...@@ -403,7 +396,7 @@ extern "C" ...@@ -403,7 +396,7 @@ extern "C"
* @param node the node * @param node the node
* @return the type of the node * @return the type of the node
*/ */
PLIST_API plist_type plist_get_node_type(plist_t node); plist_type plist_get_node_type(plist_t node);
/** /**
* Get the value of a #PLIST_KEY node. * Get the value of a #PLIST_KEY node.
...@@ -413,7 +406,7 @@ extern "C" ...@@ -413,7 +406,7 @@ extern "C"
* @param val a pointer to a C-string. This function allocates the memory, * @param val a pointer to a C-string. This function allocates the memory,
* caller is responsible for freeing it. * caller is responsible for freeing it.
*/ */
PLIST_API void plist_get_key_val(plist_t node, char **val); void plist_get_key_val(plist_t node, char **val);
/** /**
* Get the value of a #PLIST_STRING node. * Get the value of a #PLIST_STRING node.
...@@ -423,7 +416,7 @@ extern "C" ...@@ -423,7 +416,7 @@ extern "C"
* @param val a pointer to a C-string. This function allocates the memory, * @param val a pointer to a C-string. This function allocates the memory,
* caller is responsible for freeing it. Data is UTF-8 encoded. * caller is responsible for freeing it. Data is UTF-8 encoded.
*/ */
PLIST_API void plist_get_string_val(plist_t node, char **val); void plist_get_string_val(plist_t node, char **val);
/** /**
* Get the value of a #PLIST_BOOLEAN node. * Get the value of a #PLIST_BOOLEAN node.
...@@ -432,7 +425,7 @@ extern "C" ...@@ -432,7 +425,7 @@ extern "C"
* @param node the node * @param node the node
* @param val a pointer to a uint8_t variable. * @param val a pointer to a uint8_t variable.
*/ */
PLIST_API void plist_get_bool_val(plist_t node, uint8_t * val); void plist_get_bool_val(plist_t node, uint8_t * val);
/** /**
* Get the value of a #PLIST_UINT node. * Get the value of a #PLIST_UINT node.
...@@ -441,7 +434,7 @@ extern "C" ...@@ -441,7 +434,7 @@ extern "C"
* @param node the node * @param node the node
* @param val a pointer to a uint64_t variable. * @param val a pointer to a uint64_t variable.
*/ */
PLIST_API void plist_get_uint_val(plist_t node, uint64_t * val); void plist_get_uint_val(plist_t node, uint64_t * val);
/** /**
* Get the value of a #PLIST_REAL node. * Get the value of a #PLIST_REAL node.
...@@ -450,7 +443,7 @@ extern "C" ...@@ -450,7 +443,7 @@ extern "C"
* @param node the node * @param node the node
* @param val a pointer to a double variable. * @param val a pointer to a double variable.
*/ */
PLIST_API void plist_get_real_val(plist_t node, double *val); void plist_get_real_val(plist_t node, double *val);
/** /**
* Get the value of a #PLIST_DATA node. * Get the value of a #PLIST_DATA node.
...@@ -461,7 +454,7 @@ extern "C" ...@@ -461,7 +454,7 @@ extern "C"
* caller is responsible for freeing it. * caller is responsible for freeing it.
* @param length the length of the buffer * @param length the length of the buffer
*/ */
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);
/** /**
* Get the value of a #PLIST_DATE node. * Get the value of a #PLIST_DATE node.
...@@ -471,7 +464,7 @@ extern "C" ...@@ -471,7 +464,7 @@ extern "C"
* @param sec a pointer to an int32_t variable. Represents the number of seconds since 01/01/2001. * @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 * @param usec a pointer to an int32_t variable. Represents the number of microseconds
*/ */
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);
/** /**
* Get the value of a #PLIST_UID node. * Get the value of a #PLIST_UID node.
...@@ -480,7 +473,7 @@ extern "C" ...@@ -480,7 +473,7 @@ extern "C"
* @param node the node * @param node the node
* @param val a pointer to a uint64_t variable. * @param val a pointer to a uint64_t variable.
*/ */
PLIST_API void plist_get_uid_val(plist_t node, uint64_t * val); void plist_get_uid_val(plist_t node, uint64_t * val);
/******************************************** /********************************************
...@@ -496,7 +489,7 @@ extern "C" ...@@ -496,7 +489,7 @@ extern "C"
* @param node the node * @param node the node
* @param val the key value * @param val the key value
*/ */
PLIST_API void plist_set_key_val(plist_t node, const char *val); void plist_set_key_val(plist_t node, const char *val);
/** /**
* Set the value of a node. * Set the value of a node.
...@@ -506,7 +499,7 @@ extern "C" ...@@ -506,7 +499,7 @@ extern "C"
* @param val the string value. The string is copied when set and will be * @param val the string value. The string is copied when set and will be
* freed by the node. * freed by the node.
*/ */
PLIST_API void plist_set_string_val(plist_t node, const char *val); void plist_set_string_val(plist_t node, const char *val);
/** /**
* Set the value of a node. * Set the value of a node.
...@@ -515,7 +508,7 @@ extern "C" ...@@ -515,7 +508,7 @@ extern "C"
* @param node the node * @param node the node
* @param val the boolean value * @param val the boolean value
*/ */
PLIST_API void plist_set_bool_val(plist_t node, uint8_t val); void plist_set_bool_val(plist_t node, uint8_t val);
/** /**
* Set the value of a node. * Set the value of a node.
...@@ -524,7 +517,7 @@ extern "C" ...@@ -524,7 +517,7 @@ extern "C"
* @param node the node * @param node the node
* @param val the unsigned integer value * @param val the unsigned integer value
*/ */
PLIST_API void plist_set_uint_val(plist_t node, uint64_t val); void plist_set_uint_val(plist_t node, uint64_t val);
/** /**
* Set the value of a node. * Set the value of a node.
...@@ -533,7 +526,7 @@ extern "C" ...@@ -533,7 +526,7 @@ extern "C"
* @param node the node * @param node the node
* @param val the real value * @param val the real value
*/ */
PLIST_API void plist_set_real_val(plist_t node, double val); void plist_set_real_val(plist_t node, double val);
/** /**
* Set the value of a node. * Set the value of a node.
...@@ -544,7 +537,7 @@ extern "C" ...@@ -544,7 +537,7 @@ extern "C"
* be freed by the node. * be freed by the node.
* @param length the length of the buffer * @param length the length of the buffer
*/ */
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);
/** /**
* Set the value of a node. * Set the value of a node.
...@@ -554,7 +547,7 @@ extern "C" ...@@ -554,7 +547,7 @@ extern "C"
* @param sec the number of seconds since 01/01/2001 * @param sec the number of seconds since 01/01/2001
* @param usec the number of microseconds * @param usec the number of microseconds
*/ */
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);
/** /**
* Set the value of a node. * Set the value of a node.
...@@ -563,7 +556,7 @@ extern "C" ...@@ -563,7 +556,7 @@ extern "C"
* @param node the node * @param node the node
* @param val the unsigned integer value * @param val the unsigned integer value
*/ */
PLIST_API void plist_set_uid_val(plist_t node, uint64_t val); void plist_set_uid_val(plist_t node, uint64_t val);
/******************************************** /********************************************
...@@ -580,7 +573,7 @@ extern "C" ...@@ -580,7 +573,7 @@ extern "C"
* caller is responsible for freeing it. Data is UTF-8 encoded. * 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. * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer.
*/ */
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);
/** /**
* Export the #plist_t structure to binary format. * Export the #plist_t structure to binary format.
...@@ -590,7 +583,7 @@ extern "C" ...@@ -590,7 +583,7 @@ extern "C"
* caller is responsible for freeing it. * caller is responsible for freeing it.
* @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer. * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer.
*/ */
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);
/** /**
* Import the #plist_t structure from XML format. * Import the #plist_t structure from XML format.
...@@ -599,7 +592,7 @@ extern "C" ...@@ -599,7 +592,7 @@ extern "C"
* @param length length of the buffer to read. * @param length length of the buffer to read.
* @param plist a pointer to the imported plist. * @param plist a pointer to the imported plist.
*/ */
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);
/** /**
* Import the #plist_t structure from binary format. * Import the #plist_t structure from binary format.
...@@ -608,7 +601,7 @@ extern "C" ...@@ -608,7 +601,7 @@ extern "C"
* @param length length of the buffer to read. * @param length length of the buffer to read.
* @param plist a pointer to the imported plist. * @param plist a pointer to the imported 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);
/******************************************** /********************************************
...@@ -626,7 +619,7 @@ extern "C" ...@@ -626,7 +619,7 @@ extern "C"
* @param length length of the path to access * @param length length of the path to access
* @return the value to access. * @return the value to access.
*/ */
PLIST_API plist_t plist_access_path(plist_t plist, uint32_t length, ...); plist_t plist_access_path(plist_t plist, uint32_t length, ...);
/** /**
* Variadic version of #plist_access_path. * Variadic version of #plist_access_path.
...@@ -636,7 +629,7 @@ extern "C" ...@@ -636,7 +629,7 @@ extern "C"
* @param v list of array's index and dic'st key * @param v list of array's index and dic'st key
* @return the value to access. * @return the value to access.
*/ */
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);
/** /**
* Compare two node values * Compare two node values
...@@ -645,7 +638,7 @@ extern "C" ...@@ -645,7 +638,7 @@ extern "C"
* @param node_r rigth node to compare * @param node_r rigth node to compare
* @return TRUE is type and value match, FALSE otherwise. * @return TRUE is type and value match, FALSE otherwise.
*/ */
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);
/*@}*/ /*@}*/
......
...@@ -21,9 +21,8 @@ ...@@ -21,9 +21,8 @@
#ifndef BASE64_H #ifndef BASE64_H
#define BASE64_H #define BASE64_H
#include <stdlib.h> #include <stdlib.h>
#include "common.h"
_PLIST_INTERNAL char *base64encode(const unsigned char *buf, size_t *size); char *base64encode(const unsigned char *buf, size_t *size);
_PLIST_INTERNAL unsigned char *base64decode(const char *buf, size_t *size); unsigned char *base64decode(const char *buf, size_t *size);
#endif #endif
...@@ -599,7 +599,7 @@ static void* copy_plist_data(const void* src) ...@@ -599,7 +599,7 @@ static void* copy_plist_data(const void* src)
return dstdata; return dstdata;
} }
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)
{ {
char *trailer = NULL; char *trailer = NULL;
...@@ -1095,7 +1095,7 @@ static uint16_t *plist_utf8_to_utf16(char *unistr, long size, long *items_read, ...@@ -1095,7 +1095,7 @@ static uint16_t *plist_utf8_to_utf16(char *unistr, long size, long *items_read,
} }
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)
{ {
ptrarray_t* objects = NULL; ptrarray_t* objects = NULL;
hashtable_t* ref_table = NULL; hashtable_t* ref_table = NULL;
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#ifndef BYTEARRAY_H #ifndef BYTEARRAY_H
#define BYTEARRAY_H #define BYTEARRAY_H
#include <stdlib.h> #include <stdlib.h>
#include "common.h"
typedef struct bytearray_t { typedef struct bytearray_t {
void *data; void *data;
...@@ -29,8 +28,8 @@ typedef struct bytearray_t { ...@@ -29,8 +28,8 @@ typedef struct bytearray_t {
size_t capacity; size_t capacity;
} bytearray_t; } bytearray_t;
_PLIST_INTERNAL bytearray_t *byte_array_new(); bytearray_t *byte_array_new();
_PLIST_INTERNAL void byte_array_free(bytearray_t *ba); void byte_array_free(bytearray_t *ba);
_PLIST_INTERNAL void byte_array_append(bytearray_t *ba, void *buf, size_t len); void byte_array_append(bytearray_t *ba, void *buf, size_t len);
#endif #endif
...@@ -17,12 +17,4 @@ ...@@ -17,12 +17,4 @@
#endif #endif
#endif #endif
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__) && !defined(WIN32)
# define _PLIST_INTERNAL __attribute__((visibility("hidden")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
# define _PLIST_INTERNAL __hidden
#else /* not gcc >= 4 and not Sun Studio >= 8 */
# define _PLIST_INTERNAL
#endif /* GNUC >= 4 */
#endif #endif
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#ifndef HASHTABLE_H #ifndef HASHTABLE_H
#define HASHTABLE_H #define HASHTABLE_H
#include <stdlib.h> #include <stdlib.h>
#include "common.h"
typedef struct hashentry_t { typedef struct hashentry_t {
void *key; void *key;
...@@ -39,10 +38,10 @@ typedef struct hashtable_t { ...@@ -39,10 +38,10 @@ typedef struct hashtable_t {
compare_func_t compare_func; compare_func_t compare_func;
} hashtable_t; } hashtable_t;
_PLIST_INTERNAL hashtable_t* hash_table_new(hash_func_t hash_func, compare_func_t compare_func); hashtable_t* hash_table_new(hash_func_t hash_func, compare_func_t compare_func);
_PLIST_INTERNAL void hash_table_destroy(hashtable_t *ht); void hash_table_destroy(hashtable_t *ht);
_PLIST_INTERNAL void hash_table_insert(hashtable_t* ht, void *key, void *value); void hash_table_insert(hashtable_t* ht, void *key, void *value);
_PLIST_INTERNAL void* hash_table_lookup(hashtable_t* ht, void *key); void* hash_table_lookup(hashtable_t* ht, void *key);
#endif #endif
...@@ -87,14 +87,14 @@ static int plist_free_node(node_t* node) ...@@ -87,14 +87,14 @@ static int plist_free_node(node_t* node)
return node_index; return node_index;
} }
plist_t plist_new_dict(void) PLIST_API plist_t plist_new_dict(void)
{ {
plist_data_t data = plist_new_plist_data(); plist_data_t data = plist_new_plist_data();
data->type = PLIST_DICT; data->type = PLIST_DICT;
return plist_new_node(data); return plist_new_node(data);
} }
plist_t plist_new_array(void) PLIST_API plist_t plist_new_array(void)
{ {
plist_data_t data = plist_new_plist_data(); plist_data_t data = plist_new_plist_data();
data->type = PLIST_ARRAY; data->type = PLIST_ARRAY;
...@@ -111,7 +111,7 @@ static plist_t plist_new_key(const char *val) ...@@ -111,7 +111,7 @@ static plist_t plist_new_key(const char *val)
return plist_new_node(data); return plist_new_node(data);
} }
plist_t plist_new_string(const char *val) PLIST_API plist_t plist_new_string(const char *val)
{ {
plist_data_t data = plist_new_plist_data(); plist_data_t data = plist_new_plist_data();
data->type = PLIST_STRING; data->type = PLIST_STRING;
...@@ -120,7 +120,7 @@ plist_t plist_new_string(const char *val) ...@@ -120,7 +120,7 @@ plist_t plist_new_string(const char *val)
return plist_new_node(data); return plist_new_node(data);
} }
plist_t plist_new_bool(uint8_t val) PLIST_API plist_t plist_new_bool(uint8_t val)
{ {
plist_data_t data = plist_new_plist_data(); plist_data_t data = plist_new_plist_data();
data->type = PLIST_BOOLEAN; data->type = PLIST_BOOLEAN;
...@@ -129,7 +129,7 @@ plist_t plist_new_bool(uint8_t val) ...@@ -129,7 +129,7 @@ plist_t plist_new_bool(uint8_t val)
return plist_new_node(data); return plist_new_node(data);
} }
plist_t plist_new_uint(uint64_t val) PLIST_API plist_t plist_new_uint(uint64_t val)
{ {
plist_data_t data = plist_new_plist_data(); plist_data_t data = plist_new_plist_data();
data->type = PLIST_UINT; data->type = PLIST_UINT;
...@@ -138,7 +138,7 @@ plist_t plist_new_uint(uint64_t val) ...@@ -138,7 +138,7 @@ plist_t plist_new_uint(uint64_t val)
return plist_new_node(data); return plist_new_node(data);
} }
plist_t plist_new_uid(uint64_t val) PLIST_API plist_t plist_new_uid(uint64_t val)
{ {
plist_data_t data = plist_new_plist_data(); plist_data_t data = plist_new_plist_data();
data->type = PLIST_UID; data->type = PLIST_UID;
...@@ -147,7 +147,7 @@ plist_t plist_new_uid(uint64_t val) ...@@ -147,7 +147,7 @@ plist_t plist_new_uid(uint64_t val)
return plist_new_node(data); return plist_new_node(data);
} }
plist_t plist_new_real(double val) PLIST_API plist_t plist_new_real(double val)
{ {
plist_data_t data = plist_new_plist_data(); plist_data_t data = plist_new_plist_data();
data->type = PLIST_REAL; data->type = PLIST_REAL;
...@@ -156,7 +156,7 @@ plist_t plist_new_real(double val) ...@@ -156,7 +156,7 @@ plist_t plist_new_real(double val)
return plist_new_node(data); return plist_new_node(data);
} }
plist_t plist_new_data(const char *val, uint64_t length) PLIST_API plist_t plist_new_data(const char *val, uint64_t length)
{ {
plist_data_t data = plist_new_plist_data(); plist_data_t data = plist_new_plist_data();
data->type = PLIST_DATA; data->type = PLIST_DATA;
...@@ -166,7 +166,7 @@ plist_t plist_new_data(const char *val, uint64_t length) ...@@ -166,7 +166,7 @@ plist_t plist_new_data(const char *val, uint64_t length)
return plist_new_node(data); return plist_new_node(data);
} }
plist_t plist_new_date(int32_t sec, int32_t usec) PLIST_API plist_t plist_new_date(int32_t sec, int32_t usec)
{ {
plist_data_t data = plist_new_plist_data(); plist_data_t data = plist_new_plist_data();
data->type = PLIST_DATE; data->type = PLIST_DATE;
...@@ -176,7 +176,7 @@ plist_t plist_new_date(int32_t sec, int32_t usec) ...@@ -176,7 +176,7 @@ plist_t plist_new_date(int32_t sec, int32_t usec)
return plist_new_node(data); return plist_new_node(data);
} }
void plist_free(plist_t plist) PLIST_API void plist_free(plist_t plist)
{ {
if (plist) if (plist)
{ {
...@@ -231,14 +231,14 @@ static void plist_copy_node(node_t *node, void *parent_node_ptr) ...@@ -231,14 +231,14 @@ static void plist_copy_node(node_t *node, void *parent_node_ptr)
node_iterator_destroy(ni); node_iterator_destroy(ni);
} }
plist_t plist_copy(plist_t node) PLIST_API plist_t plist_copy(plist_t node)
{ {
plist_t copied = NULL; plist_t copied = NULL;
plist_copy_node(node, &copied); plist_copy_node(node, &copied);
return copied; return copied;
} }
uint32_t plist_array_get_size(plist_t node) PLIST_API uint32_t plist_array_get_size(plist_t node)
{ {
uint32_t ret = 0; uint32_t ret = 0;
if (node && PLIST_ARRAY == plist_get_node_type(node)) if (node && PLIST_ARRAY == plist_get_node_type(node))
...@@ -248,7 +248,7 @@ uint32_t plist_array_get_size(plist_t node) ...@@ -248,7 +248,7 @@ uint32_t plist_array_get_size(plist_t node)
return ret; return ret;
} }
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)
{ {
plist_t ret = NULL; plist_t ret = NULL;
if (node && PLIST_ARRAY == plist_get_node_type(node)) if (node && PLIST_ARRAY == plist_get_node_type(node))
...@@ -258,7 +258,7 @@ plist_t plist_array_get_item(plist_t node, uint32_t n) ...@@ -258,7 +258,7 @@ plist_t plist_array_get_item(plist_t node, uint32_t n)
return ret; return ret;
} }
uint32_t plist_array_get_item_index(plist_t node) PLIST_API uint32_t plist_array_get_item_index(plist_t node)
{ {
plist_t father = plist_get_parent(node); plist_t father = plist_get_parent(node);
if (PLIST_ARRAY == plist_get_node_type(father)) if (PLIST_ARRAY == plist_get_node_type(father))
...@@ -268,7 +268,7 @@ uint32_t plist_array_get_item_index(plist_t node) ...@@ -268,7 +268,7 @@ uint32_t plist_array_get_item_index(plist_t node)
return 0; return 0;
} }
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)
{ {
if (node && PLIST_ARRAY == plist_get_node_type(node)) if (node && PLIST_ARRAY == plist_get_node_type(node))
{ {
...@@ -286,7 +286,7 @@ void plist_array_set_item(plist_t node, plist_t item, uint32_t n) ...@@ -286,7 +286,7 @@ void plist_array_set_item(plist_t node, plist_t item, uint32_t n)
return; return;
} }
void plist_array_append_item(plist_t node, plist_t item) PLIST_API void plist_array_append_item(plist_t node, plist_t item)
{ {
if (node && PLIST_ARRAY == plist_get_node_type(node)) if (node && PLIST_ARRAY == plist_get_node_type(node))
{ {
...@@ -295,7 +295,7 @@ void plist_array_append_item(plist_t node, plist_t item) ...@@ -295,7 +295,7 @@ void plist_array_append_item(plist_t node, plist_t item)
return; return;
} }
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)
{ {
if (node && PLIST_ARRAY == plist_get_node_type(node)) if (node && PLIST_ARRAY == plist_get_node_type(node))
{ {
...@@ -304,7 +304,7 @@ void plist_array_insert_item(plist_t node, plist_t item, uint32_t n) ...@@ -304,7 +304,7 @@ void plist_array_insert_item(plist_t node, plist_t item, uint32_t n)
return; return;
} }
void plist_array_remove_item(plist_t node, uint32_t n) PLIST_API void plist_array_remove_item(plist_t node, uint32_t n)
{ {
if (node && PLIST_ARRAY == plist_get_node_type(node)) if (node && PLIST_ARRAY == plist_get_node_type(node))
{ {
...@@ -317,7 +317,7 @@ void plist_array_remove_item(plist_t node, uint32_t n) ...@@ -317,7 +317,7 @@ void plist_array_remove_item(plist_t node, uint32_t n)
return; return;
} }
uint32_t plist_dict_get_size(plist_t node) PLIST_API uint32_t plist_dict_get_size(plist_t node)
{ {
uint32_t ret = 0; uint32_t ret = 0;
if (node && PLIST_DICT == plist_get_node_type(node)) if (node && PLIST_DICT == plist_get_node_type(node))
...@@ -327,7 +327,7 @@ uint32_t plist_dict_get_size(plist_t node) ...@@ -327,7 +327,7 @@ uint32_t plist_dict_get_size(plist_t node)
return ret; return ret;
} }
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)
{ {
if (iter && *iter == NULL) if (iter && *iter == NULL)
{ {
...@@ -337,7 +337,7 @@ void plist_dict_new_iter(plist_t node, plist_dict_iter *iter) ...@@ -337,7 +337,7 @@ void plist_dict_new_iter(plist_t node, plist_dict_iter *iter)
return; return;
} }
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)
{ {
uint32_t* iter_int = (uint32_t*) iter; uint32_t* iter_int = (uint32_t*) iter;
...@@ -368,7 +368,7 @@ void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_ ...@@ -368,7 +368,7 @@ void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_
return; return;
} }
void plist_dict_get_item_key(plist_t node, char **key) PLIST_API void plist_dict_get_item_key(plist_t node, char **key)
{ {
plist_t father = plist_get_parent(node); plist_t father = plist_get_parent(node);
if (PLIST_DICT == plist_get_node_type(father)) if (PLIST_DICT == plist_get_node_type(father))
...@@ -377,7 +377,7 @@ void plist_dict_get_item_key(plist_t node, char **key) ...@@ -377,7 +377,7 @@ void plist_dict_get_item_key(plist_t node, char **key)
} }
} }
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)
{ {
plist_t ret = NULL; plist_t ret = NULL;
...@@ -403,7 +403,7 @@ plist_t plist_dict_get_item(plist_t node, const char* key) ...@@ -403,7 +403,7 @@ plist_t plist_dict_get_item(plist_t node, const char* key)
return ret; return ret;
} }
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)
{ {
if (node && PLIST_DICT == plist_get_node_type(node)) { if (node && PLIST_DICT == plist_get_node_type(node)) {
node_t* old_item = plist_dict_get_item(node, key); node_t* old_item = plist_dict_get_item(node, key);
...@@ -422,12 +422,12 @@ void plist_dict_set_item(plist_t node, const char* key, plist_t item) ...@@ -422,12 +422,12 @@ void plist_dict_set_item(plist_t node, const char* key, plist_t item)
return; return;
} }
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)
{ {
plist_dict_set_item(node, key, item); plist_dict_set_item(node, key, item);
} }
void plist_dict_remove_item(plist_t node, const char* key) PLIST_API void plist_dict_remove_item(plist_t node, const char* key)
{ {
if (node && PLIST_DICT == plist_get_node_type(node)) if (node && PLIST_DICT == plist_get_node_type(node))
{ {
...@@ -442,7 +442,7 @@ void plist_dict_remove_item(plist_t node, const char* key) ...@@ -442,7 +442,7 @@ void plist_dict_remove_item(plist_t node, const char* key)
return; return;
} }
void plist_dict_merge(plist_t *target, plist_t source) PLIST_API 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)) if (!target || !*target || (plist_get_node_type(*target) != PLIST_DICT) || !source || (plist_get_node_type(source) != PLIST_DICT))
return; return;
...@@ -466,7 +466,7 @@ void plist_dict_merge(plist_t *target, plist_t source) ...@@ -466,7 +466,7 @@ void plist_dict_merge(plist_t *target, plist_t source)
free(it); free(it);
} }
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)
{ {
plist_t current = plist; plist_t current = plist;
plist_type type = PLIST_NONE; plist_type type = PLIST_NONE;
...@@ -490,7 +490,7 @@ plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v) ...@@ -490,7 +490,7 @@ plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v)
return current; return current;
} }
plist_t plist_access_path(plist_t plist, uint32_t length, ...) PLIST_API plist_t plist_access_path(plist_t plist, uint32_t length, ...)
{ {
plist_t ret = NULL; plist_t ret = NULL;
va_list v; va_list v;
...@@ -545,12 +545,12 @@ static void plist_get_type_and_value(plist_t node, plist_type * type, void *valu ...@@ -545,12 +545,12 @@ static void plist_get_type_and_value(plist_t node, plist_type * type, void *valu
} }
} }
plist_t plist_get_parent(plist_t node) PLIST_API plist_t plist_get_parent(plist_t node)
{ {
return node ? (plist_t) ((node_t*) node)->parent : NULL; return node ? (plist_t) ((node_t*) node)->parent : NULL;
} }
plist_type plist_get_node_type(plist_t node) PLIST_API plist_type plist_get_node_type(plist_t node)
{ {
if (node) if (node)
{ {
...@@ -561,7 +561,7 @@ plist_type plist_get_node_type(plist_t node) ...@@ -561,7 +561,7 @@ plist_type plist_get_node_type(plist_t node)
return PLIST_NONE; return PLIST_NONE;
} }
void plist_get_key_val(plist_t node, char **val) PLIST_API void plist_get_key_val(plist_t node, char **val)
{ {
plist_type type = plist_get_node_type(node); plist_type type = plist_get_node_type(node);
uint64_t length = 0; uint64_t length = 0;
...@@ -570,7 +570,7 @@ void plist_get_key_val(plist_t node, char **val) ...@@ -570,7 +570,7 @@ void plist_get_key_val(plist_t node, char **val)
assert(length == strlen(*val)); assert(length == strlen(*val));
} }
void plist_get_string_val(plist_t node, char **val) PLIST_API void plist_get_string_val(plist_t node, char **val)
{ {
plist_type type = plist_get_node_type(node); plist_type type = plist_get_node_type(node);
uint64_t length = 0; uint64_t length = 0;
...@@ -579,7 +579,7 @@ void plist_get_string_val(plist_t node, char **val) ...@@ -579,7 +579,7 @@ void plist_get_string_val(plist_t node, char **val)
assert(length == strlen(*val)); assert(length == strlen(*val));
} }
void plist_get_bool_val(plist_t node, uint8_t * val) PLIST_API void plist_get_bool_val(plist_t node, uint8_t * val)
{ {
plist_type type = plist_get_node_type(node); plist_type type = plist_get_node_type(node);
uint64_t length = 0; uint64_t length = 0;
...@@ -588,7 +588,7 @@ void plist_get_bool_val(plist_t node, uint8_t * val) ...@@ -588,7 +588,7 @@ void plist_get_bool_val(plist_t node, uint8_t * val)
assert(length == sizeof(uint8_t)); assert(length == sizeof(uint8_t));
} }
void plist_get_uint_val(plist_t node, uint64_t * val) PLIST_API void plist_get_uint_val(plist_t node, uint64_t * val)
{ {
plist_type type = plist_get_node_type(node); plist_type type = plist_get_node_type(node);
uint64_t length = 0; uint64_t length = 0;
...@@ -597,7 +597,7 @@ void plist_get_uint_val(plist_t node, uint64_t * val) ...@@ -597,7 +597,7 @@ void plist_get_uint_val(plist_t node, uint64_t * val)
assert(length == sizeof(uint64_t)); assert(length == sizeof(uint64_t));
} }
void plist_get_uid_val(plist_t node, uint64_t * val) PLIST_API void plist_get_uid_val(plist_t node, uint64_t * val)
{ {
plist_type type = plist_get_node_type(node); plist_type type = plist_get_node_type(node);
uint64_t length = 0; uint64_t length = 0;
...@@ -606,7 +606,7 @@ void plist_get_uid_val(plist_t node, uint64_t * val) ...@@ -606,7 +606,7 @@ void plist_get_uid_val(plist_t node, uint64_t * val)
assert(length == sizeof(uint64_t)); assert(length == sizeof(uint64_t));
} }
void plist_get_real_val(plist_t node, double *val) PLIST_API void plist_get_real_val(plist_t node, double *val)
{ {
plist_type type = plist_get_node_type(node); plist_type type = plist_get_node_type(node);
uint64_t length = 0; uint64_t length = 0;
...@@ -615,14 +615,14 @@ void plist_get_real_val(plist_t node, double *val) ...@@ -615,14 +615,14 @@ void plist_get_real_val(plist_t node, double *val)
assert(length == sizeof(double)); assert(length == sizeof(double));
} }
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)
{ {
plist_type type = plist_get_node_type(node); plist_type type = plist_get_node_type(node);
if (PLIST_DATA == type) if (PLIST_DATA == type)
plist_get_type_and_value(node, &type, (void *) val, length); plist_get_type_and_value(node, &type, (void *) val, length);
} }
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)
{ {
plist_type type = plist_get_node_type(node); plist_type type = plist_get_node_type(node);
uint64_t length = 0; uint64_t length = 0;
...@@ -695,7 +695,7 @@ int plist_data_compare(const void *a, const void *b) ...@@ -695,7 +695,7 @@ int plist_data_compare(const void *a, const void *b)
return FALSE; return FALSE;
} }
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)
{ {
return plist_data_compare(node_l, node_r); return plist_data_compare(node_l, node_r);
} }
...@@ -757,42 +757,42 @@ static void plist_set_element_val(plist_t node, plist_type type, const void *val ...@@ -757,42 +757,42 @@ static void plist_set_element_val(plist_t node, plist_type type, const void *val
} }
} }
void plist_set_key_val(plist_t node, const char *val) PLIST_API void plist_set_key_val(plist_t node, const char *val)
{ {
plist_set_element_val(node, PLIST_KEY, val, strlen(val)); plist_set_element_val(node, PLIST_KEY, val, strlen(val));
} }
void plist_set_string_val(plist_t node, const char *val) PLIST_API void plist_set_string_val(plist_t node, const char *val)
{ {
plist_set_element_val(node, PLIST_STRING, val, strlen(val)); plist_set_element_val(node, PLIST_STRING, val, strlen(val));
} }
void plist_set_bool_val(plist_t node, uint8_t val) PLIST_API void plist_set_bool_val(plist_t node, uint8_t val)
{ {
plist_set_element_val(node, PLIST_BOOLEAN, &val, sizeof(uint8_t)); plist_set_element_val(node, PLIST_BOOLEAN, &val, sizeof(uint8_t));
} }
void plist_set_uint_val(plist_t node, uint64_t val) PLIST_API void plist_set_uint_val(plist_t node, uint64_t val)
{ {
plist_set_element_val(node, PLIST_UINT, &val, sizeof(uint64_t)); plist_set_element_val(node, PLIST_UINT, &val, sizeof(uint64_t));
} }
void plist_set_uid_val(plist_t node, uint64_t val) PLIST_API void plist_set_uid_val(plist_t node, uint64_t val)
{ {
plist_set_element_val(node, PLIST_UID, &val, sizeof(uint64_t)); plist_set_element_val(node, PLIST_UID, &val, sizeof(uint64_t));
} }
void plist_set_real_val(plist_t node, double val) PLIST_API void plist_set_real_val(plist_t node, double val)
{ {
plist_set_element_val(node, PLIST_REAL, &val, sizeof(double)); plist_set_element_val(node, PLIST_REAL, &val, sizeof(double));
} }
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)
{ {
plist_set_element_val(node, PLIST_DATA, val, length); plist_set_element_val(node, PLIST_DATA, val, length);
} }
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)
{ {
struct timeval val = { sec, usec }; struct timeval val = { sec, usec };
plist_set_element_val(node, PLIST_DATE, &val, sizeof(struct timeval)); plist_set_element_val(node, PLIST_DATE, &val, sizeof(struct timeval));
......
...@@ -22,8 +22,11 @@ ...@@ -22,8 +22,11 @@
#ifndef PLIST_H #ifndef PLIST_H
#define PLIST_H #define PLIST_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "plist/plist.h" #include "plist/plist.h"
#include "common.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
...@@ -34,6 +37,15 @@ ...@@ -34,6 +37,15 @@
#pragma warning(disable:4244) #pragma warning(disable:4244)
#endif #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 struct plist_data_s
{ {
...@@ -52,10 +64,10 @@ struct plist_data_s ...@@ -52,10 +64,10 @@ struct plist_data_s
typedef struct plist_data_s *plist_data_t; typedef struct plist_data_s *plist_data_t;
_PLIST_INTERNAL plist_t plist_new_node(plist_data_t data); plist_t plist_new_node(plist_data_t data);
_PLIST_INTERNAL plist_data_t plist_get_data(const plist_t node); plist_data_t plist_get_data(const plist_t node);
_PLIST_INTERNAL plist_data_t plist_new_plist_data(void); plist_data_t plist_new_plist_data(void);
_PLIST_INTERNAL int plist_data_compare(const void *a, const void *b); int plist_data_compare(const void *a, const void *b);
#endif #endif
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#ifndef PTRARRAY_H #ifndef PTRARRAY_H
#define PTRARRAY_H #define PTRARRAY_H
#include <stdlib.h> #include <stdlib.h>
#include "common.h"
typedef struct ptrarray_t { typedef struct ptrarray_t {
void **pdata; void **pdata;
...@@ -30,8 +29,8 @@ typedef struct ptrarray_t { ...@@ -30,8 +29,8 @@ typedef struct ptrarray_t {
size_t capacity_step; size_t capacity_step;
} ptrarray_t; } ptrarray_t;
_PLIST_INTERNAL ptrarray_t *ptr_array_new(int capacity); ptrarray_t *ptr_array_new(int capacity);
_PLIST_INTERNAL void ptr_array_free(ptrarray_t *pa); void ptr_array_free(ptrarray_t *pa);
_PLIST_INTERNAL void ptr_array_add(ptrarray_t *pa, void *data); void ptr_array_add(ptrarray_t *pa, void *data);
_PLIST_INTERNAL void* ptr_array_index(ptrarray_t *pa, size_t index); void* ptr_array_index(ptrarray_t *pa, size_t index);
#endif #endif
...@@ -513,7 +513,7 @@ static void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node) ...@@ -513,7 +513,7 @@ static void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node)
} }
} }
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)
{ {
xmlDocPtr plist_doc = NULL; xmlDocPtr plist_doc = NULL;
xmlNodePtr root_node = NULL; xmlNodePtr root_node = NULL;
...@@ -555,7 +555,7 @@ void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length) ...@@ -555,7 +555,7 @@ void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length)
} }
} }
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)
{ {
xmlDocPtr plist_doc = xmlParseMemory(plist_xml, length); xmlDocPtr plist_doc = xmlParseMemory(plist_xml, length);
xmlNodePtr root_node = xmlDocGetRootElement(plist_doc); xmlNodePtr root_node = xmlDocGetRootElement(plist_doc);
......
...@@ -4,7 +4,7 @@ AM_LDFLAGS = ...@@ -4,7 +4,7 @@ AM_LDFLAGS =
noinst_PROGRAMS = plist_cmp plist_test noinst_PROGRAMS = plist_cmp plist_test
plist_cmp_SOURCES = plist_cmp.c plist_cmp_SOURCES = plist_cmp.c
plist_cmp_LDADD = $(top_builddir)/src/libplist.la plist_cmp_LDADD = $(top_builddir)/src/libplist.la $(top_builddir)/libcnary/libcnary.la
plist_test_SOURCES = plist_test.c plist_test_SOURCES = plist_test.c
plist_test_LDADD = $(top_builddir)/src/libplist.la plist_test_LDADD = $(top_builddir)/src/libplist.la
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment