summaryrefslogtreecommitdiffstats
path: root/src/plist.c
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-10-28 17:57:52 +0100
committerGravatar Jonathan Beck2009-10-28 17:57:52 +0100
commit1bc333972bb5d5b45ba8908f1b12015300d88711 (patch)
treed061424c0ba0390259ae092df68c9c7462e16315 /src/plist.c
parenta129688a888968286a30eeba7833629225c59fa0 (diff)
downloadlibplist-1bc333972bb5d5b45ba8908f1b12015300d88711.tar.gz
libplist-1bc333972bb5d5b45ba8908f1b12015300d88711.tar.bz2
Fix build for MSVC9.
Diffstat (limited to 'src/plist.c')
-rw-r--r--src/plist.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/plist.c b/src/plist.c
index 95b9593..30be007 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -64,8 +64,9 @@ static void plist_free_data(plist_data_t data)
64 64
65static void plist_free_node(GNode * node, gpointer none) 65static void plist_free_node(GNode * node, gpointer none)
66{ 66{
67 plist_data_t data = NULL;
67 g_node_unlink(node); 68 g_node_unlink(node);
68 plist_data_t data = plist_get_data(node); 69 data = plist_get_data(node);
69 plist_free_data(data); 70 plist_free_data(data);
70 node->data = NULL; 71 node->data = NULL;
71 g_node_children_foreach(node, G_TRAVERSE_ALL, plist_free_node, NULL); 72 g_node_children_foreach(node, G_TRAVERSE_ALL, plist_free_node, NULL);
@@ -161,6 +162,7 @@ void plist_free(plist_t plist)
161 162
162static void plist_copy_node(GNode * node, gpointer parent_node_ptr) 163static void plist_copy_node(GNode * node, gpointer parent_node_ptr)
163{ 164{
165 plist_type node_type = PLIST_NONE;
164 plist_t newnode = NULL; 166 plist_t newnode = NULL;
165 plist_data_t data = plist_get_data(node); 167 plist_data_t data = plist_get_data(node);
166 plist_data_t newdata = plist_new_plist_data(); 168 plist_data_t newdata = plist_new_plist_data();
@@ -169,7 +171,7 @@ static void plist_copy_node(GNode * node, gpointer parent_node_ptr)
169 171
170 memcpy(newdata, data, sizeof(struct plist_data_s)); 172 memcpy(newdata, data, sizeof(struct plist_data_s));
171 173
172 plist_type node_type = plist_get_node_type(node); 174 node_type = plist_get_node_type(node);
173 if (node_type == PLIST_DATA || node_type == PLIST_STRING || node_type == PLIST_KEY) { 175 if (node_type == PLIST_DATA || node_type == PLIST_STRING || node_type == PLIST_KEY) {
174 switch (node_type) { 176 switch (node_type) {
175 case PLIST_DATA: 177 case PLIST_DATA:
@@ -225,6 +227,7 @@ uint32_t plist_array_get_item_index(plist_t node)
225 if (PLIST_ARRAY == plist_get_node_type(father)) { 227 if (PLIST_ARRAY == plist_get_node_type(father)) {
226 return g_node_child_position(father, node); 228 return g_node_child_position(father, node);
227 } 229 }
230 return 0;
228} 231}
229 232
230void plist_array_set_item(plist_t node, plist_t item, uint32_t n) 233void plist_array_set_item(plist_t node, plist_t item, uint32_t n)
@@ -330,8 +333,8 @@ plist_t plist_dict_get_item(plist_t node, const char* key)
330 current; 333 current;
331 current = (plist_t)g_node_next_sibling(g_node_next_sibling(current))) { 334 current = (plist_t)g_node_next_sibling(g_node_next_sibling(current))) {
332 335
333 assert( PLIST_KEY == plist_get_node_type(current) );
334 plist_data_t data = plist_get_data(current); 336 plist_data_t data = plist_get_data(current);
337 assert( PLIST_KEY == plist_get_node_type(current) );
335 338
336 if (data && !strcmp(key, data->strval)) { 339 if (data && !strcmp(key, data->strval)) {
337 ret = (plist_t)g_node_next_sibling(current); 340 ret = (plist_t)g_node_next_sibling(current);
@@ -623,7 +626,7 @@ char plist_compare_node_value(plist_t node_l, plist_t node_r)
623 return plist_data_compare(node_l, node_r); 626 return plist_data_compare(node_l, node_r);
624} 627}
625 628
626static plist_t plist_set_element_val(plist_t node, plist_type type, const void *value, uint64_t length) 629static void plist_set_element_val(plist_t node, plist_type type, const void *value, uint64_t length)
627{ 630{
628 //free previous allocated buffer 631 //free previous allocated buffer
629 plist_data_t data = plist_get_data(node); 632 plist_data_t data = plist_get_data(node);