Make cur_pos unsigned long in append()

Suppress a warning caused by comparing signed cur_pos to unsigned
main_header_size (warning only present on gcc 4.5 for some reason, not 4.9.1).