summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2015-05-12 23:31:23 +0200
committerDirk Engling <erdgeist@erdgeist.org>2015-05-12 23:31:23 +0200
commit09fd0933d3024b0bde4f20c2955db5cb831aab13 (patch)
tree0268b1ac6a7314602933b39dbd2072abb3ea5395
parentaef71733e0912bc9ffd9df80c75378c11c70a361 (diff)
Convert continuation flags in our standard representation
-rw-r--r--src/export/split_version_2.c20
1 files changed, 14 insertions, 6 deletions
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 ) {
111} 111}
112 112
113static void dump_primary( uint8_t *end, uint32_t flags ) { 113static void dump_primary( uint8_t *end, uint32_t flags ) {
114 /* First dump type of record (should be 1) */ 114 /* First dump type of record (should be 1)
115 dump_string( end, 1, 0 ); 115 dump_string( end, 1, 0 );
116 actually the entry is dumped in the caller when we know
117 if this is the first line of a continuation.
118 Here we just skip the byte:
119 */
120 --end;
116 121
117 /* Dump first 5 chars of zip, they're always there */ 122 /* Dump first 5 chars of zip, they're always there */
118 dump_string( end -= 5, 5, 1 ); 123 dump_string( end -= 5, 5, 1 );
@@ -168,13 +173,16 @@ static void act_on_record( uint8_t * end, uint16_t base ) {
168 uint16_t t_off = load_word( e, base, 2*i+1 ); 173 uint16_t t_off = load_word( e, base, 2*i+1 );
169 uint8_t *rec_start = end - t_off; 174 uint8_t *rec_start = end - t_off;
170 175
171 if (i == 0) 176 if (i == 0) {
177 dump_string( num_dwords > 1 ? (uint8_t*)"01" : (uint8_t*)"00", 2, 0 );
172 dump_primary( rec_start, flags ); 178 dump_primary( rec_start, flags );
173 else { 179 } else {
174 uint8_t * rec_end = end - ( ( i+1 == num_dwords ) ? 0 : load_word( e, base, 2*i+3 ) ); 180 uint8_t * rec_end = end - ( ( i+1 == num_dwords ) ? 0 : load_word( e, base, 2*i+3 ) );
175 int file = g_outfilemap[g_cd][subflag&0x1F]; 181 int file = g_outfilemap[g_cd][subflag&0x1F];
176 if( subflag == 0x4003 ) finish_record(); 182 if( subflag == 0x4003 ) {
177 if( file >= 0 ) 183 finish_record();
184 dump_string( (uint8_t*)"02", 2, 0 );
185 } else if( file >= 0 )
178 dump_string( rec_start, rec_end - rec_start, g_outfilemap[g_cd][subflag&0x1F] ); 186 dump_string( rec_start, rec_end - rec_start, g_outfilemap[g_cd][subflag&0x1F] );
179 } 187 }
180 } 188 }