summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulian Seward <jseward@acm.org>2006-12-20 22:13:13 +0100
committerJulian Seward <jseward@acm.org>2006-12-20 22:13:13 +0100
commitf10a33538e9bab6deb61779b3d8aae168824ef48 (patch)
treeecd1c2ed553ced58a090e0d8b7b7a20bb7c95c80
parentbzip2-1.0.3 (diff)
downloadbzip2-f10a33538e9bab6deb61779b3d8aae168824ef48.tar.gz
bzip2-f10a33538e9bab6deb61779b3d8aae168824ef48.tar.bz2
bzip2-f10a33538e9bab6deb61779b3d8aae168824ef48.tar.xz
bzip2-1.0.4bzip2-1.0.4
-rw-r--r--CHANGES41
-rw-r--r--LICENSE9
-rw-r--r--Makefile30
-rw-r--r--Makefile-libbz2_so31
-rw-r--r--README100
-rw-r--r--README.COMPILATION.PROBLEMS37
-rw-r--r--README.XML.STUFF22
-rw-r--r--Y2K_INFO34
-rw-r--r--blocksort.c77
-rw-r--r--bz-fo.xsl19
-rw-r--r--bzdiff4
-rw-r--r--bzgrep6
-rw-r--r--bzip2.16
-rw-r--r--bzip2.1.preformatted14
-rw-r--r--bzip2.c205
-rw-r--r--bzip2.txt14
-rw-r--r--bzip2recover.c88
-rw-r--r--bzlib.c95
-rw-r--r--bzlib.h69
-rw-r--r--bzlib_private.h88
-rw-r--r--compress.c86
-rw-r--r--crctable.c60
-rw-r--r--decompress.c66
-rw-r--r--dlltest.c5
-rw-r--r--entities.xml6
-rwxr-xr-xformat.pl15
-rw-r--r--huffman.c66
-rw-r--r--manual.xml28
-rw-r--r--mk251.c15
-rw-r--r--randtable.c60
-rw-r--r--spewG.c15
-rw-r--r--unzcrash.c17
-rw-r--r--words06
-rw-r--r--words22
-rw-r--r--words313
-rwxr-xr-xxmlproc.sh19
36 files changed, 593 insertions, 875 deletions
diff --git a/CHANGES b/CHANGES
index e31b03a..0959ea0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,16 @@
1 ------------------------------------------------------------------
2 This file is part of bzip2/libbzip2, a program and library for
3 lossless, block-sorting data compression.
4
5 bzip2/libbzip2 version 1.0.4 of 20 December 2006
6 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
7
8 Please read the WARNING, DISCLAIMER and PATENTS sections in the
9 README file.
10
11 This program is released under the terms of the license contained
12 in the file LICENSE.
13 ------------------------------------------------------------------
1 14
2 15
30.9.0 160.9.0
@@ -261,7 +274,7 @@ Fixes some minor bugs since the last version, 1.0.2.
261 decompressor to crash, loop or access memory which does not 274 decompressor to crash, loop or access memory which does not
262 belong to it. If you are using bzip2 or the library to 275 belong to it. If you are using bzip2 or the library to
263 decompress bitstreams from untrusted sources, an upgrade 276 decompress bitstreams from untrusted sources, an upgrade
264 to 1.0.3 is recommended. 277 to 1.0.3 is recommended. This fixes CAN-2005-1260.
265 278
266* The documentation has been converted to XML, from which html 279* The documentation has been converted to XML, from which html
267 and pdf can be derived. 280 and pdf can be derived.
@@ -273,3 +286,29 @@ Fixes some minor bugs since the last version, 1.0.2.
273 286
274* The BZ_NO_STDIO cpp symbol was not properly observed in 1.0.2. 287* The BZ_NO_STDIO cpp symbol was not properly observed in 1.0.2.
275 This has been fixed. 288 This has been fixed.
289
290
2911.0.4 (20 Dec 06)
292~~~~~~~~~~~~~~~~~
293Fixes some minor bugs since the last version, 1.0.3.
294
295* Fix file permissions race problem (CAN-2005-0953).
296
297* Avoid possible segfault in BZ2_bzclose. From Coverity's NetBSD
298 scan.
299
300* 'const'/prototype cleanups in the C code.
301
302* Change default install location to /usr/local, and handle multiple
303 'make install's without error.
304
305* Sanitise file names more carefully in bzgrep. Fixes CAN-2005-0758
306 to the extent that applies to bzgrep.
307
308* Use 'mktemp' rather than 'tempfile' in bzdiff.
309
310* Tighten up a couple of assertions in blocksort.c following automated
311 analysis.
312
313* Fix minor doc/comment bugs.
314
diff --git a/LICENSE b/LICENSE
index e60845b..4458e35 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,8 @@
1 1
2--------------------------------------------------------------------------
3
2This program, "bzip2", the associated library "libbzip2", and all 4This program, "bzip2", the associated library "libbzip2", and all
3documentation, are copyright (C) 1996-2005 Julian R Seward. All 5documentation, are copyright (C) 1996-2006 Julian R Seward. All
4rights reserved. 6rights reserved.
5 7
6Redistribution and use in source and binary forms, with or without 8Redistribution and use in source and binary forms, with or without
@@ -35,6 +37,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 38
37Julian Seward, Cambridge, UK. 39Julian Seward, Cambridge, UK.
38jseward@acm.org 40jseward@bzip.org
39bzip2/libbzip2 version 1.0.3 of 15 February 2005 41bzip2/libbzip2 version 1.0.4 of 20 December 2006
40 42
43--------------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index eea329a..c4cbc04 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,16 @@
1# ------------------------------------------------------------------
2# This file is part of bzip2/libbzip2, a program and library for
3# lossless, block-sorting data compression.
4#
5# bzip2/libbzip2 version 1.0.4 of 20 December 2006
6# Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
7#
8# Please read the WARNING, DISCLAIMER and PATENTS sections in the
9# README file.
10#
11# This program is released under the terms of the license contained
12# in the file LICENSE.
13# ------------------------------------------------------------------
1 14
2SHELL=/bin/sh 15SHELL=/bin/sh
3 16
@@ -8,10 +21,10 @@ RANLIB=ranlib
8LDFLAGS= 21LDFLAGS=
9 22
10BIGFILES=-D_FILE_OFFSET_BITS=64 23BIGFILES=-D_FILE_OFFSET_BITS=64
11CFLAGS=-Wall -Winline -O -g $(BIGFILES) 24CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
12 25
13# Where you want it installed when you do 'make install' 26# Where you want it installed when you do 'make install'
14PREFIX=/usr 27PREFIX=/usr/local
15 28
16 29
17OBJS= blocksort.o \ 30OBJS= blocksort.o \
@@ -77,14 +90,14 @@ install: bzip2 bzip2recover
77 cp -f libbz2.a $(PREFIX)/lib 90 cp -f libbz2.a $(PREFIX)/lib
78 chmod a+r $(PREFIX)/lib/libbz2.a 91 chmod a+r $(PREFIX)/lib/libbz2.a
79 cp -f bzgrep $(PREFIX)/bin/bzgrep 92 cp -f bzgrep $(PREFIX)/bin/bzgrep
80 ln $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep 93 ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep
81 ln $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep 94 ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep
82 chmod a+x $(PREFIX)/bin/bzgrep 95 chmod a+x $(PREFIX)/bin/bzgrep
83 cp -f bzmore $(PREFIX)/bin/bzmore 96 cp -f bzmore $(PREFIX)/bin/bzmore
84 ln $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless 97 ln -s -f $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless
85 chmod a+x $(PREFIX)/bin/bzmore 98 chmod a+x $(PREFIX)/bin/bzmore
86 cp -f bzdiff $(PREFIX)/bin/bzdiff 99 cp -f bzdiff $(PREFIX)/bin/bzdiff
87 ln $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp 100 ln -s -f $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp
88 chmod a+x $(PREFIX)/bin/bzdiff 101 chmod a+x $(PREFIX)/bin/bzdiff
89 cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1 102 cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1
90 chmod a+r $(PREFIX)/man/man1/bzgrep.1 103 chmod a+r $(PREFIX)/man/man1/bzgrep.1
@@ -124,10 +137,10 @@ bzip2recover.o: bzip2recover.c
124distclean: clean 137distclean: clean
125 rm -f manual.ps manual.html manual.pdf 138 rm -f manual.ps manual.html manual.pdf
126 139
127DISTNAME=bzip2-1.0.3 140DISTNAME=bzip2-1.0.4
128dist: check manual 141dist: check manual
129 rm -f $(DISTNAME) 142 rm -f $(DISTNAME)
130 ln -sf . $(DISTNAME) 143 ln -s -f . $(DISTNAME)
131 tar cvf $(DISTNAME).tar \ 144 tar cvf $(DISTNAME).tar \
132 $(DISTNAME)/blocksort.c \ 145 $(DISTNAME)/blocksort.c \
133 $(DISTNAME)/huffman.c \ 146 $(DISTNAME)/huffman.c \
@@ -167,7 +180,6 @@ dist: check manual
167 $(DISTNAME)/libbz2.dsp \ 180 $(DISTNAME)/libbz2.dsp \
168 $(DISTNAME)/dlltest.dsp \ 181 $(DISTNAME)/dlltest.dsp \
169 $(DISTNAME)/makefile.msc \ 182 $(DISTNAME)/makefile.msc \
170 $(DISTNAME)/Y2K_INFO \
171 $(DISTNAME)/unzcrash.c \ 183 $(DISTNAME)/unzcrash.c \
172 $(DISTNAME)/spewG.c \ 184 $(DISTNAME)/spewG.c \
173 $(DISTNAME)/mk251.c \ 185 $(DISTNAME)/mk251.c \
diff --git a/Makefile-libbz2_so b/Makefile-libbz2_so
index 458c5a1..2b65f3b 100644
--- a/Makefile-libbz2_so
+++ b/Makefile-libbz2_so
@@ -1,15 +1,30 @@
1 1
2# This Makefile builds a shared version of the library, 2# This Makefile builds a shared version of the library,
3# libbz2.so.1.0.3, with soname libbz2.so.1.0, 3# libbz2.so.1.0.4, with soname libbz2.so.1.0,
4# at least on x86-Linux (RedHat 7.2), 4# at least on x86-Linux (RedHat 7.2),
5# with gcc-2.96 20000731 (Red Hat Linux 7.1 2.96-98). 5# with gcc-2.96 20000731 (Red Hat Linux 7.1 2.96-98).
6# Please see the README file for some 6# Please see the README file for some important info
7# important info about building the library like this. 7# about building the library like this.
8
9# ------------------------------------------------------------------
10# This file is part of bzip2/libbzip2, a program and library for
11# lossless, block-sorting data compression.
12#
13# bzip2/libbzip2 version 1.0.4 of 20 December 2006
14# Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
15#
16# Please read the WARNING, DISCLAIMER and PATENTS sections in the
17# README file.
18#
19# This program is released under the terms of the license contained
20# in the file LICENSE.
21# ------------------------------------------------------------------
22
8 23
9SHELL=/bin/sh 24SHELL=/bin/sh
10CC=gcc 25CC=gcc
11BIGFILES=-D_FILE_OFFSET_BITS=64 26BIGFILES=-D_FILE_OFFSET_BITS=64
12CFLAGS=-fpic -fPIC -Wall -Winline -O -g 27CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES)
13 28
14OBJS= blocksort.o \ 29OBJS= blocksort.o \
15 huffman.o \ 30 huffman.o \
@@ -20,13 +35,13 @@ OBJS= blocksort.o \
20 bzlib.o 35 bzlib.o
21 36
22all: $(OBJS) 37all: $(OBJS)
23 $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.3 $(OBJS) 38 $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.4 $(OBJS)
24 $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.3 39 $(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.4
25 rm -f libbz2.so.1.0 40 rm -f libbz2.so.1.0
26 ln -s libbz2.so.1.0.3 libbz2.so.1.0 41 ln -s libbz2.so.1.0.4 libbz2.so.1.0
27 42
28clean: 43clean:
29 rm -f $(OBJS) bzip2.o libbz2.so.1.0.3 libbz2.so.1.0 bzip2-shared 44 rm -f $(OBJS) bzip2.o libbz2.so.1.0.4 libbz2.so.1.0 bzip2-shared
30 45
31blocksort.o: blocksort.c 46blocksort.o: blocksort.c
32 $(CC) $(CFLAGS) -c blocksort.c 47 $(CC) $(CFLAGS) -c blocksort.c
diff --git a/README b/README
index 1aff448..b18c096 100644
--- a/README
+++ b/README
@@ -1,33 +1,48 @@
1 1
2This is the README for bzip2, a block-sorting file compressor, version 2This is the README for bzip2/libzip2.
31.0.3. This version is fully compatible with the previous public 3This version is fully compatible with the previous public releases.
4releases, versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1 and 1.0.2.
5 4
6bzip2-1.0.3 is distributed under a BSD-style license. For details, 5------------------------------------------------------------------
7see the file LICENSE. 6This file is part of bzip2/libbzip2, a program and library for
7lossless, block-sorting data compression.
8
9bzip2/libbzip2 version 1.0.4 of 20 December 2006
10Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
11
12Please read the WARNING, DISCLAIMER and PATENTS sections in this file.
13
14This program is released under the terms of the license contained
15in the file LICENSE.
16------------------------------------------------------------------
8 17
9Complete documentation is available in Postscript form (manual.ps), 18Complete documentation is available in Postscript form (manual.ps),
10PDF (manual.pdf) or html (manual.html). A plain-text version of the 19PDF (manual.pdf) or html (manual.html). A plain-text version of the
11manual page is available as bzip2.txt. A statement about Y2K issues 20manual page is available as bzip2.txt.
12is now included in the file Y2K_INFO.
13 21
14 22
15HOW TO BUILD -- UNIX 23HOW TO BUILD -- UNIX
16 24
17Type `make'. This builds the library libbz2.a and then the 25Type 'make'. This builds the library libbz2.a and then the programs
18programs bzip2 and bzip2recover. Six self-tests are run. 26bzip2 and bzip2recover. Six self-tests are run. If the self-tests
19If the self-tests complete ok, carry on to installation: 27complete ok, carry on to installation:
28
29To install in /usr/local/bin, /usr/local/lib, /usr/local/man and
30/usr/local/include, type
20 31
21To install in /usr/bin, /usr/lib, /usr/man and /usr/include, type
22 make install 32 make install
23To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type 33
34To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type
35
24 make install PREFIX=/xxx/yyy 36 make install PREFIX=/xxx/yyy
37
25If you are (justifiably) paranoid and want to see what 'make install' 38If you are (justifiably) paranoid and want to see what 'make install'
26is going to do, you can first do 39is going to do, you can first do
40
27 make -n install or 41 make -n install or
28 make -n install PREFIX=/xxx/yyy respectively. 42 make -n install PREFIX=/xxx/yyy respectively.
29The -n instructs make to show the commands it would execute, but 43
30not actually execute them. 44The -n instructs make to show the commands it would execute, but not
45actually execute them.
31 46
32 47
33HOW TO BUILD -- UNIX, shared library libbz2.so. 48HOW TO BUILD -- UNIX, shared library libbz2.so.
@@ -49,23 +64,25 @@ Important note for people upgrading .so's from 0.9.0/0.9.5 to version
49bzCompress to BZ2_bzCompress, to avoid namespace pollution. 64bzCompress to BZ2_bzCompress, to avoid namespace pollution.
50Unfortunately this means that the libbz2.so created by 65Unfortunately this means that the libbz2.so created by
51Makefile-libbz2_so will not work with any program which used an older 66Makefile-libbz2_so will not work with any program which used an older
52version of the library. Sorry. I do encourage library clients to 67version of the library. I do encourage library clients to make the
53make the effort to upgrade to use version 1.0, since it is both faster 68effort to upgrade to use version 1.0, since it is both faster and more
54and more robust than previous versions. 69robust than previous versions.
55 70
56 71
57HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc. 72HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc.
58 73
59It's difficult for me to support compilation on all these platforms. 74It's difficult for me to support compilation on all these platforms.
60My approach is to collect binaries for these platforms, and put them 75My approach is to collect binaries for these platforms, and put them
61on the master web page (http://sources.redhat.com/bzip2). Look there. 76on the master web site (http://www.bzip.org). Look there. However
62However (FWIW), bzip2-1.0.X is very standard ANSI C and should compile 77(FWIW), bzip2-1.0.X is very standard ANSI C and should compile
63unmodified with MS Visual C. If you have difficulties building, you 78unmodified with MS Visual C. If you have difficulties building, you
64might want to read README.COMPILATION.PROBLEMS. 79might want to read README.COMPILATION.PROBLEMS.
65 80
66At least using MS Visual C++ 6, you can build from the unmodified 81At least using MS Visual C++ 6, you can build from the unmodified
67sources by issuing, in a command shell: 82sources by issuing, in a command shell:
83
68 nmake -f makefile.msc 84 nmake -f makefile.msc
85
69(you may need to first run the MSVC-provided script VCVARS32.BAT 86(you may need to first run the MSVC-provided script VCVARS32.BAT
70 so as to set up paths to the MSVC tools correctly). 87 so as to set up paths to the MSVC tools correctly).
71 88
@@ -86,18 +103,19 @@ Please read and be aware of the following:
86 103
87WARNING: 104WARNING:
88 105
89 This program (attempts to) compress data by performing several 106 This program and library (attempts to) compress data by
90 non-trivial transformations on it. Unless you are 100% familiar 107 performing several non-trivial transformations on it.
91 with *all* the algorithms contained herein, and with the 108 Unless you are 100% familiar with *all* the algorithms
92 consequences of modifying them, you should NOT meddle with the 109 contained herein, and with the consequences of modifying them,
93 compression or decompression machinery. Incorrect changes can and 110 you should NOT meddle with the compression or decompression
94 very likely *will* lead to disastrous loss of data. 111 machinery. Incorrect changes can and very likely *will*
112 lead to disastrous loss of data.
95 113
96 114
97DISCLAIMER: 115DISCLAIMER:
98 116
99 I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE 117 I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE
100 USE OF THIS PROGRAM, HOWSOEVER CAUSED. 118 USE OF THIS PROGRAM/LIBRARY, HOWSOEVER CAUSED.
101 119
102 Every compression of a file implies an assumption that the 120 Every compression of a file implies an assumption that the
103 compressed file can be decompressed to reproduce the original. 121 compressed file can be decompressed to reproduce the original.
@@ -110,19 +128,18 @@ DISCLAIMER:
110 PROGRAM UNLESS YOU ARE PREPARED TO ACCEPT THE POSSIBILITY, HOWEVER 128 PROGRAM UNLESS YOU ARE PREPARED TO ACCEPT THE POSSIBILITY, HOWEVER
111 SMALL, THAT THE DATA WILL NOT BE RECOVERABLE. 129 SMALL, THAT THE DATA WILL NOT BE RECOVERABLE.
112 130
113 That is not to say this program is inherently unreliable. Indeed, 131 That is not to say this program is inherently unreliable.
114 I very much hope the opposite is true. bzip2 has been carefully 132 Indeed, I very much hope the opposite is true. bzip2/libbzip2
115 constructed and extensively tested. 133 has been carefully constructed and extensively tested.
116 134
117 135
118PATENTS: 136PATENTS:
119 137
120 To the best of my knowledge, bzip2 does not use any patented 138 To the best of my knowledge, bzip2/libbzip2 does not use any
121 algorithms. However, I do not have the resources to carry out 139 patented algorithms. However, I do not have the resources
122 a patent search. Therefore I cannot give any guarantee of the 140 to carry out a patent search. Therefore I cannot give any
123 above statement. 141 guarantee of the above statement.
124 142
125End of legalities.
126 143
127 144
128WHAT'S NEW IN 0.9.0 (as compared to 0.1pl2) ? 145WHAT'S NEW IN 0.9.0 (as compared to 0.1pl2) ?
@@ -156,21 +173,23 @@ WHAT'S NEW IN 1.0.3 ?
156 173
157 See the CHANGES file. 174 See the CHANGES file.
158 175
176WHAT'S NEW IN 1.0.4 ?
177
178 See the CHANGES file.
179
159 180
160I hope you find bzip2 useful. Feel free to contact me at 181I hope you find bzip2 useful. Feel free to contact me at
161 jseward@bzip.org 182 jseward@bzip.org
162if you have any suggestions or queries. Many people mailed me with 183if you have any suggestions or queries. Many people mailed me with
163comments, suggestions and patches after the releases of bzip-0.15, 184comments, suggestions and patches after the releases of bzip-0.15,
164bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1 and 185bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1,
1651.0.2, and the changes in bzip2 are largely a result of this feedback. 1861.0.2 and 1.0.3, and the changes in bzip2 are largely a result of this
166I thank you for your comments. 187feedback. I thank you for your comments.
167 188
168At least for the time being, bzip2's "home" is (or can be reached via) 189bzip2's "home" is http://www.bzip.org/
169http://www.bzip.org
170 190
171Julian Seward 191Julian Seward
172jseward@bzip.org 192jseward@bzip.org
173
174Cambridge, UK. 193Cambridge, UK.
175 194
17618 July 1996 (version 0.15) 19518 July 1996 (version 0.15)
@@ -183,3 +202,4 @@ Cambridge, UK.
183 5 May 2000 (bzip2, version 1.0pre8) 202 5 May 2000 (bzip2, version 1.0pre8)
18430 December 2001 (bzip2, version 1.0.2pre1) 20330 December 2001 (bzip2, version 1.0.2pre1)
18515 February 2005 (bzip2, version 1.0.3) 20415 February 2005 (bzip2, version 1.0.3)
20520 December 2006 (bzip2, version 1.0.4)
diff --git a/README.COMPILATION.PROBLEMS b/README.COMPILATION.PROBLEMS
index f1bc396..64ab586 100644
--- a/README.COMPILATION.PROBLEMS
+++ b/README.COMPILATION.PROBLEMS
@@ -1,32 +1,47 @@
1------------------------------------------------------------------
2This file is part of bzip2/libbzip2, a program and library for
3lossless, block-sorting data compression.
1 4
2bzip2-1.0.3 should compile without problems on the vast majority of 5bzip2/libbzip2 version 1.0.4 of 20 December 2006
6Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
7
8Please read the WARNING, DISCLAIMER and PATENTS sections in the
9README file.
10
11This program is released under the terms of the license contained
12in the file LICENSE.
13------------------------------------------------------------------
14
15bzip2-1.0.4 should compile without problems on the vast majority of
3platforms. Using the supplied Makefile, I've built and tested it 16platforms. Using the supplied Makefile, I've built and tested it
4myself for x86-linux and x86_64-linux. With makefile.msc, Visual C++ 17myself for x86-linux and amd64-linux. With makefile.msc, Visual C++
56.0 and nmake, you can build a native Win32 version too. Large file 186.0 and nmake, you can build a native Win32 version too. Large file
6support seems to work correctly on at least alpha-tru64unix and 19support seems to work correctly on at least on amd64-linux.
7x86-cygwin32 (on Windows 2000).
8 20
9When I say "large file" I mean a file of size 2,147,483,648 (2^31) 21When I say "large file" I mean a file of size 2,147,483,648 (2^31)
10bytes or above. Many older OSs can't handle files above this size, 22bytes or above. Many older OSs can't handle files above this size,
11but many newer ones can. Large files are pretty huge -- most files 23but many newer ones can. Large files are pretty huge -- most files
12you'll encounter are not Large Files. 24you'll encounter are not Large Files.
13 25
14Earlier versions of bzip2 (0.1, 0.9.0, 0.9.5) compiled on a wide 26Early versions of bzip2 (0.1, 0.9.0, 0.9.5) compiled on a wide variety
15variety of platforms without difficulty, and I hope this version will 27of platforms without difficulty, and I hope this version will continue
16continue in that tradition. However, in order to support large files, 28in that tradition. However, in order to support large files, I've had
17I've had to include the define -D_FILE_OFFSET_BITS=64 in the Makefile. 29to include the define -D_FILE_OFFSET_BITS=64 in the Makefile. This
18This can cause problems. 30can cause problems.
19 31
20The technique of adding -D_FILE_OFFSET_BITS=64 to get large file 32The technique of adding -D_FILE_OFFSET_BITS=64 to get large file
21support is, as far as I know, the Recommended Way to get correct large 33support is, as far as I know, the Recommended Way to get correct large
22file support. For more details, see the Large File Support 34file support. For more details, see the Large File Support
23Specification, published by the Large File Summit, at 35Specification, published by the Large File Summit, at
36
24 http://ftp.sas.com/standards/large.file 37 http://ftp.sas.com/standards/large.file
25 38
26As a general comment, if you get compilation errors which you think 39As a general comment, if you get compilation errors which you think
27are related to large file support, try removing the above define from 40are related to large file support, try removing the above define from
28the Makefile, ie, delete the line 41the Makefile, ie, delete the line
42
29 BIGFILES=-D_FILE_OFFSET_BITS=64 43 BIGFILES=-D_FILE_OFFSET_BITS=64
44
30from the Makefile, and do 'make clean ; make'. This will give you a 45from the Makefile, and do 'make clean ; make'. This will give you a
31version of bzip2 without large file support, which, for most 46version of bzip2 without large file support, which, for most
32applications, is probably not a problem. 47applications, is probably not a problem.
@@ -37,3 +52,7 @@ You can use the spewG.c program to generate huge files to test bzip2's
37large file support, if you are feeling paranoid. Be aware though that 52large file support, if you are feeling paranoid. Be aware though that
38any compilation problems which affect bzip2 will also affect spewG.c, 53any compilation problems which affect bzip2 will also affect spewG.c,
39alas. 54alas.
55
56AIX: I have reports that for large file support, you need to specify
57-D_LARGE_FILES rather than -D_FILE_OFFSET_BITS=64. I have not tested
58this myself.
diff --git a/README.XML.STUFF b/README.XML.STUFF
index 0ff209f..93bf405 100644
--- a/README.XML.STUFF
+++ b/README.XML.STUFF
@@ -1,3 +1,17 @@
1 ----------------------------------------------------------------
2 This file is part of bzip2/libbzip2, a program and library for
3 lossless, block-sorting data compression.
4
5 bzip2/libbzip2 version 1.0.4 of 20 December 2006
6 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
7
8 Please read the WARNING, DISCLAIMER and PATENTS sections in the
9 README file.
10
11 This program is released under the terms of the license contained
12 in the file LICENSE.
13 ----------------------------------------------------------------
14
1The script xmlproc.sh takes an xml file as input, 15The script xmlproc.sh takes an xml file as input,
2and processes it to create .pdf, .html or .ps output. 16and processes it to create .pdf, .html or .ps output.
3It uses format.pl, a perl script to format <pre> blocks nicely, 17It uses format.pl, a perl script to format <pre> blocks nicely,
@@ -9,16 +23,16 @@ version, year, etc.
9 23
10Usage: 24Usage:
11 25
12 xmlproc.sh -v manual.xml 26 ./xmlproc.sh -v manual.xml
13 Validates an xml file to ensure no dtd-compliance errors 27 Validates an xml file to ensure no dtd-compliance errors
14 28
15 xmlproc.sh -html manual.xml 29 ./xmlproc.sh -html manual.xml
16 Output: manual.html 30 Output: manual.html
17 31
18 xmlproc.sh -pdf manual.xml 32 ./xmlproc.sh -pdf manual.xml
19 Output: manual.pdf 33 Output: manual.pdf
20 34
21 xmlproc.sh -ps manual.xml 35 ./xmlproc.sh -ps manual.xml
22 Output: manual.ps 36 Output: manual.ps
23 37
24 38
diff --git a/Y2K_INFO b/Y2K_INFO
deleted file mode 100644
index 55fd56a..0000000
--- a/Y2K_INFO
+++ /dev/null
@@ -1,34 +0,0 @@
1
2Y2K status of bzip2 and libbzip2, versions 0.1, 0.9.0 and 0.9.5
3~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
5Informally speaking:
6 bzip2 is a compression program built on top of libbzip2,
7 a library which does the real work of compression and
8 decompression. As far as I am aware, libbzip2 does not have
9 any date-related code at all.
10
11 bzip2 itself copies dates from source to destination files
12 when compressing or decompressing, using the 'stat' and 'utime'
13 UNIX system calls. It doesn't examine, manipulate or store the
14 dates in any way. So as far as I can see, there shouldn't be any
15 problem with bzip2 providing 'stat' and 'utime' work correctly
16 on your system.
17
18 On non-unix platforms (those for which BZ_UNIX in bzip2.c is
19 not set to 1), bzip2 doesn't even do the date copying.
20
21 Overall, informally speaking, I don't think bzip2 or libbzip2
22 have a Y2K problem.
23
24Formally speaking:
25 I am not prepared to offer you any assurance whatsoever
26 regarding Y2K issues in my software. You alone assume the
27 entire risk of using the software. The disclaimer of liability
28 in the LICENSE file in the bzip2 source distribution continues
29 to apply on this issue as with every other issue pertaining
30 to the software.
31
32Julian Seward
33Cambridge, UK
3425 August 1999
diff --git a/blocksort.c b/blocksort.c
index 33ec9f5..8535c93 100644
--- a/blocksort.c
+++ b/blocksort.c
@@ -4,66 +4,19 @@
4/*--- blocksort.c ---*/ 4/*--- blocksort.c ---*/
5/*-------------------------------------------------------------*/ 5/*-------------------------------------------------------------*/
6 6
7/*-- 7/* ------------------------------------------------------------------
8 This file is a part of bzip2 and/or libbzip2, a program and 8 This file is part of bzip2/libbzip2, a program and library for
9 library for lossless, block-sorting data compression. 9 lossless, block-sorting data compression.
10 10
11 Copyright (C) 1996-2005 Julian R Seward. All rights reserved. 11 bzip2/libbzip2 version 1.0.4 of 20 December 2006
12 12 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
13 Redistribution and use in source and binary forms, with or without 13
14 modification, are permitted provided that the following conditions 14 Please read the WARNING, DISCLAIMER and PATENTS sections in the
15 are met: 15 README file.
16 16
17 1. Redistributions of source code must retain the above copyright 17 This program is released under the terms of the license contained
18 notice, this list of conditions and the following disclaimer. 18 in the file LICENSE.
19 19 ------------------------------------------------------------------ */
20 2. The origin of this software must not be misrepresented; you must
21 not claim that you wrote the original software. If you use this
22 software in a product, an acknowledgment in the product
23 documentation would be appreciated but is not required.
24
25 3. Altered source versions must be plainly marked as such, and must
26 not be misrepresented as being the original software.
27
28 4. The name of the author may not be used to endorse or promote
29 products derived from this software without specific prior written
30 permission.
31
32 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
33 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
36 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
38 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
44 Julian Seward, Cambridge, UK.
45 jseward@bzip.org
46 bzip2/libbzip2 version 1.0 of 21 March 2000
47
48 This program is based on (at least) the work of:
49 Mike Burrows
50 David Wheeler
51 Peter Fenwick
52 Alistair Moffat
53 Radford Neal
54 Ian H. Witten
55 Robert Sedgewick
56 Jon L. Bentley
57
58 For more information on these sources, see the manual.
59
60 To get some idea how the block sorting algorithms in this file
61 work, read my paper
62 On the Performance of BWT Sorting Algorithms
63 in Proceedings of the IEEE Data Compression Conference 2000,
64 Snowbird, Utah, USA, 27-30 March 2000. The main sort in this
65 file implements the algorithm called cache in the paper.
66--*/
67 20
68 21
69#include "bzlib_private.h" 22#include "bzlib_private.h"
@@ -155,7 +108,7 @@ void fallbackQSort3 ( UInt32* fmap,
155 108
156 while (sp > 0) { 109 while (sp > 0) {
157 110
158 AssertH ( sp < FALLBACK_QSORT_STACK_SIZE, 1004 ); 111 AssertH ( sp < FALLBACK_QSORT_STACK_SIZE - 1, 1004 );
159 112
160 fpop ( lo, hi ); 113 fpop ( lo, hi );
161 if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) { 114 if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) {
@@ -690,7 +643,7 @@ void mainQSort3 ( UInt32* ptr,
690 643
691 while (sp > 0) { 644 while (sp > 0) {
692 645
693 AssertH ( sp < MAIN_QSORT_STACK_SIZE, 1001 ); 646 AssertH ( sp < MAIN_QSORT_STACK_SIZE - 2, 1001 );
694 647
695 mpop ( lo, hi, d ); 648 mpop ( lo, hi, d );
696 if (hi - lo < MAIN_QSORT_SMALL_THRESH || 649 if (hi - lo < MAIN_QSORT_SMALL_THRESH ||
diff --git a/bz-fo.xsl b/bz-fo.xsl
index 7f2a767..ba3e301 100644
--- a/bz-fo.xsl
+++ b/bz-fo.xsl
@@ -254,4 +254,23 @@
254</xsl:template> 254</xsl:template>
255 255
256 256
257<!-- Bug-fix for Suse 10 PassiveTex version -->
258<!-- Precompute attribute values 'cos PassiveTex is too stupid: -->
259<xsl:attribute-set name="component.title.properties">
260 <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
261 <xsl:attribute name="space-before.optimum">
262 <xsl:value-of select="concat($body.font.master, 'pt')"/>
263 </xsl:attribute>
264 <xsl:attribute name="space-before.minimum">
265 <xsl:value-of select="$body.font.master * 0.8"/>
266 <xsl:text>pt</xsl:text>
267 </xsl:attribute>
268 <xsl:attribute name="space-before.maximum">
269 <xsl:value-of select="$body.font.master * 1.2"/>
270 <xsl:text>pt</xsl:text>
271 </xsl:attribute>
272 <xsl:attribute name="hyphenate">false</xsl:attribute>
273</xsl:attribute-set>
274
275
257</xsl:stylesheet> 276</xsl:stylesheet>
diff --git a/bzdiff b/bzdiff
index 3c2eb85..6fc38f9 100644
--- a/bzdiff
+++ b/bzdiff
@@ -12,7 +12,7 @@
12# necessary) and fed to cmp or diff. The exit status from cmp 12# necessary) and fed to cmp or diff. The exit status from cmp
13# or diff is preserved. 13# or diff is preserved.
14 14
15PATH="/usr/bin:$PATH"; export PATH 15PATH="/usr/bin:/bin:$PATH"; export PATH
16prog=`echo $0 | sed 's|.*/||'` 16prog=`echo $0 | sed 's|.*/||'`
17case "$prog" in 17case "$prog" in
18 *cmp) comp=${CMP-cmp} ;; 18 *cmp) comp=${CMP-cmp} ;;
@@ -37,7 +37,7 @@ if test -z "$FILES"; then
37 echo "Usage: $prog [${comp}_options] file [file]" 37 echo "Usage: $prog [${comp}_options] file [file]"
38 exit 1 38 exit 1
39fi 39fi
40tmp=`tempfile -d /tmp -p bz` || { 40tmp=`mktemp ${TMPDIR:-/tmp}/bzdiff.XXXXXXXXXX` || {
41 echo 'cannot create a temporary file' >&2 41 echo 'cannot create a temporary file' >&2
42 exit 1 42 exit 1
43} 43}
diff --git a/bzgrep b/bzgrep
index dbfc00e..9a04b83 100644
--- a/bzgrep
+++ b/bzgrep
@@ -63,7 +63,11 @@ for i do
63 bzip2 -cdfq "$i" | $grep $opt "$pat" 63 bzip2 -cdfq "$i" | $grep $opt "$pat"
64 r=$? 64 r=$?
65 else 65 else
66 bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${i}:|" 66 j=${i//\\/\\\\}
67 j=${j//|/\\|}
68 j=${j//&/\\&}
69 j=`printf "%s" "$j" | tr '\n' ' '`
70 bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
67 r=$? 71 r=$?
68 fi 72 fi
69 test "$r" -ne 0 && res="$r" 73 test "$r" -ne 0 && res="$r"
diff --git a/bzip2.1 b/bzip2.1
index d2c0661..a313f2d 100644
--- a/bzip2.1
+++ b/bzip2.1
@@ -1,7 +1,7 @@
1.PU 1.PU
2.TH bzip2 1 2.TH bzip2 1
3.SH NAME 3.SH NAME
4bzip2, bunzip2 \- a block-sorting file compressor, v1.0.3 4bzip2, bunzip2 \- a block-sorting file compressor, v1.0.4
5.br 5.br
6bzcat \- decompresses files to stdout 6bzcat \- decompresses files to stdout
7.br 7.br
@@ -405,11 +405,11 @@ I/O error messages are not as helpful as they could be.
405tries hard to detect I/O errors and exit cleanly, but the details of 405tries hard to detect I/O errors and exit cleanly, but the details of
406what the problem is sometimes seem rather misleading. 406what the problem is sometimes seem rather misleading.
407 407
408This manual page pertains to version 1.0.3 of 408This manual page pertains to version 1.0.4 of
409.I bzip2. 409.I bzip2.
410Compressed data created by this version is entirely forwards and 410Compressed data created by this version is entirely forwards and
411backwards compatible with the previous public releases, versions 411backwards compatible with the previous public releases, versions
4120.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1 and 1.0.2, but with the following 4120.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and 1.0.3, but with the following
413exception: 0.9.0 and above can correctly decompress multiple 413exception: 0.9.0 and above can correctly decompress multiple
414concatenated compressed files. 0.1pl2 cannot do this; it will stop 414concatenated compressed files. 0.1pl2 cannot do this; it will stop
415after decompressing just the first file in the stream. 415after decompressing just the first file in the stream.
diff --git a/bzip2.1.preformatted b/bzip2.1.preformatted
index 129ca83..15e16e5 100644
--- a/bzip2.1.preformatted
+++ b/bzip2.1.preformatted
@@ -3,7 +3,7 @@ bzip2(1) bzip2(1)
3 3
4 4
5NNAAMMEE 5NNAAMMEE
6 bzip2, bunzip2 − a block‐sorting file compressor, v1.0.3 6 bzip2, bunzip2 − a block‐sorting file compressor, v1.0.4
7 bzcat − decompresses files to stdout 7 bzcat − decompresses files to stdout
8 bzip2recover − recovers data from damaged bzip2 files 8 bzip2recover − recovers data from damaged bzip2 files
9 9
@@ -348,14 +348,14 @@ CCAAVVEEAATTSS
348 but the details of what the problem is sometimes seem 348 but the details of what the problem is sometimes seem
349 rather misleading. 349 rather misleading.
350 350
351 This manual page pertains to version 1.0.3 of _b_z_i_p_2_. Com­ 351 This manual page pertains to version 1.0.4 of _b_z_i_p_2_. Com­
352 pressed data created by this version is entirely forwards 352 pressed data created by this version is entirely forwards
353 and backwards compatible with the previous public 353 and backwards compatible with the previous public
354 releases, versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1 and 354 releases, versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1,
355 1.0.2, but with the following exception: 0.9.0 and above 355 1.0.2 and 1.0.3, but with the following exception: 0.9.0
356 can correctly decompress multiple concatenated compressed 356 and above can correctly decompress multiple concatenated
357 files. 0.1pl2 cannot do this; it will stop after decom­ 357 compressed files. 0.1pl2 cannot do this; it will stop
358 pressing just the first file in the stream. 358 after decompressing just the first file in the stream.
359 359
360 _b_z_i_p_2_r_e_c_o_v_e_r versions prior to 1.0.2 used 32‐bit integers 360 _b_z_i_p_2_r_e_c_o_v_e_r versions prior to 1.0.2 used 32‐bit integers
361 to represent bit positions in compressed files, so they 361 to represent bit positions in compressed files, so they
diff --git a/bzip2.c b/bzip2.c
index 79f87a5..5fbae0e 100644
--- a/bzip2.c
+++ b/bzip2.c
@@ -3,118 +3,26 @@
3/*--- A block-sorting, lossless compressor bzip2.c ---*/ 3/*--- A block-sorting, lossless compressor bzip2.c ---*/
4/*-----------------------------------------------------------*/ 4/*-----------------------------------------------------------*/
5 5
6/*-- 6/* ------------------------------------------------------------------
7 This file is a part of bzip2 and/or libbzip2, a program and 7 This file is part of bzip2/libbzip2, a program and library for
8 library for lossless, block-sorting data compression. 8 lossless, block-sorting data compression.
9
10 Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
11
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
14 are met:
15
16 1. Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the following disclaimer.
18
19 2. The origin of this software must not be misrepresented; you must
20 not claim that you wrote the original software. If you use this
21 software in a product, an acknowledgment in the product
22 documentation would be appreciated but is not required.
23
24 3. Altered source versions must be plainly marked as such, and must
25 not be misrepresented as being the original software.
26
27 4. The name of the author may not be used to endorse or promote
28 products derived from this software without specific prior written
29 permission.
30
31 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
32 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
35 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
37 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
39 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
40 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42
43 Julian Seward, Cambridge, UK.
44 jseward@bzip.org
45 bzip2/libbzip2 version 1.0 of 21 March 2000
46
47 This program is based on (at least) the work of:
48 Mike Burrows
49 David Wheeler
50 Peter Fenwick
51 Alistair Moffat
52 Radford Neal
53 Ian H. Witten
54 Robert Sedgewick
55 Jon L. Bentley
56
57 For more information on these sources, see the manual.
58--*/
59 9
10 bzip2/libbzip2 version 1.0.4 of 20 December 2006
11 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
60 12
61/*----------------------------------------------------*/ 13 Please read the WARNING, DISCLAIMER and PATENTS sections in the
62/*--- IMPORTANT ---*/ 14 README file.
63/*----------------------------------------------------*/
64 15
65/*-- 16 This program is released under the terms of the license contained
66 WARNING: 17 in the file LICENSE.
67 This program and library (attempts to) compress data by 18 ------------------------------------------------------------------ */
68 performing several non-trivial transformations on it.
69 Unless you are 100% familiar with *all* the algorithms
70 contained herein, and with the consequences of modifying them,
71 you should NOT meddle with the compression or decompression
72 machinery. Incorrect changes can and very likely *will*
73 lead to disasterous loss of data.
74
75 DISCLAIMER:
76 I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE
77 USE OF THIS PROGRAM, HOWSOEVER CAUSED.
78
79 Every compression of a file implies an assumption that the
80 compressed file can be decompressed to reproduce the original.
81 Great efforts in design, coding and testing have been made to
82 ensure that this program works correctly. However, the
83 complexity of the algorithms, and, in particular, the presence
84 of various special cases in the code which occur with very low
85 but non-zero probability make it impossible to rule out the
86 possibility of bugs remaining in the program. DO NOT COMPRESS
87 ANY DATA WITH THIS PROGRAM AND/OR LIBRARY UNLESS YOU ARE PREPARED
88 TO ACCEPT THE POSSIBILITY, HOWEVER SMALL, THAT THE DATA WILL
89 NOT BE RECOVERABLE.
90
91 That is not to say this program is inherently unreliable.
92 Indeed, I very much hope the opposite is true. bzip2/libbzip2
93 has been carefully constructed and extensively tested.
94
95 PATENTS:
96 To the best of my knowledge, bzip2/libbzip2 does not use any
97 patented algorithms. However, I do not have the resources
98 available to carry out a full patent search. Therefore I cannot
99 give any guarantee of the above statement.
100--*/
101 19
102 20
103 21/* Place a 1 beside your platform, and 0 elsewhere.
104/*----------------------------------------------------*/ 22 Generic 32-bit Unix.
105/*--- and now for something much more pleasant :-) ---*/ 23 Also works on 64-bit Unix boxes.
106/*----------------------------------------------------*/ 24 This is the default.
107 25*/
108/*---------------------------------------------*/
109/*--
110 Place a 1 beside your platform, and 0 elsewhere.
111--*/
112
113/*--
114 Generic 32-bit Unix.
115 Also works on 64-bit Unix boxes.
116 This is the default.
117--*/
118#define BZ_UNIX 1 26#define BZ_UNIX 1
119 27
120/*-- 28/*--
@@ -302,16 +210,17 @@ Char progNameReally[FILE_NAME_LEN];
302FILE *outputHandleJustInCase; 210FILE *outputHandleJustInCase;
303Int32 workFactor; 211Int32 workFactor;
304 212
305static void panic ( Char* ) NORETURN; 213static void panic ( const Char* ) NORETURN;
306static void ioError ( void ) NORETURN; 214static void ioError ( void ) NORETURN;
307static void outOfMemory ( void ) NORETURN; 215static void outOfMemory ( void ) NORETURN;
308static void configError ( void ) NORETURN; 216static void configError ( void ) NORETURN;
309static void crcError ( void ) NORETURN; 217static void crcError ( void ) NORETURN;
310static void cleanUpAndFail ( Int32 ) NORETURN; 218static void cleanUpAndFail ( Int32 ) NORETURN;
311static void compressedStreamEOF ( void ) NORETURN; 219static void compressedStreamEOF ( void ) NORETURN;
312 220
313static void copyFileName ( Char*, Char* ); 221static void copyFileName ( Char*, Char* );
314static void* myMalloc ( Int32 ); 222static void* myMalloc ( Int32 );
223static void applySavedFileAttrToOutputFile ( IntNative fd );
315 224
316 225
317 226
@@ -457,6 +366,9 @@ void compressStream ( FILE *stream, FILE *zStream )
457 ret = fflush ( zStream ); 366 ret = fflush ( zStream );
458 if (ret == EOF) goto errhandler_io; 367 if (ret == EOF) goto errhandler_io;
459 if (zStream != stdout) { 368 if (zStream != stdout) {
369 Int32 fd = fileno ( zStream );
370 if (fd < 0) goto errhandler_io;
371 applySavedFileAttrToOutputFile ( fd );
460 ret = fclose ( zStream ); 372 ret = fclose ( zStream );
461 outputHandleJustInCase = NULL; 373 outputHandleJustInCase = NULL;
462 if (ret == EOF) goto errhandler_io; 374 if (ret == EOF) goto errhandler_io;
@@ -569,6 +481,11 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
569 481
570 closeok: 482 closeok:
571 if (ferror(zStream)) goto errhandler_io; 483 if (ferror(zStream)) goto errhandler_io;
484 if (stream != stdout) {
485 Int32 fd = fileno ( stream );
486 if (fd < 0) goto errhandler_io;
487 applySavedFileAttrToOutputFile ( fd );
488 }
572 ret = fclose ( zStream ); 489 ret = fclose ( zStream );
573 if (ret == EOF) goto errhandler_io; 490 if (ret == EOF) goto errhandler_io;
574 491
@@ -826,7 +743,7 @@ void cleanUpAndFail ( Int32 ec )
826 743
827/*---------------------------------------------*/ 744/*---------------------------------------------*/
828static 745static
829void panic ( Char* s ) 746void panic ( const Char* s )
830{ 747{
831 fprintf ( stderr, 748 fprintf ( stderr,
832 "\n%s: PANIC -- internal consistency error:\n" 749 "\n%s: PANIC -- internal consistency error:\n"
@@ -1039,6 +956,7 @@ Bool fileExists ( Char* name )
1039 For non-Unix platforms, if we are not worrying about 956 For non-Unix platforms, if we are not worrying about
1040 security issues, simple this simply behaves like fopen. 957 security issues, simple this simply behaves like fopen.
1041*/ 958*/
959static
1042FILE* fopen_output_safely ( Char* name, const char* mode ) 960FILE* fopen_output_safely ( Char* name, const char* mode )
1043{ 961{
1044# if BZ_UNIX 962# if BZ_UNIX
@@ -1129,7 +1047,7 @@ void saveInputFileMetaInfo ( Char *srcName )
1129 1047
1130 1048
1131static 1049static
1132void applySavedMetaInfoToOutputFile ( Char *dstName ) 1050void applySavedTimeInfoToOutputFile ( Char *dstName )
1133{ 1051{
1134# if BZ_UNIX 1052# if BZ_UNIX
1135 IntNative retVal; 1053 IntNative retVal;
@@ -1138,13 +1056,21 @@ void applySavedMetaInfoToOutputFile ( Char *dstName )
1138 uTimBuf.actime = fileMetaInfo.st_atime; 1056 uTimBuf.actime = fileMetaInfo.st_atime;
1139 uTimBuf.modtime = fileMetaInfo.st_mtime; 1057 uTimBuf.modtime = fileMetaInfo.st_mtime;
1140 1058
1141 retVal = chmod ( dstName, fileMetaInfo.st_mode ); 1059 retVal = utime ( dstName, &uTimBuf );
1142 ERROR_IF_NOT_ZERO ( retVal ); 1060 ERROR_IF_NOT_ZERO ( retVal );
1061# endif
1062}
1143 1063
1144 retVal = utime ( dstName, &uTimBuf ); 1064static
1065void applySavedFileAttrToOutputFile ( IntNative fd )
1066{
1067# if BZ_UNIX
1068 IntNative retVal;
1069
1070 retVal = fchmod ( fd, fileMetaInfo.st_mode );
1145 ERROR_IF_NOT_ZERO ( retVal ); 1071 ERROR_IF_NOT_ZERO ( retVal );
1146 1072
1147 retVal = chown ( dstName, fileMetaInfo.st_uid, fileMetaInfo.st_gid ); 1073 (void) fchown ( fd, fileMetaInfo.st_uid, fileMetaInfo.st_gid );
1148 /* chown() will in many cases return with EPERM, which can 1074 /* chown() will in many cases return with EPERM, which can
1149 be safely ignored. 1075 be safely ignored.
1150 */ 1076 */
@@ -1175,13 +1101,13 @@ Bool containsDubiousChars ( Char* name )
1175/*---------------------------------------------*/ 1101/*---------------------------------------------*/
1176#define BZ_N_SUFFIX_PAIRS 4 1102#define BZ_N_SUFFIX_PAIRS 4
1177 1103
1178Char* zSuffix[BZ_N_SUFFIX_PAIRS] 1104const Char* zSuffix[BZ_N_SUFFIX_PAIRS]
1179 = { ".bz2", ".bz", ".tbz2", ".tbz" }; 1105 = { ".bz2", ".bz", ".tbz2", ".tbz" };
1180Char* unzSuffix[BZ_N_SUFFIX_PAIRS] 1106const Char* unzSuffix[BZ_N_SUFFIX_PAIRS]
1181 = { "", "", ".tar", ".tar" }; 1107 = { "", "", ".tar", ".tar" };
1182 1108
1183static 1109static
1184Bool hasSuffix ( Char* s, Char* suffix ) 1110Bool hasSuffix ( Char* s, const Char* suffix )
1185{ 1111{
1186 Int32 ns = strlen(s); 1112 Int32 ns = strlen(s);
1187 Int32 nx = strlen(suffix); 1113 Int32 nx = strlen(suffix);
@@ -1192,7 +1118,8 @@ Bool hasSuffix ( Char* s, Char* suffix )
1192 1118
1193static 1119static
1194Bool mapSuffix ( Char* name, 1120Bool mapSuffix ( Char* name,
1195 Char* oldSuffix, Char* newSuffix ) 1121 const Char* oldSuffix,
1122 const Char* newSuffix )
1196{ 1123{
1197 if (!hasSuffix(name,oldSuffix)) return False; 1124 if (!hasSuffix(name,oldSuffix)) return False;
1198 name[strlen(name)-strlen(oldSuffix)] = 0; 1125 name[strlen(name)-strlen(oldSuffix)] = 0;
@@ -1217,8 +1144,8 @@ void compress ( Char *name )
1217 1144
1218 switch (srcMode) { 1145 switch (srcMode) {
1219 case SM_I2O: 1146 case SM_I2O:
1220 copyFileName ( inName, "(stdin)" ); 1147 copyFileName ( inName, (Char*)"(stdin)" );
1221 copyFileName ( outName, "(stdout)" ); 1148 copyFileName ( outName, (Char*)"(stdout)" );
1222 break; 1149 break;
1223 case SM_F2F: 1150 case SM_F2F:
1224 copyFileName ( inName, name ); 1151 copyFileName ( inName, name );
@@ -1227,7 +1154,7 @@ void compress ( Char *name )
1227 break; 1154 break;
1228 case SM_F2O: 1155 case SM_F2O:
1229 copyFileName ( inName, name ); 1156 copyFileName ( inName, name );
1230 copyFileName ( outName, "(stdout)" ); 1157 copyFileName ( outName, (Char*)"(stdout)" );
1231 break; 1158 break;
1232 } 1159 }
1233 1160
@@ -1370,7 +1297,7 @@ void compress ( Char *name )
1370 1297
1371 /*--- If there was an I/O error, we won't get here. ---*/ 1298 /*--- If there was an I/O error, we won't get here. ---*/
1372 if ( srcMode == SM_F2F ) { 1299 if ( srcMode == SM_F2F ) {
1373 applySavedMetaInfoToOutputFile ( outName ); 1300 applySavedTimeInfoToOutputFile ( outName );
1374 deleteOutputOnInterrupt = False; 1301 deleteOutputOnInterrupt = False;
1375 if ( !keepInputFiles ) { 1302 if ( !keepInputFiles ) {
1376 IntNative retVal = remove ( inName ); 1303 IntNative retVal = remove ( inName );
@@ -1401,8 +1328,8 @@ void uncompress ( Char *name )
1401 cantGuess = False; 1328 cantGuess = False;
1402 switch (srcMode) { 1329 switch (srcMode) {
1403 case SM_I2O: 1330 case SM_I2O:
1404 copyFileName ( inName, "(stdin)" ); 1331 copyFileName ( inName, (Char*)"(stdin)" );
1405 copyFileName ( outName, "(stdout)" ); 1332 copyFileName ( outName, (Char*)"(stdout)" );
1406 break; 1333 break;
1407 case SM_F2F: 1334 case SM_F2F:
1408 copyFileName ( inName, name ); 1335 copyFileName ( inName, name );
@@ -1415,7 +1342,7 @@ void uncompress ( Char *name )
1415 break; 1342 break;
1416 case SM_F2O: 1343 case SM_F2O:
1417 copyFileName ( inName, name ); 1344 copyFileName ( inName, name );
1418 copyFileName ( outName, "(stdout)" ); 1345 copyFileName ( outName, (Char*)"(stdout)" );
1419 break; 1346 break;
1420 } 1347 }
1421 1348
@@ -1548,7 +1475,7 @@ void uncompress ( Char *name )
1548 /*--- If there was an I/O error, we won't get here. ---*/ 1475 /*--- If there was an I/O error, we won't get here. ---*/
1549 if ( magicNumberOK ) { 1476 if ( magicNumberOK ) {
1550 if ( srcMode == SM_F2F ) { 1477 if ( srcMode == SM_F2F ) {
1551 applySavedMetaInfoToOutputFile ( outName ); 1478 applySavedTimeInfoToOutputFile ( outName );
1552 deleteOutputOnInterrupt = False; 1479 deleteOutputOnInterrupt = False;
1553 if ( !keepInputFiles ) { 1480 if ( !keepInputFiles ) {
1554 IntNative retVal = remove ( inName ); 1481 IntNative retVal = remove ( inName );
@@ -1593,9 +1520,9 @@ void testf ( Char *name )
1593 if (name == NULL && srcMode != SM_I2O) 1520 if (name == NULL && srcMode != SM_I2O)
1594 panic ( "testf: bad modes\n" ); 1521 panic ( "testf: bad modes\n" );
1595 1522
1596 copyFileName ( outName, "(none)" ); 1523 copyFileName ( outName, (Char*)"(none)" );
1597 switch (srcMode) { 1524 switch (srcMode) {
1598 case SM_I2O: copyFileName ( inName, "(stdin)" ); break; 1525 case SM_I2O: copyFileName ( inName, (Char*)"(stdin)" ); break;
1599 case SM_F2F: copyFileName ( inName, name ); break; 1526 case SM_F2F: copyFileName ( inName, name ); break;
1600 case SM_F2O: copyFileName ( inName, name ); break; 1527 case SM_F2O: copyFileName ( inName, name ); break;
1601 } 1528 }
@@ -1678,11 +1605,11 @@ void license ( void )
1678 "bzip2, a block-sorting file compressor. " 1605 "bzip2, a block-sorting file compressor. "
1679 "Version %s.\n" 1606 "Version %s.\n"
1680 " \n" 1607 " \n"
1681 " Copyright (C) 1996-2005 by Julian Seward.\n" 1608 " Copyright (C) 1996-2006 by Julian Seward.\n"
1682 " \n" 1609 " \n"
1683 " This program is free software; you can redistribute it and/or modify\n" 1610 " This program is free software; you can redistribute it and/or modify\n"
1684 " it under the terms set out in the LICENSE file, which is included\n" 1611 " it under the terms set out in the LICENSE file, which is included\n"
1685 " in the bzip2-1.0 source distribution.\n" 1612 " in the bzip2-1.0.4 source distribution.\n"
1686 " \n" 1613 " \n"
1687 " This program is distributed in the hope that it will be useful,\n" 1614 " This program is distributed in the hope that it will be useful,\n"
1688 " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" 1615 " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
@@ -1885,8 +1812,8 @@ IntNative main ( IntNative argc, Char *argv[] )
1885# endif 1812# endif
1886# endif 1813# endif
1887 1814
1888 copyFileName ( inName, "(none)" ); 1815 copyFileName ( inName, (Char*)"(none)" );
1889 copyFileName ( outName, "(none)" ); 1816 copyFileName ( outName, (Char*)"(none)" );
1890 1817
1891 copyFileName ( progNameReally, argv[0] ); 1818 copyFileName ( progNameReally, argv[0] );
1892 progName = &progNameReally[0]; 1819 progName = &progNameReally[0];
@@ -1898,8 +1825,8 @@ IntNative main ( IntNative argc, Char *argv[] )
1898 expand filename wildcards in arg list. 1825 expand filename wildcards in arg list.
1899 --*/ 1826 --*/
1900 argList = NULL; 1827 argList = NULL;
1901 addFlagsFromEnvVar ( &argList, "BZIP2" ); 1828 addFlagsFromEnvVar ( &argList, (Char*)"BZIP2" );
1902 addFlagsFromEnvVar ( &argList, "BZIP" ); 1829 addFlagsFromEnvVar ( &argList, (Char*)"BZIP" );
1903 for (i = 1; i <= argc-1; i++) 1830 for (i = 1; i <= argc-1; i++)
1904 APPEND_FILESPEC(argList, argv[i]); 1831 APPEND_FILESPEC(argList, argv[i]);
1905 1832
diff --git a/bzip2.txt b/bzip2.txt
index bf895b6..4fb9c74 100644
--- a/bzip2.txt
+++ b/bzip2.txt
@@ -1,6 +1,6 @@
1 1
2NAME 2NAME
3 bzip2, bunzip2 - a block-sorting file compressor, v1.0.3 3 bzip2, bunzip2 - a block-sorting file compressor, v1.0.4
4 bzcat - decompresses files to stdout 4 bzcat - decompresses files to stdout
5 bzip2recover - recovers data from damaged bzip2 files 5 bzip2recover - recovers data from damaged bzip2 files
6 6
@@ -345,14 +345,14 @@ CAVEATS
345 but the details of what the problem is sometimes seem 345 but the details of what the problem is sometimes seem
346 rather misleading. 346 rather misleading.
347 347
348 This manual page pertains to version 1.0.3 of bzip2. Com- 348 This manual page pertains to version 1.0.4 of bzip2. Com-
349 pressed data created by this version is entirely forwards 349 pressed data created by this version is entirely forwards
350 and backwards compatible with the previous public 350 and backwards compatible with the previous public
351 releases, versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1 and 351 releases, versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1,
352 1.0.2, but with the following exception: 0.9.0 and above 352 1.0.2 and 1.0.3, but with the following exception: 0.9.0
353 can correctly decompress multiple concatenated compressed 353 and above can correctly decompress multiple concatenated
354 files. 0.1pl2 cannot do this; it will stop after decom- 354 compressed files. 0.1pl2 cannot do this; it will stop
355 pressing just the first file in the stream. 355 after decompressing just the first file in the stream.
356 356
357 bzip2recover versions prior to 1.0.2 used 32-bit integers 357 bzip2recover versions prior to 1.0.2 used 32-bit integers
358 to represent bit positions in compressed files, so they 358 to represent bit positions in compressed files, so they
diff --git a/bzip2recover.c b/bzip2recover.c
index 5cd405d..ffe60bc 100644
--- a/bzip2recover.c
+++ b/bzip2recover.c
@@ -1,56 +1,24 @@
1
2/*-----------------------------------------------------------*/ 1/*-----------------------------------------------------------*/
3/*--- Block recoverer program for bzip2 ---*/ 2/*--- Block recoverer program for bzip2 ---*/
4/*--- bzip2recover.c ---*/ 3/*--- bzip2recover.c ---*/
5/*-----------------------------------------------------------*/ 4/*-----------------------------------------------------------*/
6 5
7/*-- 6/* ------------------------------------------------------------------
8 This program is bzip2recover, a program to attempt data 7 This file is part of bzip2/libbzip2, a program and library for
9 salvage from damaged files created by the accompanying 8 lossless, block-sorting data compression.
10 bzip2-1.0.3 program.
11
12 Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
13
14 Redistribution and use in source and binary forms, with or without
15 modification, are permitted provided that the following conditions
16 are met:
17
18 1. Redistributions of source code must retain the above copyright
19 notice, this list of conditions and the following disclaimer.
20
21 2. The origin of this software must not be misrepresented; you must
22 not claim that you wrote the original software. If you use this
23 software in a product, an acknowledgment in the product
24 documentation would be appreciated but is not required.
25
26 3. Altered source versions must be plainly marked as such, and must
27 not be misrepresented as being the original software.
28
29 4. The name of the author may not be used to endorse or promote
30 products derived from this software without specific prior written
31 permission.
32
33 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
34 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
35 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
37 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
39 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
40 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
41 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
42 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44
45 Julian Seward, Cambridge, UK.
46 jseward@bzip.org
47 bzip2/libbzip2 version 1.0.3 of 15 February 2005
48--*/
49 9
50/*-- 10 bzip2/libbzip2 version 1.0.4 of 20 December 2006
51 This program is a complete hack and should be rewritten 11 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
52 properly. It isn't very complicated. 12
53--*/ 13 Please read the WARNING, DISCLAIMER and PATENTS sections in the
14 README file.
15
16 This program is released under the terms of the license contained
17 in the file LICENSE.
18 ------------------------------------------------------------------ */
19
20/* This program is a complete hack and should be rewritten properly.
21 It isn't very complicated. */
54 22
55#include <stdio.h> 23#include <stdio.h>
56#include <errno.h> 24#include <errno.h>
@@ -114,7 +82,7 @@ MaybeUInt64 bytesIn = 0;
114/*---------------------------------------------------*/ 82/*---------------------------------------------------*/
115 83
116/*---------------------------------------------*/ 84/*---------------------------------------------*/
117void readError ( void ) 85static void readError ( void )
118{ 86{
119 fprintf ( stderr, 87 fprintf ( stderr,
120 "%s: I/O error reading `%s', possible reason follows.\n", 88 "%s: I/O error reading `%s', possible reason follows.\n",
@@ -127,7 +95,7 @@ void readError ( void )
127 95
128 96
129/*---------------------------------------------*/ 97/*---------------------------------------------*/
130void writeError ( void ) 98static void writeError ( void )
131{ 99{
132 fprintf ( stderr, 100 fprintf ( stderr,
133 "%s: I/O error reading `%s', possible reason follows.\n", 101 "%s: I/O error reading `%s', possible reason follows.\n",
@@ -140,7 +108,7 @@ void writeError ( void )
140 108
141 109
142/*---------------------------------------------*/ 110/*---------------------------------------------*/
143void mallocFail ( Int32 n ) 111static void mallocFail ( Int32 n )
144{ 112{
145 fprintf ( stderr, 113 fprintf ( stderr,
146 "%s: malloc failed on request for %d bytes.\n", 114 "%s: malloc failed on request for %d bytes.\n",
@@ -152,7 +120,7 @@ void mallocFail ( Int32 n )
152 120
153 121
154/*---------------------------------------------*/ 122/*---------------------------------------------*/
155void tooManyBlocks ( Int32 max_handled_blocks ) 123static void tooManyBlocks ( Int32 max_handled_blocks )
156{ 124{
157 fprintf ( stderr, 125 fprintf ( stderr,
158 "%s: `%s' appears to contain more than %d blocks\n", 126 "%s: `%s' appears to contain more than %d blocks\n",
@@ -183,7 +151,7 @@ typedef
183 151
184 152
185/*---------------------------------------------*/ 153/*---------------------------------------------*/
186BitStream* bsOpenReadStream ( FILE* stream ) 154static BitStream* bsOpenReadStream ( FILE* stream )
187{ 155{
188 BitStream *bs = malloc ( sizeof(BitStream) ); 156 BitStream *bs = malloc ( sizeof(BitStream) );
189 if (bs == NULL) mallocFail ( sizeof(BitStream) ); 157 if (bs == NULL) mallocFail ( sizeof(BitStream) );
@@ -196,7 +164,7 @@ BitStream* bsOpenReadStream ( FILE* stream )
196 164
197 165
198/*---------------------------------------------*/ 166/*---------------------------------------------*/
199BitStream* bsOpenWriteStream ( FILE* stream ) 167static BitStream* bsOpenWriteStream ( FILE* stream )
200{ 168{
201 BitStream *bs = malloc ( sizeof(BitStream) ); 169 BitStream *bs = malloc ( sizeof(BitStream) );
202 if (bs == NULL) mallocFail ( sizeof(BitStream) ); 170 if (bs == NULL) mallocFail ( sizeof(BitStream) );
@@ -209,7 +177,7 @@ BitStream* bsOpenWriteStream ( FILE* stream )
209 177
210 178
211/*---------------------------------------------*/ 179/*---------------------------------------------*/
212void bsPutBit ( BitStream* bs, Int32 bit ) 180static void bsPutBit ( BitStream* bs, Int32 bit )
213{ 181{
214 if (bs->buffLive == 8) { 182 if (bs->buffLive == 8) {
215 Int32 retVal = putc ( (UChar) bs->buffer, bs->handle ); 183 Int32 retVal = putc ( (UChar) bs->buffer, bs->handle );
@@ -228,7 +196,7 @@ void bsPutBit ( BitStream* bs, Int32 bit )
228/*-- 196/*--
229 Returns 0 or 1, or 2 to indicate EOF. 197 Returns 0 or 1, or 2 to indicate EOF.
230--*/ 198--*/
231Int32 bsGetBit ( BitStream* bs ) 199static Int32 bsGetBit ( BitStream* bs )
232{ 200{
233 if (bs->buffLive > 0) { 201 if (bs->buffLive > 0) {
234 bs->buffLive --; 202 bs->buffLive --;
@@ -247,7 +215,7 @@ Int32 bsGetBit ( BitStream* bs )
247 215
248 216
249/*---------------------------------------------*/ 217/*---------------------------------------------*/
250void bsClose ( BitStream* bs ) 218static void bsClose ( BitStream* bs )
251{ 219{
252 Int32 retVal; 220 Int32 retVal;
253 221
@@ -271,7 +239,7 @@ void bsClose ( BitStream* bs )
271 239
272 240
273/*---------------------------------------------*/ 241/*---------------------------------------------*/
274void bsPutUChar ( BitStream* bs, UChar c ) 242static void bsPutUChar ( BitStream* bs, UChar c )
275{ 243{
276 Int32 i; 244 Int32 i;
277 for (i = 7; i >= 0; i--) 245 for (i = 7; i >= 0; i--)
@@ -280,7 +248,7 @@ void bsPutUChar ( BitStream* bs, UChar c )
280 248
281 249
282/*---------------------------------------------*/ 250/*---------------------------------------------*/
283void bsPutUInt32 ( BitStream* bs, UInt32 c ) 251static void bsPutUInt32 ( BitStream* bs, UInt32 c )
284{ 252{
285 Int32 i; 253 Int32 i;
286 254
@@ -290,7 +258,7 @@ void bsPutUInt32 ( BitStream* bs, UInt32 c )
290 258
291 259
292/*---------------------------------------------*/ 260/*---------------------------------------------*/
293Bool endsInBz2 ( Char* name ) 261static Bool endsInBz2 ( Char* name )
294{ 262{
295 Int32 n = strlen ( name ); 263 Int32 n = strlen ( name );
296 if (n <= 4) return False; 264 if (n <= 4) return False;
@@ -345,7 +313,7 @@ Int32 main ( Int32 argc, Char** argv )
345 inFileName[0] = outFileName[0] = 0; 313 inFileName[0] = outFileName[0] = 0;
346 314
347 fprintf ( stderr, 315 fprintf ( stderr,
348 "bzip2recover 1.0.3: extracts blocks from damaged .bz2 files.\n" ); 316 "bzip2recover 1.0.4: extracts blocks from damaged .bz2 files.\n" );
349 317
350 if (argc != 2) { 318 if (argc != 2) {
351 fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n", 319 fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n",
diff --git a/bzlib.c b/bzlib.c
index e9c1e87..79c34a5 100644
--- a/bzlib.c
+++ b/bzlib.c
@@ -4,74 +4,29 @@
4/*--- bzlib.c ---*/ 4/*--- bzlib.c ---*/
5/*-------------------------------------------------------------*/ 5/*-------------------------------------------------------------*/
6 6
7/*-- 7/* ------------------------------------------------------------------
8 This file is a part of bzip2 and/or libbzip2, a program and 8 This file is part of bzip2/libbzip2, a program and library for
9 library for lossless, block-sorting data compression. 9 lossless, block-sorting data compression.
10
11 Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions
15 are met:
16
17 1. Redistributions of source code must retain the above copyright
18 notice, this list of conditions and the following disclaimer.
19
20 2. The origin of this software must not be misrepresented; you must
21 not claim that you wrote the original software. If you use this
22 software in a product, an acknowledgment in the product
23 documentation would be appreciated but is not required.
24
25 3. Altered source versions must be plainly marked as such, and must
26 not be misrepresented as being the original software.
27
28 4. The name of the author may not be used to endorse or promote
29 products derived from this software without specific prior written
30 permission.
31
32 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
33 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
36 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
38 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
44 Julian Seward, Cambridge, UK.
45 jseward@bzip.org
46 bzip2/libbzip2 version 1.0 of 21 March 2000
47
48 This program is based on (at least) the work of:
49 Mike Burrows
50 David Wheeler
51 Peter Fenwick
52 Alistair Moffat
53 Radford Neal
54 Ian H. Witten
55 Robert Sedgewick
56 Jon L. Bentley
57
58 For more information on these sources, see the manual.
59--*/
60 10
61/*-- 11 bzip2/libbzip2 version 1.0.4 of 20 December 2006
62 CHANGES 12 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
63 ~~~~~~~
64 0.9.0 -- original version.
65 13
66 0.9.0a/b -- no changes in this file. 14 Please read the WARNING, DISCLAIMER and PATENTS sections in the
15 README file.
67 16
68 0.9.0c 17 This program is released under the terms of the license contained
69 * made zero-length BZ_FLUSH work correctly in bzCompress(). 18 in the file LICENSE.
70 * fixed bzWrite/bzRead to ignore zero-length requests. 19 ------------------------------------------------------------------ */
71 * fixed bzread to correctly handle read requests after EOF. 20
72 * wrong parameter order in call to bzDecompressInit in 21/* CHANGES
73 bzBuffToBuffDecompress. Fixed. 22 0.9.0 -- original version.
74--*/ 23 0.9.0a/b -- no changes in this file.
24 0.9.0c -- made zero-length BZ_FLUSH work correctly in bzCompress().
25 fixed bzWrite/bzRead to ignore zero-length requests.
26 fixed bzread to correctly handle read requests after EOF.
27 wrong parameter order in call to bzDecompressInit in
28 bzBuffToBuffDecompress. Fixed.
29*/
75 30
76#include "bzlib_private.h" 31#include "bzlib_private.h"
77 32
@@ -1394,8 +1349,7 @@ int BZ_API(BZ2_bzBuffToBuffDecompress)
1394 1349
1395/*---------------------------------------------------*/ 1350/*---------------------------------------------------*/
1396/*-- 1351/*--
1397 Code contributed by Yoshioka Tsuneo 1352 Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
1398 (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
1399 to support better zlib compatibility. 1353 to support better zlib compatibility.
1400 This code is not _officially_ part of libbzip2 (yet); 1354 This code is not _officially_ part of libbzip2 (yet);
1401 I haven't tested it, documented it, or considered the 1355 I haven't tested it, documented it, or considered the
@@ -1406,7 +1360,7 @@ int BZ_API(BZ2_bzBuffToBuffDecompress)
1406 1360
1407/*---------------------------------------------------*/ 1361/*---------------------------------------------------*/
1408/*-- 1362/*--
1409 return version like "0.9.0c". 1363 return version like "0.9.5d, 4-Sept-1999".
1410--*/ 1364--*/
1411const char * BZ_API(BZ2_bzlibVersion)(void) 1365const char * BZ_API(BZ2_bzlibVersion)(void)
1412{ 1366{
@@ -1559,9 +1513,10 @@ int BZ_API(BZ2_bzflush) (BZFILE *b)
1559void BZ_API(BZ2_bzclose) (BZFILE* b) 1513void BZ_API(BZ2_bzclose) (BZFILE* b)
1560{ 1514{
1561 int bzerr; 1515 int bzerr;
1562 FILE *fp = ((bzFile *)b)->handle; 1516 FILE *fp;
1563 1517
1564 if (b==NULL) {return;} 1518 if (b==NULL) {return;}
1519 fp = ((bzFile *)b)->handle;
1565 if(((bzFile*)b)->writing){ 1520 if(((bzFile*)b)->writing){
1566 BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL); 1521 BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL);
1567 if(bzerr != BZ_OK){ 1522 if(bzerr != BZ_OK){
@@ -1580,7 +1535,7 @@ void BZ_API(BZ2_bzclose) (BZFILE* b)
1580/*-- 1535/*--
1581 return last error code 1536 return last error code
1582--*/ 1537--*/
1583static char *bzerrorstrings[] = { 1538static const char *bzerrorstrings[] = {
1584 "OK" 1539 "OK"
1585 ,"SEQUENCE_ERROR" 1540 ,"SEQUENCE_ERROR"
1586 ,"PARAM_ERROR" 1541 ,"PARAM_ERROR"
diff --git a/bzlib.h b/bzlib.h
index 3237243..fdb0dbe 100644
--- a/bzlib.h
+++ b/bzlib.h
@@ -4,59 +4,19 @@
4/*--- bzlib.h ---*/ 4/*--- bzlib.h ---*/
5/*-------------------------------------------------------------*/ 5/*-------------------------------------------------------------*/
6 6
7/*-- 7/* ------------------------------------------------------------------
8 This file is a part of bzip2 and/or libbzip2, a program and 8 This file is part of bzip2/libbzip2, a program and library for
9 library for lossless, block-sorting data compression. 9 lossless, block-sorting data compression.
10 10
11 Copyright (C) 1996-2005 Julian R Seward. All rights reserved. 11 bzip2/libbzip2 version 1.0.4 of 20 December 2006
12 12 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
13 Redistribution and use in source and binary forms, with or without 13
14 modification, are permitted provided that the following conditions 14 Please read the WARNING, DISCLAIMER and PATENTS sections in the
15 are met: 15 README file.
16 16
17 1. Redistributions of source code must retain the above copyright 17 This program is released under the terms of the license contained
18 notice, this list of conditions and the following disclaimer. 18 in the file LICENSE.
19 19 ------------------------------------------------------------------ */
20 2. The origin of this software must not be misrepresented; you must
21 not claim that you wrote the original software. If you use this
22 software in a product, an acknowledgment in the product
23 documentation would be appreciated but is not required.
24
25 3. Altered source versions must be plainly marked as such, and must
26 not be misrepresented as being the original software.
27
28 4. The name of the author may not be used to endorse or promote
29 products derived from this software without specific prior written
30 permission.
31
32 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
33 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
36 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
38 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
44 Julian Seward, Cambridge, UK.
45 jseward@bzip.org
46 bzip2/libbzip2 version 1.0 of 21 March 2000
47
48 This program is based on (at least) the work of:
49 Mike Burrows
50 David Wheeler
51 Peter Fenwick
52 Alistair Moffat
53 Radford Neal
54 Ian H. Witten
55 Robert Sedgewick
56 Jon L. Bentley
57
58 For more information on these sources, see the manual.
59--*/
60 20
61 21
62#ifndef _BZLIB_H 22#ifndef _BZLIB_H
@@ -262,8 +222,7 @@ BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
262 222
263 223
264/*-- 224/*--
265 Code contributed by Yoshioka Tsuneo 225 Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
266 (QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
267 to support better zlib compatibility. 226 to support better zlib compatibility.
268 This code is not _officially_ part of libbzip2 (yet); 227 This code is not _officially_ part of libbzip2 (yet);
269 I haven't tested it, documented it, or considered the 228 I haven't tested it, documented it, or considered the
diff --git a/bzlib_private.h b/bzlib_private.h
index ca76fe6..d0a0554 100644
--- a/bzlib_private.h
+++ b/bzlib_private.h
@@ -4,59 +4,19 @@
4/*--- bzlib_private.h ---*/ 4/*--- bzlib_private.h ---*/
5/*-------------------------------------------------------------*/ 5/*-------------------------------------------------------------*/
6 6
7/*-- 7/* ------------------------------------------------------------------
8 This file is a part of bzip2 and/or libbzip2, a program and 8 This file is part of bzip2/libbzip2, a program and library for
9 library for lossless, block-sorting data compression. 9 lossless, block-sorting data compression.
10 10
11 Copyright (C) 1996-2005 Julian R Seward. All rights reserved. 11 bzip2/libbzip2 version 1.0.4 of 20 December 2006
12 12 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
13 Redistribution and use in source and binary forms, with or without 13
14 modification, are permitted provided that the following conditions 14 Please read the WARNING, DISCLAIMER and PATENTS sections in the
15 are met: 15 README file.
16 16
17 1. Redistributions of source code must retain the above copyright 17 This program is released under the terms of the license contained
18 notice, this list of conditions and the following disclaimer. 18 in the file LICENSE.
19 19 ------------------------------------------------------------------ */
20 2. The origin of this software must not be misrepresented; you must
21 not claim that you wrote the original software. If you use this
22 software in a product, an acknowledgment in the product
23 documentation would be appreciated but is not required.
24
25 3. Altered source versions must be plainly marked as such, and must
26 not be misrepresented as being the original software.
27
28 4. The name of the author may not be used to endorse or promote
29 products derived from this software without specific prior written
30 permission.
31
32 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
33 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
36 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
38 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
44 Julian Seward, Cambridge, UK.
45 jseward@bzip.org
46 bzip2/libbzip2 version 1.0 of 21 March 2000
47
48 This program is based on (at least) the work of:
49 Mike Burrows
50 David Wheeler
51 Peter Fenwick
52 Alistair Moffat
53 Radford Neal
54 Ian H. Witten
55 Robert Sedgewick
56 Jon L. Bentley
57
58 For more information on these sources, see the manual.
59--*/
60 20
61 21
62#ifndef _BZLIB_PRIVATE_H 22#ifndef _BZLIB_PRIVATE_H
@@ -76,7 +36,7 @@
76 36
77/*-- General stuff. --*/ 37/*-- General stuff. --*/
78 38
79#define BZ_VERSION "1.0.3, 15-Feb-2005" 39#define BZ_VERSION "1.0.4, 20-Dec-2006"
80 40
81typedef char Char; 41typedef char Char;
82typedef unsigned char Bool; 42typedef unsigned char Bool;
@@ -94,9 +54,11 @@ typedef unsigned short UInt16;
94#endif 54#endif
95 55
96#ifndef BZ_NO_STDIO 56#ifndef BZ_NO_STDIO
57
97extern void BZ2_bz__AssertH__fail ( int errcode ); 58extern void BZ2_bz__AssertH__fail ( int errcode );
98#define AssertH(cond,errcode) \ 59#define AssertH(cond,errcode) \
99 { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); } 60 { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); }
61
100#if BZ_DEBUG 62#if BZ_DEBUG
101#define AssertD(cond,msg) \ 63#define AssertD(cond,msg) \
102 { if (!(cond)) { \ 64 { if (!(cond)) { \
@@ -107,6 +69,7 @@ extern void BZ2_bz__AssertH__fail ( int errcode );
107#else 69#else
108#define AssertD(cond,msg) /* */ 70#define AssertD(cond,msg) /* */
109#endif 71#endif
72
110#define VPrintf0(zf) \ 73#define VPrintf0(zf) \
111 fprintf(stderr,zf) 74 fprintf(stderr,zf)
112#define VPrintf1(zf,za1) \ 75#define VPrintf1(zf,za1) \
@@ -119,17 +82,20 @@ extern void BZ2_bz__AssertH__fail ( int errcode );
119 fprintf(stderr,zf,za1,za2,za3,za4) 82 fprintf(stderr,zf,za1,za2,za3,za4)
120#define VPrintf5(zf,za1,za2,za3,za4,za5) \ 83#define VPrintf5(zf,za1,za2,za3,za4,za5) \
121 fprintf(stderr,zf,za1,za2,za3,za4,za5) 84 fprintf(stderr,zf,za1,za2,za3,za4,za5)
85
122#else 86#else
87
123extern void bz_internal_error ( int errcode ); 88extern void bz_internal_error ( int errcode );
124#define AssertH(cond,errcode) \ 89#define AssertH(cond,errcode) \
125 { if (!(cond)) bz_internal_error ( errcode ); } 90 { if (!(cond)) bz_internal_error ( errcode ); }
126#define AssertD(cond,msg) /* */ 91#define AssertD(cond,msg) do { } while (0)
127#define VPrintf0(zf) /* */ 92#define VPrintf0(zf) do { } while (0)
128#define VPrintf1(zf,za1) /* */ 93#define VPrintf1(zf,za1) do { } while (0)
129#define VPrintf2(zf,za1,za2) /* */ 94#define VPrintf2(zf,za1,za2) do { } while (0)
130#define VPrintf3(zf,za1,za2,za3) /* */ 95#define VPrintf3(zf,za1,za2,za3) do { } while (0)
131#define VPrintf4(zf,za1,za2,za3,za4) /* */ 96#define VPrintf4(zf,za1,za2,za3,za4) do { } while (0)
132#define VPrintf5(zf,za1,za2,za3,za4,za5) /* */ 97#define VPrintf5(zf,za1,za2,za3,za4,za5) do { } while (0)
98
133#endif 99#endif
134 100
135 101
diff --git a/compress.c b/compress.c
index 7e0c291..d98d5c0 100644
--- a/compress.c
+++ b/compress.c
@@ -4,71 +4,27 @@
4/*--- compress.c ---*/ 4/*--- compress.c ---*/
5/*-------------------------------------------------------------*/ 5/*-------------------------------------------------------------*/
6 6
7/*-- 7/* ------------------------------------------------------------------
8 This file is a part of bzip2 and/or libbzip2, a program and 8 This file is part of bzip2/libbzip2, a program and library for
9 library for lossless, block-sorting data compression. 9 lossless, block-sorting data compression.
10 10
11 Copyright (C) 1996-2005 Julian R Seward. All rights reserved. 11 bzip2/libbzip2 version 1.0.4 of 20 December 2006
12 12 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
13 Redistribution and use in source and binary forms, with or without 13
14 modification, are permitted provided that the following conditions 14 Please read the WARNING, DISCLAIMER and PATENTS sections in the
15 are met: 15 README file.
16 16
17 1. Redistributions of source code must retain the above copyright 17 This program is released under the terms of the license contained
18 notice, this list of conditions and the following disclaimer. 18 in the file LICENSE.
19 19 ------------------------------------------------------------------ */
20 2. The origin of this software must not be misrepresented; you must 20
21 not claim that you wrote the original software. If you use this 21
22 software in a product, an acknowledgment in the product 22/* CHANGES
23 documentation would be appreciated but is not required. 23 0.9.0 -- original version.
24 24 0.9.0a/b -- no changes in this file.
25 3. Altered source versions must be plainly marked as such, and must 25 0.9.0c -- changed setting of nGroups in sendMTFValues()
26 not be misrepresented as being the original software. 26 so as to do a bit better on small files
27 27*/
28 4. The name of the author may not be used to endorse or promote
29 products derived from this software without specific prior written
30 permission.
31
32 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
33 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
36 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
38 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
44 Julian Seward, Cambridge, UK.
45 jseward@bzip.org
46 bzip2/libbzip2 version 1.0 of 21 March 2000
47
48 This program is based on (at least) the work of:
49 Mike Burrows
50 David Wheeler
51 Peter Fenwick
52 Alistair Moffat
53 Radford Neal
54 Ian H. Witten
55 Robert Sedgewick
56 Jon L. Bentley
57
58 For more information on these sources, see the manual.
59--*/
60
61/*--
62 CHANGES
63 ~~~~~~~
64 0.9.0 -- original version.
65
66 0.9.0a/b -- no changes in this file.
67
68 0.9.0c
69 * changed setting of nGroups in sendMTFValues() so as to
70 do a bit better on small files
71--*/
72 28
73#include "bzlib_private.h" 29#include "bzlib_private.h"
74 30
diff --git a/crctable.c b/crctable.c
index b6dadfc..bc7e2ae 100644
--- a/crctable.c
+++ b/crctable.c
@@ -4,59 +4,19 @@
4/*--- crctable.c ---*/ 4/*--- crctable.c ---*/
5/*-------------------------------------------------------------*/ 5/*-------------------------------------------------------------*/
6 6
7/*-- 7/* ------------------------------------------------------------------
8 This file is a part of bzip2 and/or libbzip2, a program and 8 This file is part of bzip2/libbzip2, a program and library for
9 library for lossless, block-sorting data compression. 9 lossless, block-sorting data compression.
10
11 Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions
15 are met:
16
17 1. Redistributions of source code must retain the above copyright
18 notice, this list of conditions and the following disclaimer.
19
20 2. The origin of this software must not be misrepresented; you must
21 not claim that you wrote the original software. If you use this
22 software in a product, an acknowledgment in the product
23 documentation would be appreciated but is not required.
24 10
25 3. Altered source versions must be plainly marked as such, and must 11 bzip2/libbzip2 version 1.0.4 of 20 December 2006
26 not be misrepresented as being the original software. 12 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
27 13
28 4. The name of the author may not be used to endorse or promote 14 Please read the WARNING, DISCLAIMER and PATENTS sections in the
29 products derived from this software without specific prior written 15 README file.
30 permission.
31 16
32 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 17 This program is released under the terms of the license contained
33 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 in the file LICENSE.
34 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 ------------------------------------------------------------------ */
35 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
36 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
38 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
44 Julian Seward, Cambridge, UK.
45 jseward@bzip.org
46 bzip2/libbzip2 version 1.0 of 21 March 2000
47
48 This program is based on (at least) the work of:
49 Mike Burrows
50 David Wheeler
51 Peter Fenwick
52 Alistair Moffat
53 Radford Neal
54 Ian H. Witten
55 Robert Sedgewick
56 Jon L. Bentley
57
58 For more information on these sources, see the manual.
59--*/
60 20
61 21
62#include "bzlib_private.h" 22#include "bzlib_private.h"
diff --git a/decompress.c b/decompress.c
index 81c3d2c..124cc8d 100644
--- a/decompress.c
+++ b/decompress.c
@@ -4,59 +4,19 @@
4/*--- decompress.c ---*/ 4/*--- decompress.c ---*/
5/*-------------------------------------------------------------*/ 5/*-------------------------------------------------------------*/
6 6
7/*-- 7/* ------------------------------------------------------------------
8 This file is a part of bzip2 and/or libbzip2, a program and 8 This file is part of bzip2/libbzip2, a program and library for
9 library for lossless, block-sorting data compression. 9 lossless, block-sorting data compression.
10 10
11 Copyright (C) 1996-2005 Julian R Seward. All rights reserved. 11 bzip2/libbzip2 version 1.0.4 of 20 December 2006
12 12 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
13 Redistribution and use in source and binary forms, with or without 13
14 modification, are permitted provided that the following conditions 14 Please read the WARNING, DISCLAIMER and PATENTS sections in the
15 are met: 15 README file.
16 16
17 1. Redistributions of source code must retain the above copyright 17 This program is released under the terms of the license contained
18 notice, this list of conditions and the following disclaimer. 18 in the file LICENSE.
19 19 ------------------------------------------------------------------ */
20 2. The origin of this software must not be misrepresented; you must
21 not claim that you wrote the original software. If you use this
22 software in a product, an acknowledgment in the product
23 documentation would be appreciated but is not required.
24
25 3. Altered source versions must be plainly marked as such, and must
26 not be misrepresented as being the original software.
27
28 4. The name of the author may not be used to endorse or promote
29 products derived from this software without specific prior written
30 permission.
31
32 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
33 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
36 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
38 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
44 Julian Seward, Cambridge, UK.
45 jseward@bzip.org
46 bzip2/libbzip2 version 1.0 of 21 March 2000
47
48 This program is based on (at least) the work of:
49 Mike Burrows
50 David Wheeler
51 Peter Fenwick
52 Alistair Moffat
53 Radford Neal
54 Ian H. Witten
55 Robert Sedgewick
56 Jon L. Bentley
57
58 For more information on these sources, see the manual.
59--*/
60 20
61 21
62#include "bzlib_private.h" 22#include "bzlib_private.h"
diff --git a/dlltest.c b/dlltest.c
index 2d7dcca..03fa146 100644
--- a/dlltest.c
+++ b/dlltest.c
@@ -1,9 +1,8 @@
1/* 1/*
2 minibz2 2 minibz2
3 libbz2.dll test program. 3 libbz2.dll test program.
4 by Yoshioka Tsuneo(QWF00133@nifty.ne.jp/tsuneo-y@is.aist-nara.ac.jp) 4 by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
5 This file is Public Domain. 5 This file is Public Domain. Welcome any email to me.
6 welcome any email to me.
7 6
8 usage: minibz2 [-d] [-{1,2,..9}] [[srcfilename] destfilename] 7 usage: minibz2 [-d] [-{1,2,..9}] [[srcfilename] destfilename]
9*/ 8*/
diff --git a/entities.xml b/entities.xml
index 6d0975f..ce2b70d 100644
--- a/entities.xml
+++ b/entities.xml
@@ -1,9 +1,9 @@
1<!-- misc. strings --> 1<!-- misc. strings -->
2<!ENTITY bz-url "http://www.bzip.org"> 2<!ENTITY bz-url "http://www.bzip.org">
3<!ENTITY bz-email "jseward@bzip.org"> 3<!ENTITY bz-email "jseward@bzip.org">
4<!ENTITY bz-lifespan "1996-2005"> 4<!ENTITY bz-lifespan "1996-2006">
5 5
6<!ENTITY bz-version "1.0.3"> 6<!ENTITY bz-version "1.0.4">
7<!ENTITY bz-date "15 February 2005"> 7<!ENTITY bz-date "20 December 2006">
8 8
9<!ENTITY manual-title "bzip2 Manual"> 9<!ENTITY manual-title "bzip2 Manual">
diff --git a/format.pl b/format.pl
index 8ab47ac..bd03043 100755
--- a/format.pl
+++ b/format.pl
@@ -1,4 +1,19 @@
1#!/usr/bin/perl -w 1#!/usr/bin/perl -w
2#
3# ------------------------------------------------------------------
4# This file is part of bzip2/libbzip2, a program and library for
5# lossless, block-sorting data compression.
6#
7# bzip2/libbzip2 version 1.0.4 of 20 December 2006
8# Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
9#
10# Please read the WARNING, DISCLAIMER and PATENTS sections in the
11# README file.
12#
13# This program is released under the terms of the license contained
14# in the file LICENSE.
15# ------------------------------------------------------------------
16#
2use strict; 17use strict;
3 18
4# get command line values: 19# get command line values:
diff --git a/huffman.c b/huffman.c
index 5bf190b..be4dc02 100644
--- a/huffman.c
+++ b/huffman.c
@@ -4,59 +4,19 @@
4/*--- huffman.c ---*/ 4/*--- huffman.c ---*/
5/*-------------------------------------------------------------*/ 5/*-------------------------------------------------------------*/
6 6
7/*-- 7/* ------------------------------------------------------------------
8 This file is a part of bzip2 and/or libbzip2, a program and 8 This file is part of bzip2/libbzip2, a program and library for
9 library for lossless, block-sorting data compression. 9 lossless, block-sorting data compression.
10 10
11 Copyright (C) 1996-2005 Julian R Seward. All rights reserved. 11 bzip2/libbzip2 version 1.0.4 of 20 December 2006
12 12 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
13 Redistribution and use in source and binary forms, with or without 13
14 modification, are permitted provided that the following conditions 14 Please read the WARNING, DISCLAIMER and PATENTS sections in the
15 are met: 15 README file.
16 16
17 1. Redistributions of source code must retain the above copyright 17 This program is released under the terms of the license contained
18 notice, this list of conditions and the following disclaimer. 18 in the file LICENSE.
19 19 ------------------------------------------------------------------ */
20 2. The origin of this software must not be misrepresented; you must
21 not claim that you wrote the original software. If you use this
22 software in a product, an acknowledgment in the product
23 documentation would be appreciated but is not required.
24
25 3. Altered source versions must be plainly marked as such, and must
26 not be misrepresented as being the original software.
27
28 4. The name of the author may not be used to endorse or promote
29 products derived from this software without specific prior written
30 permission.
31
32 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
33 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
36 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
38 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
44 Julian Seward, Cambridge, UK.
45 jseward@bzip.org
46 bzip2/libbzip2 version 1.0 of 21 March 2000
47
48 This program is based on (at least) the work of:
49 Mike Burrows
50 David Wheeler
51 Peter Fenwick
52 Alistair Moffat
53 Radford Neal
54 Ian H. Witten
55 Robert Sedgewick
56 Jon L. Bentley
57
58 For more information on these sources, see the manual.
59--*/
60 20
61 21
62#include "bzlib_private.h" 22#include "bzlib_private.h"
diff --git a/manual.xml b/manual.xml
index 1ab5bd7..b22a6c8 100644
--- a/manual.xml
+++ b/manual.xml
@@ -9,7 +9,7 @@
9<book lang="en" id="userman" xreflabel="bzip2 Manual"> 9<book lang="en" id="userman" xreflabel="bzip2 Manual">
10 10
11 <bookinfo> 11 <bookinfo>
12 <title>bzip2 and libbzip2, version 1.0.3</title> 12 <title>bzip2 and libbzip2, version 1.0.4</title>
13 <subtitle>A program and library for data compression</subtitle> 13 <subtitle>A program and library for data compression</subtitle>
14 <copyright> 14 <copyright>
15 <year>&bz-lifespan;</year> 15 <year>&bz-lifespan;</year>
@@ -139,7 +139,7 @@ else.</para>
139 139
140 <listitem><para><computeroutput>bzip2</computeroutput>, 140 <listitem><para><computeroutput>bzip2</computeroutput>,
141 <computeroutput>bunzip2</computeroutput> - a block-sorting file 141 <computeroutput>bunzip2</computeroutput> - a block-sorting file
142 compressor, v1.0.3</para></listitem> 142 compressor, v1.0.4</para></listitem>
143 143
144 <listitem><para><computeroutput>bzcat</computeroutput> - 144 <listitem><para><computeroutput>bzcat</computeroutput> -
145 decompresses files to stdout</para></listitem> 145 decompresses files to stdout</para></listitem>
@@ -625,13 +625,13 @@ errors and exit cleanly, but the details of what the problem is
625sometimes seem rather misleading.</para> 625sometimes seem rather misleading.</para>
626 626
627<para>This manual page pertains to version &bz-version; of 627<para>This manual page pertains to version &bz-version; of
628<computeroutput>bzip2</computeroutput>. Compressed data created 628<computeroutput>bzip2</computeroutput>. Compressed data created by
629by this version is entirely forwards and backwards compatible 629this version is entirely forwards and backwards compatible with the
630with the previous public releases, versions 0.1pl2, 0.9.0 and 630previous public releases, versions 0.1pl2, 0.9.0 and 0.9.5, 1.0.0,
6310.9.5, 1.0.0, 1.0.1 and 1.0.2, but with the following exception: 0.9.0 6311.0.1, 1.0.2 and 1.0.3, but with the following exception: 0.9.0 and
632and above can correctly decompress multiple concatenated 632above can correctly decompress multiple concatenated compressed files.
633compressed files. 0.1pl2 cannot do this; it will stop after 6330.1pl2 cannot do this; it will stop after decompressing just the first
634decompressing just the first file in the stream.</para> 634file in the stream.</para>
635 635
636<para><computeroutput>bzip2recover</computeroutput> versions 636<para><computeroutput>bzip2recover</computeroutput> versions
637prior to 1.0.2 used 32-bit integers to represent bit positions in 637prior to 1.0.2 used 32-bit integers to represent bit positions in
@@ -819,8 +819,7 @@ understanding the more general but more complex low-level
819interface.</para> 819interface.</para>
820 820
821<para>Yoshioka Tsuneo 821<para>Yoshioka Tsuneo
822(<computeroutput>QWF00133@niftyserve.or.jp</computeroutput> / 822(<computeroutput>tsuneo@rr.iij4u.or.jp</computeroutput>) has
823<computeroutput>tsuneo-y@is.aist-nara.ac.jp</computeroutput>) has
824contributed some functions to give better 823contributed some functions to give better
825<computeroutput>zlib</computeroutput> compatibility. These 824<computeroutput>zlib</computeroutput> compatibility. These
826functions are <computeroutput>BZ2_bzopen</computeroutput>, 825functions are <computeroutput>BZ2_bzopen</computeroutput>,
@@ -1352,7 +1351,7 @@ FINISHING/BZ_FINISH
1352 output has been removed 1351 output has been removed
1353 Next state = IDLE; Return value = BZ_STREAM_END 1352 Next state = IDLE; Return value = BZ_STREAM_END
1354 else 1353 else
1355 Next state = FINISHING; Return value = BZ_FINISHING 1354 Next state = FINISHING; Return value = BZ_FINISH_OK
1356 1355
1357FINISHING/other 1356FINISHING/other
1358 Illegal. 1357 Illegal.
@@ -2222,7 +2221,7 @@ if ( bzerror != BZ_STREAM_END ) {
2222 BZ2_bzReadClose ( &bzerror, b ); 2221 BZ2_bzReadClose ( &bzerror, b );
2223 /* handle error */ 2222 /* handle error */
2224} else { 2223} else {
2225 BZ2_bzReadClose ( &bzerror ); 2224 BZ2_bzReadClose ( &bzerror, b );
2226} 2225}
2227</programlisting> 2226</programlisting>
2228 2227
@@ -2537,8 +2536,7 @@ recovered from.</para>
2537 2536
2538<para>Everything related to Windows has been contributed by 2537<para>Everything related to Windows has been contributed by
2539Yoshioka Tsuneo 2538Yoshioka Tsuneo
2540(<computeroutput>QWF00133@niftyserve.or.jp</computeroutput> / 2539(<computeroutput>tsuneo@rr.iij4u.or.jp</computeroutput>), so
2541<computeroutput>tsuneo-y@is.aist-nara.ac.jp</computeroutput>), so
2542you should send your queries to him (but perhaps Cc: me, 2540you should send your queries to him (but perhaps Cc: me,
2543<computeroutput>&bz-email;</computeroutput>).</para> 2541<computeroutput>&bz-email;</computeroutput>).</para>
2544 2542
diff --git a/mk251.c b/mk251.c
index 205778a..b56d420 100644
--- a/mk251.c
+++ b/mk251.c
@@ -5,6 +5,21 @@
5 case, which is fixed in this version (1.0.2) and above. 5 case, which is fixed in this version (1.0.2) and above.
6*/ 6*/
7 7
8/* ------------------------------------------------------------------
9 This file is part of bzip2/libbzip2, a program and library for
10 lossless, block-sorting data compression.
11
12 bzip2/libbzip2 version 1.0.4 of 20 December 2006
13 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
14
15 Please read the WARNING, DISCLAIMER and PATENTS sections in the
16 README file.
17
18 This program is released under the terms of the license contained
19 in the file LICENSE.
20 ------------------------------------------------------------------ */
21
22
8#include <stdio.h> 23#include <stdio.h>
9 24
10int main () 25int main ()
diff --git a/randtable.c b/randtable.c
index 940462d..d186335 100644
--- a/randtable.c
+++ b/randtable.c
@@ -4,59 +4,19 @@
4/*--- randtable.c ---*/ 4/*--- randtable.c ---*/
5/*-------------------------------------------------------------*/ 5/*-------------------------------------------------------------*/
6 6
7/*-- 7/* ------------------------------------------------------------------
8 This file is a part of bzip2 and/or libbzip2, a program and 8 This file is part of bzip2/libbzip2, a program and library for
9 library for lossless, block-sorting data compression. 9 lossless, block-sorting data compression.
10 10
11 Copyright (C) 1996-2005 Julian R Seward. All rights reserved. 11 bzip2/libbzip2 version 1.0.4 of 20 December 2006
12 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
12 13
13 Redistribution and use in source and binary forms, with or without 14 Please read the WARNING, DISCLAIMER and PATENTS sections in the
14 modification, are permitted provided that the following conditions 15 README file.
15 are met:
16 16
17 1. Redistributions of source code must retain the above copyright 17 This program is released under the terms of the license contained
18 notice, this list of conditions and the following disclaimer. 18 in the file LICENSE.
19 19 ------------------------------------------------------------------ */
20 2. The origin of this software must not be misrepresented; you must
21 not claim that you wrote the original software. If you use this
22 software in a product, an acknowledgment in the product
23 documentation would be appreciated but is not required.
24
25 3. Altered source versions must be plainly marked as such, and must
26 not be misrepresented as being the original software.
27
28 4. The name of the author may not be used to endorse or promote
29 products derived from this software without specific prior written
30 permission.
31
32 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
33 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
36 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
38 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
44 Julian Seward, Cambridge, UK.
45 jseward@bzip.org
46 bzip2/libbzip2 version 1.0 of 21 March 2000
47
48 This program is based on (at least) the work of:
49 Mike Burrows
50 David Wheeler
51 Peter Fenwick
52 Alistair Moffat
53 Radford Neal
54 Ian H. Witten
55 Robert Sedgewick
56 Jon L. Bentley
57
58 For more information on these sources, see the manual.
59--*/
60 20
61 21
62#include "bzlib_private.h" 22#include "bzlib_private.h"
diff --git a/spewG.c b/spewG.c
index 7934e76..e1f3032 100644
--- a/spewG.c
+++ b/spewG.c
@@ -9,6 +9,21 @@
9 (but is otherwise harmless). 9 (but is otherwise harmless).
10*/ 10*/
11 11
12/* ------------------------------------------------------------------
13 This file is part of bzip2/libbzip2, a program and library for
14 lossless, block-sorting data compression.
15
16 bzip2/libbzip2 version 1.0.4 of 20 December 2006
17 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
18
19 Please read the WARNING, DISCLAIMER and PATENTS sections in the
20 README file.
21
22 This program is released under the terms of the license contained
23 in the file LICENSE.
24 ------------------------------------------------------------------ */
25
26
12#define _FILE_OFFSET_BITS 64 27#define _FILE_OFFSET_BITS 64
13 28
14#include <stdio.h> 29#include <stdio.h>
diff --git a/unzcrash.c b/unzcrash.c
index f0f17fc..1f08a2e 100644
--- a/unzcrash.c
+++ b/unzcrash.c
@@ -8,11 +8,26 @@
8 This should not cause any invalid memory accesses. If it does, 8 This should not cause any invalid memory accesses. If it does,
9 I want to know about it! 9 I want to know about it!
10 10
11 p.s. As you can see from the above description, the process is 11 PS. As you can see from the above description, the process is
12 incredibly slow. A file of size eg 5KB will cause it to run for 12 incredibly slow. A file of size eg 5KB will cause it to run for
13 many hours. 13 many hours.
14*/ 14*/
15 15
16/* ------------------------------------------------------------------
17 This file is part of bzip2/libbzip2, a program and library for
18 lossless, block-sorting data compression.
19
20 bzip2/libbzip2 version 1.0.4 of 20 December 2006
21 Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
22
23 Please read the WARNING, DISCLAIMER and PATENTS sections in the
24 README file.
25
26 This program is released under the terms of the license contained
27 in the file LICENSE.
28 ------------------------------------------------------------------ */
29
30
16#include <stdio.h> 31#include <stdio.h>
17#include <assert.h> 32#include <assert.h>
18#include "bzlib.h" 33#include "bzlib.h"
diff --git a/words0 b/words0
index 164a8ed..fbf442a 100644
--- a/words0
+++ b/words0
@@ -1,5 +1,9 @@
1 1
2If compilation produces errors, or a large number of warnings, 2If compilation produces errors, or a large number of warnings,
3please read README.COMPILATION.PROBLEMS -- you might be able to 3please read README.COMPILATION.PROBLEMS -- you might be able to
4adjust the flags in this Makefile to improve matters. 4adjust the flags in this Makefile to improve matters.
5 5
6Also in README.COMPILATION.PROBLEMS are some hints that may help
7if your build produces an executable which is unable to correctly
8handle so-called 'large files' -- files of size 2GB or more.
9
diff --git a/words2 b/words2
index 203ee39..caddcf4 100644
--- a/words2
+++ b/words2
@@ -1,5 +1,5 @@
1 1
2Checking test results. If any of the four "cmp"s which follow 2Checking test results. If any of the four "cmp"s which follow
3report any differences, something is wrong. If you can't easily 3report any differences, something is wrong. If you can't easily
4figure out what, please let me know (jseward@acm.org). 4figure out what, please let me know (jseward@bzip.org).
5 5
diff --git a/words3 b/words3
index 7a6b462..6972669 100644
--- a/words3
+++ b/words3
@@ -1,22 +1,29 @@
1 1
2If you got this far and the "cmp"s didn't complain, it looks 2If you got this far and the 'cmp's didn't complain, it looks
3like you're in business. 3like you're in business.
4 4
5To install in /usr/bin, /usr/lib, /usr/man and /usr/include, type 5To install in /usr/local/bin, /usr/local/lib, /usr/local/man and
6/usr/local/include, type
7
6 make install 8 make install
9
7To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type 10To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type
11
8 make install PREFIX=/xxx/yyy 12 make install PREFIX=/xxx/yyy
13
9If you are (justifiably) paranoid and want to see what 'make install' 14If you are (justifiably) paranoid and want to see what 'make install'
10is going to do, you can first do 15is going to do, you can first do
16
11 make -n install or 17 make -n install or
12 make -n install PREFIX=/xxx/yyy respectively. 18 make -n install PREFIX=/xxx/yyy respectively.
19
13The -n instructs make to show the commands it would execute, but 20The -n instructs make to show the commands it would execute, but
14not actually execute them. 21not actually execute them.
15 22
16Instructions for use are in the preformatted manual page, in the file 23Instructions for use are in the preformatted manual page, in the file
17bzip2.txt. For more detailed documentation, read the full manual. 24bzip2.txt. For more detailed documentation, read the full manual.
18It is available in Postscript form (manual.ps), PDF form (manual.pdf), 25It is available in Postscript form (manual.ps), PDF form (manual.pdf),
19and HTML form (manual_toc.html). 26and HTML form (manual.html).
20 27
21You can also do "bzip2 --help" to see some helpful information. 28You can also do "bzip2 --help" to see some helpful information.
22"bzip2 -L" displays the software license. 29"bzip2 -L" displays the software license.
diff --git a/xmlproc.sh b/xmlproc.sh
index 6fe4d57..5a1f051 100755
--- a/xmlproc.sh
+++ b/xmlproc.sh
@@ -1,5 +1,20 @@
1#!/bin/bash 1#!/bin/bash
2# see the README in this directory for usage etc. 2# see the README file for usage etc.
3#
4# ------------------------------------------------------------------
5# This file is part of bzip2/libbzip2, a program and library for
6# lossless, block-sorting data compression.
7#
8# bzip2/libbzip2 version 1.0.4 of 20 December 2006
9# Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
10#
11# Please read the WARNING, DISCLAIMER and PATENTS sections in the
12# README file.
13#
14# This program is released under the terms of the license contained
15# in the file LICENSE.
16# ----------------------------------------------------------------
17
3 18
4usage() { 19usage() {
5 echo ''; 20 echo '';
@@ -45,7 +60,7 @@ export XML_CATALOG_FILES=/etc/xml/catalog
45 60
46# post-processing tidy up 61# post-processing tidy up
47cleanup() { 62cleanup() {
48 echo "Cleaning up: # $@" 63 echo "Cleaning up: $@"
49 while [ $# != 0 ] 64 while [ $# != 0 ]
50 do 65 do
51 arg=$1; shift; 66 arg=$1; shift;