summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3-decode.h
diff options
context:
space:
mode:
authorjosh.macdonald <jmacd@users.noreply.github.com>2007-09-13 09:59:55 +0000
committerjosh.macdonald <jmacd@users.noreply.github.com>2007-09-13 09:59:55 +0000
commit94fc679c61ca73182ba9d473a36253364f8f1967 (patch)
tree50db96ee01d0a73bd2809bb2fcd0401955180850 /xdelta3/xdelta3-decode.h
parentc453ed7952ef5ee3f7d799f8ed7ee113ee711e28 (diff)
Fix secondary compression for recode. Now able to reproduce doytchin's
bug report by recoding an FGK as a DJW.
Diffstat (limited to 'xdelta3/xdelta3-decode.h')
-rw-r--r--xdelta3/xdelta3-decode.h35
1 files changed, 22 insertions, 13 deletions
diff --git a/xdelta3/xdelta3-decode.h b/xdelta3/xdelta3-decode.h
index fd41675..0368cdc 100644
--- a/xdelta3/xdelta3-decode.h
+++ b/xdelta3/xdelta3-decode.h
@@ -495,6 +495,27 @@ xd3_decode_finish_window (xd3_stream *stream)
495} 495}
496 496
497static int 497static int
498xd3_decode_secondary_sections (xd3_stream *secondary_stream)
499{
500#if SECONDARY_ANY
501 int ret;
502#define DECODE_SECONDARY_SECTION(UPPER,LOWER) \
503 ((secondary_stream->dec_del_ind & VCD_ ## UPPER ## COMP) && \
504 (ret = xd3_decode_secondary (secondary_stream, & secondary_stream-> LOWER ## _sect, \
505 & xd3_sec_ ## LOWER (secondary_stream))))
506
507 if (DECODE_SECONDARY_SECTION (DATA, data) ||
508 DECODE_SECONDARY_SECTION (INST, inst) ||
509 DECODE_SECONDARY_SECTION (ADDR, addr))
510 {
511 return ret;
512 }
513#undef DECODE_SECONDARY_SECTION
514#endif
515 return 0;
516}
517
518static int
498xd3_decode_sections (xd3_stream *stream) 519xd3_decode_sections (xd3_stream *stream)
499{ 520{
500 usize_t need, more, take; 521 usize_t need, more, take;
@@ -557,19 +578,7 @@ xd3_decode_sections (xd3_stream *stream)
557 578
558 XD3_ASSERT (stream->dec_winbytes == need); 579 XD3_ASSERT (stream->dec_winbytes == need);
559 580
560#if SECONDARY_ANY 581 if ((ret = xd3_decode_secondary_sections (stream))) { return ret; }
561#define DECODE_SECONDARY_SECTION(UPPER,LOWER) \
562 ((stream->dec_del_ind & VCD_ ## UPPER ## COMP) && \
563 (ret = xd3_decode_secondary (stream, & stream-> LOWER ## _sect, \
564 & xd3_sec_ ## LOWER (stream))))
565
566 if (DECODE_SECONDARY_SECTION (DATA, data) ||
567 DECODE_SECONDARY_SECTION (INST, inst) ||
568 DECODE_SECONDARY_SECTION (ADDR, addr))
569 {
570 return ret;
571 }
572#endif
573 582
574 if (stream->flags & XD3_SKIP_EMIT) 583 if (stream->flags & XD3_SKIP_EMIT)
575 { 584 {