updated bzip2 to 1.0.4
added bzip2 and bunzip2 to the image git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20847 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -20,7 +20,7 @@ if $(INCLUDE_GPL_ADDONS) = 1 {
|
|||||||
GPL_ONLY = ;
|
GPL_ONLY = ;
|
||||||
}
|
}
|
||||||
|
|
||||||
BEOS_BIN = "[" addattr alert arp basename bc beep cat cardctl catattr chgrp
|
BEOS_BIN = "[" addattr alert arp basename bc beep bzip2 cat cardctl catattr chgrp
|
||||||
chmod chop chown cksum clear clockconfig cmp comm compress cp copyattr
|
chmod chop chown cksum clear clockconfig cmp comm compress cp copyattr
|
||||||
csplit ctags cut date dc dd desklink df diff diff3 dircolors dirname
|
csplit ctags cut date dc dd desklink df diff diff3 dircolors dirname
|
||||||
driveinfo dstcheck du dump_cis dump_cisreg echo eject env error expand
|
driveinfo dstcheck du dump_cis dump_cisreg echo eject env error expand
|
||||||
@@ -183,6 +183,7 @@ AddSymlinkToHaikuImage home config be : /boot/beos/apps : Applications ;
|
|||||||
AddSymlinkToHaikuImage home config be : /boot/beos/preferences : Preferences ;
|
AddSymlinkToHaikuImage home config be : /boot/beos/preferences : Preferences ;
|
||||||
AddSymlinkToHaikuImage home config be : /boot/beos/demos : Demos ;
|
AddSymlinkToHaikuImage home config be : /boot/beos/demos : Demos ;
|
||||||
|
|
||||||
|
AddSymlinkToHaikuImage beos bin : bzip2 : bunzip2 ;
|
||||||
AddSymlinkToHaikuImage beos bin : less : more ;
|
AddSymlinkToHaikuImage beos bin : less : more ;
|
||||||
AddSymlinkToHaikuImage beos bin : gzip : gunzip ;
|
AddSymlinkToHaikuImage beos bin : gzip : gunzip ;
|
||||||
AddSymlinkToHaikuImage beos bin : gzip : zcat ;
|
AddSymlinkToHaikuImage beos bin : gzip : zcat ;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
|
||||||
This program, "bzip2", the associated library "libbzip2", and all
|
This program, "bzip2", the associated library "libbzip2", and all
|
||||||
documentation, are copyright (C) 1996-2005 Julian R Seward. All
|
documentation, are copyright (C) 1996-2006 Julian R Seward. All
|
||||||
rights reserved.
|
rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution 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
|
|||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
Julian Seward, Cambridge, UK.
|
Julian Seward, Cambridge, UK.
|
||||||
jseward@acm.org
|
jseward@bzip.org
|
||||||
bzip2/libbzip2 version 1.0.3 of 15 February 2005
|
bzip2/libbzip2 version 1.0.4 of 20 December 2006
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------
|
||||||
|
|||||||
+12
-59
@@ -4,66 +4,19 @@
|
|||||||
/*--- blocksort.c ---*/
|
/*--- blocksort.c ---*/
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
||||||
/*--
|
/* ------------------------------------------------------------------
|
||||||
This file is a part of bzip2 and/or libbzip2, a program and
|
This file is part of bzip2/libbzip2, a program and library for
|
||||||
library for lossless, block-sorting data compression.
|
lossless, block-sorting data compression.
|
||||||
|
|
||||||
Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
|
bzip2/libbzip2 version 1.0.4 of 20 December 2006
|
||||||
|
Copyright (C) 1996-2006 Julian Seward <[email protected]>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||||
modification, are permitted provided that the following conditions
|
README file.
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
This program is released under the terms of the license contained
|
||||||
notice, this list of conditions and the following disclaimer.
|
in the file LICENSE.
|
||||||
|
------------------------------------------------------------------ */
|
||||||
2. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product
|
|
||||||
documentation would be appreciated but is not required.
|
|
||||||
|
|
||||||
3. Altered source versions must be plainly marked as such, and must
|
|
||||||
not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
4. The name of the author may not be used to endorse or promote
|
|
||||||
products derived from this software without specific prior written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
||||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
||||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
Julian Seward, Cambridge, UK.
|
|
||||||
[email protected]
|
|
||||||
bzip2/libbzip2 version 1.0 of 21 March 2000
|
|
||||||
|
|
||||||
This program is based on (at least) the work of:
|
|
||||||
Mike Burrows
|
|
||||||
David Wheeler
|
|
||||||
Peter Fenwick
|
|
||||||
Alistair Moffat
|
|
||||||
Radford Neal
|
|
||||||
Ian H. Witten
|
|
||||||
Robert Sedgewick
|
|
||||||
Jon L. Bentley
|
|
||||||
|
|
||||||
For more information on these sources, see the manual.
|
|
||||||
|
|
||||||
To get some idea how the block sorting algorithms in this file
|
|
||||||
work, read my paper
|
|
||||||
On the Performance of BWT Sorting Algorithms
|
|
||||||
in Proceedings of the IEEE Data Compression Conference 2000,
|
|
||||||
Snowbird, Utah, USA, 27-30 March 2000. The main sort in this
|
|
||||||
file implements the algorithm called cache in the paper.
|
|
||||||
--*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "bzlib_private.h"
|
#include "bzlib_private.h"
|
||||||
@@ -155,7 +108,7 @@ void fallbackQSort3 ( UInt32* fmap,
|
|||||||
|
|
||||||
while (sp > 0) {
|
while (sp > 0) {
|
||||||
|
|
||||||
AssertH ( sp < FALLBACK_QSORT_STACK_SIZE, 1004 );
|
AssertH ( sp < FALLBACK_QSORT_STACK_SIZE - 1, 1004 );
|
||||||
|
|
||||||
fpop ( lo, hi );
|
fpop ( lo, hi );
|
||||||
if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) {
|
if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) {
|
||||||
@@ -690,7 +643,7 @@ void mainQSort3 ( UInt32* ptr,
|
|||||||
|
|
||||||
while (sp > 0) {
|
while (sp > 0) {
|
||||||
|
|
||||||
AssertH ( sp < MAIN_QSORT_STACK_SIZE, 1001 );
|
AssertH ( sp < MAIN_QSORT_STACK_SIZE - 2, 1001 );
|
||||||
|
|
||||||
mpop ( lo, hi, d );
|
mpop ( lo, hi, d );
|
||||||
if (hi - lo < MAIN_QSORT_SMALL_THRESH ||
|
if (hi - lo < MAIN_QSORT_SMALL_THRESH ||
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
# necessary) and fed to cmp or diff. The exit status from cmp
|
# necessary) and fed to cmp or diff. The exit status from cmp
|
||||||
# or diff is preserved.
|
# or diff is preserved.
|
||||||
|
|
||||||
PATH="/usr/bin:$PATH"; export PATH
|
PATH="/usr/bin:/bin:$PATH"; export PATH
|
||||||
prog=`echo $0 | sed 's|.*/||'`
|
prog=`echo $0 | sed 's|.*/||'`
|
||||||
case "$prog" in
|
case "$prog" in
|
||||||
*cmp) comp=${CMP-cmp} ;;
|
*cmp) comp=${CMP-cmp} ;;
|
||||||
@@ -37,7 +37,7 @@ if test -z "$FILES"; then
|
|||||||
echo "Usage: $prog [${comp}_options] file [file]"
|
echo "Usage: $prog [${comp}_options] file [file]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
tmp=`tempfile -d /tmp -p bz` || {
|
tmp=`mktemp ${TMPDIR:-/tmp}/bzdiff.XXXXXXXXXX` || {
|
||||||
echo 'cannot create a temporary file' >&2
|
echo 'cannot create a temporary file' >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,11 @@ for i do
|
|||||||
bzip2 -cdfq "$i" | $grep $opt "$pat"
|
bzip2 -cdfq "$i" | $grep $opt "$pat"
|
||||||
r=$?
|
r=$?
|
||||||
else
|
else
|
||||||
bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${i}:|"
|
j=${i//\\/\\\\}
|
||||||
|
j=${j//|/\\|}
|
||||||
|
j=${j//&/\\&}
|
||||||
|
j=`printf "%s" "$j" | tr '\n' ' '`
|
||||||
|
bzip2 -cdfq "$i" | $grep $opt "$pat" | sed "s|^|${j}:|"
|
||||||
r=$?
|
r=$?
|
||||||
fi
|
fi
|
||||||
test "$r" -ne 0 && res="$r"
|
test "$r" -ne 0 && res="$r"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.PU
|
.PU
|
||||||
.TH bzip2 1
|
.TH bzip2 1
|
||||||
.SH NAME
|
.SH NAME
|
||||||
bzip2, bunzip2 \- a block-sorting file compressor, v1.0.3
|
bzip2, bunzip2 \- a block-sorting file compressor, v1.0.4
|
||||||
.br
|
.br
|
||||||
bzcat \- decompresses files to stdout
|
bzcat \- decompresses files to stdout
|
||||||
.br
|
.br
|
||||||
@@ -405,11 +405,11 @@ I/O error messages are not as helpful as they could be.
|
|||||||
tries hard to detect I/O errors and exit cleanly, but the details of
|
tries hard to detect I/O errors and exit cleanly, but the details of
|
||||||
what the problem is sometimes seem rather misleading.
|
what the problem is sometimes seem rather misleading.
|
||||||
|
|
||||||
This manual page pertains to version 1.0.3 of
|
This manual page pertains to version 1.0.4 of
|
||||||
.I bzip2.
|
.I bzip2.
|
||||||
Compressed data created by this version is entirely forwards and
|
Compressed data created by this version is entirely forwards and
|
||||||
backwards compatible with the previous public releases, versions
|
backwards compatible with the previous public releases, versions
|
||||||
0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1 and 1.0.2, but with the following
|
0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and 1.0.3, but with the following
|
||||||
exception: 0.9.0 and above can correctly decompress multiple
|
exception: 0.9.0 and above can correctly decompress multiple
|
||||||
concatenated compressed files. 0.1pl2 cannot do this; it will stop
|
concatenated compressed files. 0.1pl2 cannot do this; it will stop
|
||||||
after decompressing just the first file in the stream.
|
after decompressing just the first file in the stream.
|
||||||
|
|||||||
+67
-140
@@ -3,118 +3,26 @@
|
|||||||
/*--- A block-sorting, lossless compressor bzip2.c ---*/
|
/*--- A block-sorting, lossless compressor bzip2.c ---*/
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*--
|
/* ------------------------------------------------------------------
|
||||||
This file is a part of bzip2 and/or libbzip2, a program and
|
This file is part of bzip2/libbzip2, a program and library for
|
||||||
library for lossless, block-sorting data compression.
|
lossless, block-sorting data compression.
|
||||||
|
|
||||||
Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
|
bzip2/libbzip2 version 1.0.4 of 20 December 2006
|
||||||
|
Copyright (C) 1996-2006 Julian Seward <[email protected]>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||||
modification, are permitted provided that the following conditions
|
README file.
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
This program is released under the terms of the license contained
|
||||||
notice, this list of conditions and the following disclaimer.
|
in the file LICENSE.
|
||||||
|
------------------------------------------------------------------ */
|
||||||
2. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product
|
|
||||||
documentation would be appreciated but is not required.
|
|
||||||
|
|
||||||
3. Altered source versions must be plainly marked as such, and must
|
|
||||||
not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
4. The name of the author may not be used to endorse or promote
|
|
||||||
products derived from this software without specific prior written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
||||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
||||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
Julian Seward, Cambridge, UK.
|
|
||||||
[email protected]
|
|
||||||
bzip2/libbzip2 version 1.0 of 21 March 2000
|
|
||||||
|
|
||||||
This program is based on (at least) the work of:
|
|
||||||
Mike Burrows
|
|
||||||
David Wheeler
|
|
||||||
Peter Fenwick
|
|
||||||
Alistair Moffat
|
|
||||||
Radford Neal
|
|
||||||
Ian H. Witten
|
|
||||||
Robert Sedgewick
|
|
||||||
Jon L. Bentley
|
|
||||||
|
|
||||||
For more information on these sources, see the manual.
|
|
||||||
--*/
|
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------*/
|
/* Place a 1 beside your platform, and 0 elsewhere.
|
||||||
/*--- IMPORTANT ---*/
|
Generic 32-bit Unix.
|
||||||
/*----------------------------------------------------*/
|
Also works on 64-bit Unix boxes.
|
||||||
|
This is the default.
|
||||||
/*--
|
*/
|
||||||
WARNING:
|
|
||||||
This program and library (attempts to) compress data by
|
|
||||||
performing several non-trivial transformations on it.
|
|
||||||
Unless you are 100% familiar with *all* the algorithms
|
|
||||||
contained herein, and with the consequences of modifying them,
|
|
||||||
you should NOT meddle with the compression or decompression
|
|
||||||
machinery. Incorrect changes can and very likely *will*
|
|
||||||
lead to disasterous loss of data.
|
|
||||||
|
|
||||||
DISCLAIMER:
|
|
||||||
I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE
|
|
||||||
USE OF THIS PROGRAM, HOWSOEVER CAUSED.
|
|
||||||
|
|
||||||
Every compression of a file implies an assumption that the
|
|
||||||
compressed file can be decompressed to reproduce the original.
|
|
||||||
Great efforts in design, coding and testing have been made to
|
|
||||||
ensure that this program works correctly. However, the
|
|
||||||
complexity of the algorithms, and, in particular, the presence
|
|
||||||
of various special cases in the code which occur with very low
|
|
||||||
but non-zero probability make it impossible to rule out the
|
|
||||||
possibility of bugs remaining in the program. DO NOT COMPRESS
|
|
||||||
ANY DATA WITH THIS PROGRAM AND/OR LIBRARY UNLESS YOU ARE PREPARED
|
|
||||||
TO ACCEPT THE POSSIBILITY, HOWEVER SMALL, THAT THE DATA WILL
|
|
||||||
NOT BE RECOVERABLE.
|
|
||||||
|
|
||||||
That is not to say this program is inherently unreliable.
|
|
||||||
Indeed, I very much hope the opposite is true. bzip2/libbzip2
|
|
||||||
has been carefully constructed and extensively tested.
|
|
||||||
|
|
||||||
PATENTS:
|
|
||||||
To the best of my knowledge, bzip2/libbzip2 does not use any
|
|
||||||
patented algorithms. However, I do not have the resources
|
|
||||||
available to carry out a full patent search. Therefore I cannot
|
|
||||||
give any guarantee of the above statement.
|
|
||||||
--*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------*/
|
|
||||||
/*--- and now for something much more pleasant :-) ---*/
|
|
||||||
/*----------------------------------------------------*/
|
|
||||||
|
|
||||||
/*---------------------------------------------*/
|
|
||||||
/*--
|
|
||||||
Place a 1 beside your platform, and 0 elsewhere.
|
|
||||||
--*/
|
|
||||||
|
|
||||||
/*--
|
|
||||||
Generic 32-bit Unix.
|
|
||||||
Also works on 64-bit Unix boxes.
|
|
||||||
This is the default.
|
|
||||||
--*/
|
|
||||||
#define BZ_UNIX 1
|
#define BZ_UNIX 1
|
||||||
|
|
||||||
/*--
|
/*--
|
||||||
@@ -302,16 +210,17 @@ Char progNameReally[FILE_NAME_LEN];
|
|||||||
FILE *outputHandleJustInCase;
|
FILE *outputHandleJustInCase;
|
||||||
Int32 workFactor;
|
Int32 workFactor;
|
||||||
|
|
||||||
static void panic ( Char* ) NORETURN;
|
static void panic ( const Char* ) NORETURN;
|
||||||
static void ioError ( void ) NORETURN;
|
static void ioError ( void ) NORETURN;
|
||||||
static void outOfMemory ( void ) NORETURN;
|
static void outOfMemory ( void ) NORETURN;
|
||||||
static void configError ( void ) NORETURN;
|
static void configError ( void ) NORETURN;
|
||||||
static void crcError ( void ) NORETURN;
|
static void crcError ( void ) NORETURN;
|
||||||
static void cleanUpAndFail ( Int32 ) NORETURN;
|
static void cleanUpAndFail ( Int32 ) NORETURN;
|
||||||
static void compressedStreamEOF ( void ) NORETURN;
|
static void compressedStreamEOF ( void ) NORETURN;
|
||||||
|
|
||||||
static void copyFileName ( Char*, Char* );
|
static void copyFileName ( Char*, Char* );
|
||||||
static void* myMalloc ( Int32 );
|
static void* myMalloc ( Int32 );
|
||||||
|
static void applySavedFileAttrToOutputFile ( IntNative fd );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -457,6 +366,9 @@ void compressStream ( FILE *stream, FILE *zStream )
|
|||||||
ret = fflush ( zStream );
|
ret = fflush ( zStream );
|
||||||
if (ret == EOF) goto errhandler_io;
|
if (ret == EOF) goto errhandler_io;
|
||||||
if (zStream != stdout) {
|
if (zStream != stdout) {
|
||||||
|
Int32 fd = fileno ( zStream );
|
||||||
|
if (fd < 0) goto errhandler_io;
|
||||||
|
applySavedFileAttrToOutputFile ( fd );
|
||||||
ret = fclose ( zStream );
|
ret = fclose ( zStream );
|
||||||
outputHandleJustInCase = NULL;
|
outputHandleJustInCase = NULL;
|
||||||
if (ret == EOF) goto errhandler_io;
|
if (ret == EOF) goto errhandler_io;
|
||||||
@@ -569,6 +481,11 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
|
|||||||
|
|
||||||
closeok:
|
closeok:
|
||||||
if (ferror(zStream)) goto errhandler_io;
|
if (ferror(zStream)) goto errhandler_io;
|
||||||
|
if (stream != stdout) {
|
||||||
|
Int32 fd = fileno ( stream );
|
||||||
|
if (fd < 0) goto errhandler_io;
|
||||||
|
applySavedFileAttrToOutputFile ( fd );
|
||||||
|
}
|
||||||
ret = fclose ( zStream );
|
ret = fclose ( zStream );
|
||||||
if (ret == EOF) goto errhandler_io;
|
if (ret == EOF) goto errhandler_io;
|
||||||
|
|
||||||
@@ -826,7 +743,7 @@ void cleanUpAndFail ( Int32 ec )
|
|||||||
|
|
||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
static
|
static
|
||||||
void panic ( Char* s )
|
void panic ( const Char* s )
|
||||||
{
|
{
|
||||||
fprintf ( stderr,
|
fprintf ( stderr,
|
||||||
"\n%s: PANIC -- internal consistency error:\n"
|
"\n%s: PANIC -- internal consistency error:\n"
|
||||||
@@ -1039,6 +956,7 @@ Bool fileExists ( Char* name )
|
|||||||
For non-Unix platforms, if we are not worrying about
|
For non-Unix platforms, if we are not worrying about
|
||||||
security issues, simple this simply behaves like fopen.
|
security issues, simple this simply behaves like fopen.
|
||||||
*/
|
*/
|
||||||
|
static
|
||||||
FILE* fopen_output_safely ( Char* name, const char* mode )
|
FILE* fopen_output_safely ( Char* name, const char* mode )
|
||||||
{
|
{
|
||||||
# if BZ_UNIX
|
# if BZ_UNIX
|
||||||
@@ -1129,7 +1047,7 @@ void saveInputFileMetaInfo ( Char *srcName )
|
|||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void applySavedMetaInfoToOutputFile ( Char *dstName )
|
void applySavedTimeInfoToOutputFile ( Char *dstName )
|
||||||
{
|
{
|
||||||
# if BZ_UNIX
|
# if BZ_UNIX
|
||||||
IntNative retVal;
|
IntNative retVal;
|
||||||
@@ -1138,13 +1056,21 @@ void applySavedMetaInfoToOutputFile ( Char *dstName )
|
|||||||
uTimBuf.actime = fileMetaInfo.st_atime;
|
uTimBuf.actime = fileMetaInfo.st_atime;
|
||||||
uTimBuf.modtime = fileMetaInfo.st_mtime;
|
uTimBuf.modtime = fileMetaInfo.st_mtime;
|
||||||
|
|
||||||
retVal = chmod ( dstName, fileMetaInfo.st_mode );
|
|
||||||
ERROR_IF_NOT_ZERO ( retVal );
|
|
||||||
|
|
||||||
retVal = utime ( dstName, &uTimBuf );
|
retVal = utime ( dstName, &uTimBuf );
|
||||||
ERROR_IF_NOT_ZERO ( retVal );
|
ERROR_IF_NOT_ZERO ( retVal );
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
retVal = chown ( dstName, fileMetaInfo.st_uid, fileMetaInfo.st_gid );
|
static
|
||||||
|
void applySavedFileAttrToOutputFile ( IntNative fd )
|
||||||
|
{
|
||||||
|
# if BZ_UNIX
|
||||||
|
IntNative retVal;
|
||||||
|
|
||||||
|
retVal = fchmod ( fd, fileMetaInfo.st_mode );
|
||||||
|
ERROR_IF_NOT_ZERO ( retVal );
|
||||||
|
|
||||||
|
(void) fchown ( fd, fileMetaInfo.st_uid, fileMetaInfo.st_gid );
|
||||||
/* chown() will in many cases return with EPERM, which can
|
/* chown() will in many cases return with EPERM, which can
|
||||||
be safely ignored.
|
be safely ignored.
|
||||||
*/
|
*/
|
||||||
@@ -1175,13 +1101,13 @@ Bool containsDubiousChars ( Char* name )
|
|||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
#define BZ_N_SUFFIX_PAIRS 4
|
#define BZ_N_SUFFIX_PAIRS 4
|
||||||
|
|
||||||
Char* zSuffix[BZ_N_SUFFIX_PAIRS]
|
const Char* zSuffix[BZ_N_SUFFIX_PAIRS]
|
||||||
= { ".bz2", ".bz", ".tbz2", ".tbz" };
|
= { ".bz2", ".bz", ".tbz2", ".tbz" };
|
||||||
Char* unzSuffix[BZ_N_SUFFIX_PAIRS]
|
const Char* unzSuffix[BZ_N_SUFFIX_PAIRS]
|
||||||
= { "", "", ".tar", ".tar" };
|
= { "", "", ".tar", ".tar" };
|
||||||
|
|
||||||
static
|
static
|
||||||
Bool hasSuffix ( Char* s, Char* suffix )
|
Bool hasSuffix ( Char* s, const Char* suffix )
|
||||||
{
|
{
|
||||||
Int32 ns = strlen(s);
|
Int32 ns = strlen(s);
|
||||||
Int32 nx = strlen(suffix);
|
Int32 nx = strlen(suffix);
|
||||||
@@ -1192,7 +1118,8 @@ Bool hasSuffix ( Char* s, Char* suffix )
|
|||||||
|
|
||||||
static
|
static
|
||||||
Bool mapSuffix ( Char* name,
|
Bool mapSuffix ( Char* name,
|
||||||
Char* oldSuffix, Char* newSuffix )
|
const Char* oldSuffix,
|
||||||
|
const Char* newSuffix )
|
||||||
{
|
{
|
||||||
if (!hasSuffix(name,oldSuffix)) return False;
|
if (!hasSuffix(name,oldSuffix)) return False;
|
||||||
name[strlen(name)-strlen(oldSuffix)] = 0;
|
name[strlen(name)-strlen(oldSuffix)] = 0;
|
||||||
@@ -1217,8 +1144,8 @@ void compress ( Char *name )
|
|||||||
|
|
||||||
switch (srcMode) {
|
switch (srcMode) {
|
||||||
case SM_I2O:
|
case SM_I2O:
|
||||||
copyFileName ( inName, "(stdin)" );
|
copyFileName ( inName, (Char*)"(stdin)" );
|
||||||
copyFileName ( outName, "(stdout)" );
|
copyFileName ( outName, (Char*)"(stdout)" );
|
||||||
break;
|
break;
|
||||||
case SM_F2F:
|
case SM_F2F:
|
||||||
copyFileName ( inName, name );
|
copyFileName ( inName, name );
|
||||||
@@ -1227,7 +1154,7 @@ void compress ( Char *name )
|
|||||||
break;
|
break;
|
||||||
case SM_F2O:
|
case SM_F2O:
|
||||||
copyFileName ( inName, name );
|
copyFileName ( inName, name );
|
||||||
copyFileName ( outName, "(stdout)" );
|
copyFileName ( outName, (Char*)"(stdout)" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1370,7 +1297,7 @@ void compress ( Char *name )
|
|||||||
|
|
||||||
/*--- If there was an I/O error, we won't get here. ---*/
|
/*--- If there was an I/O error, we won't get here. ---*/
|
||||||
if ( srcMode == SM_F2F ) {
|
if ( srcMode == SM_F2F ) {
|
||||||
applySavedMetaInfoToOutputFile ( outName );
|
applySavedTimeInfoToOutputFile ( outName );
|
||||||
deleteOutputOnInterrupt = False;
|
deleteOutputOnInterrupt = False;
|
||||||
if ( !keepInputFiles ) {
|
if ( !keepInputFiles ) {
|
||||||
IntNative retVal = remove ( inName );
|
IntNative retVal = remove ( inName );
|
||||||
@@ -1401,8 +1328,8 @@ void uncompress ( Char *name )
|
|||||||
cantGuess = False;
|
cantGuess = False;
|
||||||
switch (srcMode) {
|
switch (srcMode) {
|
||||||
case SM_I2O:
|
case SM_I2O:
|
||||||
copyFileName ( inName, "(stdin)" );
|
copyFileName ( inName, (Char*)"(stdin)" );
|
||||||
copyFileName ( outName, "(stdout)" );
|
copyFileName ( outName, (Char*)"(stdout)" );
|
||||||
break;
|
break;
|
||||||
case SM_F2F:
|
case SM_F2F:
|
||||||
copyFileName ( inName, name );
|
copyFileName ( inName, name );
|
||||||
@@ -1415,7 +1342,7 @@ void uncompress ( Char *name )
|
|||||||
break;
|
break;
|
||||||
case SM_F2O:
|
case SM_F2O:
|
||||||
copyFileName ( inName, name );
|
copyFileName ( inName, name );
|
||||||
copyFileName ( outName, "(stdout)" );
|
copyFileName ( outName, (Char*)"(stdout)" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1548,7 +1475,7 @@ void uncompress ( Char *name )
|
|||||||
/*--- If there was an I/O error, we won't get here. ---*/
|
/*--- If there was an I/O error, we won't get here. ---*/
|
||||||
if ( magicNumberOK ) {
|
if ( magicNumberOK ) {
|
||||||
if ( srcMode == SM_F2F ) {
|
if ( srcMode == SM_F2F ) {
|
||||||
applySavedMetaInfoToOutputFile ( outName );
|
applySavedTimeInfoToOutputFile ( outName );
|
||||||
deleteOutputOnInterrupt = False;
|
deleteOutputOnInterrupt = False;
|
||||||
if ( !keepInputFiles ) {
|
if ( !keepInputFiles ) {
|
||||||
IntNative retVal = remove ( inName );
|
IntNative retVal = remove ( inName );
|
||||||
@@ -1593,9 +1520,9 @@ void testf ( Char *name )
|
|||||||
if (name == NULL && srcMode != SM_I2O)
|
if (name == NULL && srcMode != SM_I2O)
|
||||||
panic ( "testf: bad modes\n" );
|
panic ( "testf: bad modes\n" );
|
||||||
|
|
||||||
copyFileName ( outName, "(none)" );
|
copyFileName ( outName, (Char*)"(none)" );
|
||||||
switch (srcMode) {
|
switch (srcMode) {
|
||||||
case SM_I2O: copyFileName ( inName, "(stdin)" ); break;
|
case SM_I2O: copyFileName ( inName, (Char*)"(stdin)" ); break;
|
||||||
case SM_F2F: copyFileName ( inName, name ); break;
|
case SM_F2F: copyFileName ( inName, name ); break;
|
||||||
case SM_F2O: copyFileName ( inName, name ); break;
|
case SM_F2O: copyFileName ( inName, name ); break;
|
||||||
}
|
}
|
||||||
@@ -1678,11 +1605,11 @@ void license ( void )
|
|||||||
"bzip2, a block-sorting file compressor. "
|
"bzip2, a block-sorting file compressor. "
|
||||||
"Version %s.\n"
|
"Version %s.\n"
|
||||||
" \n"
|
" \n"
|
||||||
" Copyright (C) 1996-2005 by Julian Seward.\n"
|
" Copyright (C) 1996-2006 by Julian Seward.\n"
|
||||||
" \n"
|
" \n"
|
||||||
" This program is free software; you can redistribute it and/or modify\n"
|
" This program is free software; you can redistribute it and/or modify\n"
|
||||||
" it under the terms set out in the LICENSE file, which is included\n"
|
" it under the terms set out in the LICENSE file, which is included\n"
|
||||||
" in the bzip2-1.0 source distribution.\n"
|
" in the bzip2-1.0.4 source distribution.\n"
|
||||||
" \n"
|
" \n"
|
||||||
" This program is distributed in the hope that it will be useful,\n"
|
" This program is distributed in the hope that it will be useful,\n"
|
||||||
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||||||
@@ -1885,8 +1812,8 @@ IntNative main ( IntNative argc, Char *argv[] )
|
|||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
copyFileName ( inName, "(none)" );
|
copyFileName ( inName, (Char*)"(none)" );
|
||||||
copyFileName ( outName, "(none)" );
|
copyFileName ( outName, (Char*)"(none)" );
|
||||||
|
|
||||||
copyFileName ( progNameReally, argv[0] );
|
copyFileName ( progNameReally, argv[0] );
|
||||||
progName = &progNameReally[0];
|
progName = &progNameReally[0];
|
||||||
@@ -1898,8 +1825,8 @@ IntNative main ( IntNative argc, Char *argv[] )
|
|||||||
expand filename wildcards in arg list.
|
expand filename wildcards in arg list.
|
||||||
--*/
|
--*/
|
||||||
argList = NULL;
|
argList = NULL;
|
||||||
addFlagsFromEnvVar ( &argList, "BZIP2" );
|
addFlagsFromEnvVar ( &argList, (Char*)"BZIP2" );
|
||||||
addFlagsFromEnvVar ( &argList, "BZIP" );
|
addFlagsFromEnvVar ( &argList, (Char*)"BZIP" );
|
||||||
for (i = 1; i <= argc-1; i++)
|
for (i = 1; i <= argc-1; i++)
|
||||||
APPEND_FILESPEC(argList, argv[i]);
|
APPEND_FILESPEC(argList, argv[i]);
|
||||||
|
|
||||||
|
|||||||
@@ -1,56 +1,24 @@
|
|||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
/*--- Block recoverer program for bzip2 ---*/
|
/*--- Block recoverer program for bzip2 ---*/
|
||||||
/*--- bzip2recover.c ---*/
|
/*--- bzip2recover.c ---*/
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*--
|
/* ------------------------------------------------------------------
|
||||||
This program is bzip2recover, a program to attempt data
|
This file is part of bzip2/libbzip2, a program and library for
|
||||||
salvage from damaged files created by the accompanying
|
lossless, block-sorting data compression.
|
||||||
bzip2-1.0.3 program.
|
|
||||||
|
|
||||||
Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
|
bzip2/libbzip2 version 1.0.4 of 20 December 2006
|
||||||
|
Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||||
modification, are permitted provided that the following conditions
|
README file.
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
This program is released under the terms of the license contained
|
||||||
notice, this list of conditions and the following disclaimer.
|
in the file LICENSE.
|
||||||
|
------------------------------------------------------------------ */
|
||||||
|
|
||||||
2. The origin of this software must not be misrepresented; you must
|
/* This program is a complete hack and should be rewritten properly.
|
||||||
not claim that you wrote the original software. If you use this
|
It isn't very complicated. */
|
||||||
software in a product, an acknowledgment in the product
|
|
||||||
documentation would be appreciated but is not required.
|
|
||||||
|
|
||||||
3. Altered source versions must be plainly marked as such, and must
|
|
||||||
not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
4. The name of the author may not be used to endorse or promote
|
|
||||||
products derived from this software without specific prior written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
||||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
||||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
Julian Seward, Cambridge, UK.
|
|
||||||
jseward@bzip.org
|
|
||||||
bzip2/libbzip2 version 1.0.3 of 15 February 2005
|
|
||||||
--*/
|
|
||||||
|
|
||||||
/*--
|
|
||||||
This program is a complete hack and should be rewritten
|
|
||||||
properly. It isn't very complicated.
|
|
||||||
--*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -114,7 +82,7 @@ MaybeUInt64 bytesIn = 0;
|
|||||||
/*---------------------------------------------------*/
|
/*---------------------------------------------------*/
|
||||||
|
|
||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
void readError ( void )
|
static void readError ( void )
|
||||||
{
|
{
|
||||||
fprintf ( stderr,
|
fprintf ( stderr,
|
||||||
"%s: I/O error reading `%s', possible reason follows.\n",
|
"%s: I/O error reading `%s', possible reason follows.\n",
|
||||||
@@ -127,7 +95,7 @@ void readError ( void )
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
void writeError ( void )
|
static void writeError ( void )
|
||||||
{
|
{
|
||||||
fprintf ( stderr,
|
fprintf ( stderr,
|
||||||
"%s: I/O error reading `%s', possible reason follows.\n",
|
"%s: I/O error reading `%s', possible reason follows.\n",
|
||||||
@@ -140,7 +108,7 @@ void writeError ( void )
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
void mallocFail ( Int32 n )
|
static void mallocFail ( Int32 n )
|
||||||
{
|
{
|
||||||
fprintf ( stderr,
|
fprintf ( stderr,
|
||||||
"%s: malloc failed on request for %d bytes.\n",
|
"%s: malloc failed on request for %d bytes.\n",
|
||||||
@@ -152,7 +120,7 @@ void mallocFail ( Int32 n )
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
void tooManyBlocks ( Int32 max_handled_blocks )
|
static void tooManyBlocks ( Int32 max_handled_blocks )
|
||||||
{
|
{
|
||||||
fprintf ( stderr,
|
fprintf ( stderr,
|
||||||
"%s: `%s' appears to contain more than %d blocks\n",
|
"%s: `%s' appears to contain more than %d blocks\n",
|
||||||
@@ -183,7 +151,7 @@ typedef
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
BitStream* bsOpenReadStream ( FILE* stream )
|
static BitStream* bsOpenReadStream ( FILE* stream )
|
||||||
{
|
{
|
||||||
BitStream *bs = malloc ( sizeof(BitStream) );
|
BitStream *bs = malloc ( sizeof(BitStream) );
|
||||||
if (bs == NULL) mallocFail ( sizeof(BitStream) );
|
if (bs == NULL) mallocFail ( sizeof(BitStream) );
|
||||||
@@ -196,7 +164,7 @@ BitStream* bsOpenReadStream ( FILE* stream )
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
BitStream* bsOpenWriteStream ( FILE* stream )
|
static BitStream* bsOpenWriteStream ( FILE* stream )
|
||||||
{
|
{
|
||||||
BitStream *bs = malloc ( sizeof(BitStream) );
|
BitStream *bs = malloc ( sizeof(BitStream) );
|
||||||
if (bs == NULL) mallocFail ( sizeof(BitStream) );
|
if (bs == NULL) mallocFail ( sizeof(BitStream) );
|
||||||
@@ -209,7 +177,7 @@ BitStream* bsOpenWriteStream ( FILE* stream )
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
void bsPutBit ( BitStream* bs, Int32 bit )
|
static void bsPutBit ( BitStream* bs, Int32 bit )
|
||||||
{
|
{
|
||||||
if (bs->buffLive == 8) {
|
if (bs->buffLive == 8) {
|
||||||
Int32 retVal = putc ( (UChar) bs->buffer, bs->handle );
|
Int32 retVal = putc ( (UChar) bs->buffer, bs->handle );
|
||||||
@@ -228,7 +196,7 @@ void bsPutBit ( BitStream* bs, Int32 bit )
|
|||||||
/*--
|
/*--
|
||||||
Returns 0 or 1, or 2 to indicate EOF.
|
Returns 0 or 1, or 2 to indicate EOF.
|
||||||
--*/
|
--*/
|
||||||
Int32 bsGetBit ( BitStream* bs )
|
static Int32 bsGetBit ( BitStream* bs )
|
||||||
{
|
{
|
||||||
if (bs->buffLive > 0) {
|
if (bs->buffLive > 0) {
|
||||||
bs->buffLive --;
|
bs->buffLive --;
|
||||||
@@ -247,7 +215,7 @@ Int32 bsGetBit ( BitStream* bs )
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
void bsClose ( BitStream* bs )
|
static void bsClose ( BitStream* bs )
|
||||||
{
|
{
|
||||||
Int32 retVal;
|
Int32 retVal;
|
||||||
|
|
||||||
@@ -271,7 +239,7 @@ void bsClose ( BitStream* bs )
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
void bsPutUChar ( BitStream* bs, UChar c )
|
static void bsPutUChar ( BitStream* bs, UChar c )
|
||||||
{
|
{
|
||||||
Int32 i;
|
Int32 i;
|
||||||
for (i = 7; i >= 0; i--)
|
for (i = 7; i >= 0; i--)
|
||||||
@@ -280,7 +248,7 @@ void bsPutUChar ( BitStream* bs, UChar c )
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
void bsPutUInt32 ( BitStream* bs, UInt32 c )
|
static void bsPutUInt32 ( BitStream* bs, UInt32 c )
|
||||||
{
|
{
|
||||||
Int32 i;
|
Int32 i;
|
||||||
|
|
||||||
@@ -290,7 +258,7 @@ void bsPutUInt32 ( BitStream* bs, UInt32 c )
|
|||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------*/
|
/*---------------------------------------------*/
|
||||||
Bool endsInBz2 ( Char* name )
|
static Bool endsInBz2 ( Char* name )
|
||||||
{
|
{
|
||||||
Int32 n = strlen ( name );
|
Int32 n = strlen ( name );
|
||||||
if (n <= 4) return False;
|
if (n <= 4) return False;
|
||||||
@@ -345,7 +313,7 @@ Int32 main ( Int32 argc, Char** argv )
|
|||||||
inFileName[0] = outFileName[0] = 0;
|
inFileName[0] = outFileName[0] = 0;
|
||||||
|
|
||||||
fprintf ( stderr,
|
fprintf ( stderr,
|
||||||
"bzip2recover 1.0.3: extracts blocks from damaged .bz2 files.\n" );
|
"bzip2recover 1.0.4: extracts blocks from damaged .bz2 files.\n" );
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n",
|
fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n",
|
||||||
|
|||||||
+23
-68
@@ -4,74 +4,29 @@
|
|||||||
/*--- bzlib.c ---*/
|
/*--- bzlib.c ---*/
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
||||||
/*--
|
/* ------------------------------------------------------------------
|
||||||
This file is a part of bzip2 and/or libbzip2, a program and
|
This file is part of bzip2/libbzip2, a program and library for
|
||||||
library for lossless, block-sorting data compression.
|
lossless, block-sorting data compression.
|
||||||
|
|
||||||
Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
|
bzip2/libbzip2 version 1.0.4 of 20 December 2006
|
||||||
|
Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||||
modification, are permitted provided that the following conditions
|
README file.
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
This program is released under the terms of the license contained
|
||||||
notice, this list of conditions and the following disclaimer.
|
in the file LICENSE.
|
||||||
|
------------------------------------------------------------------ */
|
||||||
2. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product
|
|
||||||
documentation would be appreciated but is not required.
|
|
||||||
|
|
||||||
3. Altered source versions must be plainly marked as such, and must
|
|
||||||
not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
4. The name of the author may not be used to endorse or promote
|
|
||||||
products derived from this software without specific prior written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
||||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
||||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
Julian Seward, Cambridge, UK.
|
|
||||||
jseward@bzip.org
|
|
||||||
bzip2/libbzip2 version 1.0 of 21 March 2000
|
|
||||||
|
|
||||||
This program is based on (at least) the work of:
|
|
||||||
Mike Burrows
|
|
||||||
David Wheeler
|
|
||||||
Peter Fenwick
|
|
||||||
Alistair Moffat
|
|
||||||
Radford Neal
|
|
||||||
Ian H. Witten
|
|
||||||
Robert Sedgewick
|
|
||||||
Jon L. Bentley
|
|
||||||
|
|
||||||
For more information on these sources, see the manual.
|
|
||||||
--*/
|
|
||||||
|
|
||||||
/*--
|
|
||||||
CHANGES
|
|
||||||
~~~~~~~
|
|
||||||
0.9.0 -- original version.
|
|
||||||
|
|
||||||
|
/* CHANGES
|
||||||
|
0.9.0 -- original version.
|
||||||
0.9.0a/b -- no changes in this file.
|
0.9.0a/b -- no changes in this file.
|
||||||
|
0.9.0c -- made zero-length BZ_FLUSH work correctly in bzCompress().
|
||||||
0.9.0c
|
fixed bzWrite/bzRead to ignore zero-length requests.
|
||||||
* made zero-length BZ_FLUSH work correctly in bzCompress().
|
fixed bzread to correctly handle read requests after EOF.
|
||||||
* fixed bzWrite/bzRead to ignore zero-length requests.
|
wrong parameter order in call to bzDecompressInit in
|
||||||
* fixed bzread to correctly handle read requests after EOF.
|
bzBuffToBuffDecompress. Fixed.
|
||||||
* wrong parameter order in call to bzDecompressInit in
|
*/
|
||||||
bzBuffToBuffDecompress. Fixed.
|
|
||||||
--*/
|
|
||||||
|
|
||||||
#include "bzlib_private.h"
|
#include "bzlib_private.h"
|
||||||
|
|
||||||
@@ -1394,8 +1349,7 @@ int BZ_API(BZ2_bzBuffToBuffDecompress)
|
|||||||
|
|
||||||
/*---------------------------------------------------*/
|
/*---------------------------------------------------*/
|
||||||
/*--
|
/*--
|
||||||
Code contributed by Yoshioka Tsuneo
|
Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
|
||||||
(QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
|
|
||||||
to support better zlib compatibility.
|
to support better zlib compatibility.
|
||||||
This code is not _officially_ part of libbzip2 (yet);
|
This code is not _officially_ part of libbzip2 (yet);
|
||||||
I haven't tested it, documented it, or considered the
|
I haven't tested it, documented it, or considered the
|
||||||
@@ -1406,7 +1360,7 @@ int BZ_API(BZ2_bzBuffToBuffDecompress)
|
|||||||
|
|
||||||
/*---------------------------------------------------*/
|
/*---------------------------------------------------*/
|
||||||
/*--
|
/*--
|
||||||
return version like "0.9.0c".
|
return version like "0.9.5d, 4-Sept-1999".
|
||||||
--*/
|
--*/
|
||||||
const char * BZ_API(BZ2_bzlibVersion)(void)
|
const char * BZ_API(BZ2_bzlibVersion)(void)
|
||||||
{
|
{
|
||||||
@@ -1559,9 +1513,10 @@ int BZ_API(BZ2_bzflush) (BZFILE *b)
|
|||||||
void BZ_API(BZ2_bzclose) (BZFILE* b)
|
void BZ_API(BZ2_bzclose) (BZFILE* b)
|
||||||
{
|
{
|
||||||
int bzerr;
|
int bzerr;
|
||||||
FILE *fp = ((bzFile *)b)->handle;
|
FILE *fp;
|
||||||
|
|
||||||
if (b==NULL) {return;}
|
if (b==NULL) {return;}
|
||||||
|
fp = ((bzFile *)b)->handle;
|
||||||
if(((bzFile*)b)->writing){
|
if(((bzFile*)b)->writing){
|
||||||
BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL);
|
BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL);
|
||||||
if(bzerr != BZ_OK){
|
if(bzerr != BZ_OK){
|
||||||
@@ -1580,7 +1535,7 @@ void BZ_API(BZ2_bzclose) (BZFILE* b)
|
|||||||
/*--
|
/*--
|
||||||
return last error code
|
return last error code
|
||||||
--*/
|
--*/
|
||||||
static char *bzerrorstrings[] = {
|
static const char *bzerrorstrings[] = {
|
||||||
"OK"
|
"OK"
|
||||||
,"SEQUENCE_ERROR"
|
,"SEQUENCE_ERROR"
|
||||||
,"PARAM_ERROR"
|
,"PARAM_ERROR"
|
||||||
|
|||||||
+11
-52
@@ -4,59 +4,19 @@
|
|||||||
/*--- bzlib.h ---*/
|
/*--- bzlib.h ---*/
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
||||||
/*--
|
/* ------------------------------------------------------------------
|
||||||
This file is a part of bzip2 and/or libbzip2, a program and
|
This file is part of bzip2/libbzip2, a program and library for
|
||||||
library for lossless, block-sorting data compression.
|
lossless, block-sorting data compression.
|
||||||
|
|
||||||
Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
|
bzip2/libbzip2 version 1.0.4 of 20 December 2006
|
||||||
|
Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||||
modification, are permitted provided that the following conditions
|
README file.
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
This program is released under the terms of the license contained
|
||||||
notice, this list of conditions and the following disclaimer.
|
in the file LICENSE.
|
||||||
|
------------------------------------------------------------------ */
|
||||||
2. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product
|
|
||||||
documentation would be appreciated but is not required.
|
|
||||||
|
|
||||||
3. Altered source versions must be plainly marked as such, and must
|
|
||||||
not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
4. The name of the author may not be used to endorse or promote
|
|
||||||
products derived from this software without specific prior written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
||||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
||||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
Julian Seward, Cambridge, UK.
|
|
||||||
jseward@bzip.org
|
|
||||||
bzip2/libbzip2 version 1.0 of 21 March 2000
|
|
||||||
|
|
||||||
This program is based on (at least) the work of:
|
|
||||||
Mike Burrows
|
|
||||||
David Wheeler
|
|
||||||
Peter Fenwick
|
|
||||||
Alistair Moffat
|
|
||||||
Radford Neal
|
|
||||||
Ian H. Witten
|
|
||||||
Robert Sedgewick
|
|
||||||
Jon L. Bentley
|
|
||||||
|
|
||||||
For more information on these sources, see the manual.
|
|
||||||
--*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _BZLIB_H
|
#ifndef _BZLIB_H
|
||||||
@@ -262,8 +222,7 @@ BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
|
|||||||
|
|
||||||
|
|
||||||
/*--
|
/*--
|
||||||
Code contributed by Yoshioka Tsuneo
|
Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
|
||||||
(QWF00133@niftyserve.or.jp/tsuneo-y@is.aist-nara.ac.jp),
|
|
||||||
to support better zlib compatibility.
|
to support better zlib compatibility.
|
||||||
This code is not _officially_ part of libbzip2 (yet);
|
This code is not _officially_ part of libbzip2 (yet);
|
||||||
I haven't tested it, documented it, or considered the
|
I haven't tested it, documented it, or considered the
|
||||||
|
|||||||
@@ -4,59 +4,19 @@
|
|||||||
/*--- bzlib_private.h ---*/
|
/*--- bzlib_private.h ---*/
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
||||||
/*--
|
/* ------------------------------------------------------------------
|
||||||
This file is a part of bzip2 and/or libbzip2, a program and
|
This file is part of bzip2/libbzip2, a program and library for
|
||||||
library for lossless, block-sorting data compression.
|
lossless, block-sorting data compression.
|
||||||
|
|
||||||
Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
|
bzip2/libbzip2 version 1.0.4 of 20 December 2006
|
||||||
|
Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||||
modification, are permitted provided that the following conditions
|
README file.
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
This program is released under the terms of the license contained
|
||||||
notice, this list of conditions and the following disclaimer.
|
in the file LICENSE.
|
||||||
|
------------------------------------------------------------------ */
|
||||||
2. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product
|
|
||||||
documentation would be appreciated but is not required.
|
|
||||||
|
|
||||||
3. Altered source versions must be plainly marked as such, and must
|
|
||||||
not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
4. The name of the author may not be used to endorse or promote
|
|
||||||
products derived from this software without specific prior written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
||||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
||||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
Julian Seward, Cambridge, UK.
|
|
||||||
jseward@bzip.org
|
|
||||||
bzip2/libbzip2 version 1.0 of 21 March 2000
|
|
||||||
|
|
||||||
This program is based on (at least) the work of:
|
|
||||||
Mike Burrows
|
|
||||||
David Wheeler
|
|
||||||
Peter Fenwick
|
|
||||||
Alistair Moffat
|
|
||||||
Radford Neal
|
|
||||||
Ian H. Witten
|
|
||||||
Robert Sedgewick
|
|
||||||
Jon L. Bentley
|
|
||||||
|
|
||||||
For more information on these sources, see the manual.
|
|
||||||
--*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _BZLIB_PRIVATE_H
|
#ifndef _BZLIB_PRIVATE_H
|
||||||
@@ -76,7 +36,7 @@
|
|||||||
|
|
||||||
/*-- General stuff. --*/
|
/*-- General stuff. --*/
|
||||||
|
|
||||||
#define BZ_VERSION "1.0.3, 15-Feb-2005"
|
#define BZ_VERSION "1.0.4, 20-Dec-2006"
|
||||||
|
|
||||||
typedef char Char;
|
typedef char Char;
|
||||||
typedef unsigned char Bool;
|
typedef unsigned char Bool;
|
||||||
@@ -94,9 +54,11 @@ typedef unsigned short UInt16;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef BZ_NO_STDIO
|
#ifndef BZ_NO_STDIO
|
||||||
|
|
||||||
extern void BZ2_bz__AssertH__fail ( int errcode );
|
extern void BZ2_bz__AssertH__fail ( int errcode );
|
||||||
#define AssertH(cond,errcode) \
|
#define AssertH(cond,errcode) \
|
||||||
{ if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); }
|
{ if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); }
|
||||||
|
|
||||||
#if BZ_DEBUG
|
#if BZ_DEBUG
|
||||||
#define AssertD(cond,msg) \
|
#define AssertD(cond,msg) \
|
||||||
{ if (!(cond)) { \
|
{ if (!(cond)) { \
|
||||||
@@ -107,6 +69,7 @@ extern void BZ2_bz__AssertH__fail ( int errcode );
|
|||||||
#else
|
#else
|
||||||
#define AssertD(cond,msg) /* */
|
#define AssertD(cond,msg) /* */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VPrintf0(zf) \
|
#define VPrintf0(zf) \
|
||||||
fprintf(stderr,zf)
|
fprintf(stderr,zf)
|
||||||
#define VPrintf1(zf,za1) \
|
#define VPrintf1(zf,za1) \
|
||||||
@@ -119,17 +82,20 @@ extern void BZ2_bz__AssertH__fail ( int errcode );
|
|||||||
fprintf(stderr,zf,za1,za2,za3,za4)
|
fprintf(stderr,zf,za1,za2,za3,za4)
|
||||||
#define VPrintf5(zf,za1,za2,za3,za4,za5) \
|
#define VPrintf5(zf,za1,za2,za3,za4,za5) \
|
||||||
fprintf(stderr,zf,za1,za2,za3,za4,za5)
|
fprintf(stderr,zf,za1,za2,za3,za4,za5)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
extern void bz_internal_error ( int errcode );
|
extern void bz_internal_error ( int errcode );
|
||||||
#define AssertH(cond,errcode) \
|
#define AssertH(cond,errcode) \
|
||||||
{ if (!(cond)) bz_internal_error ( errcode ); }
|
{ if (!(cond)) bz_internal_error ( errcode ); }
|
||||||
#define AssertD(cond,msg) /* */
|
#define AssertD(cond,msg) do { } while (0)
|
||||||
#define VPrintf0(zf) /* */
|
#define VPrintf0(zf) do { } while (0)
|
||||||
#define VPrintf1(zf,za1) /* */
|
#define VPrintf1(zf,za1) do { } while (0)
|
||||||
#define VPrintf2(zf,za1,za2) /* */
|
#define VPrintf2(zf,za1,za2) do { } while (0)
|
||||||
#define VPrintf3(zf,za1,za2,za3) /* */
|
#define VPrintf3(zf,za1,za2,za3) do { } while (0)
|
||||||
#define VPrintf4(zf,za1,za2,za3,za4) /* */
|
#define VPrintf4(zf,za1,za2,za3,za4) do { } while (0)
|
||||||
#define VPrintf5(zf,za1,za2,za3,za4,za5) /* */
|
#define VPrintf5(zf,za1,za2,za3,za4,za5) do { } while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+16
-60
@@ -4,71 +4,27 @@
|
|||||||
/*--- compress.c ---*/
|
/*--- compress.c ---*/
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
||||||
/*--
|
/* ------------------------------------------------------------------
|
||||||
This file is a part of bzip2 and/or libbzip2, a program and
|
This file is part of bzip2/libbzip2, a program and library for
|
||||||
library for lossless, block-sorting data compression.
|
lossless, block-sorting data compression.
|
||||||
|
|
||||||
Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
|
bzip2/libbzip2 version 1.0.4 of 20 December 2006
|
||||||
|
Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||||
modification, are permitted provided that the following conditions
|
README file.
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
This program is released under the terms of the license contained
|
||||||
notice, this list of conditions and the following disclaimer.
|
in the file LICENSE.
|
||||||
|
------------------------------------------------------------------ */
|
||||||
|
|
||||||
2. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product
|
|
||||||
documentation would be appreciated but is not required.
|
|
||||||
|
|
||||||
3. Altered source versions must be plainly marked as such, and must
|
/* CHANGES
|
||||||
not be misrepresented as being the original software.
|
0.9.0 -- original version.
|
||||||
|
0.9.0a/b -- no changes in this file.
|
||||||
4. The name of the author may not be used to endorse or promote
|
0.9.0c -- changed setting of nGroups in sendMTFValues()
|
||||||
products derived from this software without specific prior written
|
so as to do a bit better on small files
|
||||||
permission.
|
*/
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
||||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
||||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
Julian Seward, Cambridge, UK.
|
|
||||||
jseward@bzip.org
|
|
||||||
bzip2/libbzip2 version 1.0 of 21 March 2000
|
|
||||||
|
|
||||||
This program is based on (at least) the work of:
|
|
||||||
Mike Burrows
|
|
||||||
David Wheeler
|
|
||||||
Peter Fenwick
|
|
||||||
Alistair Moffat
|
|
||||||
Radford Neal
|
|
||||||
Ian H. Witten
|
|
||||||
Robert Sedgewick
|
|
||||||
Jon L. Bentley
|
|
||||||
|
|
||||||
For more information on these sources, see the manual.
|
|
||||||
--*/
|
|
||||||
|
|
||||||
/*--
|
|
||||||
CHANGES
|
|
||||||
~~~~~~~
|
|
||||||
0.9.0 -- original version.
|
|
||||||
|
|
||||||
0.9.0a/b -- no changes in this file.
|
|
||||||
|
|
||||||
0.9.0c
|
|
||||||
* changed setting of nGroups in sendMTFValues() so as to
|
|
||||||
do a bit better on small files
|
|
||||||
--*/
|
|
||||||
|
|
||||||
#include "bzlib_private.h"
|
#include "bzlib_private.h"
|
||||||
|
|
||||||
|
|||||||
+10
-50
@@ -4,59 +4,19 @@
|
|||||||
/*--- crctable.c ---*/
|
/*--- crctable.c ---*/
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
||||||
/*--
|
/* ------------------------------------------------------------------
|
||||||
This file is a part of bzip2 and/or libbzip2, a program and
|
This file is part of bzip2/libbzip2, a program and library for
|
||||||
library for lossless, block-sorting data compression.
|
lossless, block-sorting data compression.
|
||||||
|
|
||||||
Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
|
bzip2/libbzip2 version 1.0.4 of 20 December 2006
|
||||||
|
Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||||
modification, are permitted provided that the following conditions
|
README file.
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
This program is released under the terms of the license contained
|
||||||
notice, this list of conditions and the following disclaimer.
|
in the file LICENSE.
|
||||||
|
------------------------------------------------------------------ */
|
||||||
2. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product
|
|
||||||
documentation would be appreciated but is not required.
|
|
||||||
|
|
||||||
3. Altered source versions must be plainly marked as such, and must
|
|
||||||
not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
4. The name of the author may not be used to endorse or promote
|
|
||||||
products derived from this software without specific prior written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
||||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
||||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
Julian Seward, Cambridge, UK.
|
|
||||||
jseward@bzip.org
|
|
||||||
bzip2/libbzip2 version 1.0 of 21 March 2000
|
|
||||||
|
|
||||||
This program is based on (at least) the work of:
|
|
||||||
Mike Burrows
|
|
||||||
David Wheeler
|
|
||||||
Peter Fenwick
|
|
||||||
Alistair Moffat
|
|
||||||
Radford Neal
|
|
||||||
Ian H. Witten
|
|
||||||
Robert Sedgewick
|
|
||||||
Jon L. Bentley
|
|
||||||
|
|
||||||
For more information on these sources, see the manual.
|
|
||||||
--*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "bzlib_private.h"
|
#include "bzlib_private.h"
|
||||||
|
|||||||
+10
-50
@@ -4,59 +4,19 @@
|
|||||||
/*--- decompress.c ---*/
|
/*--- decompress.c ---*/
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
||||||
/*--
|
/* ------------------------------------------------------------------
|
||||||
This file is a part of bzip2 and/or libbzip2, a program and
|
This file is part of bzip2/libbzip2, a program and library for
|
||||||
library for lossless, block-sorting data compression.
|
lossless, block-sorting data compression.
|
||||||
|
|
||||||
Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
|
bzip2/libbzip2 version 1.0.4 of 20 December 2006
|
||||||
|
Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||||
modification, are permitted provided that the following conditions
|
README file.
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
This program is released under the terms of the license contained
|
||||||
notice, this list of conditions and the following disclaimer.
|
in the file LICENSE.
|
||||||
|
------------------------------------------------------------------ */
|
||||||
2. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product
|
|
||||||
documentation would be appreciated but is not required.
|
|
||||||
|
|
||||||
3. Altered source versions must be plainly marked as such, and must
|
|
||||||
not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
4. The name of the author may not be used to endorse or promote
|
|
||||||
products derived from this software without specific prior written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
||||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
||||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
Julian Seward, Cambridge, UK.
|
|
||||||
jseward@bzip.org
|
|
||||||
bzip2/libbzip2 version 1.0 of 21 March 2000
|
|
||||||
|
|
||||||
This program is based on (at least) the work of:
|
|
||||||
Mike Burrows
|
|
||||||
David Wheeler
|
|
||||||
Peter Fenwick
|
|
||||||
Alistair Moffat
|
|
||||||
Radford Neal
|
|
||||||
Ian H. Witten
|
|
||||||
Robert Sedgewick
|
|
||||||
Jon L. Bentley
|
|
||||||
|
|
||||||
For more information on these sources, see the manual.
|
|
||||||
--*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "bzlib_private.h"
|
#include "bzlib_private.h"
|
||||||
|
|||||||
+10
-50
@@ -4,59 +4,19 @@
|
|||||||
/*--- huffman.c ---*/
|
/*--- huffman.c ---*/
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
||||||
/*--
|
/* ------------------------------------------------------------------
|
||||||
This file is a part of bzip2 and/or libbzip2, a program and
|
This file is part of bzip2/libbzip2, a program and library for
|
||||||
library for lossless, block-sorting data compression.
|
lossless, block-sorting data compression.
|
||||||
|
|
||||||
Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
|
bzip2/libbzip2 version 1.0.4 of 20 December 2006
|
||||||
|
Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||||
modification, are permitted provided that the following conditions
|
README file.
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
This program is released under the terms of the license contained
|
||||||
notice, this list of conditions and the following disclaimer.
|
in the file LICENSE.
|
||||||
|
------------------------------------------------------------------ */
|
||||||
2. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product
|
|
||||||
documentation would be appreciated but is not required.
|
|
||||||
|
|
||||||
3. Altered source versions must be plainly marked as such, and must
|
|
||||||
not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
4. The name of the author may not be used to endorse or promote
|
|
||||||
products derived from this software without specific prior written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
||||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
||||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
Julian Seward, Cambridge, UK.
|
|
||||||
jseward@bzip.org
|
|
||||||
bzip2/libbzip2 version 1.0 of 21 March 2000
|
|
||||||
|
|
||||||
This program is based on (at least) the work of:
|
|
||||||
Mike Burrows
|
|
||||||
David Wheeler
|
|
||||||
Peter Fenwick
|
|
||||||
Alistair Moffat
|
|
||||||
Radford Neal
|
|
||||||
Ian H. Witten
|
|
||||||
Robert Sedgewick
|
|
||||||
Jon L. Bentley
|
|
||||||
|
|
||||||
For more information on these sources, see the manual.
|
|
||||||
--*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "bzlib_private.h"
|
#include "bzlib_private.h"
|
||||||
|
|||||||
+10
-50
@@ -4,59 +4,19 @@
|
|||||||
/*--- randtable.c ---*/
|
/*--- randtable.c ---*/
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
||||||
/*--
|
/* ------------------------------------------------------------------
|
||||||
This file is a part of bzip2 and/or libbzip2, a program and
|
This file is part of bzip2/libbzip2, a program and library for
|
||||||
library for lossless, block-sorting data compression.
|
lossless, block-sorting data compression.
|
||||||
|
|
||||||
Copyright (C) 1996-2005 Julian R Seward. All rights reserved.
|
bzip2/libbzip2 version 1.0.4 of 20 December 2006
|
||||||
|
Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||||
modification, are permitted provided that the following conditions
|
README file.
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
This program is released under the terms of the license contained
|
||||||
notice, this list of conditions and the following disclaimer.
|
in the file LICENSE.
|
||||||
|
------------------------------------------------------------------ */
|
||||||
2. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product
|
|
||||||
documentation would be appreciated but is not required.
|
|
||||||
|
|
||||||
3. Altered source versions must be plainly marked as such, and must
|
|
||||||
not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
4. The name of the author may not be used to endorse or promote
|
|
||||||
products derived from this software without specific prior written
|
|
||||||
permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
||||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
||||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
||||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
||||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
Julian Seward, Cambridge, UK.
|
|
||||||
jseward@bzip.org
|
|
||||||
bzip2/libbzip2 version 1.0 of 21 March 2000
|
|
||||||
|
|
||||||
This program is based on (at least) the work of:
|
|
||||||
Mike Burrows
|
|
||||||
David Wheeler
|
|
||||||
Peter Fenwick
|
|
||||||
Alistair Moffat
|
|
||||||
Radford Neal
|
|
||||||
Ian H. Witten
|
|
||||||
Robert Sedgewick
|
|
||||||
Jon L. Bentley
|
|
||||||
|
|
||||||
For more information on these sources, see the manual.
|
|
||||||
--*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "bzlib_private.h"
|
#include "bzlib_private.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user