From 09fd0933d3024b0bde4f20c2955db5cb831aab13 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Tue, 12 May 2015 23:31:23 +0200 Subject: Convert continuation flags in our standard representation --- src/export/split_version_2.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/export/split_version_2.c b/src/export/split_version_2.c index 3ed1bbd..e886454 100644 --- a/src/export/split_version_2.c +++ b/src/export/split_version_2.c @@ -111,8 +111,13 @@ static uint16_t load_word( uint8_t *table_start, uint16_t base, int offset ) { } static void dump_primary( uint8_t *end, uint32_t flags ) { - /* First dump type of record (should be 1) */ - dump_string( end, 1, 0 ); + /* First dump type of record (should be 1) + dump_string( end, 1, 0 ); + actually the entry is dumped in the caller when we know + if this is the first line of a continuation. + Here we just skip the byte: + */ + --end; /* Dump first 5 chars of zip, they're always there */ dump_string( end -= 5, 5, 1 ); @@ -168,13 +173,16 @@ static void act_on_record( uint8_t * end, uint16_t base ) { uint16_t t_off = load_word( e, base, 2*i+1 ); uint8_t *rec_start = end - t_off; - if (i == 0) + if (i == 0) { + dump_string( num_dwords > 1 ? (uint8_t*)"01" : (uint8_t*)"00", 2, 0 ); dump_primary( rec_start, flags ); - else { + } else { uint8_t * rec_end = end - ( ( i+1 == num_dwords ) ? 0 : load_word( e, base, 2*i+3 ) ); int file = g_outfilemap[g_cd][subflag&0x1F]; - if( subflag == 0x4003 ) finish_record(); - if( file >= 0 ) + if( subflag == 0x4003 ) { + finish_record(); + dump_string( (uint8_t*)"02", 2, 0 ); + } else if( file >= 0 ) dump_string( rec_start, rec_end - rec_start, g_outfilemap[g_cd][subflag&0x1F] ); } } -- cgit v1.2.3