summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-01-08 23:44:30 +0100
committerGravatar Jonathan Beck2009-01-08 23:44:30 +0100
commited5f0b7154a5f653c240e6962098ae7b28ab61e5 (patch)
tree0e268239ebb9edf0996596b0262dac95940f91dd
parente0b6a20b79e1a438125c72a3335713af01619ea9 (diff)
downloadlibplist-ed5f0b7154a5f653c240e6962098ae7b28ab61e5.tar.gz
libplist-ed5f0b7154a5f653c240e6962098ae7b28ab61e5.tar.bz2
fix offset writing and add experimental padding to mimic Apple files.
-rw-r--r--src/bplist.c6
1 files changed, 5 insertions, 1 deletions
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)
808 //write offsets 808 //write offsets
809 offset_size = get_needed_bytes(bplist_buff->len); 809 offset_size = get_needed_bytes(bplist_buff->len);
810 offset_table_index = bplist_buff->len; 810 offset_table_index = bplist_buff->len;
811 for (i = 0; i <= num_objects; i++) { 811 for (i = 0; i < num_objects; i++) {
812 uint8_t *offsetbuff = (uint8_t *) malloc(offset_size); 812 uint8_t *offsetbuff = (uint8_t *) malloc(offset_size);
813 memcpy(offsetbuff, offsets + i, offset_size); 813 memcpy(offsetbuff, offsets + i, offset_size);
814 byte_convert(offsetbuff, offset_size); 814 byte_convert(offsetbuff, offset_size);
@@ -816,6 +816,10 @@ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
816 free(offsetbuff); 816 free(offsetbuff);
817 } 817 }
818 818
819 //experimental pad to reflect apple's files
820 uint8_t pad[6] = {0, 0, 0, 0, 0, 0};
821 g_byte_array_append(bplist_buff, pad, 6);
822
819 //setup trailer 823 //setup trailer
820 num_objects = GUINT64_FROM_BE(num_objects); 824 num_objects = GUINT64_FROM_BE(num_objects);
821 root_object = GUINT64_FROM_BE(root_object); 825 root_object = GUINT64_FROM_BE(root_object);