summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bplist.c4
-rw-r--r--src/jplist.c4
-rw-r--r--src/oplist.c4
-rw-r--r--src/plist.c166
-rw-r--r--src/plist.h10
-rw-r--r--src/xplist.c4
6 files changed, 91 insertions, 101 deletions
diff --git a/src/bplist.c b/src/bplist.c
index e9b71eb..840e40c 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -781,7 +781,7 @@ static plist_t parse_bin_node_at_index(struct bplist_data *bplist, uint32_t node
781 return plist; 781 return plist;
782} 782}
783 783
784PLIST_API plist_err_t plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist) 784plist_err_t plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist)
785{ 785{
786 bplist_trailer_t *trailer = NULL; 786 bplist_trailer_t *trailer = NULL;
787 uint8_t offset_size = 0; 787 uint8_t offset_size = 0;
@@ -1191,7 +1191,7 @@ static int is_ascii_string(char* s, int len)
1191 return ret; 1191 return ret;
1192} 1192}
1193 1193
1194PLIST_API plist_err_t plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length) 1194plist_err_t plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
1195{ 1195{
1196 ptrarray_t* objects = NULL; 1196 ptrarray_t* objects = NULL;
1197 hashtable_t* ref_table = NULL; 1197 hashtable_t* ref_table = NULL;
diff --git a/src/jplist.c b/src/jplist.c
index d6ea942..9263b36 100644
--- a/src/jplist.c
+++ b/src/jplist.c
@@ -398,7 +398,7 @@ static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, int p
398 return PLIST_ERR_SUCCESS; 398 return PLIST_ERR_SUCCESS;
399} 399}
400 400
401PLIST_API int plist_to_json(plist_t plist, char **json, uint32_t* length, int prettify) 401int plist_to_json(plist_t plist, char **json, uint32_t* length, int prettify)
402{ 402{
403 uint64_t size = 0; 403 uint64_t size = 0;
404 int res; 404 int res;
@@ -782,7 +782,7 @@ static plist_t parse_object(const char* js, jsmntok_info_t* ti, int* index)
782 return obj; 782 return obj;
783} 783}
784 784
785PLIST_API int plist_from_json(const char *json, uint32_t length, plist_t * plist) 785int plist_from_json(const char *json, uint32_t length, plist_t * plist)
786{ 786{
787 if (!plist) { 787 if (!plist) {
788 return PLIST_ERR_INVALID_ARG; 788 return PLIST_ERR_INVALID_ARG;
diff --git a/src/oplist.c b/src/oplist.c
index 2c7d26c..74c4e0a 100644
--- a/src/oplist.c
+++ b/src/oplist.c
@@ -442,7 +442,7 @@ static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, int p
442 return PLIST_ERR_SUCCESS; 442 return PLIST_ERR_SUCCESS;
443} 443}
444 444
445PLIST_API int plist_to_openstep(plist_t plist, char **openstep, uint32_t* length, int prettify) 445int plist_to_openstep(plist_t plist, char **openstep, uint32_t* length, int prettify)
446{ 446{
447 uint64_t size = 0; 447 uint64_t size = 0;
448 int res; 448 int res;
@@ -895,7 +895,7 @@ err_out:
895 return PLIST_ERR_SUCCESS; 895 return PLIST_ERR_SUCCESS;
896} 896}
897 897
898PLIST_API int plist_from_openstep(const char *plist_ostep, uint32_t length, plist_t * plist) 898int plist_from_openstep(const char *plist_ostep, uint32_t length, plist_t * plist)
899{ 899{
900 if (!plist) { 900 if (!plist) {
901 return PLIST_ERR_INVALID_ARG; 901 return PLIST_ERR_INVALID_ARG;
diff --git a/src/plist.c b/src/plist.c
index e0cb86a..677e398 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -183,7 +183,7 @@ void* memmem(const void* haystack, size_t haystack_len, const void* needle, size
183} 183}
184#endif 184#endif
185 185
186PLIST_API int plist_is_binary(const char *plist_data, uint32_t length) 186int plist_is_binary(const char *plist_data, uint32_t length)
187{ 187{
188 if (length < 8) { 188 if (length < 8) {
189 return 0; 189 return 0;
@@ -197,7 +197,7 @@ PLIST_API int plist_is_binary(const char *plist_data, uint32_t length)
197#define FIND_NEXT(blob, pos, len, chr) \ 197#define FIND_NEXT(blob, pos, len, chr) \
198 while (pos < len && (blob[pos] != chr)) pos++; 198 while (pos < len && (blob[pos] != chr)) pos++;
199 199
200PLIST_API plist_err_t plist_from_memory(const char *plist_data, uint32_t length, plist_t *plist, plist_format_t *format) 200plist_err_t plist_from_memory(const char *plist_data, uint32_t length, plist_t *plist, plist_format_t *format)
201{ 201{
202 int res = -1; 202 int res = -1;
203 if (!plist) { 203 if (!plist) {
@@ -266,7 +266,7 @@ PLIST_API plist_err_t plist_from_memory(const char *plist_data, uint32_t length,
266 return res; 266 return res;
267} 267}
268 268
269PLIST_API plist_err_t plist_read_from_file(const char *filename, plist_t *plist, plist_format_t *format) 269plist_err_t plist_read_from_file(const char *filename, plist_t *plist, plist_format_t *format)
270{ 270{
271 if (!filename || !plist) { 271 if (!filename || !plist) {
272 return PLIST_ERR_INVALID_ARG; 272 return PLIST_ERR_INVALID_ARG;
@@ -396,14 +396,14 @@ static int plist_free_node(node_t node)
396 return node_index; 396 return node_index;
397} 397}
398 398
399PLIST_API plist_t plist_new_dict(void) 399plist_t plist_new_dict(void)
400{ 400{
401 plist_data_t data = plist_new_plist_data(); 401 plist_data_t data = plist_new_plist_data();
402 data->type = PLIST_DICT; 402 data->type = PLIST_DICT;
403 return plist_new_node(data); 403 return plist_new_node(data);
404} 404}
405 405
406PLIST_API plist_t plist_new_array(void) 406plist_t plist_new_array(void)
407{ 407{
408 plist_data_t data = plist_new_plist_data(); 408 plist_data_t data = plist_new_plist_data();
409 data->type = PLIST_ARRAY; 409 data->type = PLIST_ARRAY;
@@ -420,7 +420,7 @@ static plist_t plist_new_key(const char *val)
420 return plist_new_node(data); 420 return plist_new_node(data);
421} 421}
422 422
423PLIST_API plist_t plist_new_string(const char *val) 423plist_t plist_new_string(const char *val)
424{ 424{
425 plist_data_t data = plist_new_plist_data(); 425 plist_data_t data = plist_new_plist_data();
426 data->type = PLIST_STRING; 426 data->type = PLIST_STRING;
@@ -429,7 +429,7 @@ PLIST_API plist_t plist_new_string(const char *val)
429 return plist_new_node(data); 429 return plist_new_node(data);
430} 430}
431 431
432PLIST_API plist_t plist_new_bool(uint8_t val) 432plist_t plist_new_bool(uint8_t val)
433{ 433{
434 plist_data_t data = plist_new_plist_data(); 434 plist_data_t data = plist_new_plist_data();
435 data->type = PLIST_BOOLEAN; 435 data->type = PLIST_BOOLEAN;
@@ -438,7 +438,7 @@ PLIST_API plist_t plist_new_bool(uint8_t val)
438 return plist_new_node(data); 438 return plist_new_node(data);
439} 439}
440 440
441PLIST_API plist_t plist_new_uint(uint64_t val) 441plist_t plist_new_uint(uint64_t val)
442{ 442{
443 plist_data_t data = plist_new_plist_data(); 443 plist_data_t data = plist_new_plist_data();
444 data->type = PLIST_INT; 444 data->type = PLIST_INT;
@@ -447,7 +447,7 @@ PLIST_API plist_t plist_new_uint(uint64_t val)
447 return plist_new_node(data); 447 return plist_new_node(data);
448} 448}
449 449
450PLIST_API plist_t plist_new_int(int64_t val) 450plist_t plist_new_int(int64_t val)
451{ 451{
452 plist_data_t data = plist_new_plist_data(); 452 plist_data_t data = plist_new_plist_data();
453 data->type = PLIST_INT; 453 data->type = PLIST_INT;
@@ -456,7 +456,7 @@ PLIST_API plist_t plist_new_int(int64_t val)
456 return plist_new_node(data); 456 return plist_new_node(data);
457} 457}
458 458
459PLIST_API plist_t plist_new_uid(uint64_t val) 459plist_t plist_new_uid(uint64_t val)
460{ 460{
461 plist_data_t data = plist_new_plist_data(); 461 plist_data_t data = plist_new_plist_data();
462 data->type = PLIST_UID; 462 data->type = PLIST_UID;
@@ -465,7 +465,7 @@ PLIST_API plist_t plist_new_uid(uint64_t val)
465 return plist_new_node(data); 465 return plist_new_node(data);
466} 466}
467 467
468PLIST_API plist_t plist_new_real(double val) 468plist_t plist_new_real(double val)
469{ 469{
470 plist_data_t data = plist_new_plist_data(); 470 plist_data_t data = plist_new_plist_data();
471 data->type = PLIST_REAL; 471 data->type = PLIST_REAL;
@@ -474,7 +474,7 @@ PLIST_API plist_t plist_new_real(double val)
474 return plist_new_node(data); 474 return plist_new_node(data);
475} 475}
476 476
477PLIST_API plist_t plist_new_data(const char *val, uint64_t length) 477plist_t plist_new_data(const char *val, uint64_t length)
478{ 478{
479 plist_data_t data = plist_new_plist_data(); 479 plist_data_t data = plist_new_plist_data();
480 data->type = PLIST_DATA; 480 data->type = PLIST_DATA;
@@ -484,7 +484,7 @@ PLIST_API plist_t plist_new_data(const char *val, uint64_t length)
484 return plist_new_node(data); 484 return plist_new_node(data);
485} 485}
486 486
487PLIST_API plist_t plist_new_date(int32_t sec, int32_t usec) 487plist_t plist_new_date(int32_t sec, int32_t usec)
488{ 488{
489 plist_data_t data = plist_new_plist_data(); 489 plist_data_t data = plist_new_plist_data();
490 data->type = PLIST_DATE; 490 data->type = PLIST_DATE;
@@ -493,7 +493,7 @@ PLIST_API plist_t plist_new_date(int32_t sec, int32_t usec)
493 return plist_new_node(data); 493 return plist_new_node(data);
494} 494}
495 495
496PLIST_API plist_t plist_new_null(void) 496plist_t plist_new_null(void)
497{ 497{
498 plist_data_t data = plist_new_plist_data(); 498 plist_data_t data = plist_new_plist_data();
499 data->type = PLIST_NULL; 499 data->type = PLIST_NULL;
@@ -502,7 +502,7 @@ PLIST_API plist_t plist_new_null(void)
502 return plist_new_node(data); 502 return plist_new_node(data);
503} 503}
504 504
505PLIST_API void plist_free(plist_t plist) 505void plist_free(plist_t plist)
506{ 506{
507 if (plist) 507 if (plist)
508 { 508 {
@@ -510,7 +510,7 @@ PLIST_API void plist_free(plist_t plist)
510 } 510 }
511} 511}
512 512
513PLIST_API void plist_mem_free(void* ptr) 513void plist_mem_free(void* ptr)
514{ 514{
515 if (ptr) 515 if (ptr)
516 { 516 {
@@ -586,12 +586,12 @@ static plist_t plist_copy_node(node_t node)
586 return newnode; 586 return newnode;
587} 587}
588 588
589PLIST_API plist_t plist_copy(plist_t node) 589plist_t plist_copy(plist_t node)
590{ 590{
591 return node ? plist_copy_node(node) : NULL; 591 return node ? plist_copy_node(node) : NULL;
592} 592}
593 593
594PLIST_API uint32_t plist_array_get_size(plist_t node) 594uint32_t plist_array_get_size(plist_t node)
595{ 595{
596 uint32_t ret = 0; 596 uint32_t ret = 0;
597 if (node && PLIST_ARRAY == plist_get_node_type(node)) 597 if (node && PLIST_ARRAY == plist_get_node_type(node))
@@ -601,7 +601,7 @@ PLIST_API uint32_t plist_array_get_size(plist_t node)
601 return ret; 601 return ret;
602} 602}
603 603
604PLIST_API plist_t plist_array_get_item(plist_t node, uint32_t n) 604plist_t plist_array_get_item(plist_t node, uint32_t n)
605{ 605{
606 plist_t ret = NULL; 606 plist_t ret = NULL;
607 if (node && PLIST_ARRAY == plist_get_node_type(node) && n < INT_MAX) 607 if (node && PLIST_ARRAY == plist_get_node_type(node) && n < INT_MAX)
@@ -616,7 +616,7 @@ PLIST_API plist_t plist_array_get_item(plist_t node, uint32_t n)
616 return ret; 616 return ret;
617} 617}
618 618
619PLIST_API uint32_t plist_array_get_item_index(plist_t node) 619uint32_t plist_array_get_item_index(plist_t node)
620{ 620{
621 plist_t father = plist_get_parent(node); 621 plist_t father = plist_get_parent(node);
622 if (PLIST_ARRAY == plist_get_node_type(father)) 622 if (PLIST_ARRAY == plist_get_node_type(father))
@@ -648,7 +648,7 @@ static void _plist_array_post_insert(plist_t node, plist_t item, long n)
648 } 648 }
649} 649}
650 650
651PLIST_API void plist_array_set_item(plist_t node, plist_t item, uint32_t n) 651void plist_array_set_item(plist_t node, plist_t item, uint32_t n)
652{ 652{
653 if (node && PLIST_ARRAY == plist_get_node_type(node) && n < INT_MAX) 653 if (node && PLIST_ARRAY == plist_get_node_type(node) && n < INT_MAX)
654 { 654 {
@@ -669,7 +669,7 @@ PLIST_API void plist_array_set_item(plist_t node, plist_t item, uint32_t n)
669 } 669 }
670} 670}
671 671
672PLIST_API void plist_array_append_item(plist_t node, plist_t item) 672void plist_array_append_item(plist_t node, plist_t item)
673{ 673{
674 if (node && PLIST_ARRAY == plist_get_node_type(node)) 674 if (node && PLIST_ARRAY == plist_get_node_type(node))
675 { 675 {
@@ -678,7 +678,7 @@ PLIST_API void plist_array_append_item(plist_t node, plist_t item)
678 } 678 }
679} 679}
680 680
681PLIST_API void plist_array_insert_item(plist_t node, plist_t item, uint32_t n) 681void plist_array_insert_item(plist_t node, plist_t item, uint32_t n)
682{ 682{
683 if (node && PLIST_ARRAY == plist_get_node_type(node) && n < INT_MAX) 683 if (node && PLIST_ARRAY == plist_get_node_type(node) && n < INT_MAX)
684 { 684 {
@@ -687,7 +687,7 @@ PLIST_API void plist_array_insert_item(plist_t node, plist_t item, uint32_t n)
687 } 687 }
688} 688}
689 689
690PLIST_API void plist_array_remove_item(plist_t node, uint32_t n) 690void plist_array_remove_item(plist_t node, uint32_t n)
691{ 691{
692 if (node && PLIST_ARRAY == plist_get_node_type(node) && n < INT_MAX) 692 if (node && PLIST_ARRAY == plist_get_node_type(node) && n < INT_MAX)
693 { 693 {
@@ -703,7 +703,7 @@ PLIST_API void plist_array_remove_item(plist_t node, uint32_t n)
703 } 703 }
704} 704}
705 705
706PLIST_API void plist_array_item_remove(plist_t node) 706void plist_array_item_remove(plist_t node)
707{ 707{
708 plist_t father = plist_get_parent(node); 708 plist_t father = plist_get_parent(node);
709 if (PLIST_ARRAY == plist_get_node_type(father)) 709 if (PLIST_ARRAY == plist_get_node_type(father))
@@ -718,7 +718,7 @@ PLIST_API void plist_array_item_remove(plist_t node)
718 } 718 }
719} 719}
720 720
721PLIST_API void plist_array_new_iter(plist_t node, plist_array_iter *iter) 721void plist_array_new_iter(plist_t node, plist_array_iter *iter)
722{ 722{
723 if (iter) 723 if (iter)
724 { 724 {
@@ -727,7 +727,7 @@ PLIST_API void plist_array_new_iter(plist_t node, plist_array_iter *iter)
727 } 727 }
728} 728}
729 729
730PLIST_API void plist_array_next_item(plist_t node, plist_array_iter iter, plist_t *item) 730void plist_array_next_item(plist_t node, plist_array_iter iter, plist_t *item)
731{ 731{
732 node_t* iter_node = (node_t*)iter; 732 node_t* iter_node = (node_t*)iter;
733 733
@@ -746,7 +746,7 @@ PLIST_API void plist_array_next_item(plist_t node, plist_array_iter iter, plist_
746 } 746 }
747} 747}
748 748
749PLIST_API uint32_t plist_dict_get_size(plist_t node) 749uint32_t plist_dict_get_size(plist_t node)
750{ 750{
751 uint32_t ret = 0; 751 uint32_t ret = 0;
752 if (node && PLIST_DICT == plist_get_node_type(node)) 752 if (node && PLIST_DICT == plist_get_node_type(node))
@@ -756,7 +756,7 @@ PLIST_API uint32_t plist_dict_get_size(plist_t node)
756 return ret; 756 return ret;
757} 757}
758 758
759PLIST_API void plist_dict_new_iter(plist_t node, plist_dict_iter *iter) 759void plist_dict_new_iter(plist_t node, plist_dict_iter *iter)
760{ 760{
761 if (iter) 761 if (iter)
762 { 762 {
@@ -765,7 +765,7 @@ PLIST_API void plist_dict_new_iter(plist_t node, plist_dict_iter *iter)
765 } 765 }
766} 766}
767 767
768PLIST_API void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val) 768void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val)
769{ 769{
770 node_t* iter_node = (node_t*)iter; 770 node_t* iter_node = (node_t*)iter;
771 771
@@ -793,7 +793,7 @@ PLIST_API void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **k
793 } 793 }
794} 794}
795 795
796PLIST_API void plist_dict_get_item_key(plist_t node, char **key) 796void plist_dict_get_item_key(plist_t node, char **key)
797{ 797{
798 plist_t father = plist_get_parent(node); 798 plist_t father = plist_get_parent(node);
799 if (PLIST_DICT == plist_get_node_type(father)) 799 if (PLIST_DICT == plist_get_node_type(father))
@@ -802,7 +802,7 @@ PLIST_API void plist_dict_get_item_key(plist_t node, char **key)
802 } 802 }
803} 803}
804 804
805PLIST_API plist_t plist_dict_item_get_key(plist_t node) 805plist_t plist_dict_item_get_key(plist_t node)
806{ 806{
807 plist_t ret = NULL; 807 plist_t ret = NULL;
808 plist_t father = plist_get_parent(node); 808 plist_t father = plist_get_parent(node);
@@ -813,7 +813,7 @@ PLIST_API plist_t plist_dict_item_get_key(plist_t node)
813 return ret; 813 return ret;
814} 814}
815 815
816PLIST_API plist_t plist_dict_get_item(plist_t node, const char* key) 816plist_t plist_dict_get_item(plist_t node, const char* key)
817{ 817{
818 plist_t ret = NULL; 818 plist_t ret = NULL;
819 819
@@ -846,7 +846,7 @@ PLIST_API plist_t plist_dict_get_item(plist_t node, const char* key)
846 return ret; 846 return ret;
847} 847}
848 848
849PLIST_API void plist_dict_set_item(plist_t node, const char* key, plist_t item) 849void plist_dict_set_item(plist_t node, const char* key, plist_t item)
850{ 850{
851 if (node && PLIST_DICT == plist_get_node_type(node)) { 851 if (node && PLIST_DICT == plist_get_node_type(node)) {
852 node_t old_item = plist_dict_get_item(node, key); 852 node_t old_item = plist_dict_get_item(node, key);
@@ -887,7 +887,7 @@ PLIST_API void plist_dict_set_item(plist_t node, const char* key, plist_t item)
887 } 887 }
888} 888}
889 889
890PLIST_API void plist_dict_remove_item(plist_t node, const char* key) 890void plist_dict_remove_item(plist_t node, const char* key)
891{ 891{
892 if (node && PLIST_DICT == plist_get_node_type(node)) 892 if (node && PLIST_DICT == plist_get_node_type(node))
893 { 893 {
@@ -905,7 +905,7 @@ PLIST_API void plist_dict_remove_item(plist_t node, const char* key)
905 } 905 }
906} 906}
907 907
908PLIST_API void plist_dict_merge(plist_t *target, plist_t source) 908void plist_dict_merge(plist_t *target, plist_t source)
909{ 909{
910 if (!target || !*target || (plist_get_node_type(*target) != PLIST_DICT) || !source || (plist_get_node_type(source) != PLIST_DICT)) 910 if (!target || !*target || (plist_get_node_type(*target) != PLIST_DICT) || !source || (plist_get_node_type(source) != PLIST_DICT))
911 return; 911 return;
@@ -929,7 +929,7 @@ PLIST_API void plist_dict_merge(plist_t *target, plist_t source)
929 free(it); 929 free(it);
930} 930}
931 931
932PLIST_API plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v) 932plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v)
933{ 933{
934 plist_t current = plist; 934 plist_t current = plist;
935 plist_type type = PLIST_NONE; 935 plist_type type = PLIST_NONE;
@@ -953,7 +953,7 @@ PLIST_API plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v)
953 return current; 953 return current;
954} 954}
955 955
956PLIST_API plist_t plist_access_path(plist_t plist, uint32_t length, ...) 956plist_t plist_access_path(plist_t plist, uint32_t length, ...)
957{ 957{
958 plist_t ret = NULL; 958 plist_t ret = NULL;
959 va_list v; 959 va_list v;
@@ -1004,12 +1004,12 @@ static void plist_get_type_and_value(plist_t node, plist_type * type, void *valu
1004 } 1004 }
1005} 1005}
1006 1006
1007PLIST_API plist_t plist_get_parent(plist_t node) 1007plist_t plist_get_parent(plist_t node)
1008{ 1008{
1009 return node ? (plist_t) ((node_t) node)->parent : NULL; 1009 return node ? (plist_t) ((node_t) node)->parent : NULL;
1010} 1010}
1011 1011
1012PLIST_API plist_type plist_get_node_type(plist_t node) 1012plist_type plist_get_node_type(plist_t node)
1013{ 1013{
1014 if (node) 1014 if (node)
1015 { 1015 {
@@ -1020,7 +1020,7 @@ PLIST_API plist_type plist_get_node_type(plist_t node)
1020 return PLIST_NONE; 1020 return PLIST_NONE;
1021} 1021}
1022 1022
1023PLIST_API void plist_get_key_val(plist_t node, char **val) 1023void plist_get_key_val(plist_t node, char **val)
1024{ 1024{
1025 if (!node || !val) 1025 if (!node || !val)
1026 return; 1026 return;
@@ -1034,7 +1034,7 @@ PLIST_API void plist_get_key_val(plist_t node, char **val)
1034 assert(length == strlen(*val)); 1034 assert(length == strlen(*val));
1035} 1035}
1036 1036
1037PLIST_API void plist_get_string_val(plist_t node, char **val) 1037void plist_get_string_val(plist_t node, char **val)
1038{ 1038{
1039 if (!node || !val) 1039 if (!node || !val)
1040 return; 1040 return;
@@ -1048,7 +1048,7 @@ PLIST_API void plist_get_string_val(plist_t node, char **val)
1048 assert(length == strlen(*val)); 1048 assert(length == strlen(*val));
1049} 1049}
1050 1050
1051PLIST_API const char* plist_get_string_ptr(plist_t node, uint64_t* length) 1051const char* plist_get_string_ptr(plist_t node, uint64_t* length)
1052{ 1052{
1053 if (!node) 1053 if (!node)
1054 return NULL; 1054 return NULL;
@@ -1061,7 +1061,7 @@ PLIST_API const char* plist_get_string_ptr(plist_t node, uint64_t* length)
1061 return (const char*)data->strval; 1061 return (const char*)data->strval;
1062} 1062}
1063 1063
1064PLIST_API void plist_get_bool_val(plist_t node, uint8_t * val) 1064void plist_get_bool_val(plist_t node, uint8_t * val)
1065{ 1065{
1066 if (!node || !val) 1066 if (!node || !val)
1067 return; 1067 return;
@@ -1073,7 +1073,7 @@ PLIST_API void plist_get_bool_val(plist_t node, uint8_t * val)
1073 assert(length == sizeof(uint8_t)); 1073 assert(length == sizeof(uint8_t));
1074} 1074}
1075 1075
1076PLIST_API void plist_get_uint_val(plist_t node, uint64_t * val) 1076void plist_get_uint_val(plist_t node, uint64_t * val)
1077{ 1077{
1078 if (!node || !val) 1078 if (!node || !val)
1079 return; 1079 return;
@@ -1085,12 +1085,12 @@ PLIST_API void plist_get_uint_val(plist_t node, uint64_t * val)
1085 assert(length == sizeof(uint64_t) || length == 16); 1085 assert(length == sizeof(uint64_t) || length == 16);
1086} 1086}
1087 1087
1088PLIST_API void plist_get_int_val(plist_t node, int64_t * val) 1088void plist_get_int_val(plist_t node, int64_t * val)
1089{ 1089{
1090 plist_get_uint_val(node, (uint64_t*)val); 1090 plist_get_uint_val(node, (uint64_t*)val);
1091} 1091}
1092 1092
1093PLIST_API void plist_get_uid_val(plist_t node, uint64_t * val) 1093void plist_get_uid_val(plist_t node, uint64_t * val)
1094{ 1094{
1095 if (!node || !val) 1095 if (!node || !val)
1096 return; 1096 return;
@@ -1102,7 +1102,7 @@ PLIST_API void plist_get_uid_val(plist_t node, uint64_t * val)
1102 assert(length == sizeof(uint64_t)); 1102 assert(length == sizeof(uint64_t));
1103} 1103}
1104 1104
1105PLIST_API void plist_get_real_val(plist_t node, double *val) 1105void plist_get_real_val(plist_t node, double *val)
1106{ 1106{
1107 if (!node || !val) 1107 if (!node || !val)
1108 return; 1108 return;
@@ -1114,7 +1114,7 @@ PLIST_API void plist_get_real_val(plist_t node, double *val)
1114 assert(length == sizeof(double)); 1114 assert(length == sizeof(double));
1115} 1115}
1116 1116
1117PLIST_API void plist_get_data_val(plist_t node, char **val, uint64_t * length) 1117void plist_get_data_val(plist_t node, char **val, uint64_t * length)
1118{ 1118{
1119 if (!node || !val || !length) 1119 if (!node || !val || !length)
1120 return; 1120 return;
@@ -1124,7 +1124,7 @@ PLIST_API void plist_get_data_val(plist_t node, char **val, uint64_t * length)
1124 plist_get_type_and_value(node, &type, (void *) val, length); 1124 plist_get_type_and_value(node, &type, (void *) val, length);
1125} 1125}
1126 1126
1127PLIST_API const char* plist_get_data_ptr(plist_t node, uint64_t* length) 1127const char* plist_get_data_ptr(plist_t node, uint64_t* length)
1128{ 1128{
1129 if (!node || !length) 1129 if (!node || !length)
1130 return NULL; 1130 return NULL;
@@ -1136,7 +1136,7 @@ PLIST_API const char* plist_get_data_ptr(plist_t node, uint64_t* length)
1136 return (const char*)data->buff; 1136 return (const char*)data->buff;
1137} 1137}
1138 1138
1139PLIST_API void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec) 1139void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec)
1140{ 1140{
1141 if (!node) 1141 if (!node)
1142 return; 1142 return;
@@ -1205,7 +1205,7 @@ int plist_data_compare(const void *a, const void *b)
1205 return FALSE; 1205 return FALSE;
1206} 1206}
1207 1207
1208PLIST_API char plist_compare_node_value(plist_t node_l, plist_t node_r) 1208char plist_compare_node_value(plist_t node_l, plist_t node_r)
1209{ 1209{
1210 return plist_data_compare(node_l, node_r); 1210 return plist_data_compare(node_l, node_r);
1211} 1211}
@@ -1264,7 +1264,7 @@ static void plist_set_element_val(plist_t node, plist_type type, const void *val
1264 } 1264 }
1265} 1265}
1266 1266
1267PLIST_API void plist_set_key_val(plist_t node, const char *val) 1267void plist_set_key_val(plist_t node, const char *val)
1268{ 1268{
1269 plist_t father = plist_get_parent(node); 1269 plist_t father = plist_get_parent(node);
1270 plist_t item = plist_dict_get_item(father, val); 1270 plist_t item = plist_dict_get_item(father, val);
@@ -1274,48 +1274,48 @@ PLIST_API void plist_set_key_val(plist_t node, const char *val)
1274 plist_set_element_val(node, PLIST_KEY, val, strlen(val)); 1274 plist_set_element_val(node, PLIST_KEY, val, strlen(val));
1275} 1275}
1276 1276
1277PLIST_API void plist_set_string_val(plist_t node, const char *val) 1277void plist_set_string_val(plist_t node, const char *val)
1278{ 1278{
1279 plist_set_element_val(node, PLIST_STRING, val, strlen(val)); 1279 plist_set_element_val(node, PLIST_STRING, val, strlen(val));
1280} 1280}
1281 1281
1282PLIST_API void plist_set_bool_val(plist_t node, uint8_t val) 1282void plist_set_bool_val(plist_t node, uint8_t val)
1283{ 1283{
1284 plist_set_element_val(node, PLIST_BOOLEAN, &val, sizeof(uint8_t)); 1284 plist_set_element_val(node, PLIST_BOOLEAN, &val, sizeof(uint8_t));
1285} 1285}
1286 1286
1287PLIST_API void plist_set_uint_val(plist_t node, uint64_t val) 1287void plist_set_uint_val(plist_t node, uint64_t val)
1288{ 1288{
1289 plist_set_element_val(node, PLIST_INT, &val, (val > INT64_MAX) ? sizeof(uint64_t)*2 : sizeof(uint64_t)); 1289 plist_set_element_val(node, PLIST_INT, &val, (val > INT64_MAX) ? sizeof(uint64_t)*2 : sizeof(uint64_t));
1290} 1290}
1291 1291
1292PLIST_API void plist_set_int_val(plist_t node, int64_t val) 1292void plist_set_int_val(plist_t node, int64_t val)
1293{ 1293{
1294 plist_set_element_val(node, PLIST_INT, &val, sizeof(uint64_t)); 1294 plist_set_element_val(node, PLIST_INT, &val, sizeof(uint64_t));
1295} 1295}
1296 1296
1297PLIST_API void plist_set_uid_val(plist_t node, uint64_t val) 1297void plist_set_uid_val(plist_t node, uint64_t val)
1298{ 1298{
1299 plist_set_element_val(node, PLIST_UID, &val, sizeof(uint64_t)); 1299 plist_set_element_val(node, PLIST_UID, &val, sizeof(uint64_t));
1300} 1300}
1301 1301
1302PLIST_API void plist_set_real_val(plist_t node, double val) 1302void plist_set_real_val(plist_t node, double val)
1303{ 1303{
1304 plist_set_element_val(node, PLIST_REAL, &val, sizeof(double)); 1304 plist_set_element_val(node, PLIST_REAL, &val, sizeof(double));
1305} 1305}
1306 1306
1307PLIST_API void plist_set_data_val(plist_t node, const char *val, uint64_t length) 1307void plist_set_data_val(plist_t node, const char *val, uint64_t length)
1308{ 1308{
1309 plist_set_element_val(node, PLIST_DATA, val, length); 1309 plist_set_element_val(node, PLIST_DATA, val, length);
1310} 1310}
1311 1311
1312PLIST_API void plist_set_date_val(plist_t node, int32_t sec, int32_t usec) 1312void plist_set_date_val(plist_t node, int32_t sec, int32_t usec)
1313{ 1313{
1314 double val = (double)sec + (double)usec / 1000000; 1314 double val = (double)sec + (double)usec / 1000000;
1315 plist_set_element_val(node, PLIST_DATE, &val, sizeof(struct timeval)); 1315 plist_set_element_val(node, PLIST_DATE, &val, sizeof(struct timeval));
1316} 1316}
1317 1317
1318PLIST_API int plist_bool_val_is_true(plist_t boolnode) 1318int plist_bool_val_is_true(plist_t boolnode)
1319{ 1319{
1320 if (!PLIST_IS_BOOLEAN(boolnode)) { 1320 if (!PLIST_IS_BOOLEAN(boolnode)) {
1321 return 0; 1321 return 0;
@@ -1325,7 +1325,7 @@ PLIST_API int plist_bool_val_is_true(plist_t boolnode)
1325 return (bv == 1); 1325 return (bv == 1);
1326} 1326}
1327 1327
1328PLIST_API int plist_int_val_is_negative(plist_t intnode) 1328int plist_int_val_is_negative(plist_t intnode)
1329{ 1329{
1330 if (!PLIST_IS_INT(intnode)) { 1330 if (!PLIST_IS_INT(intnode)) {
1331 return 0; 1331 return 0;
@@ -1340,7 +1340,7 @@ PLIST_API int plist_int_val_is_negative(plist_t intnode)
1340 return 0; 1340 return 0;
1341} 1341}
1342 1342
1343PLIST_API int plist_int_val_compare(plist_t uintnode, int64_t cmpval) 1343int plist_int_val_compare(plist_t uintnode, int64_t cmpval)
1344{ 1344{
1345 if (!PLIST_IS_INT(uintnode)) { 1345 if (!PLIST_IS_INT(uintnode)) {
1346 return -1; 1346 return -1;
@@ -1358,7 +1358,7 @@ PLIST_API int plist_int_val_compare(plist_t uintnode, int64_t cmpval)
1358 return 1; 1358 return 1;
1359} 1359}
1360 1360
1361PLIST_API int plist_uint_val_compare(plist_t uintnode, uint64_t cmpval) 1361int plist_uint_val_compare(plist_t uintnode, uint64_t cmpval)
1362{ 1362{
1363 if (!PLIST_IS_INT(uintnode)) { 1363 if (!PLIST_IS_INT(uintnode)) {
1364 return -1; 1364 return -1;
@@ -1376,7 +1376,7 @@ PLIST_API int plist_uint_val_compare(plist_t uintnode, uint64_t cmpval)
1376 return 1; 1376 return 1;
1377} 1377}
1378 1378
1379PLIST_API int plist_uid_val_compare(plist_t uidnode, uint64_t cmpval) 1379int plist_uid_val_compare(plist_t uidnode, uint64_t cmpval)
1380{ 1380{
1381 if (!PLIST_IS_UID(uidnode)) { 1381 if (!PLIST_IS_UID(uidnode)) {
1382 return -1; 1382 return -1;
@@ -1394,7 +1394,7 @@ PLIST_API int plist_uid_val_compare(plist_t uidnode, uint64_t cmpval)
1394 return 1; 1394 return 1;
1395} 1395}
1396 1396
1397PLIST_API int plist_real_val_compare(plist_t realnode, double cmpval) 1397int plist_real_val_compare(plist_t realnode, double cmpval)
1398{ 1398{
1399 if (!PLIST_IS_REAL(realnode)) { 1399 if (!PLIST_IS_REAL(realnode)) {
1400 return -1; 1400 return -1;
@@ -1429,7 +1429,7 @@ PLIST_API int plist_real_val_compare(plist_t realnode, double cmpval)
1429 return 1; 1429 return 1;
1430} 1430}
1431 1431
1432PLIST_API int plist_date_val_compare(plist_t datenode, int32_t cmpsec, int32_t cmpusec) 1432int plist_date_val_compare(plist_t datenode, int32_t cmpsec, int32_t cmpusec)
1433{ 1433{
1434 if (!PLIST_IS_DATE(datenode)) { 1434 if (!PLIST_IS_DATE(datenode)) {
1435 return -1; 1435 return -1;
@@ -1450,7 +1450,7 @@ PLIST_API int plist_date_val_compare(plist_t datenode, int32_t cmpsec, int32_t c
1450 return 1; 1450 return 1;
1451} 1451}
1452 1452
1453PLIST_API int plist_string_val_compare(plist_t strnode, const char* cmpval) 1453int plist_string_val_compare(plist_t strnode, const char* cmpval)
1454{ 1454{
1455 if (!PLIST_IS_STRING(strnode)) { 1455 if (!PLIST_IS_STRING(strnode)) {
1456 return -1; 1456 return -1;
@@ -1459,7 +1459,7 @@ PLIST_API int plist_string_val_compare(plist_t strnode, const char* cmpval)
1459 return strcmp(data->strval, cmpval); 1459 return strcmp(data->strval, cmpval);
1460} 1460}
1461 1461
1462PLIST_API int plist_string_val_compare_with_size(plist_t strnode, const char* cmpval, size_t n) 1462int plist_string_val_compare_with_size(plist_t strnode, const char* cmpval, size_t n)
1463{ 1463{
1464 if (!PLIST_IS_STRING(strnode)) { 1464 if (!PLIST_IS_STRING(strnode)) {
1465 return -1; 1465 return -1;
@@ -1468,7 +1468,7 @@ PLIST_API int plist_string_val_compare_with_size(plist_t strnode, const char* cm
1468 return strncmp(data->strval, cmpval, n); 1468 return strncmp(data->strval, cmpval, n);
1469} 1469}
1470 1470
1471PLIST_API int plist_string_val_contains(plist_t strnode, const char* substr) 1471int plist_string_val_contains(plist_t strnode, const char* substr)
1472{ 1472{
1473 if (!PLIST_IS_STRING(strnode)) { 1473 if (!PLIST_IS_STRING(strnode)) {
1474 return 0; 1474 return 0;
@@ -1477,7 +1477,7 @@ PLIST_API int plist_string_val_contains(plist_t strnode, const char* substr)
1477 return (strstr(data->strval, substr) != NULL); 1477 return (strstr(data->strval, substr) != NULL);
1478} 1478}
1479 1479
1480PLIST_API int plist_key_val_compare(plist_t keynode, const char* cmpval) 1480int plist_key_val_compare(plist_t keynode, const char* cmpval)
1481{ 1481{
1482 if (!PLIST_IS_KEY(keynode)) { 1482 if (!PLIST_IS_KEY(keynode)) {
1483 return -1; 1483 return -1;
@@ -1486,7 +1486,7 @@ PLIST_API int plist_key_val_compare(plist_t keynode, const char* cmpval)
1486 return strcmp(data->strval, cmpval); 1486 return strcmp(data->strval, cmpval);
1487} 1487}
1488 1488
1489PLIST_API int plist_key_val_compare_with_size(plist_t keynode, const char* cmpval, size_t n) 1489int plist_key_val_compare_with_size(plist_t keynode, const char* cmpval, size_t n)
1490{ 1490{
1491 if (!PLIST_IS_KEY(keynode)) { 1491 if (!PLIST_IS_KEY(keynode)) {
1492 return -1; 1492 return -1;
@@ -1495,7 +1495,7 @@ PLIST_API int plist_key_val_compare_with_size(plist_t keynode, const char* cmpva
1495 return strncmp(data->strval, cmpval, n); 1495 return strncmp(data->strval, cmpval, n);
1496} 1496}
1497 1497
1498PLIST_API int plist_key_val_contains(plist_t keynode, const char* substr) 1498int plist_key_val_contains(plist_t keynode, const char* substr)
1499{ 1499{
1500 if (!PLIST_IS_KEY(keynode)) { 1500 if (!PLIST_IS_KEY(keynode)) {
1501 return 0; 1501 return 0;
@@ -1504,7 +1504,7 @@ PLIST_API int plist_key_val_contains(plist_t keynode, const char* substr)
1504 return (strstr(data->strval, substr) != NULL); 1504 return (strstr(data->strval, substr) != NULL);
1505} 1505}
1506 1506
1507PLIST_API int plist_data_val_compare(plist_t datanode, const uint8_t* cmpval, size_t n) 1507int plist_data_val_compare(plist_t datanode, const uint8_t* cmpval, size_t n)
1508{ 1508{
1509 if (!PLIST_IS_DATA(datanode)) { 1509 if (!PLIST_IS_DATA(datanode)) {
1510 return -1; 1510 return -1;
@@ -1521,7 +1521,7 @@ PLIST_API int plist_data_val_compare(plist_t datanode, const uint8_t* cmpval, si
1521 return memcmp(data->buff, cmpval, n); 1521 return memcmp(data->buff, cmpval, n);
1522} 1522}
1523 1523
1524PLIST_API int plist_data_val_compare_with_size(plist_t datanode, const uint8_t* cmpval, size_t n) 1524int plist_data_val_compare_with_size(plist_t datanode, const uint8_t* cmpval, size_t n)
1525{ 1525{
1526 if (!PLIST_IS_DATA(datanode)) { 1526 if (!PLIST_IS_DATA(datanode)) {
1527 return -1; 1527 return -1;
@@ -1533,7 +1533,7 @@ PLIST_API int plist_data_val_compare_with_size(plist_t datanode, const uint8_t*
1533 return memcmp(data->buff, cmpval, n); 1533 return memcmp(data->buff, cmpval, n);
1534} 1534}
1535 1535
1536PLIST_API int plist_data_val_contains(plist_t datanode, const uint8_t* cmpval, size_t n) 1536int plist_data_val_contains(plist_t datanode, const uint8_t* cmpval, size_t n)
1537{ 1537{
1538 if (!PLIST_IS_DATA(datanode)) { 1538 if (!PLIST_IS_DATA(datanode)) {
1539 return -1; 1539 return -1;
@@ -1547,7 +1547,7 @@ extern void plist_bin_set_debug(int debug);
1547extern void plist_json_set_debug(int debug); 1547extern void plist_json_set_debug(int debug);
1548extern void plist_ostep_set_debug(int debug); 1548extern void plist_ostep_set_debug(int debug);
1549 1549
1550PLIST_API void plist_set_debug(int debug) 1550void plist_set_debug(int debug)
1551{ 1551{
1552 plist_xml_set_debug(debug); 1552 plist_xml_set_debug(debug);
1553 plist_bin_set_debug(debug); 1553 plist_bin_set_debug(debug);
@@ -1555,7 +1555,7 @@ PLIST_API void plist_set_debug(int debug)
1555 plist_ostep_set_debug(debug); 1555 plist_ostep_set_debug(debug);
1556} 1556}
1557 1557
1558PLIST_API void plist_sort(plist_t plist) 1558void plist_sort(plist_t plist)
1559{ 1559{
1560 if (!plist) { 1560 if (!plist) {
1561 return; 1561 return;
@@ -1619,7 +1619,7 @@ PLIST_API void plist_sort(plist_t plist)
1619 } 1619 }
1620} 1620}
1621 1621
1622PLIST_API plist_err_t plist_write_to_string(plist_t plist, char **output, uint32_t* length, plist_format_t format, plist_write_options_t options) 1622plist_err_t plist_write_to_string(plist_t plist, char **output, uint32_t* length, plist_format_t format, plist_write_options_t options)
1623{ 1623{
1624 plist_err_t err = PLIST_ERR_UNKNOWN; 1624 plist_err_t err = PLIST_ERR_UNKNOWN;
1625 switch (format) { 1625 switch (format) {
@@ -1649,7 +1649,7 @@ PLIST_API plist_err_t plist_write_to_string(plist_t plist, char **output, uint32
1649 return err; 1649 return err;
1650} 1650}
1651 1651
1652PLIST_API plist_err_t plist_write_to_stream(plist_t plist, FILE *stream, plist_format_t format, plist_write_options_t options) 1652plist_err_t plist_write_to_stream(plist_t plist, FILE *stream, plist_format_t format, plist_write_options_t options)
1653{ 1653{
1654 if (!plist || !stream) { 1654 if (!plist || !stream) {
1655 return PLIST_ERR_INVALID_ARG; 1655 return PLIST_ERR_INVALID_ARG;
@@ -1692,7 +1692,7 @@ PLIST_API plist_err_t plist_write_to_stream(plist_t plist, FILE *stream, plist_f
1692 return err; 1692 return err;
1693} 1693}
1694 1694
1695PLIST_API plist_err_t plist_write_to_file(plist_t plist, const char* filename, plist_format_t format, plist_write_options_t options) 1695plist_err_t plist_write_to_file(plist_t plist, const char* filename, plist_format_t format, plist_write_options_t options)
1696{ 1696{
1697 if (!plist || !filename) { 1697 if (!plist || !filename) {
1698 return PLIST_ERR_INVALID_ARG; 1698 return PLIST_ERR_INVALID_ARG;
@@ -1706,7 +1706,7 @@ PLIST_API plist_err_t plist_write_to_file(plist_t plist, const char* filename, p
1706 return err; 1706 return err;
1707} 1707}
1708 1708
1709PLIST_API void plist_print(plist_t plist) 1709void plist_print(plist_t plist)
1710{ 1710{
1711 plist_write_to_stream(plist, stdout, PLIST_FORMAT_PRINT, PLIST_OPT_PARTIAL_DATA); 1711 plist_write_to_stream(plist, stdout, PLIST_FORMAT_PRINT, PLIST_OPT_PARTIAL_DATA);
1712} 1712}
diff --git a/src/plist.h b/src/plist.h
index 13dc286..4351ce4 100644
--- a/src/plist.h
+++ b/src/plist.h
@@ -37,16 +37,6 @@
37#pragma warning(disable:4244) 37#pragma warning(disable:4244)
38#endif 38#endif
39 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
49
50struct plist_data_s 40struct plist_data_s
51{ 41{
52 union 42 union
diff --git a/src/xplist.c b/src/xplist.c
index a0ab6d3..481da5d 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -529,7 +529,7 @@ static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth)
529 return PLIST_ERR_SUCCESS; 529 return PLIST_ERR_SUCCESS;
530} 530}
531 531
532PLIST_API plist_err_t plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length) 532plist_err_t plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length)
533{ 533{
534 uint64_t size = 0; 534 uint64_t size = 0;
535 int res; 535 int res;
@@ -1471,7 +1471,7 @@ err_out:
1471 return PLIST_ERR_SUCCESS; 1471 return PLIST_ERR_SUCCESS;
1472} 1472}
1473 1473
1474PLIST_API plist_err_t plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist) 1474plist_err_t plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist)
1475{ 1475{
1476 if (!plist) { 1476 if (!plist) {
1477 return PLIST_ERR_INVALID_ARG; 1477 return PLIST_ERR_INVALID_ARG;