summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3-main.h
diff options
context:
space:
mode:
authordotdotisdead <dotdotisdead@a3eca27d-f21b-0410-9b4a-6511e771f64e>2006-09-24 02:46:46 +0000
committerdotdotisdead <dotdotisdead@a3eca27d-f21b-0410-9b4a-6511e771f64e>2006-09-24 02:46:46 +0000
commit23ded1901e47c21fb0a66ea846898bb450e4f205 (patch)
tree403b54cf7cc61c363c37c86a7980e3bf66a597a4 /xdelta3/xdelta3-main.h
parent88dc5e73a9d7ecacb9296a97624348bd98cf539e (diff)
Fix a bug in xd3_source_extend_match, causing stream->input_position to
move backward when a large-cksum collision causes a short match in lazy mode, where there was a small match_back. Reproduce w/ testcases/7.
Diffstat (limited to 'xdelta3/xdelta3-main.h')
-rwxr-xr-xxdelta3/xdelta3-main.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h
index 7915ff4..4af4b87 100755
--- a/xdelta3/xdelta3-main.h
+++ b/xdelta3/xdelta3-main.h
@@ -317,7 +317,8 @@ static main_extcomp extcomp_types[] =
317 { "compress", "-cf", "uncompress", "-cf", "Z", "\037\235", 2, 0 }, 317 { "compress", "-cf", "uncompress", "-cf", "Z", "\037\235", 2, 0 },
318}; 318};
319 319
320static void main_get_appheader (xd3_stream *stream, main_file *output, main_file *sfile); 320static void main_get_appheader (xd3_stream *stream, main_file *ifile,
321 main_file *output, main_file *sfile);
321 322
322static int main_help (void); 323static int main_help (void);
323 324
@@ -925,19 +926,23 @@ main_print_func (xd3_stream* stream, main_file *xfile)
925 if (ret == 0 && appheadsz > 0) 926 if (ret == 0 && appheadsz > 0)
926 { 927 {
927 int sq = option_quiet; 928 int sq = option_quiet;
928 main_file o, s; 929 main_file i, o, s;
929 XD3_ASSERT (apphead != NULL); 930 XD3_ASSERT (apphead != NULL);
930 VC(OUT "VCDIFF application header: "); 931 VC(OUT "VCDIFF application header: ");
931 fwrite (apphead, 1, appheadsz, vcout); 932 fwrite (apphead, 1, appheadsz, vcout);
932 VC(OUT "\n"); 933 VC(OUT "\n");
933 934
935 main_file_init (& i);
934 main_file_init (& o); 936 main_file_init (& o);
935 main_file_init (& s); 937 main_file_init (& s);
936 option_quiet = 1; 938 option_quiet = 1;
937 main_get_appheader (stream, & o, & s); 939 main_get_appheader (stream, &i, & o, & s);
938 option_quiet = sq; 940 option_quiet = sq;
939 main_print_vcdiff_file (& o, "output", vcout); 941 main_print_vcdiff_file (& o, "output", vcout);
940 main_print_vcdiff_file (& s, "source", vcout); 942 main_print_vcdiff_file (& s, "source", vcout);
943 main_file_cleanup (& i);
944 main_file_cleanup (& o);
945 main_file_cleanup (& s);
941 } 946 }
942 } 947 }
943 } 948 }
@@ -1653,7 +1658,7 @@ main_get_appheader_params (main_file *file, char **parsed, int output, const cha
1653} 1658}
1654 1659
1655static void 1660static void
1656main_get_appheader (xd3_stream *stream, main_file *output, main_file *sfile) 1661main_get_appheader (xd3_stream *stream, main_file *ifile, main_file *output, main_file *sfile)
1657{ 1662{
1658 uint8_t *apphead; 1663 uint8_t *apphead;
1659 usize_t appheadsz; 1664 usize_t appheadsz;
@@ -1689,13 +1694,13 @@ main_get_appheader (xd3_stream *stream, main_file *output, main_file *sfile)
1689 /* First take the output parameters. */ 1694 /* First take the output parameters. */
1690 if (place == 2 || place == 4) 1695 if (place == 2 || place == 4)
1691 { 1696 {
1692 main_get_appheader_params (output, parsed, 1, "output", sfile); 1697 main_get_appheader_params (output, parsed, 1, "output", ifile);
1693 } 1698 }
1694 1699
1695 /* Then take the source parameters. */ 1700 /* Then take the source parameters. */
1696 if (place == 4) 1701 if (place == 4)
1697 { 1702 {
1698 main_get_appheader_params (sfile, parsed+2, 0, "source", output); 1703 main_get_appheader_params (sfile, parsed+2, 0, "source", ifile);
1699 } 1704 }
1700 } 1705 }
1701 1706
@@ -2324,7 +2329,7 @@ main_input (xd3_cmd cmd,
2324 int recv_src; 2329 int recv_src;
2325 2330
2326 /* May need to set the sfile->filename if none was given. */ 2331 /* May need to set the sfile->filename if none was given. */
2327 main_get_appheader (& stream, ofile, sfile); 2332 main_get_appheader (& stream, ifile, ofile, sfile);
2328 2333
2329 recv_src = sfile->filename != NULL; 2334 recv_src = sfile->filename != NULL;
2330 2335