summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordotdotisdead <dotdotisdead@a3eca27d-f21b-0410-9b4a-6511e771f64e>2006-09-25 07:20:48 +0000
committerdotdotisdead <dotdotisdead@a3eca27d-f21b-0410-9b4a-6511e771f64e>2006-09-25 07:20:48 +0000
commit1bd0bf97026c2f8ff6e80c7299f03a1470b2f2bd (patch)
tree7fb0c8cf8300d2a7c7e52d3f1fb2e1b17d69ee18
parent485d0b54d205a6f91e4dba20b34c9e936646e04f (diff)
Cleanups, working on the python module, which has assertion failures.
-rwxr-xr-xxdelta3/Makefile11
-rwxr-xr-xxdelta3/junk.py11
-rwxr-xr-xxdelta3/www/xdelta3-cmdline.html27
-rwxr-xr-xxdelta3/xdelta3-main.h59
-rwxr-xr-xxdelta3/xdelta3-regtest.py6
-rwxr-xr-xxdelta3/xdelta3-test.h9
-rwxr-xr-xxdelta3/xdelta3.c3
-rwxr-xr-xxdelta3/xdelta3.h2
-rwxr-xr-xxdelta3/xdelta3.prj3
9 files changed, 41 insertions, 90 deletions
diff --git a/xdelta3/Makefile b/xdelta3/Makefile
index 34437e9..d6a6b5b 100755
--- a/xdelta3/Makefile
+++ b/xdelta3/Makefile
@@ -29,10 +29,10 @@ PYFILES = xdelta3-regtest.py setup.py
29EXTRA = Makefile COPYING linkxd3lib.c badcopy.c www 29EXTRA = Makefile COPYING linkxd3lib.c badcopy.c www
30 30
31# $Format: "REL=$Xdelta3Version$" $ 31# $Format: "REL=$Xdelta3Version$" $
32REL=0g 32REL=0h_pre0
33RELDIR = xdelta3$(REL) 33RELDIR = xdelta3$(REL)
34 34
35all: xdelta3 35all: xdelta3 $(PYTGT)
36 36
37all-targets: $(TARGETS) 37all-targets: $(TARGETS)
38 38
@@ -48,18 +48,19 @@ tar:
48clean: 48clean:
49 rm -f $(TARGETS) 49 rm -f $(TARGETS)
50 50
51$(PYTGT): $(SOURCES)
52 $(PYTHON) setup.py install --compile --force
53
54xdelta3: $(SOURCES) 51xdelta3: $(SOURCES)
55 $(CC) -O3 -Wall -Wshadow xdelta3.c -lm -o xdelta3 \ 52 $(CC) -O3 -Wall -Wshadow xdelta3.c -lm -o xdelta3 \
56 -DXD3_DEBUG=0 \ 53 -DXD3_DEBUG=0 \
57 -DXD3_USE_LARGEFILE64=1 \ 54 -DXD3_USE_LARGEFILE64=1 \
58 -DREGRESSION_TEST=1 \ 55 -DREGRESSION_TEST=1 \
59 -DSECONDARY_DJW=1 \ 56 -DSECONDARY_DJW=1 \
57 -DSECONDARY_FGK=1 \
60 -DXD3_MAIN=1 \ 58 -DXD3_MAIN=1 \
61 -DXD3_POSIX=1 59 -DXD3_POSIX=1
62 60
61$(PYTGT): $(SOURCES)
62 $(PYTHON) setup.py install --verbose --compile --force
63
63xdelta3-1: $(SOURCES) 64xdelta3-1: $(SOURCES)
64 $(CC) -g -Wall -Wshadow xdelta3.c -o xdelta3-1 -DXD3_MAIN=1 -DGENERIC_ENCODE_TABLES=1 \ 65 $(CC) -g -Wall -Wshadow xdelta3.c -o xdelta3-1 -DXD3_MAIN=1 -DGENERIC_ENCODE_TABLES=1 \
65 -DXD3_USE_LARGEFILE64=1 -DREGRESSION_TEST=1 -DXD3_DEBUG=1 -DSECONDARY_DJW=1 -lm 66 -DXD3_USE_LARGEFILE64=1 -DREGRESSION_TEST=1 -DXD3_DEBUG=1 -DSECONDARY_DJW=1 -lm
diff --git a/xdelta3/junk.py b/xdelta3/junk.py
deleted file mode 100755
index 384951e..0000000
--- a/xdelta3/junk.py
+++ /dev/null
@@ -1,11 +0,0 @@
1#!/usr/bin/python
2
3bytes = ''
4
5for x in range(0, 250):
6 bytes = bytes + ('%c%c%c%c=' % (x, x+1, x+2, x+3))
7
8for x in range(0, 250):
9 bytes = bytes + ('%c' % x)
10
11print bytes
diff --git a/xdelta3/www/xdelta3-cmdline.html b/xdelta3/www/xdelta3-cmdline.html
index cabb547..19f59ae 100755
--- a/xdelta3/www/xdelta3-cmdline.html
+++ b/xdelta3/www/xdelta3-cmdline.html
@@ -128,33 +128,38 @@ VCDIFF addr section length: 3
128<pre> 128<pre>
129usage: xdelta3 [command/options] [input [output]] 129usage: xdelta3 [command/options] [input [output]]
130commands are: 130commands are:
131 encode encodes the input
132 decode decodes the input
133 config prints xdelta3 configuration 131 config prints xdelta3 configuration
132 decode decodes the input
133 encode encodes the input
134 test run the builtin tests 134 test run the builtin tests
135special commands for VCDIFF inputs: 135special commands for VCDIFF inputs:
136 printdelta print information about the entire delta
136 printhdr print information about the first window 137 printhdr print information about the first window
137 printhdrs print information about all windows 138 printhdrs print information about all windows
138 printdelta print information about the entire delta
139options are: 139options are:
140 -0 .. -9 compression level
141 -A [apphead] disable/provide application header
142 -B blksize source file block size
143 -C soft config (see xdelta3-cfgs.h)
140 -c use stdout instead of default 144 -c use stdout instead of default
145 -D disable external decompression (encode/decode)
141 -d same as decode command 146 -d same as decode command
142 -e same as encode command 147 -e same as encode command
143 -f force overwrite 148 -f force overwrite
149 -h show help
150 -J disable output (check/compute only)
151 -M memsize memory budget for hash tables
144 -n disable checksum (encode/decode) 152 -n disable checksum (encode/decode)
145 -D disable external decompression (encode/decode)
146 -R disable external recompression (decode)
147 -N disable small string-matching compression 153 -N disable small string-matching compression
154 -P repeat count (for profiling)
155 -q be quiet
156 -R disable external recompression (decode)
148 -S [djw|fgk] disable/enable secondary compression 157 -S [djw|fgk] disable/enable secondary compression
149 -A [apphead] disable/provide application header
150 -s source source file to copy from (if any) 158 -s source source file to copy from (if any)
151 -B blksize source file block size 159 -T use alternate code table
152 -W winsize input window buffer size
153 -v be verbose (max 2) 160 -v be verbose (max 2)
154 -q be quiet
155 -h show help
156 -V show version 161 -V show version
157 -P repeat count (for profiling) 162 -W winsize input window buffer size
158</pre> 163</pre>
159<p> 164<p>
160 165
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h
index 4a84e67..26a12e1 100755
--- a/xdelta3/xdelta3-main.h
+++ b/xdelta3/xdelta3-main.h
@@ -214,7 +214,7 @@ XD3_MAKELIST(main_blklru_list,main_blklru,link);
214/* Program options: various command line flags and options. */ 214/* Program options: various command line flags and options. */
215static int option_stdout = 0; 215static int option_stdout = 0;
216static int option_force = 0; 216static int option_force = 0;
217static int option_verbose = 0; 217static int option_verbose = 3;
218static int option_quiet = 0; 218static int option_quiet = 0;
219static int option_level = 6; 219static int option_level = 6;
220static int option_use_appheader = 1; 220static int option_use_appheader = 1;
@@ -232,24 +232,6 @@ static usize_t option_winsize = XD3_DEFAULT_WINSIZE;
232static usize_t option_srcwinsz = XD3_DEFAULT_SRCWINSZ; 232static usize_t option_srcwinsz = XD3_DEFAULT_SRCWINSZ;
233static usize_t option_memsize = XD3_DEFAULT_MEMSIZE; 233static usize_t option_memsize = XD3_DEFAULT_MEMSIZE;
234 234
235/* Wishful TODO: Support should probably be for partial deltas & update-in-place deltas,
236 * following the latest draft RFC specs partial deltas [the changes have moderate
237 * complexity]. The following flags implement primitive controls to skip sections
238 * of the input & output, mainly for debugging purposes. */
239
240/* DECODE-ONLY: Skips processing windows up to first_window and past last_window using the
241 * XD3_SKIP_WINDOW flag, but main_ still reads reads/parses every window. TODO: make it
242 * meaningful for encode, etc... */
243/*static xoff_t option_first_window = 0;*/
244/*static xoff_t option_last_window = XOFF_T_MAX;*/
245
246/* ENCODE-ONLY: Seeks to first_offset, EOF at last_offset, done entirely in this main_
247 * routines, so the library actually sees a shortened input. TODO: implement this for
248 * decode, implement proper partial deltas, works with external compression?, works with
249 * non-seekable inputs?, change ranges, etc... */
250/*static xoff_t option_first_offset = 0;*/
251/*static xoff_t option_last_offset = XOFF_T_MAX;*/
252
253/* This controls the number of times main repeats itself, only for profiling. */ 235/* This controls the number of times main repeats itself, only for profiling. */
254static int option_profile_cnt = 0; 236static int option_profile_cnt = 0;
255 237
@@ -307,7 +289,7 @@ static int
307main_version (void) 289main_version (void)
308{ 290{
309 /* $Format: " P(RINT \"VERSION=3.$Xdelta3Version$\\n\");" $ */ 291 /* $Format: " P(RINT \"VERSION=3.$Xdelta3Version$\\n\");" $ */
310 P(RINT "VERSION=3.0g\n"); 292 P(RINT "VERSION=3.0h_pre0\n");
311 return EXIT_SUCCESS; 293 return EXIT_SUCCESS;
312} 294}
313 295
@@ -345,7 +327,7 @@ main_malloc1 (usize_t size)
345{ 327{
346 void* r = malloc (size); 328 void* r = malloc (size);
347 if (r == NULL) { XPR(NT "malloc: %s\n", xd3_strerror (ENOMEM)); } 329 if (r == NULL) { XPR(NT "malloc: %s\n", xd3_strerror (ENOMEM)); }
348 else if (option_verbose > 2) { XPR(NT "malloc: %u\n", size); } 330 else if (option_verbose > 2) { XPR(NT "malloc: %u: %p\n", size, r); }
349 return r; 331 return r;
350} 332}
351 333
@@ -366,19 +348,20 @@ main_alloc (void *opaque,
366} 348}
367 349
368static void 350static void
369main_free (void *ptr) 351main_free1 (void *opaque, void *ptr)
370{ 352{
371 if (ptr) 353 if (option_verbose > 2) { XPR(NT "free: %p\n", ptr); }
372 { 354 free (ptr);
373 IF_DEBUG (main_mallocs -= 1);
374 free (ptr);
375 }
376} 355}
377 356
378static void 357static void
379main_free1 (void *opaque, void *ptr) 358main_free (void *ptr)
380{ 359{
381 free (ptr); 360 if (ptr)
361 {
362 IF_DEBUG (main_mallocs -= 1);
363 main_free1 (NULL, ptr);
364 }
382} 365}
383 366
384/* This ensures that (ret = errno) always indicates failure, in case errno was 367/* This ensures that (ret = errno) always indicates failure, in case errno was
@@ -1820,19 +1803,6 @@ main_set_source (xd3_stream *stream, int cmd, main_file *sfile, xd3_source *sour
1820 lru_size = (option_srcwinsz / source->blksize); 1803 lru_size = (option_srcwinsz / source->blksize);
1821 lru_size = max(1, lru_size); 1804 lru_size = max(1, lru_size);
1822 1805
1823 if (lru_size > 128)
1824 {
1825 /* TODO: fix performance here, the LRU is scanned sequentially to find blocks,
1826 * except in encode, where it uses FIFO. Fix is to set source->blksize
1827 * accordingly. */
1828 if (IS_ENCODE(cmd) && ! option_quiet)
1829 {
1830 XPR(NT "warning: large source window (--B %u) "
1831 "hurts performance except for encoding\n",
1832 option_srcwinsz);
1833 }
1834 }
1835
1836 if ((lru = main_malloc (sizeof (main_blklru) * lru_size)) == NULL) 1806 if ((lru = main_malloc (sizeof (main_blklru) * lru_size)) == NULL)
1837 { 1807 {
1838 return ENOMEM; 1808 return ENOMEM;
@@ -2073,9 +2043,6 @@ main_getblk_func (xd3_stream *stream,
2073/* This is a generic input function. It calls the xd3_encode_input or xd3_decode_input 2043/* This is a generic input function. It calls the xd3_encode_input or xd3_decode_input
2074 * functions and makes calls to the various input handling routines above, which 2044 * functions and makes calls to the various input handling routines above, which
2075 * coordinate external decompression. 2045 * coordinate external decompression.
2076 *
2077 * TODO config: Still need options for the at least: smatch config, memsize, sprevsz,
2078 * XD3_SEC_* flags, greedy/1.5
2079 */ 2046 */
2080static int 2047static int
2081main_input (xd3_cmd cmd, 2048main_input (xd3_cmd cmd,
@@ -2570,7 +2537,7 @@ main (int argc, char **argv)
2570 * main() and thus care about freeing all memory. I never had much trust for getopt 2537 * main() and thus care about freeing all memory. I never had much trust for getopt
2571 * anyway, it's too opaque. This implements a fairly standard non-long-option getopt 2538 * anyway, it's too opaque. This implements a fairly standard non-long-option getopt
2572 * with support for named operations (e.g., "xdelta3 [encode|decode|printhdr...] < in > 2539 * with support for named operations (e.g., "xdelta3 [encode|decode|printhdr...] < in >
2573 * out"). I'll probably add long options at some point. See TODO. */ 2540 * out"). I'll probably add long options at some point. */
2574 if (my_optstr) 2541 if (my_optstr)
2575 { 2542 {
2576 if (*my_optstr == '-') { my_optstr += 1; } 2543 if (*my_optstr == '-') { my_optstr += 1; }
diff --git a/xdelta3/xdelta3-regtest.py b/xdelta3/xdelta3-regtest.py
index f3313a4..e8d0339 100755
--- a/xdelta3/xdelta3-regtest.py
+++ b/xdelta3/xdelta3-regtest.py
@@ -1,4 +1,4 @@
1#!/usr/bin/python2.3 1#!/usr/bin/python2.4
2# xdelta 3 - delta compression tools and library 2# xdelta 3 - delta compression tools and library
3# Copyright (C) 2003 and onward. Joshua P. MacDonald 3# Copyright (C) 2003 and onward. Joshua P. MacDonald
4# 4#
@@ -51,7 +51,7 @@ FORK = 0
51 51
52# 52#
53# 53#
54RCSDIR = '/Volumes/LACIE120RAID/orbit_linux/home/jmacd/PRCS/prcs/b' 54RCSDIR = '/mnt/polaroid/Polaroid/orbit_linux/home/jmacd/PRCS/prcs/b'
55 55
56TMPDIR = '/tmp/xd3regtest.%d' % os.getpid() 56TMPDIR = '/tmp/xd3regtest.%d' % os.getpid()
57 57
@@ -551,7 +551,7 @@ class Xdelta3Run1:
551 if self.reps: 551 if self.reps:
552 assert(reps == 1) 552 assert(reps == 1)
553 reps = self.reps 553 reps = self.reps
554 RunXdelta3(['-P', '%d' % reps, '-efq', self.file, DFILE],kind=self.kind) 554 RunXdelta3(['-vvv', '-P', '%d' % reps, '-efq', self.file, DFILE],kind=self.kind)
555 if trial > 0: 555 if trial > 0:
556 return None 556 return None
557 return Xdelta3Info(self.file,DFILE) 557 return Xdelta3Info(self.file,DFILE)
diff --git a/xdelta3/xdelta3-test.h b/xdelta3/xdelta3-test.h
index d076656..3c50bb6 100755
--- a/xdelta3/xdelta3-test.h
+++ b/xdelta3/xdelta3-test.h
@@ -45,14 +45,7 @@ static int test_exponential_dist (usize_t mean, usize_t max);
45 45
46#define CHECK(cond) if (!(cond)) { P(RINT "check failure: " #cond); abort(); } 46#define CHECK(cond) if (!(cond)) { P(RINT "check failure: " #cond); abort(); }
47 47
48/* TODO 48/* TODO: Test 1.5 pass alg vs. greedy */
49 *
50 * 1. Test state changes: that config is called before open, open called before
51 * encode/decode..., close incomplete works, invalid options, consume_output always
52 * called, no mixing of encode/decode, etc.
53 *
54 * 2. Test window selection, window alignment, 1.5 pass alg vs. greedy
55 */
56 49
57/****************************************************************************************** 50/******************************************************************************************
58 TEST HELPERS 51 TEST HELPERS
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c
index f7514e5..a26a93c 100755
--- a/xdelta3/xdelta3.c
+++ b/xdelta3/xdelta3.c
@@ -239,6 +239,7 @@
239 xdelta3-main.h The command-line interface, external compression 239 xdelta3-main.h The command-line interface, external compression
240 support, POSIX-specific, info & VCDIFF-debug tools. 240 support, POSIX-specific, info & VCDIFF-debug tools.
241 xdelta3-second.h The common secondary compression routines. 241 xdelta3-second.h The common secondary compression routines.
242 xdelta3-decoder.h All decoding routines.
242 xdelta3-djw.h The semi-adaptive huffman secondary encoder. 243 xdelta3-djw.h The semi-adaptive huffman secondary encoder.
243 xdelta3-fgk.h The adaptive huffman secondary encoder. 244 xdelta3-fgk.h The adaptive huffman secondary encoder.
244 xdelta3-test.h The unit test covers major algorithms, 245 xdelta3-test.h The unit test covers major algorithms,
@@ -268,8 +269,6 @@
268 generated using an expoential distribution 269 generated using an expoential distribution
269 which approximates the expected error_prob 270 which approximates the expected error_prob
270 distribution. 271 distribution.
271 show.c Prints an offset/length segment from a file.
272 testh.c Checks that xdelta3.h is can be #included
273 -------------------------------------------------------------------- 272 --------------------------------------------------------------------
274 273
275 This file itself is unusually large. I hope to defend this layout 274 This file itself is unusually large. I hope to defend this layout
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h
index 90b2fd9..0f11854 100755
--- a/xdelta3/xdelta3.h
+++ b/xdelta3/xdelta3.h
@@ -940,7 +940,6 @@ void xd3_avail_input (xd3_stream *stream,
940 * a stream->winsize buffer. This is to avoid an unwanted allocation. */ 940 * a stream->winsize buffer. This is to avoid an unwanted allocation. */
941 XD3_ASSERT (idata != NULL); 941 XD3_ASSERT (idata != NULL);
942 942
943 /* TODO: Should check for a call to xd3_avail_input in the wrong state. */
944 stream->next_in = idata; 943 stream->next_in = idata;
945 stream->avail_in = isize; 944 stream->avail_in = isize;
946} 945}
@@ -950,7 +949,6 @@ void xd3_avail_input (xd3_stream *stream,
950static inline 949static inline
951void xd3_consume_output (xd3_stream *stream) 950void xd3_consume_output (xd3_stream *stream)
952{ 951{
953 /* TODO: Is it correct to set avail_in = 0 here, then check == 0 in avail_in? */
954 stream->avail_out = 0; 952 stream->avail_out = 0;
955} 953}
956 954
diff --git a/xdelta3/xdelta3.prj b/xdelta3/xdelta3.prj
index 02a254d..9ce7618 100755
--- a/xdelta3/xdelta3.prj
+++ b/xdelta3/xdelta3.prj
@@ -9,7 +9,7 @@
9(Checkin-Login jmacd) 9(Checkin-Login jmacd)
10(Populate-Ignore ()) 10(Populate-Ignore ())
11(Project-Keywords 11(Project-Keywords
12 (Xdelta3Version "0g") 12 (Xdelta3Version "0h_pre0")
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>") 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 ) 14 )
15(Files 15(Files
@@ -41,7 +41,6 @@
41 (junk.py ()) 41 (junk.py ())
42 (linkxd3lib.c (xdelta3/19_linkxd3lib 1.1 644)) 42 (linkxd3lib.c (xdelta3/19_linkxd3lib 1.1 644))
43 (rcs_junk.cc (xdelta3/15_rcs_junk.c 1.1 644)) 43 (rcs_junk.cc (xdelta3/15_rcs_junk.c 1.1 644))
44 (show.c (xdelta3/18_show.c 1.1 644))
45) 44)
46(Merge-Parents) 45(Merge-Parents)
47(New-Merge-Parents) 46(New-Merge-Parents)