summaryrefslogtreecommitdiffstats
path: root/src/plist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plist.c')
-rw-r--r--src/plist.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/plist.c b/src/plist.c
index 81cdfc5..1fafd94 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -75,7 +75,7 @@ plist_t plist_new_array()
75plist_t plist_add_sub_element(plist_t node, plist_type type, void *value, uint64_t length) 75plist_t plist_add_sub_element(plist_t node, plist_type type, void *value, uint64_t length)
76{ 76{
77 //only structured types are allowed to have nulll value 77 //only structured types are allowed to have nulll value
78 if (!value && (type == PLIST_DICT || type == PLIST_ARRAY)) { 78 if (value || (!value && (type == PLIST_DICT || type == PLIST_ARRAY))) {
79 //now handle value 79 //now handle value
80 plist_data_t data = plist_new_plist_data(); 80 plist_data_t data = plist_new_plist_data();
81 data->type = type; 81 data->type = type;
@@ -91,6 +91,7 @@ plist_t plist_add_sub_element(plist_t node, plist_type type, void *value, uint64
91 case PLIST_REAL: 91 case PLIST_REAL:
92 data->realval = *((double *) value); 92 data->realval = *((double *) value);
93 break; 93 break;
94 case PLIST_KEY:
94 case PLIST_STRING: 95 case PLIST_STRING:
95 data->strval = strdup((char *) value); 96 data->strval = strdup((char *) value);
96 break; 97 break;
@@ -209,15 +210,13 @@ void plist_get_type_and_value(plist_t node, plist_type * type, void *value, uint
209 case PLIST_REAL: 210 case PLIST_REAL:
210 *((double *) value) = data->realval; 211 *((double *) value) = data->realval;
211 break; 212 break;
213 case PLIST_KEY:
212 case PLIST_STRING: 214 case PLIST_STRING:
213 *((char **) value) = strdup(data->strval); 215 *((char **) value) = strdup(data->strval);
214 break; 216 break;
215 case PLIST_UNICODE: 217 case PLIST_UNICODE:
216 *((wchar_t **) value) = wcsdup(data->unicodeval); 218 *((wchar_t **) value) = wcsdup(data->unicodeval);
217 break; 219 break;
218 case PLIST_KEY:
219 *((char **) value) = strdup(data->strval);
220 break;
221 case PLIST_DATA: 220 case PLIST_DATA:
222 case PLIST_ARRAY: 221 case PLIST_ARRAY:
223 case PLIST_DICT: 222 case PLIST_DICT: