summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjosh.macdonald <jmacd@users.noreply.github.com>2007-01-29 04:56:38 +0000
committerjosh.macdonald <jmacd@users.noreply.github.com>2007-01-29 04:56:38 +0000
commitae118dad4f77c07dc2673e6877d5fdb4098ba727 (patch)
tree8b380a4243d77b28c23fe47548772a130301ea5c
parent19ab311b65d55c748672a5d1d914f2af83c27956 (diff)
Change _completely() to _completely_stream(), to introduce a new,
simpler in-memory API.
-rwxr-xr-xxdelta3/linkxd3lib.c4
-rwxr-xr-xxdelta3/xdelta3-main.h4
-rwxr-xr-xxdelta3/xdelta3-test.h12
-rwxr-xr-xxdelta3/xdelta3.c14
-rwxr-xr-xxdelta3/xdelta3.h31
-rwxr-xr-xxdelta3/xdelta3.prj63
6 files changed, 65 insertions, 63 deletions
diff --git a/xdelta3/linkxd3lib.c b/xdelta3/linkxd3lib.c
index d605fa6..feed876 100755
--- a/xdelta3/linkxd3lib.c
+++ b/xdelta3/linkxd3lib.c
@@ -27,7 +27,7 @@ int main() {
27 use (xd3_set_source (& stream, & source)); 27 use (xd3_set_source (& stream, & source));
28 xd3_set_flags (& stream, 0); 28 xd3_set_flags (& stream, 0);
29 29
30 use (xd3_decode_completely (& stream, NULL, 0, NULL, NULL, 0)); 30 use (xd3_decode_completely_stream (& stream, NULL, 0, NULL, NULL, 0));
31 use (xd3_decode_input (&stream)); 31 use (xd3_decode_input (&stream));
32 use (xd3_decoder_needs_source (& stream)); 32 use (xd3_decoder_needs_source (& stream));
33 use (xd3_get_appheader (& stream, NULL, NULL)); 33 use (xd3_get_appheader (& stream, NULL, NULL));
@@ -37,7 +37,7 @@ int main() {
37 37
38#if XD3_ENCODER 38#if XD3_ENCODER
39 use (xd3_encode_input (&stream)); 39 use (xd3_encode_input (&stream));
40 use (xd3_encode_completely (& stream, NULL, 0, NULL, NULL, 0)); 40 use (xd3_encode_completely_stream (& stream, NULL, 0, NULL, NULL, 0));
41 use (xd3_set_appheader (& stream)); 41 use (xd3_set_appheader (& stream));
42 use (xd3_encoder_used_source (& stream)); 42 use (xd3_encoder_used_source (& stream));
43 use (xd3_encoder_srcbase (& stream)); 43 use (xd3_encoder_srcbase (& stream));
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h
index f49868f..b18e919 100755
--- a/xdelta3/xdelta3-main.h
+++ b/xdelta3/xdelta3-main.h
@@ -257,7 +257,7 @@ static int option_no_compress = 0;
257static int option_no_output = 0; /* go through the motions, but do not open or write output */ 257static int option_no_output = 0; /* go through the motions, but do not open or write output */
258static const char *option_source_filename = NULL; 258static const char *option_source_filename = NULL;
259 259
260static int option_iopt_size = XD3_DEFAULT_IOPT_SIZE; 260static usize_t option_iopt_size = XD3_DEFAULT_IOPT_SIZE;
261static usize_t option_winsize = XD3_DEFAULT_WINSIZE; 261static usize_t option_winsize = XD3_DEFAULT_WINSIZE;
262static usize_t option_srcwinsz = XD3_DEFAULT_SRCWINSZ; 262static usize_t option_srcwinsz = XD3_DEFAULT_SRCWINSZ;
263static int option_srcwinsz_set = 0; 263static int option_srcwinsz_set = 0;
@@ -303,7 +303,7 @@ static int allow_fake_source = 0;
303 * the program knows the mapping of IDENT->NAME. */ 303 * the program knows the mapping of IDENT->NAME. */
304static main_extcomp extcomp_types[] = 304static main_extcomp extcomp_types[] =
305{ 305{
306 /* The entry for xdelta3/1 must be 0/1 because the program_names are set there. */ 306 /* The entry for xdelta3 must be 0 because the program_name is set there. */
307 { "xdelta3", "-cfq", "xdelta3", "-dcfq", "X", "\xd6\xc3\xc4", 3, RD_NONEXTERNAL }, 307 { "xdelta3", "-cfq", "xdelta3", "-dcfq", "X", "\xd6\xc3\xc4", 3, RD_NONEXTERNAL },
308 { "bzip2", "-cf", "bzip2", "-dcf", "B", "BZh", 3, 0 }, 308 { "bzip2", "-cf", "bzip2", "-dcf", "B", "BZh", 3, 0 },
309 { "gzip", "-cf", "gzip", "-dcf", "G", "\037\213", 2, 0 }, 309 { "gzip", "-cf", "gzip", "-dcf", "G", "\037\213", 2, 0 },
diff --git a/xdelta3/xdelta3-test.h b/xdelta3/xdelta3-test.h
index 36166c6..2307b7e 100755
--- a/xdelta3/xdelta3-test.h
+++ b/xdelta3/xdelta3-test.h
@@ -701,7 +701,7 @@ test_compress_text (xd3_stream *stream,
701 701
702 xd3_set_appheader (stream, test_apphead, sizeof (test_apphead)); 702 xd3_set_appheader (stream, test_apphead, sizeof (test_apphead));
703 703
704 if ((ret = xd3_encode_completely (stream, test_text, sizeof (test_text), 704 if ((ret = xd3_encode_completely_stream (stream, test_text, sizeof (test_text),
705 encoded, encoded_size, 4*sizeof (test_text)))) { goto fail; } 705 encoded, encoded_size, 4*sizeof (test_text)))) { goto fail; }
706 706
707 if ((ret = xd3_close_stream (stream))) { goto fail; } 707 if ((ret = xd3_close_stream (stream))) { goto fail; }
@@ -1384,7 +1384,7 @@ test_streaming (xd3_stream *in_stream, uint8_t *encbuf, uint8_t *decbuf, uint8_t
1384 1384
1385 if ((i % 200) == 199) { DOT (); } 1385 if ((i % 200) == 199) { DOT (); }
1386 1386
1387 if ((ret = xd3_process_completely (& estream, xd3_encode_input, 0, 1387 if ((ret = xd3_process_completely_stream (& estream, xd3_encode_input, 0,
1388 encbuf, 1 << 20, 1388 encbuf, 1 << 20,
1389 delbuf, & delsize, 1 << 10))) 1389 delbuf, & delsize, 1 << 10)))
1390 { 1390 {
@@ -1392,7 +1392,7 @@ test_streaming (xd3_stream *in_stream, uint8_t *encbuf, uint8_t *decbuf, uint8_t
1392 goto fail; 1392 goto fail;
1393 } 1393 }
1394 1394
1395 if ((ret = xd3_process_completely (& dstream, xd3_decode_input, 0, 1395 if ((ret = xd3_process_completely_stream (& dstream, xd3_decode_input, 0,
1396 delbuf, delsize, 1396 delbuf, delsize,
1397 decbuf, & decsize, 1 << 20))) 1397 decbuf, & decsize, 1 << 20)))
1398 { 1398 {
@@ -1921,7 +1921,7 @@ test_identical_behavior (xd3_stream *stream, int ignore)
1921 if ((ret = xd3_set_source (stream, & source))) { goto fail; } 1921 if ((ret = xd3_set_source (stream, & source))) { goto fail; }
1922 1922
1923 /* Decode. */ 1923 /* Decode. */
1924 if ((ret = xd3_decode_completely (stream, del, delpos, rec, & recsize, IDB_TGTSZ))) { goto fail; } 1924 if ((ret = xd3_decode_completely_stream (stream, del, delpos, rec, & recsize, IDB_TGTSZ))) { goto fail; }
1925 1925
1926 /* Check result size and data. */ 1926 /* Check result size and data. */
1927 if (recsize != IDB_TGTSZ) { stream->msg = "wrong size reconstruction"; goto fail; } 1927 if (recsize != IDB_TGTSZ) { stream->msg = "wrong size reconstruction"; goto fail; }
@@ -2135,7 +2135,7 @@ test_iopt_flush_instructions (xd3_stream *stream, int ignore)
2135 target[tpos++] = i; 2135 target[tpos++] = i;
2136 } 2136 }
2137 2137
2138 if ((ret = xd3_encode_completely (stream, target, tpos, 2138 if ((ret = xd3_encode_completely_stream (stream, target, tpos,
2139 delta, & delta_size, sizeof (delta)))) 2139 delta, & delta_size, sizeof (delta))))
2140 { 2140 {
2141 return ret; 2141 return ret;
@@ -2144,7 +2144,7 @@ test_iopt_flush_instructions (xd3_stream *stream, int ignore)
2144 xd3_free_stream(stream); 2144 xd3_free_stream(stream);
2145 if ((ret = xd3_config_stream (stream, & config))) { return ret; } 2145 if ((ret = xd3_config_stream (stream, & config))) { return ret; }
2146 2146
2147 if ((ret = xd3_decode_completely (stream, delta, delta_size, 2147 if ((ret = xd3_decode_completely_stream (stream, delta, delta_size,
2148 recon, & recon_size, sizeof (recon)))) 2148 recon, & recon_size, sizeof (recon))))
2149 { 2149 {
2150 return ret; 2150 return ret;
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c
index 87a06ab..e5c82d8 100755
--- a/xdelta3/xdelta3.c
+++ b/xdelta3/xdelta3.c
@@ -1204,7 +1204,7 @@ int xd3_compute_code_table_encoding (xd3_stream *in_stream, const xd3_dinst *cod
1204 1204
1205 if ((ret = xd3_set_source (& stream, & source))) { goto fail; } 1205 if ((ret = xd3_set_source (& stream, & source))) { goto fail; }
1206 1206
1207 if ((ret = xd3_encode_completely (& stream, code_string, CODE_TABLE_STRING_SIZE, 1207 if ((ret = xd3_encode_completely_stream (& stream, code_string, CODE_TABLE_STRING_SIZE,
1208 comp_string, comp_string_size, CODE_TABLE_VCDIFF_SIZE))) { goto fail; } 1208 comp_string, comp_string_size, CODE_TABLE_VCDIFF_SIZE))) { goto fail; }
1209 1209
1210 fail: 1210 fail:
@@ -1400,7 +1400,7 @@ xd3_apply_table_encoding (xd3_stream *in_stream, const uint8_t *data, usize_t si
1400 1400
1401 if ((ret = xd3_config_stream (& stream, NULL)) || 1401 if ((ret = xd3_config_stream (& stream, NULL)) ||
1402 (ret = xd3_set_source (& stream, & source)) || 1402 (ret = xd3_set_source (& stream, & source)) ||
1403 (ret = xd3_decode_completely (& stream, data, size, code_string, & code_size, sizeof (code_string)))) 1403 (ret = xd3_decode_completely_stream (& stream, data, size, code_string, & code_size, sizeof (code_string))))
1404 { 1404 {
1405 in_stream->msg = stream.msg; 1405 in_stream->msg = stream.msg;
1406 goto fail; 1406 goto fail;
@@ -3807,7 +3807,7 @@ xd3_encode_input (xd3_stream *stream)
3807/* This function invokes either encode or decode to and from in-memory arrays. The output array 3807/* This function invokes either encode or decode to and from in-memory arrays. The output array
3808 * must be large enough to hold the output or else ENOSPC is returned. */ 3808 * must be large enough to hold the output or else ENOSPC is returned. */
3809static int 3809static int
3810xd3_process_completely (xd3_stream *stream, 3810xd3_process_completely_stream (xd3_stream *stream,
3811 int (*func) (xd3_stream *), 3811 int (*func) (xd3_stream *),
3812 int close_stream, 3812 int close_stream,
3813 const uint8_t *input, 3813 const uint8_t *input,
@@ -3860,28 +3860,28 @@ xd3_process_completely (xd3_stream *stream,
3860} 3860}
3861 3861
3862int 3862int
3863xd3_decode_completely (xd3_stream *stream, 3863xd3_decode_completely_stream (xd3_stream *stream,
3864 const uint8_t *input, 3864 const uint8_t *input,
3865 usize_t input_size, 3865 usize_t input_size,
3866 uint8_t *output, 3866 uint8_t *output,
3867 usize_t *output_size, 3867 usize_t *output_size,
3868 usize_t avail_size) 3868 usize_t avail_size)
3869{ 3869{
3870 return xd3_process_completely (stream, & xd3_decode_input, 1, 3870 return xd3_process_completely_stream (stream, & xd3_decode_input, 1,
3871 input, input_size, 3871 input, input_size,
3872 output, output_size, avail_size); 3872 output, output_size, avail_size);
3873} 3873}
3874 3874
3875#if XD3_ENCODER 3875#if XD3_ENCODER
3876int 3876int
3877xd3_encode_completely (xd3_stream *stream, 3877xd3_encode_completely_stream (xd3_stream *stream,
3878 const uint8_t *input, 3878 const uint8_t *input,
3879 usize_t input_size, 3879 usize_t input_size,
3880 uint8_t *output, 3880 uint8_t *output,
3881 usize_t *output_size, 3881 usize_t *output_size,
3882 usize_t avail_size) 3882 usize_t avail_size)
3883{ 3883{
3884 return xd3_process_completely (stream, & xd3_encode_input, 1, 3884 return xd3_process_completely_stream (stream, & xd3_encode_input, 1,
3885 input, input_size, 3885 input, input_size,
3886 output, output_size, avail_size); 3886 output, output_size, avail_size);
3887} 3887}
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h
index c2fe0a6..86a2662 100755
--- a/xdelta3/xdelta3.h
+++ b/xdelta3/xdelta3.h
@@ -841,9 +841,10 @@ struct _xd3_stream
841 * XD3_GETSRCBLK: If the xd3_getblk() callback is NULL, this value is returned to 841 * XD3_GETSRCBLK: If the xd3_getblk() callback is NULL, this value is returned to
842 * initiate a non-blocking source read. 842 * initiate a non-blocking source read.
843 * 843 *
844 * For simple usage, see the xd3_process_completely() function, which underlies 844 * For simple usage, see the xd3_process_completely_stream() function, which underlies
845 * xd3_encode_completely() and xd3_decode_completely() [xdelta3.c]. For real application 845 * xd3_encode_completely_stream() and xd3_decode_completely_stream() [xdelta3.c]. For
846 * usage, including the application header, the see command-line utility [xdelta3-main.h]. 846 * real application usage, including the application header, the see command-line utility
847 * [xdelta3-main.h].
847 * 848 *
848 * main_input() implements the command-line encode and decode as well as the optional 849 * main_input() implements the command-line encode and decode as well as the optional
849 * VCDIFF_TOOLS printhdr, printhdrs, and printdelta with a single loop [xdelta3-main.h]. 850 * VCDIFF_TOOLS printhdr, printhdrs, and printdelta with a single loop [xdelta3-main.h].
@@ -881,21 +882,21 @@ int xd3_set_source (xd3_stream *stream,
881 882
882/* This function invokes xd3_encode_input using whole-file, in-memory inputs. The output 883/* This function invokes xd3_encode_input using whole-file, in-memory inputs. The output
883 * array must be large enough to hold the output or else ENOSPC is returned. */ 884 * array must be large enough to hold the output or else ENOSPC is returned. */
884int xd3_encode_completely (xd3_stream *stream, 885int xd3_encode_completely_stream (xd3_stream *stream,
885 const uint8_t *input, 886 const uint8_t *input,
886 usize_t input_size, 887 usize_t input_size,
887 uint8_t *output, 888 uint8_t *output,
888 usize_t *output_size, 889 usize_t *output_size,
889 usize_t avail_output); 890 usize_t avail_output);
890 891
891/* This function invokes xd3_decode_input using whole-file, in-memory inputs. The output 892/* This function invokes xd3_decode_input using whole-file, in-memory inputs. The output
892 * array must be large enough to hold the output or else ENOSPC is returned. */ 893 * array must be large enough to hold the output or else ENOSPC is returned. */
893int xd3_decode_completely (xd3_stream *stream, 894int xd3_decode_completely_stream (xd3_stream *stream,
894 const uint8_t *input, 895 const uint8_t *input,
895 usize_t input_size, 896 usize_t input_size,
896 uint8_t *output, 897 uint8_t *output,
897 usize_t *output_size, 898 usize_t *output_size,
898 usize_t avail_size); 899 usize_t avail_size);
899 900
900/* This should be called before the first call to xd3_encode_input() to include 901/* This should be called before the first call to xd3_encode_input() to include
901 * application-specific data in the VCDIFF header. */ 902 * application-specific data in the VCDIFF header. */
diff --git a/xdelta3/xdelta3.prj b/xdelta3/xdelta3.prj
index 8217daa..ae05516 100755
--- a/xdelta3/xdelta3.prj
+++ b/xdelta3/xdelta3.prj
@@ -1,11 +1,12 @@
1;; -*- Prcs -*- 1;; -*- Prcs -*-
2(Created-By-Prcs-Version 1 3 3) 2(Created-By-Prcs-Version 1 3 4)
3(Project-Description "") 3(Project-Description "")
4(Project-Version xdelta3 0 5) 4(Project-Version xdelta3 0 9)
5(Parent-Version xdelta3 0 4) 5(Parent-Version xdelta3 0 8)
6(Version-Log "write a bit of documentation, work to fix/clean the regression test, fixed one actual bug in xd3_stream_close()") 6(Version-Log "rename encode/decode_completely to encode/decode_completely_stream
7(New-Version-Log "update .prj after 2 years! see http://code.google.com/p/xdelta/") 7")
8(Checkin-Time "Sun, 30 May 2004 14:42:47 -0700") 8(New-Version-Log "")
9(Checkin-Time "Sun, 28 Jan 2007 21:08:28 -0800")
9(Checkin-Login jmacd) 10(Checkin-Login jmacd)
10(Populate-Ignore ()) 11(Populate-Ignore ())
11(Project-Keywords 12(Project-Keywords
@@ -13,37 +14,37 @@
13 (WWWLeftNavBar "<table cellpadding=\"20px\" width=700> <tr> <td class=\"leftbdr\" valign=top height=600 width=100> <div class=\"leftbody\"> <h1>Xdelta</h1> <a href=\"xdelta3.html\">overview</a><br> <a href=\"xdelta3-cmdline.html\">command&nbsp;line</a><br> <a href=\"xdelta3-api-guide.html\">api&nbsp;guide</a><br> <br><a href=\"http://xdelta.org\">xdelta.org</a></h2> </div> </td> <td valign=top width=500>") 14 (WWWLeftNavBar "<table cellpadding=\"20px\" width=700> <tr> <td class=\"leftbdr\" valign=top height=600 width=100> <div class=\"leftbody\"> <h1>Xdelta</h1> <a href=\"xdelta3.html\">overview</a><br> <a href=\"xdelta3-cmdline.html\">command&nbsp;line</a><br> <a href=\"xdelta3-api-guide.html\">api&nbsp;guide</a><br> <br><a href=\"http://xdelta.org\">xdelta.org</a></h2> </div> </td> <td valign=top width=500>")
14 ) 15 )
15(Files 16(Files
16 (COPYING ()) 17 (COPYING (xdelta3/b/29_COPYING 1.1 644))
17 18
18 (xdelta3-cfgs.h (xdelta3/9_xdelta3-cf 1.1 644)) 19 (xdelta3-cfgs.h (xdelta3/9_xdelta3-cf 1.2 744))
19 (xdelta3-decode.h ()) 20 (xdelta3-decode.h (xdelta3/b/30_xdelta3-de 1.1 744))
20 (xdelta3-djw.h (xdelta3/8_xdelta3-dj 1.1 644)) 21 (xdelta3-djw.h (xdelta3/8_xdelta3-dj 1.2 744))
21 (xdelta3-fgk.h (xdelta3/7_xdelta3-fg 1.1 644)) 22 (xdelta3-fgk.h (xdelta3/7_xdelta3-fg 1.2 744))
22 (xdelta3-list.h (xdelta3/6_xdelta3-li 1.1 644)) 23 (xdelta3-list.h (xdelta3/6_xdelta3-li 1.2 644))
23 (xdelta3-main.h (xdelta3/5_xdelta3-ma 1.3 644)) 24 (xdelta3-main.h (xdelta3/5_xdelta3-ma 1.5 744))
24 (xdelta3-python.h (xdelta3/4_xdelta3-py 1.1 644)) 25 (xdelta3-python.h (xdelta3/4_xdelta3-py 1.2 644))
25 (xdelta3-regtest.py (xdelta3/10_xdelta3-re 1.3 755)) 26 (xdelta3-regtest.py (xdelta3/10_xdelta3-re 1.4 744))
26 (xdelta3-second.h (xdelta3/3_xdelta3-se 1.1 644)) 27 (xdelta3-second.h (xdelta3/3_xdelta3-se 1.2 744))
27 (xdelta3-test.h (xdelta3/2_xdelta3-te 1.2 644)) 28 (xdelta3-test.h (xdelta3/2_xdelta3-te 1.4 744))
28 (xdelta3.c (xdelta3/16_xdelta3.c 1.3 644)) 29 (xdelta3.c (xdelta3/16_xdelta3.c 1.5 744))
29 (xdelta3.h (xdelta3/1_xdelta3.h 1.2 644)) 30 (xdelta3.h (xdelta3/1_xdelta3.h 1.4 744))
30 31
31 (Makefile (xdelta3/0_Makefile 1.3 644)) 32 (Makefile (xdelta3/0_Makefile 1.4 744))
32 (setup.py (xdelta3/11_setup.py 1.1 644)) 33 (setup.py (xdelta3/11_setup.py 1.2 744))
33 34
34 (draft-korn-vcdiff.txt (xdelta3/b/22_draft-korn 1.1 600)) 35 (draft-korn-vcdiff.txt (xdelta3/b/22_draft-korn 1.1 644))
35 (www/xdelta3-api-guide.html (xdelta3/b/23_Xdelta3-ap 1.4 644)) 36 (www/xdelta3-api-guide.html (xdelta3/b/23_Xdelta3-ap 1.5 744))
36 (www/xdelta3-cmdline.html (xdelta3/b/25_xdelta3-cm 1.2 644)) 37 (www/xdelta3-cmdline.html (xdelta3/b/25_xdelta3-cm 1.3 744))
37 (www/xdelta3.css (xdelta3/b/26_xdelta3.cs 1.3 644)) 38 (www/xdelta3.css (xdelta3/b/26_xdelta3.cs 1.3 744))
38 (www/xdelta3.html (xdelta3/b/24_Xdelta3.ht 1.4 644)) 39 (www/xdelta3.html (xdelta3/b/24_Xdelta3.ht 1.5 744))
39 40
40 (badcopy.c (xdelta3/20_badcopy.c 1.1 644)) 41 (badcopy.c (xdelta3/20_badcopy.c 1.2 744))
41 (linkxd3lib.c (xdelta3/19_linkxd3lib 1.1 644)) 42 (linkxd3lib.c (xdelta3/19_linkxd3lib 1.2 744))
42 (rcs_junk.cc (xdelta3/15_rcs_junk.c 1.1 644)) 43 (rcs_junk.cc (xdelta3/15_rcs_junk.c 1.1 644))
43 44
44 (README ()) 45 (README (xdelta3/b/31_README 1.1 744))
45 (badcopy.vcproj ()) 46 (badcopy.vcproj (xdelta3/b/32_badcopy.vc 1.1 744))
46 (xdelta3.vcproj ()) 47 (xdelta3.vcproj (xdelta3/b/33_xdelta3.vc 1.1 744))
47) 48)
48(Merge-Parents) 49(Merge-Parents)
49(New-Merge-Parents) 50(New-Merge-Parents)