summaryrefslogtreecommitdiffstats
path: root/src/plist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plist.c')
-rw-r--r--src/plist.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/plist.c b/src/plist.c
index b723517..5ef3144 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -264,24 +264,33 @@ void plist_dict_new_iter(plist_t node, plist_dict_iter *iter)
264{ 264{
265 if (iter && *iter == NULL) { 265 if (iter && *iter == NULL) {
266 *iter = malloc(sizeof(uint32_t)); 266 *iter = malloc(sizeof(uint32_t));
267 *(uint32_t*)*iter = 0; 267 *((uint32_t*)(*iter)) = 0;
268 } 268 }
269 return; 269 return;
270} 270}
271 271
272void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val) 272void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val)
273{ 273{
274 if (node && PLIST_DICT == plist_get_node_type(node) && *(uint32_t*)iter < g_node_n_children(node) / 2) { 274 uint32_t* iter_int = (uint32_t*) iter;
275
276 if (key) {
277 *key = NULL;
278 }
279 if (val) {
280 *val = NULL;
281 }
282
283 if (node && PLIST_DICT == plist_get_node_type(node) && *iter_int < g_node_n_children(node)) {
275 284
276 if (key) { 285 if (key) {
277 plist_get_key_val((plist_t)g_node_nth_child(node, 2 * (*(uint32_t*)iter)), key); 286 plist_get_key_val((plist_t)g_node_nth_child(node, *iter_int), key);
278 } 287 }
279 288
280 if (val) { 289 if (val) {
281 *val = (plist_t) g_node_nth_child(node, 2 * (*(uint32_t*)iter) + 1); 290 *val = (plist_t) g_node_nth_child(node, *iter_int + 1);
282 } 291 }
283 292
284 *(uint32_t*)iter += 2; 293 *iter_int += 2;
285 } 294 }
286 return; 295 return;
287} 296}