summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore16
-rw-r--r--xdelta3/Makefile.am11
-rw-r--r--xdelta3/Makefile.mingw238
-rw-r--r--xdelta3/Makefile.orig332
-rw-r--r--xdelta3/README.md (renamed from xdelta3/README)19
-rw-r--r--xdelta3/configure.ac34
-rw-r--r--xdelta3/examples/README.md (renamed from xdelta3/examples/README)0
-rw-r--r--xdelta3/readme.txt34
-rw-r--r--xdelta3/releases/xdelta3-3.0.1.tar.gzbin678351 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.2-x86-32.exebin109568 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.2.tar.gzbin664706 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.3.tar.gzbin638940 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.4-x86-32.exebin110080 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.4.tar.gzbin481462 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.5-x86-64.exebin223744 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.5.tar.gzbin483596 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.6-win32.exebin194560 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.6-x64.exebin223744 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.6.tar.gzbin495860 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.7.tar.gzbin481371 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.7.x86-32.exebin194560 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.7.x86-64.exebin223744 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.8.tar.xzbin429964 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.8.x86-32.exebin314880 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3-3.0.8.x86-64.exebin332800 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3.0.0.tar.gzbin282201 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3.0s.msibin331264 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3.0s.tar.gzbin196298 -> 0 bytes
-rwxr-xr-xxdelta3/releases/xdelta3.0s.x86-32.exebin192512 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3.0t.msibin338944 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3.0t.tar.gzbin203424 -> 0 bytes
-rwxr-xr-xxdelta3/releases/xdelta3.0t.x86-32.exebin192512 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta3.0u.x86-32.exebin227840 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30e.tar.gzbin145229 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30g.tar.gzbin139793 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30h.ppc-osx.binbin147404 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30h.tar.gzbin139972 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30h.x86-32.exebin102400 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30i.tar.gzbin141095 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30i.x86-32.exebin102400 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30j.tar.gzbin161201 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30j.x86-32.exebin98304 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30k.tar.gzbin161860 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30k.x86-32.exebin98304 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30l.tar.gzbin161964 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30l.x86-32.exebin98304 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30m.tar.gzbin162526 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30m.x86-32.exebin98304 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30n.tar.gzbin158197 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30n.x86-32.exebin102400 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30o.tar.gzbin177573 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30o.x86-32.exebin102400 -> 0 bytes
-rwxr-xr-xxdelta3/releases/xdelta30p.tar.gzbin179763 -> 0 bytes
-rwxr-xr-xxdelta3/releases/xdelta30p.x86-32.exebin102400 -> 0 bytes
-rw-r--r--xdelta3/releases/xdelta30q.tar.gzbin180962 -> 0 bytes
-rwxr-xr-xxdelta3/releases/xdelta30q.x86-32.exebin102400 -> 0 bytes
-rwxr-xr-xxdelta3/releases/xdelta30r.tar.gzbin183110 -> 0 bytes
-rwxr-xr-xxdelta3/run_release.sh301
-rw-r--r--xdelta3/testing/file.h5
-rw-r--r--xdelta3/testing/modify.h10
-rw-r--r--xdelta3/testing/regtest.cc118
-rw-r--r--xdelta3/xdelta3-blkcache.h30
-rw-r--r--xdelta3/xdelta3-decode.h52
-rw-r--r--xdelta3/xdelta3-djw.h6
-rw-r--r--xdelta3/xdelta3-internal.h213
-rw-r--r--xdelta3/xdelta3-lzma.h2
-rw-r--r--xdelta3/xdelta3-main.h115
-rw-r--r--xdelta3/xdelta3-merge.h2
-rw-r--r--xdelta3/xdelta3-test.h67
-rw-r--r--xdelta3/xdelta3.c278
-rw-r--r--xdelta3/xdelta3.h128
-rw-r--r--xdelta3/xdelta3.prj2
-rwxr-xr-xxdelta3/xdelta3.vcxproj11
73 files changed, 876 insertions, 1148 deletions
diff --git a/.gitignore b/.gitignore
index 366b29f..58a9163 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,20 +1,32 @@
1*.o 1*.o
2*~ 2*~
3 3.deps
4.dirstamp
5INSTALL
6Makefile
4Makefile.in 7Makefile.in
5aclocal.m4 8aclocal.m4
6autom4te.cache 9autom4te.cache
7build 10build
8compile 11compile
9config.guess 12config.guess
13config.h
10config.h.in 14config.h.in
15config.log
16config.status
17config.sub
11config.sub 18config.sub
12configure 19configure
13depcomp 20depcomp
14ltmain.sh 21libtool
15libtool.m4 22libtool.m4
23ltmain.sh
16ltoptions.m4 24ltoptions.m4
17ltsugar.m4 25ltsugar.m4
18ltversion.m4 26ltversion.m4
19lt~obsolete.m4 27lt~obsolete.m4
20missing 28missing
29stamp-h1
30xdelta3
31xdelta3decode
32xdelta3regtest
diff --git a/xdelta3/Makefile.am b/xdelta3/Makefile.am
index ffc35a4..322d88d 100644
--- a/xdelta3/Makefile.am
+++ b/xdelta3/Makefile.am
@@ -43,8 +43,7 @@ xdelta3checksum_SOURCES = $(common_SOURCES) \
43# Note: for extra sanity checks, enable -Wconversion. Note there 43# Note: for extra sanity checks, enable -Wconversion. Note there
44# are a lot of false positives. 44# are a lot of false positives.
45WFLAGS = -Wall -Wshadow -fno-builtin -Wextra -Wsign-compare \ 45WFLAGS = -Wall -Wshadow -fno-builtin -Wextra -Wsign-compare \
46 -Wno-unused-parameter -Wformat # -Wconversion 46 -Wno-unused-parameter -Wformat -Wno-unused-function # -Wconversion
47
48 47
49C_WFLAGS = $(WFLAGS) -pedantic -std=c99 48C_WFLAGS = $(WFLAGS) -pedantic -std=c99
50CXX_WFLAGS = $(WFLAGS) 49CXX_WFLAGS = $(WFLAGS)
@@ -53,7 +52,6 @@ common_CFLAGS = \
53 -DREGRESSION_TEST=1 \ 52 -DREGRESSION_TEST=1 \
54 -DSECONDARY_DJW=1 \ 53 -DSECONDARY_DJW=1 \
55 -DSECONDARY_FGK=1 \ 54 -DSECONDARY_FGK=1 \
56 -DXD3_POSIX=1 \
57 -DXD3_MAIN=1 55 -DXD3_MAIN=1
58 56
59if DEBUG_SYMBOLS 57if DEBUG_SYMBOLS
@@ -91,10 +89,11 @@ xdelta3checksum_CFLAGS = \
91man1_MANS = xdelta3.1 89man1_MANS = xdelta3.1
92 90
93EXTRA_DIST = \ 91EXTRA_DIST = \
92 README.md \
93 run_release.sh \
94 draft-korn-vcdiff.txt \ 94 draft-korn-vcdiff.txt \
95 README \
96 examples/Makefile \ 95 examples/Makefile \
97 examples/README \ 96 examples/README.md \
98 examples/checksum_test.cc \ 97 examples/checksum_test.cc \
99 examples/compare_test.c \ 98 examples/compare_test.c \
100 examples/encode_decode_test.c \ 99 examples/encode_decode_test.c \
@@ -115,8 +114,6 @@ EXTRA_DIST = \
115 examples/iOS/xdelta3-ios-test/xdelta3-ios-test/main.m \ 114 examples/iOS/xdelta3-ios-test/xdelta3-ios-test/main.m \
116 examples/iOS/xdelta3-ios-test/xdelta3-ios-test/xdelta3-ios-test-Info.plist \ 115 examples/iOS/xdelta3-ios-test/xdelta3-ios-test/xdelta3-ios-test-Info.plist \
117 examples/iOS/xdelta3-ios-test/xdelta3-ios-test/xdelta3-ios-test-Prefix.pch \ 116 examples/iOS/xdelta3-ios-test/xdelta3-ios-test/xdelta3-ios-test-Prefix.pch \
118 Makefile.mingw \
119 Makefile.orig \
120 testing/xdelta3-regtest.py \ 117 testing/xdelta3-regtest.py \
121 testing/xdelta3-test.py \ 118 testing/xdelta3-test.py \
122 xdelta3.1 \ 119 xdelta3.1 \
diff --git a/xdelta3/Makefile.mingw b/xdelta3/Makefile.mingw
deleted file mode 100644
index 20ea9be..0000000
--- a/xdelta3/Makefile.mingw
+++ /dev/null
@@ -1,238 +0,0 @@
1# xdelta 3 - delta compression tools and library
2# Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007. Joshua P. MacDonald
3
4UNAME = $(shell uname)
5CYGWIN = $(findstring CYGWIN, $(UNAME))
6MINGW = $(findstring MINGW32, $(UNAME))
7PYVER = 2.5
8
9ifneq ("$(CYGWIN)", "")
10SWIGTGT = xdelta3module.dll
11PYTGT = build/lib.cygwin-1.5.24-i686-$(PYVER)/xdelta3main.dll
12else
13ifneq ("$(MINGW)", "")
14# FIXME: WHAT TO DO HERE???
15# FIXME: WHAT IF WE ARE CROSS-COMPILING???
16endif
17endif
18
19SOURCES = xdelta3-cfgs.h \
20 xdelta3-decode.h \
21 xdelta3-djw.h \
22 xdelta3-fgk.h \
23 xdelta3-hash.h \
24 xdelta3-list.h \
25 xdelta3-main.h \
26 xdelta3-python.h \
27 xdelta3-second.h \
28 xdelta3-test.h \
29 xdelta3-test2.h \
30 xdelta3.c \
31 xdelta3.h
32
33TARGETS = xdelta3-debug.exe \
34 xdelta3.exe \
35 xdelta3-debug2.exe \
36 xdelta3-debug3.exe \
37 xdelta3.o \
38 xdelta3_wrap.o \
39 xdelta3-32.exe \
40 xdelta3-64.exe \
41 xdelta3-everything.exe \
42 xdelta3-decoder.exe xdelta3-decoder-nomain.o \
43 xdelta3-nosec.o xdelta3-all.o xdelta3-fgk.o \
44 xdelta3-noext.exe xdelta3-tools.exe \
45 xdelta3-notools.exe \
46 xdelta3_wrap.c xdelta3.py \
47 $(PYTGT) $(SWIGTGT)
48
49PYTHON = python
50
51WIXDIR = "/cygdrive/c/Program Files/wix2.0.4820"
52# FIXME: MinGW ????
53
54CFLAGS= -Wall -Wshadow -fno-builtin
55XDWINFLAGS:=-DXD3_STDIO=0 -DXD3_POSIX=0 -DXD3_WIN32=1 -DEXTERNAL_COMPRESSION=0
56
57# $Format: "REL=$Xdelta3Version$" $
58REL=3.0.1
59
60RELDIR = xdelta$(REL)
61
62EXTRA = Makefile COPYING linkxd3lib.c badcopy.c xdelta3.swig \
63 draft-korn-vcdiff.txt xdelta3.vcproj badcopy.vcproj \
64 xdelta3-regtest.py xdelta3-test.py setup.py \
65 examples/Makefile examples/small_page_test.c \
66 examples/README examples/encode_decode_test.c \
67 examples/compare_test.c examples/speed_test.c \
68 examples/test.h examples/checksum_test.cc \
69 xdelta3.py xdelta3_wrap.c xdelta3.wxs xdelta3.wxi \
70 README readme.txt
71
72SWIG_FLAGS = -DXD3_DEBUG=0 \
73 -DEXTERNAL_COMPRESSION=0 \
74 -DXD3_USE_LARGEFILE64=1 \
75 -DSECONDARY_DJW=1 \
76 -DVCDIFF_TOOLS=1 \
77 -DSWIG_MODULE=1
78
79all: xdelta3-debug.exe xdelta3.exe
80
81all-py: all $(PYTGT) $(SWIGTGT)
82
83all-targets: $(TARGETS)
84
85all-targets-test: all-targets test
86
87pytgt: $(PYTGT)
88swigtgt: $(SWIGTGT)
89
90test:
91 ./xdelta3-debug.exe test
92# FIXME: Not good when cross-compiling
93
94clean:
95 rm -f $(TARGETS)
96 rm -rf build Debug Release core cifs* *.stackdump *.exe \
97 xdelta3.ncb xdelta3.suo xdelta3.sln xdelta3.wixobj xdelta3.msi
98
99wix: xdelta3.wxs xdelta3.wxi readme.txt Release\xdelta3.exe
100 $(WIXDIR)/candle.exe xdelta3.wxs -out xdelta3.wixobj
101 $(WIXDIR)/light.exe xdelta3.wixobj -out xdelta3.msi
102# FIXME: MinGW ????
103
104xdelta3.exe: $(SOURCES)
105 $(CC) $(CFLAGS) -O3 xdelta3.c -lm -o xdelta3.exe \
106 $(XDWINFLAGS) \
107 -DREGRESSION_TEST=1 \
108 -DSECONDARY_DJW=1 \
109 -DSECONDARY_FGK=1 \
110 -DXD3_DEBUG=0 \
111 -DXD3_MAIN=1 \
112 -DXD3_USE_LARGEFILE64=1
113
114xdelta3-debug.exe: $(SOURCES)
115 $(CC) -g $(CFLAGS) xdelta3.c -lm -o xdelta3-debug.exe \
116 $(XDWINFLAGS) \
117 -DREGRESSION_TEST=1 \
118 -DSECONDARY_DJW=1 \
119 -DSECONDARY_FGK=1 \
120 -DXD3_DEBUG=1 \
121 -DXD3_MAIN=1 \
122 -DXD3_USE_LARGEFILE64=1
123
124xdelta3-32.exe: $(SOURCES)
125 $(CC) -O3 $(CFLAGS) xdelta3.c -lm -o xdelta3-32.exe \
126 $(XDWINFLAGS) \
127 -DXD3_DEBUG=1 \
128 -DXD3_USE_LARGEFILE64=0 \
129 -DREGRESSION_TEST=1 \
130 -DSECONDARY_DJW=1 \
131 -DSECONDARY_FGK=1 \
132 -DXD3_MAIN=1
133
134xdelta3-debug2.exe: $(SOURCES)
135 $(CC) -g $(CFLAGS) \
136 xdelta3.c -o xdelta3-debug2.exe \
137 $(XDWINFLAGS) \
138 -DXD3_DEBUG=2 \
139 -DXD3_MAIN=1 \
140 -DXD3_USE_LARGEFILE64=1 \
141 -DREGRESSION_TEST=1 \
142 -DSECONDARY_DJW=1 \
143 -DSECONDARY_FGK=1 \
144 -lm
145
146xdelta3-debug3.exe: $(SOURCES)
147 $(CC) -g $(CFLAGS) xdelta3.c -o xdelta3-debug3.exe \
148 $(XDWINFLAGS) \
149 -DXD3_MAIN=1 \
150 -DXD3_USE_LARGEFILE64=1 \
151 -DREGRESSION_TEST=1 \
152 -DXD3_DEBUG=3 \
153 -DSECONDARY_DJW=1 \
154 -DSECONDARY_FGK=1 \
155 -lm
156
157$(PYTGT): $(SOURCES) setup.py
158 $(PYTHON) setup.py install --verbose --compile --force
159
160xdelta3_wrap.c xdelta3.py: xdelta3.swig
161 swig -python xdelta3.swig
162
163xdelta3.o: $(SOURCES)
164 $(CC) -O3 $(CFLAGS) -c xdelta3.c $(SWIG_FLAGS) -o xdelta3.o
165
166xdelta3_wrap.o: xdelta3_wrap.c
167 $(CC) -O3 $(CFLAGS) $(SWIG_FLAGS) \
168 -DHAVE_CONFIG_H \
169 -I/usr/include/python$(PYVER) \
170 -I/usr/lib/python$(PYVER)/config \
171 -fpic \
172 -c xdelta3_wrap.c
173# FIXME: MinGW ????
174
175xdelta3module.dll: xdelta3_wrap.o xdelta3.o
176 gcc -shared -Wl,--enable-auto-image-base \
177 xdelta3.o \
178 xdelta3_wrap.o \
179 -L/usr/lib/python$(PYVER)/config \
180 -lpython$(PYVER) \
181 -o xdelta3module.dll
182 cp $(SWIGTGT) /usr/lib/python$(PYVER)/site-packages
183# FIXME: MinGW ????
184
185xdelta3-decoder.exe: $(SOURCES)
186 $(CC) -O3 -Wall -Wshadow xdelta3.c \
187 -DXD3_ENCODER=0 -DXD3_MAIN=1 -DSECONDARY_FGK=0 -DSECONDARY_DJW=0 \
188 $(XDWINFLAGS) -DVCDIFF_TOOLS=0 \
189 -o xdelta3-decoder.exe
190
191xdelta3-decoder-nomain.o: $(SOURCES) linkxd3lib.c
192 $(CC) -O3 -Wall -Wshadow xdelta3.c linkxd3lib.c \
193 -DXD3_ENCODER=0 -DSECONDARY_FGK=0 -DSECONDARY_DJW=0 \
194 -o xdelta3-decoder-nomain.o
195 strip xdelta3-decoder-nomain.o
196# FIXME: this OK with MinGW?? What's with strip??
197
198xdelta3-64.exe: $(SOURCES)
199 $(CC) -g $(CFLAGS) \
200 xdelta3.c \
201 -o xdelta3-64.exe \
202 $(XDWINFLAGS) \
203 -DXD3_MAIN=1 \
204 -DREGRESSION_TEST=1 \
205 -DXD3_DEBUG=0 \
206 -DXD3_USE_LARGEFILE64=1 \
207 -lm
208
209xdelta3-everything.exe: $(SOURCES)
210 $(CC) -g $(CFLAGS) \
211 xdelta3.c \
212 -o xdelta3-everything.exe \
213 $(XDWINFLAGS) \
214 -DXD3_MAIN=1 \
215 -DVCDIFF_TOOLS=1 \
216 -DREGRESSION_TEST=1 \
217 -DSECONDARY_FGK=1 \
218 -DSECONDARY_DJW=1 \
219 -DXD3_DEBUG=1 \
220 -lm
221
222xdelta3-nosec.o: $(SOURCES)
223 $(CC) -O3 $(CFLAGS) -c xdelta3.c $(XDWINFLAGS) -DSECONDARY_FGK=0 -DSECONDARY_DJW=0 -o xdelta3-nosec.o
224
225xdelta3-all.o: $(SOURCES)
226 $(CC) -O3 $(CFLAGS) -c xdelta3.c $(XDWINFLAGS) -DSECONDARY_FGK=1 -DSECONDARY_DJW=1 -o xdelta3-all.o
227
228xdelta3-fgk.o: $(SOURCES)
229 $(CC) -O3 $(CFLAGS) -c xdelta3.c $(XDWINFLAGS) -DSECONDARY_FGK=1 -DSECONDARY_DJW=0 -o xdelta3-fgk.o
230
231xdelta3-noext.exe: $(SOURCES)
232 $(CC) -O3 $(CFLAGS) xdelta3.c $(XDWINFLAGS) -DEXTERNAL_COMPRESSION=0 -DXD3_MAIN=1 -o xdelta3-noext.exe
233
234xdelta3-tools.exe: $(SOURCES)
235 $(CC) -O3 $(CFLAGS) xdelta3.c $(XDWINFLAGS) -DXD3_MAIN=1 -o xdelta3-tools.exe
236
237xdelta3-notools.exe: $(SOURCES)
238 $(CC) -O3 $(CFLAGS) xdelta3.c $(XDWINFLAGS) -DXD3_MAIN=1 -DVCDIFF_TOOLS=0 -o xdelta3-notools.exe
diff --git a/xdelta3/Makefile.orig b/xdelta3/Makefile.orig
deleted file mode 100644
index 33b0ea4..0000000
--- a/xdelta3/Makefile.orig
+++ /dev/null
@@ -1,332 +0,0 @@
1# xdelta 3 - delta compression tools and library
2# Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007. Joshua P. MacDonald
3
4UNAME = $(shell uname)
5CYGWIN = $(findstring CYGWIN, $(UNAME))
6DARWIN = $(findstring Darwin, $(UNAME))
7PYVER = 2.6
8
9ifeq ("$(CYGWIN)", "")
10SWIGTGT = xdelta3module.so
11PYTGT = build/lib.macosx-10.6-universal-2.6/xdelta3main.so
12else
13SWIGTGT = xdelta3module.dll
14PYTGT = build/lib.cygwin-1.5.24-i686-$(PYVER)/xdelta3main.dll
15endif
16
17SOURCES = xdelta3-blkcache.h \
18 xdelta3-cfgs.h \
19 xdelta3-decode.h \
20 xdelta3-djw.h \
21 xdelta3-fgk.h \
22 xdelta3-hash.h \
23 xdelta3-list.h \
24 xdelta3-main.h \
25 xdelta3-merge.h \
26 xdelta3-python.h \
27 xdelta3-second.h \
28 xdelta3-test.h \
29 xdelta3.c \
30 xdelta3.h
31
32TARGETS = xdelta3-debug \
33 xdelta3-debug32 \
34 xdelta3-debug64 \
35 xdelta3 \
36 xdelta3-debug2 \
37 xdelta3-debugstdio \
38 xdelta3.o \
39 xdelta3_wrap.o \
40 xdelta3-32 \
41 xdelta3-64 \
42 xdelta3-everything \
43 xdelta3-Opg \
44 xdelta3-64-O \
45 xdelta3-Op \
46 xdelta3-decoder xdelta3-decoder-nomain.o \
47 xdelta3-nosec.o xdelta3-all.o xdelta3-fgk.o \
48 xdelta3-noext xdelta3-tools \
49 xdelta3-notools \
50 xdelta3_wrap.c xdelta3.py \
51 $(PYTGT) $(SWIGTGT) \
52 xdelta3-warnings
53
54PYTHON = python
55
56WIXDIR = "/cygdrive/c/Program Files/wix2.0.4820"
57
58CFLAGS= -Wall -Wshadow -fno-builtin
59WFLAGS= -Wextra -Wsign-compare -Wconversion -Wextra -Wno-unused-parameter
60
61# $Format: "REL=$Xdelta3Version$" $
62REL=3.0.1
63
64RELDIR = xdelta$(REL)
65
66EXTRA = Makefile COPYING linkxd3lib.c badcopy.c xdelta3.swig \
67 draft-korn-vcdiff.txt xdelta3.vcproj badcopy.vcproj \
68 testing/xdelta3-regtest.py xdelta3-test.py setup.py \
69 examples/Makefile examples/small_page_test.c \
70 examples/README examples/encode_decode_test.c \
71 examples/compare_test.c examples/speed_test.c \
72 examples/test.h examples/checksum_test.cc \
73 xdelta3.py xdelta3_wrap.c xdelta3.wxs xdelta3.wxi \
74 testing/cmp.h testing/delta.h testing/file.h \
75 testing/modify.h testing/random.h testing/segment.h \
76 testing/sizes.h testing/test.h testing/Makefile \
77 testing/regtest.cc README readme.txt xdelta3.1
78
79SWIG_FLAGS = -DXD3_DEBUG=1 \
80 -DEXTERNAL_COMPRESSION=0 \
81 -DXD3_USE_LARGEFILE64=1 \
82 -DSECONDARY_DJW=1 \
83 -DVCDIFF_TOOLS=1 \
84 -DSWIG_MODULE=1
85
86all: xdelta3-debug32 xdelta3-debug64 xdelta3-debug2 xdelta3
87 (cd testing && make)
88
89all-py: all $(PYTGT) $(SWIGTGT)
90
91all-targets: $(TARGETS)
92
93all-targets-test: all-targets test
94
95pytgt: $(PYTGT)
96swigtgt: $(SWIGTGT)
97
98test:
99 ./xdelta3-debug test
100
101tar:
102 tar --exclude ".svn" -czf /tmp/$(RELDIR)-tmp.tar.gz $(SOURCES) $(EXTRA)
103 rm -rf /tmp/$(RELDIR)
104 mkdir /tmp/$(RELDIR)
105 (cd /tmp/$(RELDIR) && tar -xzf ../$(RELDIR)-tmp.tar.gz)
106 tar -czf ./$(RELDIR).tar.gz -C /tmp $(RELDIR)
107 +tar -tzf ./$(RELDIR).tar.gz
108 rm -rf /tmp/$(RELDIR)
109
110zip:
111 tar --exclude ".svn" -czf /tmp/$(RELDIR)-tmp.tar.gz $(SOURCES) $(EXTRA)
112 rm -rf /tmp/$(RELDIR)
113 mkdir /tmp/$(RELDIR)
114 (cd /tmp/$(RELDIR) && tar -xzf ../$(RELDIR)-tmp.tar.gz)
115 tar -czf ./$(RELDIR).tar.gz -C /tmp $(RELDIR)
116 +zip -r $(RELDIR).zip /tmp/$(RELDIR)
117 rm -rf /tmp/$(RELDIR)
118
119clean:
120 rm -f $(TARGETS)
121 rm -rf build Debug Release core cifs* *.stackdump *.exe *~ *.dSYM \
122 xdelta3.ncb xdelta3.suo xdelta3.sln xdelta3.wixobj xdelta3.msi
123
124wix: xdelta3.wxs xdelta3.wxi readme.txt Release\xdelta3.exe
125 $(WIXDIR)/candle.exe xdelta3.wxs -out xdelta3.wixobj
126 $(WIXDIR)/light.exe xdelta3.wixobj -out xdelta3.msi
127
128xdelta3: $(SOURCES)
129 $(CC) $(CFLAGS) -O3 xdelta3.c -lm -o xdelta3 \
130 -DREGRESSION_TEST=1 \
131 -DSECONDARY_DJW=1 \
132 -DSECONDARY_FGK=1 \
133 -DXD3_DEBUG=0 \
134 -DXD3_MAIN=1 \
135 -DXD3_POSIX=1 \
136 -DXD3_USE_LARGEFILE64=1
137
138xdelta3-debug32: $(SOURCES)
139 $(CC) -g $(CFLAGS) xdelta3.c -lm -o xdelta3-debug32 \
140 -arch i386 \
141 -DREGRESSION_TEST=1 \
142 -DSECONDARY_DJW=1 \
143 -DSECONDARY_FGK=1 \
144 -DXD3_DEBUG=1 \
145 -DXD3_MAIN=1 \
146 -DXD3_POSIX=1 \
147 -DXD3_USE_LARGEFILE64=1
148
149xdelta3-debug64: $(SOURCES)
150 $(CC) -g $(CFLAGS) xdelta3.c -lm -o xdelta3-debug64 \
151 -arch x86_64 \
152 -DREGRESSION_TEST=1 \
153 -DSECONDARY_DJW=1 \
154 -DSECONDARY_FGK=1 \
155 -DXD3_DEBUG=1 \
156 -DXD3_MAIN=1 \
157 -DXD3_POSIX=1 \
158 -DXD3_USE_LARGEFILE64=1
159
160xdelta3-warnings: $(SOURCES)
161 $(CC) -g $(CFLAGS) $(WFLAGS) xdelta3.c -lm -o xdelta3-warnings \
162 -DREGRESSION_TEST=1 \
163 -DSECONDARY_DJW=1 \
164 -DSECONDARY_FGK=1 \
165 -DXD3_DEBUG=1 \
166 -DXD3_MAIN=1 \
167 -DXD3_STDIO=1 \
168 -DXD3_USE_LARGEFILE64=1
169
170xdelta3-32: $(SOURCES)
171 $(CC) -g $(CFLAGS) xdelta3.c -lm -o xdelta3-32 \
172 -DXD3_DEBUG=1 \
173 -DXD3_USE_LARGEFILE64=0 \
174 -DREGRESSION_TEST=1 \
175 -DSECONDARY_DJW=1 \
176 -DSECONDARY_FGK=1 \
177 -DXD3_MAIN=1 \
178 -DXD3_POSIX=1
179
180xdelta3-debug2: $(SOURCES)
181 $(CC) -g $(CFLAGS) \
182 xdelta3.c -o xdelta3-debug2 \
183 -DXD3_DEBUG=2 \
184 -DXD3_MAIN=1 \
185 -DXD3_POSIX=1 \
186 -DXD3_USE_LARGEFILE64=1 \
187 -DREGRESSION_TEST=1 \
188 -DSECONDARY_DJW=1 \
189 -DSECONDARY_FGK=1 \
190 -lm
191
192xdelta3-debugstdio: $(SOURCES)
193 $(CC) -g $(CFLAGS) xdelta3.c -o xdelta3-debugstdio \
194 -DXD3_MAIN=1 \
195 -DXD3_USE_LARGEFILE64=1 \
196 -DXD3_STDIO=1 \
197 -DREGRESSION_TEST=1 \
198 -DXD3_DEBUG=1 \
199 -DSECONDARY_DJW=1 \
200 -DSECONDARY_FGK=1 \
201 -lm
202
203$(PYTGT): $(SOURCES) setup.py
204 $(PYTHON) setup.py install --verbose --compile --force
205
206xdelta3_wrap.c xdelta3.py: xdelta3.swig
207 swig -python xdelta3.swig
208
209xdelta3.o: $(SOURCES)
210 $(CC) -O3 $(CFLAGS) -c xdelta3.c $(SWIG_FLAGS) -o xdelta3.o
211
212xdelta3_wrap.o: xdelta3_wrap.c
213 $(CC) -O3 $(CFLAGS) $(SWIG_FLAGS) \
214 -DHAVE_CONFIG_H \
215 -I/usr/include/python$(PYVER) \
216 -I/usr/lib/python$(PYVER)/config \
217 -fpic \
218 -c xdelta3_wrap.c
219
220xdelta3module.dll: xdelta3_wrap.o xdelta3.o
221 gcc -shared -Wl,--enable-auto-image-base \
222 xdelta3.o \
223 xdelta3_wrap.o \
224 -L/usr/lib/python$(PYVER)/config \
225 -lpython$(PYVER) \
226 -o xdelta3module.dll
227 cp $(SWIGTGT) /usr/lib/python$(PYVER)/site-packages
228
229ifeq ("$(DARWIN)", "")
230xdelta3module.so: xdelta3_wrap.o xdelta3.o
231 ld -shared xdelta3.o xdelta3_wrap.o \
232 -o xdelta3module.so \
233 /usr/lib/libpython$(PYVER).so \
234 -lc
235else
236xdelta3module.so: xdelta3_wrap.o xdelta3.o
237 gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup \
238 -arch x86_64 $(CFLAGS) \
239 xdelta3.o xdelta3_wrap.o -o xdelta3module.so
240 cp xdelta3module.so /Library/Python/2.6/site-packages
241endif
242
243xdelta3-decoder: $(SOURCES)
244 $(CC) -O3 -Wall -Wshadow xdelta3.c \
245 -DXD3_ENCODER=0 -DXD3_MAIN=1 -DSECONDARY_FGK=0 -DSECONDARY_DJW=0 \
246 -DXD3_STDIO=1 -DEXTERNAL_COMPRESSION=0 -DVCDIFF_TOOLS=0 \
247 -o xdelta3-decoder
248
249xdelta3-decoder-nomain.o: $(SOURCES) linkxd3lib.c
250 $(CC) -O3 -Wall -Wshadow xdelta3.c linkxd3lib.c \
251 -DXD3_ENCODER=0 -DSECONDARY_FGK=0 -DSECONDARY_DJW=0 \
252 -o xdelta3-decoder-nomain.o
253 strip xdelta3-decoder-nomain.o
254
255xdelta3-O++: $(SOURCES)
256 $(CXX) -g -O3 $(CFLAGS) xdelta3.c \
257 -o xdelta3-O++ \
258 -DXD3_MAIN=1 \
259 -DSECONDARY_DJW=1 \
260 -DREGRESSION_TEST=1 \
261 -lm
262
263xdelta3-Op: $(SOURCES)
264 $(CC) -g -O3 $(CFLAGS) xdelta3.c \
265 -o xdelta3-Op \
266 -DXD3_POSIX=1 \
267 -DXD3_MAIN=1 \
268 -DREGRESSION_TEST=1 \
269 -lm
270
271xdelta3-64: $(SOURCES)
272 $(CC) -g $(CFLAGS) \
273 xdelta3.c \
274 -o xdelta3-64 \
275 -DXD3_POSIX=1 \
276 -DXD3_MAIN=1 \
277 -DREGRESSION_TEST=1 \
278 -DXD3_DEBUG=0 \
279 -DXD3_USE_LARGEFILE64=1 \
280 -lm
281
282xdelta3-64-O: $(SOURCES)
283 $(CC) -O3 $(CFLAGS) \
284 xdelta3.c \
285 -o xdelta3-64-O \
286 -DXD3_POSIX=1 \
287 -DXD3_MAIN=1 \
288 -DXD3_USE_LARGEFILE64=1 \
289 -lm
290
291xdelta3-everything: $(SOURCES)
292 $(CC) -g $(CFLAGS) \
293 xdelta3.c \
294 -o xdelta3-everything \
295 -DXD3_MAIN=1 \
296 -DVCDIFF_TOOLS=1 \
297 -DREGRESSION_TEST=1 \
298 -DSECONDARY_FGK=1 \
299 -DSECONDARY_DJW=1 \
300 -DXD3_POSIX=1 \
301 -DEXTERNAL_COMPRESSION=1 \
302 -DXD3_DEBUG=1 \
303 -lm
304
305xdelta3-Opg: $(SOURCES)
306 $(CC) -pg -g -O3 $(CFLAGS) \
307 xdelta3.c \
308 -o xdelta3-Opg \
309 -DXD3_MAIN=1 \
310 -DSECONDARY_DJW=1 \
311 -DSECONDARY_FGK=1 \
312 -DXD3_POSIX=1 \
313 -DXD3_USE_LARGEFILE64=1 \
314 -DREGRESSION_TEST=1
315
316xdelta3-nosec.o: $(SOURCES)
317 $(CC) -O3 $(CFLAGS) -c xdelta3.c -DSECONDARY_FGK=0 -DSECONDARY_DJW=0 -o xdelta3-nosec.o
318
319xdelta3-all.o: $(SOURCES)
320 $(CC) -O3 $(CFLAGS) -c xdelta3.c -DSECONDARY_FGK=1 -DSECONDARY_DJW=1 -o xdelta3-all.o
321
322xdelta3-fgk.o: $(SOURCES)
323 $(CC) -O3 $(CFLAGS) -c xdelta3.c -DSECONDARY_FGK=1 -DSECONDARY_DJW=0 -o xdelta3-fgk.o
324
325xdelta3-noext: $(SOURCES)
326 $(CC) -O3 $(CFLAGS) xdelta3.c -DXD3_MAIN=1 -DEXTERNAL_COMPRESSION=0 -o xdelta3-noext
327
328xdelta3-tools: $(SOURCES)
329 $(CC) -O3 $(CFLAGS) xdelta3.c -DXD3_MAIN=1 -o xdelta3-tools
330
331xdelta3-notools: $(SOURCES)
332 $(CC) -O3 $(CFLAGS) xdelta3.c -DXD3_MAIN=1 -DVCDIFF_TOOLS=0 -o xdelta3-notools
diff --git a/xdelta3/README b/xdelta3/README.md
index be7c6ce..a713765 100644
--- a/xdelta3/README
+++ b/xdelta3/README.md
@@ -1,5 +1,6 @@
1Xdelta 3.x readme.txt 1Xdelta 3.x readme.txt
2Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 2Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
32009, 2010, 2011, 2012, 2013, 2014, 2015
3<josh.macdonald@gmail.com> 4<josh.macdonald@gmail.com>
4 5
5 6
@@ -10,22 +11,26 @@ distribution for VCDIFF differential compression, a.k.a. delta
10compression. The latest information and downloads are available here: 11compression. The latest information and downloads are available here:
11 12
12 http://xdelta.org/ 13 http://xdelta.org/
13 http://code.google.com/p/xdelta/ 14 http://github.com/jmacd/xdelta/
14 15
15The command-line syntax: 16Xdelta can be configured to use XZ Utils for secondary compression:
16 17
17 http://code.google.com/p/xdelta/wiki/CommandLineSyntax 18 http://tukaani.org/xz/
19
20The command-line syntax is detailed here:
21
22 https://github.com/jmacd/xdelta/blob/wiki/CommandLineSyntax.md
18 23
19Run 'xdelta3 -h' for brief help. Run 'xdelta3 test' for built-in tests. 24Run 'xdelta3 -h' for brief help. Run 'xdelta3 test' for built-in tests.
20 25
21Sample commands (like gzip, -e means encode, -d means decode) 26Sample commands (like gzip, -e means encode, -d means decode)
22 27
23 xdelta3 -9 -S djw -e -vfs OLD_FILE NEW_FILE DELTA_FILE 28 xdelta3 -9 -S lzma -e -f -s OLD_FILE NEW_FILE DELTA_FILE
24 xdelta3 -d -vfs OLD_FILE DELTA_FILE DECODED_FILE 29 xdelta3 -d -s OLD_FILE DELTA_FILE DECODED_FILE
25 30
26File bug reports and browse open support issues here: 31File bug reports and browse open support issues here:
27 32
28 http://code.google.com/p/xdelta/issues/list 33 https://github.com/jmacd/xdelta/issues
29 34
30The source distribution contains the C/C++/Python APIs, Unix, Microsoft VC++ 35The source distribution contains the C/C++/Python APIs, Unix, Microsoft VC++
31and Cygwin builds. Xdelta3 is covered under the terms of the GPL, see 36and Cygwin builds. Xdelta3 is covered under the terms of the GPL, see
diff --git a/xdelta3/configure.ac b/xdelta3/configure.ac
index 313e48b..af96bc2 100644
--- a/xdelta3/configure.ac
+++ b/xdelta3/configure.ac
@@ -1,19 +1,37 @@
1AC_INIT([Xdelta3], [3.0.8], [josh.macdonald@gmail.com], 1AC_INIT([Xdelta3], [3.0.10], [josh.macdonald@gmail.com],
2 [xdelta3], [http://xdelta.org/]) 2 [xdelta3], [http://xdelta.org/])
3AC_PREREQ([2.68]) 3AC_PREREQ([2.68])
4AC_CONFIG_MACRO_DIR([m4]) 4AC_CONFIG_MACRO_DIR([m4])
5LT_INIT 5LT_INIT
6AM_INIT_AUTOMAKE([1.9 no-define foreign tar-ustar]) 6AM_INIT_AUTOMAKE([1.9 no-define foreign tar-ustar subdir-objects])
7#AC_DISABLE_STATIC 7
8AX_CHECK_ALIGNED_ACCESS_REQUIRED 8AX_CHECK_ALIGNED_ACCESS_REQUIRED
9AC_PROG_CC 9AC_PROG_CC
10AC_PROG_CXX 10AC_PROG_CXX
11
11AC_CHECK_SIZEOF(size_t) 12AC_CHECK_SIZEOF(size_t)
12AC_CHECK_SIZEOF(int) 13AC_CHECK_SIZEOF(unsigned int)
13AC_CHECK_SIZEOF(long) 14AC_CHECK_SIZEOF(unsigned long)
14AC_CHECK_SIZEOF(long long) 15AC_CHECK_SIZEOF(unsigned long long)
15AC_CHECK_HEADERS([lzma.h]) 16
16AC_CHECK_LIB(lzma, lzma_easy_buffer_encode) 17AC_ARG_WITH(
18 [liblzma],
19 [AC_HELP_STRING(
20 [--with-liblzma],
21 [build with liblzma support @<:@default=autodetect@:>@])],
22 [USE_LIBLZMA=$withval],
23 [USE_LIBLZMA=auto])
24
25if test "x$USE_LIBLZMA" != xno ; then
26 AC_CHECK_HEADERS([lzma.h],,[
27 if test "x$with_liblzma" = xyes ; then
28 AC_MSG_FAILURE([liblzma includes were not found])
29 fi])
30 AC_CHECK_LIB([lzma], [lzma_easy_buffer_encode],,[
31 if test "x$with_liblzma" = xyes ; then
32 AC_MSG_FAILURE([liblzma library were not found])
33 fi])
34fi
17 35
18#AM_PATH_PYTHON(,, [:]) 36#AM_PATH_PYTHON(,, [:])
19#AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :]) 37#AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
diff --git a/xdelta3/examples/README b/xdelta3/examples/README.md
index 60840bf..60840bf 100644
--- a/xdelta3/examples/README
+++ b/xdelta3/examples/README.md
diff --git a/xdelta3/readme.txt b/xdelta3/readme.txt
deleted file mode 100644
index be7c6ce..0000000
--- a/xdelta3/readme.txt
+++ /dev/null
@@ -1,34 +0,0 @@
1Xdelta 3.x readme.txt
2Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
3<josh.macdonald@gmail.com>
4
5
6Thanks for downloading Xdelta!
7
8This directory contains the Xdelta3 command-line interface (CLI) and source
9distribution for VCDIFF differential compression, a.k.a. delta
10compression. The latest information and downloads are available here:
11
12 http://xdelta.org/
13 http://code.google.com/p/xdelta/
14
15The command-line syntax:
16
17 http://code.google.com/p/xdelta/wiki/CommandLineSyntax
18
19Run 'xdelta3 -h' for brief help. Run 'xdelta3 test' for built-in tests.
20
21Sample commands (like gzip, -e means encode, -d means decode)
22
23 xdelta3 -9 -S djw -e -vfs OLD_FILE NEW_FILE DELTA_FILE
24 xdelta3 -d -vfs OLD_FILE DELTA_FILE DECODED_FILE
25
26File bug reports and browse open support issues here:
27
28 http://code.google.com/p/xdelta/issues/list
29
30The source distribution contains the C/C++/Python APIs, Unix, Microsoft VC++
31and Cygwin builds. Xdelta3 is covered under the terms of the GPL, see
32COPYING.
33
34Commercial inquiries welcome, please contact <josh.macdonald@gmail.com>
diff --git a/xdelta3/releases/xdelta3-3.0.1.tar.gz b/xdelta3/releases/xdelta3-3.0.1.tar.gz
deleted file mode 100644
index c69b7d8..0000000
--- a/xdelta3/releases/xdelta3-3.0.1.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.2-x86-32.exe b/xdelta3/releases/xdelta3-3.0.2-x86-32.exe
deleted file mode 100644
index 36ca1a9..0000000
--- a/xdelta3/releases/xdelta3-3.0.2-x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.2.tar.gz b/xdelta3/releases/xdelta3-3.0.2.tar.gz
deleted file mode 100644
index f7aa78b..0000000
--- a/xdelta3/releases/xdelta3-3.0.2.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.3.tar.gz b/xdelta3/releases/xdelta3-3.0.3.tar.gz
deleted file mode 100644
index 3e0c64f..0000000
--- a/xdelta3/releases/xdelta3-3.0.3.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.4-x86-32.exe b/xdelta3/releases/xdelta3-3.0.4-x86-32.exe
deleted file mode 100644
index e9beb32..0000000
--- a/xdelta3/releases/xdelta3-3.0.4-x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.4.tar.gz b/xdelta3/releases/xdelta3-3.0.4.tar.gz
deleted file mode 100644
index 8d8cf10..0000000
--- a/xdelta3/releases/xdelta3-3.0.4.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.5-x86-64.exe b/xdelta3/releases/xdelta3-3.0.5-x86-64.exe
deleted file mode 100644
index cff74e3..0000000
--- a/xdelta3/releases/xdelta3-3.0.5-x86-64.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.5.tar.gz b/xdelta3/releases/xdelta3-3.0.5.tar.gz
deleted file mode 100644
index 41b6850..0000000
--- a/xdelta3/releases/xdelta3-3.0.5.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.6-win32.exe b/xdelta3/releases/xdelta3-3.0.6-win32.exe
deleted file mode 100644
index 7d03fa2..0000000
--- a/xdelta3/releases/xdelta3-3.0.6-win32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.6-x64.exe b/xdelta3/releases/xdelta3-3.0.6-x64.exe
deleted file mode 100644
index 2ee4c4c..0000000
--- a/xdelta3/releases/xdelta3-3.0.6-x64.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.6.tar.gz b/xdelta3/releases/xdelta3-3.0.6.tar.gz
deleted file mode 100644
index 7de9db4..0000000
--- a/xdelta3/releases/xdelta3-3.0.6.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.7.tar.gz b/xdelta3/releases/xdelta3-3.0.7.tar.gz
deleted file mode 100644
index 768bdb7..0000000
--- a/xdelta3/releases/xdelta3-3.0.7.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.7.x86-32.exe b/xdelta3/releases/xdelta3-3.0.7.x86-32.exe
deleted file mode 100644
index e3612ae..0000000
--- a/xdelta3/releases/xdelta3-3.0.7.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.7.x86-64.exe b/xdelta3/releases/xdelta3-3.0.7.x86-64.exe
deleted file mode 100644
index c011990..0000000
--- a/xdelta3/releases/xdelta3-3.0.7.x86-64.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.8.tar.xz b/xdelta3/releases/xdelta3-3.0.8.tar.xz
deleted file mode 100644
index 34e3143..0000000
--- a/xdelta3/releases/xdelta3-3.0.8.tar.xz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.8.x86-32.exe b/xdelta3/releases/xdelta3-3.0.8.x86-32.exe
deleted file mode 100644
index 2b4970d..0000000
--- a/xdelta3/releases/xdelta3-3.0.8.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3-3.0.8.x86-64.exe b/xdelta3/releases/xdelta3-3.0.8.x86-64.exe
deleted file mode 100644
index b6d8a97..0000000
--- a/xdelta3/releases/xdelta3-3.0.8.x86-64.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3.0.0.tar.gz b/xdelta3/releases/xdelta3.0.0.tar.gz
deleted file mode 100644
index 205bcbd..0000000
--- a/xdelta3/releases/xdelta3.0.0.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3.0s.msi b/xdelta3/releases/xdelta3.0s.msi
deleted file mode 100644
index 6cd3869..0000000
--- a/xdelta3/releases/xdelta3.0s.msi
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3.0s.tar.gz b/xdelta3/releases/xdelta3.0s.tar.gz
deleted file mode 100644
index 5593b3f..0000000
--- a/xdelta3/releases/xdelta3.0s.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3.0s.x86-32.exe b/xdelta3/releases/xdelta3.0s.x86-32.exe
deleted file mode 100755
index b6ca273..0000000
--- a/xdelta3/releases/xdelta3.0s.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3.0t.msi b/xdelta3/releases/xdelta3.0t.msi
deleted file mode 100644
index a61d14c..0000000
--- a/xdelta3/releases/xdelta3.0t.msi
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3.0t.tar.gz b/xdelta3/releases/xdelta3.0t.tar.gz
deleted file mode 100644
index 5799cd1..0000000
--- a/xdelta3/releases/xdelta3.0t.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3.0t.x86-32.exe b/xdelta3/releases/xdelta3.0t.x86-32.exe
deleted file mode 100755
index be492f9..0000000
--- a/xdelta3/releases/xdelta3.0t.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta3.0u.x86-32.exe b/xdelta3/releases/xdelta3.0u.x86-32.exe
deleted file mode 100644
index 231e03a..0000000
--- a/xdelta3/releases/xdelta3.0u.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30e.tar.gz b/xdelta3/releases/xdelta30e.tar.gz
deleted file mode 100644
index 9c5c43b..0000000
--- a/xdelta3/releases/xdelta30e.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30g.tar.gz b/xdelta3/releases/xdelta30g.tar.gz
deleted file mode 100644
index 337da8f..0000000
--- a/xdelta3/releases/xdelta30g.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30h.ppc-osx.bin b/xdelta3/releases/xdelta30h.ppc-osx.bin
deleted file mode 100644
index 7ce8f0d..0000000
--- a/xdelta3/releases/xdelta30h.ppc-osx.bin
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30h.tar.gz b/xdelta3/releases/xdelta30h.tar.gz
deleted file mode 100644
index aa8070d..0000000
--- a/xdelta3/releases/xdelta30h.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30h.x86-32.exe b/xdelta3/releases/xdelta30h.x86-32.exe
deleted file mode 100644
index 05acf9e..0000000
--- a/xdelta3/releases/xdelta30h.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30i.tar.gz b/xdelta3/releases/xdelta30i.tar.gz
deleted file mode 100644
index 18a4f2a..0000000
--- a/xdelta3/releases/xdelta30i.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30i.x86-32.exe b/xdelta3/releases/xdelta30i.x86-32.exe
deleted file mode 100644
index 4b845f8..0000000
--- a/xdelta3/releases/xdelta30i.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30j.tar.gz b/xdelta3/releases/xdelta30j.tar.gz
deleted file mode 100644
index 852d842..0000000
--- a/xdelta3/releases/xdelta30j.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30j.x86-32.exe b/xdelta3/releases/xdelta30j.x86-32.exe
deleted file mode 100644
index adc0c22..0000000
--- a/xdelta3/releases/xdelta30j.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30k.tar.gz b/xdelta3/releases/xdelta30k.tar.gz
deleted file mode 100644
index cc67fbe..0000000
--- a/xdelta3/releases/xdelta30k.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30k.x86-32.exe b/xdelta3/releases/xdelta30k.x86-32.exe
deleted file mode 100644
index 18aacdd..0000000
--- a/xdelta3/releases/xdelta30k.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30l.tar.gz b/xdelta3/releases/xdelta30l.tar.gz
deleted file mode 100644
index 1df1c4d..0000000
--- a/xdelta3/releases/xdelta30l.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30l.x86-32.exe b/xdelta3/releases/xdelta30l.x86-32.exe
deleted file mode 100644
index 50c59e0..0000000
--- a/xdelta3/releases/xdelta30l.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30m.tar.gz b/xdelta3/releases/xdelta30m.tar.gz
deleted file mode 100644
index f09aa7e..0000000
--- a/xdelta3/releases/xdelta30m.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30m.x86-32.exe b/xdelta3/releases/xdelta30m.x86-32.exe
deleted file mode 100644
index c5dabd9..0000000
--- a/xdelta3/releases/xdelta30m.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30n.tar.gz b/xdelta3/releases/xdelta30n.tar.gz
deleted file mode 100644
index 66fadb4..0000000
--- a/xdelta3/releases/xdelta30n.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30n.x86-32.exe b/xdelta3/releases/xdelta30n.x86-32.exe
deleted file mode 100644
index cd96077..0000000
--- a/xdelta3/releases/xdelta30n.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30o.tar.gz b/xdelta3/releases/xdelta30o.tar.gz
deleted file mode 100644
index b2de57b..0000000
--- a/xdelta3/releases/xdelta30o.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30o.x86-32.exe b/xdelta3/releases/xdelta30o.x86-32.exe
deleted file mode 100644
index bcca3e8..0000000
--- a/xdelta3/releases/xdelta30o.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30p.tar.gz b/xdelta3/releases/xdelta30p.tar.gz
deleted file mode 100755
index 9ef42ab..0000000
--- a/xdelta3/releases/xdelta30p.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30p.x86-32.exe b/xdelta3/releases/xdelta30p.x86-32.exe
deleted file mode 100755
index 8ac083a..0000000
--- a/xdelta3/releases/xdelta30p.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30q.tar.gz b/xdelta3/releases/xdelta30q.tar.gz
deleted file mode 100644
index 167fde6..0000000
--- a/xdelta3/releases/xdelta30q.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30q.x86-32.exe b/xdelta3/releases/xdelta30q.x86-32.exe
deleted file mode 100755
index ab3b434..0000000
--- a/xdelta3/releases/xdelta30q.x86-32.exe
+++ /dev/null
Binary files differ
diff --git a/xdelta3/releases/xdelta30r.tar.gz b/xdelta3/releases/xdelta30r.tar.gz
deleted file mode 100755
index e1bba34..0000000
--- a/xdelta3/releases/xdelta30r.tar.gz
+++ /dev/null
Binary files differ
diff --git a/xdelta3/run_release.sh b/xdelta3/run_release.sh
index 2ac810a..1b9dc8c 100755
--- a/xdelta3/run_release.sh
+++ b/xdelta3/run_release.sh
@@ -1,79 +1,250 @@
1#!/bin/sh 1#!/bin/bash
2 2
3# Choose 3# Run from the source dir.
4CC=clang 4SRCDIR=${PWD}
5CXX=clang++
6# or
7CC=gcc
8CXX=g++
9 5
10# These are updated below, 6# TODO replace w/ wget
11CFLAGS= # Do not set here 7LZMA="xz-5.2.1"
12CXXFLAGS= # Do not set here 8LZMA_FILE="${SRCDIR}/../${LZMA}.tar.xz"
13 9
14# Place C/C++ common flags here 10MAKEFLAGS="-j 10"
15COMMON=-O3
16 11
17export CFLAGS 12BUILDDIR=${SRCDIR}/build
18export CXXFLAGS 13LZMASRC=${BUILDDIR}/${LZMA}
19export CC
20export CXX
21 14
22LIBBASE=$HOME/lib 15MINGW_CFLAGS="-DEXTERNAL_COMPRESSION=0 -DVCDIFF_TOOLS=0"
16MINGW_CFLAGS="${MINGW_CFLAGS} -DXD3_WIN32=1 -DSHELL_TESTS=0"
23 17
24# Run from the source dir. 18MYOS=`uname`
25# Looks for liblzma to be installed in $LIBBASE/$MACH. 19DATE=`date`
26MACH= 20
27SRCDIR=$PWD 21CLEAN=""
28 22
29rm -rf build 23LINUXTGTS=""
30 24LINUXTEST1=""
31# aclocal -I m4 25LINUXTEST2=""
32# automake --force-missing 26
33# automake 27WINTGTS=""
34# autoconf 28WINTEST1=""
35 29WINTEST2=""
36function resetflag { 30
37 CFLAGS="$COMMON -$1 -I$LIBBASE/$MACH/include" 31OSXTGTS=""
38 CXXFLAGS="$COMMON -$1 -I$LIBBASE/$MACH/include" 32OSXTEST1=""
39 LDFLAGS="$COMMON -$1 -L$LIBBASE/$MACH/lib" 33OSXTEST2=""
40} 34
41 35XTMP="/tmp"
42function addflag { 36if [ "${TMP}" != "" ]; then
43 CFLAGS="$CFLAGS $1" 37 XTMP="${TMP}"
44 CXXFLAGS="$CXXFLAGS $1" 38fi
39if [ "${TMPDIR}" != "" ]; then
40 XTMP="${TMPDIR}"
41fi
42
43find build -type f 2> /dev/null | xargs rm
44
45function setup {
46 mkdir -p ${BUILDDIR}
47 aclocal -I m4
48 autoheader
49 libtoolize
50 automake
51 automake --add-missing
52 autoconf
53}
54
55function try {
56 local w=$1
57 shift
58 local dir=$1
59 shift
60 echo -n " ${w} ..."
61 (cd "${dir}" && "$@" >${w}.stdout 2>${w}.stderr)
62 local s=$?
63 if [ ${s} -eq 0 ]; then
64 echo " success"
65 else
66 echo " failed!"
67 echo "Error $1 in ${dir}" >&2
68 fi
69 return ${s}
70}
71
72function buildlzma {
73 host=$1
74 march=$2
75 local target="${BUILDDIR}/lib-${host}${march}"
76
77 echo " ... liblzma"
78
79 mkdir -p ${target}
80
81 try configure-lzma ${target} ${LZMASRC}/configure \
82 --host=${host} \
83 --prefix=${target} \
84 --disable-shared \
85 "CFLAGS=${march}" \
86 "CXXFLAGS=${march}" \
87 "LDFLAGS=${march}"
88 if [ $? -ne 0 ]; then
89 return
90 fi
91
92 try build-lzma ${target} make ${MAKEFLAGS}
93 if [ $? -ne 0 ]; then
94 return
95 fi
96 try install-lzma ${target} make install
97 if [ $? -ne 0 ]; then
98 return
99 fi
45} 100}
46 101
47function buildit { 102function buildit {
48 sizebits=$1 103 local host=$1
49 offsetbits=$2 104 local march=$2
50 echo Configuration for usize_t=${sizebits} bits, xoff_t=${offsetbits} bits. 105 local usizebits=$3
51 echo CFLAGS=$CFLAGS 106 local offsetbits=$4
52 echo CXXFLAGS=$CXXFLAGS 107 local cargs=$5
53 D=build/$MACH/${sizebits}size-${offsetbits}off 108 local largs=$6
54 mkdir -p $D 109 local BM="${host}${march}"
55 echo "Configuring $D ..." 110 local D="build/${BM}/usize${usizebits}/xoff${offsetbits}"
56 (cd $D && $SRCDIR/configure --prefix=$PWD/bin --enable-debug-symbols) 111 local BMD="${BM}-${usizebits}-${offsetbits}"
57 #(cd $D && make all && make test) 112 local FULLD="${SRCDIR}/${D}"
113 local CFLAGS="${march} ${cargs} -g -I${SRCDIR}/build/lib-${BM}/include"
114 local CXXFLAGS="${march} ${cargs} -g -I${SRCDIR}/build/lib-${BM}/include"
115 local LDFLAGS="${largs} ${march} -L${SRCDIR}/build/lib-${BM}/lib"
116 mkdir -p ${D}
117
118 echo " ... ${BMD}"
119
120 cat >> Makefile.test <<EOF
121
122# ${BMD}
123# ${CFLAGS}
124.PHONY: build-${BMD}
125build-${BMD}:
126 (cd ${D} && make all)
127
128.PHONY: clean-${BMD}
129clean-${BMD}:
130 (cd ${D} && make clean)
131
132.PHONY: regtest-${BMD}
133regtest-${BMD}:
134 (cd ${D} && ./xdelta3regtest 1> \${TMP}/regtest.${BMD}.stdout 2> \${TMP}/regtest.${BMD}.stderr)
135
136.PHONY: selftest-${BMD}
137selftest-${BMD}:
138 (cd ${D} && ./bin/xdelta3 test 1> \${TMP}/selftest.${BMD}.stdout 2> \${TMP}/selftest.${BMD}.stderr)
139
140
141EOF
142
143 case ${host} in
144 *linux*)
145 LINUXTGTS="${LINUXTGTS} build-${BMD}"
146 LINUXTEST1="${LINUXTEST1} selftest-${BMD}"
147 LINUXTEST2="${LINUXTEST2} regtest-${BMD}"
148 ;;
149 *mingw*)
150 WINTGTS="${WINTGTS} build-${BMD}"
151 WINTEST1="${WINTEST1} selftest-${BMD}"
152 WINTEST2="${WINTEST2} regtest-${BMD}"
153 ;;
154 *apple*)
155 OSXTGTS="${OSXTGTS} build-${BMD}"
156 OSXTEST1="${OSXTEST1} selftest-${BMD}"
157 OSXTEST2="${OSXTEST2} regtest-${BMD}"
158 ;;
159 esac
160 CLEAN="${CLEAN} clean-${BMD}"
161
162 try configure-xdelta ${FULLD} ${SRCDIR}/configure \
163 --host=${host} \
164 --prefix=${FULLD} \
165 --enable-static \
166 --disable-shared \
167 --enable-debug-symbols \
168 "CFLAGS=${CFLAGS}" \
169 "CXXFLAGS=${CXXFLAGS}" \
170 "LDFLAGS=${LDFLAGS}"
171 if [ $? -ne 0 ]; then
172 return
173 fi
174
175 try build-xdelta ${FULLD} make ${MAKEFLAGS} all
176 if [ $? -ne 0 ]; then
177 return
178 fi
179
180 try install-xdelta ${FULLD} make install
58} 181}
59 182
60function buildall { 183function buildall {
61 MACH=$1 184 echo ""
62 resetflag $MACH 185 echo "Host $1$2"
63 addflag -DXD3_USE_LARGEFILE64=0 186 echo ""
64 addflag -DXD3_USE_LARGEWINDOW64=0 187
65 buildit 32 32 188 buildlzma "$1" "$2"
66 189 buildit "$1" "$2" 32 32 "-DXD3_USE_LARGESIZET=0 -DXD3_USE_LARGEFILE64=0 $3" "$4"
67 resetflag $MACH 190 buildit "$1" "$2" 32 64 "-DXD3_USE_LARGESIZET=0 -DXD3_USE_LARGEFILE64=1 $3" "$4"
68 addflag -DXD3_USE_LARGEFILE64=1 191 buildit "$1" "$2" 64 64 "-DXD3_USE_LARGESIZET=1 -DXD3_USE_LARGEFILE64=1 $3" "$4"
69 addflag -DXD3_USE_LARGEWINDOW64=0
70 buildit 32 64
71
72 resetflag $MACH
73 addflag -DXD3_USE_LARGEFILE64=1
74 addflag -DXD3_USE_LARGEWINDOW64=1
75 buildit 64 64
76} 192}
77 193
78buildall m64 194setup
79buildall m32 195
196try untar-lzma ${BUILDDIR} tar -xvf "${LZMA_FILE}"
197if [ $? -ne 0 ]; then
198 exit $?
199fi
200
201cat > Makefile.test <<EOF
202# Auto-generated ${DATE} -*- Mode: Makefile -*-
203TMP = ${XTMP}
204
205EOF
206
207# Native compiles
208if [ "${MYOS}" == "Linux" ]; then
209 # Linux
210 buildall x86_64-pc-linux-gnu -m32
211 buildall x86_64-pc-linux-gnu -m64
212fi
213
214if [ "${MYOS}" == "Darwin" ]; then
215 # OS X
216 buildall x86_64-apple-darwin -m32
217 buildall x86_64-apple-darwin -m64
218fi
219
220# Cross compile
221buildall i686-w64-mingw32 -mconsole "${MINGW_CFLAGS}"
222buildall x86_64-w64-mingw32 -mconsole "${MINGW_CFLAGS}"
223
224cat >> Makefile.test <<EOF
225
226all: linux windows apple
227clean: ${CLEAN}
228
229.PHONY: linux windows apple
230.PHONY: linux-build windows-build apple-build
231.PHONY: linux-selftest windows-selftest apple-selftest
232.PHONY: linux-regtest windows-regtest apple-regtest
233
234linux: linux-build linux-selftest linux-regtest
235windows: windows-build windows-selftest windows-regtest
236apple: apple-build apple-selftest apple-regtest
237
238linux-build: ${LINUXTGTS}
239linux-selftest: ${LINUXTEST1}
240linux-regtest: ${LINUXTEST2}
241
242windows-build: ${WINTGTS}
243windows-selftest: ${WINTEST1}
244windows-regtest: ${WINTEST2}
245
246apple-build: ${OSXTGTS}
247apple-selftest: ${OSXTEST1}
248apple-regtest: ${OSXTEST2}
249
250EOF
diff --git a/xdelta3/testing/file.h b/xdelta3/testing/file.h
index 67309ac..05f9dde 100644
--- a/xdelta3/testing/file.h
+++ b/xdelta3/testing/file.h
@@ -311,8 +311,9 @@ class ExtFile {
311public: 311public:
312 ExtFile() { 312 ExtFile() {
313 static int static_counter = 0; 313 static int static_counter = 0;
314 char buf[32]; 314 pid_t pid = getpid();
315 snprintf(buf, 32, "/tmp/regtest.%d", static_counter++); 315 char buf[64];
316 snprintf(buf, 64, "/tmp/regtest.%d.%d", pid, static_counter++);
316 filename_.append(buf); 317 filename_.append(buf);
317 unlink(filename_.c_str()); 318 unlink(filename_.c_str());
318 } 319 }
diff --git a/xdelta3/testing/modify.h b/xdelta3/testing/modify.h
index 023e6ce..93f7bde 100644
--- a/xdelta3/testing/modify.h
+++ b/xdelta3/testing/modify.h
@@ -12,12 +12,12 @@ public:
12 enum Kind { 12 enum Kind {
13 MODIFY = 1, // Mutate a certain range w/ random or supplied data 13 MODIFY = 1, // Mutate a certain range w/ random or supplied data
14 ADD = 2, // Insert random or supplied data 14 ADD = 2, // Insert random or supplied data
15 DELETE = 3, // Delete a specified range of data 15 DELRANGE = 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 COPYOVER = 6 // Copy then delete copied-to range 18 COPYOVER = 6 // Copy then delete copied-to range
19 19
20 // ADD, DELETE, and COPY change the file size 20 // ADD, DELRANGE, and COPY change the file size
21 // MODIFY, MOVE, COPYOVER preserve the file size 21 // MODIFY, MOVE, COPYOVER preserve the file size
22 }; 22 };
23 23
@@ -97,7 +97,7 @@ public:
97 case Change::MODIFY: 97 case Change::MODIFY:
98 ModifyChange(ch, table, source_table, rand); 98 ModifyChange(ch, table, source_table, rand);
99 break; 99 break;
100 case Change::DELETE: 100 case Change::DELRANGE:
101 DeleteChange(ch, table, source_table, rand); 101 DeleteChange(ch, table, source_table, rand);
102 break; 102 break;
103 case Change::COPY: 103 case Change::COPY:
@@ -269,7 +269,7 @@ public:
269 SegmentMap tmp; 269 SegmentMap tmp;
270 CHECK_NE(ch.addr1, ch.addr2); 270 CHECK_NE(ch.addr1, ch.addr2);
271 CopyChange(ch, &tmp, source_table, rand); 271 CopyChange(ch, &tmp, source_table, rand);
272 Change d(Change::DELETE, ch.size, 272 Change d(Change::DELRANGE, ch.size,
273 ch.addr1 < ch.addr2 ? ch.addr1 : ch.addr1 + ch.size); 273 ch.addr1 < ch.addr2 ? ch.addr1 : ch.addr1 + ch.size);
274 DeleteChange(d, table, &tmp, rand); 274 DeleteChange(d, table, &tmp, rand);
275 } 275 }
@@ -282,7 +282,7 @@ public:
282 SegmentMap tmp; 282 SegmentMap tmp;
283 CHECK_NE(ch.addr1, ch.addr2); 283 CHECK_NE(ch.addr1, ch.addr2);
284 CopyChange(ch, &tmp, source_table, rand); 284 CopyChange(ch, &tmp, source_table, rand);
285 Change d(Change::DELETE, ch.size, ch.addr2 + ch.size); 285 Change d(Change::DELRANGE, ch.size, ch.addr2 + ch.size);
286 DeleteChange(d, table, &tmp, rand); 286 DeleteChange(d, table, &tmp, rand);
287 } 287 }
288 288
diff --git a/xdelta3/testing/regtest.cc b/xdelta3/testing/regtest.cc
index afeb5e2..bee7477 100644
--- a/xdelta3/testing/regtest.cc
+++ b/xdelta3/testing/regtest.cc
@@ -12,12 +12,14 @@ public:
12 Options() 12 Options()
13 : encode_srcwin_maxsz(1<<20), 13 : encode_srcwin_maxsz(1<<20),
14 block_size(Constants::BLOCK_SIZE), 14 block_size(Constants::BLOCK_SIZE),
15 window_size(Constants::WINDOW_SIZE),
15 size_known(false), 16 size_known(false),
16 iopt_size(XD3_DEFAULT_IOPT_SIZE), 17 iopt_size(XD3_DEFAULT_IOPT_SIZE),
17 smatch_cfg(XD3_SMATCH_DEFAULT) { } 18 smatch_cfg(XD3_SMATCH_DEFAULT) { }
18 19
19 xoff_t encode_srcwin_maxsz; 20 xoff_t encode_srcwin_maxsz;
20 size_t block_size; 21 size_t block_size;
22 xoff_t window_size;
21 bool size_known; 23 bool size_known;
22 usize_t iopt_size; 24 usize_t iopt_size;
23 xd3_smatch_cfg smatch_cfg; 25 xd3_smatch_cfg smatch_cfg;
@@ -56,7 +58,7 @@ public:
56 xd3_init_config(&encode_config, XD3_ADLER32); 58 xd3_init_config(&encode_config, XD3_ADLER32);
57 xd3_init_config(&decode_config, XD3_ADLER32); 59 xd3_init_config(&decode_config, XD3_ADLER32);
58 60
59 encode_config.winsize = Constants::WINDOW_SIZE; 61 encode_config.winsize = options.window_size;
60 encode_config.iopt_size = options.iopt_size; 62 encode_config.iopt_size = options.iopt_size;
61 encode_config.smatch_cfg = options.smatch_cfg; 63 encode_config.smatch_cfg = options.smatch_cfg;
62 64
@@ -151,11 +153,11 @@ public:
151 xd3_source *src = (encoding ? &encode_source : &decode_source); 153 xd3_source *src = (encoding ? &encode_source : &decode_source);
152 Block *block = (encoding ? &encode_source_block : &decode_source_block); 154 Block *block = (encoding ? &encode_source_block : &decode_source_block);
153 if (encoding) { 155 if (encoding) {
154 IF_DEBUG1(XPR(NTR "[srcblock] %"Q" last srcpos %"Q" " 156 IF_DEBUG1(XPR(NTR "[srcblock] %"Q"u last srcpos %"Q"u "
155 "encodepos %"Q"\n", 157 "encodepos %"Q"u\n",
156 encode_source.getblkno, 158 encode_source.getblkno,
157 encode_stream.match_last_srcpos, 159 encode_stream.match_last_srcpos,
158 encode_stream.input_position + encode_stream.total_in)); 160 encode_stream.input_position + encode_stream.total_in));
159 } 161 }
160 162
161 source_iterator.SetBlock(src->getblkno); 163 source_iterator.SetBlock(src->getblkno);
@@ -228,10 +230,10 @@ public:
228 ExtFile *coded_data, 230 ExtFile *coded_data,
229 const Options &options) { 231 const Options &options) {
230 vector<const char*> ecmd; 232 vector<const char*> ecmd;
231 char wbuf[16]; 233 char bbuf[16];
232 snprintf(wbuf, sizeof(wbuf), "-B%"Q, options.encode_srcwin_maxsz); 234 snprintf(bbuf, sizeof(bbuf), "-B%"Q"u", options.encode_srcwin_maxsz);
233 ecmd.push_back("xdelta3"); 235 ecmd.push_back("xdelta3");
234 ecmd.push_back(wbuf); 236 ecmd.push_back(bbuf);
235 ecmd.push_back("-s"); 237 ecmd.push_back("-s");
236 ecmd.push_back(source_file.Name()); 238 ecmd.push_back(source_file.Name());
237 ecmd.push_back(target_file.Name()); 239 ecmd.push_back(target_file.Name());
@@ -244,7 +246,7 @@ public:
244 vector<const char*> dcmd; 246 vector<const char*> dcmd;
245 ExtFile recon_file; 247 ExtFile recon_file;
246 dcmd.push_back("xdelta3"); 248 dcmd.push_back("xdelta3");
247 ecmd.push_back(wbuf); 249 ecmd.push_back(bbuf);
248 dcmd.push_back("-d"); 250 dcmd.push_back("-d");
249 dcmd.push_back("-s"); 251 dcmd.push_back("-s");
250 dcmd.push_back(source_file.Name()); 252 dcmd.push_back(source_file.Name());
@@ -364,28 +366,37 @@ public:
364 CHECK_EQ(0, CmpDifferentBlockBytes(to, recon)); 366 CHECK_EQ(0, CmpDifferentBlockBytes(to, recon));
365 } 367 }
366 368
367 ////////////////////////////////////////////////////////////////////// 369//////////////////////////////////////////////////////////////////////
368 370
369 void TestRandomNumbers() { 371void TestPrintf() {
370 MTRandom rand; 372 char buf[64];
371 int rounds = 1<<20; 373 xoff_t x = XOFF_T_MAX;
372 uint64_t usum = 0; 374 snprintf_func (buf, sizeof(buf), "%"Q"u", x);
373 uint64_t esum = 0; 375 const char *expect = XD3_USE_LARGEFILE64 ?
376 "18446744073709551615" : "4294967295";
377 XD3_ASSERT(strcmp (buf, expect) == 0);
378}
374 379
375 for (int i = 0; i < rounds; i++) { 380void TestRandomNumbers() {
376 usum += rand.Rand32(); 381 MTRandom rand;
377 esum += rand.ExpRand32(1024); 382 int rounds = 1<<20;
378 } 383 uint64_t usum = 0;
384 uint64_t esum = 0;
379 385
380 double allowed_error = 0.01; 386 for (int i = 0; i < rounds; i++) {
387 usum += rand.Rand32();
388 esum += rand.ExpRand32(1024);
389 }
390
391 double allowed_error = 0.01;
381 392
382 uint32_t umean = usum / rounds; 393 uint32_t umean = usum / rounds;
383 uint32_t emean = esum / rounds; 394 uint32_t emean = esum / rounds;
384 395
385 uint32_t uexpect = UINT32_MAX / 2; 396 uint32_t uexpect = UINT32_MAX / 2;
386 uint32_t eexpect = 1024; 397 uint32_t eexpect = 1024;
387 398
388 if (umean < uexpect * (1.0 - allowed_error) || 399 if (umean < uexpect * (1.0 - allowed_error) ||
389 umean > uexpect * (1.0 + allowed_error)) { 400 umean > uexpect * (1.0 + allowed_error)) {
390 XPR(NT "uniform mean error: %u != %u\n", umean, uexpect); 401 XPR(NT "uniform mean error: %u != %u\n", umean, uexpect);
391 abort(); 402 abort();
@@ -574,7 +585,7 @@ void TestDeleteMutator() {
574 585
575 for (size_t i = 0; i < SIZEOF_ARRAY(test_cases); i++) { 586 for (size_t i = 0; i < SIZEOF_ARRAY(test_cases); i++) {
576 ChangeList cl1; 587 ChangeList cl1;
577 cl1.push_back(Change(Change::DELETE, test_cases[i].size, 588 cl1.push_back(Change(Change::DELRANGE, test_cases[i].size,
578 test_cases[i].addr)); 589 test_cases[i].addr));
579 spec0.ModifyTo(ChangeListMutator(cl1), &spec1); 590 spec0.ModifyTo(ChangeListMutator(cl1), &spec1);
580 CHECK_EQ(spec0.Size() - test_cases[i].size, spec1.Size()); 591 CHECK_EQ(spec0.Size() - test_cases[i].size, spec1.Size());
@@ -837,7 +848,6 @@ void TestCopyWindow() {
837 options.encode_srcwin_maxsz = size; 848 options.encode_srcwin_maxsz = size;
838 options.iopt_size = 128; 849 options.iopt_size = 128;
839 options.smatch_cfg = XD3_SMATCH_SLOW; 850 options.smatch_cfg = XD3_SMATCH_SLOW;
840 options.size_known = false;
841 851
842 Block block1; 852 Block block1;
843 InMemoryEncodeDecode(spec0, spec1, &block1, options); 853 InMemoryEncodeDecode(spec0, spec1, &block1, options);
@@ -978,7 +988,6 @@ void TestHalfBlockCopy() {
978 // When there are fewer than 3 source blocks. 988 // When there are fewer than 3 source blocks.
979 CHECK_EQ(nocopy_adds, delta1.AddedBytes()); 989 CHECK_EQ(nocopy_adds, delta1.AddedBytes());
980 } 990 }
981 // XPR(NT "0=%zu 1=%zu\n", delta0.AddedBytes(), delta1.AddedBytes());
982 } 991 }
983 992
984 Options options; 993 Options options;
@@ -997,7 +1006,6 @@ void TestHalfBlockCopy() {
997 CHECK_GE(onecopy_adds + 1, delta0.AddedBytes()); 1006 CHECK_GE(onecopy_adds + 1, delta0.AddedBytes());
998 1007
999 CHECK_EQ(onecopy_adds, delta1.AddedBytes()); 1008 CHECK_EQ(onecopy_adds, delta1.AddedBytes());
1000 // XPR(NT "0=%zu 1=%zu\n", delta0.AddedBytes(), delta1.AddedBytes());
1001} 1009}
1002 1010
1003void FourWayMergeTest(const FileSpec &spec0, 1011void FourWayMergeTest(const FileSpec &spec0,
@@ -1130,7 +1138,7 @@ void TestMergeCommand1() {
1130 } 1138 }
1131 1139
1132 cl1.push_back(Change(Change::ADD, change1, add1_pos)); 1140 cl1.push_back(Change(Change::ADD, change1, add1_pos));
1133 cl2.push_back(Change(Change::DELETE, change1, del2_pos)); 1141 cl2.push_back(Change(Change::DELRANGE, change1, del2_pos));
1134 cl3.push_back(Change(Change::MODIFY, change3, change3_pos)); 1142 cl3.push_back(Change(Change::MODIFY, change3, change3_pos));
1135 1143
1136 spec0.ModifyTo(ChangeListMutator(cl1), &spec1); 1144 spec0.ModifyTo(ChangeListMutator(cl1), &spec1);
@@ -1184,9 +1192,9 @@ void TestMergeCommand2() {
1184 1192
1185 ChangeList cl1, cl2, cl3; 1193 ChangeList cl1, cl2, cl3;
1186 1194
1187 cl1.push_back(Change(Change::DELETE, size0 - size1, 0)); 1195 cl1.push_back(Change(Change::DELRANGE, size0 - size1, 0));
1188 cl2.push_back(Change(Change::DELETE, size0 - size2, 0)); 1196 cl2.push_back(Change(Change::DELRANGE, size0 - size2, 0));
1189 cl3.push_back(Change(Change::DELETE, size0 - size3, 0)); 1197 cl3.push_back(Change(Change::DELRANGE, size0 - size3, 0));
1190 1198
1191 spec0.ModifyTo(ChangeListMutator(cl1), &spec1); 1199 spec0.ModifyTo(ChangeListMutator(cl1), &spec1);
1192 spec0.ModifyTo(ChangeListMutator(cl2), &spec2); 1200 spec0.ModifyTo(ChangeListMutator(cl2), &spec2);
@@ -1200,6 +1208,44 @@ void TestMergeCommand2() {
1200 } 1208 }
1201} 1209}
1202 1210
1211void TestLastFrontierBlock() {
1212 // This test constructs an input that can expose
1213 // https://github.com/jmacd/xdelta/issues/188
1214 // when run through the command-line with source via a FIFO.
1215 // That is not tested here, but the test stays.
1216 if (Constants::WINDOW_SIZE < XD3_ALLOCSIZE)
1217 {
1218 return;
1219 }
1220
1221 MTRandom rand;
1222 FileSpec spec0(&rand);
1223 FileSpec spec1(&rand);
1224 const xoff_t size = XD3_ALLOCSIZE * 64; // == XD3_MINSRCWINSZ * 2
1225 const xoff_t edit = XD3_ALLOCSIZE;
1226
1227 Options options;
1228 options.encode_srcwin_maxsz = XD3_MINSRCWINSZ;
1229 options.block_size = XD3_ALLOCSIZE;
1230 options.window_size = XD3_MINSRCWINSZ;
1231 options.size_known = false;
1232
1233 spec0.GenerateFixedSize(size);
1234
1235 ChangeList cl;
1236
1237 // Modify the 0th byte in order to induce indexing of subsequent
1238 // bytes, but allow copying most of the file to keep the test fast.
1239 cl.push_back(Change(Change::MODIFY, 1, edit * 31));
1240 cl.push_back(Change(Change::COPYOVER, edit, edit * 31, edit * 63));
1241
1242 spec0.ModifyTo(ChangeListMutator(cl), &spec1);
1243
1244 Block noblock;
1245 InMemoryEncodeDecode(spec0, spec1, &noblock, options);
1246 InMemoryEncodeDecode(spec1, spec0, &noblock, options);
1247}
1248
1203}; // class Regtest<Constants> 1249}; // class Regtest<Constants>
1204 1250
1205#define TEST(x) XPR(NTR #x "...\n"); regtest.x() 1251#define TEST(x) XPR(NTR #x "...\n"); regtest.x()
@@ -1208,6 +1254,7 @@ void TestMergeCommand2() {
1208template <class T> 1254template <class T>
1209void UnitTest() { 1255void UnitTest() {
1210 Regtest<T> regtest; 1256 Regtest<T> regtest;
1257 TEST(TestPrintf);
1211 TEST(TestRandomNumbers); 1258 TEST(TestRandomNumbers);
1212 TEST(TestRandomFile); 1259 TEST(TestRandomFile);
1213 TEST(TestFirstByte); 1260 TEST(TestFirstByte);
@@ -1222,7 +1269,7 @@ void UnitTest() {
1222// These are Xdelta tests. 1269// These are Xdelta tests.
1223template <class T> 1270template <class T>
1224void MainTest() { 1271void MainTest() {
1225 XPR(NT "Blocksize %"Q" windowsize %zu\n", 1272 XPR(NT "Blocksize %"Q"u windowsize %"Z"u\n",
1226 T::BLOCK_SIZE, T::WINDOW_SIZE); 1273 T::BLOCK_SIZE, T::WINDOW_SIZE);
1227 Regtest<T> regtest; 1274 Regtest<T> regtest;
1228 TEST(TestEmptyInMemory); 1275 TEST(TestEmptyInMemory);
@@ -1232,6 +1279,7 @@ void MainTest() {
1232 TEST(TestCopyFromEnd); 1279 TEST(TestCopyFromEnd);
1233 TEST(TestNonBlocking); 1280 TEST(TestNonBlocking);
1234 TEST(TestHalfBlockCopy); 1281 TEST(TestHalfBlockCopy);
1282 TEST(TestLastFrontierBlock);
1235 TEST(TestMergeCommand1); 1283 TEST(TestMergeCommand1);
1236 TEST(TestMergeCommand2); 1284 TEST(TestMergeCommand2);
1237} 1285}
diff --git a/xdelta3/xdelta3-blkcache.h b/xdelta3/xdelta3-blkcache.h
index 917a7b9..561c963 100644
--- a/xdelta3/xdelta3-blkcache.h
+++ b/xdelta3/xdelta3-blkcache.h
@@ -26,6 +26,9 @@
26typedef struct _main_blklru main_blklru; 26typedef struct _main_blklru main_blklru;
27typedef struct _main_blklru_list main_blklru_list; 27typedef struct _main_blklru_list main_blklru_list;
28 28
29
30#define XD3_INVALID_OFFSET XOFF_T_MAX
31
29struct _main_blklru_list 32struct _main_blklru_list
30{ 33{
31 main_blklru_list *next; 34 main_blklru_list *next;
@@ -40,11 +43,6 @@ struct _main_blklru
40 main_blklru_list link; 43 main_blklru_list link;
41}; 44};
42 45
43#define MAX_LRU_SIZE 32U
44#define XD3_MINSRCWINSZ (XD3_ALLOCSIZE * MAX_LRU_SIZE)
45#define XD3_MAXSRCWINSZ (1ULL << (SIZEOF_USIZE_T * 8 - 1))
46#define XD3_INVALID_OFFSET XOFF_T_MAX
47
48XD3_MAKELIST(main_blklru_list,main_blklru,link); 46XD3_MAKELIST(main_blklru_list,main_blklru,link);
49 47
50static usize_t lru_size = 0; 48static usize_t lru_size = 0;
@@ -247,7 +245,7 @@ main_set_source (xd3_stream *stream, xd3_cmd cmd,
247 245
248 if (sfile->size_known) 246 if (sfile->size_known)
249 { 247 {
250 short_sprintf (srcszbuf, "source size %s [%"Q"]", 248 short_sprintf (srcszbuf, "source size %s [%"Q"u]",
251 main_format_bcnt (source_size, &srccntbuf), 249 main_format_bcnt (source_size, &srccntbuf),
252 source_size); 250 source_size);
253 } 251 }
@@ -260,7 +258,7 @@ main_set_source (xd3_stream *stream, xd3_cmd cmd,
260 258
261 if (option_verbose > 1) 259 if (option_verbose > 1)
262 { 260 {
263 short_sprintf (nbufs, " #bufs %"Z, lru_size); 261 short_sprintf (nbufs, " #bufs %"Z"u", lru_size);
264 } 262 }
265 263
266 XPR(NT "source %s %s blksize %s window %s%s%s\n", 264 XPR(NT "source %s %s blksize %s window %s%s%s\n",
@@ -367,7 +365,7 @@ main_read_seek_source (xd3_stream *stream,
367 if (!option_quiet) 365 if (!option_quiet)
368 { 366 {
369 XPR(NT "source can't seek backwards; requested block offset " 367 XPR(NT "source can't seek backwards; requested block offset "
370 "%"Q" source position is %"Q"\n", 368 "%"Q"u source position is %"Q"u\n",
371 pos, sfile->source_position); 369 pos, sfile->source_position);
372 } 370 }
373 371
@@ -387,7 +385,7 @@ main_read_seek_source (xd3_stream *stream,
387 385
388 if (option_verbose > 1) 386 if (option_verbose > 1)
389 { 387 {
390 XPR(NT "seek error at offset %"Q": %s\n", 388 XPR(NT "seek error at offset %"Q"u: %s\n",
391 pos, xd3_mainerror (ret)); 389 pos, xd3_mainerror (ret));
392 } 390 }
393 } 391 }
@@ -396,7 +394,7 @@ main_read_seek_source (xd3_stream *stream,
396 394
397 if (option_verbose > 1 && pos != sfile->source_position) 395 if (option_verbose > 1 && pos != sfile->source_position)
398 { 396 {
399 XPR(NT "non-seekable source skipping %"Q" bytes @ %"Q"\n", 397 XPR(NT "non-seekable source skipping %"Q"u bytes @ %"Q"u\n",
400 pos - sfile->source_position, 398 pos - sfile->source_position,
401 sfile->source_position); 399 sfile->source_position);
402 } 400 }
@@ -432,7 +430,7 @@ main_read_seek_source (xd3_stream *stream,
432 430
433 if (nread != source->blksize) 431 if (nread != source->blksize)
434 { 432 {
435 IF_DEBUG1 (DP(RINT "[getblk] short skip block nread = %zu\n", 433 IF_DEBUG1 (DP(RINT "[getblk] short skip block nread = %"Z"u\n",
436 nread)); 434 nread));
437 stream->msg = "non-seekable input is short"; 435 stream->msg = "non-seekable input is short";
438 return XD3_INVALID_INPUT; 436 return XD3_INVALID_INPUT;
@@ -537,20 +535,20 @@ main_getblk_func (xd3_stream *stream,
537 { 535 {
538 if (blru->blkno != blkno) 536 if (blru->blkno != blkno)
539 { 537 {
540 XPR(NT "source block %"Q" read %zu ejects %"Q" (lru_hits=%u, " 538 XPR(NT "source block %"Q"u read %"Z"u ejects %"Q"u (lru_hits=%u, "
541 "lru_misses=%u, lru_filled=%u)\n", 539 "lru_misses=%u, lru_filled=%u)\n",
542 blkno, nread, blru->blkno, lru_hits, lru_misses, lru_filled); 540 blkno, nread, blru->blkno, lru_hits, lru_misses, lru_filled);
543 } 541 }
544 else 542 else
545 { 543 {
546 XPR(NT "source block %"Q" read %zu (lru_hits=%u, " 544 XPR(NT "source block %"Q"u read %"Z"u (lru_hits=%u, "
547 "lru_misses=%u, lru_filled=%u)\n", 545 "lru_misses=%u, lru_filled=%u)\n",
548 blkno, nread, lru_hits, lru_misses, lru_filled); 546 blkno, nread, lru_hits, lru_misses, lru_filled);
549 } 547 }
550 } 548 }
551 else 549 else
552 { 550 {
553 XPR(NT "source block %"Q" read %zu (lru_hits=%u, lru_misses=%u, " 551 XPR(NT "source block %"Q"u read %"Z"u (lru_hits=%u, lru_misses=%u, "
554 "lru_filled=%u)\n", blkno, nread, 552 "lru_filled=%u)\n", blkno, nread,
555 lru_hits, lru_misses, lru_filled); 553 lru_hits, lru_misses, lru_filled);
556 } 554 }
@@ -562,8 +560,8 @@ main_getblk_func (xd3_stream *stream,
562 blru->size = nread; 560 blru->size = nread;
563 blru->blkno = blkno; 561 blru->blkno = blkno;
564 562
565 IF_DEBUG1 (DP(RINT "[main_getblk] blkno %"Q" onblk %zu pos %"Q" " 563 IF_DEBUG1 (DP(RINT "[main_getblk] blkno %"Q"u onblk %"Z"u pos %"Q"u "
566 "srcpos %"Q"\n", 564 "srcpos %"Q"u\n",
567 blkno, nread, pos, sfile->source_position)); 565 blkno, nread, pos, sfile->source_position));
568 566
569 return 0; 567 return 0;
diff --git a/xdelta3/xdelta3-decode.h b/xdelta3/xdelta3-decode.h
index a9dad3f..7999bc3 100644
--- a/xdelta3/xdelta3-decode.h
+++ b/xdelta3/xdelta3-decode.h
@@ -1,5 +1,6 @@
1/* xdelta 3 - delta compression tools and library 1/* xdelta 3 - delta compression tools and library
2 * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007. Joshua P. MacDonald 2 * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
3 * 2011, 2012, 2013, 2014, 2015. Joshua P. MacDonald
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -25,6 +26,50 @@
25 VCD_SOURCE : ((((x) & VCD_SRCORTGT) == \ 26 VCD_SOURCE : ((((x) & VCD_SRCORTGT) == \
26 VCD_TARGET) ? VCD_TARGET : 0)) 27 VCD_TARGET) ? VCD_TARGET : 0))
27 28
29static inline int
30xd3_decode_byte (xd3_stream *stream, usize_t *val)
31{
32 if (stream->avail_in == 0)
33 {
34 stream->msg = "further input required";
35 return XD3_INPUT;
36 }
37
38 (*val) = stream->next_in[0];
39
40 DECODE_INPUT (1);
41 return 0;
42}
43
44static inline int
45xd3_decode_bytes (xd3_stream *stream, uint8_t *buf, usize_t *pos, usize_t size)
46{
47 usize_t want;
48 usize_t take;
49
50 /* Note: The case where (*pos == size) happens when a zero-length
51 * appheader or code table is transmitted, but there is nothing in
52 * the standard against that. */
53 while (*pos < size)
54 {
55 if (stream->avail_in == 0)
56 {
57 stream->msg = "further input required";
58 return XD3_INPUT;
59 }
60
61 want = size - *pos;
62 take = xd3_min (want, stream->avail_in);
63
64 memcpy (buf + *pos, stream->next_in, (size_t) take);
65
66 DECODE_INPUT (take);
67 (*pos) += take;
68 }
69
70 return 0;
71}
72
28/* Initialize the decoder for a new window. The dec_tgtlen value is 73/* Initialize the decoder for a new window. The dec_tgtlen value is
29 * preserved across successive window decodings, and the update to 74 * preserved across successive window decodings, and the update to
30 * dec_winstart is delayed until a new window actually starts. This 75 * dec_winstart is delayed until a new window actually starts. This
@@ -156,7 +201,7 @@ xd3_decode_section (xd3_stream *stream,
156 usize_t sect_need = section->size - section->pos; 201 usize_t sect_need = section->size - section->pos;
157 202
158 /* Allocate and copy */ 203 /* Allocate and copy */
159 sect_take = min (sect_need, stream->avail_in); 204 sect_take = xd3_min (sect_need, stream->avail_in);
160 205
161 if (section->pos == 0) 206 if (section->pos == 0)
162 { 207 {
@@ -583,7 +628,7 @@ xd3_decode_sections (xd3_stream *stream)
583 more = (need - stream->dec_winbytes); 628 more = (need - stream->dec_winbytes);
584 629
585 /* How much to consume. */ 630 /* How much to consume. */
586 take = min (more, stream->avail_in); 631 take = xd3_min (more, stream->avail_in);
587 632
588 /* See if the input is completely available, to avoid copy. */ 633 /* See if the input is completely available, to avoid copy. */
589 copy = (take != more); 634 copy = (take != more);
@@ -934,6 +979,7 @@ xd3_decode_input (xd3_stream *stream)
934 979
935 case DEC_CPYOFF: 980 case DEC_CPYOFF:
936 /* Copy window offset: only if VCD_SOURCE or VCD_TARGET is set */ 981 /* Copy window offset: only if VCD_SOURCE or VCD_TARGET is set */
982
937 OFFSET_CASE(SRCORTGT (stream->dec_win_ind), stream->dec_cpyoff, 983 OFFSET_CASE(SRCORTGT (stream->dec_win_ind), stream->dec_cpyoff,
938 DEC_ENCLEN); 984 DEC_ENCLEN);
939 985
diff --git a/xdelta3/xdelta3-djw.h b/xdelta3/xdelta3-djw.h
index 729f492..e6be032 100644
--- a/xdelta3/xdelta3-djw.h
+++ b/xdelta3/xdelta3-djw.h
@@ -456,7 +456,7 @@ djw_build_prefix (const djw_weight *freq, uint8_t *clen, usize_t asize, usize_t
456 djw_heapen *h2 = heap_extract (heap, ents, --heap_last); 456 djw_heapen *h2 = heap_extract (heap, ents, --heap_last);
457 457
458 ents[ents_size].freq = h1->freq + h2->freq; 458 ents[ents_size].freq = h1->freq + h2->freq;
459 ents[ents_size].depth = 1 + max (h1->depth, h2->depth); 459 ents[ents_size].depth = 1 + xd3_max (h1->depth, h2->depth);
460 ents[ents_size].parent = 0; 460 ents[ents_size].parent = 0;
461 461
462 h1->parent = h2->parent = ents_size; 462 h1->parent = h2->parent = ents_size;
@@ -525,7 +525,7 @@ djw_build_codes (usize_t *codes, const uint8_t *clen, usize_t asize, usize_t abs
525 min_clen = clen[i]; 525 min_clen = clen[i];
526 } 526 }
527 527
528 max_clen = max (max_clen, (usize_t) clen[i]); 528 max_clen = xd3_max (max_clen, (usize_t) clen[i]);
529 } 529 }
530 530
531 XD3_ASSERT (max_clen <= abs_max); 531 XD3_ASSERT (max_clen <= abs_max);
@@ -1799,7 +1799,7 @@ xd3_decode_huff (xd3_stream *stream,
1799 XD3_ASSERT (output_end - output > 0); 1799 XD3_ASSERT (output_end - output > 0);
1800 1800
1801 /* Decode next sector. */ 1801 /* Decode next sector. */
1802 n = min (sector_size, (usize_t) (output_end - output)); 1802 n = xd3_min (sector_size, (usize_t) (output_end - output));
1803 1803
1804 do 1804 do
1805 { 1805 {
diff --git a/xdelta3/xdelta3-internal.h b/xdelta3/xdelta3-internal.h
index d584141..8ef0bfa 100644
--- a/xdelta3/xdelta3-internal.h
+++ b/xdelta3/xdelta3-internal.h
@@ -1,5 +1,5 @@
1/* xdelta3 - delta compression tools and library 1/* xdelta3 - delta compression tools and library
2 * Copyright (C) 2011, 2012, 2014 Joshua P. MacDonald 2 * Copyright (C) 2011, 2012, 2013, 2014, 2015 Joshua P. MacDonald
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -47,6 +47,21 @@ void main_free (void *ptr);
47int test_compare_files (const char* f0, const char* f1); 47int test_compare_files (const char* f0, const char* f1);
48usize_t xd3_bytes_on_srcblk (xd3_source *src, xoff_t blkno); 48usize_t xd3_bytes_on_srcblk (xd3_source *src, xoff_t blkno);
49xoff_t xd3_source_eof(const xd3_source *src); 49xoff_t xd3_source_eof(const xd3_source *src);
50
51uint32_t xd3_large_cksum_update (uint32_t cksum,
52 const uint8_t *base,
53 usize_t look);
54int xd3_emit_byte (xd3_stream *stream,
55 xd3_output **outputp,
56 uint8_t code);
57
58int xd3_emit_bytes (xd3_stream *stream,
59 xd3_output **outputp,
60 const uint8_t *base,
61 usize_t size);
62xd3_output* xd3_alloc_output (xd3_stream *stream,
63 xd3_output *old_output);
64
50int xd3_encode_init_full (xd3_stream *stream); 65int xd3_encode_init_full (xd3_stream *stream);
51usize_t xd3_pow2_roundup (usize_t x); 66usize_t xd3_pow2_roundup (usize_t x);
52long get_millisecs_now (); 67long get_millisecs_now ();
@@ -75,14 +90,33 @@ typedef enum
75 XO_WRITE = 1 90 XO_WRITE = 1
76} main_file_modes; 91} main_file_modes;
77 92
93#ifndef XD3_POSIX
94#define XD3_POSIX 0
95#endif
96#ifndef XD3_STDIO
97#define XD3_STDIO 0
98#endif
99#ifndef XD3_WIN32
100#define XD3_WIN32 0
101#endif
102#ifndef NOT_MAIN
103#define NOT_MAIN 0
104#endif
105
106/* If none are set, default to posix. */
107#if (XD3_POSIX + XD3_STDIO + XD3_WIN32) == 0
108#undef XD3_POSIX
109#define XD3_POSIX 1
110#endif
111
78struct _main_file 112struct _main_file
79{ 113{
80#if XD3_STDIO 114#if XD3_WIN32
115 HANDLE file;
116#elif XD3_STDIO
81 FILE *file; 117 FILE *file;
82#elif XD3_POSIX 118#elif XD3_POSIX
83 int file; 119 int file;
84#elif XD3_WIN32
85 HANDLE file;
86#endif 120#endif
87 121
88 int mode; /* XO_READ and XO_WRITE */ 122 int mode; /* XO_READ and XO_WRITE */
@@ -102,19 +136,9 @@ struct _main_file
102 int seek_failed; /* after seek fails once, try FIFO */ 136 int seek_failed; /* after seek fails once, try FIFO */
103}; 137};
104 138
105/* According to the internet, Windows vsnprintf() differs from most
106 * Unix implementations regarding the terminating 0 when the boundary
107 * condition is met. It doesn't matter here, we don't rely on the
108 * trailing 0. Besides, both Windows and DJGPP vsnprintf return -1
109 * upon truncation, which isn't C99 compliant. To overcome this,
110 * recent MinGW runtimes provided their own vsnprintf (notice the
111 * absence of the '_' prefix) but they were initially buggy. So,
112 * always use the native '_'-prefixed version with Win32. */
113#ifdef _WIN32 139#ifdef _WIN32
114#define vsnprintf_func(str,size,fmt,args) \ 140#define vsnprintf_func _vsnprintf
115 _vsnprintf_s(str,size,size-1,fmt,args) 141#define snprintf_func _snprintf
116#define snprintf_func(str,size,fmt,...) \
117 _snprintf_s(str,size,size-1,fmt,__VA_ARGS__)
118#else 142#else
119#define vsnprintf_func vsnprintf 143#define vsnprintf_func vsnprintf
120#define snprintf_func snprintf 144#define snprintf_func snprintf
@@ -135,7 +159,6 @@ typedef struct {
135 * therefore always define xsnprintf_func. */ 159 * therefore always define xsnprintf_func. */
136#undef PRINTF_ATTRIBUTE 160#undef PRINTF_ATTRIBUTE
137#ifdef __GNUC__ 161#ifdef __GNUC__
138/* Let's just assume no one uses gcc 2.x! */
139#define PRINTF_ATTRIBUTE(x,y) __attribute__ ((__format__ (__printf__, x, y))) 162#define PRINTF_ATTRIBUTE(x,y) __attribute__ ((__format__ (__printf__, x, y)))
140#else 163#else
141#define PRINTF_ATTRIBUTE(x,y) 164#define PRINTF_ATTRIBUTE(x,y)
@@ -162,6 +185,154 @@ void xprintf(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);
162#define UINT32_OFLOW_MASK 0xfe000000U 185#define UINT32_OFLOW_MASK 0xfe000000U
163#define UINT64_OFLOW_MASK 0xfe00000000000000ULL 186#define UINT64_OFLOW_MASK 0xfe00000000000000ULL
164 187
188/*********************************************************************
189 Integer encoder/decoder functions
190 **********************************************************************/
191
192/* Consume N bytes of input, only used by the decoder. */
193#define DECODE_INPUT(n) \
194 do { \
195 stream->total_in += (xoff_t) (n); \
196 stream->avail_in -= (n); \
197 stream->next_in += (n); \
198 } while (0)
199
200#define DECODE_INTEGER_TYPE(PART,OFLOW) \
201 while (stream->avail_in != 0) \
202 { \
203 usize_t next = stream->next_in[0]; \
204 \
205 DECODE_INPUT(1); \
206 \
207 if (PART & OFLOW) \
208 { \
209 stream->msg = "overflow in decode_integer"; \
210 return XD3_INVALID_INPUT; \
211 } \
212 \
213 PART = (PART << 7) | (next & 127); \
214 \
215 if ((next & 128) == 0) \
216 { \
217 (*val) = PART; \
218 PART = 0; \
219 return 0; \
220 } \
221 } \
222 \
223 stream->msg = "further input required"; \
224 return XD3_INPUT
225
226#define READ_INTEGER_TYPE(TYPE, OFLOW) \
227 TYPE val = 0; \
228 const uint8_t *inp = (*inpp); \
229 usize_t next; \
230 \
231 do \
232 { \
233 if (inp == max) \
234 { \
235 stream->msg = "end-of-input in read_integer"; \
236 return XD3_INVALID_INPUT; \
237 } \
238 \
239 if (val & OFLOW) \
240 { \
241 stream->msg = "overflow in read_intger"; \
242 return XD3_INVALID_INPUT; \
243 } \
244 \
245 next = (*inp++); \
246 val = (val << 7) | (next & 127); \
247 } \
248 while (next & 128); \
249 \
250 (*valp) = val; \
251 (*inpp) = inp; \
252 \
253 return 0
254
255#define EMIT_INTEGER_TYPE() \
256 /* max 64-bit value in base-7 encoding is 9.1 bytes */ \
257 uint8_t buf[10]; \
258 usize_t bufi = 10; \
259 \
260 /* This loop performs division and turns on all MSBs. */ \
261 do \
262 { \
263 buf[--bufi] = (num & 127) | 128; \
264 num >>= 7U; \
265 } \
266 while (num != 0); \
267 \
268 /* Turn off MSB of the last byte. */ \
269 buf[9] &= 127; \
270 \
271 return xd3_emit_bytes (stream, output, buf + bufi, 10 - bufi)
272
273#define IF_SIZEOF32(x) if (num < (1U << (7 * (x)))) return (x);
274#define IF_SIZEOF64(x) if (num < (1ULL << (7 * (x)))) return (x);
275
276#if USE_UINT32
277static inline uint32_t
278xd3_sizeof_uint32_t (uint32_t num)
279{
280 IF_SIZEOF32(1);
281 IF_SIZEOF32(2);
282 IF_SIZEOF32(3);
283 IF_SIZEOF32(4);
284 return 5;
285}
286
287static inline int
288xd3_decode_uint32_t (xd3_stream *stream, uint32_t *val)
289{ DECODE_INTEGER_TYPE (stream->dec_32part, UINT32_OFLOW_MASK); }
290
291static inline int
292xd3_read_uint32_t (xd3_stream *stream, const uint8_t **inpp,
293 const uint8_t *max, uint32_t *valp)
294{ READ_INTEGER_TYPE (uint32_t, UINT32_OFLOW_MASK); }
295
296#if XD3_ENCODER
297static inline int
298xd3_emit_uint32_t (xd3_stream *stream, xd3_output **output, uint32_t num)
299{ EMIT_INTEGER_TYPE (); }
300#endif /* XD3_ENCODER */
301#endif /* USE_UINT32 */
302
303#if USE_UINT64
304static uint32_t
305xd3_sizeof_uint64_t (uint64_t num)
306{
307 IF_SIZEOF64(1);
308 IF_SIZEOF64(2);
309 IF_SIZEOF64(3);
310 IF_SIZEOF64(4);
311 IF_SIZEOF64(5);
312 IF_SIZEOF64(6);
313 IF_SIZEOF64(7);
314 IF_SIZEOF64(8);
315 IF_SIZEOF64(9);
316
317 return 10;
318}
319
320static inline int
321xd3_decode_uint64_t (xd3_stream *stream, uint64_t *val)
322{ DECODE_INTEGER_TYPE (stream->dec_64part, UINT64_OFLOW_MASK); }
323
324static int
325xd3_read_uint64_t (xd3_stream *stream, const uint8_t **inpp,
326 const uint8_t *max, uint64_t *valp)
327{ READ_INTEGER_TYPE (uint64_t, UINT64_OFLOW_MASK); }
328
329#if XD3_ENCODER
330static inline int
331xd3_emit_uint64_t (xd3_stream *stream, xd3_output **output, uint64_t num)
332{ EMIT_INTEGER_TYPE (); }
333#endif /* XD3_ENCODER */
334#endif /* USE_UINT64 */
335
165#if SIZEOF_USIZE_T == 4 336#if SIZEOF_USIZE_T == 4
166#define USIZE_T_MAX UINT32_MAX 337#define USIZE_T_MAX UINT32_MAX
167#define xd3_decode_size xd3_decode_uint32_t 338#define xd3_decode_size xd3_decode_uint32_t
@@ -180,7 +351,7 @@ void xprintf(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);
180#define xd3_large_cksum xd3_large64_cksum 351#define xd3_large_cksum xd3_large64_cksum
181#define xd3_large_cksum_update xd3_large64_cksum_update 352#define xd3_large_cksum_update xd3_large64_cksum_update
182#define xd3_hash_multiplier xd3_hash_multiplier64 353#define xd3_hash_multiplier xd3_hash_multiplier64
183#endif 354#endif /* SIZEOF_USIZE_T */
184 355
185#if SIZEOF_XOFF_T == 4 356#if SIZEOF_XOFF_T == 4
186#define XOFF_T_MAX UINT32_MAX 357#define XOFF_T_MAX UINT32_MAX
@@ -214,4 +385,8 @@ uint64_t xd3_large64_cksum_update (xd3_hash_cfg *cfg, uint64_t cksum,
214 const uint8_t *base, const usize_t look); 385 const uint8_t *base, const usize_t look);
215#endif /* USE_UINT64 */ 386#endif /* USE_UINT64 */
216 387
217#endif /* XDELTA3_INTERNAL_H__ */ 388#define MAX_LRU_SIZE 32U
389#define XD3_MINSRCWINSZ (XD3_ALLOCSIZE * MAX_LRU_SIZE)
390#define XD3_MAXSRCWINSZ (1ULL << 31)
391
392#endif // XDELTA3_INTERNAL_H__
diff --git a/xdelta3/xdelta3-lzma.h b/xdelta3/xdelta3-lzma.h
index 5f9f9c8..de317ee 100644
--- a/xdelta3/xdelta3-lzma.h
+++ b/xdelta3/xdelta3-lzma.h
@@ -1,5 +1,5 @@
1/* xdelta 3 - delta compression tools and library 1/* xdelta 3 - delta compression tools and library
2 * Copyright (C) 2012, 2013. Joshua P. MacDonald 2 * Copyright (C) 2012, 2013, 2014, 2015. Joshua P. MacDonald
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
diff --git a/xdelta3/xdelta3-main.h b/xdelta3/xdelta3-main.h
index 1871f14..8d36ebc 100644
--- a/xdelta3/xdelta3-main.h
+++ b/xdelta3/xdelta3-main.h
@@ -1,6 +1,6 @@
1/* xdelta3 - delta compression tools and library 1/* xdelta3 - delta compression tools and library
2 * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2 * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
3 * 2009, 2010, 2011, 2012, 2013 Joshua P. MacDonald 3 * 2009, 2010, 2011, 2012, 2013, 2014, 2015 Joshua P. MacDonald
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -84,12 +84,6 @@ xsnprintf_func (char *str, size_t n, const char *fmt, ...)
84 return ret; 84 return ret;
85} 85}
86 86
87/* If none are set, default to posix. */
88#if (XD3_POSIX + XD3_STDIO + XD3_WIN32) == 0
89#undef XD3_POSIX
90#define XD3_POSIX 1
91#endif
92
93/* Handle externally-compressed inputs. */ 87/* Handle externally-compressed inputs. */
94#ifndef EXTERNAL_COMPRESSION 88#ifndef EXTERNAL_COMPRESSION
95#define EXTERNAL_COMPRESSION 1 89#define EXTERNAL_COMPRESSION 1
@@ -353,8 +347,8 @@ xprintf (const char *fmt, ...)
353static int 347static int
354main_version (void) 348main_version (void)
355{ 349{
356 /* $Format: " XPR(NTR \"Xdelta version $Xdelta3Version$, Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, Joshua MacDonald\\n\");" $ */ 350 /* $Format: " XPR(NTR \"Xdelta version $Xdelta3Version$, Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, Joshua MacDonald\\n\");" $ */
357 XPR(NTR "Xdelta version 3.0.8, Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Joshua MacDonald\n"); 351 XPR(NTR "Xdelta version 3.0.10, Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Joshua MacDonald\n");
358 XPR(NTR "Xdelta comes with ABSOLUTELY NO WARRANTY.\n"); 352 XPR(NTR "Xdelta comes with ABSOLUTELY NO WARRANTY.\n");
359 XPR(NTR "This is free software, and you are welcome to redistribute it\n"); 353 XPR(NTR "This is free software, and you are welcome to redistribute it\n");
360 XPR(NTR "under certain conditions; see \"COPYING\" for details.\n"); 354 XPR(NTR "under certain conditions; see \"COPYING\" for details.\n");
@@ -389,6 +383,8 @@ main_config (void)
389 XPR(NTR "XD3_HARDMAXWINSIZE=%d\n", XD3_HARDMAXWINSIZE); 383 XPR(NTR "XD3_HARDMAXWINSIZE=%d\n", XD3_HARDMAXWINSIZE);
390 XPR(NTR "sizeof(void*)=%d\n", (int)sizeof(void*)); 384 XPR(NTR "sizeof(void*)=%d\n", (int)sizeof(void*));
391 XPR(NTR "sizeof(int)=%d\n", (int)sizeof(int)); 385 XPR(NTR "sizeof(int)=%d\n", (int)sizeof(int));
386 XPR(NTR "sizeof(long)=%d\n", (int)sizeof(long));
387 XPR(NTR "sizeof(long long)=%d\n", (int)sizeof(long long));
392 XPR(NTR "sizeof(size_t)=%d\n", (int)sizeof(size_t)); 388 XPR(NTR "sizeof(size_t)=%d\n", (int)sizeof(size_t));
393 XPR(NTR "sizeof(uint32_t)=%d\n", (int)sizeof(uint32_t)); 389 XPR(NTR "sizeof(uint32_t)=%d\n", (int)sizeof(uint32_t));
394 XPR(NTR "sizeof(uint64_t)=%d\n", (int)sizeof(uint64_t)); 390 XPR(NTR "sizeof(uint64_t)=%d\n", (int)sizeof(uint64_t));
@@ -608,7 +604,7 @@ main_format_bcnt (xoff_t r, shortbuf *buf)
608 604
609 if (r >= 100 && r < 1000) 605 if (r >= 100 && r < 1000)
610 { 606 {
611 short_sprintf (*buf, "%"Q" %s", r, fmts[i]); 607 short_sprintf (*buf, "%"Q"u %s", r, fmts[i]);
612 return buf->buf; 608 return buf->buf;
613 } 609 }
614 610
@@ -671,14 +667,14 @@ main_strtoxoff (const char* s, xoff_t *xo, char which)
671 XD3_ASSERT(s && *s != 0); 667 XD3_ASSERT(s && *s != 0);
672 668
673 { 669 {
674#if SIZEOF_XOFF_T == SIZEOF_LONG_LONG 670#if SIZEOF_XOFF_T == SIZEOF_UNSIGNED_LONG_LONG
675 unsigned long long xx = strtoull (s, &e, 0); 671 unsigned long long xx = strtoull (s, &e, 0);
676 unsigned long long bad = ULLONG_MAX; 672 unsigned long long bad = ULLONG_MAX;
677#elif SIZEOF_XOFF_T <= SIZEOF_LONG 673#elif SIZEOF_XOFF_T <= SIZEOF_UNSIGNED_LONG
678 unsigned long xx = strtoul (s, &e, 0); 674 unsigned long xx = strtoul (s, &e, 0);
679 unsigned long long bad = ULONG_MAX; 675 unsigned long long bad = ULONG_MAX;
680#else 676#else
681 /* Something wrong with SIZEOF_XOFF_T, SIZEOF_LONG, etc. */ 677 /* Something wrong with SIZEOF_XOFF_T, SIZEOF_UNSIGNED_LONG, etc. */
682#endif 678#endif
683 679
684 if (xx == bad) 680 if (xx == bad)
@@ -711,12 +707,12 @@ main_atoux (const char* arg, xoff_t *xo, xoff_t low,
711 707
712 if (x < low) 708 if (x < low)
713 { 709 {
714 XPR(NT "-%c: minimum value: %"Q"\n", which, low); 710 XPR(NT "-%c: minimum value: %"Q"u\n", which, low);
715 return EXIT_FAILURE; 711 return EXIT_FAILURE;
716 } 712 }
717 if (high != 0 && x > high) 713 if (high != 0 && x > high)
718 { 714 {
719 XPR(NT "-%c: maximum value: %"Q"\n", which, high); 715 XPR(NT "-%c: maximum value: %"Q"u\n", which, high);
720 return EXIT_FAILURE; 716 return EXIT_FAILURE;
721 } 717 }
722 (*xo) = x; 718 (*xo) = x;
@@ -979,7 +975,7 @@ xd3_posix_io (int fd, uint8_t *buf, size_t size,
979 975
980 while (nproc < size) 976 while (nproc < size)
981 { 977 {
982 size_t tryread = min(size - nproc, 1U << 30); 978 size_t tryread = xd3_min(size - nproc, 1U << 30);
983 ssize_t result = (*func) (fd, buf + nproc, tryread); 979 ssize_t result = (*func) (fd, buf + nproc, tryread);
984 980
985 if (result < 0) 981 if (result < 0)
@@ -1072,7 +1068,7 @@ main_file_read (main_file *ifile,
1072 } 1068 }
1073 else 1069 else
1074 { 1070 {
1075 if (option_verbose > 4) { XPR(NT "read %s: %zu bytes\n", 1071 if (option_verbose > 4) { XPR(NT "read %s: %"Z"u bytes\n",
1076 ifile->filename, (*nread)); } 1072 ifile->filename, (*nread)); }
1077 ifile->nread += (*nread); 1073 ifile->nread += (*nread);
1078 } 1074 }
@@ -1106,7 +1102,7 @@ main_file_write (main_file *ofile, uint8_t *buf, usize_t size, const char *msg)
1106 } 1102 }
1107 else 1103 else
1108 { 1104 {
1109 if (option_verbose > 5) { XPR(NT "write %s: %"Z" bytes\n", 1105 if (option_verbose > 5) { XPR(NT "write %s: %"Z"u bytes\n",
1110 ofile->filename, size); } 1106 ofile->filename, size); }
1111 ofile->nwrite += size; 1107 ofile->nwrite += size;
1112 } 1108 }
@@ -1247,9 +1243,10 @@ main_set_secondary_flags (xd3_config *config)
1247 VCDIFF TOOLS 1243 VCDIFF TOOLS
1248 *****************************************************************/ 1244 *****************************************************************/
1249 1245
1250#if VCDIFF_TOOLS
1251#include "xdelta3-merge.h" 1246#include "xdelta3-merge.h"
1252 1247
1248#if VCDIFF_TOOLS
1249
1253/* The following macros let VCDIFF print using main_file_write(), 1250/* The following macros let VCDIFF print using main_file_write(),
1254 * for example: 1251 * for example:
1255 * 1252 *
@@ -1291,7 +1288,7 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1291 1288
1292 if ((ret = xd3_decode_instruction (stream))) 1289 if ((ret = xd3_decode_instruction (stream)))
1293 { 1290 {
1294 XPR(NT "instruction decode error at %"Q": %s\n", 1291 XPR(NT "instruction decode error at %"Q"u: %s\n",
1295 stream->dec_winstart + size, stream->msg); 1292 stream->dec_winstart + size, stream->msg);
1296 return ret; 1293 return ret;
1297 } 1294 }
@@ -1299,7 +1296,7 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1299 addr_bytes = (usize_t)(stream->addr_sect.buf - addr_before); 1296 addr_bytes = (usize_t)(stream->addr_sect.buf - addr_before);
1300 inst_bytes = (usize_t)(stream->inst_sect.buf - inst_before); 1297 inst_bytes = (usize_t)(stream->inst_sect.buf - inst_before);
1301 1298
1302 VC(UT " %06"Q" %03"Z" %s %6"Z, 1299 VC(UT " %06"Q"u %03"Z"u %s %6"Z"u",
1303 stream->dec_winstart + size, 1300 stream->dec_winstart + size,
1304 option_print_cpymode ? code : 0, 1301 option_print_cpymode ? code : 0,
1305 xd3_rtype_to_string ((xd3_rtype) stream->dec_current1.type, 1302 xd3_rtype_to_string ((xd3_rtype) stream->dec_current1.type,
@@ -1312,12 +1309,12 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1312 { 1309 {
1313 if (stream->dec_current1.addr >= stream->dec_cpylen) 1310 if (stream->dec_current1.addr >= stream->dec_cpylen)
1314 { 1311 {
1315 VC(UT " T@%-6"Z, 1312 VC(UT " T@%-6"Z"u",
1316 stream->dec_current1.addr - stream->dec_cpylen)VE; 1313 stream->dec_current1.addr - stream->dec_cpylen)VE;
1317 } 1314 }
1318 else 1315 else
1319 { 1316 {
1320 VC(UT " S@%-6"Q, 1317 VC(UT " S@%-6"Q"u",
1321 stream->dec_cpyoff + stream->dec_current1.addr)VE; 1318 stream->dec_cpyoff + stream->dec_current1.addr)VE;
1322 } 1319 }
1323 } 1320 }
@@ -1331,7 +1328,7 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1331 1328
1332 if (stream->dec_current2.type != XD3_NOOP) 1329 if (stream->dec_current2.type != XD3_NOOP)
1333 { 1330 {
1334 VC(UT " %s %6"Z, 1331 VC(UT " %s %6"Z"u",
1335 xd3_rtype_to_string ((xd3_rtype) stream->dec_current2.type, 1332 xd3_rtype_to_string ((xd3_rtype) stream->dec_current2.type,
1336 option_print_cpymode), 1333 option_print_cpymode),
1337 stream->dec_current2.size)VE; 1334 stream->dec_current2.size)VE;
@@ -1340,12 +1337,12 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1340 { 1337 {
1341 if (stream->dec_current2.addr >= stream->dec_cpylen) 1338 if (stream->dec_current2.addr >= stream->dec_cpylen)
1342 { 1339 {
1343 VC(UT " T@%-6"Z, 1340 VC(UT " T@%-6"Z"u",
1344 stream->dec_current2.addr - stream->dec_cpylen)VE; 1341 stream->dec_current2.addr - stream->dec_cpylen)VE;
1345 } 1342 }
1346 else 1343 else
1347 { 1344 {
1348 VC(UT " S@%-6"Q"", 1345 VC(UT " S@%-6"Q"u",
1349 stream->dec_cpyoff + stream->dec_current2.addr)VE; 1346 stream->dec_cpyoff + stream->dec_current2.addr)VE;
1350 } 1347 }
1351 } 1348 }
@@ -1360,7 +1357,7 @@ main_print_window (xd3_stream* stream, main_file *xfile)
1360 (stream->dec_current1.type >= XD3_CPY || 1357 (stream->dec_current1.type >= XD3_CPY ||
1361 stream->dec_current2.type >= XD3_CPY)) 1358 stream->dec_current2.type >= XD3_CPY))
1362 { 1359 {
1363 VC(UT " %06"Q" (inefficiency) %"Z" encoded as %"Z" bytes\n", 1360 VC(UT " %06"Q"u (inefficiency) %"Z"u encoded as %"Z"u bytes\n",
1364 stream->dec_winstart + size_before, 1361 stream->dec_winstart + size_before,
1365 size - size_before, 1362 size - size_before,
1366 addr_bytes + inst_bytes)VE; 1363 addr_bytes + inst_bytes)VE;
@@ -1428,7 +1425,7 @@ main_print_func (xd3_stream* stream, main_file *xfile)
1428 if (stream->dec_winstart == 0) 1425 if (stream->dec_winstart == 0)
1429 { 1426 {
1430 VC(UT "VCDIFF version: 0\n")VE; 1427 VC(UT "VCDIFF version: 0\n")VE;
1431 VC(UT "VCDIFF header size: %"Z"\n", 1428 VC(UT "VCDIFF header size: %"Z"u\n",
1432 stream->dec_hdrsize)VE; 1429 stream->dec_hdrsize)VE;
1433 VC(UT "VCDIFF header indicator: ")VE; 1430 VC(UT "VCDIFF header indicator: ")VE;
1434 if ((stream->dec_hdr_ind & VCD_SECONDARY) != 0) 1431 if ((stream->dec_hdr_ind & VCD_SECONDARY) != 0)
@@ -1483,7 +1480,7 @@ main_print_func (xd3_stream* stream, main_file *xfile)
1483 VC(UT "\n")VE; 1480 VC(UT "\n")VE;
1484 } 1481 }
1485 1482
1486 VC(UT "VCDIFF window number: %"Q"\n", stream->current_window)VE; 1483 VC(UT "VCDIFF window number: %"Q"u\n", stream->current_window)VE;
1487 VC(UT "VCDIFF window indicator: ")VE; 1484 VC(UT "VCDIFF window indicator: ")VE;
1488 if ((stream->dec_win_ind & VCD_SOURCE) != 0) VC(UT "VCD_SOURCE ")VE; 1485 if ((stream->dec_win_ind & VCD_SOURCE) != 0) VC(UT "VCD_SOURCE ")VE;
1489 if ((stream->dec_win_ind & VCD_TARGET) != 0) VC(UT "VCD_TARGET ")VE; 1486 if ((stream->dec_win_ind & VCD_TARGET) != 0) VC(UT "VCD_TARGET ")VE;
@@ -1509,27 +1506,27 @@ main_print_func (xd3_stream* stream, main_file *xfile)
1509 1506
1510 if (stream->dec_winstart != 0) 1507 if (stream->dec_winstart != 0)
1511 { 1508 {
1512 VC(UT "VCDIFF window at offset: %"Q"\n", stream->dec_winstart)VE; 1509 VC(UT "VCDIFF window at offset: %"Q"u\n", stream->dec_winstart)VE;
1513 } 1510 }
1514 1511
1515 if (SRCORTGT (stream->dec_win_ind)) 1512 if (SRCORTGT (stream->dec_win_ind))
1516 { 1513 {
1517 VC(UT "VCDIFF copy window length: %"Z"\n", 1514 VC(UT "VCDIFF copy window length: %"Z"u\n",
1518 stream->dec_cpylen)VE; 1515 stream->dec_cpylen)VE;
1519 VC(UT "VCDIFF copy window offset: %"Q"\n", 1516 VC(UT "VCDIFF copy window offset: %"Q"u\n",
1520 stream->dec_cpyoff)VE; 1517 stream->dec_cpyoff)VE;
1521 } 1518 }
1522 1519
1523 VC(UT "VCDIFF delta encoding length: %"Z"\n", 1520 VC(UT "VCDIFF delta encoding length: %"Z"u\n",
1524 (usize_t)stream->dec_enclen)VE; 1521 (usize_t)stream->dec_enclen)VE;
1525 VC(UT "VCDIFF target window length: %"Z"\n", 1522 VC(UT "VCDIFF target window length: %"Z"u\n",
1526 (usize_t)stream->dec_tgtlen)VE; 1523 (usize_t)stream->dec_tgtlen)VE;
1527 1524
1528 VC(UT "VCDIFF data section length: %"Z"\n", 1525 VC(UT "VCDIFF data section length: %"Z"u\n",
1529 (usize_t)stream->data_sect.size)VE; 1526 (usize_t)stream->data_sect.size)VE;
1530 VC(UT "VCDIFF inst section length: %"Z"\n", 1527 VC(UT "VCDIFF inst section length: %"Z"u\n",
1531 (usize_t)stream->inst_sect.size)VE; 1528 (usize_t)stream->inst_sect.size)VE;
1532 VC(UT "VCDIFF addr section length: %"Z"\n", 1529 VC(UT "VCDIFF addr section length: %"Z"u\n",
1533 (usize_t)stream->addr_sect.size)VE; 1530 (usize_t)stream->addr_sect.size)VE;
1534 1531
1535 ret = 0; 1532 ret = 0;
@@ -1932,7 +1929,7 @@ main_merge_output (xd3_stream *stream, main_file *ofile)
1932 inst_pos < stream->whole_target.instlen) 1929 inst_pos < stream->whole_target.instlen)
1933 { 1930 {
1934 xd3_winst *inst = &stream->whole_target.inst[inst_pos]; 1931 xd3_winst *inst = &stream->whole_target.inst[inst_pos];
1935 usize_t take = min(inst->size, window_size - window_pos); 1932 usize_t take = xd3_min(inst->size, window_size - window_pos);
1936 xoff_t addr; 1933 xoff_t addr;
1937 1934
1938 switch (inst->type) 1935 switch (inst->type)
@@ -1955,8 +1952,8 @@ main_merge_output (xd3_stream *stream, main_file *ofile)
1955 if (inst->mode != 0) 1952 if (inst->mode != 0)
1956 { 1953 {
1957 if (window_srcset) { 1954 if (window_srcset) {
1958 window_srcmin = min(window_srcmin, inst->addr); 1955 window_srcmin = xd3_min (window_srcmin, inst->addr);
1959 window_srcmax = max(window_srcmax, inst->addr + take); 1956 window_srcmax = xd3_max (window_srcmax, inst->addr + take);
1960 } else { 1957 } else {
1961 window_srcset = 1; 1958 window_srcset = 1;
1962 window_srcmin = inst->addr; 1959 window_srcmin = inst->addr;
@@ -2248,7 +2245,7 @@ main_pipe_copier (uint8_t *pipe_buf,
2248 2245
2249 if (option_verbose && skipped != 0) 2246 if (option_verbose && skipped != 0)
2250 { 2247 {
2251 XPR(NT "skipping %"Q" bytes in %s\n", 2248 XPR(NT "skipping %"Q"u bytes in %s\n",
2252 skipped, ifile->filename); 2249 skipped, ifile->filename);
2253 } 2250 }
2254 return 0; 2251 return 0;
@@ -2419,7 +2416,7 @@ main_secondary_decompress_check (main_file *file,
2419{ 2416{
2420 int ret; 2417 int ret;
2421 usize_t i; 2418 usize_t i;
2422 usize_t try_read = min (input_size, XD3_ALLOCSIZE); 2419 usize_t try_read = xd3_min (input_size, XD3_ALLOCSIZE);
2423 size_t check_nread = 0; 2420 size_t check_nread = 0;
2424 uint8_t check_buf[XD3_ALLOCSIZE]; /* TODO: stack limit */ 2421 uint8_t check_buf[XD3_ALLOCSIZE]; /* TODO: stack limit */
2425 const main_extcomp *decompressor = NULL; 2422 const main_extcomp *decompressor = NULL;
@@ -2811,11 +2808,11 @@ main_get_appheader (xd3_stream *stream, main_file *ifile,
2811 2808
2812 if (appheadsz > 0) 2809 if (appheadsz > 0)
2813 { 2810 {
2814 const int kMaxArgs = 4;
2815 char *start = (char*)apphead; 2811 char *start = (char*)apphead;
2816 char *slash; 2812 char *slash;
2817 int place = 0; 2813 int place = 0;
2818 char *parsed[kMaxArgs]; 2814 const int kMaxArgs = 4;
2815 char *parsed[4];
2819 2816
2820 memset (parsed, 0, sizeof (parsed)); 2817 memset (parsed, 0, sizeof (parsed));
2821 2818
@@ -2944,10 +2941,10 @@ main_get_winsize (main_file *ifile) {
2944 2941
2945 if (main_file_stat (ifile, &file_size) == 0) 2942 if (main_file_stat (ifile, &file_size) == 0)
2946 { 2943 {
2947 size = (usize_t) min(file_size, (xoff_t) size); 2944 size = (usize_t) xd3_min (file_size, (xoff_t) size);
2948 } 2945 }
2949 2946
2950 size = max(size, XD3_ALLOCSIZE); 2947 size = xd3_max (size, XD3_ALLOCSIZE);
2951 2948
2952 if (option_verbose > 1) 2949 if (option_verbose > 1)
2953 { 2950 {
@@ -3178,7 +3175,7 @@ main_input (xd3_cmd cmd,
3178 3175
3179 input_remain = XOFF_T_MAX - input_offset; 3176 input_remain = XOFF_T_MAX - input_offset;
3180 3177
3181 try_read = (usize_t) min ((xoff_t) config.winsize, input_remain); 3178 try_read = (usize_t) xd3_min ((xoff_t) config.winsize, input_remain);
3182 3179
3183 if ((ret = main_read_primary_input (ifile, main_bdata, 3180 if ((ret = main_read_primary_input (ifile, main_bdata,
3184 try_read, & nread))) 3181 try_read, & nread)))
@@ -3289,7 +3286,7 @@ main_input (xd3_cmd cmd,
3289 /* Warn when no source copies are found */ 3286 /* Warn when no source copies are found */
3290 if (option_verbose && ! xd3_encoder_used_source (& stream)) 3287 if (option_verbose && ! xd3_encoder_used_source (& stream))
3291 { 3288 {
3292 XPR(NT "warning: input window %"Q"..%"Q" has " 3289 XPR(NT "warning: input window %"Q"u..%"Q"u has "
3293 "no source copies\n", 3290 "no source copies\n",
3294 stream.current_window * winsize, 3291 stream.current_window * winsize,
3295 (stream.current_window+1) * winsize); 3292 (stream.current_window+1) * winsize);
@@ -3302,8 +3299,8 @@ main_input (xd3_cmd cmd,
3302 stream.srcwin_decided_early && 3299 stream.srcwin_decided_early &&
3303 stream.i_slots_used > stream.iopt_size) 3300 stream.i_slots_used > stream.iopt_size)
3304 { 3301 {
3305 XPR(NT "warning: input position %"Q" overflowed " 3302 XPR(NT "warning: input position %"Q"u overflowed "
3306 "instruction buffer, needed %"Z" (vs. %"Z"), " 3303 "instruction buffer, needed %"Z"u (vs. %"Z"u), "
3307 "consider changing -I\n", 3304 "consider changing -I\n",
3308 stream.current_window * winsize, 3305 stream.current_window * winsize,
3309 stream.i_slots_used, stream.iopt_size); 3306 stream.i_slots_used, stream.iopt_size);
@@ -3326,7 +3323,7 @@ main_input (xd3_cmd cmd,
3326 3323
3327 if (option_verbose > 1) 3324 if (option_verbose > 1)
3328 { 3325 {
3329 XPR(NT "%"Q": in %s (%s): out %s (%s): " 3326 XPR(NT "%"Q"u: in %s (%s): out %s (%s): "
3330 "total in %s: out %s: %s: srcpos %s\n", 3327 "total in %s: out %s: %s: srcpos %s\n",
3331 stream.current_window, 3328 stream.current_window,
3332 main_format_bcnt (this_read, &rdb), 3329 main_format_bcnt (this_read, &rdb),
@@ -3340,7 +3337,7 @@ main_input (xd3_cmd cmd,
3340 } 3337 }
3341 else 3338 else
3342 { 3339 {
3343 XPR(NT "%"Q": in %s: out %s: total in %s: " 3340 XPR(NT "%"Q"u: in %s: out %s: total in %s: "
3344 "out %s: %s\n", 3341 "out %s: %s\n",
3345 stream.current_window, 3342 stream.current_window,
3346 main_format_bcnt (this_read, &rdb), 3343 main_format_bcnt (this_read, &rdb),
@@ -3427,21 +3424,21 @@ done:
3427 if (option_verbose > 1 && cmd == CMD_ENCODE) 3424 if (option_verbose > 1 && cmd == CMD_ENCODE)
3428 { 3425 {
3429 XPR(NT "scanner configuration: %s\n", stream.smatcher.name); 3426 XPR(NT "scanner configuration: %s\n", stream.smatcher.name);
3430 XPR(NT "target hash table size: %"Z"\n", stream.small_hash.size); 3427 XPR(NT "target hash table size: %"Z"u\n", stream.small_hash.size);
3431 if (sfile != NULL && sfile->filename != NULL) 3428 if (sfile != NULL && sfile->filename != NULL)
3432 { 3429 {
3433 XPR(NT "source hash table size: %"Z"\n", stream.large_hash.size); 3430 XPR(NT "source hash table size: %"Z"u\n", stream.large_hash.size);
3434 } 3431 }
3435 } 3432 }
3436 3433
3437 if (option_verbose > 2 && cmd == CMD_ENCODE) 3434 if (option_verbose > 2 && cmd == CMD_ENCODE)
3438 { 3435 {
3439 XPR(NT "source copies: %"Q" (%"Q" bytes)\n", 3436 XPR(NT "source copies: %"Q"u (%"Q"u bytes)\n",
3440 stream.n_scpy, stream.l_scpy); 3437 stream.n_scpy, stream.l_scpy);
3441 XPR(NT "target copies: %"Q" (%"Q" bytes)\n", 3438 XPR(NT "target copies: %"Q"u (%"Q"u bytes)\n",
3442 stream.n_tcpy, stream.l_tcpy); 3439 stream.n_tcpy, stream.l_tcpy);
3443 XPR(NT "adds: %"Q" (%"Q" bytes)\n", stream.n_add, stream.l_add); 3440 XPR(NT "adds: %"Q"u (%"Q"u bytes)\n", stream.n_add, stream.l_add);
3444 XPR(NT "runs: %"Q" (%"Q" bytes)\n", stream.n_run, stream.l_run); 3441 XPR(NT "runs: %"Q"u (%"Q"u bytes)\n", stream.n_run, stream.l_run);
3445 } 3442 }
3446#endif 3443#endif
3447 3444
@@ -3453,7 +3450,7 @@ done:
3453 long end_time = get_millisecs_now (); 3450 long end_time = get_millisecs_now ();
3454 xoff_t nwrite = ofile != NULL ? ofile->nwrite : 0; 3451 xoff_t nwrite = ofile != NULL ? ofile->nwrite : 0;
3455 3452
3456 XPR(NT "finished in %s; input %"Q" output %"Q" bytes (%0.2f%%)\n", 3453 XPR(NT "finished in %s; input %"Q"u output %"Q"u bytes (%0.2f%%)\n",
3457 main_format_millis (end_time - start_time, &tm), 3454 main_format_millis (end_time - start_time, &tm),
3458 ifile->nread, nwrite, 100.0 * nwrite / ifile->nread); 3455 ifile->nread, nwrite, 100.0 * nwrite / ifile->nread);
3459 } 3456 }
diff --git a/xdelta3/xdelta3-merge.h b/xdelta3/xdelta3-merge.h
index e65978d..72bc892 100644
--- a/xdelta3/xdelta3-merge.h
+++ b/xdelta3/xdelta3-merge.h
@@ -446,7 +446,7 @@ xd3_merge_source_copy (xd3_stream *stream,
446 XD3_ASSERT (sinst->size > sinst_offset); 446 XD3_ASSERT (sinst->size > sinst_offset);
447 447
448 sinst_left = sinst->size - sinst_offset; 448 sinst_left = sinst->size - sinst_offset;
449 this_take = min (iinst.size, sinst_left); 449 this_take = xd3_min (iinst.size, sinst_left);
450 450
451 XD3_ASSERT (this_take > 0); 451 XD3_ASSERT (this_take > 0);
452 452
diff --git a/xdelta3/xdelta3-test.h b/xdelta3/xdelta3-test.h
index ccb158b..98da749 100644
--- a/xdelta3/xdelta3-test.h
+++ b/xdelta3/xdelta3-test.h
@@ -109,7 +109,7 @@ mt_exp_rand (uint32_t mean, uint32_t max_value)
109 (double)UINT32_MAX)); 109 (double)UINT32_MAX));
110 uint32_t x = (uint32_t) (mean_d * erand + 0.5); 110 uint32_t x = (uint32_t) (mean_d * erand + 0.5);
111 111
112 return min (x, max_value); 112 return xd3_min (x, max_value);
113} 113}
114 114
115#if SHELL_TESTS 115#if SHELL_TESTS
@@ -218,6 +218,20 @@ test_random_numbers (xd3_stream *stream, int ignore)
218 return XD3_INTERNAL; 218 return XD3_INTERNAL;
219} 219}
220 220
221static int
222test_printf_xoff (xd3_stream *stream, int ignore)
223{
224 char buf[64];
225 xoff_t x = XOFF_T_MAX;
226 snprintf_func (buf, sizeof(buf), "%"Q"u", x);
227 const char *expect = XD3_USE_LARGEFILE64 ?
228 "18446744073709551615" : "4294967295";
229 if (strcmp (buf, expect) == 0) {
230 return 0;
231 }
232 return XD3_INTERNAL;
233}
234
221static void 235static void
222test_unlink (char* file) 236test_unlink (char* file)
223{ 237{
@@ -245,14 +259,22 @@ test_cleanup (void)
245int test_setup (void) 259int test_setup (void)
246{ 260{
247 static int x = 0; 261 static int x = 0;
262 pid_t pid = getpid();
248 x++; 263 x++;
249 snprintf_func (TEST_TARGET_FILE, TESTFILESIZE, "/tmp/xdtest.target.%d", x); 264 snprintf_func (TEST_TARGET_FILE, TESTFILESIZE,
250 snprintf_func (TEST_SOURCE_FILE, TESTFILESIZE, "/tmp/xdtest.source.%d", x); 265 "/tmp/xdtest.%d.target.%d", pid, x);
251 snprintf_func (TEST_DELTA_FILE, TESTFILESIZE, "/tmp/xdtest.delta.%d", x); 266 snprintf_func (TEST_SOURCE_FILE, TESTFILESIZE,
252 snprintf_func (TEST_RECON_FILE, TESTFILESIZE, "/tmp/xdtest.recon.%d", x); 267 "/tmp/xdtest.%d.source.%d", pid, x);
253 snprintf_func (TEST_RECON2_FILE, TESTFILESIZE, "/tmp/xdtest.recon2.%d", x); 268 snprintf_func (TEST_DELTA_FILE, TESTFILESIZE,
254 snprintf_func (TEST_COPY_FILE, TESTFILESIZE, "/tmp/xdtest.copy.%d", x); 269 "/tmp/xdtest.%d.delta.%d", pid, x);
255 snprintf_func (TEST_NOPERM_FILE, TESTFILESIZE, "/tmp/xdtest.noperm.%d", x); 270 snprintf_func (TEST_RECON_FILE, TESTFILESIZE,
271 "/tmp/xdtest.%d.recon.%d", pid, x);
272 snprintf_func (TEST_RECON2_FILE, TESTFILESIZE,
273 "/tmp/xdtest.%d.recon2.%d", pid, x);
274 snprintf_func (TEST_COPY_FILE, TESTFILESIZE,
275 "/tmp/xdtest.%d.copy.%d", pid, x);
276 snprintf_func (TEST_NOPERM_FILE, TESTFILESIZE,
277 "/tmp/xdtest.%d.noperm.%d", pid, x);
256 test_cleanup(); 278 test_cleanup();
257 return 0; 279 return 0;
258} 280}
@@ -303,7 +325,7 @@ test_make_inputs (xd3_stream *stream, xoff_t *ss_out, xoff_t *ts_out)
303 double add_prob = (left == 0) ? 0 : (add_left / (double) left); 325 double add_prob = (left == 0) ? 0 : (add_left / (double) left);
304 int do_copy; 326 int do_copy;
305 327
306 next = min (left, next); 328 next = xd3_min (left, next);
307 do_copy = (next > add_left || 329 do_copy = (next > add_left ||
308 (mt_random (&static_mtrand) / \ 330 (mt_random (&static_mtrand) / \
309 (double)USIZE_T_MAX) >= add_prob); 331 (double)USIZE_T_MAX) >= add_prob);
@@ -414,7 +436,7 @@ test_compare_files (const char* tgt, const char *rec)
414 { 436 {
415 if (obuf[i] != rbuf[i]) 437 if (obuf[i] != rbuf[i])
416 { 438 {
417 XPR(NT "byte %u (read %u @ %"Q") %d != %d\n", 439 XPR(NT "byte %u (read %u @ %"Q"u) %d != %d\n",
418 (int)i, (int)oc, offset, obuf[i], rbuf[i]); 440 (int)i, (int)oc, offset, obuf[i], rbuf[i]);
419 diffs++; 441 diffs++;
420 return XD3_INTERNAL; 442 return XD3_INTERNAL;
@@ -738,10 +760,10 @@ test_address_cache (xd3_stream *stream, int unused)
738 p = (mt_random (&static_mtrand) / (double)UINT32_MAX); 760 p = (mt_random (&static_mtrand) / (double)UINT32_MAX);
739 prev_i = mt_random (&static_mtrand) % offset; 761 prev_i = mt_random (&static_mtrand) % offset;
740 nearby = (mt_random (&static_mtrand) % 256) % offset; 762 nearby = (mt_random (&static_mtrand) % 256) % offset;
741 nearby = max (1U, nearby); 763 nearby = xd3_max (1U, nearby);
742 764
743 if (p < 0.1) { addr = addrs[offset-nearby]; } 765 if (p < 0.1) { addr = addrs[offset-nearby]; }
744 else if (p < 0.4) { addr = min (addrs[prev_i] + nearby, offset-1); } 766 else if (p < 0.4) { addr = xd3_min (addrs[prev_i] + nearby, offset-1); }
745 else { addr = prev_i; } 767 else { addr = prev_i; }
746 768
747 if ((ret = xd3_encode_address (stream, addr, offset, & modes[offset]))) { return ret; } 769 if ((ret = xd3_encode_address (stream, addr, offset, & modes[offset]))) { return ret; }
@@ -891,7 +913,7 @@ test_decompress_text (xd3_stream *stream, uint8_t *enc, usize_t enc_size, usize_
891 913
892 input: 914 input:
893 /* Test decoding test_desize input bytes at a time */ 915 /* Test decoding test_desize input bytes at a time */
894 take = min (enc_size - pos, test_desize); 916 take = xd3_min (enc_size - pos, test_desize);
895 CHECK(take > 0); 917 CHECK(take > 0);
896 918
897 xd3_avail_input (stream, enc + pos, take); 919 xd3_avail_input (stream, enc + pos, take);
@@ -1068,9 +1090,9 @@ test_decompress_single_bit_error (xd3_stream *stream, int expected_non_failures)
1068 } 1090 }
1069 1091
1070 /* Check expected non-failures */ 1092 /* Check expected non-failures */
1071 if (non_failures != expected_non_failures) 1093 if (non_failures > expected_non_failures)
1072 { 1094 {
1073 XPR(NT "non-failures %u; expected %u", 1095 XPR(NT "non-failures %u > expected %u",
1074 non_failures, expected_non_failures); 1096 non_failures, expected_non_failures);
1075 stream->msg = "incorrect"; 1097 stream->msg = "incorrect";
1076 return XD3_INTERNAL; 1098 return XD3_INTERNAL;
@@ -1398,7 +1420,7 @@ test_secondary (xd3_stream *stream, const xd3_sec_type *sec, usize_t groups)
1398 if ((ret = sec->encode (stream, enc_stream, 1420 if ((ret = sec->encode (stream, enc_stream,
1399 in_head, out_head, & cfg))) 1421 in_head, out_head, & cfg)))
1400 { 1422 {
1401 XPR(NT "test %"Z": encode: %s", test_i, stream->msg); 1423 XPR(NT "test %"Z"u: encode: %s", test_i, stream->msg);
1402 goto fail; 1424 goto fail;
1403 } 1425 }
1404 1426
@@ -1437,7 +1459,7 @@ test_secondary (xd3_stream *stream, const xd3_sec_type *sec, usize_t groups)
1437 compress_size, dec_input, 1459 compress_size, dec_input,
1438 dec_correct, dec_output))) 1460 dec_correct, dec_output)))
1439 { 1461 {
1440 XPR(NT "test %"Z": decode: %s", test_i, stream->msg); 1462 XPR(NT "test %"Z"u: decode: %s", test_i, stream->msg);
1441 goto fail; 1463 goto fail;
1442 } 1464 }
1443 1465
@@ -1447,7 +1469,7 @@ test_secondary (xd3_stream *stream, const xd3_sec_type *sec, usize_t groups)
1447 * decoding. Really looking for faults here. */ 1469 * decoding. Really looking for faults here. */
1448 { 1470 {
1449 int i; 1471 int i;
1450 int bytes = min (compress_size, 10U); 1472 int bytes = xd3_min (compress_size, 10U);
1451 for (i = 0; i < bytes * 8; i += 1) 1473 for (i = 0; i < bytes * 8; i += 1)
1452 { 1474 {
1453 dec_input[i/8] ^= 1 << (i%8); 1475 dec_input[i/8] ^= 1 << (i%8);
@@ -1805,7 +1827,7 @@ test_command_line_arguments (xd3_stream *stream, int ignore)
1805 if (ratio >= TEST_ADD_RATIO + TEST_EPSILON) 1827 if (ratio >= TEST_ADD_RATIO + TEST_EPSILON)
1806 { 1828 {
1807 XPR(NT "test encode with size ratio %.4f, " 1829 XPR(NT "test encode with size ratio %.4f, "
1808 "expected < %.4f (%"Q", %"Q")\n", 1830 "expected < %.4f (%"Q"u, %"Q"u)\n",
1809 ratio, TEST_ADD_RATIO + TEST_EPSILON, dsize, tsize); 1831 ratio, TEST_ADD_RATIO + TEST_EPSILON, dsize, tsize);
1810 stream->msg = "strange encoding"; 1832 stream->msg = "strange encoding";
1811 return XD3_INTERNAL; 1833 return XD3_INTERNAL;
@@ -2691,14 +2713,14 @@ test_string_matching (xd3_stream *stream, int ignore)
2691 default: CHECK(0); 2713 default: CHECK(0);
2692 } 2714 }
2693 2715
2694 snprintf_func (rptr, rbuf+TESTBUFSIZE-rptr, "%"Z"/%"Z"", 2716 snprintf_func (rptr, rbuf+TESTBUFSIZE-rptr, "%"Z"u/%"Z"u",
2695 inst->pos, inst->size); 2717 inst->pos, inst->size);
2696 rptr += strlen (rptr); 2718 rptr += strlen (rptr);
2697 2719
2698 if (inst->type == XD3_CPY) 2720 if (inst->type == XD3_CPY)
2699 { 2721 {
2700 *rptr++ = '@'; 2722 *rptr++ = '@';
2701 snprintf_func (rptr, rbuf+TESTBUFSIZE-rptr, "%"Q, inst->addr); 2723 snprintf_func (rptr, rbuf+TESTBUFSIZE-rptr, "%"Q"u", inst->addr);
2702 rptr += strlen (rptr); 2724 rptr += strlen (rptr);
2703 } 2725 }
2704 2726
@@ -2714,7 +2736,7 @@ test_string_matching (xd3_stream *stream, int ignore)
2714 2736
2715 if (strcmp (rbuf, test->result) != 0) 2737 if (strcmp (rbuf, test->result) != 0)
2716 { 2738 {
2717 XPR(NT "test %"Z": expected %s: got %s", i, test->result, rbuf); 2739 XPR(NT "test %"Z"u: expected %s: got %s", i, test->result, rbuf);
2718 stream->msg = "wrong result"; 2740 stream->msg = "wrong result";
2719 return XD3_INTERNAL; 2741 return XD3_INTERNAL;
2720 } 2742 }
@@ -2899,6 +2921,7 @@ int xd3_selftest (void)
2899 2921
2900 int ret; 2922 int ret;
2901 DO_TEST (random_numbers, 0, 0); 2923 DO_TEST (random_numbers, 0, 0);
2924 DO_TEST (printf_xoff, 0, 0);
2902 2925
2903 DO_TEST (decode_integer_end_of_input, 0, 0); 2926 DO_TEST (decode_integer_end_of_input, 0, 0);
2904 DO_TEST (decode_integer_overflow, 0, 0); 2927 DO_TEST (decode_integer_overflow, 0, 0);
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c
index 42fdfe2..266574f 100644
--- a/xdelta3/xdelta3.c
+++ b/xdelta3/xdelta3.c
@@ -1,6 +1,6 @@
1/* xdelta 3 - delta compression tools and library 1/* xdelta 3 - delta compression tools and library
2 * Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007, 2 * Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007,
3 * 2008, 2009, 2010, 2011, 2012, 2013. Joshua P. MacDonald 3 * 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015. Joshua P. MacDonald
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -265,6 +265,7 @@
265#define __XDELTA3_C_HEADER_PASS__ 265#define __XDELTA3_C_HEADER_PASS__
266 266
267#include "xdelta3.h" 267#include "xdelta3.h"
268#include "xdelta3-internal.h"
268 269
269/*********************************************************************** 270/***********************************************************************
270 STATIC CONFIGURATION 271 STATIC CONFIGURATION
@@ -449,14 +450,6 @@ XD3_MAKELIST(xd3_rlist, xd3_rinst, link);
449#define IF_BUILD_DEFAULT(x) 450#define IF_BUILD_DEFAULT(x)
450#endif 451#endif
451 452
452/* Consume N bytes of input, only used by the decoder. */
453#define DECODE_INPUT(n) \
454 do { \
455 stream->total_in += (xoff_t) (n); \
456 stream->avail_in -= (n); \
457 stream->next_in += (n); \
458 } while (0)
459
460/* Update the run-length state */ 453/* Update the run-length state */
461#define NEXTRUN(c) do { if ((c) == run_c) { run_l += 1; } \ 454#define NEXTRUN(c) do { if ((c) == run_c) { run_l += 1; } \
462 else { run_c = (c); run_l = 1; } } while (0) 455 else { run_c = (c); run_l = 1; } } while (0)
@@ -476,23 +469,11 @@ static void* xd3_alloc0 (xd3_stream *stream,
476 usize_t size); 469 usize_t size);
477 470
478 471
479static xd3_output* xd3_alloc_output (xd3_stream *stream,
480 xd3_output *old_output);
481
482static int xd3_alloc_iopt (xd3_stream *stream, usize_t elts); 472static int xd3_alloc_iopt (xd3_stream *stream, usize_t elts);
483 473
484static void xd3_free_output (xd3_stream *stream, 474static void xd3_free_output (xd3_stream *stream,
485 xd3_output *output); 475 xd3_output *output);
486 476
487static int xd3_emit_byte (xd3_stream *stream,
488 xd3_output **outputp,
489 uint8_t code);
490
491static int xd3_emit_bytes (xd3_stream *stream,
492 xd3_output **outputp,
493 const uint8_t *base,
494 usize_t size);
495
496static int xd3_emit_double (xd3_stream *stream, xd3_rinst *first, 477static int xd3_emit_double (xd3_stream *stream, xd3_rinst *first,
497 xd3_rinst *second, uint8_t code); 478 xd3_rinst *second, uint8_t code);
498static int xd3_emit_single (xd3_stream *stream, xd3_rinst *single, 479static int xd3_emit_single (xd3_stream *stream, xd3_rinst *single,
@@ -521,8 +502,6 @@ static int xd3_srcwin_move_point (xd3_stream *stream,
521 502
522static int xd3_emit_run (xd3_stream *stream, usize_t pos, 503static int xd3_emit_run (xd3_stream *stream, usize_t pos,
523 usize_t size, uint8_t *run_c); 504 usize_t size, uint8_t *run_c);
524static usize_t xd3_checksum_hash (const xd3_hash_cfg *cfg,
525 const usize_t cksum);
526static xoff_t xd3_source_cksum_offset(xd3_stream *stream, usize_t low); 505static xoff_t xd3_source_cksum_offset(xd3_stream *stream, usize_t low);
527static void xd3_scksum_insert (xd3_stream *stream, 506static void xd3_scksum_insert (xd3_stream *stream,
528 usize_t inx, 507 usize_t inx,
@@ -1167,52 +1146,8 @@ xd3_comprun (const uint8_t *seg, usize_t slook, uint8_t *run_cp)
1167 Basic encoder/decoder functions 1146 Basic encoder/decoder functions
1168 ***********************************************************************/ 1147 ***********************************************************************/
1169 1148
1170static inline int
1171xd3_decode_byte (xd3_stream *stream, usize_t *val)
1172{
1173 if (stream->avail_in == 0)
1174 {
1175 stream->msg = "further input required";
1176 return XD3_INPUT;
1177 }
1178
1179 (*val) = stream->next_in[0];
1180
1181 DECODE_INPUT (1);
1182 return 0;
1183}
1184
1185static inline int
1186xd3_decode_bytes (xd3_stream *stream, uint8_t *buf, usize_t *pos, usize_t size)
1187{
1188 usize_t want;
1189 usize_t take;
1190
1191 /* Note: The case where (*pos == size) happens when a zero-length
1192 * appheader or code table is transmitted, but there is nothing in
1193 * the standard against that. */
1194 while (*pos < size)
1195 {
1196 if (stream->avail_in == 0)
1197 {
1198 stream->msg = "further input required";
1199 return XD3_INPUT;
1200 }
1201
1202 want = size - *pos;
1203 take = min (want, stream->avail_in);
1204
1205 memcpy (buf + *pos, stream->next_in, (size_t) take);
1206
1207 DECODE_INPUT (take);
1208 (*pos) += take;
1209 }
1210
1211 return 0;
1212}
1213
1214#if XD3_ENCODER 1149#if XD3_ENCODER
1215static inline int 1150inline int
1216xd3_emit_byte (xd3_stream *stream, 1151xd3_emit_byte (xd3_stream *stream,
1217 xd3_output **outputp, 1152 xd3_output **outputp,
1218 uint8_t code) 1153 uint8_t code)
@@ -1236,7 +1171,7 @@ xd3_emit_byte (xd3_stream *stream,
1236 return 0; 1171 return 0;
1237} 1172}
1238 1173
1239static inline int 1174inline int
1240xd3_emit_bytes (xd3_stream *stream, 1175xd3_emit_bytes (xd3_stream *stream,
1241 xd3_output **outputp, 1176 xd3_output **outputp,
1242 const uint8_t *base, 1177 const uint8_t *base,
@@ -1260,7 +1195,7 @@ xd3_emit_bytes (xd3_stream *stream,
1260 output = (*outputp) = aoutput; 1195 output = (*outputp) = aoutput;
1261 } 1196 }
1262 1197
1263 take = min (output->avail - output->next, size); 1198 take = xd3_min (output->avail - output->next, size);
1264 1199
1265 memcpy (output->base + output->next, base, (size_t) take); 1200 memcpy (output->base + output->next, base, (size_t) take);
1266 1201
@@ -1274,158 +1209,6 @@ xd3_emit_bytes (xd3_stream *stream,
1274} 1209}
1275#endif /* XD3_ENCODER */ 1210#endif /* XD3_ENCODER */
1276 1211
1277/*********************************************************************
1278 Integer encoder/decoder functions
1279 **********************************************************************/
1280
1281#define DECODE_INTEGER_TYPE(TYPE,PART,OFLOW) \
1282 while (stream->avail_in != 0) \
1283 { \
1284 TYPE next = stream->next_in[0]; \
1285 \
1286 DECODE_INPUT(1); \
1287 \
1288 if (PART & OFLOW) \
1289 { \
1290 stream->msg = "overflow in decode_integer"; \
1291 return XD3_INVALID_INPUT; \
1292 } \
1293 \
1294 PART = (PART << 7) | (next & 127); \
1295 \
1296 if ((next & 128) == 0) \
1297 { \
1298 (*val) = PART; \
1299 PART = 0; \
1300 return 0; \
1301 } \
1302 } \
1303 \
1304 stream->msg = "further input required"; \
1305 return XD3_INPUT
1306
1307#define READ_INTEGER_TYPE(TYPE, OFLOW) \
1308 TYPE val = 0; \
1309 TYPE next; \
1310 const uint8_t *inp = (*inpp); \
1311 \
1312 do \
1313 { \
1314 if (inp == max) \
1315 { \
1316 stream->msg = "end-of-input in read_integer"; \
1317 return XD3_INVALID_INPUT; \
1318 } \
1319 \
1320 if (val & OFLOW) \
1321 { \
1322 stream->msg = "overflow in read_intger"; \
1323 return XD3_INVALID_INPUT; \
1324 } \
1325 \
1326 next = (*inp++); \
1327 val = (val << 7) | (next & 127); \
1328 } \
1329 while (next & 128); \
1330 \
1331 (*valp) = val; \
1332 (*inpp) = inp; \
1333 \
1334 return 0
1335
1336#define EMIT_INTEGER_TYPE() \
1337 /* max 64-bit value in base-7 encoding is 9.1 bytes */ \
1338 uint8_t buf[10]; \
1339 usize_t bufi = 10; \
1340 \
1341 /* This loop performs division and turns on all MSBs. */ \
1342 do \
1343 { \
1344 buf[--bufi] = (num & 127) | 128; \
1345 num >>= 7U; \
1346 } \
1347 while (num != 0); \
1348 \
1349 /* Turn off MSB of the last byte. */ \
1350 buf[9] &= 127; \
1351 \
1352 return xd3_emit_bytes (stream, output, buf + bufi, 10 - bufi)
1353
1354#if USE_UINT32
1355usize_t
1356xd3_sizeof_uint32_t (uint32_t num)
1357{
1358#define IF_SIZEOF32(x) if (num < (1U << (7 * (x)))) return (x);
1359 IF_SIZEOF32(1);
1360 IF_SIZEOF32(2);
1361 IF_SIZEOF32(3);
1362 IF_SIZEOF32(4);
1363#undef IF_SIZEOF32
1364 return 5;
1365}
1366
1367int
1368xd3_decode_uint32_t (xd3_stream *stream, uint32_t *val)
1369{
1370 DECODE_INTEGER_TYPE (uint32_t, stream->dec_32part, UINT32_OFLOW_MASK);
1371}
1372
1373int
1374xd3_read_uint32_t (xd3_stream *stream, const uint8_t **inpp,
1375 const uint8_t *max, uint32_t *valp)
1376{
1377 READ_INTEGER_TYPE (uint32_t, UINT32_OFLOW_MASK);
1378}
1379
1380#if XD3_ENCODER
1381int
1382xd3_emit_uint32_t (xd3_stream *stream, xd3_output **output, uint32_t num)
1383{
1384 EMIT_INTEGER_TYPE ();
1385}
1386#endif /* XD3_ENCODER */
1387#endif /* USE_UINT32 */
1388
1389#if USE_UINT64
1390int
1391xd3_decode_uint64_t (xd3_stream *stream, uint64_t *val)
1392{
1393 DECODE_INTEGER_TYPE (uint64_t, stream->dec_64part, UINT64_OFLOW_MASK);
1394}
1395
1396int
1397xd3_read_uint64_t (xd3_stream *stream, const uint8_t **inpp,
1398 const uint8_t *max, uint64_t *valp)
1399{
1400 READ_INTEGER_TYPE (uint64_t, UINT64_OFLOW_MASK);
1401}
1402
1403usize_t
1404xd3_sizeof_uint64_t (uint64_t num)
1405{
1406#define IF_SIZEOF64(x) if (num < (1ULL << (7 * (x)))) return (x);
1407 IF_SIZEOF64(1);
1408 IF_SIZEOF64(2);
1409 IF_SIZEOF64(3);
1410 IF_SIZEOF64(4);
1411 IF_SIZEOF64(5);
1412 IF_SIZEOF64(6);
1413 IF_SIZEOF64(7);
1414 IF_SIZEOF64(8);
1415 IF_SIZEOF64(9);
1416#undef IF_SIZEOF64
1417 return 10;
1418}
1419
1420#if XD3_ENCODER
1421int
1422xd3_emit_uint64_t (xd3_stream *stream, xd3_output **output, uint64_t num)
1423{
1424 EMIT_INTEGER_TYPE ();
1425}
1426#endif /* XD3_ENCODER */
1427#endif /* USE_UINT64 */
1428
1429/*********************************************************************** 1212/***********************************************************************
1430 Address cache stuff 1213 Address cache stuff
1431 ***********************************************************************/ 1214 ***********************************************************************/
@@ -1682,7 +1465,7 @@ xd3_alloc0 (xd3_stream *stream,
1682 return a; 1465 return a;
1683} 1466}
1684 1467
1685static xd3_output* 1468xd3_output*
1686xd3_alloc_output (xd3_stream *stream, 1469xd3_alloc_output (xd3_stream *stream,
1687 xd3_output *old_output) 1470 xd3_output *old_output)
1688{ 1471{
@@ -2123,6 +1906,13 @@ xd3_getblk (xd3_stream *stream, xoff_t blkno)
2123 } 1906 }
2124 else 1907 else
2125 { 1908 {
1909 source->frontier_blkno = blkno;
1910
1911 if (xd3_bytes_on_srcblk (source, blkno) != 0)
1912 {
1913 source->frontier_blkno += 1;
1914 }
1915
2126 if (!source->eof_known) 1916 if (!source->eof_known)
2127 { 1917 {
2128 IF_DEBUG2 (DP(RINT "[getblk] eof block has %d bytes; " 1918 IF_DEBUG2 (DP(RINT "[getblk] eof block has %d bytes; "
@@ -2131,8 +1921,6 @@ xd3_getblk (xd3_stream *stream, xoff_t blkno)
2131 xd3_source_eof (source))); 1921 xd3_source_eof (source)));
2132 source->eof_known = 1; 1922 source->eof_known = 1;
2133 } 1923 }
2134
2135 source->frontier_blkno = blkno;
2136 } 1924 }
2137 } 1925 }
2138 1926
@@ -2183,7 +1971,7 @@ xd3_set_source (xd3_stream *stream,
2183 src->max_winsize = xd3_xoff_roundup(src->max_winsize); 1971 src->max_winsize = xd3_xoff_roundup(src->max_winsize);
2184 IF_DEBUG1 (DP(RINT "raising src_maxsize to %u\n", src->blksize)); 1972 IF_DEBUG1 (DP(RINT "raising src_maxsize to %u\n", src->blksize));
2185 } 1973 }
2186 src->max_winsize = max(src->max_winsize, XD3_ALLOCSIZE); 1974 src->max_winsize = xd3_max (src->max_winsize, XD3_ALLOCSIZE);
2187 1975
2188 return 0; 1976 return 0;
2189} 1977}
@@ -2630,7 +2418,7 @@ xd3_iopt_flush_instructions (xd3_stream *stream, int force)
2630 /* Try to balance the length of both instructions, but avoid 2418 /* Try to balance the length of both instructions, but avoid
2631 * making both longer than MAX_MATCH_SPLIT . */ 2419 * making both longer than MAX_MATCH_SPLIT . */
2632 average = gap / 2; 2420 average = gap / 2;
2633 newsize = min (MAX_MATCH_SPLIT, gap - average); 2421 newsize = xd3_min (MAX_MATCH_SPLIT, gap - average);
2634 2422
2635 /* Should be possible to simplify this code. */ 2423 /* Should be possible to simplify this code. */
2636 if (newsize > r1->size) 2424 if (newsize > r1->size)
@@ -3107,7 +2895,7 @@ xd3_encode_buffer_leftover (xd3_stream *stream)
3107 2895
3108 /* Copy into the buffer. */ 2896 /* Copy into the buffer. */
3109 room = stream->winsize - stream->buf_avail; 2897 room = stream->winsize - stream->buf_avail;
3110 take = min (room, stream->avail_in); 2898 take = xd3_min (room, stream->avail_in);
3111 2899
3112 memcpy (stream->buf_in + stream->buf_avail, stream->next_in, take); 2900 memcpy (stream->buf_in + stream->buf_avail, stream->next_in, take);
3113 2901
@@ -3192,10 +2980,9 @@ xd3_encode_init (xd3_stream *stream, int full_init)
3192 2980
3193 if (small_comp) 2981 if (small_comp)
3194 { 2982 {
3195 /* TODO: This is under devel: used to have min(sprevsz) 2983 /* TODO: This is under devel: used to have min (sprevsz) here, which sort
3196 * here, which sort of makes sense, but observed fast 2984 * of makes sense, but observed fast performance w/ larger tables, which
3197 * performance w/ larger tables, which also sort of makes 2985 * also sort of makes sense. @@@ */
3198 * sense. @@@ */
3199 usize_t hash_values = stream->winsize; 2986 usize_t hash_values = stream->winsize;
3200 2987
3201 if ((ret = xd3_size_hashtable (stream, 2988 if ((ret = xd3_size_hashtable (stream,
@@ -3538,7 +3325,7 @@ xd3_process_stream (int is_encode,
3538 usize_t output_size_max) 3325 usize_t output_size_max)
3539{ 3326{
3540 usize_t ipos = 0; 3327 usize_t ipos = 0;
3541 usize_t n = min(stream->winsize, input_size); 3328 usize_t n = xd3_min (stream->winsize, input_size);
3542 3329
3543 (*output_size) = 0; 3330 (*output_size) = 0;
3544 3331
@@ -3554,8 +3341,8 @@ xd3_process_stream (int is_encode,
3554 { 3341 {
3555 case XD3_OUTPUT: { /* memcpy below */ break; } 3342 case XD3_OUTPUT: { /* memcpy below */ break; }
3556 case XD3_INPUT: { 3343 case XD3_INPUT: {
3557 n = min(stream->winsize, input_size - ipos); 3344 n = xd3_min(stream->winsize, input_size - ipos);
3558 if (n == 0) 3345 if (n == 0)
3559 { 3346 {
3560 goto done; 3347 goto done;
3561 } 3348 }
@@ -3630,7 +3417,7 @@ xd3_process_memory (int is_encode,
3630 3417
3631 if (is_encode) 3418 if (is_encode)
3632 { 3419 {
3633 config.winsize = min(input_size, (usize_t) XD3_DEFAULT_WINSIZE); 3420 config.winsize = xd3_min(input_size, (usize_t) XD3_DEFAULT_WINSIZE);
3634 config.sprevsz = xd3_pow2_roundup (config.winsize); 3421 config.sprevsz = xd3_pow2_roundup (config.winsize);
3635 } 3422 }
3636 3423
@@ -3886,7 +3673,7 @@ xd3_srcwin_setup (xd3_stream *stream)
3886 * now. */ 3673 * now. */
3887 src->srcbase = stream->match_minaddr; 3674 src->srcbase = stream->match_minaddr;
3888 /* TODO(jmacd) Need to check for overflow here. */ 3675 /* TODO(jmacd) Need to check for overflow here. */
3889 src->srclen = max ((usize_t) length, 3676 src->srclen = xd3_max ((usize_t) length,
3890 stream->avail_in + (stream->avail_in >> 2)); 3677 stream->avail_in + (stream->avail_in >> 2));
3891 3678
3892 if (src->eof_known) 3679 if (src->eof_known)
@@ -3895,10 +3682,9 @@ xd3_srcwin_setup (xd3_stream *stream)
3895 * code that expects to pass a single block w/ getblk == NULL 3682 * code that expects to pass a single block w/ getblk == NULL
3896 * will not function, as the code will return GETSRCBLK asking 3683 * will not function, as the code will return GETSRCBLK asking
3897 * for the second block. */ 3684 * for the second block. */
3898 src->srclen = min (src->srclen, xd3_source_eof(src) - src->srcbase); 3685 src->srclen = xd3_min (src->srclen, xd3_source_eof(src) - src->srcbase);
3899 } 3686 }
3900 3687 IF_DEBUG1 (DP(RINT "[srcwin_setup_constrained] base %"Q"u len %u\n",
3901 IF_DEBUG1 (DP(RINT "[srcwin_setup_constrained] base %llu len %llu\n",
3902 src->srcbase, src->srclen)); 3688 src->srcbase, src->srclen));
3903 3689
3904 XD3_ASSERT (src->srclen); 3690 XD3_ASSERT (src->srclen);
@@ -4159,7 +3945,7 @@ xd3_source_extend_match (xd3_stream *stream)
4159 return ret; 3945 return ret;
4160 } 3946 }
4161 3947
4162 tryrem = min (tryoff, stream->match_maxback - stream->match_back); 3948 tryrem = xd3_min (tryoff, stream->match_maxback - stream->match_back);
4163 3949
4164 IF_DEBUG2(DP(RINT "[maxback] maxback %u trysrc %"Q"/%u tgt %u tryrem %u\n", 3950 IF_DEBUG2(DP(RINT "[maxback] maxback %u trysrc %"Q"/%u tgt %u tryrem %u\n",
4165 stream->match_maxback, tryblk, tryoff, streamoff, tryrem)); 3951 stream->match_maxback, tryblk, tryoff, streamoff, tryrem));
@@ -4204,7 +3990,7 @@ xd3_source_extend_match (xd3_stream *stream)
4204 return ret; 3990 return ret;
4205 } 3991 }
4206 3992
4207 tryrem = min(stream->match_maxfwd - stream->match_fwd, 3993 tryrem = xd3_min(stream->match_maxfwd - stream->match_fwd,
4208 src->onblk - tryoff); 3994 src->onblk - tryoff);
4209 3995
4210 if (tryrem == 0) 3996 if (tryrem == 0)
@@ -4546,7 +4332,7 @@ xd3_srcwin_move_point (xd3_stream *stream, usize_t *next_move_point)
4546 4332
4547 /* Begin by advancing at twice the input rate, up to half the 4333 /* Begin by advancing at twice the input rate, up to half the
4548 * maximum window size. */ 4334 * maximum window size. */
4549 logical_input_cksum_pos = min((stream->total_in + stream->input_position) * 2, 4335 logical_input_cksum_pos = xd3_min((stream->total_in + stream->input_position) * 2,
4550 (stream->total_in + stream->input_position) + 4336 (stream->total_in + stream->input_position) +
4551 (stream->src->max_winsize / 2)); 4337 (stream->src->max_winsize / 2));
4552 4338
@@ -4775,9 +4561,9 @@ XD3_TEMPLATE(xd3_string_match_) (xd3_stream *stream)
4775 * of length 8 at the next position. */ 4561 * of length 8 at the next position. */
4776 if (xd3_iopt_last_matched (stream) > stream->input_position) 4562 if (xd3_iopt_last_matched (stream) > stream->input_position)
4777 { 4563 {
4778 stream->min_match = max(MIN_MATCH, 4564 stream->min_match = xd3_max (MIN_MATCH,
4779 1 + xd3_iopt_last_matched(stream) - 4565 1 + xd3_iopt_last_matched(stream) -
4780 stream->input_position); 4566 stream->input_position);
4781 } 4567 }
4782 else 4568 else
4783 { 4569 {
diff --git a/xdelta3/xdelta3.h b/xdelta3/xdelta3.h
index bb5f4d6..1b8f083 100644
--- a/xdelta3/xdelta3.h
+++ b/xdelta3/xdelta3.h
@@ -1,6 +1,6 @@
1/* xdelta 3 - delta compression tools and library 1/* xdelta 3 - delta compression tools and library
2 * Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007, 2 * Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007,
3 * 2008, 2009, 2010, 2011, 2012, 2013, 2014. Joshua P. MacDonald 3 * 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015. Joshua P. MacDonald
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -117,82 +117,140 @@
117#define __STDC_FORMAT_MACROS 117#define __STDC_FORMAT_MACROS
118#include <inttypes.h> 118#include <inttypes.h>
119#include <stdint.h> 119#include <stdint.h>
120#else 120#else /* WIN32 case */
121#define WIN32_LEAN_AND_MEAN 121#define WIN32_LEAN_AND_MEAN
122
123#ifndef WINVER
122#if XD3_USE_LARGEFILE64 124#if XD3_USE_LARGEFILE64
123/* 64 bit file offsets: uses GetFileSizeEx and SetFilePointerEx. 125/* 64 bit file offsets: uses GetFileSizeEx and SetFilePointerEx.
124 * requires Win2000 or newer version of WinNT */ 126 * requires Win2000 or newer version of WinNT */
125#define WINVER 0x0500 127#define WINVER 0x0500
126#define _WIN32_WINNT 0x0500 128#define _WIN32_WINNT 0x0500
127#else 129#else /* xoff_t is 32bit */
128/* 32 bit (DWORD) file offsets: uses GetFileSize and 130/* 32 bit (DWORD) file offsets: uses GetFileSize and
129 * SetFilePointer. compatible with win9x-me and WinNT4 */ 131 * SetFilePointer. compatible with win9x-me and WinNT4 */
130#define WINVER 0x0400 132#define WINVER 0x0400
131#define _WIN32_WINNT 0x0400 133#define _WIN32_WINNT 0x0400
132#endif 134#endif /* if XD3_USE_LARGEFILE64 */
135#endif /* ifndef WINVER */
136
133#include <windows.h> 137#include <windows.h>
138
139/* _MSV_VER is defined by Microsoft tools, not by mingw32 */
134#ifdef _MSC_VER 140#ifdef _MSC_VER
135#define inline 141/*#define inline*/
136typedef signed int ssize_t; 142typedef signed int ssize_t;
137#if _MSC_VER < 1600 143#if _MSC_VER < 1600
138typedef unsigned char uint8_t; 144typedef unsigned char uint8_t;
139typedef unsigned short uint16_t; 145typedef unsigned short uint16_t;
140typedef unsigned long uint32_t; 146typedef unsigned long uint32_t;
141typedef ULONGLONG uint64_t; 147typedef ULONGLONG uint64_t;
142#else 148#else /* _MSC_VER >= 1600 */
143/* For MSVC10 and above */ 149/* For MSVC10 and above */
144#include <stdint.h> 150#include <stdint.h>
145#endif 151#endif /* _MSC_VER < 1600 */
146#else 152#else /* _MSC_VER not defined */
147/* mingw32, lcc and watcom provide a proper header */ 153/* mingw32, lcc and watcom provide a proper header */
148#include <stdint.h> 154#include <stdint.h>
149#endif 155#endif /* _MSC_VER defined */
150#endif 156#endif /* _WIN32 defined */
151 157
158/* Settings based on the size of xoff_t (32 vs 64 file offsets) */
152#if XD3_USE_LARGEFILE64 159#if XD3_USE_LARGEFILE64
160/* xoff_t is a 64-bit type */
153#define __USE_FILE_OFFSET64 1 /* GLIBC: for 64bit fileops, ... ? */ 161#define __USE_FILE_OFFSET64 1 /* GLIBC: for 64bit fileops, ... ? */
162
154#ifndef _LARGEFILE_SOURCE 163#ifndef _LARGEFILE_SOURCE
155#define _LARGEFILE_SOURCE 164#define _LARGEFILE_SOURCE
156#endif 165#endif
166
157#ifndef _FILE_OFFSET_BITS 167#ifndef _FILE_OFFSET_BITS
158#define _FILE_OFFSET_BITS 64 168#define _FILE_OFFSET_BITS 64
159#endif 169#endif
160 170
161#define SIZEOF_XOFF_T 8 171/* Set a xoff_t typedef and the "Q" printf insert. */
172#if defined(_WIN32)
162typedef uint64_t xoff_t; 173typedef uint64_t xoff_t;
174/* Note: The following generates benign warnings in a mingw
175 * cross-compiler */
176#define Q "I64"
177#elif SIZEOF_UNSIGNED_LONG == 8
178typedef unsigned long xoff_t;
179#define Q "l"
180#elif SIZEOF_SIZE_T == 8
181typedef size_t xoff_t;
182#define Q "z"
183#elif SIZEOF_UNSIGNED_LONG_LONG == 8
184typedef unsigned long long xoff_t;
185#define Q "ll"
186#endif /* typedef and #define Q */
163 187
164#ifndef _WIN32 188#define SIZEOF_XOFF_T 8
165#define Q PRIu64
166#else /* _WIN32 */
167#define Q "I64u"
168#endif
169 189
170#else /* XD3_USE_LARGEFILE64 */ 190#else /* XD3_USE_LARGEFILE64 == 0 */
171 191
172#define SIZEOF_XOFF_T 4 192#if SIZEOF_UNSIGNED_INT == 4
193typedef unsigned int xoff_t;
194#elif SIZEOF_UNSIGNED_LONG == 4
195typedef unsigned long xoff_t;
196#else
173typedef uint32_t xoff_t; 197typedef uint32_t xoff_t;
198#endif /* xoff_t is 32 bits */
174 199
175#define Q "u" 200#define SIZEOF_XOFF_T 4
176 201#define Q
177#endif /* XD3_USE_LARGEFILE64 */ 202#endif /* 64 vs 32 bit xoff_t */
178 203
179#if XD3_USE_LARGEWINDOW64 204/* Settings based on the size of usize_t (32 and 64 bit window size) */
205#if XD3_USE_LARGESIZET
180 206
181#if !XD3_USE_LARGEFILE64 207/* Set a usize_ttypedef and the "W" printf insert. */
182#error "Invalid configuration" 208#if defined(_WIN32)
183#endif 209typedef uint64_t usize_t;
210/* Note: The following generates benign warnings in a mingw
211 * cross-compiler */
212#define W "I64"
213#elif SIZEOF_UNSIGNED_LONG == 8
214typedef unsigned long usize_t;
215#define W "l"
216#elif SIZEOF_SIZE_T == 8
217typedef size_t usize_t;
218#define W "z"
219#elif SIZEOF_UNSIGNED_LONG_LONG == 8
220typedef unsigned long long usize_t;
221#define W "ll"
222#endif /* typedef and #define W */
184 223
185#define SIZEOF_USIZE_T 8 224#define SIZEOF_USIZE_T 8
186typedef uint64_t usize_t;
187 225
188#define Z Q 226#else /* XD3_USE_LARGESIZET == 0 */
189#else /* XD3_USE_LARGEWINDOW64 */
190 227
191#define SIZEOF_USIZE_T 4 228#if SIZEOF_UNSIGNED_INT == 4
229typedef unsigned int usize_t;
230#elif SIZEOF_UNSIGNED_LONG == 4
231typedef unsigned long usize_t;
232#else
192typedef uint32_t usize_t; 233typedef uint32_t usize_t;
234#endif /* usize_t is 32 bits */
193 235
194#define Z "u" 236#define SIZEOF_USIZE_T 4
195#endif 237#define W
238
239#endif /* 64 vs 32 bit usize_t */
240
241/* Settings based on the size of size_t (the system-provided,
242 * usually-but-maybe-not an unsigned type) */
243#if SIZEOF_SIZE_T == 4
244#define Z "z"
245#elif SIZEOF_SIZE_T == 8
246#ifdef _WIN32
247#define Z "I64"
248#else /* !_WIN32 */
249#define Z "z"
250#endif /* Windows or not */
251#else
252#error Bad configure script
253#endif /* size_t printf flags */
196 254
197#define USE_UINT32 (SIZEOF_USIZE_T == 4 || \ 255#define USE_UINT32 (SIZEOF_USIZE_T == 4 || \
198 SIZEOF_XOFF_T == 4 || REGRESSION_TEST) 256 SIZEOF_XOFF_T == 4 || REGRESSION_TEST)
@@ -334,12 +392,8 @@ typedef int (xd3_comp_table_func) (xd3_stream *stream,
334#define XD3_ASSERT(x) (void)0 392#define XD3_ASSERT(x) (void)0
335#endif /* XD3_DEBUG */ 393#endif /* XD3_DEBUG */
336 394
337#ifndef max 395#define xd3_max(x,y) ((x) < (y) ? (y) : (x))
338#define max(x,y) ((x) < (y) ? (y) : (x)) 396#define xd3_min(x,y) ((x) < (y) ? (x) : (y))
339#endif
340#ifndef min
341#define min(x,y) ((x) < (y) ? (x) : (y))
342#endif
343 397
344/**************************************************************** 398/****************************************************************
345 PUBLIC ENUMS 399 PUBLIC ENUMS
diff --git a/xdelta3/xdelta3.prj b/xdelta3/xdelta3.prj
index 79f11a6..96c3a8c 100644
--- a/xdelta3/xdelta3.prj
+++ b/xdelta3/xdelta3.prj
@@ -9,7 +9,7 @@
9(Checkin-Login jmacd) 9(Checkin-Login jmacd)
10(Populate-Ignore ("\\.svn")) 10(Populate-Ignore ("\\.svn"))
11(Project-Keywords 11(Project-Keywords
12 (Xdelta3Version "3.0.8") 12 (Xdelta3Version "3.0.10")
13 ) 13 )
14(Files 14(Files
15 (COPYING (xdelta3/b/29_COPYING 1.1 744)) 15 (COPYING (xdelta3/b/29_COPYING 1.1 744))
diff --git a/xdelta3/xdelta3.vcxproj b/xdelta3/xdelta3.vcxproj
index 8cee9b9..1bff06b 100755
--- a/xdelta3/xdelta3.vcxproj
+++ b/xdelta3/xdelta3.vcxproj
@@ -197,7 +197,7 @@
197 <Link> 197 <Link>
198 <SubSystem>Console</SubSystem> 198 <SubSystem>Console</SubSystem>
199 <GenerateDebugInformation>true</GenerateDebugInformation> 199 <GenerateDebugInformation>true</GenerateDebugInformation>
200 <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;..\xz\bin_i486\liblzma_static.lib;%(AdditionalDependencies)</AdditionalDependencies> 200 <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;..\..\..\..\src\xz\bin_i486\liblzma_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
201 </Link> 201 </Link>
202 </ItemDefinitionGroup> 202 </ItemDefinitionGroup>
203 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'"> 203 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Itanium'">
@@ -224,7 +224,7 @@
224 <Link> 224 <Link>
225 <SubSystem>Console</SubSystem> 225 <SubSystem>Console</SubSystem>
226 <GenerateDebugInformation>true</GenerateDebugInformation> 226 <GenerateDebugInformation>true</GenerateDebugInformation>
227 <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;..\xz\bin_x86-64\liblzma_static.lib;%(AdditionalDependencies)</AdditionalDependencies> 227 <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;..\..\..\..\src\xz\bin_x86-64\liblzma_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
228 </Link> 228 </Link>
229 </ItemDefinitionGroup> 229 </ItemDefinitionGroup>
230 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 230 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -236,14 +236,14 @@
236 <IntrinsicFunctions>true</IntrinsicFunctions> 236 <IntrinsicFunctions>true</IntrinsicFunctions>
237 <PreprocessorDefinitions>WIN32;XD3_MAIN=1;XD3_DEBUG=0;XD3_USE_LARGEFILE64=1;REGRESSION_TEST=1;SECONDARY_DJW=1;SECONDARY_FGK=1;SECONDARY_LZMA=1;XD3_WIN32=1;EXTERNAL_COMPRESSION=0;SHELL_TESTS=0;_DEBUG;_CONSOLE;LZMA_API_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> 237 <PreprocessorDefinitions>WIN32;XD3_MAIN=1;XD3_DEBUG=0;XD3_USE_LARGEFILE64=1;REGRESSION_TEST=1;SECONDARY_DJW=1;SECONDARY_FGK=1;SECONDARY_LZMA=1;XD3_WIN32=1;EXTERNAL_COMPRESSION=0;SHELL_TESTS=0;_DEBUG;_CONSOLE;LZMA_API_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
238 <RuntimeLibrary>MultiThreaded</RuntimeLibrary> 238 <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
239 <AdditionalIncludeDirectories>..\xz\include</AdditionalIncludeDirectories> 239 <AdditionalIncludeDirectories>..\..\..\..\src\xz\include</AdditionalIncludeDirectories>
240 </ClCompile> 240 </ClCompile>
241 <Link> 241 <Link>
242 <SubSystem>Console</SubSystem> 242 <SubSystem>Console</SubSystem>
243 <GenerateDebugInformation>true</GenerateDebugInformation> 243 <GenerateDebugInformation>true</GenerateDebugInformation>
244 <EnableCOMDATFolding>true</EnableCOMDATFolding> 244 <EnableCOMDATFolding>true</EnableCOMDATFolding>
245 <OptimizeReferences>true</OptimizeReferences> 245 <OptimizeReferences>true</OptimizeReferences>
246 <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;..\xz\bin_i486\liblzma_static.lib;%(AdditionalDependencies)</AdditionalDependencies> 246 <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;..\..\..\..\src\xz\bin_i486\liblzma_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
247 </Link> 247 </Link>
248 </ItemDefinitionGroup> 248 </ItemDefinitionGroup>
249 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'"> 249 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Itanium'">
@@ -272,13 +272,14 @@
272 <IntrinsicFunctions>true</IntrinsicFunctions> 272 <IntrinsicFunctions>true</IntrinsicFunctions>
273 <PreprocessorDefinitions>WIN32;XD3_MAIN=1;XD3_DEBUG=0;XD3_USE_LARGEFILE64=1;REGRESSION_TEST=1;SECONDARY_DJW=1;SECONDARY_FGK=1;SECONDARY_LZMA=1;XD3_WIN32=1;EXTERNAL_COMPRESSION=0;SHELL_TESTS=0;_DEBUG;_CONSOLE;LZMA_API_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> 273 <PreprocessorDefinitions>WIN32;XD3_MAIN=1;XD3_DEBUG=0;XD3_USE_LARGEFILE64=1;REGRESSION_TEST=1;SECONDARY_DJW=1;SECONDARY_FGK=1;SECONDARY_LZMA=1;XD3_WIN32=1;EXTERNAL_COMPRESSION=0;SHELL_TESTS=0;_DEBUG;_CONSOLE;LZMA_API_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
274 <RuntimeLibrary>MultiThreaded</RuntimeLibrary> 274 <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
275 <AdditionalIncludeDirectories>..\..\..\..\src\xz\include</AdditionalIncludeDirectories>
275 </ClCompile> 276 </ClCompile>
276 <Link> 277 <Link>
277 <SubSystem>Console</SubSystem> 278 <SubSystem>Console</SubSystem>
278 <GenerateDebugInformation>true</GenerateDebugInformation> 279 <GenerateDebugInformation>true</GenerateDebugInformation>
279 <EnableCOMDATFolding>true</EnableCOMDATFolding> 280 <EnableCOMDATFolding>true</EnableCOMDATFolding>
280 <OptimizeReferences>true</OptimizeReferences> 281 <OptimizeReferences>true</OptimizeReferences>
281 <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);..\xz\bin_x86-64\liblzma_static.lib</AdditionalDependencies> 282 <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);..\..\..\..\src\xz\bin_x86-64\liblzma_static.lib</AdditionalDependencies>
282 </Link> 283 </Link>
283 </ItemDefinitionGroup> 284 </ItemDefinitionGroup>
284 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='xdelta3-64|Win32'"> 285 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='xdelta3-64|Win32'">