summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bplist.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/bplist.c b/src/bplist.c
index f0b8f0e..987dd93 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -201,7 +201,7 @@ struct bplist_data {
201 uint8_t offset_size; 201 uint8_t offset_size;
202 const char* offset_table; 202 const char* offset_table;
203 uint32_t level; 203 uint32_t level;
204 plist_t used_indexes; 204 ptrarray_t* used_indexes;
205}; 205};
206 206
207#ifdef DEBUG 207#ifdef DEBUG
@@ -740,20 +740,20 @@ static plist_t parse_bin_node_at_index(struct bplist_data *bplist, uint32_t node
740 } 740 }
741 741
742 /* store node_index for current recursion level */ 742 /* store node_index for current recursion level */
743 if (plist_array_get_size(bplist->used_indexes) < bplist->level+1) { 743 if (ptr_array_size(bplist->used_indexes) < bplist->level+1) {
744 while (plist_array_get_size(bplist->used_indexes) < bplist->level+1) { 744 while (ptr_array_size(bplist->used_indexes) < bplist->level+1) {
745 plist_array_append_item(bplist->used_indexes, plist_new_uint(node_index)); 745 ptr_array_add(bplist->used_indexes, node_index);
746 } 746 }
747 } else { 747 } else {
748 plist_array_set_item(bplist->used_indexes, plist_new_uint(node_index), bplist->level); 748 ptr_array_set(bplist->used_indexes, node_index, bplist->level);
749 } 749 }
750 750
751 /* recursion check */ 751 /* recursion check */
752 if (bplist->level > 0) { 752 if (bplist->level > 0) {
753 for (i = bplist->level-1; i >= 0; i--) { 753 for (i = bplist->level-1; i >= 0; i--) {
754 plist_t node_i = plist_array_get_item(bplist->used_indexes, i); 754 uint32_t node_i = ptr_array_index(bplist->used_indexes, i);
755 plist_t node_level = plist_array_get_item(bplist->used_indexes, bplist->level); 755 uint32_t node_level = ptr_array_index(bplist->used_indexes, bplist->level);
756 if (plist_compare_node_value(node_i, node_level)) { 756 if (node_i == node_level) {
757 PLIST_BIN_ERR("recursion detected in binary plist\n"); 757 PLIST_BIN_ERR("recursion detected in binary plist\n");
758 return NULL; 758 return NULL;
759 } 759 }
@@ -850,7 +850,7 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t *
850 bplist.offset_size = offset_size; 850 bplist.offset_size = offset_size;
851 bplist.offset_table = offset_table; 851 bplist.offset_table = offset_table;
852 bplist.level = 0; 852 bplist.level = 0;
853 bplist.used_indexes = plist_new_array(); 853 bplist.used_indexes = ptr_array_new(16);
854 854
855 if (!bplist.used_indexes) { 855 if (!bplist.used_indexes) {
856 PLIST_BIN_ERR("failed to create array to hold used node indexes. Out of memory?\n"); 856 PLIST_BIN_ERR("failed to create array to hold used node indexes. Out of memory?\n");
@@ -859,7 +859,7 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t *
859 859
860 *plist = parse_bin_node_at_index(&bplist, root_object); 860 *plist = parse_bin_node_at_index(&bplist, root_object);
861 861
862 plist_free(bplist.used_indexes); 862 ptr_array_free(bplist.used_indexes);
863} 863}
864 864
865static unsigned int plist_data_hash(const void* key) 865static unsigned int plist_data_hash(const void* key)