Revert whitespace fixes to third_party (#501)

This commit is contained in:
Jared Miller 2022-07-22 00:46:07 -04:00 committed by GitHub
parent d4000bb8f7
commit 9de3d8f1e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
365 changed files with 39190 additions and 39211 deletions

View file

@ -5,7 +5,7 @@
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
This program is released under the terms of the license contained
@ -20,7 +20,7 @@ First version.
0.9.0a
~~~~~~
Removed 'ranlib' from Makefile, since most modern Unix-es
Removed 'ranlib' from Makefile, since most modern Unix-es
don't need it, or even know about it.
@ -52,7 +52,7 @@ In bzlib.c:
bzBuffToBuffDecompress. Fixed.
In compress.c:
* changed setting of nGroups in sendMTFValues() so as to
* changed setting of nGroups in sendMTFValues() so as to
do a bit better on small files. This _does_ effect
bzip2.c.
@ -117,7 +117,7 @@ changes are minor documentation changes.
Several minor bugfixes and enhancements:
* Large file support. The library uses 64-bit counters to
count the volume of data passing through it. bzip2.c
count the volume of data passing through it. bzip2.c
is now compiled with -D_FILE_OFFSET_BITS=64 to get large
file support from the C library. -v correctly prints out
file sizes greater than 4 gigabytes. All these changes have
@ -128,7 +128,7 @@ Several minor bugfixes and enhancements:
* Decompression robustness. The library/program should be
robust to any corruption of compressed data, detecting and
handling _all_ corruption, instead of merely relying on
the CRCs. What this means is that the program should
the CRCs. What this means is that the program should
never crash, given corrupted data, and the library should
always return BZ_DATA_ERROR.
@ -140,13 +140,13 @@ Several minor bugfixes and enhancements:
* Don't run out of file handles on test/decompression when
large numbers of files have invalid magic numbers.
* Avoid library namespace pollution. Prefix all exported
* Avoid library namespace pollution. Prefix all exported
symbols with BZ2_.
* Minor sorting enhancements from my DCC2000 paper.
* Advance the version number to 1.0, so as to counteract the
(false-in-this-case) impression some people have that programs
(false-in-this-case) impression some people have that programs
with version numbers less than 1.0 are in some way, experimental,
pre-release versions.
@ -156,10 +156,10 @@ Several minor bugfixes and enhancements:
* Make the program exit with 2 instead of 0 when decompression
fails due to a bad magic number (ie, an invalid bzip2 header).
Also exit with 1 (as the manual claims :-) whenever a diagnostic
message would have been printed AND the corresponding operation
message would have been printed AND the corresponding operation
is aborted, for example
bzip2: Output file xx already exists.
When a diagnostic message is printed but the operation is not
When a diagnostic message is printed but the operation is not
aborted, for example
bzip2: Can't guess original name for wurble -- using wurble.out
then the exit value 0 is returned, unless some other problem is
@ -272,7 +272,7 @@ Fixes some minor bugs since the last version, 1.0.2.
* Further robustification against corrupted compressed data.
There are currently no known bitstreams which can cause the
decompressor to crash, loop or access memory which does not
belong to it. If you are using bzip2 or the library to
belong to it. If you are using bzip2 or the library to
decompress bitstreams from untrusted sources, an upgrade
to 1.0.3 is recommended. This fixes CAN-2005-1260.

View file

@ -12,16 +12,16 @@ are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
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
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
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

View file

@ -79,7 +79,7 @@ unmodified with MS Visual C. If you have difficulties building, you
might want to read README.COMPILATION.PROBLEMS.
At least using MS Visual C++ 6, you can build from the unmodified
sources by issuing, in a command shell:
sources by issuing, in a command shell:
nmake -f makefile.msc
@ -103,12 +103,12 @@ Please read and be aware of the following:
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*
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 disastrous loss of data.
@ -128,16 +128,16 @@ DISCLAIMER:
PROGRAM 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
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
to carry out a patent search. Therefore I cannot give any
To the best of my knowledge, bzip2/libbzip2 does not use any
patented algorithms. However, I do not have the resources
to carry out a patent search. Therefore I cannot give any
guarantee of the above statement.

View file

@ -12,7 +12,7 @@
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
This program is released under the terms of the license contained
@ -30,11 +30,11 @@
/*---------------------------------------------*/
/*---------------------------------------------*/
static
static
__inline__
void fallbackSimpleSort ( UInt32* fmap,
UInt32* eclass,
Int32 lo,
void fallbackSimpleSort ( UInt32* fmap,
UInt32* eclass,
Int32 lo,
Int32 hi )
{
Int32 i, j, tmp;
@ -93,9 +93,9 @@ void fallbackSimpleSort ( UInt32* fmap,
static
void fallbackQSort3 ( UInt32* fmap,
void fallbackQSort3 ( UInt32* fmap,
UInt32* eclass,
Int32 loSt,
Int32 loSt,
Int32 hiSt )
{
Int32 unLo, unHi, ltLo, gtHi, n, m;
@ -120,9 +120,9 @@ void fallbackQSort3 ( UInt32* fmap,
}
/* Random partitioning. Median of 3 sometimes fails to
avoid bad cases. Median of 9 seems to help but
avoid bad cases. Median of 9 seems to help but
looks rather expensive. This too seems to work but
is cheaper. Guidance for the magic constants
is cheaper. Guidance for the magic constants
7621 and 32768 is taken from Sedgewick's algorithms
book, chapter 35.
*/
@ -139,10 +139,10 @@ void fallbackQSort3 ( UInt32* fmap,
while (1) {
if (unLo > unHi) break;
n = (Int32)eclass[fmap[unLo]] - (Int32)med;
if (n == 0) {
fswap(fmap[unLo], fmap[ltLo]);
ltLo++; unLo++;
continue;
if (n == 0) {
fswap(fmap[unLo], fmap[ltLo]);
ltLo++; unLo++;
continue;
};
if (n > 0) break;
unLo++;
@ -150,10 +150,10 @@ void fallbackQSort3 ( UInt32* fmap,
while (1) {
if (unLo > unHi) break;
n = (Int32)eclass[fmap[unHi]] - (Int32)med;
if (n == 0) {
fswap(fmap[unHi], fmap[gtHi]);
gtHi--; unHi--;
continue;
if (n == 0) {
fswap(fmap[unHi], fmap[gtHi]);
gtHi--; unHi--;
continue;
};
if (n < 0) break;
unHi--;
@ -212,8 +212,8 @@ void fallbackQSort3 ( UInt32* fmap,
#define UNALIGNED_BH(zz) ((zz) & 0x01f)
static
void fallbackSort ( UInt32* fmap,
UInt32* eclass,
void fallbackSort ( UInt32* fmap,
UInt32* eclass,
UInt32* bhtab,
Int32 nblock,
Int32 verb )
@ -254,7 +254,7 @@ void fallbackSort ( UInt32* fmap,
--*/
/*-- set sentinel bits for block-end detection --*/
for (i = 0; i < 32; i++) {
for (i = 0; i < 32; i++) {
SET_BH(nblock + 2*i);
CLEAR_BH(nblock + 2*i + 1);
}
@ -263,7 +263,7 @@ void fallbackSort ( UInt32* fmap,
H = 1;
while (1) {
if (verb >= 4)
if (verb >= 4)
VPrintf1 ( " depth %6d has ", H );
j = 0;
@ -308,14 +308,14 @@ void fallbackSort ( UInt32* fmap,
}
}
if (verb >= 4)
if (verb >= 4)
VPrintf1 ( "%6d unresolved strings\n", nNotDone );
H *= 2;
if (H > nblock || nNotDone == 0) break;
}
/*--
/*--
Reconstruct the original block in
eclass8 [0 .. nblock-1], since the
previous phase destroyed it.
@ -347,9 +347,9 @@ void fallbackSort ( UInt32* fmap,
/*---------------------------------------------*/
static
__inline__
Bool mainGtU ( UInt32 i1,
Bool mainGtU ( UInt32 i1,
UInt32 i2,
UChar* block,
UChar* block,
UInt16* quadrant,
UInt32 nblock,
Int32* budget )
@ -489,8 +489,8 @@ void mainSimpleSort ( UInt32* ptr,
UChar* block,
UInt16* quadrant,
Int32 nblock,
Int32 lo,
Int32 hi,
Int32 lo,
Int32 hi,
Int32 d,
Int32* budget )
{
@ -514,8 +514,8 @@ void mainSimpleSort ( UInt32* ptr,
if (i > hi) break;
v = ptr[i];
j = i;
while ( mainGtU (
ptr[j-h]+d, v+d, block, quadrant, nblock, budget
while ( mainGtU (
ptr[j-h]+d, v+d, block, quadrant, nblock, budget
) ) {
ptr[j] = ptr[j-h];
j = j - h;
@ -528,8 +528,8 @@ void mainSimpleSort ( UInt32* ptr,
if (i > hi) break;
v = ptr[i];
j = i;
while ( mainGtU (
ptr[j-h]+d, v+d, block, quadrant, nblock, budget
while ( mainGtU (
ptr[j-h]+d, v+d, block, quadrant, nblock, budget
) ) {
ptr[j] = ptr[j-h];
j = j - h;
@ -542,8 +542,8 @@ void mainSimpleSort ( UInt32* ptr,
if (i > hi) break;
v = ptr[i];
j = i;
while ( mainGtU (
ptr[j-h]+d, v+d, block, quadrant, nblock, budget
while ( mainGtU (
ptr[j-h]+d, v+d, block, quadrant, nblock, budget
) ) {
ptr[j] = ptr[j-h];
j = j - h;
@ -581,13 +581,13 @@ void mainSimpleSort ( UInt32* ptr,
} \
}
static
static
__inline__
UChar mmed3 ( UChar a, UChar b, UChar c )
{
UChar t;
if (a > b) { t = a; a = b; b = t; };
if (b > c) {
if (b > c) {
b = c;
if (a > b) b = a;
}
@ -625,8 +625,8 @@ void mainQSort3 ( UInt32* ptr,
UChar* block,
UInt16* quadrant,
Int32 nblock,
Int32 loSt,
Int32 hiSt,
Int32 loSt,
Int32 hiSt,
Int32 dSt,
Int32* budget )
{
@ -649,14 +649,14 @@ void mainQSort3 ( UInt32* ptr,
AssertH ( sp < MAIN_QSORT_STACK_SIZE - 2, 1001 );
mpop ( lo, hi, d );
if (hi - lo < MAIN_QSORT_SMALL_THRESH ||
if (hi - lo < MAIN_QSORT_SMALL_THRESH ||
d > MAIN_QSORT_DEPTH_THRESH) {
mainSimpleSort ( ptr, block, quadrant, nblock, lo, hi, d, budget );
if (*budget < 0) return;
continue;
}
med = (Int32)
med = (Int32)
mmed3 ( block[ptr[ lo ]+d],
block[ptr[ hi ]+d],
block[ptr[ (lo+hi)>>1 ]+d] );
@ -668,9 +668,9 @@ void mainQSort3 ( UInt32* ptr,
while (True) {
if (unLo > unHi) break;
n = ((Int32)block[ptr[unLo]+d]) - med;
if (n == 0) {
mswap(ptr[unLo], ptr[ltLo]);
ltLo++; unLo++; continue;
if (n == 0) {
mswap(ptr[unLo], ptr[ltLo]);
ltLo++; unLo++; continue;
};
if (n > 0) break;
unLo++;
@ -678,9 +678,9 @@ void mainQSort3 ( UInt32* ptr,
while (True) {
if (unLo > unHi) break;
n = ((Int32)block[ptr[unHi]+d]) - med;
if (n == 0) {
mswap(ptr[unHi], ptr[gtHi]);
gtHi--; unHi--; continue;
if (n == 0) {
mswap(ptr[unHi], ptr[gtHi]);
gtHi--; unHi--; continue;
};
if (n < 0) break;
unHi--;
@ -751,9 +751,9 @@ void mainQSort3 ( UInt32* ptr,
#define CLEARMASK (~(SETMASK))
static
void mainSort ( UInt32* ptr,
void mainSort ( UInt32* ptr,
UChar* block,
UInt16* quadrant,
UInt16* quadrant,
UInt32* ftab,
Int32 nblock,
Int32 verb,
@ -881,7 +881,7 @@ void mainSort ( UInt32* ptr,
/*--
Step 1:
Complete the big bucket [ss] by quicksorting
any unsorted small buckets [ss, j], for j != ss.
any unsorted small buckets [ss, j], for j != ss.
Hopefully previous pointer-scanning phases have already
completed many of the small buckets [ss, j], so
we don't have to sort them at all.
@ -897,10 +897,10 @@ void mainSort ( UInt32* ptr,
VPrintf4 ( " qsort [0x%x, 0x%x] "
"done %d this %d\n",
ss, j, numQSorted, hi - lo + 1 );
mainQSort3 (
ptr, block, quadrant, nblock,
lo, hi, BZ_N_RADIX, budget
);
mainQSort3 (
ptr, block, quadrant, nblock,
lo, hi, BZ_N_RADIX, budget
);
numQSorted += (hi - lo + 1);
if (*budget < 0) return;
}
@ -932,16 +932,16 @@ void mainSort ( UInt32* ptr,
for (j = (ftab[(ss+1) << 8] & CLEARMASK) - 1; j > copyEnd[ss]; j--) {
k = ptr[j]-1; if (k < 0) k += nblock;
c1 = block[k];
if (!bigDone[c1])
if (!bigDone[c1])
ptr[ copyEnd[c1]-- ] = k;
}
}
AssertH ( (copyStart[ss]-1 == copyEnd[ss])
||
||
/* Extremely rare case missing in bzip2-1.0.0 and 1.0.1.
Necessity for this case is demonstrated by compressing
a sequence of approximately 48.5 million of character
Necessity for this case is demonstrated by compressing
a sequence of approximately 48.5 million of character
251; 1.0.0/1.0.1 will then die here. */
(copyStart[ss] == 0 && copyEnd[ss] == nblock-1),
1007 )
@ -958,7 +958,7 @@ void mainSort ( UInt32* ptr,
updating for the last bucket is pointless.
The quadrant array provides a way to incrementally
cache sort orderings, as they appear, so as to
cache sort orderings, as they appear, so as to
make subsequent comparisons in fullGtU() complete
faster. For repetitive blocks this makes a big
difference (but not big enough to be able to avoid
@ -968,9 +968,9 @@ void mainSort ( UInt32* ptr,
for 0 <= i < nblock and 0 <= j <= nblock
if block[i] != block[j],
if block[i] != block[j],
then the relative values of quadrant[i] and
then the relative values of quadrant[i] and
quadrant[j] are meaningless.
else {
@ -1033,7 +1033,7 @@ void mainSort ( UInt32* ptr,
*/
void BZ2_blockSort ( EState* s )
{
UInt32* ptr = s->ptr;
UInt32* ptr = s->ptr;
UChar* block = s->block;
UInt32* ftab = s->ftab;
Int32 nblock = s->nblock;
@ -1057,8 +1057,8 @@ void BZ2_blockSort ( EState* s )
quadrant = (UInt16*)(&(block[i]));
/* (wfact-1) / 3 puts the default-factor-30
transition point at very roughly the same place as
with v0.1 and v0.9.0.
transition point at very roughly the same place as
with v0.1 and v0.9.0.
Not that it particularly matters any more, since the
resulting compressed stream is now the same regardless
of whether or not we use the main sort or fallback sort.
@ -1069,14 +1069,14 @@ void BZ2_blockSort ( EState* s )
budget = budgetInit;
mainSort ( ptr, block, quadrant, ftab, nblock, verb, &budget );
if (verb >= 3)
if (verb >= 3)
VPrintf3 ( " %d work, %d block, ratio %5.2f\n",
budgetInit - budget,
nblock,
nblock,
(float)(budgetInit - budget) /
(float)(nblock==0 ? 1 : nblock) );
(float)(nblock==0 ? 1 : nblock) );
if (budget < 0) {
if (verb >= 2)
if (verb >= 2)
VPrintf0 ( " too repetitive; using fallback"
" sorting algorithm\n" );
fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb );

View file

@ -1,7 +1,7 @@
#!/bin/sh
# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh
# Bzcmp/diff wrapped for bzip2,
# Bzcmp/diff wrapped for bzip2,
# adapted from zdiff by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
# Bzcmp and bzdiff are used to invoke the cmp or the diff pro-

View file

@ -13,7 +13,7 @@ bzcmp, bzdiff \- compare bzip2 compressed files
[ file2 ]
.SH DESCRIPTION
.I Bzcmp
and
and
.I bzdiff
are used to invoke the
.I cmp
@ -32,7 +32,7 @@ If two files are specified, then they are uncompressed if necessary and fed to
.I cmp
or
.IR diff "."
The exit status from
The exit status from
.I cmp
or
.I diff

View file

@ -1,6 +1,6 @@
#!/bin/sh
# Bzgrep wrapped for bzip2,
# Bzgrep wrapped for bzip2,
# adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
## zgrep notice:
## zgrep -- a wrapper around a grep program that decompresses files as needed

View file

@ -18,13 +18,13 @@ bzip2recover \- recovers data from damaged bzip2 files
.br
.B bunzip2
.RB [ " \-fkvsVL " ]
[
[
.I "filenames \&..."
]
.br
.B bzcat
.RB [ " \-s " ]
[
[
.I "filenames \&..."
]
.br
@ -39,15 +39,15 @@ generally considerably better than that achieved by more conventional
LZ77/LZ78-based compressors, and approaches the performance of the PPM
family of statistical compressors.
The command-line options are deliberately very similar to
those of
.I GNU gzip,
The command-line options are deliberately very similar to
those of
.I GNU gzip,
but they are not identical.
.I bzip2
expects a list of file names to accompany the
command-line flags. Each file is replaced by a compressed version of
itself, with the name "original_name.bz2".
itself, with the name "original_name.bz2".
Each compressed file
has the same modification date, permissions, and, when possible,
ownership as the corresponding original, so that these properties can
@ -74,13 +74,13 @@ incomprehensible and therefore pointless.
.I bunzip2
(or
.I bzip2 \-d)
.I bzip2 \-d)
decompresses all
specified files. Files which were not created by
specified files. Files which were not created by
.I bzip2
will be detected and ignored, and a warning issued.
will be detected and ignored, and a warning issued.
.I bzip2
attempts to guess the filename for the decompressed file
attempts to guess the filename for the decompressed file
from that of the compressed file as follows:
filename.bz2 becomes filename
@ -89,13 +89,13 @@ from that of the compressed file as follows:
filename.tbz becomes filename.tar
anyothername becomes anyothername.out
If the file does not end in one of the recognised endings,
.I .bz2,
.I .bz,
If the file does not end in one of the recognised endings,
.I .bz2,
.I .bz,
.I .tbz2
or
.I .tbz,
.I bzip2
.I .tbz,
.I bzip2
complains that it cannot
guess the name of the original file, and uses the original name
with
@ -103,25 +103,25 @@ with
appended.
As with compression, supplying no
filenames causes decompression from
filenames causes decompression from
standard input to standard output.
.I bunzip2
.I bunzip2
will correctly decompress a file which is the
concatenation of two or more compressed files. The result is the
concatenation of the corresponding uncompressed files. Integrity
testing (\-t)
of concatenated
testing (\-t)
of concatenated
compressed files is also supported.
You can also compress or decompress files to the standard output by
giving the \-c flag. Multiple files may be compressed and
decompressed like this. The resulting outputs are fed sequentially to
stdout. Compression of multiple files
stdout. Compression of multiple files
in this manner generates a stream
containing multiple compressed file representations. Such a stream
can be decompressed correctly only by
.I bzip2
.I bzip2
version 0.9.0 or
later. Earlier versions of
.I bzip2
@ -130,7 +130,7 @@ the first file in the stream.
.I bzcat
(or
.I bzip2 -dc)
.I bzip2 -dc)
decompresses all specified files to
the standard output.
@ -140,10 +140,10 @@ will read arguments from the environment variables
and
.I BZIP,
in that order, and will process them
before any arguments read from the command line. This gives a
before any arguments read from the command line. This gives a
convenient way to supply default arguments.
Compression is always performed, even if the compressed
Compression is always performed, even if the compressed
file is slightly
larger than the original. Files of less than about one hundred bytes
tend to get larger, since the compression mechanism has a constant
@ -151,8 +151,8 @@ overhead in the region of 50 bytes. Random data (including the output
of most file compressors) is coded at about 8.05 bits per byte, giving
an expansion of around 0.5%.
As a self-check for your protection,
.I
As a self-check for your protection,
.I
bzip2
uses 32-bit CRCs to
make sure that the decompressed version of a file is identical to the
@ -163,9 +163,9 @@ against undetected bugs in
chances of data corruption going undetected is microscopic, about one
chance in four billion for each file processed. Be aware, though, that
the check occurs upon decompression, so it can only tell you that
something is wrong. It can't help you
something is wrong. It can't help you
recover the original uncompressed
data. You can use
data. You can use
.I bzip2recover
to try to recover data from
damaged files.
@ -183,15 +183,15 @@ to panic.
Compress or decompress to standard output.
.TP
.B \-d --decompress
Force decompression.
.I bzip2,
.I bunzip2
Force decompression.
.I bzip2,
.I bunzip2
and
.I bzcat
.I bzcat
are
really the same program, and the decision about what actions to take is
done on the basis of which name is used. This flag overrides that
mechanism, and forces
mechanism, and forces
.I bzip2
to decompress.
.TP
@ -205,10 +205,10 @@ This really performs a trial decompression and throws away the result.
.TP
.B \-f --force
Force overwrite of output files. Normally,
.I bzip2
.I bzip2
will not overwrite
existing output files. Also forces
.I bzip2
existing output files. Also forces
.I bzip2
to break hard links
to files, which it otherwise wouldn't do.
@ -246,9 +246,9 @@ Display the software version, license terms and conditions.
.B \-1 (or \-\-fast) to \-9 (or \-\-best)
Set the block size to 100 k, 200 k .. 900 k when compressing. Has no
effect when decompressing. See MEMORY MANAGEMENT below.
The \-\-fast and \-\-best aliases are primarily for GNU gzip
The \-\-fast and \-\-best aliases are primarily for GNU gzip
compatibility. In particular, \-\-fast doesn't make things
significantly faster.
significantly faster.
And \-\-best merely selects the default behaviour.
.TP
.B \--
@ -263,7 +263,7 @@ earlier versions, which was sometimes useful. 0.9.5 and above have an
improved algorithm which renders these flags irrelevant.
.SH MEMORY MANAGEMENT
.I bzip2
.I bzip2
compresses large files in blocks. The block size affects
both the compression ratio achieved, and the amount of memory needed for
compression and decompression. The flags \-1 through \-9
@ -276,7 +276,7 @@ the file. Since block sizes are stored in compressed files, it follows
that the flags \-1 to \-9 are irrelevant to and so ignored
during decompression.
Compression and decompression requirements,
Compression and decompression requirements,
in bytes, can be estimated as:
Compression: 400k + ( 8 x block size )
@ -295,7 +295,7 @@ requirement is set at compression time by the choice of block size.
For files compressed with the default 900k block size,
.I bunzip2
will require about 3700 kbytes to decompress. To support decompression
of any file on a 4 megabyte machine,
of any file on a 4 megabyte machine,
.I bunzip2
has an option to
decompress using approximately half this amount of memory, about 2300
@ -350,20 +350,20 @@ damaged blocks can be distinguished from undamaged ones.
.I bzip2recover
is a simple program whose purpose is to search for
blocks in .bz2 files, and write each block out into its own .bz2
blocks in .bz2 files, and write each block out into its own .bz2
file. You can then use
.I bzip2
.I bzip2
\-t
to test the
integrity of the resulting files, and decompress those which are
undamaged.
.I bzip2recover
takes a single argument, the name of the damaged file,
takes a single argument, the name of the damaged file,
and writes a number of files "rec00001file.bz2",
"rec00002file.bz2", etc, containing the extracted blocks.
The output filenames are designed so that the use of
wildcards in subsequent processing -- for example,
wildcards in subsequent processing -- for example,
"bzip2 -dc rec*file.bz2 > recovered_data" -- processes the files in
the correct order.
@ -371,8 +371,8 @@ the correct order.
should be of most use dealing with large .bz2
files, as these will contain many blocks. It is clearly
futile to use it on damaged single-block files, since a
damaged block cannot be recovered. If you wish to minimise
any potential data loss through media or transmission errors,
damaged block cannot be recovered. If you wish to minimise
any potential data loss through media or transmission errors,
you might consider compressing with a smaller
block size.
@ -395,7 +395,7 @@ that performance, both for compressing and decompressing, is largely
determined by the speed at which your machine can service cache misses.
Because of this, small changes to the code to reduce the miss rate have
been observed to give disproportionately large performance improvements.
I imagine
I imagine
.I bzip2
will perform best on machines with very large caches.
@ -406,7 +406,7 @@ tries hard to detect I/O errors and exit cleanly, but the details of
what the problem is sometimes seem rather misleading.
This manual page pertains to version 1.0.8 of
.I bzip2.
.I bzip2.
Compressed data created by this version is entirely forwards and
backwards compatible with the previous public releases, versions
0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and above, but with the following
@ -440,13 +440,13 @@ Fenwick (for the structured coding model in the original
.I bzip,
and many refinements), and Alistair Moffat, Radford Neal and Ian Witten
(for the arithmetic coder in the original
.I bzip).
.I bzip).
I am much
indebted for their help, support and advice. See the manual in the
source distribution for pointers to sources of documentation. Christian
von Roques encouraged me to look for faster sorting algorithms, so as to
speed up compression. Bela Lubkin encouraged me to improve the
worst-case compression performance.
worst-case compression performance.
Donna Robinson XMLised the documentation.
The bz* scripts are derived from those of GNU gzip.
Many people sent patches, helped

View file

@ -351,10 +351,10 @@ bzip2(1) bzip2(1)
This manual page pertains to version 1.0.8 of b̲z̲i̲p̲2̲.̲ Com-
pressed data created by this version is entirely forwards
and backwards compatible with the previous public
releases, versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1,
releases, versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1,
1.0.2 and above, but with the following exception: 0.9.0
and above can correctly decompress multiple concatenated
compressed files. 0.1pl2 cannot do this; it will stop
compressed files. 0.1pl2 cannot do this; it will stop
after decompressing just the first file in the stream.
b̲z̲i̲p̲2̲r̲e̲c̲o̲v̲e̲r̲ versions prior to 1.0.2 used 32-bit integers

View file

@ -27,7 +27,7 @@
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
This program is released under the terms of the license contained
@ -76,7 +76,7 @@ typedef int Int32;
typedef unsigned int UInt32;
typedef short Int16;
typedef unsigned short UInt16;
#define True ((Bool)1)
#define False ((Bool)0)
@ -141,7 +141,7 @@ static void applySavedFileAttrToOutputFile ( IntNative fd );
/*---------------------------------------------------*/
typedef
struct { UChar b[8]; }
struct { UChar b[8]; }
UInt64;
@ -184,7 +184,7 @@ Bool uInt64_isZero ( UInt64* n )
/* Divide *n by 10, and return the remainder. */
static
static
Int32 uInt64_qrm10 ( UInt64* n )
{
UInt32 rem, tmp;
@ -215,7 +215,7 @@ void uInt64_toAscii ( char* outbuf, UInt64* n )
nBuf++;
} while (!uInt64_isZero(&n_copy));
outbuf[nBuf] = 0;
for (i = 0; i < nBuf; i++)
for (i = 0; i < nBuf; i++)
outbuf[i] = buf[nBuf-i-1];
}
@ -225,7 +225,7 @@ void uInt64_toAscii ( char* outbuf, UInt64* n )
/*---------------------------------------------------*/
/*---------------------------------------------*/
static
static
Bool myfeof ( FILE* f )
{
Int32 c = fgetc ( f );
@ -236,7 +236,7 @@ Bool myfeof ( FILE* f )
/*---------------------------------------------*/
static
static
void compressStream ( FILE *stream, FILE *zStream )
{
BZFILE* bzf = NULL;
@ -252,8 +252,8 @@ void compressStream ( FILE *stream, FILE *zStream )
if (ferror(stream)) goto errhandler_io;
if (ferror(zStream)) goto errhandler_io;
bzf = BZ2_bzWriteOpen ( &bzerr, zStream,
blockSize100k, verbosity, workFactor );
bzf = BZ2_bzWriteOpen ( &bzerr, zStream,
blockSize100k, verbosity, workFactor );
if (bzerr != BZ_OK) goto errhandler;
if (verbosity >= 2) (fprintf) ( stderr, "\n" );
@ -268,7 +268,7 @@ void compressStream ( FILE *stream, FILE *zStream )
}
BZ2_bzWriteClose64 ( &bzerr, bzf, 0,
BZ2_bzWriteClose64 ( &bzerr, bzf, 0,
&nbytes_in_lo32, &nbytes_in_hi32,
&nbytes_out_lo32, &nbytes_out_hi32 );
if (bzerr != BZ_OK) goto errhandler;
@ -296,9 +296,9 @@ void compressStream ( FILE *stream, FILE *zStream )
Char buf_nin[32], buf_nout[32];
UInt64 nbytes_in, nbytes_out;
double nbytes_in_d, nbytes_out_d;
uInt64_from_UInt32s ( &nbytes_in,
uInt64_from_UInt32s ( &nbytes_in,
nbytes_in_lo32, nbytes_in_hi32 );
uInt64_from_UInt32s ( &nbytes_out,
uInt64_from_UInt32s ( &nbytes_out,
nbytes_out_lo32, nbytes_out_hi32 );
nbytes_in_d = uInt64_to_double ( &nbytes_in );
nbytes_out_d = uInt64_to_double ( &nbytes_out );
@ -318,7 +318,7 @@ void compressStream ( FILE *stream, FILE *zStream )
return;
errhandler:
BZ2_bzWriteClose64 ( &bzerr_dummy, bzf, 1,
BZ2_bzWriteClose64 ( &bzerr_dummy, bzf, 1,
&nbytes_in_lo32, &nbytes_in_hi32,
&nbytes_out_lo32, &nbytes_out_hi32 );
switch (bzerr) {
@ -340,7 +340,7 @@ void compressStream ( FILE *stream, FILE *zStream )
/*---------------------------------------------*/
static
static
Bool uncompressStream ( FILE *zStream, FILE *stream )
{
BZFILE* bzf = NULL;
@ -362,8 +362,8 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
while (True) {
bzf = BZ2_bzReadOpen (
&bzerr, zStream, verbosity,
bzf = BZ2_bzReadOpen (
&bzerr, zStream, verbosity,
(int)smallMode, unused, nUnused
);
if (bzf == NULL || bzerr != BZ_OK) goto errhandler;
@ -412,7 +412,7 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
if (verbosity >= 2) (fprintf) ( stderr, "\n " );
return True;
trycat:
trycat:
if (forceOverwrite) {
rewind(zStream);
while (True) {
@ -424,7 +424,7 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
}
goto closeok;
}
errhandler:
BZ2_bzReadClose ( &bzerr_dummy, bzf );
switch (bzerr) {
@ -446,10 +446,10 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
return False;
} else {
if (noisy)
(fprintf) ( stderr,
(fprintf) ( stderr,
"\n%s: %s: trailing garbage after EOF ignored\n",
progName, inName );
return True;
return True;
}
default:
panic ( "decompress:unexpected error" );
@ -461,7 +461,7 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
/*---------------------------------------------*/
static
static
Bool testStream ( FILE *zStream )
{
BZFILE* bzf = NULL;
@ -480,8 +480,8 @@ Bool testStream ( FILE *zStream )
while (True) {
bzf = BZ2_bzReadOpen (
&bzerr, zStream, verbosity,
bzf = BZ2_bzReadOpen (
&bzerr, zStream, verbosity,
(int)smallMode, unused, nUnused
);
if (bzf == NULL || bzerr != BZ_OK) goto errhandler;
@ -514,7 +514,7 @@ Bool testStream ( FILE *zStream )
errhandler:
BZ2_bzReadClose ( &bzerr_dummy, bzf );
if (verbosity == 0)
if (verbosity == 0)
(fprintf) ( stderr, "%s: %s: ", progName, inName );
switch (bzerr) {
case BZ_CONFIG_ERROR:
@ -535,14 +535,14 @@ Bool testStream ( FILE *zStream )
case BZ_DATA_ERROR_MAGIC:
if (zStream != stdin) fclose(zStream);
if (streamNo == 1) {
(fprintf) ( stderr,
(fprintf) ( stderr,
"bad magic number (file not created by bzip2)\n" );
return False;
} else {
if (noisy)
(fprintf) ( stderr,
(fprintf) ( stderr,
"trailing garbage after EOF ignored\n" );
return True;
return True;
}
default:
panic ( "test:unexpected error" );
@ -566,7 +566,7 @@ void setExit ( Int32 v )
/*---------------------------------------------*/
static
static
void cadvise ( void )
{
if (noisy)
@ -581,26 +581,26 @@ void cadvise ( void )
/*---------------------------------------------*/
static
static
void showFileNames ( void )
{
if (noisy)
(fprintf) (
stderr,
"\tInput file = %s, output file = %s\n",
inName, outName
inName, outName
);
}
/*---------------------------------------------*/
static
static
void cleanUpAndFail ( Int32 ec )
{
IntNative retVal;
struct MY_STAT statBuf;
if ( srcMode == SM_F2F
if ( srcMode == SM_F2F
&& opMode != OM_TEST
&& deleteOutputOnInterrupt ) {
@ -612,7 +612,7 @@ void cleanUpAndFail ( Int32 ec )
retVal = MY_STAT ( inName, &statBuf );
if (retVal == 0) {
if (noisy)
(fprintf) ( stderr,
(fprintf) ( stderr,
"%s: Deleting output file %s, if it exists.\n",
progName, outName );
if (outputHandleJustInCase != NULL)
@ -633,7 +633,7 @@ void cleanUpAndFail ( Int32 ec )
(fprintf) ( stderr,
"%s: `%s' may be incomplete.\n",
progName, outName );
(fprintf) ( stderr,
(fprintf) ( stderr,
"%s: I suggest doing an integrity test (bzip2 -tv)"
" of it.\n",
progName );
@ -641,7 +641,7 @@ void cleanUpAndFail ( Int32 ec )
}
if (noisy && numFileNames > 0 && numFilesProcessed < numFileNames) {
(fprintf) ( stderr,
(fprintf) ( stderr,
"%s: WARNING: some files have not been processed:\n"
"%s: %d specified on command line, %d not processed yet.\n\n",
progName, progName,
@ -653,7 +653,7 @@ void cleanUpAndFail ( Int32 ec )
/*---------------------------------------------*/
static
static
void panic ( const Char* s )
{
(fprintf) ( stderr,
@ -668,7 +668,7 @@ void panic ( const Char* s )
/*---------------------------------------------*/
static
static
void crcError ( void )
{
(fprintf) ( stderr,
@ -681,7 +681,7 @@ void crcError ( void )
/*---------------------------------------------*/
static
static
void compressedStreamEOF ( void )
{
if (noisy) {
@ -698,7 +698,7 @@ void compressedStreamEOF ( void )
/*---------------------------------------------*/
static
static
void ioError ( void )
{
(fprintf) ( stderr,
@ -712,7 +712,7 @@ void ioError ( void )
/*---------------------------------------------*/
static
static
void mySignalCatcher ( IntNative n )
{
(fprintf) ( stderr,
@ -723,11 +723,11 @@ void mySignalCatcher ( IntNative n )
/*---------------------------------------------*/
static
static
void mySIGSEGVorSIGBUScatcher ( IntNative n )
{
if (opMode == OM_Z)
(fprintf) (
(fprintf) (
stderr,
"\n%s: Caught a SIGSEGV or SIGBUS whilst compressing.\n"
"\n"
@ -748,7 +748,7 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n )
"\n",
progName );
else
(fprintf) (
(fprintf) (
stderr,
"\n%s: Caught a SIGSEGV or SIGBUS whilst decompressing.\n"
"\n"
@ -779,7 +779,7 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n )
/*---------------------------------------------*/
static
static
void outOfMemory ( void )
{
(fprintf) ( stderr,
@ -791,7 +791,7 @@ void outOfMemory ( void )
/*---------------------------------------------*/
static
static
void configError ( void )
{
(fprintf) ( stderr,
@ -811,11 +811,11 @@ void configError ( void )
/* All rather crufty. The main problem is that input files
are stat()d multiple times before use. This should be
cleaned up.
cleaned up.
*/
/*---------------------------------------------*/
static
static
void pad ( Char *s )
{
Int32 i;
@ -826,8 +826,8 @@ void pad ( Char *s )
/*---------------------------------------------*/
static
void copyFileName ( Char* to, Char* from )
static
void copyFileName ( Char* to, Char* from )
{
if ( strlen(from) > FILE_NAME_LEN-10 ) {
(fprintf) (
@ -847,7 +847,7 @@ void copyFileName ( Char* to, Char* from )
/*---------------------------------------------*/
static
static
Bool fileExists ( Char* name )
{
FILE *tmp = fopen ( name, "rb" );
@ -888,7 +888,7 @@ FILE* fopen_output_safely ( Char* name, const char* mode )
/*--
if in doubt, return True
--*/
static
static
Bool notAStandardFile ( Char* name )
{
IntNative i;
@ -905,9 +905,9 @@ Bool notAStandardFile ( Char* name )
/*--
rac 11/21/98 see if file has hard links to it
--*/
static
static
Int32 countHardLinks ( Char* name )
{
{
IntNative i;
struct MY_STAT statBuf;
@ -938,14 +938,14 @@ Int32 countHardLinks ( Char* name )
It sounds pretty fragile to me. Whether this carries across
robustly to arbitrary Unix-like platforms (or even works robustly
on this one, RedHat 7.2) is unknown to me. Nevertheless ...
on this one, RedHat 7.2) is unknown to me. Nevertheless ...
*/
#if BZ_UNIX
static
static
struct MY_STAT fileMetaInfo;
#endif
static
static
void saveInputFileMetaInfo ( Char *srcName )
{
# if BZ_UNIX
@ -957,7 +957,7 @@ void saveInputFileMetaInfo ( Char *srcName )
}
static
static
void applySavedTimeInfoToOutputFile ( Char *dstName )
{
# if BZ_UNIX
@ -972,7 +972,7 @@ void applySavedTimeInfoToOutputFile ( Char *dstName )
# endif
}
static
static
void applySavedFileAttrToOutputFile ( IntNative fd )
{
# if BZ_UNIX
@ -990,7 +990,7 @@ void applySavedFileAttrToOutputFile ( IntNative fd )
/*---------------------------------------------*/
static
static
Bool containsDubiousChars ( Char* name )
{
# if BZ_UNIX
@ -999,7 +999,7 @@ Bool containsDubiousChars ( Char* name )
*/
return False;
# else /* ! BZ_UNIX */
/* On non-unix (Win* platforms), wildcard characters are not allowed in
/* On non-unix (Win* platforms), wildcard characters are not allowed in
* filenames.
*/
for (; *name != '\0'; name++)
@ -1012,12 +1012,12 @@ Bool containsDubiousChars ( Char* name )
/*---------------------------------------------*/
#define BZ_N_SUFFIX_PAIRS 4
const Char* zSuffix[BZ_N_SUFFIX_PAIRS]
const Char* zSuffix[BZ_N_SUFFIX_PAIRS]
= { ".bz2", ".bz", ".tbz2", ".tbz" };
const Char* unzSuffix[BZ_N_SUFFIX_PAIRS]
const Char* unzSuffix[BZ_N_SUFFIX_PAIRS]
= { "", "", ".tar", ".tar" };
static
static
Bool hasSuffix ( Char* s, const Char* suffix )
{
Int32 ns = strlen(s);
@ -1027,9 +1027,9 @@ Bool hasSuffix ( Char* s, const Char* suffix )
return False;
}
static
Bool mapSuffix ( Char* name,
const Char* oldSuffix,
static
Bool mapSuffix ( Char* name,
const Char* oldSuffix,
const Char* newSuffix )
{
if (!hasSuffix(name,oldSuffix)) return False;
@ -1040,7 +1040,7 @@ Bool mapSuffix ( Char* name,
/*---------------------------------------------*/
static
static
void compress ( Char *name )
{
FILE *inStr;
@ -1054,18 +1054,18 @@ void compress ( Char *name )
panic ( "compress: bad modes\n" );
switch (srcMode) {
case SM_I2O:
case SM_I2O:
copyFileName ( inName, (Char*)"(stdin)" );
copyFileName ( outName, (Char*)"(stdout)" );
copyFileName ( outName, (Char*)"(stdout)" );
break;
case SM_F2F:
case SM_F2F:
copyFileName ( inName, name );
copyFileName ( outName, name );
strcat ( outName, ".bz2" );
strcat ( outName, ".bz2" );
break;
case SM_F2O:
case SM_F2O:
copyFileName ( inName, name );
copyFileName ( outName, (Char*)"(stdout)" );
copyFileName ( outName, (Char*)"(stdout)" );
break;
}
@ -1085,7 +1085,7 @@ void compress ( Char *name )
for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) {
if (hasSuffix(inName, zSuffix[i])) {
if (noisy)
(fprintf) ( stderr,
(fprintf) ( stderr,
"%s: Input file %s already has %s suffix.\n",
progName, inName, zSuffix[i] );
setExit(1);
@ -1221,7 +1221,7 @@ void compress ( Char *name )
/*---------------------------------------------*/
static
static
void uncompress ( Char *name )
{
FILE *inStr;
@ -1238,22 +1238,22 @@ void uncompress ( Char *name )
cantGuess = False;
switch (srcMode) {
case SM_I2O:
case SM_I2O:
copyFileName ( inName, (Char*)"(stdin)" );
copyFileName ( outName, (Char*)"(stdout)" );
copyFileName ( outName, (Char*)"(stdout)" );
break;
case SM_F2F:
case SM_F2F:
copyFileName ( inName, name );
copyFileName ( outName, name );
for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++)
if (mapSuffix(outName,zSuffix[i],unzSuffix[i]))
goto zzz;
goto zzz;
cantGuess = True;
strcat ( outName, ".out" );
break;
case SM_F2O:
case SM_F2O:
copyFileName ( inName, name );
copyFileName ( outName, (Char*)"(stdout)" );
copyFileName ( outName, (Char*)"(stdout)" );
break;
}
@ -1290,11 +1290,11 @@ void uncompress ( Char *name )
}
if ( /* srcMode == SM_F2F implied && */ cantGuess ) {
if (noisy)
(fprintf) ( stderr,
(fprintf) ( stderr,
"%s: Can't guess original name for %s -- using %s\n",
progName, inName, outName );
/* just a warning, no return */
}
}
if ( srcMode == SM_F2F && fileExists ( outName ) ) {
if (forceOverwrite) {
remove(outName);
@ -1419,7 +1419,7 @@ void uncompress ( Char *name )
/*---------------------------------------------*/
static
static
void testf ( Char *name )
{
FILE *inStr;
@ -1508,7 +1508,7 @@ void testf ( Char *name )
/*---------------------------------------------*/
static
static
void license ( void )
{
(fprintf) ( stderr,
@ -1533,7 +1533,7 @@ void license ( void )
/*---------------------------------------------*/
static
static
void usage ( Char *fullProgName )
{
(fprintf) (
@ -1577,11 +1577,11 @@ void usage ( Char *fullProgName )
/*---------------------------------------------*/
static
static
void redundant ( Char* flag )
{
(fprintf) (
stderr,
(fprintf) (
stderr,
"%s: %s is redundant in versions 0.9.5 and above\n",
progName, flag );
}
@ -1593,8 +1593,8 @@ void redundant ( Char* flag )
implement a linked list of command-line arguments,
into which main() copies argv[1 .. argc-1].
The purpose of this exercise is to facilitate
the expansion of wildcard characters * and ? in
The purpose of this exercise is to facilitate
the expansion of wildcard characters * and ? in
filenames for OSs which don't know how to do it
themselves, like MSDOS, Windows 95 and NT.
@ -1611,7 +1611,7 @@ typedef
/*---------------------------------------------*/
static
static
void *myMalloc ( Int32 n )
{
void* p;
@ -1623,7 +1623,7 @@ void *myMalloc ( Int32 n )
/*---------------------------------------------*/
static
static
Cell *mkCell ( void )
{
Cell *c;
@ -1636,7 +1636,7 @@ Cell *mkCell ( void )
/*---------------------------------------------*/
static
static
Cell *snocString ( Cell *root, Char *name )
{
if (root == NULL) {
@ -1654,8 +1654,8 @@ Cell *snocString ( Cell *root, Char *name )
/*---------------------------------------------*/
static
void addFlagsFromEnvVar ( Cell** argList, Char* varName )
static
void addFlagsFromEnvVar ( Cell** argList, Char* varName )
{
Int32 i, j, k;
Char *envbase, *p;
@ -1732,7 +1732,7 @@ IntNative main ( IntNative argc, Char *argv[] )
if (*tmp == PATH_SEP) progName = tmp + 1;
/*-- Copy flags from env var BZIP2, and
/*-- Copy flags from env var BZIP2, and
expand filename wildcards in arg list.
--*/
argList = NULL;
@ -1815,7 +1815,7 @@ IntNative main ( IntNative argc, Char *argv[] )
}
}
}
/*-- And again ... --*/
for (aa = argList; aa != NULL; aa = aa->link) {
if (ISFLAG("--")) break;
@ -1829,7 +1829,7 @@ IntNative main ( IntNative argc, Char *argv[] )
if (ISFLAG("--quiet")) noisy = False; else
if (ISFLAG("--version")) license(); else
if (ISFLAG("--license")) license(); else
if (ISFLAG("--exponential")) workFactor = 1; else
if (ISFLAG("--exponential")) workFactor = 1; else
if (ISFLAG("--repetitive-best")) redundant(aa->name); else
if (ISFLAG("--repetitive-fast")) redundant(aa->name); else
if (ISFLAG("--fast")) blockSize100k = 1; else
@ -1845,7 +1845,7 @@ IntNative main ( IntNative argc, Char *argv[] )
}
if (verbosity > 4) verbosity = 4;
if (opMode == OM_Z && smallMode && blockSize100k > 2)
if (opMode == OM_Z && smallMode && blockSize100k > 2)
blockSize100k = 2;
if (opMode == OM_TEST && srcMode == SM_F2O) {
@ -1879,7 +1879,7 @@ IntNative main ( IntNative argc, Char *argv[] )
compress ( aa->name );
}
}
}
}
else
if (opMode == OM_UNZ) {
@ -1893,13 +1893,13 @@ IntNative main ( IntNative argc, Char *argv[] )
if (aa->name[0] == '-' && decode) continue;
numFilesProcessed++;
uncompress ( aa->name );
}
}
}
if (unzFailsExist) {
setExit(2);
if (unzFailsExist) {
setExit(2);
exit(exitValue);
}
}
}
else {
testFailsExist = False;
@ -1927,7 +1927,7 @@ IntNative main ( IntNative argc, Char *argv[] )
}
}
/* Free the argument list memory to mollify leak detectors
/* Free the argument list memory to mollify leak detectors
(eg) Purify, Checker. Serves no other useful purpose.
*/
aa = argList;

View file

@ -18,7 +18,7 @@
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
This program is released under the terms of the license contained
@ -77,7 +77,7 @@ MaybeUInt64 bytesIn = 0;
#define BZ_HDR_Z 0x5a /* 'Z' */
#define BZ_HDR_h 0x68 /* 'h' */
#define BZ_HDR_0 0x30 /* '0' */
/*---------------------------------------------------*/
/*--- I/O errors ---*/
@ -130,7 +130,7 @@ static void tooManyBlocks ( Int32 max_handled_blocks )
(fprintf) ( stderr,
"%s: and cannot be handled. To fix, increase\n",
progName );
(fprintf) ( stderr,
(fprintf) ( stderr,
"%s: BZ_MAX_HANDLED_BLOCKS in bzip2recover.c, and recompile.\n",
progName );
exit ( 1 );
@ -315,7 +315,7 @@ Int32 main ( Int32 argc, Char** argv )
progName[BZ_MAX_FILENAME-1]='\0';
inFileName[0] = outFileName[0] = 0;
(fprintf) ( stderr,
(fprintf) ( stderr,
"bzip2recover 1.0.8: extracts blocks from damaged .bz2 files.\n" );
if (argc != 2) {
@ -323,18 +323,18 @@ Int32 main ( Int32 argc, Char** argv )
progName, progName );
switch (sizeof(MaybeUInt64)) {
case 8:
(fprintf)(stderr,
(fprintf)(stderr,
"\trestrictions on size of recovered file: None\n");
break;
case 4:
(fprintf)(stderr,
(fprintf)(stderr,
"\trestrictions on size of recovered file: 512 MB\n");
(fprintf)(stderr,
(fprintf)(stderr,
"\tto circumvent, recompile with MaybeUInt64 as an\n"
"\tunsigned 64-bit int.\n");
break;
default:
(fprintf)(stderr,
(fprintf)(stderr,
"\tsizeof(MaybeUInt64) is not 4 or 8 -- "
"configuration error.\n");
break;
@ -343,7 +343,7 @@ Int32 main ( Int32 argc, Char** argv )
}
if (strlen(argv[1]) >= BZ_MAX_FILENAME-20) {
(fprintf) ( stderr,
(fprintf) ( stderr,
"%s: supplied filename is suspiciously (>= %d chars) long. Bye!\n",
progName, (int)strlen(argv[1]) );
exit(1);
@ -375,7 +375,7 @@ Int32 main ( Int32 argc, Char** argv )
(bitsRead - bStart[currBlock]) >= 40) {
bEnd[currBlock] = bitsRead-1;
if (currBlock > 0)
(fprintf) ( stderr, " block %d runs from " MaybeUInt64_FMT
(fprintf) ( stderr, " block %d runs from " MaybeUInt64_FMT
" to " MaybeUInt64_FMT " (incomplete)\n",
currBlock, bStart[currBlock], bEnd[currBlock] );
} else
@ -384,10 +384,10 @@ Int32 main ( Int32 argc, Char** argv )
}
buffHi = (buffHi << 1) | (buffLo >> 31);
buffLo = (buffLo << 1) | (b & 1);
if ( ( (buffHi & 0x0000ffff) == BLOCK_HEADER_HI
if ( ( (buffHi & 0x0000ffff) == BLOCK_HEADER_HI
&& buffLo == BLOCK_HEADER_LO)
||
( (buffHi & 0x0000ffff) == BLOCK_ENDMARK_HI
||
( (buffHi & 0x0000ffff) == BLOCK_ENDMARK_HI
&& buffLo == BLOCK_ENDMARK_LO)
) {
if (bitsRead > 49) {
@ -397,7 +397,7 @@ Int32 main ( Int32 argc, Char** argv )
}
if (currBlock > 0 &&
(bEnd[currBlock] - bStart[currBlock]) >= 130) {
(fprintf) ( stderr, " block %d runs from " MaybeUInt64_FMT
(fprintf) ( stderr, " block %d runs from " MaybeUInt64_FMT
" to " MaybeUInt64_FMT "\n",
rbCtr+1, bStart[currBlock], bEnd[currBlock] );
rbStart[rbCtr] = bStart[currBlock];
@ -443,7 +443,7 @@ Int32 main ( Int32 argc, Char** argv )
if (b == 2) break;
buffHi = (buffHi << 1) | (buffLo >> 31);
buffLo = (buffLo << 1) | (b & 1);
if (bitsRead == 47+rbStart[wrBlock])
if (bitsRead == 47+rbStart[wrBlock])
blockCRC = (buffHi << 16) | (buffLo >> 16);
if (outFile != NULL && bitsRead >= rbStart[wrBlock]
@ -466,11 +466,11 @@ Int32 main ( Int32 argc, Char** argv )
wrBlock++;
} else
if (bitsRead == rbStart[wrBlock]) {
/* Create the output file name, correctly handling leading paths.
/* Create the output file name, correctly handling leading paths.
(31.10.2001 by Sergey E. Kusikov) */
Char* split;
Int32 ofs, k;
for (k = 0; k < BZ_MAX_FILENAME; k++)
for (k = 0; k < BZ_MAX_FILENAME; k++)
outFileName[k] = 0;
strcpy (outFileName, inFileName);
split = strrchr (outFileName, BZ_SPLIT_SYM);
@ -497,9 +497,9 @@ Int32 main ( Int32 argc, Char** argv )
exit(1);
}
bsWr = bsOpenWriteStream ( outFile );
bsPutUChar ( bsWr, BZ_HDR_B );
bsPutUChar ( bsWr, BZ_HDR_Z );
bsPutUChar ( bsWr, BZ_HDR_h );
bsPutUChar ( bsWr, BZ_HDR_B );
bsPutUChar ( bsWr, BZ_HDR_Z );
bsPutUChar ( bsWr, BZ_HDR_h );
bsPutUChar ( bsWr, BZ_HDR_0 + 9 );
bsPutUChar ( bsWr, 0x31 ); bsPutUChar ( bsWr, 0x41 );
bsPutUChar ( bsWr, 0x59 ); bsPutUChar ( bsWr, 0x26 );

View file

@ -12,7 +12,7 @@
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
This program is released under the terms of the license contained
@ -42,7 +42,7 @@
#ifndef BZ_NO_STDIO
void BZ2_bz__AssertH__fail ( int errcode )
{
fprintf(stderr,
fprintf(stderr,
"\n\nbzip2/libbzip2: internal error number %d.\n"
"This is a bug in bzip2/libbzip2, %s.\n"
"Please report it to: bzip2-devel@sourceware.org. If this happened\n"
@ -147,8 +147,8 @@ Bool isempty_RL ( EState* s )
/*---------------------------------------------------*/
int BZ2_bzCompressInit
( bz_stream* strm,
int BZ2_bzCompressInit
( bz_stream* strm,
int blockSize100k,
int verbosity,
int workFactor )
@ -158,7 +158,7 @@ int BZ2_bzCompressInit
if (!bz_config_ok()) return BZ_CONFIG_ERROR;
if (strm == NULL ||
if (strm == NULL ||
blockSize100k < 1 || blockSize100k > 9 ||
workFactor < 0 || workFactor > 250)
return BZ_PARAM_ERROR;
@ -301,7 +301,7 @@ Bool copy_input_until_stop ( EState* s )
/*-- no input? --*/
if (s->strm->avail_in == 0) break;
progress_in = True;
ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
s->strm->next_in++;
s->strm->avail_in--;
s->strm->total_in_lo32++;
@ -319,7 +319,7 @@ Bool copy_input_until_stop ( EState* s )
/*-- flush/finish end? --*/
if (s->avail_in_expect == 0) break;
progress_in = True;
ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
s->strm->next_in++;
s->strm->avail_in--;
s->strm->total_in_lo32++;
@ -365,18 +365,18 @@ Bool handle_compress ( bz_stream* strm )
Bool progress_in = False;
Bool progress_out = False;
EState* s = strm->state;
while (True) {
if (s->state == BZ_S_OUTPUT) {
progress_out |= copy_output_until_stop ( s );
if (s->state_out_pos < s->numZ) break;
if (s->mode == BZ_M_FINISHING &&
if (s->mode == BZ_M_FINISHING &&
s->avail_in_expect == 0 &&
isempty_RL(s)) break;
prepare_new_block ( s );
s->state = BZ_S_INPUT;
if (s->mode == BZ_M_FLUSHING &&
if (s->mode == BZ_M_FLUSHING &&
s->avail_in_expect == 0 &&
isempty_RL(s)) break;
}
@ -425,7 +425,7 @@ int BZ2_bzCompress ( bz_stream *strm, int action )
if (action == BZ_RUN) {
progress = handle_compress ( strm );
return progress ? BZ_RUN_OK : BZ_PARAM_ERROR;
}
}
else
if (action == BZ_FLUSH) {
s->avail_in_expect = strm->avail_in;
@ -438,12 +438,12 @@ int BZ2_bzCompress ( bz_stream *strm, int action )
s->mode = BZ_M_FINISHING;
goto preswitch;
}
else
else
return BZ_PARAM_ERROR;
case BZ_M_FLUSHING:
if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR;
if (s->avail_in_expect != s->strm->avail_in)
if (s->avail_in_expect != s->strm->avail_in)
return BZ_SEQUENCE_ERROR;
progress = handle_compress ( strm );
if (s->avail_in_expect > 0 || !isempty_RL(s) ||
@ -453,7 +453,7 @@ int BZ2_bzCompress ( bz_stream *strm, int action )
case BZ_M_FINISHING:
if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR;
if (s->avail_in_expect != s->strm->avail_in)
if (s->avail_in_expect != s->strm->avail_in)
return BZ_SEQUENCE_ERROR;
progress = handle_compress ( strm );
if (!progress) return BZ_SEQUENCE_ERROR;
@ -480,7 +480,7 @@ int BZ2_bzCompressEnd ( bz_stream *strm )
if (s->ftab != NULL) BZFREE(s->ftab);
BZFREE(strm->state);
strm->state = NULL;
strm->state = NULL;
return BZ_OK;
}
@ -491,8 +491,8 @@ int BZ2_bzCompressEnd ( bz_stream *strm )
/*---------------------------------------------------*/
/*---------------------------------------------------*/
int BZ2_bzDecompressInit
( bz_stream* strm,
int BZ2_bzDecompressInit
( bz_stream* strm,
int verbosity,
int small )
{
@ -557,34 +557,34 @@ Bool unRLE_obuf_to_output_FAST ( DState* s )
/* can a new run be started? */
if (s->nblock_used == s->save_nblock+1) return False;
/* Only caused by corrupt data stream? */
if (s->nblock_used > s->save_nblock+1)
return True;
s->state_out_len = 1;
s->state_out_ch = s->k0;
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
k1 ^= BZ_RAND_MASK; s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 2;
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
k1 ^= BZ_RAND_MASK; s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 3;
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
k1 ^= BZ_RAND_MASK; s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
k1 ^= BZ_RAND_MASK; s->nblock_used++;
s->state_out_len = ((Int32)k1) + 4;
BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK;
BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK;
s->k0 ^= BZ_RAND_MASK; s->nblock_used++;
}
@ -622,7 +622,7 @@ Bool unRLE_obuf_to_output_FAST ( DState* s )
}
s_state_out_len_eq_one:
{
if (cs_avail_out == 0) {
if (cs_avail_out == 0) {
c_state_out_len = 1; goto return_notr;
};
*( (UChar*)(cs_next_out) ) = c_state_out_ch;
@ -630,7 +630,7 @@ Bool unRLE_obuf_to_output_FAST ( DState* s )
cs_next_out++;
cs_avail_out--;
}
}
}
/* Only caused by corrupt data stream? */
if (c_nblock_used > s_save_nblockPP)
return True;
@ -638,25 +638,25 @@ Bool unRLE_obuf_to_output_FAST ( DState* s )
/* can a new run be started? */
if (c_nblock_used == s_save_nblockPP) {
c_state_out_len = 0; goto return_notr;
};
};
c_state_out_ch = c_k0;
BZ_GET_FAST_C(k1); c_nblock_used++;
if (k1 != c_k0) {
c_k0 = k1; goto s_state_out_len_eq_one;
if (k1 != c_k0) {
c_k0 = k1; goto s_state_out_len_eq_one;
};
if (c_nblock_used == s_save_nblockPP)
if (c_nblock_used == s_save_nblockPP)
goto s_state_out_len_eq_one;
c_state_out_len = 2;
BZ_GET_FAST_C(k1); c_nblock_used++;
if (c_nblock_used == s_save_nblockPP) continue;
if (k1 != c_k0) { c_k0 = k1; continue; };
c_state_out_len = 3;
BZ_GET_FAST_C(k1); c_nblock_used++;
if (c_nblock_used == s_save_nblockPP) continue;
if (k1 != c_k0) { c_k0 = k1; continue; };
BZ_GET_FAST_C(k1); c_nblock_used++;
c_state_out_len = ((Int32)k1) + 4;
BZ_GET_FAST_C(c_k0); c_nblock_used++;
@ -724,37 +724,37 @@ Bool unRLE_obuf_to_output_SMALL ( DState* s )
s->strm->total_out_lo32++;
if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
}
/* can a new run be started? */
if (s->nblock_used == s->save_nblock+1) return False;
/* Only caused by corrupt data stream? */
if (s->nblock_used > s->save_nblock+1)
return True;
s->state_out_len = 1;
s->state_out_ch = s->k0;
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
k1 ^= BZ_RAND_MASK; s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 2;
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
k1 ^= BZ_RAND_MASK; s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 3;
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
k1 ^= BZ_RAND_MASK; s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
k1 ^= BZ_RAND_MASK; s->nblock_used++;
s->state_out_len = ((Int32)k1) + 4;
BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK;
BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK;
s->k0 ^= BZ_RAND_MASK; s->nblock_used++;
}
@ -773,30 +773,30 @@ Bool unRLE_obuf_to_output_SMALL ( DState* s )
s->strm->total_out_lo32++;
if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
}
/* can a new run be started? */
if (s->nblock_used == s->save_nblock+1) return False;
/* Only caused by corrupt data stream? */
if (s->nblock_used > s->save_nblock+1)
return True;
s->state_out_len = 1;
s->state_out_ch = s->k0;
BZ_GET_SMALL(k1); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 2;
BZ_GET_SMALL(k1); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 3;
BZ_GET_SMALL(k1); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
BZ_GET_SMALL(k1); s->nblock_used++;
s->state_out_len = ((Int32)k1) + 4;
BZ_GET_SMALL(s->k0); s->nblock_used++;
@ -825,14 +825,14 @@ int BZ2_bzDecompress ( bz_stream *strm )
if (corrupt) return BZ_DATA_ERROR;
if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) {
BZ_FINALISE_CRC ( s->calculatedBlockCRC );
if (s->verbosity >= 3)
VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC,
if (s->verbosity >= 3)
VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC,
s->calculatedBlockCRC );
if (s->verbosity >= 2) VPrintf0 ( "]" );
if (s->calculatedBlockCRC != s->storedBlockCRC)
return BZ_DATA_ERROR;
s->calculatedCombinedCRC
= (s->calculatedCombinedCRC << 1) |
s->calculatedCombinedCRC
= (s->calculatedCombinedCRC << 1) |
(s->calculatedCombinedCRC >> 31);
s->calculatedCombinedCRC ^= s->calculatedBlockCRC;
s->state = BZ_X_BLKHDR_1;
@ -844,7 +844,7 @@ int BZ2_bzDecompress ( bz_stream *strm )
Int32 r = BZ2_decompress ( s );
if (r == BZ_STREAM_END) {
if (s->verbosity >= 3)
VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x",
VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x",
s->storedCombinedCRC, s->calculatedCombinedCRC );
if (s->calculatedCombinedCRC != s->storedCombinedCRC)
return BZ_DATA_ERROR;
@ -890,7 +890,7 @@ int BZ2_bzDecompressEnd ( bz_stream *strm )
if (bzf != NULL) bzf->lastErr = eee; \
}
typedef
typedef
struct {
FILE* handle;
Char buf[BZ_MAX_UNUSED];
@ -914,10 +914,10 @@ static Bool myfeof ( FILE* f )
/*---------------------------------------------------*/
BZFILE* BZ2_bzWriteOpen
( int* bzerror,
FILE* f,
int blockSize100k,
BZFILE* BZ2_bzWriteOpen
( int* bzerror,
FILE* f,
int blockSize100k,
int verbosity,
int workFactor )
{
@ -949,23 +949,23 @@ BZFILE* BZ2_bzWriteOpen
bzf->strm.opaque = NULL;
if (workFactor == 0) workFactor = 30;
ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k,
ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k,
verbosity, workFactor );
if (ret != BZ_OK)
{ BZ_SETERR(ret); free(bzf); return NULL; };
bzf->strm.avail_in = 0;
bzf->initialisedOk = True;
return bzf;
return bzf;
}
/*---------------------------------------------------*/
void BZ2_bzWrite
( int* bzerror,
BZFILE* b,
void* buf,
( int* bzerror,
BZFILE* b,
void* buf,
int len )
{
Int32 n, n2, ret;
@ -994,7 +994,7 @@ void BZ2_bzWrite
if (bzf->strm.avail_out < BZ_MAX_UNUSED) {
n = BZ_MAX_UNUSED - bzf->strm.avail_out;
n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
n, bzf->handle );
if (n != n2 || ferror(bzf->handle))
{ BZ_SETERR(BZ_IO_ERROR); return; };
@ -1008,20 +1008,20 @@ void BZ2_bzWrite
/*---------------------------------------------------*/
void BZ2_bzWriteClose
( int* bzerror,
BZFILE* b,
( int* bzerror,
BZFILE* b,
int abandon,
unsigned int* nbytes_in,
unsigned int* nbytes_out )
{
BZ2_bzWriteClose64 ( bzerror, b, abandon,
BZ2_bzWriteClose64 ( bzerror, b, abandon,
nbytes_in, NULL, nbytes_out, NULL );
}
void BZ2_bzWriteClose64
( int* bzerror,
BZFILE* b,
( int* bzerror,
BZFILE* b,
int abandon,
unsigned int* nbytes_in_lo32,
unsigned int* nbytes_in_hi32,
@ -1053,7 +1053,7 @@ void BZ2_bzWriteClose64
if (bzf->strm.avail_out < BZ_MAX_UNUSED) {
n = BZ_MAX_UNUSED - bzf->strm.avail_out;
n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
n, bzf->handle );
if (n != n2 || ferror(bzf->handle))
{ BZ_SETERR(BZ_IO_ERROR); return; };
@ -1085,9 +1085,9 @@ void BZ2_bzWriteClose64
/*---------------------------------------------------*/
BZFILE* BZ2_bzReadOpen
( int* bzerror,
FILE* f,
BZFILE* BZ2_bzReadOpen
( int* bzerror,
FILE* f,
int verbosity,
int small,
void* unused,
@ -1098,7 +1098,7 @@ BZFILE* BZ2_bzReadOpen
BZ_SETERR(BZ_OK);
if (f == NULL ||
if (f == NULL ||
(small != 0 && small != 1) ||
(verbosity < 0 || verbosity > 4) ||
(unused == NULL && nUnused != 0) ||
@ -1109,7 +1109,7 @@ BZFILE* BZ2_bzReadOpen
{ BZ_SETERR(BZ_IO_ERROR); return NULL; };
bzf = malloc ( sizeof(bzFile) );
if (bzf == NULL)
if (bzf == NULL)
{ BZ_SETERR(BZ_MEM_ERROR); return NULL; };
BZ_SETERR(BZ_OK);
@ -1121,7 +1121,7 @@ BZFILE* BZ2_bzReadOpen
bzf->strm.bzalloc = NULL;
bzf->strm.bzfree = NULL;
bzf->strm.opaque = NULL;
while (nUnused > 0) {
bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++;
unused = ((void*)( 1 + ((UChar*)(unused)) ));
@ -1136,7 +1136,7 @@ BZFILE* BZ2_bzReadOpen
bzf->strm.next_in = bzf->buf;
bzf->initialisedOk = True;
return bzf;
return bzf;
}
@ -1159,10 +1159,10 @@ void BZ2_bzReadClose ( int *bzerror, BZFILE *b )
/*---------------------------------------------------*/
int BZ2_bzRead
( int* bzerror,
BZFILE* b,
void* buf,
int BZ2_bzRead
( int* bzerror,
BZFILE* b,
void* buf,
int len )
{
Int32 n, ret;
@ -1184,11 +1184,11 @@ int BZ2_bzRead
while (True) {
if (ferror(bzf->handle))
if (ferror(bzf->handle))
{ BZ_SETERR(BZ_IO_ERROR); return 0; };
if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) {
n = fread ( bzf->buf, sizeof(UChar),
n = fread ( bzf->buf, sizeof(UChar),
BZ_MAX_UNUSED, bzf->handle );
if (ferror(bzf->handle))
{ BZ_SETERR(BZ_IO_ERROR); return 0; };
@ -1202,7 +1202,7 @@ int BZ2_bzRead
if (ret != BZ_OK && ret != BZ_STREAM_END)
{ BZ_SETERR(ret); return 0; };
if (ret == BZ_OK && myfeof(bzf->handle) &&
if (ret == BZ_OK && myfeof(bzf->handle) &&
bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0)
{ BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; };
@ -1211,7 +1211,7 @@ int BZ2_bzRead
return len - bzf->strm.avail_out; };
if (bzf->strm.avail_out == 0)
{ BZ_SETERR(BZ_OK); return len; };
}
return 0; /*not reached*/
@ -1219,10 +1219,10 @@ int BZ2_bzRead
/*---------------------------------------------------*/
void BZ2_bzReadGetUnused
( int* bzerror,
BZFILE* b,
void** unused,
void BZ2_bzReadGetUnused
( int* bzerror,
BZFILE* b,
void** unused,
int* nUnused )
{
bzFile* bzf = (bzFile*)b;
@ -1244,30 +1244,30 @@ void BZ2_bzReadGetUnused
/*---------------------------------------------------*/
/*---------------------------------------------------*/
int BZ2_bzBuffToBuffCompress
( char* dest,
int BZ2_bzBuffToBuffCompress
( char* dest,
unsigned int* destLen,
char* source,
char* source,
unsigned int sourceLen,
int blockSize100k,
int verbosity,
int blockSize100k,
int verbosity,
int workFactor )
{
bz_stream strm;
int ret;
if (dest == NULL || destLen == NULL ||
if (dest == NULL || destLen == NULL ||
source == NULL ||
blockSize100k < 1 || blockSize100k > 9 ||
verbosity < 0 || verbosity > 4 ||
workFactor < 0 || workFactor > 250)
workFactor < 0 || workFactor > 250)
return BZ_PARAM_ERROR;
if (workFactor == 0) workFactor = 30;
strm.bzalloc = NULL;
strm.bzfree = NULL;
strm.opaque = NULL;
ret = BZ2_bzCompressInit ( &strm, blockSize100k,
ret = BZ2_bzCompressInit ( &strm, blockSize100k,
verbosity, workFactor );
if (ret != BZ_OK) return ret;
@ -1281,7 +1281,7 @@ int BZ2_bzBuffToBuffCompress
if (ret != BZ_STREAM_END) goto errhandler;
/* normal termination */
*destLen -= strm.avail_out;
*destLen -= strm.avail_out;
BZ2_bzCompressEnd ( &strm );
return BZ_OK;
@ -1296,10 +1296,10 @@ int BZ2_bzBuffToBuffCompress
/*---------------------------------------------------*/
int BZ2_bzBuffToBuffDecompress
( char* dest,
int BZ2_bzBuffToBuffDecompress
( char* dest,
unsigned int* destLen,
char* source,
char* source,
unsigned int sourceLen,
int small,
int verbosity )
@ -1307,10 +1307,10 @@ int BZ2_bzBuffToBuffDecompress
bz_stream strm;
int ret;
if (dest == NULL || destLen == NULL ||
if (dest == NULL || destLen == NULL ||
source == NULL ||
(small != 0 && small != 1) ||
verbosity < 0 || verbosity > 4)
verbosity < 0 || verbosity > 4)
return BZ_PARAM_ERROR;
strm.bzalloc = NULL;
@ -1340,11 +1340,11 @@ int BZ2_bzBuffToBuffDecompress
} else {
BZ2_bzDecompressEnd ( &strm );
return BZ_OUTBUFF_FULL;
};
};
errhandler:
BZ2_bzDecompressEnd ( &strm );
return ret;
return ret;
}
@ -1396,7 +1396,7 @@ BZFILE * bzopen_or_bzdopen
int verbosity = 0;
int workFactor = 30;
int smallMode = 0;
int nUnused = 0;
int nUnused = 0;
if (mode == NULL) return NULL;
while (*mode) {
@ -1436,7 +1436,7 @@ BZFILE * bzopen_or_bzdopen
if (writing) {
/* Guard against total chaos and anarchy -- JRS */
if (blockSize100k < 1) blockSize100k = 1;
if (blockSize100k > 9) blockSize100k = 9;
if (blockSize100k > 9) blockSize100k = 9;
bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k,
verbosity,workFactor);
} else {
@ -1515,7 +1515,7 @@ void BZ2_bzclose (BZFILE* b)
{
int bzerr;
FILE *fp;
if (b==NULL) {return;}
fp = ((bzFile *)b)->handle;
if(((bzFile*)b)->writing){
@ -1534,7 +1534,7 @@ void BZ2_bzclose (BZFILE* b)
/*---------------------------------------------------*/
/*--
return last error code
return last error code
--*/
static const char *bzerrorstrings[] = {
"OK"

View file

@ -16,7 +16,7 @@
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
This program is released under the terms of the license contained
@ -40,7 +40,7 @@ typedef unsigned short UInt16;
#ifndef __GNUC__
#define __inline__ /* */
#endif
#endif
#ifndef BZ_NO_STDIO
@ -98,7 +98,7 @@ extern void bz_internal_error ( int errcode );
#define BZ_HDR_Z 0x5a /* 'Z' */
#define BZ_HDR_h 0x68 /* 'h' */
#define BZ_HDR_0 0x30 /* '0' */
/*-- Constants for the back end. --*/
#define BZ_MAX_ALPHA_SIZE 258
@ -258,19 +258,19 @@ typedef
/*-- externs for compression. --*/
extern void
extern void
BZ2_blockSort ( EState* );
extern void
extern void
BZ2_compressBlock ( EState*, Bool );
extern void
extern void
BZ2_bsInitWrite ( EState* );
extern void
extern void
BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 );
extern void
extern void
BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 );
@ -414,7 +414,7 @@ typedef
Int32 save_N;
Int32 save_curr;
Int32 save_zt;
Int32 save_zn;
Int32 save_zn;
Int32 save_zvec;
Int32 save_zj;
Int32 save_gSel;
@ -470,12 +470,12 @@ typedef
/*-- externs for decompression. --*/
extern Int32
extern Int32
BZ2_indexIntoF ( Int32, Int32* );
extern Int32
extern Int32
BZ2_decompress ( DState* );
extern void
extern void
BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*,
Int32, Int32, Int32 );

View file

@ -1,6 +1,6 @@
#!/bin/sh
# Bzmore wrapped for bzip2,
# Bzmore wrapped for bzip2,
# adapted from zmore by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
PATH="/usr/bin:$PATH"; export PATH
@ -43,7 +43,7 @@ else
if test $FIRST -eq 0; then
echo $n1 "--More--(Next file: $FILE)$n2"
stty $cb -echo 2>/dev/null
ANS=`dd bs=1 count=1 2>/dev/null`
ANS=`dd bs=1 count=1 2>/dev/null`
stty $ncb echo 2>/dev/null
echo " "
if test "$ANS" = 'e' -o "$ANS" = 'q'; then

View file

@ -78,15 +78,15 @@ skip \fIi\fP screenfuls and print a screenful of lines
quit reading the current file; go on to the next (if any)
.PP
.IP "e or q"
When the prompt --More--(Next file:
When the prompt --More--(Next file:
.IR file )
is printed, this command causes bzmore to exit.
.PP
.IP s
When the prompt --More--(Next file:
When the prompt --More--(Next file:
.IR file )
is printed, this command causes bzmore to skip the next file and continue.
.PP
.PP
.IP =
Display the current line number.
.PP
@ -105,7 +105,7 @@ Erasing back past the first column cancels the search command.
search for the \fIi\|\fP-th occurrence of the last regular expression entered.
.PP
.IP !command
invoke a shell with \fIcommand\|\fP.
invoke a shell with \fIcommand\|\fP.
The character `!' in "command" are replaced with the
previous shell command. The sequence "\\!" is replaced by "!".
.PP

View file

@ -12,7 +12,7 @@
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
This program is released under the terms of the license contained
@ -23,7 +23,7 @@
/* CHANGES
0.9.0 -- original version.
0.9.0a/b -- no changes in this file.
0.9.0c -- changed setting of nGroups in sendMTFValues()
0.9.0c -- changed setting of nGroups in sendMTFValues()
so as to do a bit better on small files
*/
@ -126,11 +126,11 @@ void generateMTFValues ( EState* s )
Int32 wr;
Int32 EOB;
/*
/*
After sorting (eg, here),
s->arr1 [ 0 .. s->nblock-1 ] holds sorted order,
and
((UChar*)s->arr2) [ 0 .. s->nblock-1 ]
((UChar*)s->arr2) [ 0 .. s->nblock-1 ]
holds the original block data.
The first thing to do is generate the MTF values,
@ -145,7 +145,7 @@ void generateMTFValues ( EState* s )
(UChar*) (&((UChar*)s->arr2)[s->nblock])
These storage aliases are set up in bzCompressInit(),
except for the last one, which is arranged in
except for the last one, which is arranged in
compressBlock().
*/
UInt32* ptr = s->ptr;
@ -168,7 +168,7 @@ void generateMTFValues ( EState* s )
ll_i = s->unseqToSeq[block[j]];
AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" );
if (yy[0] == ll_i) {
if (yy[0] == ll_i) {
zPend++;
} else {
@ -176,11 +176,11 @@ void generateMTFValues ( EState* s )
zPend--;
while (True) {
if (zPend & 1) {
mtfv[wr] = BZ_RUNB; wr++;
s->mtfFreq[BZ_RUNB]++;
mtfv[wr] = BZ_RUNB; wr++;
s->mtfFreq[BZ_RUNB]++;
} else {
mtfv[wr] = BZ_RUNA; wr++;
s->mtfFreq[BZ_RUNA]++;
mtfv[wr] = BZ_RUNA; wr++;
s->mtfFreq[BZ_RUNA]++;
}
if (zPend < 2) break;
zPend = (zPend - 2) / 2;
@ -214,11 +214,11 @@ void generateMTFValues ( EState* s )
zPend--;
while (True) {
if (zPend & 1) {
mtfv[wr] = BZ_RUNB; wr++;
s->mtfFreq[BZ_RUNB]++;
mtfv[wr] = BZ_RUNB; wr++;
s->mtfFreq[BZ_RUNB]++;
} else {
mtfv[wr] = BZ_RUNA; wr++;
s->mtfFreq[BZ_RUNA]++;
mtfv[wr] = BZ_RUNA; wr++;
s->mtfFreq[BZ_RUNA]++;
}
if (zPend < 2) break;
zPend = (zPend - 2) / 2;
@ -261,7 +261,7 @@ void sendMTFValues ( EState* s )
if (s->verbosity >= 3)
VPrintf3( " %d in block, %d after MTF & 1-2 coding, "
"%d+2 syms in use\n",
"%d+2 syms in use\n",
s->nblock, s->nMTF, s->nInUse );
alphaSize = s->nInUse+2;
@ -278,7 +278,7 @@ void sendMTFValues ( EState* s )
nGroups = 6;
/*--- Generate an initial set of coding tables ---*/
{
{
Int32 nPart, remF, tFreq, aFreq;
nPart = nGroups;
@ -293,8 +293,8 @@ void sendMTFValues ( EState* s )
aFreq += s->mtfFreq[ge];
}
if (ge > gs
&& nPart != nGroups && nPart != 1
if (ge > gs
&& nPart != nGroups && nPart != 1
&& ((nGroups-nPart) % 2 == 1)) {
aFreq -= s->mtfFreq[ge];
ge--;
@ -303,21 +303,21 @@ void sendMTFValues ( EState* s )
if (s->verbosity >= 3)
VPrintf5( " initial group %d, [%d .. %d], "
"has %d syms (%4.1f%%)\n",
nPart, gs, ge, aFreq,
nPart, gs, ge, aFreq,
(100.0 * (float)aFreq) / (float)(s->nMTF) );
for (v = 0; v < alphaSize; v++)
if (v >= gs && v <= ge)
if (v >= gs && v <= ge)
s->len[nPart-1][v] = BZ_LESSER_ICOST; else
s->len[nPart-1][v] = BZ_GREATER_ICOST;
nPart--;
gs = ge+1;
remF -= aFreq;
}
}
/*---
/*---
Iterate up to BZ_N_ITERS times to improve the tables.
---*/
for (iter = 0; iter < BZ_N_ITERS; iter++) {
@ -330,7 +330,7 @@ void sendMTFValues ( EState* s )
/*---
Set up an auxiliary length table which is used to fast-track
the common case (nGroups == 6).
the common case (nGroups == 6).
---*/
if (nGroups == 6) {
for (v = 0; v < alphaSize; v++) {
@ -347,10 +347,10 @@ void sendMTFValues ( EState* s )
/*--- Set group start & end marks. --*/
if (gs >= s->nMTF) break;
ge = gs + BZ_G_SIZE - 1;
ge = gs + BZ_G_SIZE - 1;
if (ge >= s->nMTF) ge = s->nMTF-1;
/*--
/*--
Calculate the cost of this group as coded
by each of the coding tables.
--*/
@ -387,13 +387,13 @@ void sendMTFValues ( EState* s )
} else {
/*--- slow version which correctly handles all situations ---*/
for (i = gs; i <= ge; i++) {
for (i = gs; i <= ge; i++) {
UInt16 icv = mtfv[i];
for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv];
}
}
/*--
/*--
Find the coding table which is best for this group,
and record its identity in the selector table.
--*/
@ -405,7 +405,7 @@ void sendMTFValues ( EState* s )
s->selector[nSelectors] = bt;
nSelectors++;
/*--
/*--
Increment the symbol frequencies for the selected table.
--*/
if (nGroups == 6 && 50 == ge-gs+1) {
@ -435,7 +435,7 @@ void sendMTFValues ( EState* s )
gs = ge+1;
}
if (s->verbosity >= 3) {
VPrintf2 ( " pass %d: size is %d, grp uses are ",
VPrintf2 ( " pass %d: size is %d, grp uses are ",
iter+1, totc/8 );
for (t = 0; t < nGroups; t++)
VPrintf1 ( "%d ", fave[t] );
@ -445,10 +445,10 @@ void sendMTFValues ( EState* s )
/*--
Recompute the tables based on the accumulated frequencies.
--*/
/* maxLen was changed from 20 to 17 in bzip2-1.0.3. See
/* maxLen was changed from 20 to 17 in bzip2-1.0.3. See
comment in huffman.c for details. */
for (t = 0; t < nGroups; t++)
BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]),
BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]),
alphaSize, 17 /*20*/ );
}
@ -488,19 +488,19 @@ void sendMTFValues ( EState* s )
}
AssertH ( !(maxLen > 17 /*20*/ ), 3004 );
AssertH ( !(minLen < 1), 3005 );
BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]),
BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]),
minLen, maxLen, alphaSize );
}
/*--- Transmit the mapping table. ---*/
{
{
Bool inUse16[16];
for (i = 0; i < 16; i++) {
inUse16[i] = False;
for (j = 0; j < 16; j++)
if (s->inUse[i * 16 + j]) inUse16[i] = True;
}
nBytes = s->numZ;
for (i = 0; i < 16; i++)
if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0);
@ -511,7 +511,7 @@ void sendMTFValues ( EState* s )
if (s->inUse[i * 16 + j]) bsW(s,1,1); else bsW(s,1,0);
}
if (s->verbosity >= 3)
if (s->verbosity >= 3)
VPrintf1( " bytes: mapping %d, ", s->numZ-nBytes );
}
@ -519,7 +519,7 @@ void sendMTFValues ( EState* s )
nBytes = s->numZ;
bsW ( s, 3, nGroups );
bsW ( s, 15, nSelectors );
for (i = 0; i < nSelectors; i++) {
for (i = 0; i < nSelectors; i++) {
for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1);
bsW(s,1,0);
}
@ -548,14 +548,14 @@ void sendMTFValues ( EState* s )
gs = 0;
while (True) {
if (gs >= s->nMTF) break;
ge = gs + BZ_G_SIZE - 1;
ge = gs + BZ_G_SIZE - 1;
if (ge >= s->nMTF) ge = s->nMTF-1;
AssertH ( s->selector[selCtr] < nGroups, 3006 );
if (nGroups == 6 && 50 == ge-gs+1) {
/*--- fast track the common case ---*/
UInt16 mtfv_i;
UChar* s_len_sel_selCtr
UChar* s_len_sel_selCtr
= &(s->len[s->selector[selCtr]][0]);
Int32* s_code_sel_selCtr
= &(s->code[s->selector[selCtr]][0]);
@ -582,7 +582,7 @@ void sendMTFValues ( EState* s )
} else {
/*--- slow version which correctly handles all situations ---*/
for (i = gs; i <= ge; i++) {
bsW ( s,
bsW ( s,
s->len [s->selector[selCtr]] [mtfv[i]],
s->code [s->selector[selCtr]] [mtfv[i]] );
}
@ -637,8 +637,8 @@ void BZ2_compressBlock ( EState* s, Bool is_last_block )
/*-- Now the block's CRC, so it is in a known place. --*/
bsPutUInt32 ( s, s->blockCRC );
/*--
Now a single bit indicating (non-)randomisation.
/*--
Now a single bit indicating (non-)randomisation.
As of version 0.9.5, we use a better sorting algorithm
which makes randomisation unnecessary. So always set
the randomised bit to 'no'. Of course, the decoder

View file

@ -12,7 +12,7 @@
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
This program is released under the terms of the license contained
@ -128,7 +128,7 @@ Int32 BZ2_decompress ( DState* s )
Int32 N;
Int32 curr;
Int32 zt;
Int32 zn;
Int32 zn;
Int32 zvec;
Int32 zj;
Int32 gSel;
@ -182,7 +182,7 @@ Int32 BZ2_decompress ( DState* s )
N = s->save_N;
curr = s->save_curr;
zt = s->save_zt;
zn = s->save_zn;
zn = s->save_zn;
zvec = s->save_zvec;
zj = s->save_zj;
gSel = s->save_gSel;
@ -205,14 +205,14 @@ Int32 BZ2_decompress ( DState* s )
if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC);
GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8)
if (s->blockSize100k < (BZ_HDR_0 + 1) ||
if (s->blockSize100k < (BZ_HDR_0 + 1) ||
s->blockSize100k > (BZ_HDR_0 + 9)) RETURN(BZ_DATA_ERROR_MAGIC);
s->blockSize100k -= BZ_HDR_0;
if (s->smallDecompress) {
s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) );
s->ll4 = BZALLOC(
((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar)
s->ll4 = BZALLOC(
((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar)
);
if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR);
} else {
@ -238,7 +238,7 @@ Int32 BZ2_decompress ( DState* s )
s->currBlockNo++;
if (s->verbosity >= 2)
VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo );
s->storedBlockCRC = 0;
GET_UCHAR(BZ_X_BCRC_1, uc);
s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
@ -261,14 +261,14 @@ Int32 BZ2_decompress ( DState* s )
if (s->origPtr < 0)
RETURN(BZ_DATA_ERROR);
if (s->origPtr > 10 + 100000*s->blockSize100k)
if (s->origPtr > 10 + 100000*s->blockSize100k)
RETURN(BZ_DATA_ERROR);
/*--- Receive the mapping table ---*/
for (i = 0; i < 16; i++) {
GET_BIT(BZ_X_MAPPING_1, uc);
if (uc == 1)
s->inUse16[i] = True; else
if (uc == 1)
s->inUse16[i] = True; else
s->inUse16[i] = False;
}
@ -310,7 +310,7 @@ Int32 BZ2_decompress ( DState* s )
{
UChar pos[BZ_N_GROUPS], tmp, v;
for (v = 0; v < nGroups; v++) pos[v] = v;
for (i = 0; i < nSelectors; i++) {
v = s->selectorMtf[i];
tmp = pos[v];
@ -343,10 +343,10 @@ Int32 BZ2_decompress ( DState* s )
if (s->len[t][i] > maxLen) maxLen = s->len[t][i];
if (s->len[t][i] < minLen) minLen = s->len[t][i];
}
BZ2_hbCreateDecodeTables (
&(s->limit[t][0]),
&(s->base[t][0]),
&(s->perm[t][0]),
BZ2_hbCreateDecodeTables (
&(s->limit[t][0]),
&(s->base[t][0]),
&(s->perm[t][0]),
&(s->len[t][0]),
minLen, maxLen, alphaSize
);
@ -445,23 +445,23 @@ Int32 BZ2_decompress ( DState* s )
s->mtfa[(z)-3] = s->mtfa[(z)-4];
nn -= 4;
}
while (nn > 0) {
s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--;
while (nn > 0) {
s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--;
};
s->mtfa[pp] = uc;
} else {
} else {
/* general case */
lno = nn / MTFL_SIZE;
off = nn % MTFL_SIZE;
pp = s->mtfbase[lno] + off;
uc = s->mtfa[pp];
while (pp > s->mtfbase[lno]) {
s->mtfa[pp] = s->mtfa[pp-1]; pp--;
while (pp > s->mtfbase[lno]) {
s->mtfa[pp] = s->mtfa[pp-1]; pp--;
};
s->mtfbase[lno]++;
while (lno > 0) {
s->mtfbase[lno]--;
s->mtfa[s->mtfbase[lno]]
s->mtfa[s->mtfbase[lno]]
= s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1];
lno--;
}
@ -556,7 +556,7 @@ Int32 BZ2_decompress ( DState* s )
if (s->blockRandomised) {
BZ_RAND_INIT_MASK;
BZ_GET_SMALL(s->k0); s->nblock_used++;
BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK;
BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK;
} else {
BZ_GET_SMALL(s->k0); s->nblock_used++;
}
@ -575,7 +575,7 @@ Int32 BZ2_decompress ( DState* s )
if (s->blockRandomised) {
BZ_RAND_INIT_MASK;
BZ_GET_FAST(s->k0); s->nblock_used++;
BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK;
BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK;
} else {
BZ_GET_FAST(s->k0); s->nblock_used++;
}
@ -644,7 +644,7 @@ Int32 BZ2_decompress ( DState* s )
s->save_gBase = gBase;
s->save_gPerm = gPerm;
return retVal;
return retVal;
}

View file

@ -7,7 +7,7 @@
# bzip2/libbzip2 version 1.0.8 of 13 July 2019
# Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
#
# Please read the WARNING, DISCLAIMER and PATENTS sections in the
# Please read the WARNING, DISCLAIMER and PATENTS sections in the
# README file.
#
# This program is released under the terms of the license contained
@ -30,14 +30,14 @@ if (! -r $infile) {
die "Can't read input $infile\n";
}
# check we can open infile
open( INFILE,"<$infile" ) or
open( INFILE,"<$infile" ) or
die "Can't input $infile $!";
#my $outfile = 'fmt-manual.xml';
my $outfile = shift;
#print "Infile: $infile, Outfile: $outfile\n";
# check we can write to outfile
open( OUTFILE,">$outfile" ) or
open( OUTFILE,">$outfile" ) or
die "Can't output $outfile $! for writing";
my ($prev, $curr, $str);

View file

@ -12,7 +12,7 @@
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
This program is released under the terms of the license contained
@ -63,7 +63,7 @@
/*---------------------------------------------------*/
void BZ2_hbMakeCodeLengths ( UChar *len,
void BZ2_hbMakeCodeLengths ( UChar *len,
Int32 *freq,
Int32 alphaSize,
Int32 maxLen )
@ -99,7 +99,7 @@ void BZ2_hbMakeCodeLengths ( UChar *len,
}
AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 );
while (nHeap > 1) {
n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1);
n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1);
@ -122,7 +122,7 @@ void BZ2_hbMakeCodeLengths ( UChar *len,
len[i-1] = j;
if (j > maxLen) tooLong = True;
}
if (! tooLong) break;
/* 17 Oct 04: keep-going condition for the following loop used

View file

@ -12,7 +12,7 @@
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
This program is released under the terms of the license contained
@ -24,58 +24,58 @@
/*---------------------------------------------*/
Int32 BZ2_rNums[512] = {
619, 720, 127, 481, 931, 816, 813, 233, 566, 247,
985, 724, 205, 454, 863, 491, 741, 242, 949, 214,
733, 859, 335, 708, 621, 574, 73, 654, 730, 472,
419, 436, 278, 496, 867, 210, 399, 680, 480, 51,
878, 465, 811, 169, 869, 675, 611, 697, 867, 561,
862, 687, 507, 283, 482, 129, 807, 591, 733, 623,
150, 238, 59, 379, 684, 877, 625, 169, 643, 105,
170, 607, 520, 932, 727, 476, 693, 425, 174, 647,
73, 122, 335, 530, 442, 853, 695, 249, 445, 515,
909, 545, 703, 919, 874, 474, 882, 500, 594, 612,
641, 801, 220, 162, 819, 984, 589, 513, 495, 799,
161, 604, 958, 533, 221, 400, 386, 867, 600, 782,
382, 596, 414, 171, 516, 375, 682, 485, 911, 276,
98, 553, 163, 354, 666, 933, 424, 341, 533, 870,
227, 730, 475, 186, 263, 647, 537, 686, 600, 224,
469, 68, 770, 919, 190, 373, 294, 822, 808, 206,
184, 943, 795, 384, 383, 461, 404, 758, 839, 887,
715, 67, 618, 276, 204, 918, 873, 777, 604, 560,
951, 160, 578, 722, 79, 804, 96, 409, 713, 940,
652, 934, 970, 447, 318, 353, 859, 672, 112, 785,
645, 863, 803, 350, 139, 93, 354, 99, 820, 908,
609, 772, 154, 274, 580, 184, 79, 626, 630, 742,
653, 282, 762, 623, 680, 81, 927, 626, 789, 125,
411, 521, 938, 300, 821, 78, 343, 175, 128, 250,
170, 774, 972, 275, 999, 639, 495, 78, 352, 126,
857, 956, 358, 619, 580, 124, 737, 594, 701, 612,
669, 112, 134, 694, 363, 992, 809, 743, 168, 974,
944, 375, 748, 52, 600, 747, 642, 182, 862, 81,
344, 805, 988, 739, 511, 655, 814, 334, 249, 515,
897, 955, 664, 981, 649, 113, 974, 459, 893, 228,
433, 837, 553, 268, 926, 240, 102, 654, 459, 51,
686, 754, 806, 760, 493, 403, 415, 394, 687, 700,
946, 670, 656, 610, 738, 392, 760, 799, 887, 653,
978, 321, 576, 617, 626, 502, 894, 679, 243, 440,
680, 879, 194, 572, 640, 724, 926, 56, 204, 700,
707, 151, 457, 449, 797, 195, 791, 558, 945, 679,
297, 59, 87, 824, 713, 663, 412, 693, 342, 606,
134, 108, 571, 364, 631, 212, 174, 643, 304, 329,
343, 97, 430, 751, 497, 314, 983, 374, 822, 928,
140, 206, 73, 263, 980, 736, 876, 478, 430, 305,
170, 514, 364, 692, 829, 82, 855, 953, 676, 246,
369, 970, 294, 750, 807, 827, 150, 790, 288, 923,
804, 378, 215, 828, 592, 281, 565, 555, 710, 82,
896, 831, 547, 261, 524, 462, 293, 465, 502, 56,
661, 821, 976, 991, 658, 869, 905, 758, 745, 193,
768, 550, 608, 933, 378, 286, 215, 979, 792, 961,
61, 688, 793, 644, 986, 403, 106, 366, 905, 644,
372, 567, 466, 434, 645, 210, 389, 550, 919, 135,
780, 773, 635, 389, 707, 100, 626, 958, 165, 504,
920, 176, 193, 713, 857, 265, 203, 50, 668, 108,
645, 990, 626, 197, 510, 357, 358, 850, 858, 364,
Int32 BZ2_rNums[512] = {
619, 720, 127, 481, 931, 816, 813, 233, 566, 247,
985, 724, 205, 454, 863, 491, 741, 242, 949, 214,
733, 859, 335, 708, 621, 574, 73, 654, 730, 472,
419, 436, 278, 496, 867, 210, 399, 680, 480, 51,
878, 465, 811, 169, 869, 675, 611, 697, 867, 561,
862, 687, 507, 283, 482, 129, 807, 591, 733, 623,
150, 238, 59, 379, 684, 877, 625, 169, 643, 105,
170, 607, 520, 932, 727, 476, 693, 425, 174, 647,
73, 122, 335, 530, 442, 853, 695, 249, 445, 515,
909, 545, 703, 919, 874, 474, 882, 500, 594, 612,
641, 801, 220, 162, 819, 984, 589, 513, 495, 799,
161, 604, 958, 533, 221, 400, 386, 867, 600, 782,
382, 596, 414, 171, 516, 375, 682, 485, 911, 276,
98, 553, 163, 354, 666, 933, 424, 341, 533, 870,
227, 730, 475, 186, 263, 647, 537, 686, 600, 224,
469, 68, 770, 919, 190, 373, 294, 822, 808, 206,
184, 943, 795, 384, 383, 461, 404, 758, 839, 887,
715, 67, 618, 276, 204, 918, 873, 777, 604, 560,
951, 160, 578, 722, 79, 804, 96, 409, 713, 940,
652, 934, 970, 447, 318, 353, 859, 672, 112, 785,
645, 863, 803, 350, 139, 93, 354, 99, 820, 908,
609, 772, 154, 274, 580, 184, 79, 626, 630, 742,
653, 282, 762, 623, 680, 81, 927, 626, 789, 125,
411, 521, 938, 300, 821, 78, 343, 175, 128, 250,
170, 774, 972, 275, 999, 639, 495, 78, 352, 126,
857, 956, 358, 619, 580, 124, 737, 594, 701, 612,
669, 112, 134, 694, 363, 992, 809, 743, 168, 974,
944, 375, 748, 52, 600, 747, 642, 182, 862, 81,
344, 805, 988, 739, 511, 655, 814, 334, 249, 515,
897, 955, 664, 981, 649, 113, 974, 459, 893, 228,
433, 837, 553, 268, 926, 240, 102, 654, 459, 51,
686, 754, 806, 760, 493, 403, 415, 394, 687, 700,
946, 670, 656, 610, 738, 392, 760, 799, 887, 653,
978, 321, 576, 617, 626, 502, 894, 679, 243, 440,
680, 879, 194, 572, 640, 724, 926, 56, 204, 700,
707, 151, 457, 449, 797, 195, 791, 558, 945, 679,
297, 59, 87, 824, 713, 663, 412, 693, 342, 606,
134, 108, 571, 364, 631, 212, 174, 643, 304, 329,
343, 97, 430, 751, 497, 314, 983, 374, 822, 928,
140, 206, 73, 263, 980, 736, 876, 478, 430, 305,
170, 514, 364, 692, 829, 82, 855, 953, 676, 246,
369, 970, 294, 750, 807, 827, 150, 790, 288, 923,
804, 378, 215, 828, 592, 281, 565, 555, 710, 82,
896, 831, 547, 261, 524, 462, 293, 465, 502, 56,
661, 821, 976, 991, 658, 869, 905, 758, 745, 193,
768, 550, 608, 933, 378, 286, 215, 979, 792, 961,
61, 688, 793, 644, 986, 403, 106, 366, 905, 644,
372, 567, 466, 434, 645, 210, 389, 550, 919, 135,
780, 773, 635, 389, 707, 100, 626, 958, 165, 504,
920, 176, 193, 713, 857, 265, 203, 50, 668, 108,
645, 990, 626, 197, 510, 357, 358, 850, 858, 364,
936, 638
};

View file

@ -7,7 +7,7 @@
support for large files (> 2GB) in a reasonable amount of time.
I suggest you use the undocumented --exponential option to
bzip2 when compressing the resulting file; this saves a bit of
time. Note: *don't* bother with --exponential when compressing
time. Note: *don't* bother with --exponential when compressing
Real Files; it'll just waste a lot of CPU time :-)
(but is otherwise harmless).
*/
@ -19,7 +19,7 @@
bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org>
Please read the WARNING, DISCLAIMER and PATENTS sections in the
Please read the WARNING, DISCLAIMER and PATENTS sections in the
README file.
This program is released under the terms of the license contained

View file

@ -1,4 +1,4 @@
Doing 6 tests (3 compress, 3 uncompress) ...
If there's a problem, things might stop at this point.

View file

@ -1,13 +1,13 @@
If you got this far and the 'cmp's didn't complain, it looks
like you're in business.
like you're in business.
To install in /usr/local/bin, /usr/local/lib, /usr/local/man and
To install in /usr/local/bin, /usr/local/lib, /usr/local/man and
/usr/local/include, type
make install
To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type
To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type
make install PREFIX=/xxx/yyy
@ -21,10 +21,10 @@ The -n instructs make to show the commands it would execute, but
not actually execute them.
Instructions for use are in the preformatted manual page, in the file
bzip2.txt. For more detailed documentation, read the full manual.
bzip2.txt. For more detailed documentation, read the full manual.
It is available in Postscript form (manual.ps), PDF form (manual.pdf),
and HTML form (manual.html).
You can also do "bzip2 --help" to see some helpful information.
You can also do "bzip2 --help" to see some helpful information.
"bzip2 -L" displays the software license.