From 3d8ba053deeacd74e621469d3d45d1db38ee411a Mon Sep 17 00:00:00 2001 From: Jonathan Beck Date: Fri, 12 Dec 2008 23:39:33 +0100 Subject: Change from Base64 encoded buffers to real buffers. Base64 decoding/encoding only happens in xml plists. --- src/plist.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/plist.c') 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) * @param value a pointer to the actual buffer containing the value. WARNING : the buffer is supposed to match the type of the value * */ -void plist_add_dict_element(plist_t dict, char *key, plist_type type, void *value) +void plist_add_dict_element(plist_t dict, char *key, plist_type type, void *value, uint64_t length) { if (!dict || !key || !value) return; @@ -81,6 +81,7 @@ void plist_add_dict_element(plist_t dict, char *key, plist_type type, void *valu //now handle value struct plist_data *val = (struct plist_data *) calloc(sizeof(struct plist_data), 1); val->type = type; + val->length = length; switch (type) { case PLIST_BOOLEAN: @@ -99,7 +100,7 @@ void plist_add_dict_element(plist_t dict, char *key, plist_type type, void *valu val->unicodeval = wcsdup((wchar_t *) value); break; case PLIST_DATA: - val->buff = strdup((char *) value); + memcpy(val->buff, value, length); break; case PLIST_ARRAY: case PLIST_DICT: @@ -195,7 +196,7 @@ plist_t find_node(plist_t plist, plist_type type, void *value) return NULL; } -void get_type_and_value(GNode * node, plist_type * type, void *value) +void get_type_and_value(GNode * node, plist_type * type, void *value, uint64_t * length) { if (!node) return; @@ -203,6 +204,7 @@ void get_type_and_value(GNode * node, plist_type * type, void *value) struct plist_data *data = (struct plist_data *) node->data; *type = data->type; + *length = data->length; switch (*type) { case PLIST_BOOLEAN: -- cgit v1.1-32-gdbae