summaryrefslogtreecommitdiffstats
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
parenteab599c151617eef9035343fd63591fa4d09bd3e (diff)
downloadlibplist-62813daf2c4aaec675652d9c1131a58dfa634e38.tar.gz
libplist-62813daf2c4aaec675652d9c1131a58dfa634e38.tar.bz2
Avoid exporting non-public symbols
-rw-r--r--configure.ac7
-rw-r--r--include/plist/plist.h111
-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
-rw-r--r--test/Makefile.am2
12 files changed, 141 insertions, 143 deletions
diff --git a/configure.ac b/configure.ac
index a149dd9..2bb18a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,9 +102,14 @@ fi
102AM_CONDITIONAL([HAVE_CYTHON],[test "x$CYTHON_SUB" = "xcython"]) 102AM_CONDITIONAL([HAVE_CYTHON],[test "x$CYTHON_SUB" = "xcython"])
103AC_SUBST([CYTHON_SUB]) 103AC_SUBST([CYTHON_SUB])
104 104
105AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter") 105AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -fvisibility=hidden")
106AC_SUBST(GLOBAL_CFLAGS) 106AC_SUBST(GLOBAL_CFLAGS)
107 107
108case "$GLOBAL_CFLAGS" in
109 *-fvisibility=hidden*)
110 AC_DEFINE([HAVE_FVISIBILITY], [1], [Define if compiled with -fvisibility=hidden])
111esac
112
108m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) 113m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
109 114
110AC_OUTPUT([ 115AC_OUTPUT([
diff --git a/include/plist/plist.h b/include/plist/plist.h
index 7dbc4ae..c66545a 100644
--- a/include/plist/plist.h
+++ b/include/plist/plist.h
@@ -39,15 +39,8 @@ extern "C"
39 typedef unsigned __int32 uint32_t; 39 typedef unsigned __int32 uint32_t;
40 typedef unsigned __int64 uint64_t; 40 typedef unsigned __int64 uint64_t;
41 41
42#ifdef plist_EXPORTS
43 #define PLIST_API __declspec( dllexport )
44#else
45 #define PLIST_API __declspec( dllimport )
46#endif
47
48#else 42#else
49#include <stdint.h> 43#include <stdint.h>
50#define PLIST_API
51#endif 44#endif
52 45
53#ifdef __llvm__ 46#ifdef __llvm__
@@ -130,7 +123,7 @@ extern "C"
130 * @return the created plist 123 * @return the created plist
131 * @sa #plist_type 124 * @sa #plist_type
132 */ 125 */
133 PLIST_API plist_t plist_new_dict(void); 126 plist_t plist_new_dict(void);
134 127
135 /** 128 /**
136 * Create a new root plist_t type #PLIST_ARRAY 129 * Create a new root plist_t type #PLIST_ARRAY
@@ -138,7 +131,7 @@ extern "C"
138 * @return the created plist 131 * @return the created plist
139 * @sa #plist_type 132 * @sa #plist_type
140 */ 133 */
141 PLIST_API plist_t plist_new_array(void); 134 plist_t plist_new_array(void);
142 135
143 /** 136 /**
144 * Create a new plist_t type #PLIST_STRING 137 * Create a new plist_t type #PLIST_STRING
@@ -147,7 +140,7 @@ extern "C"
147 * @return the created item 140 * @return the created item
148 * @sa #plist_type 141 * @sa #plist_type
149 */ 142 */
150 PLIST_API plist_t plist_new_string(const char *val); 143 plist_t plist_new_string(const char *val);
151 144
152 /** 145 /**
153 * Create a new plist_t type #PLIST_BOOLEAN 146 * Create a new plist_t type #PLIST_BOOLEAN
@@ -156,7 +149,7 @@ extern "C"
156 * @return the created item 149 * @return the created item
157 * @sa #plist_type 150 * @sa #plist_type
158 */ 151 */
159 PLIST_API plist_t plist_new_bool(uint8_t val); 152 plist_t plist_new_bool(uint8_t val);
160 153
161 /** 154 /**
162 * Create a new plist_t type #PLIST_UINT 155 * Create a new plist_t type #PLIST_UINT
@@ -165,7 +158,7 @@ extern "C"
165 * @return the created item 158 * @return the created item
166 * @sa #plist_type 159 * @sa #plist_type
167 */ 160 */
168 PLIST_API plist_t plist_new_uint(uint64_t val); 161 plist_t plist_new_uint(uint64_t val);
169 162
170 /** 163 /**
171 * Create a new plist_t type #PLIST_REAL 164 * Create a new plist_t type #PLIST_REAL
@@ -174,7 +167,7 @@ extern "C"
174 * @return the created item 167 * @return the created item
175 * @sa #plist_type 168 * @sa #plist_type
176 */ 169 */
177 PLIST_API plist_t plist_new_real(double val); 170 plist_t plist_new_real(double val);
178 171
179 /** 172 /**
180 * Create a new plist_t type #PLIST_DATA 173 * Create a new plist_t type #PLIST_DATA
@@ -184,7 +177,7 @@ extern "C"
184 * @return the created item 177 * @return the created item
185 * @sa #plist_type 178 * @sa #plist_type
186 */ 179 */
187 PLIST_API plist_t plist_new_data(const char *val, uint64_t length); 180 plist_t plist_new_data(const char *val, uint64_t length);
188 181
189 /** 182 /**
190 * Create a new plist_t type #PLIST_DATE 183 * Create a new plist_t type #PLIST_DATE
@@ -194,7 +187,7 @@ extern "C"
194 * @return the created item 187 * @return the created item
195 * @sa #plist_type 188 * @sa #plist_type
196 */ 189 */
197 PLIST_API plist_t plist_new_date(int32_t sec, int32_t usec); 190 plist_t plist_new_date(int32_t sec, int32_t usec);
198 191
199 /** 192 /**
200 * Create a new plist_t type #PLIST_UID 193 * Create a new plist_t type #PLIST_UID
@@ -203,14 +196,14 @@ extern "C"
203 * @return the created item 196 * @return the created item
204 * @sa #plist_type 197 * @sa #plist_type
205 */ 198 */
206 PLIST_API plist_t plist_new_uid(uint64_t val); 199 plist_t plist_new_uid(uint64_t val);
207 200
208 /** 201 /**
209 * Destruct a plist_t node and all its children recursively 202 * Destruct a plist_t node and all its children recursively
210 * 203 *
211 * @param plist the plist to free 204 * @param plist the plist to free
212 */ 205 */
213 PLIST_API void plist_free(plist_t plist); 206 void plist_free(plist_t plist);
214 207
215 /** 208 /**
216 * Return a copy of passed node and it's children 209 * Return a copy of passed node and it's children
@@ -218,7 +211,7 @@ extern "C"
218 * @param node the plist to copy 211 * @param node the plist to copy
219 * @return copied plist 212 * @return copied plist
220 */ 213 */
221 PLIST_API plist_t plist_copy(plist_t node); 214 plist_t plist_copy(plist_t node);
222 215
223 216
224 /******************************************** 217 /********************************************
@@ -233,7 +226,7 @@ extern "C"
233 * @param node the node of type #PLIST_ARRAY 226 * @param node the node of type #PLIST_ARRAY
234 * @return size of the #PLIST_ARRAY node 227 * @return size of the #PLIST_ARRAY node
235 */ 228 */
236 PLIST_API uint32_t plist_array_get_size(plist_t node); 229 uint32_t plist_array_get_size(plist_t node);
237 230
238 /** 231 /**
239 * Get the nth item in a #PLIST_ARRAY node. 232 * Get the nth item in a #PLIST_ARRAY node.
@@ -242,7 +235,7 @@ extern "C"
242 * @param n the index of the item to get. Range is [0, array_size[ 235 * @param n the index of the item to get. Range is [0, array_size[
243 * @return the nth item or NULL if node is not of type #PLIST_ARRAY 236 * @return the nth item or NULL if node is not of type #PLIST_ARRAY
244 */ 237 */
245 PLIST_API plist_t plist_array_get_item(plist_t node, uint32_t n); 238 plist_t plist_array_get_item(plist_t node, uint32_t n);
246 239
247 /** 240 /**
248 * Get the index of an item. item must be a member of a #PLIST_ARRAY node. 241 * Get the index of an item. item must be a member of a #PLIST_ARRAY node.
@@ -250,7 +243,7 @@ extern "C"
250 * @param node the node 243 * @param node the node
251 * @return the node index 244 * @return the node index
252 */ 245 */
253 PLIST_API uint32_t plist_array_get_item_index(plist_t node); 246 uint32_t plist_array_get_item_index(plist_t node);
254 247
255 /** 248 /**
256 * Set the nth item in a #PLIST_ARRAY node. 249 * Set the nth item in a #PLIST_ARRAY node.
@@ -260,7 +253,7 @@ extern "C"
260 * @param item the new item at index n. The array is responsible for freeing item when it is no longer needed. 253 * @param item the new item at index n. The array is responsible for freeing item when it is no longer needed.
261 * @param n the index of the item to get. Range is [0, array_size[. Assert if n is not in range. 254 * @param n the index of the item to get. Range is [0, array_size[. Assert if n is not in range.
262 */ 255 */
263 PLIST_API void plist_array_set_item(plist_t node, plist_t item, uint32_t n); 256 void plist_array_set_item(plist_t node, plist_t item, uint32_t n);
264 257
265 /** 258 /**
266 * Append a new item at the end of a #PLIST_ARRAY node. 259 * Append a new item at the end of a #PLIST_ARRAY node.
@@ -268,7 +261,7 @@ extern "C"
268 * @param node the node of type #PLIST_ARRAY 261 * @param node the node of type #PLIST_ARRAY
269 * @param item the new item. The array is responsible for freeing item when it is no longer needed. 262 * @param item the new item. The array is responsible for freeing item when it is no longer needed.
270 */ 263 */
271 PLIST_API void plist_array_append_item(plist_t node, plist_t item); 264 void plist_array_append_item(plist_t node, plist_t item);
272 265
273 /** 266 /**
274 * Insert a new item at position n in a #PLIST_ARRAY node. 267 * Insert a new item at position n in a #PLIST_ARRAY node.
@@ -277,7 +270,7 @@ extern "C"
277 * @param item the new item to insert. The array is responsible for freeing item when it is no longer needed. 270 * @param item the new item to insert. The array is responsible for freeing item when it is no longer needed.
278 * @param n The position at which the node will be stored. Range is [0, array_size[. Assert if n is not in range. 271 * @param n The position at which the node will be stored. Range is [0, array_size[. Assert if n is not in range.
279 */ 272 */
280 PLIST_API void plist_array_insert_item(plist_t node, plist_t item, uint32_t n); 273 void plist_array_insert_item(plist_t node, plist_t item, uint32_t n);
281 274
282 /** 275 /**
283 * Remove an existing position in a #PLIST_ARRAY node. 276 * Remove an existing position in a #PLIST_ARRAY node.
@@ -286,7 +279,7 @@ extern "C"
286 * @param node the node of type #PLIST_ARRAY 279 * @param node the node of type #PLIST_ARRAY
287 * @param n The position to remove. Range is [0, array_size[. Assert if n is not in range. 280 * @param n The position to remove. Range is [0, array_size[. Assert if n is not in range.
288 */ 281 */
289 PLIST_API void plist_array_remove_item(plist_t node, uint32_t n); 282 void plist_array_remove_item(plist_t node, uint32_t n);
290 283
291 /******************************************** 284 /********************************************
292 * * 285 * *
@@ -300,7 +293,7 @@ extern "C"
300 * @param node the node of type #PLIST_DICT 293 * @param node the node of type #PLIST_DICT
301 * @return size of the #PLIST_DICT node 294 * @return size of the #PLIST_DICT node
302 */ 295 */
303 PLIST_API uint32_t plist_dict_get_size(plist_t node); 296 uint32_t plist_dict_get_size(plist_t node);
304 297
305 /** 298 /**
306 * Create an iterator of a #PLIST_DICT node. 299 * Create an iterator of a #PLIST_DICT node.
@@ -309,7 +302,7 @@ extern "C"
309 * @param node the node of type #PLIST_DICT 302 * @param node the node of type #PLIST_DICT
310 * @param iter iterator of the #PLIST_DICT node 303 * @param iter iterator of the #PLIST_DICT node
311 */ 304 */
312 PLIST_API void plist_dict_new_iter(plist_t node, plist_dict_iter *iter); 305 void plist_dict_new_iter(plist_t node, plist_dict_iter *iter);
313 306
314 /** 307 /**
315 * Increment iterator of a #PLIST_DICT node. 308 * Increment iterator of a #PLIST_DICT node.
@@ -321,7 +314,7 @@ extern "C"
321 * @param val a location to store the value, or NULL. The caller should *not* 314 * @param val a location to store the value, or NULL. The caller should *not*
322 * free the returned value. 315 * free the returned value.
323 */ 316 */
324 PLIST_API void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val); 317 void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val);
325 318
326 /** 319 /**
327 * Get key associated to an item. Item must be member of a dictionary 320 * Get key associated to an item. Item must be member of a dictionary
@@ -329,7 +322,7 @@ extern "C"
329 * @param node the node 322 * @param node the node
330 * @param key a location to store the key. The caller is responsible for freeing the returned string. 323 * @param key a location to store the key. The caller is responsible for freeing the returned string.
331 */ 324 */
332 PLIST_API void plist_dict_get_item_key(plist_t node, char **key); 325 void plist_dict_get_item_key(plist_t node, char **key);
333 326
334 /** 327 /**
335 * Get the nth item in a #PLIST_DICT node. 328 * Get the nth item in a #PLIST_DICT node.
@@ -339,7 +332,7 @@ extern "C"
339 * @return the item or NULL if node is not of type #PLIST_DICT. The caller should not free 332 * @return the item or NULL if node is not of type #PLIST_DICT. The caller should not free
340 * the returned node. 333 * the returned node.
341 */ 334 */
342 PLIST_API plist_t plist_dict_get_item(plist_t node, const char* key); 335 plist_t plist_dict_get_item(plist_t node, const char* key);
343 336
344 /** 337 /**
345 * Set item identified by key in a #PLIST_DICT node. 338 * Set item identified by key in a #PLIST_DICT node.
@@ -350,7 +343,7 @@ extern "C"
350 * @param item the new item associated to key 343 * @param item the new item associated to key
351 * @param key the identifier of the item to set. 344 * @param key the identifier of the item to set.
352 */ 345 */
353 PLIST_API void plist_dict_set_item(plist_t node, const char* key, plist_t item); 346 void plist_dict_set_item(plist_t node, const char* key, plist_t item);
354 347
355 /** 348 /**
356 * Insert a new item into a #PLIST_DICT node. 349 * Insert a new item into a #PLIST_DICT node.
@@ -362,7 +355,7 @@ extern "C"
362 * @param key The identifier of the item to insert. 355 * @param key The identifier of the item to insert.
363 */ 356 */
364 PLIST_WARN_DEPRECATED("use plist_dict_set_item instead") 357 PLIST_WARN_DEPRECATED("use plist_dict_set_item instead")
365 PLIST_API void plist_dict_insert_item(plist_t node, const char* key, plist_t item); 358 void plist_dict_insert_item(plist_t node, const char* key, plist_t item);
366 359
367 /** 360 /**
368 * Remove an existing position in a #PLIST_DICT node. 361 * Remove an existing position in a #PLIST_DICT node.
@@ -371,7 +364,7 @@ extern "C"
371 * @param node the node of type #PLIST_DICT 364 * @param node the node of type #PLIST_DICT
372 * @param key The identifier of the item to remove. Assert if identifier is not present. 365 * @param key The identifier of the item to remove. Assert if identifier is not present.
373 */ 366 */
374 PLIST_API void plist_dict_remove_item(plist_t node, const char* key); 367 void plist_dict_remove_item(plist_t node, const char* key);
375 368
376 /** 369 /**
377 * Merge a dictionary into another. This will add all key/value pairs 370 * Merge a dictionary into another. This will add all key/value pairs
@@ -381,7 +374,7 @@ extern "C"
381 * @param target pointer to an existing node of type #PLIST_DICT 374 * @param target pointer to an existing node of type #PLIST_DICT
382 * @param source node of type #PLIST_DICT that should be merged into target 375 * @param source node of type #PLIST_DICT that should be merged into target
383 */ 376 */
384 PLIST_API void plist_dict_merge(plist_t *target, plist_t source); 377 void plist_dict_merge(plist_t *target, plist_t source);
385 378
386 379
387 /******************************************** 380 /********************************************
@@ -395,7 +388,7 @@ extern "C"
395 * 388 *
396 * @param node the parent (NULL if node is root) 389 * @param node the parent (NULL if node is root)
397 */ 390 */
398 PLIST_API plist_t plist_get_parent(plist_t node); 391 plist_t plist_get_parent(plist_t node);
399 392
400 /** 393 /**
401 * Get the #plist_type of a node. 394 * Get the #plist_type of a node.
@@ -403,7 +396,7 @@ extern "C"
403 * @param node the node 396 * @param node the node
404 * @return the type of the node 397 * @return the type of the node
405 */ 398 */
406 PLIST_API plist_type plist_get_node_type(plist_t node); 399 plist_type plist_get_node_type(plist_t node);
407 400
408 /** 401 /**
409 * Get the value of a #PLIST_KEY node. 402 * Get the value of a #PLIST_KEY node.
@@ -413,7 +406,7 @@ extern "C"
413 * @param val a pointer to a C-string. This function allocates the memory, 406 * @param val a pointer to a C-string. This function allocates the memory,
414 * caller is responsible for freeing it. 407 * caller is responsible for freeing it.
415 */ 408 */
416 PLIST_API void plist_get_key_val(plist_t node, char **val); 409 void plist_get_key_val(plist_t node, char **val);
417 410
418 /** 411 /**
419 * Get the value of a #PLIST_STRING node. 412 * Get the value of a #PLIST_STRING node.
@@ -423,7 +416,7 @@ extern "C"
423 * @param val a pointer to a C-string. This function allocates the memory, 416 * @param val a pointer to a C-string. This function allocates the memory,
424 * caller is responsible for freeing it. Data is UTF-8 encoded. 417 * caller is responsible for freeing it. Data is UTF-8 encoded.
425 */ 418 */
426 PLIST_API void plist_get_string_val(plist_t node, char **val); 419 void plist_get_string_val(plist_t node, char **val);
427 420
428 /** 421 /**
429 * Get the value of a #PLIST_BOOLEAN node. 422 * Get the value of a #PLIST_BOOLEAN node.
@@ -432,7 +425,7 @@ extern "C"
432 * @param node the node 425 * @param node the node
433 * @param val a pointer to a uint8_t variable. 426 * @param val a pointer to a uint8_t variable.
434 */ 427 */
435 PLIST_API void plist_get_bool_val(plist_t node, uint8_t * val); 428 void plist_get_bool_val(plist_t node, uint8_t * val);
436 429
437 /** 430 /**
438 * Get the value of a #PLIST_UINT node. 431 * Get the value of a #PLIST_UINT node.
@@ -441,7 +434,7 @@ extern "C"
441 * @param node the node 434 * @param node the node
442 * @param val a pointer to a uint64_t variable. 435 * @param val a pointer to a uint64_t variable.
443 */ 436 */
444 PLIST_API void plist_get_uint_val(plist_t node, uint64_t * val); 437 void plist_get_uint_val(plist_t node, uint64_t * val);
445 438
446 /** 439 /**
447 * Get the value of a #PLIST_REAL node. 440 * Get the value of a #PLIST_REAL node.
@@ -450,7 +443,7 @@ extern "C"
450 * @param node the node 443 * @param node the node
451 * @param val a pointer to a double variable. 444 * @param val a pointer to a double variable.
452 */ 445 */
453 PLIST_API void plist_get_real_val(plist_t node, double *val); 446 void plist_get_real_val(plist_t node, double *val);
454 447
455 /** 448 /**
456 * Get the value of a #PLIST_DATA node. 449 * Get the value of a #PLIST_DATA node.
@@ -461,7 +454,7 @@ extern "C"
461 * caller is responsible for freeing it. 454 * caller is responsible for freeing it.
462 * @param length the length of the buffer 455 * @param length the length of the buffer
463 */ 456 */
464 PLIST_API void plist_get_data_val(plist_t node, char **val, uint64_t * length); 457 void plist_get_data_val(plist_t node, char **val, uint64_t * length);
465 458
466 /** 459 /**
467 * Get the value of a #PLIST_DATE node. 460 * Get the value of a #PLIST_DATE node.
@@ -471,7 +464,7 @@ extern "C"
471 * @param sec a pointer to an int32_t variable. Represents the number of seconds since 01/01/2001. 464 * @param sec a pointer to an int32_t variable. Represents the number of seconds since 01/01/2001.
472 * @param usec a pointer to an int32_t variable. Represents the number of microseconds 465 * @param usec a pointer to an int32_t variable. Represents the number of microseconds
473 */ 466 */
474 PLIST_API void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec); 467 void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec);
475 468
476 /** 469 /**
477 * Get the value of a #PLIST_UID node. 470 * Get the value of a #PLIST_UID node.
@@ -480,7 +473,7 @@ extern "C"
480 * @param node the node 473 * @param node the node
481 * @param val a pointer to a uint64_t variable. 474 * @param val a pointer to a uint64_t variable.
482 */ 475 */
483 PLIST_API void plist_get_uid_val(plist_t node, uint64_t * val); 476 void plist_get_uid_val(plist_t node, uint64_t * val);
484 477
485 478
486 /******************************************** 479 /********************************************
@@ -496,7 +489,7 @@ extern "C"
496 * @param node the node 489 * @param node the node
497 * @param val the key value 490 * @param val the key value
498 */ 491 */
499 PLIST_API void plist_set_key_val(plist_t node, const char *val); 492 void plist_set_key_val(plist_t node, const char *val);
500 493
501 /** 494 /**
502 * Set the value of a node. 495 * Set the value of a node.
@@ -506,7 +499,7 @@ extern "C"
506 * @param val the string value. The string is copied when set and will be 499 * @param val the string value. The string is copied when set and will be
507 * freed by the node. 500 * freed by the node.
508 */ 501 */
509 PLIST_API void plist_set_string_val(plist_t node, const char *val); 502 void plist_set_string_val(plist_t node, const char *val);
510 503
511 /** 504 /**
512 * Set the value of a node. 505 * Set the value of a node.
@@ -515,7 +508,7 @@ extern "C"
515 * @param node the node 508 * @param node the node
516 * @param val the boolean value 509 * @param val the boolean value
517 */ 510 */
518 PLIST_API void plist_set_bool_val(plist_t node, uint8_t val); 511 void plist_set_bool_val(plist_t node, uint8_t val);
519 512
520 /** 513 /**
521 * Set the value of a node. 514 * Set the value of a node.
@@ -524,7 +517,7 @@ extern "C"
524 * @param node the node 517 * @param node the node
525 * @param val the unsigned integer value 518 * @param val the unsigned integer value
526 */ 519 */
527 PLIST_API void plist_set_uint_val(plist_t node, uint64_t val); 520 void plist_set_uint_val(plist_t node, uint64_t val);
528 521
529 /** 522 /**
530 * Set the value of a node. 523 * Set the value of a node.
@@ -533,7 +526,7 @@ extern "C"
533 * @param node the node 526 * @param node the node
534 * @param val the real value 527 * @param val the real value
535 */ 528 */
536 PLIST_API void plist_set_real_val(plist_t node, double val); 529 void plist_set_real_val(plist_t node, double val);
537 530
538 /** 531 /**
539 * Set the value of a node. 532 * Set the value of a node.
@@ -544,7 +537,7 @@ extern "C"
544 * be freed by the node. 537 * be freed by the node.
545 * @param length the length of the buffer 538 * @param length the length of the buffer
546 */ 539 */
547 PLIST_API void plist_set_data_val(plist_t node, const char *val, uint64_t length); 540 void plist_set_data_val(plist_t node, const char *val, uint64_t length);
548 541
549 /** 542 /**
550 * Set the value of a node. 543 * Set the value of a node.
@@ -554,7 +547,7 @@ extern "C"
554 * @param sec the number of seconds since 01/01/2001 547 * @param sec the number of seconds since 01/01/2001
555 * @param usec the number of microseconds 548 * @param usec the number of microseconds
556 */ 549 */
557 PLIST_API void plist_set_date_val(plist_t node, int32_t sec, int32_t usec); 550 void plist_set_date_val(plist_t node, int32_t sec, int32_t usec);
558 551
559 /** 552 /**
560 * Set the value of a node. 553 * Set the value of a node.
@@ -563,7 +556,7 @@ extern "C"
563 * @param node the node 556 * @param node the node
564 * @param val the unsigned integer value 557 * @param val the unsigned integer value
565 */ 558 */
566 PLIST_API void plist_set_uid_val(plist_t node, uint64_t val); 559 void plist_set_uid_val(plist_t node, uint64_t val);
567 560
568 561
569 /******************************************** 562 /********************************************
@@ -580,7 +573,7 @@ extern "C"
580 * caller is responsible for freeing it. Data is UTF-8 encoded. 573 * caller is responsible for freeing it. Data is UTF-8 encoded.
581 * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer. 574 * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer.
582 */ 575 */
583 PLIST_API void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length); 576 void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length);
584 577
585 /** 578 /**
586 * Export the #plist_t structure to binary format. 579 * Export the #plist_t structure to binary format.
@@ -590,7 +583,7 @@ extern "C"
590 * caller is responsible for freeing it. 583 * caller is responsible for freeing it.
591 * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer. 584 * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer.
592 */ 585 */
593 PLIST_API void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length); 586 void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length);
594 587
595 /** 588 /**
596 * Import the #plist_t structure from XML format. 589 * Import the #plist_t structure from XML format.
@@ -599,7 +592,7 @@ extern "C"
599 * @param length length of the buffer to read. 592 * @param length length of the buffer to read.
600 * @param plist a pointer to the imported plist. 593 * @param plist a pointer to the imported plist.
601 */ 594 */
602 PLIST_API void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist); 595 void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist);
603 596
604 /** 597 /**
605 * Import the #plist_t structure from binary format. 598 * Import the #plist_t structure from binary format.
@@ -608,7 +601,7 @@ extern "C"
608 * @param length length of the buffer to read. 601 * @param length length of the buffer to read.
609 * @param plist a pointer to the imported plist. 602 * @param plist a pointer to the imported plist.
610 */ 603 */
611 PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist); 604 void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist);
612 605
613 606
614 /******************************************** 607 /********************************************
@@ -626,7 +619,7 @@ extern "C"
626 * @param length length of the path to access 619 * @param length length of the path to access
627 * @return the value to access. 620 * @return the value to access.
628 */ 621 */
629 PLIST_API plist_t plist_access_path(plist_t plist, uint32_t length, ...); 622 plist_t plist_access_path(plist_t plist, uint32_t length, ...);
630 623
631 /** 624 /**
632 * Variadic version of #plist_access_path. 625 * Variadic version of #plist_access_path.
@@ -636,7 +629,7 @@ extern "C"
636 * @param v list of array's index and dic'st key 629 * @param v list of array's index and dic'st key
637 * @return the value to access. 630 * @return the value to access.
638 */ 631 */
639 PLIST_API plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v); 632 plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v);
640 633
641 /** 634 /**
642 * Compare two node values 635 * Compare two node values
@@ -645,7 +638,7 @@ extern "C"
645 * @param node_r rigth node to compare 638 * @param node_r rigth node to compare
646 * @return TRUE is type and value match, FALSE otherwise. 639 * @return TRUE is type and value match, FALSE otherwise.
647 */ 640 */
648 PLIST_API char plist_compare_node_value(plist_t node_l, plist_t node_r); 641 char plist_compare_node_value(plist_t node_l, plist_t node_r);
649 642
650 /*@}*/ 643 /*@}*/
651 644
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 @@
21#ifndef BASE64_H 21#ifndef BASE64_H
22#define BASE64_H 22#define BASE64_H
23#include <stdlib.h> 23#include <stdlib.h>
24#include "common.h"
25 24
26_PLIST_INTERNAL char *base64encode(const unsigned char *buf, size_t *size); 25char *base64encode(const unsigned char *buf, size_t *size);
27_PLIST_INTERNAL unsigned char *base64decode(const char *buf, size_t *size); 26unsigned char *base64decode(const char *buf, size_t *size);
28 27
29#endif 28#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)
599 return dstdata; 599 return dstdata;
600} 600}
601 601
602void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist) 602PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist)
603{ 603{
604 char *trailer = NULL; 604 char *trailer = NULL;
605 605
@@ -1095,7 +1095,7 @@ static uint16_t *plist_utf8_to_utf16(char *unistr, long size, long *items_read,
1095 1095
1096} 1096}
1097 1097
1098void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length) 1098PLIST_API void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
1099{ 1099{
1100 ptrarray_t* objects = NULL; 1100 ptrarray_t* objects = NULL;
1101 hashtable_t* ref_table = NULL; 1101 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 @@
21#ifndef BYTEARRAY_H 21#ifndef BYTEARRAY_H
22#define BYTEARRAY_H 22#define BYTEARRAY_H
23#include <stdlib.h> 23#include <stdlib.h>
24#include "common.h"
25 24
26typedef struct bytearray_t { 25typedef struct bytearray_t {
27 void *data; 26 void *data;
@@ -29,8 +28,8 @@ typedef struct bytearray_t {
29 size_t capacity; 28 size_t capacity;
30} bytearray_t; 29} bytearray_t;
31 30
32_PLIST_INTERNAL bytearray_t *byte_array_new(); 31bytearray_t *byte_array_new();
33_PLIST_INTERNAL void byte_array_free(bytearray_t *ba); 32void byte_array_free(bytearray_t *ba);
34_PLIST_INTERNAL void byte_array_append(bytearray_t *ba, void *buf, size_t len); 33void byte_array_append(bytearray_t *ba, void *buf, size_t len);
35 34
36#endif 35#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 @@
17#endif 17#endif
18#endif 18#endif
19 19
20#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__CYGWIN__) && !defined(WIN32)
21# define _PLIST_INTERNAL __attribute__((visibility("hidden")))
22#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
23# define _PLIST_INTERNAL __hidden
24#else /* not gcc >= 4 and not Sun Studio >= 8 */
25# define _PLIST_INTERNAL
26#endif /* GNUC >= 4 */
27
28#endif 20#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 @@
21#ifndef HASHTABLE_H 21#ifndef HASHTABLE_H
22#define HASHTABLE_H 22#define HASHTABLE_H
23#include <stdlib.h> 23#include <stdlib.h>
24#include "common.h"
25 24
26typedef struct hashentry_t { 25typedef struct hashentry_t {
27 void *key; 26 void *key;
@@ -39,10 +38,10 @@ typedef struct hashtable_t {
39 compare_func_t compare_func; 38 compare_func_t compare_func;
40} hashtable_t; 39} hashtable_t;
41 40
42_PLIST_INTERNAL hashtable_t* hash_table_new(hash_func_t hash_func, compare_func_t compare_func); 41hashtable_t* hash_table_new(hash_func_t hash_func, compare_func_t compare_func);
43_PLIST_INTERNAL void hash_table_destroy(hashtable_t *ht); 42void hash_table_destroy(hashtable_t *ht);
44 43
45_PLIST_INTERNAL void hash_table_insert(hashtable_t* ht, void *key, void *value); 44void hash_table_insert(hashtable_t* ht, void *key, void *value);
46_PLIST_INTERNAL void* hash_table_lookup(hashtable_t* ht, void *key); 45void* hash_table_lookup(hashtable_t* ht, void *key);
47 46
48#endif 47#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)
87 return node_index; 87 return node_index;
88} 88}
89 89
90plist_t plist_new_dict(void) 90PLIST_API plist_t plist_new_dict(void)
91{ 91{
92 plist_data_t data = plist_new_plist_data(); 92 plist_data_t data = plist_new_plist_data();
93 data->type = PLIST_DICT; 93 data->type = PLIST_DICT;
94 return plist_new_node(data); 94 return plist_new_node(data);
95} 95}
96 96
97plist_t plist_new_array(void) 97PLIST_API plist_t plist_new_array(void)
98{ 98{
99 plist_data_t data = plist_new_plist_data(); 99 plist_data_t data = plist_new_plist_data();
100 data->type = PLIST_ARRAY; 100 data->type = PLIST_ARRAY;
@@ -111,7 +111,7 @@ static plist_t plist_new_key(const char *val)
111 return plist_new_node(data); 111 return plist_new_node(data);
112} 112}
113 113
114plist_t plist_new_string(const char *val) 114PLIST_API plist_t plist_new_string(const char *val)
115{ 115{
116 plist_data_t data = plist_new_plist_data(); 116 plist_data_t data = plist_new_plist_data();
117 data->type = PLIST_STRING; 117 data->type = PLIST_STRING;
@@ -120,7 +120,7 @@ plist_t plist_new_string(const char *val)
120 return plist_new_node(data); 120 return plist_new_node(data);
121} 121}
122 122
123plist_t plist_new_bool(uint8_t val) 123PLIST_API plist_t plist_new_bool(uint8_t val)
124{ 124{
125 plist_data_t data = plist_new_plist_data(); 125 plist_data_t data = plist_new_plist_data();
126 data->type = PLIST_BOOLEAN; 126 data->type = PLIST_BOOLEAN;
@@ -129,7 +129,7 @@ plist_t plist_new_bool(uint8_t val)
129 return plist_new_node(data); 129 return plist_new_node(data);
130} 130}
131 131
132plist_t plist_new_uint(uint64_t val) 132PLIST_API plist_t plist_new_uint(uint64_t val)
133{ 133{
134 plist_data_t data = plist_new_plist_data(); 134 plist_data_t data = plist_new_plist_data();
135 data->type = PLIST_UINT; 135 data->type = PLIST_UINT;
@@ -138,7 +138,7 @@ plist_t plist_new_uint(uint64_t val)
138 return plist_new_node(data); 138 return plist_new_node(data);
139} 139}
140 140
141plist_t plist_new_uid(uint64_t val) 141PLIST_API plist_t plist_new_uid(uint64_t val)
142{ 142{
143 plist_data_t data = plist_new_plist_data(); 143 plist_data_t data = plist_new_plist_data();
144 data->type = PLIST_UID; 144 data->type = PLIST_UID;
@@ -147,7 +147,7 @@ plist_t plist_new_uid(uint64_t val)
147 return plist_new_node(data); 147 return plist_new_node(data);
148} 148}
149 149
150plist_t plist_new_real(double val) 150PLIST_API plist_t plist_new_real(double val)
151{ 151{
152 plist_data_t data = plist_new_plist_data(); 152 plist_data_t data = plist_new_plist_data();
153 data->type = PLIST_REAL; 153 data->type = PLIST_REAL;
@@ -156,7 +156,7 @@ plist_t plist_new_real(double val)
156 return plist_new_node(data); 156 return plist_new_node(data);
157} 157}
158 158
159plist_t plist_new_data(const char *val, uint64_t length) 159PLIST_API plist_t plist_new_data(const char *val, uint64_t length)
160{ 160{
161 plist_data_t data = plist_new_plist_data(); 161 plist_data_t data = plist_new_plist_data();
162 data->type = PLIST_DATA; 162 data->type = PLIST_DATA;
@@ -166,7 +166,7 @@ plist_t plist_new_data(const char *val, uint64_t length)
166 return plist_new_node(data); 166 return plist_new_node(data);
167} 167}
168 168
169plist_t plist_new_date(int32_t sec, int32_t usec) 169PLIST_API plist_t plist_new_date(int32_t sec, int32_t usec)
170{ 170{
171 plist_data_t data = plist_new_plist_data(); 171 plist_data_t data = plist_new_plist_data();
172 data->type = PLIST_DATE; 172 data->type = PLIST_DATE;
@@ -176,7 +176,7 @@ plist_t plist_new_date(int32_t sec, int32_t usec)
176 return plist_new_node(data); 176 return plist_new_node(data);
177} 177}
178 178
179void plist_free(plist_t plist) 179PLIST_API void plist_free(plist_t plist)
180{ 180{
181 if (plist) 181 if (plist)
182 { 182 {
@@ -231,14 +231,14 @@ static void plist_copy_node(node_t *node, void *parent_node_ptr)
231 node_iterator_destroy(ni); 231 node_iterator_destroy(ni);
232} 232}
233 233
234plist_t plist_copy(plist_t node) 234PLIST_API plist_t plist_copy(plist_t node)
235{ 235{
236 plist_t copied = NULL; 236 plist_t copied = NULL;
237 plist_copy_node(node, &copied); 237 plist_copy_node(node, &copied);
238 return copied; 238 return copied;
239} 239}
240 240
241uint32_t plist_array_get_size(plist_t node) 241PLIST_API uint32_t plist_array_get_size(plist_t node)
242{ 242{
243 uint32_t ret = 0; 243 uint32_t ret = 0;
244 if (node && PLIST_ARRAY == plist_get_node_type(node)) 244 if (node && PLIST_ARRAY == plist_get_node_type(node))
@@ -248,7 +248,7 @@ uint32_t plist_array_get_size(plist_t node)
248 return ret; 248 return ret;
249} 249}
250 250
251plist_t plist_array_get_item(plist_t node, uint32_t n) 251PLIST_API plist_t plist_array_get_item(plist_t node, uint32_t n)
252{ 252{
253 plist_t ret = NULL; 253 plist_t ret = NULL;
254 if (node && PLIST_ARRAY == plist_get_node_type(node)) 254 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 return ret; 258 return ret;
259} 259}
260 260
261uint32_t plist_array_get_item_index(plist_t node) 261PLIST_API uint32_t plist_array_get_item_index(plist_t node)
262{ 262{
263 plist_t father = plist_get_parent(node); 263 plist_t father = plist_get_parent(node);
264 if (PLIST_ARRAY == plist_get_node_type(father)) 264 if (PLIST_ARRAY == plist_get_node_type(father))
@@ -268,7 +268,7 @@ uint32_t plist_array_get_item_index(plist_t node)
268 return 0; 268 return 0;
269} 269}
270 270
271void plist_array_set_item(plist_t node, plist_t item, uint32_t n) 271PLIST_API void plist_array_set_item(plist_t node, plist_t item, uint32_t n)
272{ 272{
273 if (node && PLIST_ARRAY == plist_get_node_type(node)) 273 if (node && PLIST_ARRAY == plist_get_node_type(node))
274 { 274 {
@@ -286,7 +286,7 @@ void plist_array_set_item(plist_t node, plist_t item, uint32_t n)
286 return; 286 return;
287} 287}
288 288
289void plist_array_append_item(plist_t node, plist_t item) 289PLIST_API void plist_array_append_item(plist_t node, plist_t item)
290{ 290{
291 if (node && PLIST_ARRAY == plist_get_node_type(node)) 291 if (node && PLIST_ARRAY == plist_get_node_type(node))
292 { 292 {
@@ -295,7 +295,7 @@ void plist_array_append_item(plist_t node, plist_t item)
295 return; 295 return;
296} 296}
297 297
298void plist_array_insert_item(plist_t node, plist_t item, uint32_t n) 298PLIST_API void plist_array_insert_item(plist_t node, plist_t item, uint32_t n)
299{ 299{
300 if (node && PLIST_ARRAY == plist_get_node_type(node)) 300 if (node && PLIST_ARRAY == plist_get_node_type(node))
301 { 301 {
@@ -304,7 +304,7 @@ void plist_array_insert_item(plist_t node, plist_t item, uint32_t n)
304 return; 304 return;
305} 305}
306 306
307void plist_array_remove_item(plist_t node, uint32_t n) 307PLIST_API void plist_array_remove_item(plist_t node, uint32_t n)
308{ 308{
309 if (node && PLIST_ARRAY == plist_get_node_type(node)) 309 if (node && PLIST_ARRAY == plist_get_node_type(node))
310 { 310 {
@@ -317,7 +317,7 @@ void plist_array_remove_item(plist_t node, uint32_t n)
317 return; 317 return;
318} 318}
319 319
320uint32_t plist_dict_get_size(plist_t node) 320PLIST_API uint32_t plist_dict_get_size(plist_t node)
321{ 321{
322 uint32_t ret = 0; 322 uint32_t ret = 0;
323 if (node && PLIST_DICT == plist_get_node_type(node)) 323 if (node && PLIST_DICT == plist_get_node_type(node))
@@ -327,7 +327,7 @@ uint32_t plist_dict_get_size(plist_t node)
327 return ret; 327 return ret;
328} 328}
329 329
330void plist_dict_new_iter(plist_t node, plist_dict_iter *iter) 330PLIST_API void plist_dict_new_iter(plist_t node, plist_dict_iter *iter)
331{ 331{
332 if (iter && *iter == NULL) 332 if (iter && *iter == NULL)
333 { 333 {
@@ -337,7 +337,7 @@ void plist_dict_new_iter(plist_t node, plist_dict_iter *iter)
337 return; 337 return;
338} 338}
339 339
340void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val) 340PLIST_API void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val)
341{ 341{
342 uint32_t* iter_int = (uint32_t*) iter; 342 uint32_t* iter_int = (uint32_t*) iter;
343 343
@@ -368,7 +368,7 @@ void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_
368 return; 368 return;
369} 369}
370 370
371void plist_dict_get_item_key(plist_t node, char **key) 371PLIST_API void plist_dict_get_item_key(plist_t node, char **key)
372{ 372{
373 plist_t father = plist_get_parent(node); 373 plist_t father = plist_get_parent(node);
374 if (PLIST_DICT == plist_get_node_type(father)) 374 if (PLIST_DICT == plist_get_node_type(father))
@@ -377,7 +377,7 @@ void plist_dict_get_item_key(plist_t node, char **key)
377 } 377 }
378} 378}
379 379
380plist_t plist_dict_get_item(plist_t node, const char* key) 380PLIST_API plist_t plist_dict_get_item(plist_t node, const char* key)
381{ 381{
382 plist_t ret = NULL; 382 plist_t ret = NULL;
383 383
@@ -403,7 +403,7 @@ plist_t plist_dict_get_item(plist_t node, const char* key)
403 return ret; 403 return ret;
404} 404}
405 405
406void plist_dict_set_item(plist_t node, const char* key, plist_t item) 406PLIST_API void plist_dict_set_item(plist_t node, const char* key, plist_t item)
407{ 407{
408 if (node && PLIST_DICT == plist_get_node_type(node)) { 408 if (node && PLIST_DICT == plist_get_node_type(node)) {
409 node_t* old_item = plist_dict_get_item(node, key); 409 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 return; 422 return;
423} 423}
424 424
425void plist_dict_insert_item(plist_t node, const char* key, plist_t item) 425PLIST_API void plist_dict_insert_item(plist_t node, const char* key, plist_t item)
426{ 426{
427 plist_dict_set_item(node, key, item); 427 plist_dict_set_item(node, key, item);
428} 428}
429 429
430void plist_dict_remove_item(plist_t node, const char* key) 430PLIST_API void plist_dict_remove_item(plist_t node, const char* key)
431{ 431{
432 if (node && PLIST_DICT == plist_get_node_type(node)) 432 if (node && PLIST_DICT == plist_get_node_type(node))
433 { 433 {
@@ -442,7 +442,7 @@ void plist_dict_remove_item(plist_t node, const char* key)
442 return; 442 return;
443} 443}
444 444
445void plist_dict_merge(plist_t *target, plist_t source) 445PLIST_API void plist_dict_merge(plist_t *target, plist_t source)
446{ 446{
447 if (!target || !*target || (plist_get_node_type(*target) != PLIST_DICT) || !source || (plist_get_node_type(source) != PLIST_DICT)) 447 if (!target || !*target || (plist_get_node_type(*target) != PLIST_DICT) || !source || (plist_get_node_type(source) != PLIST_DICT))
448 return; 448 return;
@@ -466,7 +466,7 @@ void plist_dict_merge(plist_t *target, plist_t source)
466 free(it); 466 free(it);
467} 467}
468 468
469plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v) 469PLIST_API plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v)
470{ 470{
471 plist_t current = plist; 471 plist_t current = plist;
472 plist_type type = PLIST_NONE; 472 plist_type type = PLIST_NONE;
@@ -490,7 +490,7 @@ plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v)
490 return current; 490 return current;
491} 491}
492 492
493plist_t plist_access_path(plist_t plist, uint32_t length, ...) 493PLIST_API plist_t plist_access_path(plist_t plist, uint32_t length, ...)
494{ 494{
495 plist_t ret = NULL; 495 plist_t ret = NULL;
496 va_list v; 496 va_list v;
@@ -545,12 +545,12 @@ static void plist_get_type_and_value(plist_t node, plist_type * type, void *valu
545 } 545 }
546} 546}
547 547
548plist_t plist_get_parent(plist_t node) 548PLIST_API plist_t plist_get_parent(plist_t node)
549{ 549{
550 return node ? (plist_t) ((node_t*) node)->parent : NULL; 550 return node ? (plist_t) ((node_t*) node)->parent : NULL;
551} 551}
552 552
553plist_type plist_get_node_type(plist_t node) 553PLIST_API plist_type plist_get_node_type(plist_t node)
554{ 554{
555 if (node) 555 if (node)
556 { 556 {
@@ -561,7 +561,7 @@ plist_type plist_get_node_type(plist_t node)
561 return PLIST_NONE; 561 return PLIST_NONE;
562} 562}
563 563
564void plist_get_key_val(plist_t node, char **val) 564PLIST_API void plist_get_key_val(plist_t node, char **val)
565{ 565{
566 plist_type type = plist_get_node_type(node); 566 plist_type type = plist_get_node_type(node);
567 uint64_t length = 0; 567 uint64_t length = 0;
@@ -570,7 +570,7 @@ void plist_get_key_val(plist_t node, char **val)
570 assert(length == strlen(*val)); 570 assert(length == strlen(*val));
571} 571}
572 572
573void plist_get_string_val(plist_t node, char **val) 573PLIST_API void plist_get_string_val(plist_t node, char **val)
574{ 574{
575 plist_type type = plist_get_node_type(node); 575 plist_type type = plist_get_node_type(node);
576 uint64_t length = 0; 576 uint64_t length = 0;
@@ -579,7 +579,7 @@ void plist_get_string_val(plist_t node, char **val)
579 assert(length == strlen(*val)); 579 assert(length == strlen(*val));
580} 580}
581 581
582void plist_get_bool_val(plist_t node, uint8_t * val) 582PLIST_API void plist_get_bool_val(plist_t node, uint8_t * val)
583{ 583{
584 plist_type type = plist_get_node_type(node); 584 plist_type type = plist_get_node_type(node);
585 uint64_t length = 0; 585 uint64_t length = 0;
@@ -588,7 +588,7 @@ void plist_get_bool_val(plist_t node, uint8_t * val)
588 assert(length == sizeof(uint8_t)); 588 assert(length == sizeof(uint8_t));
589} 589}
590 590
591void plist_get_uint_val(plist_t node, uint64_t * val) 591PLIST_API void plist_get_uint_val(plist_t node, uint64_t * val)
592{ 592{
593 plist_type type = plist_get_node_type(node); 593 plist_type type = plist_get_node_type(node);
594 uint64_t length = 0; 594 uint64_t length = 0;
@@ -597,7 +597,7 @@ void plist_get_uint_val(plist_t node, uint64_t * val)
597 assert(length == sizeof(uint64_t)); 597 assert(length == sizeof(uint64_t));
598} 598}
599 599
600void plist_get_uid_val(plist_t node, uint64_t * val) 600PLIST_API void plist_get_uid_val(plist_t node, uint64_t * val)
601{ 601{
602 plist_type type = plist_get_node_type(node); 602 plist_type type = plist_get_node_type(node);
603 uint64_t length = 0; 603 uint64_t length = 0;
@@ -606,7 +606,7 @@ void plist_get_uid_val(plist_t node, uint64_t * val)
606 assert(length == sizeof(uint64_t)); 606 assert(length == sizeof(uint64_t));
607} 607}
608 608
609void plist_get_real_val(plist_t node, double *val) 609PLIST_API void plist_get_real_val(plist_t node, double *val)
610{ 610{
611 plist_type type = plist_get_node_type(node); 611 plist_type type = plist_get_node_type(node);
612 uint64_t length = 0; 612 uint64_t length = 0;
@@ -615,14 +615,14 @@ void plist_get_real_val(plist_t node, double *val)
615 assert(length == sizeof(double)); 615 assert(length == sizeof(double));
616} 616}
617 617
618void plist_get_data_val(plist_t node, char **val, uint64_t * length) 618PLIST_API void plist_get_data_val(plist_t node, char **val, uint64_t * length)
619{ 619{
620 plist_type type = plist_get_node_type(node); 620 plist_type type = plist_get_node_type(node);
621 if (PLIST_DATA == type) 621 if (PLIST_DATA == type)
622 plist_get_type_and_value(node, &type, (void *) val, length); 622 plist_get_type_and_value(node, &type, (void *) val, length);
623} 623}
624 624
625void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec) 625PLIST_API void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec)
626{ 626{
627 plist_type type = plist_get_node_type(node); 627 plist_type type = plist_get_node_type(node);
628 uint64_t length = 0; 628 uint64_t length = 0;
@@ -695,7 +695,7 @@ int plist_data_compare(const void *a, const void *b)
695 return FALSE; 695 return FALSE;
696} 696}
697 697
698char plist_compare_node_value(plist_t node_l, plist_t node_r) 698PLIST_API char plist_compare_node_value(plist_t node_l, plist_t node_r)
699{ 699{
700 return plist_data_compare(node_l, node_r); 700 return plist_data_compare(node_l, node_r);
701} 701}
@@ -757,42 +757,42 @@ static void plist_set_element_val(plist_t node, plist_type type, const void *val
757 } 757 }
758} 758}
759 759
760void plist_set_key_val(plist_t node, const char *val) 760PLIST_API void plist_set_key_val(plist_t node, const char *val)
761{ 761{
762 plist_set_element_val(node, PLIST_KEY, val, strlen(val)); 762 plist_set_element_val(node, PLIST_KEY, val, strlen(val));
763} 763}
764 764
765void plist_set_string_val(plist_t node, const char *val) 765PLIST_API void plist_set_string_val(plist_t node, const char *val)
766{ 766{
767 plist_set_element_val(node, PLIST_STRING, val, strlen(val)); 767 plist_set_element_val(node, PLIST_STRING, val, strlen(val));
768} 768}
769 769
770void plist_set_bool_val(plist_t node, uint8_t val) 770PLIST_API void plist_set_bool_val(plist_t node, uint8_t val)
771{ 771{
772 plist_set_element_val(node, PLIST_BOOLEAN, &val, sizeof(uint8_t)); 772 plist_set_element_val(node, PLIST_BOOLEAN, &val, sizeof(uint8_t));
773} 773}
774 774
775void plist_set_uint_val(plist_t node, uint64_t val) 775PLIST_API void plist_set_uint_val(plist_t node, uint64_t val)
776{ 776{
777 plist_set_element_val(node, PLIST_UINT, &val, sizeof(uint64_t)); 777 plist_set_element_val(node, PLIST_UINT, &val, sizeof(uint64_t));
778} 778}
779 779
780void plist_set_uid_val(plist_t node, uint64_t val) 780PLIST_API void plist_set_uid_val(plist_t node, uint64_t val)
781{ 781{
782 plist_set_element_val(node, PLIST_UID, &val, sizeof(uint64_t)); 782 plist_set_element_val(node, PLIST_UID, &val, sizeof(uint64_t));
783} 783}
784 784
785void plist_set_real_val(plist_t node, double val) 785PLIST_API void plist_set_real_val(plist_t node, double val)
786{ 786{
787 plist_set_element_val(node, PLIST_REAL, &val, sizeof(double)); 787 plist_set_element_val(node, PLIST_REAL, &val, sizeof(double));
788} 788}
789 789
790void plist_set_data_val(plist_t node, const char *val, uint64_t length) 790PLIST_API void plist_set_data_val(plist_t node, const char *val, uint64_t length)
791{ 791{
792 plist_set_element_val(node, PLIST_DATA, val, length); 792 plist_set_element_val(node, PLIST_DATA, val, length);
793} 793}
794 794
795void plist_set_date_val(plist_t node, int32_t sec, int32_t usec) 795PLIST_API void plist_set_date_val(plist_t node, int32_t sec, int32_t usec)
796{ 796{
797 struct timeval val = { sec, usec }; 797 struct timeval val = { sec, usec };
798 plist_set_element_val(node, PLIST_DATE, &val, sizeof(struct timeval)); 798 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 @@
22#ifndef PLIST_H 22#ifndef PLIST_H
23#define PLIST_H 23#define PLIST_H
24 24
25#ifdef HAVE_CONFIG_H
26#include <config.h>
27#endif
28
25#include "plist/plist.h" 29#include "plist/plist.h"
26#include "common.h"
27 30
28#include <sys/types.h> 31#include <sys/types.h>
29#include <sys/stat.h> 32#include <sys/stat.h>
@@ -34,6 +37,15 @@
34#pragma warning(disable:4244) 37#pragma warning(disable:4244)
35#endif 38#endif
36 39
40#ifdef WIN32
41 #define PLIST_API __declspec( dllexport )
42#else
43 #ifdef HAVE_FVISIBILITY
44 #define PLIST_API __attribute__((visibility("default")))
45 #else
46 #define PLIST_API
47 #endif
48#endif
37 49
38struct plist_data_s 50struct plist_data_s
39{ 51{
@@ -52,10 +64,10 @@ struct plist_data_s
52 64
53typedef struct plist_data_s *plist_data_t; 65typedef struct plist_data_s *plist_data_t;
54 66
55_PLIST_INTERNAL plist_t plist_new_node(plist_data_t data); 67plist_t plist_new_node(plist_data_t data);
56_PLIST_INTERNAL plist_data_t plist_get_data(const plist_t node); 68plist_data_t plist_get_data(const plist_t node);
57_PLIST_INTERNAL plist_data_t plist_new_plist_data(void); 69plist_data_t plist_new_plist_data(void);
58_PLIST_INTERNAL int plist_data_compare(const void *a, const void *b); 70int plist_data_compare(const void *a, const void *b);
59 71
60 72
61#endif 73#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 @@
21#ifndef PTRARRAY_H 21#ifndef PTRARRAY_H
22#define PTRARRAY_H 22#define PTRARRAY_H
23#include <stdlib.h> 23#include <stdlib.h>
24#include "common.h"
25 24
26typedef struct ptrarray_t { 25typedef struct ptrarray_t {
27 void **pdata; 26 void **pdata;
@@ -30,8 +29,8 @@ typedef struct ptrarray_t {
30 size_t capacity_step; 29 size_t capacity_step;
31} ptrarray_t; 30} ptrarray_t;
32 31
33_PLIST_INTERNAL ptrarray_t *ptr_array_new(int capacity); 32ptrarray_t *ptr_array_new(int capacity);
34_PLIST_INTERNAL void ptr_array_free(ptrarray_t *pa); 33void ptr_array_free(ptrarray_t *pa);
35_PLIST_INTERNAL void ptr_array_add(ptrarray_t *pa, void *data); 34void ptr_array_add(ptrarray_t *pa, void *data);
36_PLIST_INTERNAL void* ptr_array_index(ptrarray_t *pa, size_t index); 35void* ptr_array_index(ptrarray_t *pa, size_t index);
37#endif 36#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)
513 } 513 }
514} 514}
515 515
516void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length) 516PLIST_API void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length)
517{ 517{
518 xmlDocPtr plist_doc = NULL; 518 xmlDocPtr plist_doc = NULL;
519 xmlNodePtr root_node = NULL; 519 xmlNodePtr root_node = NULL;
@@ -555,7 +555,7 @@ void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length)
555 } 555 }
556} 556}
557 557
558void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist) 558PLIST_API void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist)
559{ 559{
560 xmlDocPtr plist_doc = xmlParseMemory(plist_xml, length); 560 xmlDocPtr plist_doc = xmlParseMemory(plist_xml, length);
561 xmlNodePtr root_node = xmlDocGetRootElement(plist_doc); 561 xmlNodePtr root_node = xmlDocGetRootElement(plist_doc);
diff --git a/test/Makefile.am b/test/Makefile.am
index 3bd3e5d..77122be 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -4,7 +4,7 @@ AM_LDFLAGS =
4noinst_PROGRAMS = plist_cmp plist_test 4noinst_PROGRAMS = plist_cmp plist_test
5 5
6plist_cmp_SOURCES = plist_cmp.c 6plist_cmp_SOURCES = plist_cmp.c
7plist_cmp_LDADD = $(top_builddir)/src/libplist.la 7plist_cmp_LDADD = $(top_builddir)/src/libplist.la $(top_builddir)/libcnary/libcnary.la
8 8
9plist_test_SOURCES = plist_test.c 9plist_test_SOURCES = plist_test.c
10plist_test_LDADD = $(top_builddir)/src/libplist.la 10plist_test_LDADD = $(top_builddir)/src/libplist.la