From ed5f0b7154a5f653c240e6962098ae7b28ab61e5 Mon Sep 17 00:00:00 2001 From: Jonathan Beck Date: Thu, 8 Jan 2009 23:44:30 +0100 Subject: fix offset writing and add experimental padding to mimic Apple files. --- src/bplist.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/bplist.c') diff --git a/src/bplist.c b/src/bplist.c index 746c13e..fd0280c 100644 --- a/src/bplist.c +++ b/src/bplist.c @@ -808,7 +808,7 @@ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length) //write offsets offset_size = get_needed_bytes(bplist_buff->len); offset_table_index = bplist_buff->len; - for (i = 0; i <= num_objects; i++) { + for (i = 0; i < num_objects; i++) { uint8_t *offsetbuff = (uint8_t *) malloc(offset_size); memcpy(offsetbuff, offsets + i, offset_size); byte_convert(offsetbuff, offset_size); @@ -816,6 +816,10 @@ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length) free(offsetbuff); } + //experimental pad to reflect apple's files + uint8_t pad[6] = {0, 0, 0, 0, 0, 0}; + g_byte_array_append(bplist_buff, pad, 6); + //setup trailer num_objects = GUINT64_FROM_BE(num_objects); root_object = GUINT64_FROM_BE(root_object); -- cgit v1.1-32-gdbae