summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xxdelta3/Makefile6
-rwxr-xr-xxdelta3/xdelta3.c15
-rwxr-xr-xxdelta3/xdelta3.h17
3 files changed, 24 insertions, 14 deletions
diff --git a/xdelta3/Makefile b/xdelta3/Makefile
index 1e936e4..6cac09e 100755
--- a/xdelta3/Makefile
+++ b/xdelta3/Makefile
@@ -2,7 +2,7 @@
2PYTHON = python 2PYTHON = python
3PYTGT = build/temp.linux-i686-2.3/xdelta3.so 3PYTGT = build/temp.linux-i686-2.3/xdelta3.so
4 4
5TARGETS = xdelta3 xdelta3-64 xdelta3-everything \ 5TARGETS = xdelta3 xdelta3-2 xdelta3-64 xdelta3-everything \
6 xdelta3-Opg xdelta3-64-O xdelta3-Op xdelta3-O \ 6 xdelta3-Opg xdelta3-64-O xdelta3-Op xdelta3-O \
7 xdelta3-decoder xdelta3-decoder-nomain.o \ 7 xdelta3-decoder xdelta3-decoder-nomain.o \
8 $(PYTGT) \ 8 $(PYTGT) \
@@ -41,6 +41,10 @@ xdelta3: $(SOURCES)
41 $(CC) -g -Wall -Wshadow xdelta3.c -o xdelta3 -DXD3_MAIN=1 -DGENERIC_ENCODE_TABLES=1 \ 41 $(CC) -g -Wall -Wshadow xdelta3.c -o xdelta3 -DXD3_MAIN=1 -DGENERIC_ENCODE_TABLES=1 \
42 -DXD3_USE_LARGEFILE64=1 -DREGRESSION_TEST=1 -DXD3_DEBUG=1 -DSECONDARY_DJW=1 -lm 42 -DXD3_USE_LARGEFILE64=1 -DREGRESSION_TEST=1 -DXD3_DEBUG=1 -DSECONDARY_DJW=1 -lm
43 43
44xdelta3-2: $(SOURCES)
45 $(CC) -g -Wall -Wshadow xdelta3.c -o xdelta3-2 -DXD3_MAIN=1 -DGENERIC_ENCODE_TABLES=1 \
46 -DXD3_USE_LARGEFILE64=1 -DREGRESSION_TEST=1 -DXD3_DEBUG=2 -DSECONDARY_DJW=1 -lm
47
44xdelta3-decoder: $(SOURCES) 48xdelta3-decoder: $(SOURCES)
45 $(CC) -O2 -Wall -Wshadow xdelta3.c \ 49 $(CC) -O2 -Wall -Wshadow xdelta3.c \
46 -DXD3_ENCODER=0 -DXD3_MAIN=1 -DSECONDARY_FGK=0 -DSECONDARY_DJW=0 \ 50 -DXD3_ENCODER=0 -DXD3_MAIN=1 -DSECONDARY_FGK=0 -DSECONDARY_DJW=0 \
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c
index 3f34c35..8229603 100755
--- a/xdelta3/xdelta3.c
+++ b/xdelta3/xdelta3.c
@@ -5007,7 +5007,8 @@ xd3_srcwin_move_point (xd3_stream *stream, usize_t *next_move_point)
5007 5007
5008 /* Begin by advancing at twice the input rate, up to half the maximum window size. */ 5008 /* Begin by advancing at twice the input rate, up to half the maximum window size. */
5009 logical_input_cksum_pos = min((stream->total_in + stream->input_position) * 2, 5009 logical_input_cksum_pos = min((stream->total_in + stream->input_position) * 2,
5010 (stream->total_in + stream->input_position) + (stream->srcwin_maxsz / 2)); 5010 (stream->total_in + stream->input_position) +
5011 (stream->srcwin_maxsz / 2));
5011 5012
5012 /* If srcwin_cksum_pos is already greater, wait until the difference is met. */ 5013 /* If srcwin_cksum_pos is already greater, wait until the difference is met. */
5013 if (stream->srcwin_cksum_pos > logical_input_cksum_pos) 5014 if (stream->srcwin_cksum_pos > logical_input_cksum_pos)
@@ -5019,12 +5020,14 @@ xd3_srcwin_move_point (xd3_stream *stream, usize_t *next_move_point)
5019 5020
5020 /* If the stream has matched beyond the srcwin_cksum_pos (good), we shouldn't 5021 /* If the stream has matched beyond the srcwin_cksum_pos (good), we shouldn't
5021 * begin reading so far back. */ 5022 * begin reading so far back. */
5022 int diff = logical_input_cksum_pos - stream->srcwin_cksum_pos; 5023 if (stream->match_maxaddr > stream->srcwin_cksum_pos)
5024 {
5025 stream->srcwin_cksum_pos = stream->match_maxaddr;
5026 }
5023 5027
5024 if (diff > stream->srcwin_size) 5028 if (logical_input_cksum_pos < stream->srcwin_cksum_pos)
5025 { 5029 {
5026 // TODO: I think this should use the last match position in the source! 5030 logical_input_cksum_pos = stream->srcwin_cksum_pos;
5027 //stream->srcwin_cksum_pos = logical_input_cksum_pos - stream->srcwin_size;
5028 } 5031 }
5029 5032
5030 /* Advance an extra srcwin_size bytes */ 5033 /* Advance an extra srcwin_size bytes */
@@ -5060,7 +5063,7 @@ xd3_srcwin_move_point (xd3_stream *stream, usize_t *next_move_point)
5060 } 5063 }
5061 5064
5062 onblk -= stream->large_look; 5065 onblk -= stream->large_look;
5063 diff = logical_input_cksum_pos - stream->srcwin_cksum_pos; 5066 int diff = logical_input_cksum_pos - stream->srcwin_cksum_pos;
5064 onblk = min(blkoff + diff, onblk); 5067 onblk = min(blkoff + diff, onblk);
5065 5068
5066 while (blkoff <= onblk) 5069 while (blkoff <= onblk)
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h
index eb11141..b538d77 100755
--- a/xdelta3/xdelta3.h
+++ b/xdelta3/xdelta3.h
@@ -234,7 +234,9 @@ typedef int (xd3_getblk_func) (xd3_stream *stream,
234 * alternate code tables. See the comments & code enabled by GENERIC_ENCODE_TABLES. */ 234 * alternate code tables. See the comments & code enabled by GENERIC_ENCODE_TABLES. */
235 235
236typedef const xd3_dinst* (xd3_code_table_func) (void); 236typedef const xd3_dinst* (xd3_code_table_func) (void);
237typedef int (xd3_comp_table_func) (xd3_stream *stream, const uint8_t **data, usize_t *size); 237typedef int (xd3_comp_table_func) (xd3_stream *stream,
238 const uint8_t **data,
239 usize_t *size);
238 240
239 241
240/* Some junk. */ 242/* Some junk. */
@@ -294,9 +296,9 @@ typedef enum {
294 XD3_GOTHEADER = -17706, /* (decode-only) after the initial VCDIFF & first window header */ 296 XD3_GOTHEADER = -17706, /* (decode-only) after the initial VCDIFF & first window header */
295 XD3_WINSTART = -17707, /* notification: returned before a window is processed, giving a 297 XD3_WINSTART = -17707, /* notification: returned before a window is processed, giving a
296 * chance to XD3_SKIP_WINDOW or not XD3_SKIP_EMIT that window. */ 298 * chance to XD3_SKIP_WINDOW or not XD3_SKIP_EMIT that window. */
297 XD3_WINFINISH = -17708, /* notification: returned after encode/decode & output for a window */ 299 XD3_WINFINISH = -17708, /* notification: returned after encode/decode & output for a window */
298 XD3_TOOFARBACK = -17709, /* (encoder only) may be returned by getblk() if the block is too old */ 300 XD3_TOOFARBACK = -17709, /* (encoder only) may be returned by getblk() if the block is too old */
299 XD3_INTERNAL = -17710, /* internal error */ 301 XD3_INTERNAL = -17710, /* internal error */
300 302
301} xd3_rvalues; 303} xd3_rvalues;
302 304
@@ -314,7 +316,7 @@ typedef enum
314 316
315 XD3_SEC_NODATA = (1 << 7), /* disable secondary compression of the data section. */ 317 XD3_SEC_NODATA = (1 << 7), /* disable secondary compression of the data section. */
316 XD3_SEC_NOINST = (1 << 8), /* disable secondary compression of the inst section. */ 318 XD3_SEC_NOINST = (1 << 8), /* disable secondary compression of the inst section. */
317 XD3_SEC_NOADDR = (1 << 9), /* disable secondary compression of the addr section (which is most random). */ 319 XD3_SEC_NOADDR = (1 << 9), /* disable secondary compression of the addr section. */
318 320
319 XD3_SEC_OTHER = (XD3_SEC_NODATA | XD3_SEC_NOINST | XD3_SEC_NOADDR), 321 XD3_SEC_OTHER = (XD3_SEC_NODATA | XD3_SEC_NOINST | XD3_SEC_NOADDR),
320 322
@@ -604,9 +606,10 @@ struct _xd3_config
604 uint promote; /* whether to promote matches in the hash chain */ 606 uint promote; /* whether to promote matches in the hash chain */
605}; 607};
606 608
607/* The primary source file object. You create one of these objects and initialize the first 609/* The primary source file object. You create one of these objects and initialize the
608 * four fields. This library maintains the next 5 fields. The configured getblk implementation is 610 * first four fields. This library maintains the next 5 fields. The configured getblk
609 * responsible for setting the final 3 fields when called (and/or when XD3_GETSRCBLK is returned). 611 * implementation is responsible for setting the final 3 fields when called (and/or when
612 * XD3_GETSRCBLK is returned).
610 */ 613 */
611struct _xd3_source 614struct _xd3_source
612{ 615{