summaryrefslogtreecommitdiff
path: root/xdelta3
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3')
-rw-r--r--xdelta3/Makefile.am2
-rw-r--r--xdelta3/testing/modify.h2
-rw-r--r--xdelta3/testing/random.h2
-rw-r--r--xdelta3/xdelta3-hash.h40
-rw-r--r--xdelta3/xdelta3-internal.h2
-rw-r--r--xdelta3/xdelta3-tmp.prj72
-rw-r--r--xdelta3/xdelta3.c44
-rw-r--r--xdelta3/xdelta3.h35
8 files changed, 55 insertions, 144 deletions
diff --git a/xdelta3/Makefile.am b/xdelta3/Makefile.am
index fe0bd85..3cba9af 100644
--- a/xdelta3/Makefile.am
+++ b/xdelta3/Makefile.am
@@ -44,7 +44,7 @@ common_CFLAGS = \
44 -DXD3_USE_LARGEFILE64=1 \ 44 -DXD3_USE_LARGEFILE64=1 \
45 -DXD3_MAIN=1 45 -DXD3_MAIN=1
46 46
47xdelta3_CFLAGS = $(WFLAGS) $(common_CFLAGS) 47xdelta3_CFLAGS = $(WFLAGS) $(common_CFLAGS) -pedantic -std=c99
48 48
49xdelta3regtest_CXXFLAGS = $(WFLAGS) $(common_CFLAGS) -DNOT_MAIN=1 -DXD3_DEBUG=1 49xdelta3regtest_CXXFLAGS = $(WFLAGS) $(common_CFLAGS) -DNOT_MAIN=1 -DXD3_DEBUG=1
50xdelta3regtest_CFLAGS = $(WFLAGS) $(common_CFLAGS) -DNOT_MAIN=1 -DXD3_DEBUG=1 50xdelta3regtest_CFLAGS = $(WFLAGS) $(common_CFLAGS) -DNOT_MAIN=1 -DXD3_DEBUG=1
diff --git a/xdelta3/testing/modify.h b/xdelta3/testing/modify.h
index ca83c21..d4698e3 100644
--- a/xdelta3/testing/modify.h
+++ b/xdelta3/testing/modify.h
@@ -15,7 +15,7 @@ public:
15 DELETE = 3, // Delete a specified range of data 15 DELETE = 3, // Delete a specified range of data
16 COPY = 4, // Copy from one region, inserting elsewhere 16 COPY = 4, // Copy from one region, inserting elsewhere
17 MOVE = 5, // Copy then delete copied-from range 17 MOVE = 5, // Copy then delete copied-from range
18 OVERWRITE = 6, // Copy then delete copied-to range 18 OVERWRITE = 6 // Copy then delete copied-to range
19 19
20 // ADD, DELETE, and COPY change the file size 20 // ADD, DELETE, and COPY change the file size
21 // MODIFY, MOVE, OVERWRITE preserve the file size 21 // MODIFY, MOVE, OVERWRITE preserve the file size
diff --git a/xdelta3/testing/random.h b/xdelta3/testing/random.h
index 65fabbd..d1a6840 100644
--- a/xdelta3/testing/random.h
+++ b/xdelta3/testing/random.h
@@ -9,7 +9,7 @@ class MTRandom {
9 public: 9 public:
10 enum Constants { 10 enum Constants {
11 MT_LEN = 624, 11 MT_LEN = 624,
12 MT_IA = 397, 12 MT_IA = 397
13 }; 13 };
14 14
15 static const uint32_t TEST_SEED1; 15 static const uint32_t TEST_SEED1;
diff --git a/xdelta3/xdelta3-hash.h b/xdelta3/xdelta3-hash.h
index 8a5e5b2..e546d59 100644
--- a/xdelta3/xdelta3-hash.h
+++ b/xdelta3/xdelta3-hash.h
@@ -46,43 +46,7 @@ static const uint32_t hash_multiplier = 1597334677U;
46#else 46#else
47#define PERMUTE(x) (__single_hash[(uint32_t)x]) 47#define PERMUTE(x) (__single_hash[(uint32_t)x])
48 48
49static const uint16_t __single_hash[256] = 49extern const uint16_t __single_hash[256];
50{
51 /* Random numbers generated using SLIB's pseudo-random number generator.
52 * This hashes the input alphabet. */
53 0xbcd1, 0xbb65, 0x42c2, 0xdffe, 0x9666, 0x431b, 0x8504, 0xeb46,
54 0x6379, 0xd460, 0xcf14, 0x53cf, 0xdb51, 0xdb08, 0x12c8, 0xf602,
55 0xe766, 0x2394, 0x250d, 0xdcbb, 0xa678, 0x02af, 0xa5c6, 0x7ea6,
56 0xb645, 0xcb4d, 0xc44b, 0xe5dc, 0x9fe6, 0x5b5c, 0x35f5, 0x701a,
57 0x220f, 0x6c38, 0x1a56, 0x4ca3, 0xffc6, 0xb152, 0x8d61, 0x7a58,
58 0x9025, 0x8b3d, 0xbf0f, 0x95a3, 0xe5f4, 0xc127, 0x3bed, 0x320b,
59 0xb7f3, 0x6054, 0x333c, 0xd383, 0x8154, 0x5242, 0x4e0d, 0x0a94,
60 0x7028, 0x8689, 0x3a22, 0x0980, 0x1847, 0xb0f1, 0x9b5c, 0x4176,
61 0xb858, 0xd542, 0x1f6c, 0x2497, 0x6a5a, 0x9fa9, 0x8c5a, 0x7743,
62 0xa8a9, 0x9a02, 0x4918, 0x438c, 0xc388, 0x9e2b, 0x4cad, 0x01b6,
63 0xab19, 0xf777, 0x365f, 0x1eb2, 0x091e, 0x7bf8, 0x7a8e, 0x5227,
64 0xeab1, 0x2074, 0x4523, 0xe781, 0x01a3, 0x163d, 0x3b2e, 0x287d,
65 0x5e7f, 0xa063, 0xb134, 0x8fae, 0x5e8e, 0xb7b7, 0x4548, 0x1f5a,
66 0xfa56, 0x7a24, 0x900f, 0x42dc, 0xcc69, 0x02a0, 0x0b22, 0xdb31,
67 0x71fe, 0x0c7d, 0x1732, 0x1159, 0xcb09, 0xe1d2, 0x1351, 0x52e9,
68 0xf536, 0x5a4f, 0xc316, 0x6bf9, 0x8994, 0xb774, 0x5f3e, 0xf6d6,
69 0x3a61, 0xf82c, 0xcc22, 0x9d06, 0x299c, 0x09e5, 0x1eec, 0x514f,
70 0x8d53, 0xa650, 0x5c6e, 0xc577, 0x7958, 0x71ac, 0x8916, 0x9b4f,
71 0x2c09, 0x5211, 0xf6d8, 0xcaaa, 0xf7ef, 0x287f, 0x7a94, 0xab49,
72 0xfa2c, 0x7222, 0xe457, 0xd71a, 0x00c3, 0x1a76, 0xe98c, 0xc037,
73 0x8208, 0x5c2d, 0xdfda, 0xe5f5, 0x0b45, 0x15ce, 0x8a7e, 0xfcad,
74 0xaa2d, 0x4b5c, 0xd42e, 0xb251, 0x907e, 0x9a47, 0xc9a6, 0xd93f,
75 0x085e, 0x35ce, 0xa153, 0x7e7b, 0x9f0b, 0x25aa, 0x5d9f, 0xc04d,
76 0x8a0e, 0x2875, 0x4a1c, 0x295f, 0x1393, 0xf760, 0x9178, 0x0f5b,
77 0xfa7d, 0x83b4, 0x2082, 0x721d, 0x6462, 0x0368, 0x67e2, 0x8624,
78 0x194d, 0x22f6, 0x78fb, 0x6791, 0xb238, 0xb332, 0x7276, 0xf272,
79 0x47ec, 0x4504, 0xa961, 0x9fc8, 0x3fdc, 0xb413, 0x007a, 0x0806,
80 0x7458, 0x95c6, 0xccaa, 0x18d6, 0xe2ae, 0x1b06, 0xf3f6, 0x5050,
81 0xc8e8, 0xf4ac, 0xc04c, 0xf41c, 0x992f, 0xae44, 0x5f1b, 0x1113,
82 0x1738, 0xd9a8, 0x19ea, 0x2d33, 0x9698, 0x2fe9, 0x323f, 0xcde2,
83 0x6d71, 0xe37d, 0xb697, 0x2c4f, 0x4373, 0x9102, 0x075d, 0x8e25,
84 0x1672, 0xec28, 0x6acb, 0x86cc, 0x186e, 0x9414, 0xd674, 0xd1a5
85};
86#endif 50#endif
87 51
88/* Update the checksum state. */ 52/* Update the checksum state. */
@@ -98,7 +62,7 @@ xd3_large_cksum_update (uint32_t cksum,
98 return (high << 16) | low; 62 return (high << 16) | low;
99} 63}
100#else 64#else
101// TODO: revisit this topic 65/* TODO: revisit this topic */
102#endif 66#endif
103 67
104/* Note: small cksum is hard-coded for 4 bytes */ 68/* Note: small cksum is hard-coded for 4 bytes */
diff --git a/xdelta3/xdelta3-internal.h b/xdelta3/xdelta3-internal.h
index d134564..fd01208 100644
--- a/xdelta3/xdelta3-internal.h
+++ b/xdelta3/xdelta3-internal.h
@@ -56,7 +56,7 @@ int xd3_main_cmdline (int argc, char **argv);
56typedef enum 56typedef enum
57{ 57{
58 XO_READ = 0, 58 XO_READ = 0,
59 XO_WRITE = 1, 59 XO_WRITE = 1
60} main_file_modes; 60} main_file_modes;
61 61
62struct _main_file 62struct _main_file
diff --git a/xdelta3/xdelta3-tmp.prj b/xdelta3/xdelta3-tmp.prj
deleted file mode 100644
index d29725e..0000000
--- a/xdelta3/xdelta3-tmp.prj
+++ /dev/null
@@ -1,72 +0,0 @@
1;; -*- Prcs -*-
2(Created-By-Prcs-Version 1 3 4)
3(Project-Description "")
4(Project-Version xdelta3-tmp 0 1)
5(Parent-Version -*- -*- -*-)
6(Version-Log "")
7(New-Version-Log "")
8(Checkin-Time "Sun, 09 Jan 2011 00:28:29 -0800")
9(Checkin-Login jmacd)
10(Populate-Ignore ("\\.svn" "\\.o" "\\.gz" ".dSYM"))
11(Project-Keywords
12 (Xdelta3Version "3.0.0")
13)
14(Files
15 (xdelta3.wxs (xdelta3-tmp/0_xdelta3.wx 1.1 644))
16 (xdelta3.wxi (xdelta3-tmp/1_xdelta3.wx 1.1 644))
17 (xdelta3.vcproj (xdelta3-tmp/2_xdelta3.vc 1.1 644))
18 (xdelta3.swig (xdelta3-tmp/3_xdelta3.sw 1.1 644))
19 (xdelta3.h (xdelta3-tmp/4_xdelta3.h 1.1 644))
20 (xdelta3.c (xdelta3-tmp/5_xdelta3.c 1.1 644))
21 (xdelta3.1 (xdelta3-tmp/6_xdelta3.1 1.1 600))
22 (xdelta3-test.py (xdelta3-tmp/7_xdelta3-te 1.1 755))
23 (xdelta3-test.h (xdelta3-tmp/8_xdelta3-te 1.1 644))
24 (xdelta3-second.h (xdelta3-tmp/9_xdelta3-se 1.1 644))
25 (xdelta3-python.h (xdelta3-tmp/10_xdelta3-py 1.1 644))
26 (xdelta3-merge.h (xdelta3-tmp/12_xdelta3-me 1.1 644))
27 (xdelta3-main.h (xdelta3-tmp/13_xdelta3-ma 1.1 644))
28 (xdelta3-list.h (xdelta3-tmp/14_xdelta3-li 1.1 644))
29 (xdelta3-hash.h (xdelta3-tmp/15_xdelta3-ha 1.1 644))
30 (xdelta3-fgk.h (xdelta3-tmp/16_xdelta3-fg 1.1 644))
31 (xdelta3-djw.h (xdelta3-tmp/17_xdelta3-dj 1.1 644))
32 (xdelta3-decode.h (xdelta3-tmp/18_xdelta3-de 1.1 644))
33 (xdelta3-cfgs.h (xdelta3-tmp/19_xdelta3-cf 1.1 644))
34 (xdelta3-blkcache.h (xdelta3-tmp/20_xdelta3-bl 1.1 644))
35 (testing/xdelta3-regtest.py (xdelta3-tmp/21_xdelta3-re 1.1 755))
36 (testing/test.h (xdelta3-tmp/22_test.h 1.1 644))
37 (testing/sizes.h (xdelta3-tmp/23_sizes.h 1.1 644))
38 (testing/segment.h (xdelta3-tmp/24_segment.h 1.1 644))
39 (testing/regtest.cc (xdelta3-tmp/25_regtest.cc 1.1 644))
40 (testing/random.h (xdelta3-tmp/26_random.h 1.1 644))
41 (testing/modify.h (xdelta3-tmp/27_modify.h 1.1 644))
42 (testing/Makefile (xdelta3-tmp/28_Makefile 1.1 755))
43 (testing/file.h (xdelta3-tmp/29_file.h 1.1 644))
44 (testing/delta.h (xdelta3-tmp/30_delta.h 1.1 644))
45 (testing/dead.cc (xdelta3-tmp/31_dead.cc 1.1 644))
46 (testing/cmp.h (xdelta3-tmp/32_cmp.h 1.1 644))
47 (setup.py (xdelta3-tmp/33_setup.py 1.1 644))
48 (run.sh (xdelta3-tmp/34_run.sh 1.1 644))
49 (readme.txt (xdelta3-tmp/35_readme.txt 1.1 644))
50 (README (xdelta3-tmp/36_README 1.1 644))
51 (rcs_junk.cc (xdelta3-tmp/37_rcs_junk.c 1.1 644))
52 (plot.sh (xdelta3-tmp/38_plot.sh 1.1 644))
53 (Makefile.mingw (xdelta3-tmp/39_Makefile.m 1.1 644))
54 (Makefile (xdelta3-tmp/40_Makefile 1.1 644))
55 (linkxd3lib.c (xdelta3-tmp/41_linkxd3lib 1.1 644))
56 (examples/test.h (xdelta3-tmp/42_test.h 1.1 644))
57 (examples/speed_test.c (xdelta3-tmp/43_speed_test 1.1 644))
58 (examples/small_page_test.c (xdelta3-tmp/44_small_page 1.1 755))
59 (examples/README (xdelta3-tmp/45_README 1.1 644))
60 (examples/Makefile (xdelta3-tmp/46_Makefile 1.1 755))
61 (examples/encode_decode_test.c (xdelta3-tmp/47_encode_dec 1.1 644))
62 (examples/decoded.testdata (xdelta3-tmp/48_decoded.te 1.1 644))
63 (examples/compare_test.c (xdelta3-tmp/49_compare_te 1.1 644))
64 (examples/checksum_test.cc (xdelta3-tmp/50_checksum_t 1.1 644))
65 (draft-korn-vcdiff.txt (xdelta3-tmp/51_draft-korn 1.1 644))
66 (dead.code (xdelta3-tmp/b/0_dead.code 1.1 644))
67 (COPYING (xdelta3-tmp/b/1_COPYING 1.1 644))
68 (badcopy.vcproj (xdelta3-tmp/b/2_badcopy.vc 1.1 644))
69 (badcopy.c (xdelta3-tmp/b/3_badcopy.c 1.1 644))
70)
71(Merge-Parents)
72(New-Merge-Parents)
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c
index 0242c57..20c7f9b 100644
--- a/xdelta3/xdelta3.c
+++ b/xdelta3/xdelta3.c
@@ -329,14 +329,14 @@
329 329
330typedef enum { 330typedef enum {
331 VCD_DJW_ID = 1, 331 VCD_DJW_ID = 1,
332 VCD_FGK_ID = 16, /* Note: these are not standard IANA-allocated IDs! */ 332 VCD_FGK_ID = 16 /* Note: these are not standard IANA-allocated IDs! */
333} xd3_secondary_ids; 333} xd3_secondary_ids;
334 334
335typedef enum { 335typedef enum {
336 SEC_NOFLAGS = 0, 336 SEC_NOFLAGS = 0,
337 337
338 /* Note: SEC_COUNT_FREQS Not implemented (to eliminate 1st Huffman pass) */ 338 /* Note: SEC_COUNT_FREQS Not implemented (to eliminate 1st Huffman pass) */
339 SEC_COUNT_FREQS = (1 << 0), 339 SEC_COUNT_FREQS = (1 << 0)
340} xd3_secondary_flags; 340} xd3_secondary_flags;
341 341
342typedef enum { 342typedef enum {
@@ -344,7 +344,7 @@ typedef enum {
344 * compressor. */ 344 * compressor. */
345 INST_SECTION, /* The header section is not compressed, therefore not 345 INST_SECTION, /* The header section is not compressed, therefore not
346 * listed here. */ 346 * listed here. */
347 ADDR_SECTION, 347 ADDR_SECTION
348} xd3_section_type; 348} xd3_section_type;
349 349
350typedef unsigned int xd3_rtype; 350typedef unsigned int xd3_rtype;
@@ -782,6 +782,44 @@ const xd3_sec_type djw_sec_type =
782#endif /* __XDELTA3_C_HEADER_PASS__ */ 782#endif /* __XDELTA3_C_HEADER_PASS__ */
783#ifdef __XDELTA3_C_INLINE_PASS__ 783#ifdef __XDELTA3_C_INLINE_PASS__
784 784
785const uint16_t __single_hash[256] =
786{
787 /* Random numbers generated using SLIB's pseudo-random number generator.
788 * This hashes the input alphabet. */
789 0xbcd1, 0xbb65, 0x42c2, 0xdffe, 0x9666, 0x431b, 0x8504, 0xeb46,
790 0x6379, 0xd460, 0xcf14, 0x53cf, 0xdb51, 0xdb08, 0x12c8, 0xf602,
791 0xe766, 0x2394, 0x250d, 0xdcbb, 0xa678, 0x02af, 0xa5c6, 0x7ea6,
792 0xb645, 0xcb4d, 0xc44b, 0xe5dc, 0x9fe6, 0x5b5c, 0x35f5, 0x701a,
793 0x220f, 0x6c38, 0x1a56, 0x4ca3, 0xffc6, 0xb152, 0x8d61, 0x7a58,
794 0x9025, 0x8b3d, 0xbf0f, 0x95a3, 0xe5f4, 0xc127, 0x3bed, 0x320b,
795 0xb7f3, 0x6054, 0x333c, 0xd383, 0x8154, 0x5242, 0x4e0d, 0x0a94,
796 0x7028, 0x8689, 0x3a22, 0x0980, 0x1847, 0xb0f1, 0x9b5c, 0x4176,
797 0xb858, 0xd542, 0x1f6c, 0x2497, 0x6a5a, 0x9fa9, 0x8c5a, 0x7743,
798 0xa8a9, 0x9a02, 0x4918, 0x438c, 0xc388, 0x9e2b, 0x4cad, 0x01b6,
799 0xab19, 0xf777, 0x365f, 0x1eb2, 0x091e, 0x7bf8, 0x7a8e, 0x5227,
800 0xeab1, 0x2074, 0x4523, 0xe781, 0x01a3, 0x163d, 0x3b2e, 0x287d,
801 0x5e7f, 0xa063, 0xb134, 0x8fae, 0x5e8e, 0xb7b7, 0x4548, 0x1f5a,
802 0xfa56, 0x7a24, 0x900f, 0x42dc, 0xcc69, 0x02a0, 0x0b22, 0xdb31,
803 0x71fe, 0x0c7d, 0x1732, 0x1159, 0xcb09, 0xe1d2, 0x1351, 0x52e9,
804 0xf536, 0x5a4f, 0xc316, 0x6bf9, 0x8994, 0xb774, 0x5f3e, 0xf6d6,
805 0x3a61, 0xf82c, 0xcc22, 0x9d06, 0x299c, 0x09e5, 0x1eec, 0x514f,
806 0x8d53, 0xa650, 0x5c6e, 0xc577, 0x7958, 0x71ac, 0x8916, 0x9b4f,
807 0x2c09, 0x5211, 0xf6d8, 0xcaaa, 0xf7ef, 0x287f, 0x7a94, 0xab49,
808 0xfa2c, 0x7222, 0xe457, 0xd71a, 0x00c3, 0x1a76, 0xe98c, 0xc037,
809 0x8208, 0x5c2d, 0xdfda, 0xe5f5, 0x0b45, 0x15ce, 0x8a7e, 0xfcad,
810 0xaa2d, 0x4b5c, 0xd42e, 0xb251, 0x907e, 0x9a47, 0xc9a6, 0xd93f,
811 0x085e, 0x35ce, 0xa153, 0x7e7b, 0x9f0b, 0x25aa, 0x5d9f, 0xc04d,
812 0x8a0e, 0x2875, 0x4a1c, 0x295f, 0x1393, 0xf760, 0x9178, 0x0f5b,
813 0xfa7d, 0x83b4, 0x2082, 0x721d, 0x6462, 0x0368, 0x67e2, 0x8624,
814 0x194d, 0x22f6, 0x78fb, 0x6791, 0xb238, 0xb332, 0x7276, 0xf272,
815 0x47ec, 0x4504, 0xa961, 0x9fc8, 0x3fdc, 0xb413, 0x007a, 0x0806,
816 0x7458, 0x95c6, 0xccaa, 0x18d6, 0xe2ae, 0x1b06, 0xf3f6, 0x5050,
817 0xc8e8, 0xf4ac, 0xc04c, 0xf41c, 0x992f, 0xae44, 0x5f1b, 0x1113,
818 0x1738, 0xd9a8, 0x19ea, 0x2d33, 0x9698, 0x2fe9, 0x323f, 0xcde2,
819 0x6d71, 0xe37d, 0xb697, 0x2c4f, 0x4373, 0x9102, 0x075d, 0x8e25,
820 0x1672, 0xec28, 0x6acb, 0x86cc, 0x186e, 0x9414, 0xd674, 0xd1a5
821};
822
785/**************************************************************** 823/****************************************************************
786 Instruction tables 824 Instruction tables
787 *****************************************************************/ 825 *****************************************************************/
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h
index 39e0c17..b31cbe9 100644
--- a/xdelta3/xdelta3.h
+++ b/xdelta3/xdelta3.h
@@ -293,30 +293,12 @@ typedef int (xd3_comp_table_func) (xd3_stream *stream,
293#define XD3_ASSERT(x) (void)0 293#define XD3_ASSERT(x) (void)0
294#endif /* XD3_DEBUG */ 294#endif /* XD3_DEBUG */
295 295
296#ifdef __GNUC__
297#ifndef max
298#define max(x,y) ({ \
299 const typeof(x) _x = (x); \
300 const typeof(y) _y = (y); \
301 (void) (&_x == &_y); \
302 _x > _y ? _x : _y; })
303#endif /* __GNUC__ */
304
305#ifndef min
306#define min(x,y) ({ \
307 const typeof(x) _x = (x); \
308 const typeof(y) _y = (y); \
309 (void) (&_x == &_y); \
310 _x < _y ? _x : _y; })
311#endif
312#else /* __GNUC__ */
313#ifndef max 296#ifndef max
314#define max(x,y) ((x) < (y) ? (y) : (x)) 297#define max(x,y) ((x) < (y) ? (y) : (x))
315#endif 298#endif
316#ifndef min 299#ifndef min
317#define min(x,y) ((x) < (y) ? (x) : (y)) 300#define min(x,y) ((x) < (y) ? (x) : (y))
318#endif 301#endif
319#endif /* __GNUC__ */
320 302
321/**************************************************************** 303/****************************************************************
322 PUBLIC ENUMS 304 PUBLIC ENUMS
@@ -351,7 +333,7 @@ typedef enum {
351 XD3_INVALID_INPUT = -17712, /* invalid input/decoder error */ 333 XD3_INVALID_INPUT = -17712, /* invalid input/decoder error */
352 XD3_NOSECOND = -17713, /* when secondary compression finds no 334 XD3_NOSECOND = -17713, /* when secondary compression finds no
353 improvement. */ 335 improvement. */
354 XD3_UNIMPLEMENTED = -17714, /* currently VCD_TARGET */ 336 XD3_UNIMPLEMENTED = -17714 /* currently VCD_TARGET */
355} xd3_rvalues; 337} xd3_rvalues;
356 338
357/* special values in config->flags */ 339/* special values in config->flags */
@@ -408,7 +390,7 @@ typedef enum
408 XD3_COMPLEVEL_2 = (2 << XD3_COMPLEVEL_SHIFT), 390 XD3_COMPLEVEL_2 = (2 << XD3_COMPLEVEL_SHIFT),
409 XD3_COMPLEVEL_3 = (3 << XD3_COMPLEVEL_SHIFT), 391 XD3_COMPLEVEL_3 = (3 << XD3_COMPLEVEL_SHIFT),
410 XD3_COMPLEVEL_6 = (6 << XD3_COMPLEVEL_SHIFT), 392 XD3_COMPLEVEL_6 = (6 << XD3_COMPLEVEL_SHIFT),
411 XD3_COMPLEVEL_9 = (9 << XD3_COMPLEVEL_SHIFT), 393 XD3_COMPLEVEL_9 = (9 << XD3_COMPLEVEL_SHIFT)
412 394
413} xd3_flags; 395} xd3_flags;
414 396
@@ -423,7 +405,7 @@ typedef enum
423 XD3_SMATCH_FAST = 2, 405 XD3_SMATCH_FAST = 2,
424 XD3_SMATCH_FASTER = 3, 406 XD3_SMATCH_FASTER = 3,
425 XD3_SMATCH_FASTEST = 4, 407 XD3_SMATCH_FASTEST = 4,
426 XD3_SMATCH_SOFT = 5, 408 XD3_SMATCH_SOFT = 5
427} xd3_smatch_cfg; 409} xd3_smatch_cfg;
428 410
429/********************************************************************* 411/*********************************************************************
@@ -448,7 +430,7 @@ typedef enum {
448 source/target. */ 430 source/target. */
449 MATCH_FORWARD = 2, /* currently expanding a match forward in the 431 MATCH_FORWARD = 2, /* currently expanding a match forward in the
450 source/target. */ 432 source/target. */
451 MATCH_SEARCHING = 3, /* currently searching for a match. */ 433 MATCH_SEARCHING = 3 /* currently searching for a match. */
452 434
453} xd3_match_state; 435} xd3_match_state;
454 436
@@ -467,7 +449,7 @@ typedef enum {
467 ENC_FLUSH = 4, /* currently emitting output. */ 449 ENC_FLUSH = 4, /* currently emitting output. */
468 ENC_POSTOUT = 5, /* after an output section. */ 450 ENC_POSTOUT = 5, /* after an output section. */
469 ENC_POSTWIN = 6, /* after all output sections. */ 451 ENC_POSTWIN = 6, /* after all output sections. */
470 ENC_ABORTED = 7, /* abort. */ 452 ENC_ABORTED = 7 /* abort. */
471} xd3_encode_state; 453} xd3_encode_state;
472 454
473/* The xd3_decode_input state machine steps through these states in 455/* The xd3_decode_input state machine steps through these states in
@@ -520,7 +502,7 @@ typedef enum {
520 502
521 DEC_FINISH = 23, /* window finished */ 503 DEC_FINISH = 23, /* window finished */
522 504
523 DEC_ABORTED = 24, /* xd3_abort_stream */ 505 DEC_ABORTED = 24 /* xd3_abort_stream */
524} xd3_decode_state; 506} xd3_decode_state;
525 507
526/************************************************************ 508/************************************************************
@@ -841,8 +823,7 @@ struct _xd3_stream
841 * if there is at least one 823 * if there is at least one
842 * match in the buffer. */ 824 * match in the buffer. */
843 825
844 // SRCWIN 826 /* SRCWIN: these variables plus srcwin_maxsz above (set by config) */
845 // these variables plus srcwin_maxsz above (set by config)
846 int srcwin_decided; /* boolean: true if srclen and 827 int srcwin_decided; /* boolean: true if srclen and
847 srcbase have been 828 srcbase have been
848 decided. */ 829 decided. */
@@ -851,7 +832,7 @@ struct _xd3_stream
851 decided early. */ 832 decided early. */
852 xoff_t srcwin_cksum_pos; /* Source checksum position */ 833 xoff_t srcwin_cksum_pos; /* Source checksum position */
853 834
854 // MATCH 835 /* MATCH */
855 xd3_match_state match_state; /* encoder match state */ 836 xd3_match_state match_state; /* encoder match state */
856 xoff_t match_srcpos; /* current match source 837 xoff_t match_srcpos; /* current match source
857 position relative to 838 position relative to