summaryrefslogtreecommitdiffstats
path: root/src/plist.c
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-02-09 20:39:14 +0100
committerGravatar Jonathan Beck2009-02-09 21:02:56 +0100
commitfa4a22dde897c0e2a8cc89b7479f0513c9455d37 (patch)
tree877b0140a133fb34c821ff70bde1a4a8c6ef5ab1 /src/plist.c
parentff1fa73f33e9223e69cbb71e70b084e3482dce3f (diff)
downloadlibplist-fa4a22dde897c0e2a8cc89b7479f0513c9455d37.tar.gz
libplist-fa4a22dde897c0e2a8cc89b7479f0513c9455d37.tar.bz2
Make it compile on MSVC 2005.
Diffstat (limited to 'src/plist.c')
-rw-r--r--src/plist.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/plist.c b/src/plist.c
index 758fe53..87a1de5 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -77,15 +77,17 @@ static plist_t plist_add_sub_element(plist_t node, plist_type type, const void *
77 if (node_type == PLIST_DICT || node_type == PLIST_ARRAY) { 77 if (node_type == PLIST_DICT || node_type == PLIST_ARRAY) {
78 //only structured types are allowed to have nulll value 78 //only structured types are allowed to have nulll value
79 if (value || (!value && (type == PLIST_DICT || type == PLIST_ARRAY))) { 79 if (value || (!value && (type == PLIST_DICT || type == PLIST_ARRAY))) {
80 //now handle value
81 plist_data_t data = plist_new_plist_data();
82 data->type = type;
83 data->length = length;
84 80
85 glong len = 0; 81 glong len = 0;
86 glong items_read = 0; 82 glong items_read = 0;
87 glong items_written = 0; 83 glong items_written = 0;
88 GError *error = NULL; 84 GError *error = NULL;
85 plist_t subnode = NULL;
86
87 //now handle value
88 plist_data_t data = plist_new_plist_data();
89 data->type = type;
90 data->length = length;
89 91
90 switch (type) { 92 switch (type) {
91 case PLIST_BOOLEAN: 93 case PLIST_BOOLEAN:
@@ -119,7 +121,7 @@ static plist_t plist_add_sub_element(plist_t node, plist_type type, const void *
119 break; 121 break;
120 } 122 }
121 123
122 plist_t subnode = plist_new_node(data); 124 subnode = plist_new_node(data);
123 if (node) 125 if (node)
124 g_node_append(node, subnode); 126 g_node_append(node, subnode);
125 return subnode; 127 return subnode;
@@ -185,10 +187,11 @@ static char compare_node_value(plist_type type, plist_data_t data, const void *v
185 187
186static plist_t plist_find_node(plist_t plist, plist_type type, const void *value, uint64_t length) 188static plist_t plist_find_node(plist_t plist, plist_type type, const void *value, uint64_t length)
187{ 189{
190 plist_t current = NULL;
191
188 if (!plist) 192 if (!plist)
189 return NULL; 193 return NULL;
190 194
191 plist_t current = NULL;
192 for (current = plist_get_first_child(plist); current; current = plist_get_next_sibling(current)) { 195 for (current = plist_get_first_child(plist); current; current = plist_get_next_sibling(current)) {
193 196
194 plist_data_t data = plist_get_data(current); 197 plist_data_t data = plist_get_data(current);
@@ -217,16 +220,17 @@ plist_t plist_find_node_by_string(plist_t plist, const char *value)
217 220
218static void plist_get_type_and_value(plist_t node, plist_type * type, void *value, uint64_t * length) 221static void plist_get_type_and_value(plist_t node, plist_type * type, void *value, uint64_t * length)
219{ 222{
220 if (!node)
221 return;
222
223 //for unicode 223 //for unicode
224 glong len = 0; 224 glong len = 0;
225 glong items_read = 0; 225 glong items_read = 0;
226 glong items_written = 0; 226 glong items_written = 0;
227 GError *error = NULL; 227 GError *error = NULL;
228 plist_data_t data = NULL;
229
230 if (!node)
231 return;
228 232
229 plist_data_t data = plist_get_data(node); 233 data = plist_get_data(node);
230 234
231 *type = data->type; 235 *type = data->type;
232 *length = data->length; 236 *length = data->length;