diff options
Diffstat (limited to 'src/plist.c')
| -rw-r--r-- | src/plist.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plist.c b/src/plist.c index 66a74c3..932ea5e 100644 --- a/src/plist.c +++ b/src/plist.c | |||
| @@ -67,7 +67,7 @@ void plist_new_dict_in_plist(plist_t plist, plist_t * dict) | |||
| 67 | * @param value a pointer to the actual buffer containing the value. WARNING : the buffer is supposed to match the type of the value | 67 | * @param value a pointer to the actual buffer containing the value. WARNING : the buffer is supposed to match the type of the value |
| 68 | * | 68 | * |
| 69 | */ | 69 | */ |
| 70 | void plist_add_dict_element(plist_t dict, char *key, plist_type type, void *value) | 70 | void plist_add_dict_element(plist_t dict, char *key, plist_type type, void *value, uint64_t length) |
| 71 | { | 71 | { |
| 72 | if (!dict || !key || !value) | 72 | if (!dict || !key || !value) |
| 73 | return; | 73 | return; |
| @@ -81,6 +81,7 @@ void plist_add_dict_element(plist_t dict, char *key, plist_type type, void *valu | |||
| 81 | //now handle value | 81 | //now handle value |
| 82 | struct plist_data *val = (struct plist_data *) calloc(sizeof(struct plist_data), 1); | 82 | struct plist_data *val = (struct plist_data *) calloc(sizeof(struct plist_data), 1); |
| 83 | val->type = type; | 83 | val->type = type; |
| 84 | val->length = length; | ||
| 84 | 85 | ||
| 85 | switch (type) { | 86 | switch (type) { |
| 86 | case PLIST_BOOLEAN: | 87 | case PLIST_BOOLEAN: |
| @@ -99,7 +100,7 @@ void plist_add_dict_element(plist_t dict, char *key, plist_type type, void *valu | |||
| 99 | val->unicodeval = wcsdup((wchar_t *) value); | 100 | val->unicodeval = wcsdup((wchar_t *) value); |
| 100 | break; | 101 | break; |
| 101 | case PLIST_DATA: | 102 | case PLIST_DATA: |
| 102 | val->buff = strdup((char *) value); | 103 | memcpy(val->buff, value, length); |
| 103 | break; | 104 | break; |
| 104 | case PLIST_ARRAY: | 105 | case PLIST_ARRAY: |
| 105 | case PLIST_DICT: | 106 | case PLIST_DICT: |
| @@ -195,7 +196,7 @@ plist_t find_node(plist_t plist, plist_type type, void *value) | |||
| 195 | return NULL; | 196 | return NULL; |
| 196 | } | 197 | } |
| 197 | 198 | ||
| 198 | void get_type_and_value(GNode * node, plist_type * type, void *value) | 199 | void get_type_and_value(GNode * node, plist_type * type, void *value, uint64_t * length) |
| 199 | { | 200 | { |
| 200 | if (!node) | 201 | if (!node) |
| 201 | return; | 202 | return; |
| @@ -203,6 +204,7 @@ void get_type_and_value(GNode * node, plist_type * type, void *value) | |||
| 203 | struct plist_data *data = (struct plist_data *) node->data; | 204 | struct plist_data *data = (struct plist_data *) node->data; |
| 204 | 205 | ||
| 205 | *type = data->type; | 206 | *type = data->type; |
| 207 | *length = data->length; | ||
| 206 | 208 | ||
| 207 | switch (*type) { | 209 | switch (*type) { |
| 208 | case PLIST_BOOLEAN: | 210 | case PLIST_BOOLEAN: |
