summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3-merge.h
diff options
context:
space:
mode:
authorjosh.macdonald <jmacd@users.noreply.github.com>2008-04-02 04:47:26 +0000
committerjosh.macdonald <jmacd@users.noreply.github.com>2008-04-02 04:47:26 +0000
commitc91bb844a7920a6d896c281da138c9b65476714f (patch)
treea35861c754459a12765d804f78fcceb7a524e23a /xdelta3/xdelta3-merge.h
parent0536aa91d51b43afd52d4cf08ac50baa28511ca1 (diff)
Merge command passes its first smoke test, reproduces a delta by
instruction-level rewriting of the input to the output. Hits an assertion due to target-copies that cross window boundaries--next step is to fix the output window size to the last input window size. This fixes an important bug in xd3_choose_instruction, which assumed that copy instructions were at least four bytes, but this is no longer the case for merged outputs (at least for the case where window size changes, which will not be allowed in future).
Diffstat (limited to 'xdelta3/xdelta3-merge.h')
-rw-r--r--xdelta3/xdelta3-merge.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/xdelta3/xdelta3-merge.h b/xdelta3/xdelta3-merge.h
index 217e3ec..7d32b22 100644
--- a/xdelta3/xdelta3-merge.h
+++ b/xdelta3/xdelta3-merge.h
@@ -93,7 +93,7 @@ xd3_whole_append_inst (xd3_stream *stream,
93 93
94 winst = &stream->whole_target_inst[stream->whole_target_instlen++]; 94 winst = &stream->whole_target_inst[stream->whole_target_instlen++];
95 winst->type = inst->type; 95 winst->type = inst->type;
96 winst->mode = SRCORTGT (stream->dec_win_ind); 96 winst->mode = 0;
97 winst->size = inst->size; 97 winst->size = inst->size;
98 98
99 switch (inst->type) 99 switch (inst->type)
@@ -114,7 +114,15 @@ xd3_whole_append_inst (xd3_stream *stream,
114 break; 114 break;
115 115
116 default: 116 default:
117 winst->addr = stream->dec_cpyoff + inst->addr; 117 if (inst->addr < stream->dec_cpylen)
118 {
119 winst->mode = SRCORTGT (stream->dec_win_ind);
120 winst->addr = stream->dec_cpyoff + inst->addr;
121 }
122 else
123 {
124 winst->addr = stream->total_out + inst->addr - stream->dec_cpylen;
125 }
118 break; 126 break;
119 } 127 }
120 128