Commit ed5f0b71 authored by Jonathan Beck's avatar Jonathan Beck

fix offset writing and add experimental padding to mimic Apple files.

parent e0b6a20b
...@@ -808,7 +808,7 @@ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length) ...@@ -808,7 +808,7 @@ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
//write offsets //write offsets
offset_size = get_needed_bytes(bplist_buff->len); offset_size = get_needed_bytes(bplist_buff->len);
offset_table_index = 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); uint8_t *offsetbuff = (uint8_t *) malloc(offset_size);
memcpy(offsetbuff, offsets + i, offset_size); memcpy(offsetbuff, offsets + i, offset_size);
byte_convert(offsetbuff, offset_size); byte_convert(offsetbuff, offset_size);
...@@ -816,6 +816,10 @@ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length) ...@@ -816,6 +816,10 @@ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
free(offsetbuff); 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 //setup trailer
num_objects = GUINT64_FROM_BE(num_objects); num_objects = GUINT64_FROM_BE(num_objects);
root_object = GUINT64_FROM_BE(root_object); root_object = GUINT64_FROM_BE(root_object);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment