summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2014-10-03 15:39:47 +0200
committerGravatar Nikias Bassen2014-10-03 15:39:47 +0200
commit62813daf2c4aaec675652d9c1131a58dfa634e38 (patch)
tree4427398d97f1295996410fc3dbf86c6de8bf873c /src
parenteab599c151617eef9035343fd63591fa4d09bd3e (diff)
downloadlibplist-62813daf2c4aaec675652d9c1131a58dfa634e38.tar.gz
libplist-62813daf2c4aaec675652d9c1131a58dfa634e38.tar.bz2
Avoid exporting non-public symbols
Diffstat (limited to 'src')
-rw-r--r--src/base64.h5
-rw-r--r--src/bplist.c4
-rw-r--r--src/bytearray.h7
-rw-r--r--src/common.h8
-rw-r--r--src/hashtable.h9
-rw-r--r--src/plist.c96
-rw-r--r--src/plist.h22
-rw-r--r--src/ptrarray.h9
-rw-r--r--src/xplist.c4
9 files changed, 82 insertions, 82 deletions
diff --git a/src/base64.h b/src/base64.h
index dbaf104..6eee33b 100644
--- a/src/base64.h
+++ b/src/base64.h
@@ -21,9 +21,8 @@
#ifndef BASE64_H
#define BASE64_H
#include <stdlib.h>
-#include "common.h"
-_PLIST_INTERNAL char *base64encode(const unsigned char *buf, size_t *size);
-_PLIST_INTERNAL unsigned char *base64decode(const char *buf, size_t *size);
+char *base64encode(const unsigned char *buf, size_t *size);
+unsigned char *base64decode(const char *buf, size_t *size);
#endif
diff --git a/src/bplist.c b/src/bplist.c
index 181c150..bb3465b 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -599,7 +599,7 @@ static void* copy_plist_data(const void* src)
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;
@@ -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;
hashtable_t* ref_table = NULL;
diff --git a/src/bytearray.h b/src/bytearray.h
index 3e67d7e..1613143 100644
--- a/src/bytearray.h
+++ b/src/bytearray.h
@@ -21,7 +21,6 @@
#ifndef BYTEARRAY_H
#define BYTEARRAY_H
#include <stdlib.h>
-#include "common.h"
typedef struct bytearray_t {
void *data;
@@ -29,8 +28,8 @@ typedef struct bytearray_t {
size_t capacity;
} bytearray_t;
-_PLIST_INTERNAL bytearray_t *byte_array_new();
-_PLIST_INTERNAL void byte_array_free(bytearray_t *ba);
-_PLIST_INTERNAL void byte_array_append(bytearray_t *ba, void *buf, size_t len);
+bytearray_t *byte_array_new();
+void byte_array_free(bytearray_t *ba);
+void byte_array_append(bytearray_t *ba, void *buf, size_t len);
#endif
diff --git a/src/common.h b/src/common.h
index c71ef4a..657e049 100644
--- a/src/common.h
+++ b/src/common.h
@@ -17,12 +17,4 @@
#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
diff --git a/src/hashtable.h b/src/hashtable.h
index 8c72c82..c28de91 100644
--- a/src/hashtable.h
+++ b/src/hashtable.h
@@ -21,7 +21,6 @@
#ifndef HASHTABLE_H
#define HASHTABLE_H
#include <stdlib.h>
-#include "common.h"
typedef struct hashentry_t {
void *key;
@@ -39,10 +38,10 @@ typedef struct hashtable_t {
compare_func_t compare_func;
} hashtable_t;
-_PLIST_INTERNAL hashtable_t* hash_table_new(hash_func_t hash_func, compare_func_t compare_func);
-_PLIST_INTERNAL void hash_table_destroy(hashtable_t *ht);
+hashtable_t* hash_table_new(hash_func_t hash_func, compare_func_t compare_func);
+void hash_table_destroy(hashtable_t *ht);
-_PLIST_INTERNAL 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_insert(hashtable_t* ht, void *key, void *value);
+void* hash_table_lookup(hashtable_t* ht, void *key);
#endif
diff --git a/src/plist.c b/src/plist.c
index 317a758..c38b6eb 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -87,14 +87,14 @@ static int plist_free_node(node_t* node)
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();
data->type = PLIST_DICT;
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();
data->type = PLIST_ARRAY;
@@ -111,7 +111,7 @@ static plist_t plist_new_key(const char *val)
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();
data->type = PLIST_STRING;
@@ -120,7 +120,7 @@ plist_t plist_new_string(const char *val)
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();
data->type = PLIST_BOOLEAN;
@@ -129,7 +129,7 @@ plist_t plist_new_bool(uint8_t val)
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();
data->type = PLIST_UINT;
@@ -138,7 +138,7 @@ plist_t plist_new_uint(uint64_t val)
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();
data->type = PLIST_UID;
@@ -147,7 +147,7 @@ plist_t plist_new_uid(uint64_t val)
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();
data->type = PLIST_REAL;
@@ -156,7 +156,7 @@ plist_t plist_new_real(double val)
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();
data->type = PLIST_DATA;
@@ -166,7 +166,7 @@ plist_t plist_new_data(const char *val, uint64_t length)
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();
data->type = PLIST_DATE;
@@ -176,7 +176,7 @@ plist_t plist_new_date(int32_t sec, int32_t usec)
return plist_new_node(data);
}
-void plist_free(plist_t plist)
+PLIST_API void plist_free(plist_t plist)
{
if (plist)
{
@@ -231,14 +231,14 @@ static void plist_copy_node(node_t *node, void *parent_node_ptr)
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_copy_node(node, &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;
if (node && PLIST_ARRAY == plist_get_node_type(node))
@@ -248,7 +248,7 @@ uint32_t plist_array_get_size(plist_t node)
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;
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)
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);
if (PLIST_ARRAY == plist_get_node_type(father))
@@ -268,7 +268,7 @@ uint32_t plist_array_get_item_index(plist_t node)
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))
{
@@ -286,7 +286,7 @@ void plist_array_set_item(plist_t node, plist_t item, uint32_t n)
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))
{
@@ -295,7 +295,7 @@ void plist_array_append_item(plist_t node, plist_t item)
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))
{
@@ -304,7 +304,7 @@ void plist_array_insert_item(plist_t node, plist_t item, uint32_t n)
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))
{
@@ -317,7 +317,7 @@ void plist_array_remove_item(plist_t node, uint32_t n)
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;
if (node && PLIST_DICT == plist_get_node_type(node))
@@ -327,7 +327,7 @@ uint32_t plist_dict_get_size(plist_t node)
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)
{
@@ -337,7 +337,7 @@ void plist_dict_new_iter(plist_t node, plist_dict_iter *iter)
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;
@@ -368,7 +368,7 @@ void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_
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);
if (PLIST_DICT == plist_get_node_type(father))
@@ -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;
@@ -403,7 +403,7 @@ plist_t plist_dict_get_item(plist_t node, const char* key)
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)) {
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)
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);
}
-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))
{
@@ -442,7 +442,7 @@ void plist_dict_remove_item(plist_t node, const char* key)
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))
return;
@@ -466,7 +466,7 @@ void plist_dict_merge(plist_t *target, plist_t source)
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_type type = PLIST_NONE;
@@ -490,7 +490,7 @@ plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v)
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;
va_list v;
@@ -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;
}
-plist_type plist_get_node_type(plist_t node)
+PLIST_API plist_type plist_get_node_type(plist_t node)
{
if (node)
{
@@ -561,7 +561,7 @@ plist_type plist_get_node_type(plist_t node)
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);
uint64_t length = 0;
@@ -570,7 +570,7 @@ void plist_get_key_val(plist_t node, char **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);
uint64_t length = 0;
@@ -579,7 +579,7 @@ void plist_get_string_val(plist_t node, char **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);
uint64_t length = 0;
@@ -588,7 +588,7 @@ void plist_get_bool_val(plist_t node, uint8_t * val)
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);
uint64_t length = 0;
@@ -597,7 +597,7 @@ void plist_get_uint_val(plist_t node, uint64_t * val)
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);
uint64_t length = 0;
@@ -606,7 +606,7 @@ void plist_get_uid_val(plist_t node, uint64_t * val)
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);
uint64_t length = 0;
@@ -615,14 +615,14 @@ void plist_get_real_val(plist_t node, double *val)
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);
if (PLIST_DATA == type)
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);
uint64_t length = 0;
@@ -695,7 +695,7 @@ int plist_data_compare(const void *a, const void *b)
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);
}
@@ -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));
}
-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));
}
-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));
}
-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));
}
-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));
}
-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));
}
-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);
}
-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 };
plist_set_element_val(node, PLIST_DATE, &val, sizeof(struct timeval));
diff --git a/src/plist.h b/src/plist.h
index 2a9a3b5..822144d 100644
--- a/src/plist.h
+++ b/src/plist.h
@@ -22,8 +22,11 @@
#ifndef PLIST_H
#define PLIST_H
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "plist/plist.h"
-#include "common.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -34,6 +37,15 @@
#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
{
@@ -52,10 +64,10 @@ struct plist_data_s
typedef struct plist_data_s *plist_data_t;
-_PLIST_INTERNAL plist_t plist_new_node(plist_data_t data);
-_PLIST_INTERNAL plist_data_t plist_get_data(const plist_t node);
-_PLIST_INTERNAL plist_data_t plist_new_plist_data(void);
-_PLIST_INTERNAL int plist_data_compare(const void *a, const void *b);
+plist_t plist_new_node(plist_data_t data);
+plist_data_t plist_get_data(const plist_t node);
+plist_data_t plist_new_plist_data(void);
+int plist_data_compare(const void *a, const void *b);
#endif
diff --git a/src/ptrarray.h b/src/ptrarray.h
index 84f9ef0..e8a3c88 100644
--- a/src/ptrarray.h
+++ b/src/ptrarray.h
@@ -21,7 +21,6 @@
#ifndef PTRARRAY_H
#define PTRARRAY_H
#include <stdlib.h>
-#include "common.h"
typedef struct ptrarray_t {
void **pdata;
@@ -30,8 +29,8 @@ typedef struct ptrarray_t {
size_t capacity_step;
} ptrarray_t;
-_PLIST_INTERNAL ptrarray_t *ptr_array_new(int capacity);
-_PLIST_INTERNAL void ptr_array_free(ptrarray_t *pa);
-_PLIST_INTERNAL void ptr_array_add(ptrarray_t *pa, void *data);
-_PLIST_INTERNAL void* ptr_array_index(ptrarray_t *pa, size_t index);
+ptrarray_t *ptr_array_new(int capacity);
+void ptr_array_free(ptrarray_t *pa);
+void ptr_array_add(ptrarray_t *pa, void *data);
+void* ptr_array_index(ptrarray_t *pa, size_t index);
#endif
diff --git a/src/xplist.c b/src/xplist.c
index a889cb5..4c106aa 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -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;
xmlNodePtr root_node = NULL;
@@ -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);
xmlNodePtr root_node = xmlDocGetRootElement(plist_doc);