diff options
Diffstat (limited to 'xdelta3')
-rw-r--r-- | xdelta3/xdelta3-main.h | 20 | ||||
-rw-r--r-- | xdelta3/xdelta3-merge.h | 2 | ||||
-rw-r--r-- | xdelta3/xdelta3.c | 8 |
3 files changed, 25 insertions, 5 deletions
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h index 4a75ac1..acb0ac0 100644 --- a/xdelta3/xdelta3-main.h +++ b/xdelta3/xdelta3-main.h | |||
@@ -1694,10 +1694,11 @@ main_merge_arguments (main_merge_list* merges) | |||
1694 | { | 1694 | { |
1695 | xd3_stream tmp_stream; | 1695 | xd3_stream tmp_stream; |
1696 | memset (& tmp_stream, 0, sizeof (tmp_stream)); | 1696 | memset (& tmp_stream, 0, sizeof (tmp_stream)); |
1697 | ret = xd3_merge_inputs (& tmp_stream, | 1697 | if ((ret = xd3_config_stream (& tmp_stream, NULL)) || |
1698 | & merge_input.whole_target, | 1698 | (ret = xd3_whole_state_init (& tmp_stream)) || |
1699 | & recode_stream->whole_target); | 1699 | (ret = xd3_merge_inputs (& tmp_stream, |
1700 | if (ret != 0) | 1700 | & merge_input.whole_target, |
1701 | & recode_stream->whole_target))) | ||
1701 | { | 1702 | { |
1702 | XPR(NT XD3_LIB_ERRMSG (&tmp_stream, ret)); | 1703 | XPR(NT XD3_LIB_ERRMSG (&tmp_stream, ret)); |
1703 | } | 1704 | } |
@@ -1789,6 +1790,17 @@ main_merge_output (xd3_stream *stream, main_file *ofile) | |||
1789 | xoff_t output_pos = 0; | 1790 | xoff_t output_pos = 0; |
1790 | xd3_source recode_source; | 1791 | xd3_source recode_source; |
1791 | 1792 | ||
1793 | /* merge_stream is set if there were arguments. this stream's input | ||
1794 | * needs to be applied to the merge_stream source. */ | ||
1795 | if (merge_stream != NULL && | ||
1796 | (ret = xd3_merge_inputs (stream, | ||
1797 | & merge_stream->whole_target, | ||
1798 | & stream->whole_target))) | ||
1799 | { | ||
1800 | XPR(NT XD3_LIB_ERRMSG (stream, ret)); | ||
1801 | return ret; | ||
1802 | } | ||
1803 | |||
1792 | /* Enter the ENC_INPUT state and bypass the next_in == NULL test | 1804 | /* Enter the ENC_INPUT state and bypass the next_in == NULL test |
1793 | * and (leftover) input buffering logic. */ | 1805 | * and (leftover) input buffering logic. */ |
1794 | XD3_ASSERT(recode_stream->enc_state == ENC_INIT); | 1806 | XD3_ASSERT(recode_stream->enc_state == ENC_INIT); |
diff --git a/xdelta3/xdelta3-merge.h b/xdelta3/xdelta3-merge.h index 2c03bb3..2e54cb5 100644 --- a/xdelta3/xdelta3-merge.h +++ b/xdelta3/xdelta3-merge.h | |||
@@ -197,6 +197,8 @@ int xd3_merge_inputs (xd3_stream *stream, | |||
197 | xd3_whole_state *input) | 197 | xd3_whole_state *input) |
198 | { | 198 | { |
199 | DP(RINT "Merge inputs!\n"); | 199 | DP(RINT "Merge inputs!\n"); |
200 | |||
201 | xd3_swap_whole_state (&stream->whole_target, input); | ||
200 | 202 | ||
201 | return 0; | 203 | return 0; |
202 | } | 204 | } |
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c index 3a0c6e8..d08266e 100644 --- a/xdelta3/xdelta3.c +++ b/xdelta3/xdelta3.c | |||
@@ -3817,7 +3817,13 @@ xd3_encode_input (xd3_stream *stream) | |||
3817 | * or else it can get stuck in a match-backward | 3817 | * or else it can get stuck in a match-backward |
3818 | * (getsrcblk) then match-forward (getsrcblk), | 3818 | * (getsrcblk) then match-forward (getsrcblk), |
3819 | * find insufficient match length, then repeat | 3819 | * find insufficient match length, then repeat |
3820 | * exactly the same search. */ | 3820 | * exactly the same search. |
3821 | * | ||
3822 | * TODO: would be better to solve this be remebering | ||
3823 | * the previous address and avoiding long matches | ||
3824 | * in xd3_string_match(), since there could still be | ||
3825 | * a small match at ths position. Write a test | ||
3826 | * that reproduces the above scenario. */ | ||
3821 | if (stream->match_fwd != 0) { | 3827 | if (stream->match_fwd != 0) { |
3822 | stream->input_position += stream->match_fwd; | 3828 | stream->input_position += stream->match_fwd; |
3823 | } else { | 3829 | } else { |