summaryrefslogtreecommitdiffstats
path: root/src/plist.c
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2008-12-12 23:39:33 +0100
committerGravatar Jonathan Beck2008-12-12 23:39:33 +0100
commit3d8ba053deeacd74e621469d3d45d1db38ee411a (patch)
tree9c2010c9da179f96d55988f19c861301a68e5eb4 /src/plist.c
parent9ca887308d59e6cb5bf684f9f3bd968118e8014f (diff)
downloadlibimobiledevice-3d8ba053deeacd74e621469d3d45d1db38ee411a.tar.gz
libimobiledevice-3d8ba053deeacd74e621469d3d45d1db38ee411a.tar.bz2
Change from Base64 encoded buffers to real buffers. Base64 decoding/encoding only happens in xml plists.
Diffstat (limited to 'src/plist.c')
-rw-r--r--src/plist.c8
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)
* @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: