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

@ -3,7 +3,7 @@ Argon2 reference source code package - reference C implementations
Copyright 2015 Copyright 2015
Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
You may use this work under the terms of a Creative Commons CC0 1.0 You may use this work under the terms of a Creative Commons CC0 1.0
License/Waiver or the Apache Public License 2.0, at your option. The terms of License/Waiver or the Apache Public License 2.0, at your option. The terms of
these licenses can be found at: these licenses can be found at:

View file

@ -5,7 +5,7 @@
bzip2/libbzip2 version 1.0.8 of 13 July 2019 bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org> 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. README file.
This program is released under the terms of the license contained This program is released under the terms of the license contained
@ -20,7 +20,7 @@ First version.
0.9.0a 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. don't need it, or even know about it.
@ -52,7 +52,7 @@ In bzlib.c:
bzBuffToBuffDecompress. Fixed. bzBuffToBuffDecompress. Fixed.
In compress.c: 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 do a bit better on small files. This _does_ effect
bzip2.c. bzip2.c.
@ -117,7 +117,7 @@ changes are minor documentation changes.
Several minor bugfixes and enhancements: Several minor bugfixes and enhancements:
* Large file support. The library uses 64-bit counters to * 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 is now compiled with -D_FILE_OFFSET_BITS=64 to get large
file support from the C library. -v correctly prints out file support from the C library. -v correctly prints out
file sizes greater than 4 gigabytes. All these changes have 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 * Decompression robustness. The library/program should be
robust to any corruption of compressed data, detecting and robust to any corruption of compressed data, detecting and
handling _all_ corruption, instead of merely relying on 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 never crash, given corrupted data, and the library should
always return BZ_DATA_ERROR. 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 * Don't run out of file handles on test/decompression when
large numbers of files have invalid magic numbers. 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_. symbols with BZ2_.
* Minor sorting enhancements from my DCC2000 paper. * Minor sorting enhancements from my DCC2000 paper.
* Advance the version number to 1.0, so as to counteract the * 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, with version numbers less than 1.0 are in some way, experimental,
pre-release versions. pre-release versions.
@ -156,10 +156,10 @@ Several minor bugfixes and enhancements:
* Make the program exit with 2 instead of 0 when decompression * Make the program exit with 2 instead of 0 when decompression
fails due to a bad magic number (ie, an invalid bzip2 header). fails due to a bad magic number (ie, an invalid bzip2 header).
Also exit with 1 (as the manual claims :-) whenever a diagnostic 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 is aborted, for example
bzip2: Output file xx already exists. 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 aborted, for example
bzip2: Can't guess original name for wurble -- using wurble.out bzip2: Can't guess original name for wurble -- using wurble.out
then the exit value 0 is returned, unless some other problem is 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. * Further robustification against corrupted compressed data.
There are currently no known bitstreams which can cause the There are currently no known bitstreams which can cause the
decompressor to crash, loop or access memory which does not 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 decompress bitstreams from untrusted sources, an upgrade
to 1.0.3 is recommended. This fixes CAN-2005-1260. 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 1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. notice, this list of conditions and the following disclaimer.
2. The origin of this software must not be misrepresented; you must 2. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product software in a product, an acknowledgment in the product
documentation would be appreciated but is not required. documentation would be appreciated but is not required.
3. Altered source versions must be plainly marked as such, and must 3. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. not be misrepresented as being the original software.
4. The name of the author may not be used to endorse or promote 4. The name of the author may not be used to endorse or promote
products derived from this software without specific prior written products derived from this software without specific prior written
permission. permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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. might want to read README.COMPILATION.PROBLEMS.
At least using MS Visual C++ 6, you can build from the unmodified 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 nmake -f makefile.msc
@ -103,12 +103,12 @@ Please read and be aware of the following:
WARNING: WARNING:
This program and library (attempts to) compress data by This program and library (attempts to) compress data by
performing several non-trivial transformations on it. performing several non-trivial transformations on it.
Unless you are 100% familiar with *all* the algorithms Unless you are 100% familiar with *all* the algorithms
contained herein, and with the consequences of modifying them, contained herein, and with the consequences of modifying them,
you should NOT meddle with the compression or decompression you should NOT meddle with the compression or decompression
machinery. Incorrect changes can and very likely *will* machinery. Incorrect changes can and very likely *will*
lead to disastrous loss of data. lead to disastrous loss of data.
@ -128,16 +128,16 @@ DISCLAIMER:
PROGRAM UNLESS YOU ARE PREPARED TO ACCEPT THE POSSIBILITY, HOWEVER PROGRAM UNLESS YOU ARE PREPARED TO ACCEPT THE POSSIBILITY, HOWEVER
SMALL, THAT THE DATA WILL NOT BE RECOVERABLE. SMALL, THAT THE DATA WILL NOT BE RECOVERABLE.
That is not to say this program is inherently unreliable. That is not to say this program is inherently unreliable.
Indeed, I very much hope the opposite is true. bzip2/libbzip2 Indeed, I very much hope the opposite is true. bzip2/libbzip2
has been carefully constructed and extensively tested. has been carefully constructed and extensively tested.
PATENTS: PATENTS:
To the best of my knowledge, bzip2/libbzip2 does not use any To the best of my knowledge, bzip2/libbzip2 does not use any
patented algorithms. However, I do not have the resources patented algorithms. However, I do not have the resources
to carry out a patent search. Therefore I cannot give any to carry out a patent search. Therefore I cannot give any
guarantee of the above statement. guarantee of the above statement.

View file

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

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# sh is buggy on RS/6000 AIX 3.2. Replace above line with #!/bin/ksh # 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. # 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- # 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 ] [ file2 ]
.SH DESCRIPTION .SH DESCRIPTION
.I Bzcmp .I Bzcmp
and and
.I bzdiff .I bzdiff
are used to invoke the are used to invoke the
.I cmp .I cmp
@ -32,7 +32,7 @@ If two files are specified, then they are uncompressed if necessary and fed to
.I cmp .I cmp
or or
.IR diff "." .IR diff "."
The exit status from The exit status from
.I cmp .I cmp
or or
.I diff .I diff

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Bzgrep wrapped for bzip2, # Bzgrep wrapped for bzip2,
# adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux. # adapted from zgrep by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
## zgrep notice: ## zgrep notice:
## zgrep -- a wrapper around a grep program that decompresses files as needed ## 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 .br
.B bunzip2 .B bunzip2
.RB [ " \-fkvsVL " ] .RB [ " \-fkvsVL " ]
[ [
.I "filenames \&..." .I "filenames \&..."
] ]
.br .br
.B bzcat .B bzcat
.RB [ " \-s " ] .RB [ " \-s " ]
[ [
.I "filenames \&..." .I "filenames \&..."
] ]
.br .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 LZ77/LZ78-based compressors, and approaches the performance of the PPM
family of statistical compressors. family of statistical compressors.
The command-line options are deliberately very similar to The command-line options are deliberately very similar to
those of those of
.I GNU gzip, .I GNU gzip,
but they are not identical. but they are not identical.
.I bzip2 .I bzip2
expects a list of file names to accompany the expects a list of file names to accompany the
command-line flags. Each file is replaced by a compressed version of 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 Each compressed file
has the same modification date, permissions, and, when possible, has the same modification date, permissions, and, when possible,
ownership as the corresponding original, so that these properties can ownership as the corresponding original, so that these properties can
@ -74,13 +74,13 @@ incomprehensible and therefore pointless.
.I bunzip2 .I bunzip2
(or (or
.I bzip2 \-d) .I bzip2 \-d)
decompresses all decompresses all
specified files. Files which were not created by specified files. Files which were not created by
.I bzip2 .I bzip2
will be detected and ignored, and a warning issued. will be detected and ignored, and a warning issued.
.I bzip2 .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: from that of the compressed file as follows:
filename.bz2 becomes filename filename.bz2 becomes filename
@ -89,13 +89,13 @@ from that of the compressed file as follows:
filename.tbz becomes filename.tar filename.tbz becomes filename.tar
anyothername becomes anyothername.out anyothername becomes anyothername.out
If the file does not end in one of the recognised endings, If the file does not end in one of the recognised endings,
.I .bz2, .I .bz2,
.I .bz, .I .bz,
.I .tbz2 .I .tbz2
or or
.I .tbz, .I .tbz,
.I bzip2 .I bzip2
complains that it cannot complains that it cannot
guess the name of the original file, and uses the original name guess the name of the original file, and uses the original name
with with
@ -103,25 +103,25 @@ with
appended. appended.
As with compression, supplying no As with compression, supplying no
filenames causes decompression from filenames causes decompression from
standard input to standard output. standard input to standard output.
.I bunzip2 .I bunzip2
will correctly decompress a file which is the will correctly decompress a file which is the
concatenation of two or more compressed files. The result is the concatenation of two or more compressed files. The result is the
concatenation of the corresponding uncompressed files. Integrity concatenation of the corresponding uncompressed files. Integrity
testing (\-t) testing (\-t)
of concatenated of concatenated
compressed files is also supported. compressed files is also supported.
You can also compress or decompress files to the standard output by You can also compress or decompress files to the standard output by
giving the \-c flag. Multiple files may be compressed and giving the \-c flag. Multiple files may be compressed and
decompressed like this. The resulting outputs are fed sequentially to 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 in this manner generates a stream
containing multiple compressed file representations. Such a stream containing multiple compressed file representations. Such a stream
can be decompressed correctly only by can be decompressed correctly only by
.I bzip2 .I bzip2
version 0.9.0 or version 0.9.0 or
later. Earlier versions of later. Earlier versions of
.I bzip2 .I bzip2
@ -130,7 +130,7 @@ the first file in the stream.
.I bzcat .I bzcat
(or (or
.I bzip2 -dc) .I bzip2 -dc)
decompresses all specified files to decompresses all specified files to
the standard output. the standard output.
@ -140,10 +140,10 @@ will read arguments from the environment variables
and and
.I BZIP, .I BZIP,
in that order, and will process them 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. 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 file is slightly
larger than the original. Files of less than about one hundred bytes larger than the original. Files of less than about one hundred bytes
tend to get larger, since the compression mechanism has a constant 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 of most file compressors) is coded at about 8.05 bits per byte, giving
an expansion of around 0.5%. an expansion of around 0.5%.
As a self-check for your protection, As a self-check for your protection,
.I .I
bzip2 bzip2
uses 32-bit CRCs to uses 32-bit CRCs to
make sure that the decompressed version of a file is identical to the 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 chances of data corruption going undetected is microscopic, about one
chance in four billion for each file processed. Be aware, though, that chance in four billion for each file processed. Be aware, though, that
the check occurs upon decompression, so it can only tell you 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 recover the original uncompressed
data. You can use data. You can use
.I bzip2recover .I bzip2recover
to try to recover data from to try to recover data from
damaged files. damaged files.
@ -183,15 +183,15 @@ to panic.
Compress or decompress to standard output. Compress or decompress to standard output.
.TP .TP
.B \-d --decompress .B \-d --decompress
Force decompression. Force decompression.
.I bzip2, .I bzip2,
.I bunzip2 .I bunzip2
and and
.I bzcat .I bzcat
are are
really the same program, and the decision about what actions to take is 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 done on the basis of which name is used. This flag overrides that
mechanism, and forces mechanism, and forces
.I bzip2 .I bzip2
to decompress. to decompress.
.TP .TP
@ -205,10 +205,10 @@ This really performs a trial decompression and throws away the result.
.TP .TP
.B \-f --force .B \-f --force
Force overwrite of output files. Normally, Force overwrite of output files. Normally,
.I bzip2 .I bzip2
will not overwrite will not overwrite
existing output files. Also forces existing output files. Also forces
.I bzip2 .I bzip2
to break hard links to break hard links
to files, which it otherwise wouldn't do. 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) .B \-1 (or \-\-fast) to \-9 (or \-\-best)
Set the block size to 100 k, 200 k .. 900 k when compressing. Has no Set the block size to 100 k, 200 k .. 900 k when compressing. Has no
effect when decompressing. See MEMORY MANAGEMENT below. 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 compatibility. In particular, \-\-fast doesn't make things
significantly faster. significantly faster.
And \-\-best merely selects the default behaviour. And \-\-best merely selects the default behaviour.
.TP .TP
.B \-- .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. improved algorithm which renders these flags irrelevant.
.SH MEMORY MANAGEMENT .SH MEMORY MANAGEMENT
.I bzip2 .I bzip2
compresses large files in blocks. The block size affects compresses large files in blocks. The block size affects
both the compression ratio achieved, and the amount of memory needed for both the compression ratio achieved, and the amount of memory needed for
compression and decompression. The flags \-1 through \-9 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 that the flags \-1 to \-9 are irrelevant to and so ignored
during decompression. during decompression.
Compression and decompression requirements, Compression and decompression requirements,
in bytes, can be estimated as: in bytes, can be estimated as:
Compression: 400k + ( 8 x block size ) 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, For files compressed with the default 900k block size,
.I bunzip2 .I bunzip2
will require about 3700 kbytes to decompress. To support decompression 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 .I bunzip2
has an option to has an option to
decompress using approximately half this amount of memory, about 2300 decompress using approximately half this amount of memory, about 2300
@ -350,20 +350,20 @@ damaged blocks can be distinguished from undamaged ones.
.I bzip2recover .I bzip2recover
is a simple program whose purpose is to search for 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 file. You can then use
.I bzip2 .I bzip2
\-t \-t
to test the to test the
integrity of the resulting files, and decompress those which are integrity of the resulting files, and decompress those which are
undamaged. undamaged.
.I bzip2recover .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", and writes a number of files "rec00001file.bz2",
"rec00002file.bz2", etc, containing the extracted blocks. "rec00002file.bz2", etc, containing the extracted blocks.
The output filenames are designed so that the use of 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 "bzip2 -dc rec*file.bz2 > recovered_data" -- processes the files in
the correct order. the correct order.
@ -371,8 +371,8 @@ the correct order.
should be of most use dealing with large .bz2 should be of most use dealing with large .bz2
files, as these will contain many blocks. It is clearly files, as these will contain many blocks. It is clearly
futile to use it on damaged single-block files, since a futile to use it on damaged single-block files, since a
damaged block cannot be recovered. If you wish to minimise damaged block cannot be recovered. If you wish to minimise
any potential data loss through media or transmission errors, any potential data loss through media or transmission errors,
you might consider compressing with a smaller you might consider compressing with a smaller
block size. 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. 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 Because of this, small changes to the code to reduce the miss rate have
been observed to give disproportionately large performance improvements. been observed to give disproportionately large performance improvements.
I imagine I imagine
.I bzip2 .I bzip2
will perform best on machines with very large caches. 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. what the problem is sometimes seem rather misleading.
This manual page pertains to version 1.0.8 of This manual page pertains to version 1.0.8 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, 1.0.2 and above, but with the following 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, .I bzip,
and many refinements), and Alistair Moffat, Radford Neal and Ian Witten and many refinements), and Alistair Moffat, Radford Neal and Ian Witten
(for the arithmetic coder in the original (for the arithmetic coder in the original
.I bzip). .I bzip).
I am much I am much
indebted for their help, support and advice. See the manual in the indebted for their help, support and advice. See the manual in the
source distribution for pointers to sources of documentation. Christian source distribution for pointers to sources of documentation. Christian
von Roques encouraged me to look for faster sorting algorithms, so as to von Roques encouraged me to look for faster sorting algorithms, so as to
speed up compression. Bela Lubkin encouraged me to improve the speed up compression. Bela Lubkin encouraged me to improve the
worst-case compression performance. worst-case compression performance.
Donna Robinson XMLised the documentation. Donna Robinson XMLised the documentation.
The bz* scripts are derived from those of GNU gzip. The bz* scripts are derived from those of GNU gzip.
Many people sent patches, helped 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- 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 pressed data created by this version is entirely forwards
and backwards compatible with the previous public 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 1.0.2 and above, but with the following exception: 0.9.0
and above can correctly decompress multiple concatenated 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. 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 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 bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org> 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. README file.
This program is released under the terms of the license contained This program is released under the terms of the license contained
@ -76,7 +76,7 @@ typedef int Int32;
typedef unsigned int UInt32; typedef unsigned int UInt32;
typedef short Int16; typedef short Int16;
typedef unsigned short UInt16; typedef unsigned short UInt16;
#define True ((Bool)1) #define True ((Bool)1)
#define False ((Bool)0) #define False ((Bool)0)
@ -141,7 +141,7 @@ static void applySavedFileAttrToOutputFile ( IntNative fd );
/*---------------------------------------------------*/ /*---------------------------------------------------*/
typedef typedef
struct { UChar b[8]; } struct { UChar b[8]; }
UInt64; UInt64;
@ -184,7 +184,7 @@ Bool uInt64_isZero ( UInt64* n )
/* Divide *n by 10, and return the remainder. */ /* Divide *n by 10, and return the remainder. */
static static
Int32 uInt64_qrm10 ( UInt64* n ) Int32 uInt64_qrm10 ( UInt64* n )
{ {
UInt32 rem, tmp; UInt32 rem, tmp;
@ -215,7 +215,7 @@ void uInt64_toAscii ( char* outbuf, UInt64* n )
nBuf++; nBuf++;
} while (!uInt64_isZero(&n_copy)); } while (!uInt64_isZero(&n_copy));
outbuf[nBuf] = 0; outbuf[nBuf] = 0;
for (i = 0; i < nBuf; i++) for (i = 0; i < nBuf; i++)
outbuf[i] = buf[nBuf-i-1]; outbuf[i] = buf[nBuf-i-1];
} }
@ -225,7 +225,7 @@ void uInt64_toAscii ( char* outbuf, UInt64* n )
/*---------------------------------------------------*/ /*---------------------------------------------------*/
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
Bool myfeof ( FILE* f ) Bool myfeof ( FILE* f )
{ {
Int32 c = fgetc ( f ); Int32 c = fgetc ( f );
@ -236,7 +236,7 @@ Bool myfeof ( FILE* f )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void compressStream ( FILE *stream, FILE *zStream ) void compressStream ( FILE *stream, FILE *zStream )
{ {
BZFILE* bzf = NULL; BZFILE* bzf = NULL;
@ -252,8 +252,8 @@ void compressStream ( FILE *stream, FILE *zStream )
if (ferror(stream)) goto errhandler_io; if (ferror(stream)) goto errhandler_io;
if (ferror(zStream)) goto errhandler_io; if (ferror(zStream)) goto errhandler_io;
bzf = BZ2_bzWriteOpen ( &bzerr, zStream, bzf = BZ2_bzWriteOpen ( &bzerr, zStream,
blockSize100k, verbosity, workFactor ); blockSize100k, verbosity, workFactor );
if (bzerr != BZ_OK) goto errhandler; if (bzerr != BZ_OK) goto errhandler;
if (verbosity >= 2) (fprintf) ( stderr, "\n" ); 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_in_lo32, &nbytes_in_hi32,
&nbytes_out_lo32, &nbytes_out_hi32 ); &nbytes_out_lo32, &nbytes_out_hi32 );
if (bzerr != BZ_OK) goto errhandler; if (bzerr != BZ_OK) goto errhandler;
@ -296,9 +296,9 @@ void compressStream ( FILE *stream, FILE *zStream )
Char buf_nin[32], buf_nout[32]; Char buf_nin[32], buf_nout[32];
UInt64 nbytes_in, nbytes_out; UInt64 nbytes_in, nbytes_out;
double nbytes_in_d, nbytes_out_d; double nbytes_in_d, nbytes_out_d;
uInt64_from_UInt32s ( &nbytes_in, uInt64_from_UInt32s ( &nbytes_in,
nbytes_in_lo32, nbytes_in_hi32 ); nbytes_in_lo32, nbytes_in_hi32 );
uInt64_from_UInt32s ( &nbytes_out, uInt64_from_UInt32s ( &nbytes_out,
nbytes_out_lo32, nbytes_out_hi32 ); nbytes_out_lo32, nbytes_out_hi32 );
nbytes_in_d = uInt64_to_double ( &nbytes_in ); nbytes_in_d = uInt64_to_double ( &nbytes_in );
nbytes_out_d = uInt64_to_double ( &nbytes_out ); nbytes_out_d = uInt64_to_double ( &nbytes_out );
@ -318,7 +318,7 @@ void compressStream ( FILE *stream, FILE *zStream )
return; return;
errhandler: errhandler:
BZ2_bzWriteClose64 ( &bzerr_dummy, bzf, 1, BZ2_bzWriteClose64 ( &bzerr_dummy, bzf, 1,
&nbytes_in_lo32, &nbytes_in_hi32, &nbytes_in_lo32, &nbytes_in_hi32,
&nbytes_out_lo32, &nbytes_out_hi32 ); &nbytes_out_lo32, &nbytes_out_hi32 );
switch (bzerr) { switch (bzerr) {
@ -340,7 +340,7 @@ void compressStream ( FILE *stream, FILE *zStream )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
Bool uncompressStream ( FILE *zStream, FILE *stream ) Bool uncompressStream ( FILE *zStream, FILE *stream )
{ {
BZFILE* bzf = NULL; BZFILE* bzf = NULL;
@ -362,8 +362,8 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
while (True) { while (True) {
bzf = BZ2_bzReadOpen ( bzf = BZ2_bzReadOpen (
&bzerr, zStream, verbosity, &bzerr, zStream, verbosity,
(int)smallMode, unused, nUnused (int)smallMode, unused, nUnused
); );
if (bzf == NULL || bzerr != BZ_OK) goto errhandler; if (bzf == NULL || bzerr != BZ_OK) goto errhandler;
@ -412,7 +412,7 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
if (verbosity >= 2) (fprintf) ( stderr, "\n " ); if (verbosity >= 2) (fprintf) ( stderr, "\n " );
return True; return True;
trycat: trycat:
if (forceOverwrite) { if (forceOverwrite) {
rewind(zStream); rewind(zStream);
while (True) { while (True) {
@ -424,7 +424,7 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
} }
goto closeok; goto closeok;
} }
errhandler: errhandler:
BZ2_bzReadClose ( &bzerr_dummy, bzf ); BZ2_bzReadClose ( &bzerr_dummy, bzf );
switch (bzerr) { switch (bzerr) {
@ -446,10 +446,10 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
return False; return False;
} else { } else {
if (noisy) if (noisy)
(fprintf) ( stderr, (fprintf) ( stderr,
"\n%s: %s: trailing garbage after EOF ignored\n", "\n%s: %s: trailing garbage after EOF ignored\n",
progName, inName ); progName, inName );
return True; return True;
} }
default: default:
panic ( "decompress:unexpected error" ); panic ( "decompress:unexpected error" );
@ -461,7 +461,7 @@ Bool uncompressStream ( FILE *zStream, FILE *stream )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
Bool testStream ( FILE *zStream ) Bool testStream ( FILE *zStream )
{ {
BZFILE* bzf = NULL; BZFILE* bzf = NULL;
@ -480,8 +480,8 @@ Bool testStream ( FILE *zStream )
while (True) { while (True) {
bzf = BZ2_bzReadOpen ( bzf = BZ2_bzReadOpen (
&bzerr, zStream, verbosity, &bzerr, zStream, verbosity,
(int)smallMode, unused, nUnused (int)smallMode, unused, nUnused
); );
if (bzf == NULL || bzerr != BZ_OK) goto errhandler; if (bzf == NULL || bzerr != BZ_OK) goto errhandler;
@ -514,7 +514,7 @@ Bool testStream ( FILE *zStream )
errhandler: errhandler:
BZ2_bzReadClose ( &bzerr_dummy, bzf ); BZ2_bzReadClose ( &bzerr_dummy, bzf );
if (verbosity == 0) if (verbosity == 0)
(fprintf) ( stderr, "%s: %s: ", progName, inName ); (fprintf) ( stderr, "%s: %s: ", progName, inName );
switch (bzerr) { switch (bzerr) {
case BZ_CONFIG_ERROR: case BZ_CONFIG_ERROR:
@ -535,14 +535,14 @@ Bool testStream ( FILE *zStream )
case BZ_DATA_ERROR_MAGIC: case BZ_DATA_ERROR_MAGIC:
if (zStream != stdin) fclose(zStream); if (zStream != stdin) fclose(zStream);
if (streamNo == 1) { if (streamNo == 1) {
(fprintf) ( stderr, (fprintf) ( stderr,
"bad magic number (file not created by bzip2)\n" ); "bad magic number (file not created by bzip2)\n" );
return False; return False;
} else { } else {
if (noisy) if (noisy)
(fprintf) ( stderr, (fprintf) ( stderr,
"trailing garbage after EOF ignored\n" ); "trailing garbage after EOF ignored\n" );
return True; return True;
} }
default: default:
panic ( "test:unexpected error" ); panic ( "test:unexpected error" );
@ -566,7 +566,7 @@ void setExit ( Int32 v )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void cadvise ( void ) void cadvise ( void )
{ {
if (noisy) if (noisy)
@ -581,26 +581,26 @@ void cadvise ( void )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void showFileNames ( void ) void showFileNames ( void )
{ {
if (noisy) if (noisy)
(fprintf) ( (fprintf) (
stderr, stderr,
"\tInput file = %s, output file = %s\n", "\tInput file = %s, output file = %s\n",
inName, outName inName, outName
); );
} }
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void cleanUpAndFail ( Int32 ec ) void cleanUpAndFail ( Int32 ec )
{ {
IntNative retVal; IntNative retVal;
struct MY_STAT statBuf; struct MY_STAT statBuf;
if ( srcMode == SM_F2F if ( srcMode == SM_F2F
&& opMode != OM_TEST && opMode != OM_TEST
&& deleteOutputOnInterrupt ) { && deleteOutputOnInterrupt ) {
@ -612,7 +612,7 @@ void cleanUpAndFail ( Int32 ec )
retVal = MY_STAT ( inName, &statBuf ); retVal = MY_STAT ( inName, &statBuf );
if (retVal == 0) { if (retVal == 0) {
if (noisy) if (noisy)
(fprintf) ( stderr, (fprintf) ( stderr,
"%s: Deleting output file %s, if it exists.\n", "%s: Deleting output file %s, if it exists.\n",
progName, outName ); progName, outName );
if (outputHandleJustInCase != NULL) if (outputHandleJustInCase != NULL)
@ -633,7 +633,7 @@ void cleanUpAndFail ( Int32 ec )
(fprintf) ( stderr, (fprintf) ( stderr,
"%s: `%s' may be incomplete.\n", "%s: `%s' may be incomplete.\n",
progName, outName ); progName, outName );
(fprintf) ( stderr, (fprintf) ( stderr,
"%s: I suggest doing an integrity test (bzip2 -tv)" "%s: I suggest doing an integrity test (bzip2 -tv)"
" of it.\n", " of it.\n",
progName ); progName );
@ -641,7 +641,7 @@ void cleanUpAndFail ( Int32 ec )
} }
if (noisy && numFileNames > 0 && numFilesProcessed < numFileNames) { if (noisy && numFileNames > 0 && numFilesProcessed < numFileNames) {
(fprintf) ( stderr, (fprintf) ( stderr,
"%s: WARNING: some files have not been processed:\n" "%s: WARNING: some files have not been processed:\n"
"%s: %d specified on command line, %d not processed yet.\n\n", "%s: %d specified on command line, %d not processed yet.\n\n",
progName, progName, progName, progName,
@ -653,7 +653,7 @@ void cleanUpAndFail ( Int32 ec )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void panic ( const Char* s ) void panic ( const Char* s )
{ {
(fprintf) ( stderr, (fprintf) ( stderr,
@ -668,7 +668,7 @@ void panic ( const Char* s )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void crcError ( void ) void crcError ( void )
{ {
(fprintf) ( stderr, (fprintf) ( stderr,
@ -681,7 +681,7 @@ void crcError ( void )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void compressedStreamEOF ( void ) void compressedStreamEOF ( void )
{ {
if (noisy) { if (noisy) {
@ -698,7 +698,7 @@ void compressedStreamEOF ( void )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void ioError ( void ) void ioError ( void )
{ {
(fprintf) ( stderr, (fprintf) ( stderr,
@ -712,7 +712,7 @@ void ioError ( void )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void mySignalCatcher ( IntNative n ) void mySignalCatcher ( IntNative n )
{ {
(fprintf) ( stderr, (fprintf) ( stderr,
@ -723,11 +723,11 @@ void mySignalCatcher ( IntNative n )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void mySIGSEGVorSIGBUScatcher ( IntNative n ) void mySIGSEGVorSIGBUScatcher ( IntNative n )
{ {
if (opMode == OM_Z) if (opMode == OM_Z)
(fprintf) ( (fprintf) (
stderr, stderr,
"\n%s: Caught a SIGSEGV or SIGBUS whilst compressing.\n" "\n%s: Caught a SIGSEGV or SIGBUS whilst compressing.\n"
"\n" "\n"
@ -748,7 +748,7 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n )
"\n", "\n",
progName ); progName );
else else
(fprintf) ( (fprintf) (
stderr, stderr,
"\n%s: Caught a SIGSEGV or SIGBUS whilst decompressing.\n" "\n%s: Caught a SIGSEGV or SIGBUS whilst decompressing.\n"
"\n" "\n"
@ -779,7 +779,7 @@ void mySIGSEGVorSIGBUScatcher ( IntNative n )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void outOfMemory ( void ) void outOfMemory ( void )
{ {
(fprintf) ( stderr, (fprintf) ( stderr,
@ -791,7 +791,7 @@ void outOfMemory ( void )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void configError ( void ) void configError ( void )
{ {
(fprintf) ( stderr, (fprintf) ( stderr,
@ -811,11 +811,11 @@ void configError ( void )
/* All rather crufty. The main problem is that input files /* All rather crufty. The main problem is that input files
are stat()d multiple times before use. This should be are stat()d multiple times before use. This should be
cleaned up. cleaned up.
*/ */
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void pad ( Char *s ) void pad ( Char *s )
{ {
Int32 i; Int32 i;
@ -826,8 +826,8 @@ void pad ( Char *s )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void copyFileName ( Char* to, Char* from ) void copyFileName ( Char* to, Char* from )
{ {
if ( strlen(from) > FILE_NAME_LEN-10 ) { if ( strlen(from) > FILE_NAME_LEN-10 ) {
(fprintf) ( (fprintf) (
@ -847,7 +847,7 @@ void copyFileName ( Char* to, Char* from )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
Bool fileExists ( Char* name ) Bool fileExists ( Char* name )
{ {
FILE *tmp = fopen ( name, "rb" ); FILE *tmp = fopen ( name, "rb" );
@ -888,7 +888,7 @@ FILE* fopen_output_safely ( Char* name, const char* mode )
/*-- /*--
if in doubt, return True if in doubt, return True
--*/ --*/
static static
Bool notAStandardFile ( Char* name ) Bool notAStandardFile ( Char* name )
{ {
IntNative i; IntNative i;
@ -905,9 +905,9 @@ Bool notAStandardFile ( Char* name )
/*-- /*--
rac 11/21/98 see if file has hard links to it rac 11/21/98 see if file has hard links to it
--*/ --*/
static static
Int32 countHardLinks ( Char* name ) Int32 countHardLinks ( Char* name )
{ {
IntNative i; IntNative i;
struct MY_STAT statBuf; struct MY_STAT statBuf;
@ -938,14 +938,14 @@ Int32 countHardLinks ( Char* name )
It sounds pretty fragile to me. Whether this carries across It sounds pretty fragile to me. Whether this carries across
robustly to arbitrary Unix-like platforms (or even works robustly 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 #if BZ_UNIX
static static
struct MY_STAT fileMetaInfo; struct MY_STAT fileMetaInfo;
#endif #endif
static static
void saveInputFileMetaInfo ( Char *srcName ) void saveInputFileMetaInfo ( Char *srcName )
{ {
# if BZ_UNIX # if BZ_UNIX
@ -957,7 +957,7 @@ void saveInputFileMetaInfo ( Char *srcName )
} }
static static
void applySavedTimeInfoToOutputFile ( Char *dstName ) void applySavedTimeInfoToOutputFile ( Char *dstName )
{ {
# if BZ_UNIX # if BZ_UNIX
@ -972,7 +972,7 @@ void applySavedTimeInfoToOutputFile ( Char *dstName )
# endif # endif
} }
static static
void applySavedFileAttrToOutputFile ( IntNative fd ) void applySavedFileAttrToOutputFile ( IntNative fd )
{ {
# if BZ_UNIX # if BZ_UNIX
@ -990,7 +990,7 @@ void applySavedFileAttrToOutputFile ( IntNative fd )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
Bool containsDubiousChars ( Char* name ) Bool containsDubiousChars ( Char* name )
{ {
# if BZ_UNIX # if BZ_UNIX
@ -999,7 +999,7 @@ Bool containsDubiousChars ( Char* name )
*/ */
return False; return False;
# else /* ! BZ_UNIX */ # 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. * filenames.
*/ */
for (; *name != '\0'; name++) for (; *name != '\0'; name++)
@ -1012,12 +1012,12 @@ Bool containsDubiousChars ( Char* name )
/*---------------------------------------------*/ /*---------------------------------------------*/
#define BZ_N_SUFFIX_PAIRS 4 #define BZ_N_SUFFIX_PAIRS 4
const Char* zSuffix[BZ_N_SUFFIX_PAIRS] const Char* zSuffix[BZ_N_SUFFIX_PAIRS]
= { ".bz2", ".bz", ".tbz2", ".tbz" }; = { ".bz2", ".bz", ".tbz2", ".tbz" };
const Char* unzSuffix[BZ_N_SUFFIX_PAIRS] const Char* unzSuffix[BZ_N_SUFFIX_PAIRS]
= { "", "", ".tar", ".tar" }; = { "", "", ".tar", ".tar" };
static static
Bool hasSuffix ( Char* s, const Char* suffix ) Bool hasSuffix ( Char* s, const Char* suffix )
{ {
Int32 ns = strlen(s); Int32 ns = strlen(s);
@ -1027,9 +1027,9 @@ Bool hasSuffix ( Char* s, const Char* suffix )
return False; return False;
} }
static static
Bool mapSuffix ( Char* name, Bool mapSuffix ( Char* name,
const Char* oldSuffix, const Char* oldSuffix,
const Char* newSuffix ) const Char* newSuffix )
{ {
if (!hasSuffix(name,oldSuffix)) return False; if (!hasSuffix(name,oldSuffix)) return False;
@ -1040,7 +1040,7 @@ Bool mapSuffix ( Char* name,
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void compress ( Char *name ) void compress ( Char *name )
{ {
FILE *inStr; FILE *inStr;
@ -1054,18 +1054,18 @@ void compress ( Char *name )
panic ( "compress: bad modes\n" ); panic ( "compress: bad modes\n" );
switch (srcMode) { switch (srcMode) {
case SM_I2O: case SM_I2O:
copyFileName ( inName, (Char*)"(stdin)" ); copyFileName ( inName, (Char*)"(stdin)" );
copyFileName ( outName, (Char*)"(stdout)" ); copyFileName ( outName, (Char*)"(stdout)" );
break; break;
case SM_F2F: case SM_F2F:
copyFileName ( inName, name ); copyFileName ( inName, name );
copyFileName ( outName, name ); copyFileName ( outName, name );
strcat ( outName, ".bz2" ); strcat ( outName, ".bz2" );
break; break;
case SM_F2O: case SM_F2O:
copyFileName ( inName, name ); copyFileName ( inName, name );
copyFileName ( outName, (Char*)"(stdout)" ); copyFileName ( outName, (Char*)"(stdout)" );
break; break;
} }
@ -1085,7 +1085,7 @@ void compress ( Char *name )
for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) { for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) {
if (hasSuffix(inName, zSuffix[i])) { if (hasSuffix(inName, zSuffix[i])) {
if (noisy) if (noisy)
(fprintf) ( stderr, (fprintf) ( stderr,
"%s: Input file %s already has %s suffix.\n", "%s: Input file %s already has %s suffix.\n",
progName, inName, zSuffix[i] ); progName, inName, zSuffix[i] );
setExit(1); setExit(1);
@ -1221,7 +1221,7 @@ void compress ( Char *name )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void uncompress ( Char *name ) void uncompress ( Char *name )
{ {
FILE *inStr; FILE *inStr;
@ -1238,22 +1238,22 @@ void uncompress ( Char *name )
cantGuess = False; cantGuess = False;
switch (srcMode) { switch (srcMode) {
case SM_I2O: case SM_I2O:
copyFileName ( inName, (Char*)"(stdin)" ); copyFileName ( inName, (Char*)"(stdin)" );
copyFileName ( outName, (Char*)"(stdout)" ); copyFileName ( outName, (Char*)"(stdout)" );
break; break;
case SM_F2F: case SM_F2F:
copyFileName ( inName, name ); copyFileName ( inName, name );
copyFileName ( outName, name ); copyFileName ( outName, name );
for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++) for (i = 0; i < BZ_N_SUFFIX_PAIRS; i++)
if (mapSuffix(outName,zSuffix[i],unzSuffix[i])) if (mapSuffix(outName,zSuffix[i],unzSuffix[i]))
goto zzz; goto zzz;
cantGuess = True; cantGuess = True;
strcat ( outName, ".out" ); strcat ( outName, ".out" );
break; break;
case SM_F2O: case SM_F2O:
copyFileName ( inName, name ); copyFileName ( inName, name );
copyFileName ( outName, (Char*)"(stdout)" ); copyFileName ( outName, (Char*)"(stdout)" );
break; break;
} }
@ -1290,11 +1290,11 @@ void uncompress ( Char *name )
} }
if ( /* srcMode == SM_F2F implied && */ cantGuess ) { if ( /* srcMode == SM_F2F implied && */ cantGuess ) {
if (noisy) if (noisy)
(fprintf) ( stderr, (fprintf) ( stderr,
"%s: Can't guess original name for %s -- using %s\n", "%s: Can't guess original name for %s -- using %s\n",
progName, inName, outName ); progName, inName, outName );
/* just a warning, no return */ /* just a warning, no return */
} }
if ( srcMode == SM_F2F && fileExists ( outName ) ) { if ( srcMode == SM_F2F && fileExists ( outName ) ) {
if (forceOverwrite) { if (forceOverwrite) {
remove(outName); remove(outName);
@ -1419,7 +1419,7 @@ void uncompress ( Char *name )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void testf ( Char *name ) void testf ( Char *name )
{ {
FILE *inStr; FILE *inStr;
@ -1508,7 +1508,7 @@ void testf ( Char *name )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void license ( void ) void license ( void )
{ {
(fprintf) ( stderr, (fprintf) ( stderr,
@ -1533,7 +1533,7 @@ void license ( void )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void usage ( Char *fullProgName ) void usage ( Char *fullProgName )
{ {
(fprintf) ( (fprintf) (
@ -1577,11 +1577,11 @@ void usage ( Char *fullProgName )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void redundant ( Char* flag ) void redundant ( Char* flag )
{ {
(fprintf) ( (fprintf) (
stderr, stderr,
"%s: %s is redundant in versions 0.9.5 and above\n", "%s: %s is redundant in versions 0.9.5 and above\n",
progName, flag ); progName, flag );
} }
@ -1593,8 +1593,8 @@ void redundant ( Char* flag )
implement a linked list of command-line arguments, implement a linked list of command-line arguments,
into which main() copies argv[1 .. argc-1]. into which main() copies argv[1 .. argc-1].
The purpose of this exercise is to facilitate The purpose of this exercise is to facilitate
the expansion of wildcard characters * and ? in the expansion of wildcard characters * and ? in
filenames for OSs which don't know how to do it filenames for OSs which don't know how to do it
themselves, like MSDOS, Windows 95 and NT. themselves, like MSDOS, Windows 95 and NT.
@ -1611,7 +1611,7 @@ typedef
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void *myMalloc ( Int32 n ) void *myMalloc ( Int32 n )
{ {
void* p; void* p;
@ -1623,7 +1623,7 @@ void *myMalloc ( Int32 n )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
Cell *mkCell ( void ) Cell *mkCell ( void )
{ {
Cell *c; Cell *c;
@ -1636,7 +1636,7 @@ Cell *mkCell ( void )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
Cell *snocString ( Cell *root, Char *name ) Cell *snocString ( Cell *root, Char *name )
{ {
if (root == NULL) { if (root == NULL) {
@ -1654,8 +1654,8 @@ Cell *snocString ( Cell *root, Char *name )
/*---------------------------------------------*/ /*---------------------------------------------*/
static static
void addFlagsFromEnvVar ( Cell** argList, Char* varName ) void addFlagsFromEnvVar ( Cell** argList, Char* varName )
{ {
Int32 i, j, k; Int32 i, j, k;
Char *envbase, *p; Char *envbase, *p;
@ -1732,7 +1732,7 @@ IntNative main ( IntNative argc, Char *argv[] )
if (*tmp == PATH_SEP) progName = tmp + 1; 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. expand filename wildcards in arg list.
--*/ --*/
argList = NULL; argList = NULL;
@ -1815,7 +1815,7 @@ IntNative main ( IntNative argc, Char *argv[] )
} }
} }
} }
/*-- And again ... --*/ /*-- And again ... --*/
for (aa = argList; aa != NULL; aa = aa->link) { for (aa = argList; aa != NULL; aa = aa->link) {
if (ISFLAG("--")) break; if (ISFLAG("--")) break;
@ -1829,7 +1829,7 @@ IntNative main ( IntNative argc, Char *argv[] )
if (ISFLAG("--quiet")) noisy = False; else if (ISFLAG("--quiet")) noisy = False; else
if (ISFLAG("--version")) license(); else if (ISFLAG("--version")) license(); else
if (ISFLAG("--license")) 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-best")) redundant(aa->name); else
if (ISFLAG("--repetitive-fast")) redundant(aa->name); else if (ISFLAG("--repetitive-fast")) redundant(aa->name); else
if (ISFLAG("--fast")) blockSize100k = 1; else if (ISFLAG("--fast")) blockSize100k = 1; else
@ -1845,7 +1845,7 @@ IntNative main ( IntNative argc, Char *argv[] )
} }
if (verbosity > 4) verbosity = 4; if (verbosity > 4) verbosity = 4;
if (opMode == OM_Z && smallMode && blockSize100k > 2) if (opMode == OM_Z && smallMode && blockSize100k > 2)
blockSize100k = 2; blockSize100k = 2;
if (opMode == OM_TEST && srcMode == SM_F2O) { if (opMode == OM_TEST && srcMode == SM_F2O) {
@ -1879,7 +1879,7 @@ IntNative main ( IntNative argc, Char *argv[] )
compress ( aa->name ); compress ( aa->name );
} }
} }
} }
else else
if (opMode == OM_UNZ) { if (opMode == OM_UNZ) {
@ -1893,13 +1893,13 @@ IntNative main ( IntNative argc, Char *argv[] )
if (aa->name[0] == '-' && decode) continue; if (aa->name[0] == '-' && decode) continue;
numFilesProcessed++; numFilesProcessed++;
uncompress ( aa->name ); uncompress ( aa->name );
} }
} }
if (unzFailsExist) { if (unzFailsExist) {
setExit(2); setExit(2);
exit(exitValue); exit(exitValue);
} }
} }
else { else {
testFailsExist = False; 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. (eg) Purify, Checker. Serves no other useful purpose.
*/ */
aa = argList; aa = argList;

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Bzmore wrapped for bzip2, # Bzmore wrapped for bzip2,
# adapted from zmore by Philippe Troin <phil@fifi.org> for Debian GNU/Linux. # adapted from zmore by Philippe Troin <phil@fifi.org> for Debian GNU/Linux.
PATH="/usr/bin:$PATH"; export PATH PATH="/usr/bin:$PATH"; export PATH
@ -43,7 +43,7 @@ else
if test $FIRST -eq 0; then if test $FIRST -eq 0; then
echo $n1 "--More--(Next file: $FILE)$n2" echo $n1 "--More--(Next file: $FILE)$n2"
stty $cb -echo 2>/dev/null 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 stty $ncb echo 2>/dev/null
echo " " echo " "
if test "$ANS" = 'e' -o "$ANS" = 'q'; then 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) quit reading the current file; go on to the next (if any)
.PP .PP
.IP "e or q" .IP "e or q"
When the prompt --More--(Next file: When the prompt --More--(Next file:
.IR file ) .IR file )
is printed, this command causes bzmore to exit. is printed, this command causes bzmore to exit.
.PP .PP
.IP s .IP s
When the prompt --More--(Next file: When the prompt --More--(Next file:
.IR file ) .IR file )
is printed, this command causes bzmore to skip the next file and continue. is printed, this command causes bzmore to skip the next file and continue.
.PP .PP
.IP = .IP =
Display the current line number. Display the current line number.
.PP .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. search for the \fIi\|\fP-th occurrence of the last regular expression entered.
.PP .PP
.IP !command .IP !command
invoke a shell with \fIcommand\|\fP. invoke a shell with \fIcommand\|\fP.
The character `!' in "command" are replaced with the The character `!' in "command" are replaced with the
previous shell command. The sequence "\\!" is replaced by "!". previous shell command. The sequence "\\!" is replaced by "!".
.PP .PP

View file

@ -12,7 +12,7 @@
bzip2/libbzip2 version 1.0.8 of 13 July 2019 bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org> 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. README file.
This program is released under the terms of the license contained This program is released under the terms of the license contained
@ -23,7 +23,7 @@
/* CHANGES /* CHANGES
0.9.0 -- original version. 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 -- 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 so as to do a bit better on small files
*/ */
@ -126,11 +126,11 @@ void generateMTFValues ( EState* s )
Int32 wr; Int32 wr;
Int32 EOB; Int32 EOB;
/* /*
After sorting (eg, here), After sorting (eg, here),
s->arr1 [ 0 .. s->nblock-1 ] holds sorted order, s->arr1 [ 0 .. s->nblock-1 ] holds sorted order,
and and
((UChar*)s->arr2) [ 0 .. s->nblock-1 ] ((UChar*)s->arr2) [ 0 .. s->nblock-1 ]
holds the original block data. holds the original block data.
The first thing to do is generate the MTF values, The first thing to do is generate the MTF values,
@ -145,7 +145,7 @@ void generateMTFValues ( EState* s )
(UChar*) (&((UChar*)s->arr2)[s->nblock]) (UChar*) (&((UChar*)s->arr2)[s->nblock])
These storage aliases are set up in bzCompressInit(), 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(). compressBlock().
*/ */
UInt32* ptr = s->ptr; UInt32* ptr = s->ptr;
@ -168,7 +168,7 @@ void generateMTFValues ( EState* s )
ll_i = s->unseqToSeq[block[j]]; ll_i = s->unseqToSeq[block[j]];
AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" ); AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" );
if (yy[0] == ll_i) { if (yy[0] == ll_i) {
zPend++; zPend++;
} else { } else {
@ -176,11 +176,11 @@ void generateMTFValues ( EState* s )
zPend--; zPend--;
while (True) { while (True) {
if (zPend & 1) { if (zPend & 1) {
mtfv[wr] = BZ_RUNB; wr++; mtfv[wr] = BZ_RUNB; wr++;
s->mtfFreq[BZ_RUNB]++; s->mtfFreq[BZ_RUNB]++;
} else { } else {
mtfv[wr] = BZ_RUNA; wr++; mtfv[wr] = BZ_RUNA; wr++;
s->mtfFreq[BZ_RUNA]++; s->mtfFreq[BZ_RUNA]++;
} }
if (zPend < 2) break; if (zPend < 2) break;
zPend = (zPend - 2) / 2; zPend = (zPend - 2) / 2;
@ -214,11 +214,11 @@ void generateMTFValues ( EState* s )
zPend--; zPend--;
while (True) { while (True) {
if (zPend & 1) { if (zPend & 1) {
mtfv[wr] = BZ_RUNB; wr++; mtfv[wr] = BZ_RUNB; wr++;
s->mtfFreq[BZ_RUNB]++; s->mtfFreq[BZ_RUNB]++;
} else { } else {
mtfv[wr] = BZ_RUNA; wr++; mtfv[wr] = BZ_RUNA; wr++;
s->mtfFreq[BZ_RUNA]++; s->mtfFreq[BZ_RUNA]++;
} }
if (zPend < 2) break; if (zPend < 2) break;
zPend = (zPend - 2) / 2; zPend = (zPend - 2) / 2;
@ -261,7 +261,7 @@ void sendMTFValues ( EState* s )
if (s->verbosity >= 3) if (s->verbosity >= 3)
VPrintf3( " %d in block, %d after MTF & 1-2 coding, " 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 ); s->nblock, s->nMTF, s->nInUse );
alphaSize = s->nInUse+2; alphaSize = s->nInUse+2;
@ -278,7 +278,7 @@ void sendMTFValues ( EState* s )
nGroups = 6; nGroups = 6;
/*--- Generate an initial set of coding tables ---*/ /*--- Generate an initial set of coding tables ---*/
{ {
Int32 nPart, remF, tFreq, aFreq; Int32 nPart, remF, tFreq, aFreq;
nPart = nGroups; nPart = nGroups;
@ -293,8 +293,8 @@ void sendMTFValues ( EState* s )
aFreq += s->mtfFreq[ge]; aFreq += s->mtfFreq[ge];
} }
if (ge > gs if (ge > gs
&& nPart != nGroups && nPart != 1 && nPart != nGroups && nPart != 1
&& ((nGroups-nPart) % 2 == 1)) { && ((nGroups-nPart) % 2 == 1)) {
aFreq -= s->mtfFreq[ge]; aFreq -= s->mtfFreq[ge];
ge--; ge--;
@ -303,21 +303,21 @@ void sendMTFValues ( EState* s )
if (s->verbosity >= 3) if (s->verbosity >= 3)
VPrintf5( " initial group %d, [%d .. %d], " VPrintf5( " initial group %d, [%d .. %d], "
"has %d syms (%4.1f%%)\n", "has %d syms (%4.1f%%)\n",
nPart, gs, ge, aFreq, nPart, gs, ge, aFreq,
(100.0 * (float)aFreq) / (float)(s->nMTF) ); (100.0 * (float)aFreq) / (float)(s->nMTF) );
for (v = 0; v < alphaSize; v++) 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_LESSER_ICOST; else
s->len[nPart-1][v] = BZ_GREATER_ICOST; s->len[nPart-1][v] = BZ_GREATER_ICOST;
nPart--; nPart--;
gs = ge+1; gs = ge+1;
remF -= aFreq; remF -= aFreq;
} }
} }
/*--- /*---
Iterate up to BZ_N_ITERS times to improve the tables. Iterate up to BZ_N_ITERS times to improve the tables.
---*/ ---*/
for (iter = 0; iter < BZ_N_ITERS; iter++) { 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 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) { if (nGroups == 6) {
for (v = 0; v < alphaSize; v++) { for (v = 0; v < alphaSize; v++) {
@ -347,10 +347,10 @@ void sendMTFValues ( EState* s )
/*--- Set group start & end marks. --*/ /*--- Set group start & end marks. --*/
if (gs >= s->nMTF) break; 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; if (ge >= s->nMTF) ge = s->nMTF-1;
/*-- /*--
Calculate the cost of this group as coded Calculate the cost of this group as coded
by each of the coding tables. by each of the coding tables.
--*/ --*/
@ -387,13 +387,13 @@ void sendMTFValues ( EState* s )
} else { } else {
/*--- slow version which correctly handles all situations ---*/ /*--- slow version which correctly handles all situations ---*/
for (i = gs; i <= ge; i++) { for (i = gs; i <= ge; i++) {
UInt16 icv = mtfv[i]; UInt16 icv = mtfv[i];
for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv]; for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv];
} }
} }
/*-- /*--
Find the coding table which is best for this group, Find the coding table which is best for this group,
and record its identity in the selector table. and record its identity in the selector table.
--*/ --*/
@ -405,7 +405,7 @@ void sendMTFValues ( EState* s )
s->selector[nSelectors] = bt; s->selector[nSelectors] = bt;
nSelectors++; nSelectors++;
/*-- /*--
Increment the symbol frequencies for the selected table. Increment the symbol frequencies for the selected table.
--*/ --*/
if (nGroups == 6 && 50 == ge-gs+1) { if (nGroups == 6 && 50 == ge-gs+1) {
@ -435,7 +435,7 @@ void sendMTFValues ( EState* s )
gs = ge+1; gs = ge+1;
} }
if (s->verbosity >= 3) { 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 ); iter+1, totc/8 );
for (t = 0; t < nGroups; t++) for (t = 0; t < nGroups; t++)
VPrintf1 ( "%d ", fave[t] ); VPrintf1 ( "%d ", fave[t] );
@ -445,10 +445,10 @@ void sendMTFValues ( EState* s )
/*-- /*--
Recompute the tables based on the accumulated frequencies. 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. */ comment in huffman.c for details. */
for (t = 0; t < nGroups; t++) 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*/ ); alphaSize, 17 /*20*/ );
} }
@ -488,19 +488,19 @@ void sendMTFValues ( EState* s )
} }
AssertH ( !(maxLen > 17 /*20*/ ), 3004 ); AssertH ( !(maxLen > 17 /*20*/ ), 3004 );
AssertH ( !(minLen < 1), 3005 ); 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 ); minLen, maxLen, alphaSize );
} }
/*--- Transmit the mapping table. ---*/ /*--- Transmit the mapping table. ---*/
{ {
Bool inUse16[16]; Bool inUse16[16];
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
inUse16[i] = False; inUse16[i] = False;
for (j = 0; j < 16; j++) for (j = 0; j < 16; j++)
if (s->inUse[i * 16 + j]) inUse16[i] = True; if (s->inUse[i * 16 + j]) inUse16[i] = True;
} }
nBytes = s->numZ; nBytes = s->numZ;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0); 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->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 ); VPrintf1( " bytes: mapping %d, ", s->numZ-nBytes );
} }
@ -519,7 +519,7 @@ void sendMTFValues ( EState* s )
nBytes = s->numZ; nBytes = s->numZ;
bsW ( s, 3, nGroups ); bsW ( s, 3, nGroups );
bsW ( s, 15, nSelectors ); 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); for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1);
bsW(s,1,0); bsW(s,1,0);
} }
@ -548,14 +548,14 @@ void sendMTFValues ( EState* s )
gs = 0; gs = 0;
while (True) { while (True) {
if (gs >= s->nMTF) break; 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; if (ge >= s->nMTF) ge = s->nMTF-1;
AssertH ( s->selector[selCtr] < nGroups, 3006 ); AssertH ( s->selector[selCtr] < nGroups, 3006 );
if (nGroups == 6 && 50 == ge-gs+1) { if (nGroups == 6 && 50 == ge-gs+1) {
/*--- fast track the common case ---*/ /*--- fast track the common case ---*/
UInt16 mtfv_i; UInt16 mtfv_i;
UChar* s_len_sel_selCtr UChar* s_len_sel_selCtr
= &(s->len[s->selector[selCtr]][0]); = &(s->len[s->selector[selCtr]][0]);
Int32* s_code_sel_selCtr Int32* s_code_sel_selCtr
= &(s->code[s->selector[selCtr]][0]); = &(s->code[s->selector[selCtr]][0]);
@ -582,7 +582,7 @@ void sendMTFValues ( EState* s )
} else { } else {
/*--- slow version which correctly handles all situations ---*/ /*--- slow version which correctly handles all situations ---*/
for (i = gs; i <= ge; i++) { for (i = gs; i <= ge; i++) {
bsW ( s, bsW ( s,
s->len [s->selector[selCtr]] [mtfv[i]], s->len [s->selector[selCtr]] [mtfv[i]],
s->code [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. --*/ /*-- Now the block's CRC, so it is in a known place. --*/
bsPutUInt32 ( s, s->blockCRC ); 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 As of version 0.9.5, we use a better sorting algorithm
which makes randomisation unnecessary. So always set which makes randomisation unnecessary. So always set
the randomised bit to 'no'. Of course, the decoder 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 bzip2/libbzip2 version 1.0.8 of 13 July 2019
Copyright (C) 1996-2019 Julian Seward <jseward@acm.org> 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. README file.
This program is released under the terms of the license contained This program is released under the terms of the license contained
@ -128,7 +128,7 @@ Int32 BZ2_decompress ( DState* s )
Int32 N; Int32 N;
Int32 curr; Int32 curr;
Int32 zt; Int32 zt;
Int32 zn; Int32 zn;
Int32 zvec; Int32 zvec;
Int32 zj; Int32 zj;
Int32 gSel; Int32 gSel;
@ -182,7 +182,7 @@ Int32 BZ2_decompress ( DState* s )
N = s->save_N; N = s->save_N;
curr = s->save_curr; curr = s->save_curr;
zt = s->save_zt; zt = s->save_zt;
zn = s->save_zn; zn = s->save_zn;
zvec = s->save_zvec; zvec = s->save_zvec;
zj = s->save_zj; zj = s->save_zj;
gSel = s->save_gSel; gSel = s->save_gSel;
@ -205,14 +205,14 @@ Int32 BZ2_decompress ( DState* s )
if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC); if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC);
GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8) 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 + 9)) RETURN(BZ_DATA_ERROR_MAGIC);
s->blockSize100k -= BZ_HDR_0; s->blockSize100k -= BZ_HDR_0;
if (s->smallDecompress) { if (s->smallDecompress) {
s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) ); s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) );
s->ll4 = BZALLOC( s->ll4 = BZALLOC(
((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar) ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar)
); );
if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR); if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR);
} else { } else {
@ -238,7 +238,7 @@ Int32 BZ2_decompress ( DState* s )
s->currBlockNo++; s->currBlockNo++;
if (s->verbosity >= 2) if (s->verbosity >= 2)
VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo ); VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo );
s->storedBlockCRC = 0; s->storedBlockCRC = 0;
GET_UCHAR(BZ_X_BCRC_1, uc); GET_UCHAR(BZ_X_BCRC_1, uc);
s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
@ -261,14 +261,14 @@ Int32 BZ2_decompress ( DState* s )
if (s->origPtr < 0) if (s->origPtr < 0)
RETURN(BZ_DATA_ERROR); RETURN(BZ_DATA_ERROR);
if (s->origPtr > 10 + 100000*s->blockSize100k) if (s->origPtr > 10 + 100000*s->blockSize100k)
RETURN(BZ_DATA_ERROR); RETURN(BZ_DATA_ERROR);
/*--- Receive the mapping table ---*/ /*--- Receive the mapping table ---*/
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
GET_BIT(BZ_X_MAPPING_1, uc); GET_BIT(BZ_X_MAPPING_1, uc);
if (uc == 1) if (uc == 1)
s->inUse16[i] = True; else s->inUse16[i] = True; else
s->inUse16[i] = False; s->inUse16[i] = False;
} }
@ -310,7 +310,7 @@ Int32 BZ2_decompress ( DState* s )
{ {
UChar pos[BZ_N_GROUPS], tmp, v; UChar pos[BZ_N_GROUPS], tmp, v;
for (v = 0; v < nGroups; v++) pos[v] = v; for (v = 0; v < nGroups; v++) pos[v] = v;
for (i = 0; i < nSelectors; i++) { for (i = 0; i < nSelectors; i++) {
v = s->selectorMtf[i]; v = s->selectorMtf[i];
tmp = pos[v]; 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] > maxLen) maxLen = s->len[t][i];
if (s->len[t][i] < minLen) minLen = s->len[t][i]; if (s->len[t][i] < minLen) minLen = s->len[t][i];
} }
BZ2_hbCreateDecodeTables ( BZ2_hbCreateDecodeTables (
&(s->limit[t][0]), &(s->limit[t][0]),
&(s->base[t][0]), &(s->base[t][0]),
&(s->perm[t][0]), &(s->perm[t][0]),
&(s->len[t][0]), &(s->len[t][0]),
minLen, maxLen, alphaSize minLen, maxLen, alphaSize
); );
@ -445,23 +445,23 @@ Int32 BZ2_decompress ( DState* s )
s->mtfa[(z)-3] = s->mtfa[(z)-4]; s->mtfa[(z)-3] = s->mtfa[(z)-4];
nn -= 4; nn -= 4;
} }
while (nn > 0) { while (nn > 0) {
s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--; s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--;
}; };
s->mtfa[pp] = uc; s->mtfa[pp] = uc;
} else { } else {
/* general case */ /* general case */
lno = nn / MTFL_SIZE; lno = nn / MTFL_SIZE;
off = nn % MTFL_SIZE; off = nn % MTFL_SIZE;
pp = s->mtfbase[lno] + off; pp = s->mtfbase[lno] + off;
uc = s->mtfa[pp]; uc = s->mtfa[pp];
while (pp > s->mtfbase[lno]) { while (pp > s->mtfbase[lno]) {
s->mtfa[pp] = s->mtfa[pp-1]; pp--; s->mtfa[pp] = s->mtfa[pp-1]; pp--;
}; };
s->mtfbase[lno]++; s->mtfbase[lno]++;
while (lno > 0) { while (lno > 0) {
s->mtfbase[lno]--; s->mtfbase[lno]--;
s->mtfa[s->mtfbase[lno]] s->mtfa[s->mtfbase[lno]]
= s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1]; = s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1];
lno--; lno--;
} }
@ -556,7 +556,7 @@ Int32 BZ2_decompress ( DState* s )
if (s->blockRandomised) { if (s->blockRandomised) {
BZ_RAND_INIT_MASK; BZ_RAND_INIT_MASK;
BZ_GET_SMALL(s->k0); s->nblock_used++; 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 { } else {
BZ_GET_SMALL(s->k0); s->nblock_used++; BZ_GET_SMALL(s->k0); s->nblock_used++;
} }
@ -575,7 +575,7 @@ Int32 BZ2_decompress ( DState* s )
if (s->blockRandomised) { if (s->blockRandomised) {
BZ_RAND_INIT_MASK; BZ_RAND_INIT_MASK;
BZ_GET_FAST(s->k0); s->nblock_used++; 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 { } else {
BZ_GET_FAST(s->k0); s->nblock_used++; BZ_GET_FAST(s->k0); s->nblock_used++;
} }
@ -644,7 +644,7 @@ Int32 BZ2_decompress ( DState* s )
s->save_gBase = gBase; s->save_gBase = gBase;
s->save_gPerm = gPerm; s->save_gPerm = gPerm;
return retVal; return retVal;
} }

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
Doing 6 tests (3 compress, 3 uncompress) ... Doing 6 tests (3 compress, 3 uncompress) ...
If there's a problem, things might stop at this point. 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 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 /usr/local/include, type
make install 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 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. not actually execute them.
Instructions for use are in the preformatted manual page, in the file 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), It is available in Postscript form (manual.ps), PDF form (manual.pdf),
and HTML form (manual.html). 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. "bzip2 -L" displays the software license.

View file

@ -14,7 +14,7 @@
*/ */
STATIC_YOINK("huge_compiler_rt_license"); STATIC_YOINK("huge_compiler_rt_license");
#include "third_party/compiler_rt/int_lib.h" #include "third_party/compiler_rt/int_lib.h"
/* Returns: absolute value */ /* Returns: absolute value */

View file

@ -14,7 +14,7 @@
*/ */
STATIC_YOINK("huge_compiler_rt_license"); STATIC_YOINK("huge_compiler_rt_license");
#include "third_party/compiler_rt/int_lib.h" #include "third_party/compiler_rt/int_lib.h"
/* Returns: absolute value */ /* Returns: absolute value */

View file

@ -52,18 +52,18 @@ enum LE_RESULT {
COMPILER_RT_ABI enum LE_RESULT COMPILER_RT_ABI enum LE_RESULT
__ledf2(fp_t a, fp_t b) { __ledf2(fp_t a, fp_t b) {
const srep_t aInt = toRep(a); const srep_t aInt = toRep(a);
const srep_t bInt = toRep(b); const srep_t bInt = toRep(b);
const rep_t aAbs = aInt & absMask; const rep_t aAbs = aInt & absMask;
const rep_t bAbs = bInt & absMask; const rep_t bAbs = bInt & absMask;
// If either a or b is NaN, they are unordered. // If either a or b is NaN, they are unordered.
if (aAbs > infRep || bAbs > infRep) return LE_UNORDERED; if (aAbs > infRep || bAbs > infRep) return LE_UNORDERED;
// If a and b are both zeros, they are equal. // If a and b are both zeros, they are equal.
if ((aAbs | bAbs) == 0) return LE_EQUAL; if ((aAbs | bAbs) == 0) return LE_EQUAL;
// If at least one of a and b is positive, we get the same result comparing // If at least one of a and b is positive, we get the same result comparing
// a and b as signed integers as we would with a floating-point compare. // a and b as signed integers as we would with a floating-point compare.
if ((aInt & bInt) >= 0) { if ((aInt & bInt) >= 0) {
@ -71,7 +71,7 @@ __ledf2(fp_t a, fp_t b) {
else if (aInt == bInt) return LE_EQUAL; else if (aInt == bInt) return LE_EQUAL;
else return LE_GREATER; else return LE_GREATER;
} }
// Otherwise, both are negative, so we need to flip the sense of the // Otherwise, both are negative, so we need to flip the sense of the
// comparison to get the correct result. (This assumes a twos- or ones- // comparison to get the correct result. (This assumes a twos- or ones-
// complement integer representation; if integers are represented in a // complement integer representation; if integers are represented in a
@ -98,12 +98,12 @@ enum GE_RESULT {
COMPILER_RT_ABI enum GE_RESULT COMPILER_RT_ABI enum GE_RESULT
__gedf2(fp_t a, fp_t b) { __gedf2(fp_t a, fp_t b) {
const srep_t aInt = toRep(a); const srep_t aInt = toRep(a);
const srep_t bInt = toRep(b); const srep_t bInt = toRep(b);
const rep_t aAbs = aInt & absMask; const rep_t aAbs = aInt & absMask;
const rep_t bAbs = bInt & absMask; const rep_t bAbs = bInt & absMask;
if (aAbs > infRep || bAbs > infRep) return GE_UNORDERED; if (aAbs > infRep || bAbs > infRep) return GE_UNORDERED;
if ((aAbs | bAbs) == 0) return GE_EQUAL; if ((aAbs | bAbs) == 0) return GE_EQUAL;
if ((aInt & bInt) >= 0) { if ((aInt & bInt) >= 0) {

View file

@ -52,18 +52,18 @@ enum LE_RESULT {
COMPILER_RT_ABI enum LE_RESULT COMPILER_RT_ABI enum LE_RESULT
__lesf2(fp_t a, fp_t b) { __lesf2(fp_t a, fp_t b) {
const srep_t aInt = toRep(a); const srep_t aInt = toRep(a);
const srep_t bInt = toRep(b); const srep_t bInt = toRep(b);
const rep_t aAbs = aInt & absMask; const rep_t aAbs = aInt & absMask;
const rep_t bAbs = bInt & absMask; const rep_t bAbs = bInt & absMask;
// If either a or b is NaN, they are unordered. // If either a or b is NaN, they are unordered.
if (aAbs > infRep || bAbs > infRep) return LE_UNORDERED; if (aAbs > infRep || bAbs > infRep) return LE_UNORDERED;
// If a and b are both zeros, they are equal. // If a and b are both zeros, they are equal.
if ((aAbs | bAbs) == 0) return LE_EQUAL; if ((aAbs | bAbs) == 0) return LE_EQUAL;
// If at least one of a and b is positive, we get the same result comparing // If at least one of a and b is positive, we get the same result comparing
// a and b as signed integers as we would with a fp_ting-point compare. // a and b as signed integers as we would with a fp_ting-point compare.
if ((aInt & bInt) >= 0) { if ((aInt & bInt) >= 0) {
@ -71,7 +71,7 @@ __lesf2(fp_t a, fp_t b) {
else if (aInt == bInt) return LE_EQUAL; else if (aInt == bInt) return LE_EQUAL;
else return LE_GREATER; else return LE_GREATER;
} }
// Otherwise, both are negative, so we need to flip the sense of the // Otherwise, both are negative, so we need to flip the sense of the
// comparison to get the correct result. (This assumes a twos- or ones- // comparison to get the correct result. (This assumes a twos- or ones-
// complement integer representation; if integers are represented in a // complement integer representation; if integers are represented in a
@ -98,12 +98,12 @@ enum GE_RESULT {
COMPILER_RT_ABI enum GE_RESULT COMPILER_RT_ABI enum GE_RESULT
__gesf2(fp_t a, fp_t b) { __gesf2(fp_t a, fp_t b) {
const srep_t aInt = toRep(a); const srep_t aInt = toRep(a);
const srep_t bInt = toRep(b); const srep_t bInt = toRep(b);
const rep_t aAbs = aInt & absMask; const rep_t aAbs = aInt & absMask;
const rep_t bAbs = bInt & absMask; const rep_t bAbs = bInt & absMask;
if (aAbs > infRep || bAbs > infRep) return GE_UNORDERED; if (aAbs > infRep || bAbs > infRep) return GE_UNORDERED;
if ((aAbs | bAbs) == 0) return GE_EQUAL; if ((aAbs | bAbs) == 0) return GE_EQUAL;
if ((aInt & bInt) >= 0) { if ((aInt & bInt) >= 0) {

View file

@ -25,36 +25,36 @@ STATIC_YOINK("huge_compiler_rt_license");
COMPILER_RT_ABI fp_t COMPILER_RT_ABI fp_t
__divdf3(fp_t a, fp_t b) { __divdf3(fp_t a, fp_t b) {
const unsigned int aExponent = toRep(a) >> significandBits & maxExponent; const unsigned int aExponent = toRep(a) >> significandBits & maxExponent;
const unsigned int bExponent = toRep(b) >> significandBits & maxExponent; const unsigned int bExponent = toRep(b) >> significandBits & maxExponent;
const rep_t quotientSign = (toRep(a) ^ toRep(b)) & signBit; const rep_t quotientSign = (toRep(a) ^ toRep(b)) & signBit;
rep_t aSignificand = toRep(a) & significandMask; rep_t aSignificand = toRep(a) & significandMask;
rep_t bSignificand = toRep(b) & significandMask; rep_t bSignificand = toRep(b) & significandMask;
int scale = 0; int scale = 0;
// Detect if a or b is zero, denormal, infinity, or NaN. // Detect if a or b is zero, denormal, infinity, or NaN.
if (aExponent-1U >= maxExponent-1U || bExponent-1U >= maxExponent-1U) { if (aExponent-1U >= maxExponent-1U || bExponent-1U >= maxExponent-1U) {
const rep_t aAbs = toRep(a) & absMask; const rep_t aAbs = toRep(a) & absMask;
const rep_t bAbs = toRep(b) & absMask; const rep_t bAbs = toRep(b) & absMask;
// NaN / anything = qNaN // NaN / anything = qNaN
if (aAbs > infRep) return fromRep(toRep(a) | quietBit); if (aAbs > infRep) return fromRep(toRep(a) | quietBit);
// anything / NaN = qNaN // anything / NaN = qNaN
if (bAbs > infRep) return fromRep(toRep(b) | quietBit); if (bAbs > infRep) return fromRep(toRep(b) | quietBit);
if (aAbs == infRep) { if (aAbs == infRep) {
// infinity / infinity = NaN // infinity / infinity = NaN
if (bAbs == infRep) return fromRep(qnanRep); if (bAbs == infRep) return fromRep(qnanRep);
// infinity / anything else = +/- infinity // infinity / anything else = +/- infinity
else return fromRep(aAbs | quotientSign); else return fromRep(aAbs | quotientSign);
} }
// anything else / infinity = +/- 0 // anything else / infinity = +/- 0
if (bAbs == infRep) return fromRep(quotientSign); if (bAbs == infRep) return fromRep(quotientSign);
if (!aAbs) { if (!aAbs) {
// zero / zero = NaN // zero / zero = NaN
if (!bAbs) return fromRep(qnanRep); if (!bAbs) return fromRep(qnanRep);
@ -63,28 +63,28 @@ __divdf3(fp_t a, fp_t b) {
} }
// anything else / zero = +/- infinity // anything else / zero = +/- infinity
if (!bAbs) return fromRep(infRep | quotientSign); if (!bAbs) return fromRep(infRep | quotientSign);
// one or both of a or b is denormal, the other (if applicable) is a // one or both of a or b is denormal, the other (if applicable) is a
// normal number. Renormalize one or both of a and b, and set scale to // normal number. Renormalize one or both of a and b, and set scale to
// include the necessary exponent adjustment. // include the necessary exponent adjustment.
if (aAbs < implicitBit) scale += normalize(&aSignificand); if (aAbs < implicitBit) scale += normalize(&aSignificand);
if (bAbs < implicitBit) scale -= normalize(&bSignificand); if (bAbs < implicitBit) scale -= normalize(&bSignificand);
} }
// Or in the implicit significand bit. (If we fell through from the // Or in the implicit significand bit. (If we fell through from the
// denormal path it was already set by normalize( ), but setting it twice // denormal path it was already set by normalize( ), but setting it twice
// won't hurt anything.) // won't hurt anything.)
aSignificand |= implicitBit; aSignificand |= implicitBit;
bSignificand |= implicitBit; bSignificand |= implicitBit;
int quotientExponent = aExponent - bExponent + scale; int quotientExponent = aExponent - bExponent + scale;
// Align the significand of b as a Q31 fixed-point number in the range // Align the significand of b as a Q31 fixed-point number in the range
// [1, 2.0) and get a Q32 approximate reciprocal using a small minimax // [1, 2.0) and get a Q32 approximate reciprocal using a small minimax
// polynomial approximation: reciprocal = 3/4 + 1/sqrt(2) - b/2. This // polynomial approximation: reciprocal = 3/4 + 1/sqrt(2) - b/2. This
// is accurate to about 3.5 binary digits. // is accurate to about 3.5 binary digits.
const uint32_t q31b = bSignificand >> 21; const uint32_t q31b = bSignificand >> 21;
uint32_t recip32 = UINT32_C(0x7504f333) - q31b; uint32_t recip32 = UINT32_C(0x7504f333) - q31b;
// Now refine the reciprocal estimate using a Newton-Raphson iteration: // Now refine the reciprocal estimate using a Newton-Raphson iteration:
// //
// x1 = x0 * (2 - x0 * b) // x1 = x0 * (2 - x0 * b)
@ -99,13 +99,13 @@ __divdf3(fp_t a, fp_t b) {
recip32 = (uint64_t)recip32 * correction32 >> 31; recip32 = (uint64_t)recip32 * correction32 >> 31;
correction32 = -((uint64_t)recip32 * q31b >> 32); correction32 = -((uint64_t)recip32 * q31b >> 32);
recip32 = (uint64_t)recip32 * correction32 >> 31; recip32 = (uint64_t)recip32 * correction32 >> 31;
// recip32 might have overflowed to exactly zero in the preceding // recip32 might have overflowed to exactly zero in the preceding
// computation if the high word of b is exactly 1.0. This would sabotage // computation if the high word of b is exactly 1.0. This would sabotage
// the full-width final stage of the computation that follows, so we adjust // the full-width final stage of the computation that follows, so we adjust
// recip32 downward by one bit. // recip32 downward by one bit.
recip32--; recip32--;
// We need to perform one more iteration to get us to 56 binary digits; // We need to perform one more iteration to get us to 56 binary digits;
// The last iteration needs to happen with extra precision. // The last iteration needs to happen with extra precision.
const uint32_t q63blo = bSignificand << 11; const uint32_t q63blo = bSignificand << 11;
@ -114,14 +114,14 @@ __divdf3(fp_t a, fp_t b) {
uint32_t cHi = correction >> 32; uint32_t cHi = correction >> 32;
uint32_t cLo = correction; uint32_t cLo = correction;
reciprocal = (uint64_t)recip32*cHi + ((uint64_t)recip32*cLo >> 32); reciprocal = (uint64_t)recip32*cHi + ((uint64_t)recip32*cLo >> 32);
// We already adjusted the 32-bit estimate, now we need to adjust the final // We already adjusted the 32-bit estimate, now we need to adjust the final
// 64-bit reciprocal estimate downward to ensure that it is strictly smaller // 64-bit reciprocal estimate downward to ensure that it is strictly smaller
// than the infinitely precise exact reciprocal. Because the computation // than the infinitely precise exact reciprocal. Because the computation
// of the Newton-Raphson step is truncating at every step, this adjustment // of the Newton-Raphson step is truncating at every step, this adjustment
// is small; most of the work is already done. // is small; most of the work is already done.
reciprocal -= 2; reciprocal -= 2;
// The numerical reciprocal is accurate to within 2^-56, lies in the // The numerical reciprocal is accurate to within 2^-56, lies in the
// interval [0.5, 1.0), and is strictly smaller than the true reciprocal // interval [0.5, 1.0), and is strictly smaller than the true reciprocal
// of b. Multiplying a by this reciprocal thus gives a numerical q = a/b // of b. Multiplying a by this reciprocal thus gives a numerical q = a/b
@ -131,12 +131,12 @@ __divdf3(fp_t a, fp_t b) {
// 2. q is in the interval [0.5, 2.0) // 2. q is in the interval [0.5, 2.0)
// 3. the error in q is bounded away from 2^-53 (actually, we have a // 3. the error in q is bounded away from 2^-53 (actually, we have a
// couple of bits to spare, but this is all we need). // couple of bits to spare, but this is all we need).
// We need a 64 x 64 multiply high to compute q, which isn't a basic // We need a 64 x 64 multiply high to compute q, which isn't a basic
// operation in C, so we need to be a little bit fussy. // operation in C, so we need to be a little bit fussy.
rep_t quotient, quotientLo; rep_t quotient, quotientLo;
wideMultiply(aSignificand << 2, reciprocal, &quotient, &quotientLo); wideMultiply(aSignificand << 2, reciprocal, &quotient, &quotientLo);
// Two cases: quotient is in [0.5, 1.0) or quotient is in [1.0, 2.0). // Two cases: quotient is in [0.5, 1.0) or quotient is in [1.0, 2.0).
// In either case, we are going to compute a residual of the form // In either case, we are going to compute a residual of the form
// //
@ -145,7 +145,7 @@ __divdf3(fp_t a, fp_t b) {
// We know from the construction of q that r satisfies: // We know from the construction of q that r satisfies:
// //
// 0 <= r < ulp(q)*b // 0 <= r < ulp(q)*b
// //
// if r is greater than 1/2 ulp(q)*b, then q rounds up. Otherwise, we // if r is greater than 1/2 ulp(q)*b, then q rounds up. Otherwise, we
// already have the correct result. The exact halfway case cannot occur. // already have the correct result. The exact halfway case cannot occur.
// We also take this time to right shift quotient if it falls in the [1,2) // We also take this time to right shift quotient if it falls in the [1,2)
@ -158,20 +158,20 @@ __divdf3(fp_t a, fp_t b) {
quotient >>= 1; quotient >>= 1;
residual = (aSignificand << 52) - quotient * bSignificand; residual = (aSignificand << 52) - quotient * bSignificand;
} }
const int writtenExponent = quotientExponent + exponentBias; const int writtenExponent = quotientExponent + exponentBias;
if (writtenExponent >= maxExponent) { if (writtenExponent >= maxExponent) {
// If we have overflowed the exponent, return infinity. // If we have overflowed the exponent, return infinity.
return fromRep(infRep | quotientSign); return fromRep(infRep | quotientSign);
} }
else if (writtenExponent < 1) { else if (writtenExponent < 1) {
// Flush denormals to zero. In the future, it would be nice to add // Flush denormals to zero. In the future, it would be nice to add
// code to round them correctly. // code to round them correctly.
return fromRep(quotientSign); return fromRep(quotientSign);
} }
else { else {
const bool round = (residual << 1) > bSignificand; const bool round = (residual << 1) > bSignificand;
// Clear the implicit bit // Clear the implicit bit

View file

@ -24,7 +24,7 @@ __divmodsi4(si_int a, si_int b, si_int* rem)
{ {
si_int d = __divsi3(a,b); si_int d = __divsi3(a,b);
*rem = a - (d*b); *rem = a - (d*b);
return d; return d;
} }

View file

@ -25,36 +25,36 @@ STATIC_YOINK("huge_compiler_rt_license");
COMPILER_RT_ABI fp_t COMPILER_RT_ABI fp_t
__divsf3(fp_t a, fp_t b) { __divsf3(fp_t a, fp_t b) {
const unsigned int aExponent = toRep(a) >> significandBits & maxExponent; const unsigned int aExponent = toRep(a) >> significandBits & maxExponent;
const unsigned int bExponent = toRep(b) >> significandBits & maxExponent; const unsigned int bExponent = toRep(b) >> significandBits & maxExponent;
const rep_t quotientSign = (toRep(a) ^ toRep(b)) & signBit; const rep_t quotientSign = (toRep(a) ^ toRep(b)) & signBit;
rep_t aSignificand = toRep(a) & significandMask; rep_t aSignificand = toRep(a) & significandMask;
rep_t bSignificand = toRep(b) & significandMask; rep_t bSignificand = toRep(b) & significandMask;
int scale = 0; int scale = 0;
// Detect if a or b is zero, denormal, infinity, or NaN. // Detect if a or b is zero, denormal, infinity, or NaN.
if (aExponent-1U >= maxExponent-1U || bExponent-1U >= maxExponent-1U) { if (aExponent-1U >= maxExponent-1U || bExponent-1U >= maxExponent-1U) {
const rep_t aAbs = toRep(a) & absMask; const rep_t aAbs = toRep(a) & absMask;
const rep_t bAbs = toRep(b) & absMask; const rep_t bAbs = toRep(b) & absMask;
// NaN / anything = qNaN // NaN / anything = qNaN
if (aAbs > infRep) return fromRep(toRep(a) | quietBit); if (aAbs > infRep) return fromRep(toRep(a) | quietBit);
// anything / NaN = qNaN // anything / NaN = qNaN
if (bAbs > infRep) return fromRep(toRep(b) | quietBit); if (bAbs > infRep) return fromRep(toRep(b) | quietBit);
if (aAbs == infRep) { if (aAbs == infRep) {
// infinity / infinity = NaN // infinity / infinity = NaN
if (bAbs == infRep) return fromRep(qnanRep); if (bAbs == infRep) return fromRep(qnanRep);
// infinity / anything else = +/- infinity // infinity / anything else = +/- infinity
else return fromRep(aAbs | quotientSign); else return fromRep(aAbs | quotientSign);
} }
// anything else / infinity = +/- 0 // anything else / infinity = +/- 0
if (bAbs == infRep) return fromRep(quotientSign); if (bAbs == infRep) return fromRep(quotientSign);
if (!aAbs) { if (!aAbs) {
// zero / zero = NaN // zero / zero = NaN
if (!bAbs) return fromRep(qnanRep); if (!bAbs) return fromRep(qnanRep);
@ -63,28 +63,28 @@ __divsf3(fp_t a, fp_t b) {
} }
// anything else / zero = +/- infinity // anything else / zero = +/- infinity
if (!bAbs) return fromRep(infRep | quotientSign); if (!bAbs) return fromRep(infRep | quotientSign);
// one or both of a or b is denormal, the other (if applicable) is a // one or both of a or b is denormal, the other (if applicable) is a
// normal number. Renormalize one or both of a and b, and set scale to // normal number. Renormalize one or both of a and b, and set scale to
// include the necessary exponent adjustment. // include the necessary exponent adjustment.
if (aAbs < implicitBit) scale += normalize(&aSignificand); if (aAbs < implicitBit) scale += normalize(&aSignificand);
if (bAbs < implicitBit) scale -= normalize(&bSignificand); if (bAbs < implicitBit) scale -= normalize(&bSignificand);
} }
// Or in the implicit significand bit. (If we fell through from the // Or in the implicit significand bit. (If we fell through from the
// denormal path it was already set by normalize( ), but setting it twice // denormal path it was already set by normalize( ), but setting it twice
// won't hurt anything.) // won't hurt anything.)
aSignificand |= implicitBit; aSignificand |= implicitBit;
bSignificand |= implicitBit; bSignificand |= implicitBit;
int quotientExponent = aExponent - bExponent + scale; int quotientExponent = aExponent - bExponent + scale;
// Align the significand of b as a Q31 fixed-point number in the range // Align the significand of b as a Q31 fixed-point number in the range
// [1, 2.0) and get a Q32 approximate reciprocal using a small minimax // [1, 2.0) and get a Q32 approximate reciprocal using a small minimax
// polynomial approximation: reciprocal = 3/4 + 1/sqrt(2) - b/2. This // polynomial approximation: reciprocal = 3/4 + 1/sqrt(2) - b/2. This
// is accurate to about 3.5 binary digits. // is accurate to about 3.5 binary digits.
uint32_t q31b = bSignificand << 8; uint32_t q31b = bSignificand << 8;
uint32_t reciprocal = UINT32_C(0x7504f333) - q31b; uint32_t reciprocal = UINT32_C(0x7504f333) - q31b;
// Now refine the reciprocal estimate using a Newton-Raphson iteration: // Now refine the reciprocal estimate using a Newton-Raphson iteration:
// //
// x1 = x0 * (2 - x0 * b) // x1 = x0 * (2 - x0 * b)
@ -99,7 +99,7 @@ __divsf3(fp_t a, fp_t b) {
reciprocal = (uint64_t)reciprocal * correction >> 31; reciprocal = (uint64_t)reciprocal * correction >> 31;
correction = -((uint64_t)reciprocal * q31b >> 32); correction = -((uint64_t)reciprocal * q31b >> 32);
reciprocal = (uint64_t)reciprocal * correction >> 31; reciprocal = (uint64_t)reciprocal * correction >> 31;
// Exhaustive testing shows that the error in reciprocal after three steps // Exhaustive testing shows that the error in reciprocal after three steps
// is in the interval [-0x1.f58108p-31, 0x1.d0e48cp-29], in line with our // is in the interval [-0x1.f58108p-31, 0x1.d0e48cp-29], in line with our
// expectations. We bump the reciprocal by a tiny value to force the error // expectations. We bump the reciprocal by a tiny value to force the error
@ -107,7 +107,7 @@ __divsf3(fp_t a, fp_t b) {
// be specific). This also causes 1/1 to give a sensible approximation // be specific). This also causes 1/1 to give a sensible approximation
// instead of zero (due to overflow). // instead of zero (due to overflow).
reciprocal -= 2; reciprocal -= 2;
// The numerical reciprocal is accurate to within 2^-28, lies in the // The numerical reciprocal is accurate to within 2^-28, lies in the
// interval [0x1.000000eep-1, 0x1.fffffffcp-1], and is strictly smaller // interval [0x1.000000eep-1, 0x1.fffffffcp-1], and is strictly smaller
// than the true reciprocal of b. Multiplying a by this reciprocal thus // than the true reciprocal of b. Multiplying a by this reciprocal thus
@ -119,9 +119,9 @@ __divsf3(fp_t a, fp_t b) {
// from the fact that we truncate the product, and the 2^27 term // from the fact that we truncate the product, and the 2^27 term
// is the error in the reciprocal of b scaled by the maximum // is the error in the reciprocal of b scaled by the maximum
// possible value of a. As a consequence of this error bound, // possible value of a. As a consequence of this error bound,
// either q or nextafter(q) is the correctly rounded // either q or nextafter(q) is the correctly rounded
rep_t quotient = (uint64_t)reciprocal*(aSignificand << 1) >> 32; rep_t quotient = (uint64_t)reciprocal*(aSignificand << 1) >> 32;
// Two cases: quotient is in [0.5, 1.0) or quotient is in [1.0, 2.0). // Two cases: quotient is in [0.5, 1.0) or quotient is in [1.0, 2.0).
// In either case, we are going to compute a residual of the form // In either case, we are going to compute a residual of the form
// //
@ -130,7 +130,7 @@ __divsf3(fp_t a, fp_t b) {
// We know from the construction of q that r satisfies: // We know from the construction of q that r satisfies:
// //
// 0 <= r < ulp(q)*b // 0 <= r < ulp(q)*b
// //
// if r is greater than 1/2 ulp(q)*b, then q rounds up. Otherwise, we // if r is greater than 1/2 ulp(q)*b, then q rounds up. Otherwise, we
// already have the correct result. The exact halfway case cannot occur. // already have the correct result. The exact halfway case cannot occur.
// We also take this time to right shift quotient if it falls in the [1,2) // We also take this time to right shift quotient if it falls in the [1,2)
@ -145,18 +145,18 @@ __divsf3(fp_t a, fp_t b) {
} }
const int writtenExponent = quotientExponent + exponentBias; const int writtenExponent = quotientExponent + exponentBias;
if (writtenExponent >= maxExponent) { if (writtenExponent >= maxExponent) {
// If we have overflowed the exponent, return infinity. // If we have overflowed the exponent, return infinity.
return fromRep(infRep | quotientSign); return fromRep(infRep | quotientSign);
} }
else if (writtenExponent < 1) { else if (writtenExponent < 1) {
// Flush denormals to zero. In the future, it would be nice to add // Flush denormals to zero. In the future, it would be nice to add
// code to round them correctly. // code to round them correctly.
return fromRep(quotientSign); return fromRep(quotientSign);
} }
else { else {
const bool round = (residual << 1) > bSignificand; const bool round = (residual << 1) > bSignificand;
// Clear the implicit bit // Clear the implicit bit

View file

@ -25,7 +25,7 @@ STATIC_YOINK("huge_compiler_rt_license");
/* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes /* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes
* du_int is a 64 bit integral type * du_int is a 64 bit integral type
* value in long double is representable in du_int or is negative * value in long double is representable in du_int or is negative
* (no range checking performed) * (no range checking performed)
*/ */

View file

@ -25,7 +25,7 @@ STATIC_YOINK("huge_compiler_rt_license");
/* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes /* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes
* su_int is a 32 bit integral type * su_int is a 32 bit integral type
* value in long double is representable in su_int or is negative * value in long double is representable in su_int or is negative
*/ */
/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee | /* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |

View file

@ -25,7 +25,7 @@ STATIC_YOINK("huge_compiler_rt_license");
/* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes /* Assumption: long double is an intel 80 bit floating point type padded with 6 bytes
* tu_int is a 128 bit integral type * tu_int is a 128 bit integral type
* value in long double is representable in tu_int or is negative * value in long double is representable in tu_int or is negative
*/ */
/* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee | /* gggg gggg gggg gggg gggg gggg gggg gggg | gggg gggg gggg gggg seee eeee eeee eeee |

View file

@ -17,9 +17,9 @@ STATIC_YOINK("huge_compiler_rt_license");
/* Returns: convert a to a float, rounding toward even.*/ /* Returns: convert a to a float, rounding toward even.*/
/* Assumption: float is a IEEE 32 bit floating point type /* Assumption: float is a IEEE 32 bit floating point type
* di_int is a 64 bit integral type * di_int is a 64 bit integral type
*/ */
/* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */ /* seee eeee emmm mmmm mmmm mmmm mmmm mmmm */
@ -37,13 +37,13 @@ __floatdisf(di_int a)
int e = sd - 1; /* exponent */ int e = sd - 1; /* exponent */
if (sd > FLT_MANT_DIG) if (sd > FLT_MANT_DIG)
{ {
/* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx /* start: 0000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQxxxxxxxxxxxxxxxxxx
* finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR * finish: 000000000000000000000000000000000000001xxxxxxxxxxxxxxxxxxxxxxPQR
* 12345678901234567890123456 * 12345678901234567890123456
* 1 = msb 1 bit * 1 = msb 1 bit
* P = bit FLT_MANT_DIG-1 bits to the right of 1 * P = bit FLT_MANT_DIG-1 bits to the right of 1
* Q = bit FLT_MANT_DIG bits to the right of 1 * Q = bit FLT_MANT_DIG bits to the right of 1
* R = "or" of all bits to the right of Q * R = "or" of all bits to the right of Q
*/ */
switch (sd) switch (sd)
{ {

View file

@ -11,7 +11,7 @@
* This file implements __floatdixf for the compiler_rt library. * This file implements __floatdixf for the compiler_rt library.
* *
* ===----------------------------------------------------------------------=== * ===----------------------------------------------------------------------===
*/ */
STATIC_YOINK("huge_compiler_rt_license"); STATIC_YOINK("huge_compiler_rt_license");

View file

@ -23,30 +23,30 @@ STATIC_YOINK("huge_compiler_rt_license");
COMPILER_RT_ABI fp_t COMPILER_RT_ABI fp_t
__floatsidf(int a) { __floatsidf(int a) {
const int aWidth = sizeof a * CHAR_BIT; const int aWidth = sizeof a * CHAR_BIT;
// Handle zero as a special case to protect clz // Handle zero as a special case to protect clz
if (a == 0) if (a == 0)
return fromRep(0); return fromRep(0);
// All other cases begin by extracting the sign and absolute value of a // All other cases begin by extracting the sign and absolute value of a
rep_t sign = 0; rep_t sign = 0;
if (a < 0) { if (a < 0) {
sign = signBit; sign = signBit;
a = -a; a = -a;
} }
// Exponent of (fp_t)a is the width of abs(a). // Exponent of (fp_t)a is the width of abs(a).
const int exponent = (aWidth - 1) - __builtin_clz(a); const int exponent = (aWidth - 1) - __builtin_clz(a);
rep_t result; rep_t result;
// Shift a into the significand field and clear the implicit bit. Extra // Shift a into the significand field and clear the implicit bit. Extra
// cast to unsigned int is necessary to get the correct behavior for // cast to unsigned int is necessary to get the correct behavior for
// the input INT_MIN. // the input INT_MIN.
const int shift = significandBits - exponent; const int shift = significandBits - exponent;
result = (rep_t)(unsigned int)a << shift ^ implicitBit; result = (rep_t)(unsigned int)a << shift ^ implicitBit;
// Insert the exponent // Insert the exponent
result += (rep_t)(exponent + exponentBias) << significandBits; result += (rep_t)(exponent + exponentBias) << significandBits;
// Insert the sign bit and return // Insert the sign bit and return

View file

@ -23,24 +23,24 @@ STATIC_YOINK("huge_compiler_rt_license");
COMPILER_RT_ABI fp_t COMPILER_RT_ABI fp_t
__floatsisf(int a) { __floatsisf(int a) {
const int aWidth = sizeof a * CHAR_BIT; const int aWidth = sizeof a * CHAR_BIT;
// Handle zero as a special case to protect clz // Handle zero as a special case to protect clz
if (a == 0) if (a == 0)
return fromRep(0); return fromRep(0);
// All other cases begin by extracting the sign and absolute value of a // All other cases begin by extracting the sign and absolute value of a
rep_t sign = 0; rep_t sign = 0;
if (a < 0) { if (a < 0) {
sign = signBit; sign = signBit;
a = -a; a = -a;
} }
// Exponent of (fp_t)a is the width of abs(a). // Exponent of (fp_t)a is the width of abs(a).
const int exponent = (aWidth - 1) - __builtin_clz(a); const int exponent = (aWidth - 1) - __builtin_clz(a);
rep_t result; rep_t result;
// Shift a into the significand field, rounding if it is a right-shift // Shift a into the significand field, rounding if it is a right-shift
if (exponent <= significandBits) { if (exponent <= significandBits) {
const int shift = significandBits - exponent; const int shift = significandBits - exponent;
@ -52,7 +52,7 @@ __floatsisf(int a) {
if (round > signBit) result++; if (round > signBit) result++;
if (round == signBit) result += result & 1; if (round == signBit) result += result & 1;
} }
// Insert the exponent // Insert the exponent
result += (rep_t)(exponent + exponentBias) << significandBits; result += (rep_t)(exponent + exponentBias) << significandBits;
// Insert the sign bit and return // Insert the sign bit and return

View file

@ -21,7 +21,7 @@ STATIC_YOINK("huge_compiler_rt_license");
/* Returns: convert a to a float, rounding toward even. */ /* Returns: convert a to a float, rounding toward even. */
/* Assumption: float is a IEEE 32 bit floating point type /* Assumption: float is a IEEE 32 bit floating point type
* ti_int is a 128 bit integral type * ti_int is a 128 bit integral type
*/ */

View file

@ -17,7 +17,7 @@ STATIC_YOINK("huge_compiler_rt_license");
/* Returns: convert a to a float, rounding toward even. */ /* Returns: convert a to a float, rounding toward even. */
/* Assumption: float is a IEEE 32 bit floating point type /* Assumption: float is a IEEE 32 bit floating point type
* du_int is a 64 bit integral type * du_int is a 64 bit integral type
*/ */

View file

@ -23,20 +23,20 @@ STATIC_YOINK("huge_compiler_rt_license");
COMPILER_RT_ABI fp_t COMPILER_RT_ABI fp_t
__floatunsidf(unsigned int a) { __floatunsidf(unsigned int a) {
const int aWidth = sizeof a * CHAR_BIT; const int aWidth = sizeof a * CHAR_BIT;
// Handle zero as a special case to protect clz // Handle zero as a special case to protect clz
if (a == 0) return fromRep(0); if (a == 0) return fromRep(0);
// Exponent of (fp_t)a is the width of abs(a). // Exponent of (fp_t)a is the width of abs(a).
const int exponent = (aWidth - 1) - __builtin_clz(a); const int exponent = (aWidth - 1) - __builtin_clz(a);
rep_t result; rep_t result;
// Shift a into the significand field and clear the implicit bit. // Shift a into the significand field and clear the implicit bit.
const int shift = significandBits - exponent; const int shift = significandBits - exponent;
result = (rep_t)a << shift ^ implicitBit; result = (rep_t)a << shift ^ implicitBit;
// Insert the exponent // Insert the exponent
result += (rep_t)(exponent + exponentBias) << significandBits; result += (rep_t)(exponent + exponentBias) << significandBits;
return fromRep(result); return fromRep(result);

View file

@ -23,16 +23,16 @@ STATIC_YOINK("huge_compiler_rt_license");
COMPILER_RT_ABI fp_t COMPILER_RT_ABI fp_t
__floatunsisf(unsigned int a) { __floatunsisf(unsigned int a) {
const int aWidth = sizeof a * CHAR_BIT; const int aWidth = sizeof a * CHAR_BIT;
// Handle zero as a special case to protect clz // Handle zero as a special case to protect clz
if (a == 0) return fromRep(0); if (a == 0) return fromRep(0);
// Exponent of (fp_t)a is the width of abs(a). // Exponent of (fp_t)a is the width of abs(a).
const int exponent = (aWidth - 1) - __builtin_clz(a); const int exponent = (aWidth - 1) - __builtin_clz(a);
rep_t result; rep_t result;
// Shift a into the significand field, rounding if it is a right-shift // Shift a into the significand field, rounding if it is a right-shift
if (exponent <= significandBits) { if (exponent <= significandBits) {
const int shift = significandBits - exponent; const int shift = significandBits - exponent;
@ -44,7 +44,7 @@ __floatunsisf(unsigned int a) {
if (round > signBit) result++; if (round > signBit) result++;
if (round == signBit) result += result & 1; if (round == signBit) result += result & 1;
} }
// Insert the exponent // Insert the exponent
result += (rep_t)(exponent + exponentBias) << significandBits; result += (rep_t)(exponent + exponentBias) << significandBits;
return fromRep(result); return fromRep(result);

View file

@ -21,7 +21,7 @@ STATIC_YOINK("huge_compiler_rt_license");
/* Returns: convert a to a float, rounding toward even. */ /* Returns: convert a to a float, rounding toward even. */
/* Assumption: float is a IEEE 32 bit floating point type /* Assumption: float is a IEEE 32 bit floating point type
* tu_int is a 128 bit integral type * tu_int is a 128 bit integral type
*/ */

View file

@ -27,7 +27,7 @@ __mulodi4(di_int a, di_int b, int* overflow)
const int N = (int)(sizeof(di_int) * CHAR_BIT); const int N = (int)(sizeof(di_int) * CHAR_BIT);
const di_int MIN = (di_int)1 << (N-1); const di_int MIN = (di_int)1 << (N-1);
const di_int MAX = ~MIN; const di_int MAX = ~MIN;
*overflow = 0; *overflow = 0;
di_int result = a * b; di_int result = a * b;
if (a == MIN) if (a == MIN)
{ {

View file

@ -27,7 +27,7 @@ __mulosi4(si_int a, si_int b, int* overflow)
const int N = (int)(sizeof(si_int) * CHAR_BIT); const int N = (int)(sizeof(si_int) * CHAR_BIT);
const si_int MIN = (si_int)1 << (N-1); const si_int MIN = (si_int)1 << (N-1);
const si_int MAX = ~MIN; const si_int MAX = ~MIN;
*overflow = 0; *overflow = 0;
si_int result = a * b; si_int result = a * b;
if (a == MIN) if (a == MIN)
{ {

View file

@ -11,7 +11,7 @@
* This file implements __parityti2 for the compiler_rt library. * This file implements __parityti2 for the compiler_rt library.
* *
* ===----------------------------------------------------------------------=== * ===----------------------------------------------------------------------===
*/ */
STATIC_YOINK("huge_compiler_rt_license"); STATIC_YOINK("huge_compiler_rt_license");

View file

@ -64,7 +64,7 @@ __udivmoddi4(du_int a, du_int b, du_int* rem)
/* K X /* K X
* --- * ---
* 0 0 * 0 0
*/ */
if (rem) if (rem)
*rem = n.s.high % d.s.low; *rem = n.s.high % d.s.low;
return n.s.high / d.s.low; return n.s.high / d.s.low;

View file

@ -1,6 +1,6 @@
DESCRIPTION DESCRIPTION
Efficient binary-decimal and decimal-binary conversion routines for IEEE doubles. Efficient binary-decimal and decimal-binary conversion routines for IEEE doubles.
ORIGIN ORIGIN

View file

@ -4681,7 +4681,7 @@ TEST(StringToFloatHexString) {
CHECK_EQ(5.0f, StrToF(" + 0x5 ", flags, 0.0f, &processed, &all_used)); CHECK_EQ(5.0f, StrToF(" + 0x5 ", flags, 0.0f, &processed, &all_used));
CHECK(all_used); CHECK(all_used);
CHECK_EQ(Single::NaN(), StrToF("- -0x5", flags, 0.0f, CHECK_EQ(Single::NaN(), StrToF("- -0x5", flags, 0.0f,
&processed, &all_used)); &processed, &all_used));
CHECK_EQ(0, processed); CHECK_EQ(0, processed);
@ -5949,7 +5949,7 @@ TEST(StringToTemplate) {
// The double rounding example from TEST(StringToFloatHexString), which // The double rounding example from TEST(StringToFloatHexString), which
// yields a slightly different result from StringToFloat than from // yields a slightly different result from StringToFloat than from
// StringToDouble. Allows testing that StringTo<float> behaves like // StringToDouble. Allows testing that StringTo<float> behaves like
// StringToFloat (rather than like StringToDouble). // StringToFloat (rather than like StringToDouble).
const char buffer[] = "0x100000100000008"; const char buffer[] = "0x100000100000008";
const int length = DOUBLE_CONVERSION_ARRAY_SIZE(buffer) - 1; const int length = DOUBLE_CONVERSION_ARRAY_SIZE(buffer) - 1;

View file

@ -89,18 +89,18 @@ fxputc(FILE *f, int ch)
ch = ch&0xff; ch = ch&0xff;
/* on 7-bit terminals, strip high bit */ /* on 7-bit terminals, strip high bit */
if (!is8bit()) ch &= 0x7f; if (!is8bit()) ch &= 0x7f;
/* /*
* Assume anything that isn't a control character is printable. * Assume anything that isn't a control character is printable.
* We can't count on locale stuff to tell us what's printable * We can't count on locale stuff to tell us what's printable
* because we might be looking at someone who uses different * because we might be looking at someone who uses different
* locale settings or is on the other side of the planet. So, * locale settings or is on the other side of the planet. So,
* strip 0-31, 127, 128-159, and 255. Note that not stripping * strip 0-31, 127, 128-159, and 255. Note that not stripping
* 128-159 is asking for trouble, as 155 (M-esc) is interpreted * 128-159 is asking for trouble, as 155 (M-esc) is interpreted
* as esc-[ by most terminals. Hopefully this won't break anyone's * as esc-[ by most terminals. Hopefully this won't break anyone's
* charset. * charset.
* *
* It would be nice if we could set the terminal to display in the * It would be nice if we could set the terminal to display in the
* right charset, but we have no way to know what it is. feh. * right charset, but we have no way to know what it is. feh.
*/ */

View file

@ -153,7 +153,7 @@ The
.Fl l .Fl l
option is the only option that may be passed to a remote machine. option is the only option that may be passed to a remote machine.
.Pp .Pp
If standard output is a socket, If standard output is a socket,
.Nm finger .Nm finger
will emit a carriage return (^M) before every linefeed (^J). This is will emit a carriage return (^M) before every linefeed (^J). This is
for processing remote finger requests when invoked by for processing remote finger requests when invoked by

View file

@ -258,7 +258,7 @@ void enter_lastlog(PERSON *pn) {
/* /*
* and if it's not any of the current logins * and if it's not any of the current logins
* can't use time comparison because there may be a small * can't use time comparison because there may be a small
* discrepancy since login calls time() twice * discrepency since login calls time() twice
*/ */
for (w = pn->whead; doit && w != NULL; w = w->next) for (w = pn->whead; doit && w != NULL; w = w->next)
if (w->info == LOGGEDIN && if (w->info == LOGGEDIN &&

View file

@ -479,7 +479,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does. and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's 1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an you conspicuously and appropriately publish on each copy an
@ -1518,7 +1518,7 @@ Public License instead of this License. But first, please read
the terms and conditions of version 3 of the GNU General Public the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below. License, supplemented by the additional permissions listed below.
0. Additional Definitions. 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License, and the "GNU GPL" refers to version 3 of the GNU
@ -1619,7 +1619,7 @@ the following:
a copy of the Library already present on the user's computer a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked of the Library that is interface-compatible with the Linked
Version. Version.
e) Provide Installation Information, but only if you would otherwise e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the be required to provide such information under section 6 of the
@ -4196,7 +4196,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does. and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's 1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an you conspicuously and appropriately publish on each copy an
@ -6764,7 +6764,7 @@ Public License instead of this License. But first, please read
the terms and conditions of version 3 of the GNU General Public the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below. License, supplemented by the additional permissions listed below.
0. Additional Definitions. 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License, and the "GNU GPL" refers to version 3 of the GNU
@ -6865,7 +6865,7 @@ the following:
a copy of the Library already present on the user's computer a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked of the Library that is interface-compatible with the Linked
Version. Version.
e) Provide Installation Information, but only if you would otherwise e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the be required to provide such information under section 6 of the
@ -8541,7 +8541,7 @@ Public License instead of this License. But first, please read
the terms and conditions of version 3 of the GNU General Public the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below. License, supplemented by the additional permissions listed below.
0. Additional Definitions. 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License, and the "GNU GPL" refers to version 3 of the GNU
@ -8642,7 +8642,7 @@ the following:
a copy of the Library already present on the user's computer a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked of the Library that is interface-compatible with the Linked
Version. Version.
e) Provide Installation Information, but only if you would otherwise e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the be required to provide such information under section 6 of the
@ -9188,7 +9188,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does. and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's 1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an you conspicuously and appropriately publish on each copy an
@ -10236,7 +10236,7 @@ Public License instead of this License. But first, please read
the terms and conditions of version 3 of the GNU General Public the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below. License, supplemented by the additional permissions listed below.
0. Additional Definitions. 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License, and the "GNU GPL" refers to version 3 of the GNU
@ -10337,7 +10337,7 @@ the following:
a copy of the Library already present on the user's computer a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked of the Library that is interface-compatible with the Linked
Version. Version.
e) Provide Installation Information, but only if you would otherwise e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the be required to provide such information under section 6 of the
@ -10923,16 +10923,16 @@ are met:
1. Redistributions of source code must retain the above copyright 1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer. notice, this list of conditions and the following disclaimer.
2. The origin of this software must not be misrepresented; you must 2. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product software in a product, an acknowledgment in the product
documentation would be appreciated but is not required. documentation would be appreciated but is not required.
3. Altered source versions must be plainly marked as such, and must 3. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software. not be misrepresented as being the original software.
4. The name of the author may not be used to endorse or promote 4. The name of the author may not be used to endorse or promote
products derived from this software without specific prior written products derived from this software without specific prior written
permission. permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
@ -12206,7 +12206,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does. and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's 1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an you conspicuously and appropriately publish on each copy an
@ -13331,7 +13331,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does. and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's 1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an you conspicuously and appropriately publish on each copy an
@ -14170,8 +14170,8 @@ so, subject to the following conditions:
this list of conditions and the following disclaimers in the this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution. documentation and/or other materials provided with the distribution.
* Neither the names of Intel Corporation Threading Runtimes Team nor the * Neither the names of Intel Corporation Threading Runtimes Team nor the
names of its contributors may be used to endorse or promote products names of its contributors may be used to endorse or promote products
derived from this Software without specific prior written permission. derived from this Software without specific prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
@ -14920,7 +14920,7 @@ Public License instead of this License. But first, please read
the terms and conditions of version 3 of the GNU General Public the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below. License, supplemented by the additional permissions listed below.
0. Additional Definitions. 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License, and the "GNU GPL" refers to version 3 of the GNU
@ -15021,7 +15021,7 @@ the following:
a copy of the Library already present on the user's computer a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked of the Library that is interface-compatible with the Linked
Version. Version.
e) Provide Installation Information, but only if you would otherwise e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the be required to provide such information under section 6 of the

View file

@ -19,7 +19,7 @@ Author: Rich Felker <dalias@aerifal.cx>
Date: Wed Dec 18 14:29:07 2019 -0500 Date: Wed Dec 18 14:29:07 2019 -0500
switch linux kernel headers to 4.19.88 by default switch linux kernel headers to 4.19.88 by default
using slim headers-only version. this change is needed to support all using slim headers-only version. this change is needed to support all
future versions of musl on 32-bit archs, since prior to 4.16 the future versions of musl on 32-bit archs, since prior to 4.16 the
kernel headers had incompatibility with userspace time_t not matching kernel headers had incompatibility with userspace time_t not matching

View file

@ -5,8 +5,8 @@
%{%:debug-level-gt(0):%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}} %{fdebug-prefix-map=*:--debug-prefix-map %*} %{%:debug-level-gt(0):%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}} %{fdebug-prefix-map=*:--debug-prefix-map %*}
*asm_final: *asm_final:
%{gsplit-dwarf: %{gsplit-dwarf:
objcopy --extract-dwo %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} %{c:%{o*:%:replace-extension(%{o*:%*} .dwo)}%{!o*:%b.dwo}}%{!c:%b.dwo} objcopy --extract-dwo %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} %{c:%{o*:%:replace-extension(%{o*:%*} .dwo)}%{!o*:%b.dwo}}%{!c:%b.dwo}
objcopy --strip-dwo %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} } objcopy --strip-dwo %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} }
*asm_options: *asm_options:
@ -137,5 +137,5 @@ collect2
%{march=native:%>march=native %:local_cpu_detect(arch) %{!mtune=*:%>mtune=native %:local_cpu_detect(tune)}} %{mtune=native:%>mtune=native %:local_cpu_detect(tune)} %{march=native:%>march=native %:local_cpu_detect(arch) %{!mtune=*:%>mtune=native %:local_cpu_detect(tune)}} %{mtune=native:%>mtune=native %:local_cpu_detect(tune)}
*link_command: *link_command:
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %{fuse-linker-plugin: %e-fuse-linker-plugin is not supported in this configuration}%{flto|flto=*:%<fcompare-debug*} %{flto} %{fno-lto} %{flto=*} %l %{shared|r:;pie|static-pie:-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}} %{fuse-ld=*:-fuse-ld=%*} %{gz|gz=zlib:--compress-debug-sections=zlib} %{gz=none:--compress-debug-sections=none} %{gz=zlib-gnu:--compress-debug-sections=zlib-gnu} %X %{o*} %{e*} %{N} %{n} %{r} %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) %{fvtable-verify=none:} %{fvtable-verify=std: %e-fvtable-verify=std is not supported in this configuration} %{fvtable-verify=preinit: %e-fvtable-verify=preinit is not supported in this configuration} %{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):%{!shared:libasan_preinit%O%s} %{static-libasan:%{!shared:-Bstatic --whole-archive -lasan --no-whole-archive -Bdynamic}}%{!static-libasan:-lasan}} %{%:sanitize(thread):%{!shared:libtsan_preinit%O%s} %{static-libtsan:%{!shared:-Bstatic --whole-archive -ltsan --no-whole-archive -Bdynamic}}%{!static-libtsan:-ltsan}} %{%:sanitize(leak):%{!shared:liblsan_preinit%O%s} %{static-liblsan:%{!shared:-Bstatic --whole-archive -llsan --no-whole-archive -Bdynamic}}%{!static-liblsan:-llsan}}}}} %o %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): %:include(libgomp.spec)%(link_gomp)} %{fgnu-tm:%:include(libitm.spec)%(link_itm)} %(mflib) %{fsplit-stack: --wrap=pthread_create} %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} %{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address): %{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)} %{static:%ecannot specify -static with -fsanitize=address}} %{%:sanitize(thread): %{static-libtsan|static:%:include(libsanitizer.spec)%(link_libtsan)} %{static:%ecannot specify -static with -fsanitize=thread}} %{%:sanitize(undefined):%{static-libubsan:-Bstatic} -lubsan %{static-libubsan:-Bdynamic} %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}} %{%:sanitize(leak): %{static-liblsan|static:%:include(libsanitizer.spec)%(link_liblsan)}}}}} %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}} %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*} %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %{fuse-linker-plugin: %e-fuse-linker-plugin is not supported in this configuration}%{flto|flto=*:%<fcompare-debug*} %{flto} %{fno-lto} %{flto=*} %l %{shared|r:;pie|static-pie:-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}} %{fuse-ld=*:-fuse-ld=%*} %{gz|gz=zlib:--compress-debug-sections=zlib} %{gz=none:--compress-debug-sections=none} %{gz=zlib-gnu:--compress-debug-sections=zlib-gnu} %X %{o*} %{e*} %{N} %{n} %{r} %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) %{fvtable-verify=none:} %{fvtable-verify=std: %e-fvtable-verify=std is not supported in this configuration} %{fvtable-verify=preinit: %e-fvtable-verify=preinit is not supported in this configuration} %{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address):%{!shared:libasan_preinit%O%s} %{static-libasan:%{!shared:-Bstatic --whole-archive -lasan --no-whole-archive -Bdynamic}}%{!static-libasan:-lasan}} %{%:sanitize(thread):%{!shared:libtsan_preinit%O%s} %{static-libtsan:%{!shared:-Bstatic --whole-archive -ltsan --no-whole-archive -Bdynamic}}%{!static-libtsan:-ltsan}} %{%:sanitize(leak):%{!shared:liblsan_preinit%O%s} %{static-liblsan:%{!shared:-Bstatic --whole-archive -llsan --no-whole-archive -Bdynamic}}%{!static-liblsan:-llsan}}}}} %o %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1): %:include(libgomp.spec)%(link_gomp)} %{fgnu-tm:%:include(libitm.spec)%(link_itm)} %(mflib) %{fsplit-stack: --wrap=pthread_create} %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} %{!nostdlib:%{!r:%{!nodefaultlibs:%{%:sanitize(address): %{static-libasan|static:%:include(libsanitizer.spec)%(link_libasan)} %{static:%ecannot specify -static with -fsanitize=address}} %{%:sanitize(thread): %{static-libtsan|static:%:include(libsanitizer.spec)%(link_libtsan)} %{static:%ecannot specify -static with -fsanitize=thread}} %{%:sanitize(undefined):%{static-libubsan:-Bstatic} -lubsan %{static-libubsan:-Bdynamic} %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}} %{%:sanitize(leak): %{static-liblsan|static:%:include(libsanitizer.spec)%(link_liblsan)}}}}} %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}} %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*}
%(post_link) }}}}}} %(post_link) }}}}}}

View file

@ -31,7 +31,7 @@ struct char_traits
static constexpr int compare(const char_type* s1, const char_type* s2, size_t n); static constexpr int compare(const char_type* s1, const char_type* s2, size_t n);
static constexpr size_t length(const char_type* s); static constexpr size_t length(const char_type* s);
static constexpr const char_type* static constexpr const char_type*
find(const char_type* s, size_t n, const char_type& a); find(const char_type* s, size_t n, const char_type& a);
static char_type* move(char_type* s1, const char_type* s2, size_t n); static char_type* move(char_type* s1, const char_type* s2, size_t n);
static char_type* copy(char_type* s1, const char_type* s2, size_t n); static char_type* copy(char_type* s1, const char_type* s2, size_t n);
@ -424,19 +424,19 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
static constexpr static constexpr
size_t length(const char_type* __s) _NOEXCEPT; size_t length(const char_type* __s) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY static constexpr _LIBCPP_INLINE_VISIBILITY static constexpr
const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
{return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);} {return __n == 0 ? __s1 : (char_type*) memmove(__s1, __s2, __n);}
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
{ {
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n); return __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
} }
static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
{return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);} {return __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);}
@ -744,7 +744,7 @@ char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCE
// __str_find // __str_find
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
__str_find(const _CharT *__p, _SizeT __sz, __str_find(const _CharT *__p, _SizeT __sz,
_CharT __c, _SizeT __pos) _NOEXCEPT _CharT __c, _SizeT __pos) _NOEXCEPT
{ {
if (__pos >= __sz) if (__pos >= __sz)
@ -796,7 +796,7 @@ __search_substring(const _CharT *__first1, const _CharT *__last1,
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
__str_find(const _CharT *__p, _SizeT __sz, __str_find(const _CharT *__p, _SizeT __sz,
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
{ {
if (__pos > __sz) if (__pos > __sz)
@ -818,7 +818,7 @@ __str_find(const _CharT *__p, _SizeT __sz,
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
__str_rfind(const _CharT *__p, _SizeT __sz, __str_rfind(const _CharT *__p, _SizeT __sz,
_CharT __c, _SizeT __pos) _NOEXCEPT _CharT __c, _SizeT __pos) _NOEXCEPT
{ {
if (__sz < 1) if (__sz < 1)
@ -837,7 +837,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz,
template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> template<class _CharT, class _SizeT, class _Traits, _SizeT __npos>
inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
__str_rfind(const _CharT *__p, _SizeT __sz, __str_rfind(const _CharT *__p, _SizeT __sz,
const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT
{ {
__pos = _VSTD::min(__pos, __sz); __pos = _VSTD::min(__pos, __sz);
@ -846,7 +846,7 @@ __str_rfind(const _CharT *__p, _SizeT __sz,
else else
__pos = __sz; __pos = __sz;
const _CharT* __r = _VSTD::__find_end( const _CharT* __r = _VSTD::__find_end(
__p, __p + __pos, __s, __s + __n, _Traits::eq, __p, __p + __pos, __s, __s + __n, _Traits::eq,
random_access_iterator_tag(), random_access_iterator_tag()); random_access_iterator_tag(), random_access_iterator_tag());
if (__n > 0 && __r == __p + __pos) if (__n > 0 && __r == __p + __pos)
return __npos; return __npos;
@ -975,7 +975,7 @@ struct __quoted_output_proxy
__quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e) __quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e)
: __first(__f), __last(__l), __delim(__d), __escape(__e) {} : __first(__f), __last(__l), __delim(__d), __escape(__e) {}
// This would be a nice place for a string_ref // This would be a nice place for a string_ref
}; };
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View file

@ -453,7 +453,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __reset() { __id_ = 0; } void __reset() { __id_ = 0; }
template<class _CharT, class _Traits> template<class _CharT, class _Traits>
friend friend
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY

View file

@ -42,7 +42,7 @@ namespace std {
template<class T> template<class T>
constexpr int popcount(T x) noexcept; // C++20 constexpr int popcount(T x) noexcept; // C++20
// 20.15.9, endian // 20.15.9, endian
enum class endian { enum class endian {
little = see below, // C++20 little = see below, // C++20
big = see below, // C++20 big = see below, // C++20
@ -350,7 +350,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool __ispow2(_Tp __t) _NOEXCEPT bool __ispow2(_Tp __t) _NOEXCEPT
{ {
static_assert(__bitop_unsigned_integer<_Tp>::value, "__ispow2 requires unsigned"); static_assert(__bitop_unsigned_integer<_Tp>::value, "__ispow2 requires unsigned");
return __t != 0 && (((__t & (__t - 1)) == 0)); return __t != 0 && (((__t & (__t - 1)) == 0));
} }

View file

@ -18,7 +18,7 @@ Macros:
NULL NULL
CLOCKS_PER_SEC CLOCKS_PER_SEC
TIME_UTC // C++17 TIME_UTC // C++17
namespace std namespace std
{ {
@ -29,7 +29,7 @@ Types:
time_t time_t
tm tm
timespec // C++17 timespec // C++17
clock_t clock(); clock_t clock();
double difftime(time_t time1, time_t time0); double difftime(time_t time1, time_t time0);
time_t mktime(tm* timeptr); time_t mktime(tm* timeptr);

View file

@ -2211,7 +2211,7 @@ list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
__i = __j; __i = __j;
} }
} }
return (__remove_return_type) __deleted_nodes.size(); return (__remove_return_type) __deleted_nodes.size();
} }

View file

@ -435,7 +435,7 @@ a.aVeryLongName012345678901234567890123456789012345678901234567890123456789 ==
-- test of large float/integer indices -- test of large float/integer indices
-- compute maximum integer where all bits fit in a float -- compute maximum integer where all bits fit in a float
local maxint = math.maxinteger local maxint = math.maxinteger

View file

@ -7,7 +7,7 @@ end
print "testing large tables" print "testing large tables"
local debug = require"debug" local debug = require"debug"
local lim = 2^18 + 1000 local lim = 2^18 + 1000
local prog = { "local y = {0" } local prog = { "local y = {0" }
@ -46,7 +46,7 @@ getmetatable(env).__newindex = function () end
local e, m = pcall(f) local e, m = pcall(f)
assert(not e and m:find("global 'X'")) assert(not e and m:find("global 'X'"))
-- errors in metamethods -- errors in metamethods
getmetatable(env).__newindex = function () error("hi") end getmetatable(env).__newindex = function () error("hi") end
local e, m = xpcall(f, debug.traceback) local e, m = xpcall(f, debug.traceback)
assert(not e and m:find("'newindex'")) assert(not e and m:find("'newindex'"))
@ -55,7 +55,7 @@ f, X = nil
coroutine.yield'b' coroutine.yield'b'
if 2^32 == 0 then -- (small integers) { if 2^32 == 0 then -- (small integers) {
print "testing string length overflow" print "testing string length overflow"

View file

@ -162,7 +162,7 @@ do
X = function () return b end -- closure with upvalue X = function () return b end -- closure with upvalue
if a then break end if a then break end
end end
do do
local b = 20 local b = 20
Y = function () return b end -- closure with upvalue Y = function () return b end -- closure with upvalue
@ -172,7 +172,7 @@ do
assert(X() == 10 and Y() == 20) assert(X() == 10 and Y() == 20)
end end
-- testing closures x repeat-until -- testing closures x repeat-until
local a = {} local a = {}

View file

@ -467,7 +467,7 @@ else
print "testing yields inside hooks" print "testing yields inside hooks"
local turn local turn
function fact (t, x) function fact (t, x)
assert(turn == t) assert(turn == t)
if x == 0 then return 1 if x == 0 then return 1
@ -591,7 +591,7 @@ else
print "testing coroutine API" print "testing coroutine API"
-- reusing a thread -- reusing a thread
assert(T.testC([[ assert(T.testC([[
newthread # create thread newthread # create thread
@ -870,7 +870,7 @@ do -- a few more tests for comparison operators
until res ~= 10 until res ~= 10
return res return res
end end
local function test () local function test ()
local a1 = setmetatable({x=1}, mt1) local a1 = setmetatable({x=1}, mt1)
local a2 = setmetatable({x=2}, mt2) local a2 = setmetatable({x=2}, mt2)
@ -882,7 +882,7 @@ do -- a few more tests for comparison operators
assert(2 >= a2) assert(2 >= a2)
return true return true
end end
run(test) run(test)
end end
@ -1042,11 +1042,11 @@ co = coroutine.wrap(function (...) return
cannot be here! cannot be here!
]], ]],
[[ # 1st continuation [[ # 1st continuation
yieldk 0 3 yieldk 0 3
cannot be here! cannot be here!
]], ]],
[[ # 2nd continuation [[ # 2nd continuation
yieldk 0 4 yieldk 0 4
cannot be here! cannot be here!
]], ]],
[[ # 3th continuation [[ # 3th continuation

View file

@ -359,7 +359,7 @@ end
function g(a,b) return (a+1) + f() end function g(a,b) return (a+1) + f() end
assert(g(0,0) == 30) assert(g(0,0) == 30)
debug.sethook(nil); debug.sethook(nil);
assert(not debug.gethook()) assert(not debug.gethook())
@ -411,7 +411,7 @@ debug.sethook(function (e)
dostring("XX = 12") -- test dostring inside hooks dostring("XX = 12") -- test dostring inside hooks
-- testing errors inside hooks -- testing errors inside hooks
assert(not pcall(load("a='joao'+1"))) assert(not pcall(load("a='joao'+1")))
debug.sethook(function (e, l) debug.sethook(function (e, l)
assert(debug.getinfo(2, "l").currentline == l) assert(debug.getinfo(2, "l").currentline == l)
local f,m,c = debug.gethook() local f,m,c = debug.gethook()
assert(e == "line") assert(e == "line")
@ -474,7 +474,7 @@ do print("testing inspection of parameters/returned values")
local t = {} local t = {}
for i = ar.ftransfer, ar.ftransfer + ar.ntransfer - 1 do for i = ar.ftransfer, ar.ftransfer + ar.ntransfer - 1 do
local _, v = debug.getlocal(2, i) local _, v = debug.getlocal(2, i)
t[#t + 1] = v t[#t + 1] = v
end end
if event == "return" then if event == "return" then
out = t out = t
@ -528,7 +528,7 @@ assert(t.a == 1 and t.b == 2 and t.c == 3)
assert(debug.setupvalue(foo1, 1, "xuxu") == "b") assert(debug.setupvalue(foo1, 1, "xuxu") == "b")
assert(({debug.getupvalue(foo2, 3)})[2] == "xuxu") assert(({debug.getupvalue(foo2, 3)})[2] == "xuxu")
-- upvalues of C functions are allways "called" "" (the empty string) -- upvalues of C functions are allways "called" "" (the empty string)
assert(debug.getupvalue(string.gmatch("x", "x"), 1) == "") assert(debug.getupvalue(string.gmatch("x", "x"), 1) == "")
-- testing count hooks -- testing count hooks
@ -960,7 +960,7 @@ end
do -- tests for 'source' in binary dumps do -- tests for 'source' in binary dumps
local prog = [[ local prog = [[
return function (x) return function (x)
return function (y) return function (y)
return x + y return x + y
end end
end end
@ -975,7 +975,7 @@ do -- tests for 'source' in binary dumps
local h = g(3) local h = g(3)
assert(h(5) == 8) assert(h(5) == 8)
assert(debug.getinfo(f).source == name and -- all functions have 'source' assert(debug.getinfo(f).source == name and -- all functions have 'source'
debug.getinfo(g).source == name and debug.getinfo(g).source == name and
debug.getinfo(h).source == name) debug.getinfo(h).source == name)
-- again, without debug info -- again, without debug info
local c = string.dump(p, true) local c = string.dump(p, true)
@ -985,7 +985,7 @@ do -- tests for 'source' in binary dumps
local h = g(30) local h = g(30)
assert(h(50) == 80) assert(h(50) == 80)
assert(debug.getinfo(f).source == '=?' and -- no function has 'source' assert(debug.getinfo(f).source == '=?' and -- no function has 'source'
debug.getinfo(g).source == '=?' and debug.getinfo(g).source == '=?' and
debug.getinfo(h).source == '=?') debug.getinfo(h).source == '=?')
end end

View file

@ -493,7 +493,7 @@ if not _soft then
f(3) f(3)
local function loop (x,y,z) return 1 + loop(x, y, z) end local function loop (x,y,z) return 1 + loop(x, y, z) end
local res, msg = xpcall(loop, function (m) local res, msg = xpcall(loop, function (m)
assert(string.find(m, "stack overflow")) assert(string.find(m, "stack overflow"))
checkerr("error handling", loop) checkerr("error handling", loop)
@ -526,7 +526,7 @@ do
-- 'assert' with extra arguments -- 'assert' with extra arguments
res, msg = pcall(assert, false, "X", t) res, msg = pcall(assert, false, "X", t)
assert(not res and msg == "X") assert(not res and msg == "X")
-- 'assert' with no message -- 'assert' with no message
res, msg = pcall(function () assert(false) end) res, msg = pcall(function () assert(false) end)
local line = string.match(msg, "%w+%.lua:(%d+): assertion failed!$") local line = string.match(msg, "%w+%.lua:(%d+): assertion failed!$")

View file

@ -74,7 +74,7 @@ end
function hugeid () function hugeid ()
print("loading chunk with huge identifier") print("loading chunk with huge identifier")
local st, msg = loadrep("a", "chars") local st, msg = loadrep("a", "chars")
assert(not st and assert(not st and
(string.find(msg, "lexical element too long") or (string.find(msg, "lexical element too long") or
string.find(msg, "not enough memory"))) string.find(msg, "not enough memory")))
print('+') print('+')
@ -158,7 +158,7 @@ function toomanyidx ()
print("expected error: ", msg) print("expected error: ", msg)
print("size:", #a) print("size:", #a)
end end
-- teststring() -- teststring()

View file

@ -32,7 +32,7 @@ LUAMOD_API int anotherfunc (lua_State *L) {
lua_pushfstring(L, "%d%%%d\n", (int)lua_tointeger(L, 1), lua_pushfstring(L, "%d%%%d\n", (int)lua_tointeger(L, 1),
(int)lua_tointeger(L, 2)); (int)lua_tointeger(L, 2));
return 1; return 1;
} }
LUAMOD_API int luaopen_lib1_sub (lua_State *L) { LUAMOD_API int luaopen_lib1_sub (lua_State *L) {

View file

@ -140,7 +140,7 @@ assert(eqT(3.5 // 1.5, 2.0))
assert(eqT(3.5 // -1.5, -3.0)) assert(eqT(3.5 // -1.5, -3.0))
do -- tests for different kinds of opcodes do -- tests for different kinds of opcodes
local x, y local x, y
x = 1; assert(x // 0.0 == 1/0) x = 1; assert(x // 0.0 == 1/0)
x = 1.0; assert(x // 0 == 1/0) x = 1.0; assert(x // 0 == 1/0)
x = 3.5; assert(eqT(x // 1, 3.0)) x = 3.5; assert(eqT(x // 1, 3.0))
@ -618,7 +618,7 @@ assert(minint % -1 == 0)
assert(minint % -2 == 0) assert(minint % -2 == 0)
assert(maxint % -2 == -1) assert(maxint % -2 == -1)
-- non-portable tests because Windows C library cannot compute -- non-portable tests because Windows C library cannot compute
-- fmod(1, huge) correctly -- fmod(1, huge) correctly
if not _port then if not _port then
local function anan (x) assert(isNaN(x)) end -- assert Not a Number local function anan (x) assert(isNaN(x)) end -- assert Not a Number

View file

@ -79,7 +79,7 @@ end
print "testing pack" print "testing pack"
a = table.pack() a = table.pack()
assert(a[1] == undef and a.n == 0) assert(a[1] == undef and a.n == 0)
a = table.pack(table) a = table.pack(table)
assert(a[1] == table and a.n == 1) assert(a[1] == table and a.n == 1)
@ -94,8 +94,8 @@ do
checkerror("table expected", table.move, 1, 2, 3, 4) checkerror("table expected", table.move, 1, 2, 3, 4)
local function eqT (a, b) local function eqT (a, b)
for k, v in pairs(a) do assert(b[k] == v) end for k, v in pairs(a) do assert(b[k] == v) end
for k, v in pairs(b) do assert(a[k] == v) end for k, v in pairs(b) do assert(a[k] == v) end
end end
local a = table.move({10,20,30}, 1, 3, 2) -- move forward local a = table.move({10,20,30}, 1, 3, 2) -- move forward

View file

@ -331,7 +331,7 @@ do print("testing 'format %a %A'")
assert(string.find(string.format("%a", 0/0), "^%-?nan")) assert(string.find(string.format("%a", 0/0), "^%-?nan"))
assert(string.find(string.format("%a", -0.0), "^%-0x0")) assert(string.find(string.format("%a", -0.0), "^%-0x0"))
end end
if not pcall(string.format, "%.3a", 0) then if not pcall(string.format, "%.3a", 0) then
(Message or print)("\n >>> modifiers for format '%a' not available <<<\n") (Message or print)("\n >>> modifiers for format '%a' not available <<<\n")
else else

View file

@ -173,7 +173,7 @@ else
assert(pack("f", 24) == pack(">f", 24)) assert(pack("f", 24) == pack(">f", 24))
end end
print "testing pack/unpack of floating-point numbers" print "testing pack/unpack of floating-point numbers"
for _, n in ipairs{0, -1.1, 1.9, 1/0, -1/0, 1e20, -1e20, 0.1, 2000.7} do for _, n in ipairs{0, -1.1, 1.9, 1/0, -1/0, 1e20, -1e20, 0.1, 2000.7} do
assert(unpack("n", pack("n", n)) == n) assert(unpack("n", pack("n", n)) == n)
@ -243,7 +243,7 @@ do
assert(#x == packsize("<b h b f d f n i")) assert(#x == packsize("<b h b f d f n i"))
local a, b, c, d, e, f, g, h = unpack("<b h b f d f n i", x) local a, b, c, d, e, f, g, h = unpack("<b h b f d f n i", x)
assert(a == 1 and b == 2 and c == 3 and d == 4 and e == 5 and f == 6 and assert(a == 1 and b == 2 and c == 3 and d == 4 and e == 5 and f == 6 and
g == 7 and h == 8) g == 7 and h == 8)
end end
print "testing alignment" print "testing alignment"
@ -253,7 +253,7 @@ do
assert(#x == packsize(">!8 b Xh i4 i8 c1 Xi8")) assert(#x == packsize(">!8 b Xh i4 i8 c1 Xi8"))
assert(x == "\xf4" .. "\0\0\0" .. assert(x == "\xf4" .. "\0\0\0" ..
"\0\0\0\100" .. "\0\0\0\100" ..
"\0\0\0\0\0\0\0\xC8" .. "\0\0\0\0\0\0\0\xC8" ..
"\xEC" .. "\0\0\0\0\0\0\0") "\xEC" .. "\0\0\0\0\0\0\0")
local a, b, c, d, pos = unpack(">!8 c1 Xh i4 i8 b Xi8 XI XH", x) local a, b, c, d, pos = unpack(">!8 c1 Xh i4 i8 b Xi8 XI XH", x)
assert(a == "\xF4" and b == 100 and c == 200 and d == -20 and (pos - 1) == #x) assert(a == "\xF4" and b == 100 and c == 200 and d == -20 and (pos - 1) == #x)
@ -315,7 +315,7 @@ do -- testing initial position
assert(unpack("c0", x, i) == "") assert(unpack("c0", x, i) == "")
end end
checkerror("out of string", unpack, "c0", x, #x + 2) checkerror("out of string", unpack, "c0", x, #x + 2)
end end
print "OK" print "OK"

View file

@ -32,9 +32,9 @@ extern "C" {
******************************************/ ******************************************/
#include "third_party/lz4cli/platform.h" #include "third_party/lz4cli/platform.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/time/time.h" #include "libc/time/time.h"
#include "libc/errno.h" #include "libc/errno.h"

View file

@ -48,7 +48,7 @@ static const unsigned char base64_dec_map[128] =
#define BASE64_SIZE_T_MAX ( (size_t) -1 ) /* SIZE_T_MAX is not standard */ #define BASE64_SIZE_T_MAX ( (size_t) -1 ) /* SIZE_T_MAX is not standard */
/* /*
* Constant flow conditional assignment to unsigned char * Constant flow conditional assignment to unsigned char
*/ */
forceinline void mbedtls_base64_cond_assign_uchar( unsigned char * dest, forceinline void mbedtls_base64_cond_assign_uchar( unsigned char * dest,
const unsigned char * const src, const unsigned char * const src,

View file

@ -80,7 +80,7 @@ int mbedtls_mpi_shift_l(mbedtls_mpi *X, size_t k)
m = k / biL; m = k / biL;
k = k % biL; k = k % biL;
z = X->n; z = X->n;
if (n > X->n && (r = mbedtls_mpi_grow(X, n))) if (n > X->n && (r = mbedtls_mpi_grow(X, n)))
return r; return r;
if (k) if (k)
{ {

View file

@ -469,7 +469,7 @@ int mbedtls_cipher_update( mbedtls_cipher_context_t *ctx, const unsigned char *i
*olen = ilen; *olen = ilen;
if( ( ret = ctx->cipher_info->base->ecb_func( ctx->cipher_ctx, if( ( ret = ctx->cipher_info->base->ecb_func( ctx->cipher_ctx,
ctx->operation, ctx->operation,
input, output ) ) ) input, output ) ) )
{ {
return( ret ); return( ret );

View file

@ -312,7 +312,7 @@ cleanup:
* Pick a random R in the range [2, M) for blinding purposes * Pick a random R in the range [2, M) for blinding purposes
*/ */
static int dhm_random_below( mbedtls_mpi *R, const mbedtls_mpi *M, static int dhm_random_below( mbedtls_mpi *R, const mbedtls_mpi *M,
int (*f_rng)(void *, unsigned char *, size_t), int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng ) void *p_rng )
{ {
int ret, count; int ret, count;
@ -342,7 +342,7 @@ cleanup:
* Berlin Heidelberg, 1996. p. 104-113. * Berlin Heidelberg, 1996. p. 104-113.
*/ */
static int dhm_update_blinding( mbedtls_dhm_context *ctx, static int dhm_update_blinding( mbedtls_dhm_context *ctx,
int (*f_rng)(void *, unsigned char *, size_t), int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng ) void *p_rng )
{ {
int ret; int ret;

View file

@ -125,7 +125,7 @@ static inline int ecp_drbg_random( void *p_rng,
/* DRBG context seeding */ /* DRBG context seeding */
static int ecp_drbg_seed( ecp_drbg_context *ctx, static int ecp_drbg_seed( ecp_drbg_context *ctx,
const mbedtls_mpi *secret, const mbedtls_mpi *secret,
size_t secret_len ) size_t secret_len )
{ {
int ret; int ret;

View file

@ -210,7 +210,7 @@ int mbedtls_internal_ecp_double_add_mxz( const mbedtls_ecp_group *grp,
*/ */
#if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT) #if defined(MBEDTLS_ECP_RANDOMIZE_MXZ_ALT)
int mbedtls_internal_ecp_randomize_mxz( const mbedtls_ecp_group *grp, int mbedtls_internal_ecp_randomize_mxz( const mbedtls_ecp_group *grp,
mbedtls_ecp_point *P, mbedtls_ecp_point *P,
int (*f_rng)(void *, unsigned char *, size_t), int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng ); void *p_rng );
#endif #endif

View file

@ -365,7 +365,7 @@ int mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t *md_inf
ctx->md_info = md_info; ctx->md_info = md_info;
ctx->md_ctx = NULL; ctx->md_ctx = NULL;
ctx->hmac_ctx = NULL; ctx->hmac_ctx = NULL;
if ((csize = GetMdContextSize(md_info->type)) < 0) if ((csize = GetMdContextSize(md_info->type)) < 0)
return( csize ); return( csize );
if( !( ctx->md_ctx = mbedtls_calloc( 1, csize ) ) ) if( !( ctx->md_ctx = mbedtls_calloc( 1, csize ) ) )
return( MBEDTLS_ERR_MD_ALLOC_FAILED ); return( MBEDTLS_ERR_MD_ALLOC_FAILED );

View file

@ -178,7 +178,7 @@ forceinline int mbedtls_md_starts( mbedtls_md_context_t *ctx )
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
* failure. * failure.
*/ */
forceinline int mbedtls_md_update( mbedtls_md_context_t *ctx, forceinline int mbedtls_md_update( mbedtls_md_context_t *ctx,
const unsigned char *input, size_t ilen ) const unsigned char *input, size_t ilen )
{ {
if( !ctx || !ctx->md_info ) if( !ctx || !ctx->md_info )
@ -204,7 +204,7 @@ forceinline int mbedtls_md_update( mbedtls_md_context_t *ctx,
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
* failure. * failure.
*/ */
forceinline int mbedtls_md_finish( mbedtls_md_context_t *ctx, forceinline int mbedtls_md_finish( mbedtls_md_context_t *ctx,
unsigned char *output ) unsigned char *output )
{ {
if( !ctx || !ctx->md_info ) if( !ctx || !ctx->md_info )
@ -230,7 +230,7 @@ forceinline int mbedtls_md_finish( mbedtls_md_context_t *ctx,
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
* failure. * failure.
*/ */
forceinline int mbedtls_md( const mbedtls_md_info_t *md_info, forceinline int mbedtls_md( const mbedtls_md_info_t *md_info,
const unsigned char *input, size_t ilen, const unsigned char *input, size_t ilen,
unsigned char *output ) unsigned char *output )
{ {
@ -264,8 +264,8 @@ int mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const unsigned char *key,
* \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification * \return #MBEDTLS_ERR_MD_BAD_INPUT_DATA on parameter-verification
* failure. * failure.
*/ */
forceinline int mbedtls_md_hmac_update( mbedtls_md_context_t *ctx, forceinline int mbedtls_md_hmac_update( mbedtls_md_context_t *ctx,
const unsigned char *input, const unsigned char *input,
size_t ilen ) size_t ilen )
{ {
if( ctx == NULL || ctx->md_info == NULL || ctx->hmac_ctx == NULL ) if( ctx == NULL || ctx->md_info == NULL || ctx->hmac_ctx == NULL )

View file

@ -475,7 +475,7 @@ int mbedtls_pk_sign_restartable( mbedtls_pk_context *ctx,
mbedtls_md_type_t md_alg, mbedtls_md_type_t md_alg,
const unsigned char *hash, size_t hash_len, const unsigned char *hash, size_t hash_len,
unsigned char *sig, size_t *sig_len, unsigned char *sig, size_t *sig_len,
int (*f_rng)(void *, unsigned char *, size_t), int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng, mbedtls_pk_restart_ctx *rs_ctx ) void *p_rng, mbedtls_pk_restart_ctx *rs_ctx )
{ {
PK_VALIDATE_RET( ctx ); PK_VALIDATE_RET( ctx );

View file

@ -309,7 +309,7 @@ cleanup:
static int eckey_sign_rs_wrap( void *ctx, mbedtls_md_type_t md_alg, static int eckey_sign_rs_wrap( void *ctx, mbedtls_md_type_t md_alg,
const unsigned char *hash, size_t hash_len, const unsigned char *hash, size_t hash_len,
unsigned char *sig, size_t *sig_len, unsigned char *sig, size_t *sig_len,
int (*f_rng)(void *, unsigned char *, size_t), int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng, void *rs_ctx ) void *p_rng, void *rs_ctx )
{ {
int ret = MBEDTLS_ERR_THIS_CORRUPTION; int ret = MBEDTLS_ERR_THIS_CORRUPTION;

View file

@ -1514,7 +1514,7 @@ void mbedtls_ssl_set_verify( mbedtls_ssl_context *, int (*)(void *, mbedtls_x509
* MBEDTLS_ERR_XXX_ALLOC_FAILED on memory allocation error. * MBEDTLS_ERR_XXX_ALLOC_FAILED on memory allocation error.
*/ */
forceinline int mbedtls_ssl_config_defaults( mbedtls_ssl_config *conf, forceinline int mbedtls_ssl_config_defaults( mbedtls_ssl_config *conf,
int endpoint, int transport, int endpoint, int transport,
int preset ) { int preset ) {
int mbedtls_ssl_config_defaults_impl(mbedtls_ssl_config *, int, int, int, int mbedtls_ssl_config_defaults_impl(mbedtls_ssl_config *, int, int, int,
int (*)(mbedtls_ssl_context *)); int (*)(mbedtls_ssl_context *));
@ -1522,13 +1522,13 @@ forceinline int mbedtls_ssl_config_defaults( mbedtls_ssl_config *conf,
#if defined(MBEDTLS_SSL_CLI_C) #if defined(MBEDTLS_SSL_CLI_C)
case MBEDTLS_SSL_IS_CLIENT: case MBEDTLS_SSL_IS_CLIENT:
return mbedtls_ssl_config_defaults_impl( return mbedtls_ssl_config_defaults_impl(
conf, endpoint, transport, preset, conf, endpoint, transport, preset,
mbedtls_ssl_handshake_client_step); mbedtls_ssl_handshake_client_step);
#endif #endif
#if defined(MBEDTLS_SSL_SRV_C) #if defined(MBEDTLS_SSL_SRV_C)
case MBEDTLS_SSL_IS_SERVER: case MBEDTLS_SSL_IS_SERVER:
return mbedtls_ssl_config_defaults_impl( return mbedtls_ssl_config_defaults_impl(
conf, endpoint, transport, preset, conf, endpoint, transport, preset,
mbedtls_ssl_handshake_server_step); mbedtls_ssl_handshake_server_step);
#endif #endif
default: default:

View file

@ -31,7 +31,7 @@ asm(".include \"libc/disclaimer.inc\"");
/* /*
* CRYPTOGRAPHY 101 * CRYPTOGRAPHY 101
* *
* OK WEAK BROKEN * OK WEAK BROKEN
* ------------------ ------ ------ * ------------------ ------ ------
* ECDHE > ECDH > DHE * ECDHE > ECDH > DHE

View file

@ -1762,7 +1762,7 @@ read_record_header:
MBEDTLS_SSL_DEBUG_BUF( 3, "client hello, session id", buf + 35, sess_len ); MBEDTLS_SSL_DEBUG_BUF( 3, "client hello, session id", buf + 35, sess_len );
ssl->session_negotiate->id_len = sess_len; ssl->session_negotiate->id_len = sess_len;
mbedtls_platform_zeroize( ssl->session_negotiate->id, mbedtls_platform_zeroize( ssl->session_negotiate->id,
sizeof( ssl->session_negotiate->id ) ); sizeof( ssl->session_negotiate->id ) );
memcpy( ssl->session_negotiate->id, buf + 35, memcpy( ssl->session_negotiate->id, buf + 35,
ssl->session_negotiate->id_len ); ssl->session_negotiate->id_len );

View file

@ -17,25 +17,4 @@ TkwxETAPBgNVBAoTCFBvbGFyU1NMMRwwGgYDVQQDExNQb2xhcnNzbCBUZXN0IEVD
IENBggkAwUPifmJDzOgwCgYIKoZIzj0EAwQDaQAwZgIxAL/VFrDIYUECsS0rVpAy IENBggkAwUPifmJDzOgwCgYIKoZIzj0EAwQDaQAwZgIxAL/VFrDIYUECsS0rVpAy
6zt/CqeAZ1sa/l5LTaG1XW286n2Kibipr6EpkYZNYIQILgIxAI0wb3Py1DHPWpYf 6zt/CqeAZ1sa/l5LTaG1XW286n2Kibipr6EpkYZNYIQILgIxAI0wb3Py1DHPWpYf
/BFBH7C3KYq+nWTrLeEnhrjU1LzG/CiQ8lnuskya6lw/P3lJ/A== /BFBH7C3KYq+nWTrLeEnhrjU1LzG/CiQ8lnuskya6lw/P3lJ/A==
-----END X509 CRL----- M third_party/mbedtls/base64.c -----END X509 CRL-----
M third_party/mbedtls/bigshift.c
M third_party/mbedtls/cipher.c
M third_party/mbedtls/dhm.c
M third_party/mbedtls/ecp.c
M third_party/mbedtls/ecp_internal.h
M third_party/mbedtls/md.c
M third_party/mbedtls/md.h
M third_party/mbedtls/pk.c
M third_party/mbedtls/pk_wrap.c
M third_party/mbedtls/ssl.h
M third_party/mbedtls/ssl_ciphersuites.c
M third_party/mbedtls/ssl_srv.c
M third_party/mbedtls/test/data/crl-malformed-trailing-spaces.pem
M third_party/mbedtls/test/data/dir4/Readme
M third_party/mbedtls/test/data/server10_int3_int-ca2_ca.crt
M third_party/mbedtls/test/data/server7_trailing_space.crt
M third_party/mbedtls/test/data/server9-with-ca.crt
M third_party/mbedtls/test/test_suite_ssl.c
M third_party/mbedtls/x509.h
M third_party/mbedtls/x509write_crt.c

View file

@ -1,4 +1,4 @@
This directory contains the certificates for the tests targeting the enforcement of the policy indicated by the *pathLenConstraint* field. All leaf elements were generated with *is_ca* unset and all roots with the *selfsign=1* option. This directory contains the certificates for the tests targeting the enforcement of the policy indicated by the *pathLenConstraint* field. All leaf elements were generated with *is_ca* unset and all roots with the *selfsign=1* option.
1. zero pathlen constraint on an intermediate CA (invalid) 1. zero pathlen constraint on an intermediate CA (invalid)
``` ```
@ -17,7 +17,7 @@ cert31.crt (max_pathlen=1) -> cert32.crt -> cert33.crt -> cert34.crt
4. nonzero pathlen constraint on an intermediate CA (invalid) 4. nonzero pathlen constraint on an intermediate CA (invalid)
``` ```
cert41.crt -> cert42.crt (max_pathlen=1) -> cert43.crt -> cert44.crt -> cert45.crt cert41.crt -> cert42.crt (max_pathlen=1) -> cert43.crt -> cert44.crt -> cert45.crt
``` ```
5. nonzero pathlen constraint on an intermediate CA with maximum number of elements in the chain (valid) 5. nonzero pathlen constraint on an intermediate CA with maximum number of elements in the chain (valid)
@ -30,7 +30,7 @@ cert51.crt -> cert52.crt (max_pathlen=1) -> cert53.crt -> cert54.crt
cert61.crt (max_pathlen=1) -> cert62.crt -> cert63.crt cert61.crt (max_pathlen=1) -> cert62.crt -> cert63.crt
``` ```
7. pathlen constraint on the root CA with maximum number of elements and a self signed certificate in the chain (valid) 7. pathlen constraint on the root CA with maximum number of elements and a self signed certificate in the chain (valid)
(This situation happens for example when a root of some hierarchy gets integrated into another hierarchy. In this case the certificates issued before the integration will have an intermadiate self signed certificate in their chain) (This situation happens for example when a root of some hierarchy gets integrated into another hierarchy. In this case the certificates issued before the integration will have an intermadiate self signed certificate in their chain)
``` ```
cert71.crt (max_pathlen=1) -> cert72.crt -> cert73.crt (self signed) -> cert74.crt -> cert74.crt cert71.crt (max_pathlen=1) -> cert72.crt -> cert73.crt (self signed) -> cert74.crt -> cert74.crt

View file

@ -72,11 +72,11 @@ Certificate:
a2:d5 a2:d5
Exponent: 65537 (0x10001) Exponent: 65537 (0x10001)
X509v3 extensions: X509v3 extensions:
X509v3 Basic Constraints: X509v3 Basic Constraints:
CA:TRUE CA:TRUE
X509v3 Subject Key Identifier: X509v3 Subject Key Identifier:
B4:5A:E4:A5:B3:DE:D2:52:F6:B9:D5:A6:95:0F:EB:3E:BC:C7:FD:FF B4:5A:E4:A5:B3:DE:D2:52:F6:B9:D5:A6:95:0F:EB:3E:BC:C7:FD:FF
X509v3 Authority Key Identifier: X509v3 Authority Key Identifier:
keyid:B4:5A:E4:A5:B3:DE:D2:52:F6:B9:D5:A6:95:0F:EB:3E:BC:C7:FD:FF keyid:B4:5A:E4:A5:B3:DE:D2:52:F6:B9:D5:A6:95:0F:EB:3E:BC:C7:FD:FF
DirName:/C=NL/O=PolarSSL/CN=PolarSSL Test CA DirName:/C=NL/O=PolarSSL/CN=PolarSSL Test CA
serial:00 serial:00

View file

@ -1,47 +1,47 @@
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIDwjCCAaqgAwIBAgIBEDANBgkqhkiG9w0BAQsFADBIMQswCQYDVQQGEwJOTDER MIIDwjCCAaqgAwIBAgIBEDANBgkqhkiG9w0BAQsFADBIMQswCQYDVQQGEwJOTDER
MA8GA1UEChMIUG9sYXJTU0wxJjAkBgNVBAMTHVBvbGFyU1NMIFRlc3QgSW50ZXJt MA8GA1UEChMIUG9sYXJTU0wxJjAkBgNVBAMTHVBvbGFyU1NMIFRlc3QgSW50ZXJt
ZWRpYXRlIENBMB4XDTEzMDkyNDE2MTIyNFoXDTIzMDkyMjE2MTIyNFowNDELMAkG ZWRpYXRlIENBMB4XDTEzMDkyNDE2MTIyNFoXDTIzMDkyMjE2MTIyNFowNDELMAkG
A1UEBhMCTkwxETAPBgNVBAoTCFBvbGFyU1NMMRIwEAYDVQQDEwlsb2NhbGhvc3Qw A1UEBhMCTkwxETAPBgNVBAoTCFBvbGFyU1NMMRIwEAYDVQQDEwlsb2NhbGhvc3Qw
WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQcbffp2qXqoZyychmoCRxzrd4Vu96m WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQcbffp2qXqoZyychmoCRxzrd4Vu96m
47NPBehtEC46aTeXgDnBdf++znABrAtfXBRNQz8ARIeYBmskr22rlKjyo4GVMIGS 47NPBehtEC46aTeXgDnBdf++znABrAtfXBRNQz8ARIeYBmskr22rlKjyo4GVMIGS
MAkGA1UdEwQCMAAwHQYDVR0OBBYEFNIK06V3H85VsFxGoo5zbL+hYCa7MGYGA1Ud MAkGA1UdEwQCMAAwHQYDVR0OBBYEFNIK06V3H85VsFxGoo5zbL+hYCa7MGYGA1Ud
IwRfMF2AFDh32Gt3nCh3gotO2BupHveUFrcOoUKkQDA+MQswCQYDVQQGEwJOTDER IwRfMF2AFDh32Gt3nCh3gotO2BupHveUFrcOoUKkQDA+MQswCQYDVQQGEwJOTDER
MA8GA1UEChMIUG9sYXJTU0wxHDAaBgNVBAMTE1BvbGFyc3NsIFRlc3QgRUMgQ0GC MA8GA1UEChMIUG9sYXJTU0wxHDAaBgNVBAMTE1BvbGFyc3NsIFRlc3QgRUMgQ0GC
AQ4wDQYJKoZIhvcNAQELBQADggIBADRoQ5fHKw+vkl0D3aqLX1XrZidb+25AWbhr AQ4wDQYJKoZIhvcNAQELBQADggIBADRoQ5fHKw+vkl0D3aqLX1XrZidb+25AWbhr
FYXdaskN219PrXBL3cV8x5tK6qsPKSyyw1lue80OmhXs/w7PJkOHHUSWRnmTv7lr FYXdaskN219PrXBL3cV8x5tK6qsPKSyyw1lue80OmhXs/w7PJkOHHUSWRnmTv7lr
8Us3Zr/yOF/VVqzdGs7DlOTpyzEBdugI9uar/aCqHDoltN8wOduOoQB9aojYpROj 8Us3Zr/yOF/VVqzdGs7DlOTpyzEBdugI9uar/aCqHDoltN8wOduOoQB9aojYpROj
+gjlEO0mgt/87XpjYOig1o0jv44QYDQZQzpj1zeIn6WMe6xk9YDwCLMjRIpg++c7 +gjlEO0mgt/87XpjYOig1o0jv44QYDQZQzpj1zeIn6WMe6xk9YDwCLMjRIpg++c7
QyxvcEJTn80wX1SaEBM2gau97G7bORLMwBVkMT4oSY+iKYgpPpawOnMJbqUP73Dm QyxvcEJTn80wX1SaEBM2gau97G7bORLMwBVkMT4oSY+iKYgpPpawOnMJbqUP73Dm
yfJExDdrW/BbWZ/vKIcSqSZIbkHdkNjUDVHczyVwQxZxzvLFw/B1k9s7jYFsi5eK yfJExDdrW/BbWZ/vKIcSqSZIbkHdkNjUDVHczyVwQxZxzvLFw/B1k9s7jYFsi5eK
TNAdXFa4et1H2sd+uhu24GxsjmJioDrftixcgzPVBjDCjH8QWkBEX292WJ58on0e TNAdXFa4et1H2sd+uhu24GxsjmJioDrftixcgzPVBjDCjH8QWkBEX292WJ58on0e
deWLpZUnzPdE1B4rsiPw1Vg28mGgr2O1xgBQr/fx6A+8ItNTzAXbZfEcult9ypwM deWLpZUnzPdE1B4rsiPw1Vg28mGgr2O1xgBQr/fx6A+8ItNTzAXbZfEcult9ypwM
0b6YDNe5IvdKk8iwz3mof0VNy47K6xoCaE/fxxWkjoXK8x2wfswGeP2QgUzQE93b 0b6YDNe5IvdKk8iwz3mof0VNy47K6xoCaE/fxxWkjoXK8x2wfswGeP2QgUzQE93b
OtjdHpsG1c7gIVFQmKATyAPUz4vqmezgNRleXU0oL0PYtoCmKQ51UjNMUfmO9xCj OtjdHpsG1c7gIVFQmKATyAPUz4vqmezgNRleXU0oL0PYtoCmKQ51UjNMUfmO9xCj
VJaNa2iTQ5Dgic+CW4TYAgj5/9g9X3WfwnDNxrZ0UxxawGElczHXqbrNleTtPaKp VJaNa2iTQ5Dgic+CW4TYAgj5/9g9X3WfwnDNxrZ0UxxawGElczHXqbrNleTtPaKp
a8Si6UK5 a8Si6UK5
-----END CERTIFICATE----- -----END CERTIFICATE-----
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIEATCCA4egAwIBAgIBDjAKBggqhkjOPQQDAjA+MQswCQYDVQQGEwJOTDERMA8G MIIEATCCA4egAwIBAgIBDjAKBggqhkjOPQQDAjA+MQswCQYDVQQGEwJOTDERMA8G
A1UEChMIUG9sYXJTU0wxHDAaBgNVBAMTE1BvbGFyc3NsIFRlc3QgRUMgQ0EwHhcN A1UEChMIUG9sYXJTU0wxHDAaBgNVBAMTE1BvbGFyc3NsIFRlc3QgRUMgQ0EwHhcN
MTMwOTI0MTU1NTE0WhcNMjMwOTIyMTU1NTE0WjBIMQswCQYDVQQGEwJOTDERMA8G MTMwOTI0MTU1NTE0WhcNMjMwOTIyMTU1NTE0WjBIMQswCQYDVQQGEwJOTDERMA8G
A1UEChMIUG9sYXJTU0wxJjAkBgNVBAMTHVBvbGFyU1NMIFRlc3QgSW50ZXJtZWRp A1UEChMIUG9sYXJTU0wxJjAkBgNVBAMTHVBvbGFyU1NMIFRlc3QgSW50ZXJtZWRp
YXRlIENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAo1Oc8nr6fMTq YXRlIENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAo1Oc8nr6fMTq
vowV+CpC55i5BZGFGc50Eb4RLBSRTH1e7JepdFjAVbBtyQRJSiY1ja0tgLQDDKZR vowV+CpC55i5BZGFGc50Eb4RLBSRTH1e7JepdFjAVbBtyQRJSiY1ja0tgLQDDKZR
wfEI+b4azse460InPHv7C1TN0upXlxuj6m9B1IlP+sBaM7WBC6dVfPO+jVMIxgkF wfEI+b4azse460InPHv7C1TN0upXlxuj6m9B1IlP+sBaM7WBC6dVfPO+jVMIxgkF
CaBCLhhdK1Fjf8HjkT/PkctWnho8NTwivc9+nqRZjXe/eIcqm5HwjDDhu+gz+o0g CaBCLhhdK1Fjf8HjkT/PkctWnho8NTwivc9+nqRZjXe/eIcqm5HwjDDhu+gz+o0g
Vz9MfZNi1JyCrOyNZcy+cr2QeNnNVGnFq8xTxtu6dLunhpmLFj2mm0Vjwa7Ypj5q Vz9MfZNi1JyCrOyNZcy+cr2QeNnNVGnFq8xTxtu6dLunhpmLFj2mm0Vjwa7Ypj5q
AjpqTMtDvqbRuToyoyzajhMNcCAf7gwzIupJJFVdjdtgYAcQwzikwF5HoITJzzJ2 AjpqTMtDvqbRuToyoyzajhMNcCAf7gwzIupJJFVdjdtgYAcQwzikwF5HoITJzzJ2
qgxF7CmvGZNb7G99mLdLdhtclH3wAQKHYwEGJo7XKyNEuHPQgB+e0cg1SD1HqlAM qgxF7CmvGZNb7G99mLdLdhtclH3wAQKHYwEGJo7XKyNEuHPQgB+e0cg1SD1HqlAM
uCfGGTWQ6me7Bjan3t0NzoTdDq6IpKTesbaY+/9e2xn8DCrhBKLXQMZFDZqUoLYA uCfGGTWQ6me7Bjan3t0NzoTdDq6IpKTesbaY+/9e2xn8DCrhBKLXQMZFDZqUoLYA
kGPOEGgvlPnIIXAawouxCaNYEh5Uw871YMSPT28rLdFr49dwYOtDg9foA8hDIW2P kGPOEGgvlPnIIXAawouxCaNYEh5Uw871YMSPT28rLdFr49dwYOtDg9foA8hDIW2P
d6KXbrZteesvA1nYzEOs+3AjrbT79Md2W8Bz9bqBVNlNOESSqm4kiCJFmslm/6br d6KXbrZteesvA1nYzEOs+3AjrbT79Md2W8Bz9bqBVNlNOESSqm4kiCJFmslm/6br
Np0MSQd+o22PQ4xRtmP6UsTfU0ueiMpYc8TYYhMbfnfFyo4m707ebcflPbBEN2dg Np0MSQd+o22PQ4xRtmP6UsTfU0ueiMpYc8TYYhMbfnfFyo4m707ebcflPbBEN2dg
updQ66cvfCJB0QJt9upafY0lpdV1qUkCAwEAAaOBoDCBnTAdBgNVHQ4EFgQUOHfY updQ66cvfCJB0QJt9upafY0lpdV1qUkCAwEAAaOBoDCBnTAdBgNVHQ4EFgQUOHfY
a3ecKHeCi07YG6ke95QWtw4wbgYDVR0jBGcwZYAUnW0gJEkBPyvLeLUZvH4kydv7 a3ecKHeCi07YG6ke95QWtw4wbgYDVR0jBGcwZYAUnW0gJEkBPyvLeLUZvH4kydv7
NnyhQqRAMD4xCzAJBgNVBAYTAk5MMREwDwYDVQQKEwhQb2xhclNTTDEcMBoGA1UE NnyhQqRAMD4xCzAJBgNVBAYTAk5MMREwDwYDVQQKEwhQb2xhclNTTDEcMBoGA1UE
AxMTUG9sYXJzc2wgVGVzdCBFQyBDQYIJAMFD4n5iQ8zoMAwGA1UdEwQFMAMBAf8w AxMTUG9sYXJzc2wgVGVzdCBFQyBDQYIJAMFD4n5iQ8zoMAwGA1UdEwQFMAMBAf8w
CgYIKoZIzj0EAwIDaAAwZQIxAPyE+u+eP7gRrSFjQicmpYg8jiFUCYEowWY2zuOG CgYIKoZIzj0EAwIDaAAwZQIxAPyE+u+eP7gRrSFjQicmpYg8jiFUCYEowWY2zuOG
i1HXYwmpDHfasQ3rNSuf/gHvjwIwbSSjumDk+uYNci/KMELDsD0MFHxZhhBc9Hp9 i1HXYwmpDHfasQ3rNSuf/gHvjwIwbSSjumDk+uYNci/KMELDsD0MFHxZhhBc9Hp9
Af5cNR8KhzegznL6amRObGGKmX1F Af5cNR8KhzegznL6amRObGGKmX1F
-----END CERTIFICATE----- -----END CERTIFICATE-----

View file

@ -51,11 +51,11 @@ Certificate:
a2:d5 a2:d5
Exponent: 65537 (0x10001) Exponent: 65537 (0x10001)
X509v3 extensions: X509v3 extensions:
X509v3 Basic Constraints: X509v3 Basic Constraints:
CA:TRUE CA:TRUE
X509v3 Subject Key Identifier: X509v3 Subject Key Identifier:
B4:5A:E4:A5:B3:DE:D2:52:F6:B9:D5:A6:95:0F:EB:3E:BC:C7:FD:FF B4:5A:E4:A5:B3:DE:D2:52:F6:B9:D5:A6:95:0F:EB:3E:BC:C7:FD:FF
X509v3 Authority Key Identifier: X509v3 Authority Key Identifier:
keyid:B4:5A:E4:A5:B3:DE:D2:52:F6:B9:D5:A6:95:0F:EB:3E:BC:C7:FD:FF keyid:B4:5A:E4:A5:B3:DE:D2:52:F6:B9:D5:A6:95:0F:EB:3E:BC:C7:FD:FF
DirName:/C=NL/O=PolarSSL/CN=PolarSSL Test CA DirName:/C=NL/O=PolarSSL/CN=PolarSSL Test CA
serial:00 serial:00

View file

@ -1038,7 +1038,7 @@ int mbedtls_move_handshake_to_state( mbedtls_ssl_context *ssl,
enum { BUFFSIZE = 1024 }; enum { BUFFSIZE = 1024 };
int max_steps = 1000; int max_steps = 1000;
int ret = 0; int ret = 0;
if( ssl == NULL || second_ssl == NULL ) if( ssl == NULL || second_ssl == NULL )
{ {
return MBEDTLS_ERR_SSL_BAD_INPUT_DATA; return MBEDTLS_ERR_SSL_BAD_INPUT_DATA;

View file

@ -6,7 +6,7 @@
#include "third_party/mbedtls/rsa.h" #include "third_party/mbedtls/rsa.h"
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
/* clang-format off */ /* clang-format off */
#define MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE -0x2080 /*< Unavailable feature, e.g. RSA hashing/encryption combination. */ #define MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE -0x2080 /*< Unavailable feature, e.g. RSA hashing/encryption combination. */
#define MBEDTLS_ERR_X509_UNKNOWN_OID -0x2100 /*< Requested OID is unknown. */ #define MBEDTLS_ERR_X509_UNKNOWN_OID -0x2100 /*< Requested OID is unknown. */
#define MBEDTLS_ERR_X509_INVALID_FORMAT -0x2180 /*< The CRT/CRL/CSR format is invalid, e.g. different type expected. */ #define MBEDTLS_ERR_X509_INVALID_FORMAT -0x2180 /*< The CRT/CRL/CSR format is invalid, e.g. different type expected. */

View file

@ -237,7 +237,7 @@ int mbedtls_x509write_crt_set_validity( mbedtls_x509write_cert *ctx,
*/ */
int mbedtls_x509write_crt_set_extension( mbedtls_x509write_cert *ctx, int mbedtls_x509write_crt_set_extension( mbedtls_x509write_cert *ctx,
const char *oid, size_t oid_len, const char *oid, size_t oid_len,
int critical, const unsigned char *val, int critical, const unsigned char *val,
size_t val_len ) size_t val_len )
{ {
return( mbedtls_x509_set_extension( &ctx->extensions, oid, oid_len, return( mbedtls_x509_set_extension( &ctx->extensions, oid, oid_len,

View file

@ -51,19 +51,19 @@ struct _mod {
struct { struct {
asdl_seq *body; asdl_seq *body;
} Module; } Module;
struct { struct {
asdl_seq *body; asdl_seq *body;
} Interactive; } Interactive;
struct { struct {
expr_ty body; expr_ty body;
} Expression; } Expression;
struct { struct {
asdl_seq *body; asdl_seq *body;
} Suite; } Suite;
} v; } v;
}; };
@ -85,7 +85,7 @@ struct _stmt {
asdl_seq *decorator_list; asdl_seq *decorator_list;
expr_ty returns; expr_ty returns;
} FunctionDef; } FunctionDef;
struct { struct {
identifier name; identifier name;
arguments_ty args; arguments_ty args;
@ -93,7 +93,7 @@ struct _stmt {
asdl_seq *decorator_list; asdl_seq *decorator_list;
expr_ty returns; expr_ty returns;
} AsyncFunctionDef; } AsyncFunctionDef;
struct { struct {
identifier name; identifier name;
asdl_seq *bases; asdl_seq *bases;
@ -101,108 +101,108 @@ struct _stmt {
asdl_seq *body; asdl_seq *body;
asdl_seq *decorator_list; asdl_seq *decorator_list;
} ClassDef; } ClassDef;
struct { struct {
expr_ty value; expr_ty value;
} Return; } Return;
struct { struct {
asdl_seq *targets; asdl_seq *targets;
} Delete; } Delete;
struct { struct {
asdl_seq *targets; asdl_seq *targets;
expr_ty value; expr_ty value;
} Assign; } Assign;
struct { struct {
expr_ty target; expr_ty target;
operator_ty op; operator_ty op;
expr_ty value; expr_ty value;
} AugAssign; } AugAssign;
struct { struct {
expr_ty target; expr_ty target;
expr_ty annotation; expr_ty annotation;
expr_ty value; expr_ty value;
int simple; int simple;
} AnnAssign; } AnnAssign;
struct { struct {
expr_ty target; expr_ty target;
expr_ty iter; expr_ty iter;
asdl_seq *body; asdl_seq *body;
asdl_seq *orelse; asdl_seq *orelse;
} For; } For;
struct { struct {
expr_ty target; expr_ty target;
expr_ty iter; expr_ty iter;
asdl_seq *body; asdl_seq *body;
asdl_seq *orelse; asdl_seq *orelse;
} AsyncFor; } AsyncFor;
struct { struct {
expr_ty test; expr_ty test;
asdl_seq *body; asdl_seq *body;
asdl_seq *orelse; asdl_seq *orelse;
} While; } While;
struct { struct {
expr_ty test; expr_ty test;
asdl_seq *body; asdl_seq *body;
asdl_seq *orelse; asdl_seq *orelse;
} If; } If;
struct { struct {
asdl_seq *items; asdl_seq *items;
asdl_seq *body; asdl_seq *body;
} With; } With;
struct { struct {
asdl_seq *items; asdl_seq *items;
asdl_seq *body; asdl_seq *body;
} AsyncWith; } AsyncWith;
struct { struct {
expr_ty exc; expr_ty exc;
expr_ty cause; expr_ty cause;
} Raise; } Raise;
struct { struct {
asdl_seq *body; asdl_seq *body;
asdl_seq *handlers; asdl_seq *handlers;
asdl_seq *orelse; asdl_seq *orelse;
asdl_seq *finalbody; asdl_seq *finalbody;
} Try; } Try;
struct { struct {
expr_ty test; expr_ty test;
expr_ty msg; expr_ty msg;
} Assert; } Assert;
struct { struct {
asdl_seq *names; asdl_seq *names;
} Import; } Import;
struct { struct {
identifier module; identifier module;
asdl_seq *names; asdl_seq *names;
int level; int level;
} ImportFrom; } ImportFrom;
struct { struct {
asdl_seq *names; asdl_seq *names;
} Global; } Global;
struct { struct {
asdl_seq *names; asdl_seq *names;
} Nonlocal; } Nonlocal;
struct { struct {
expr_ty value; expr_ty value;
} Expr; } Expr;
} v; } v;
int lineno; int lineno;
int col_offset; int col_offset;
@ -224,145 +224,145 @@ struct _expr {
boolop_ty op; boolop_ty op;
asdl_seq *values; asdl_seq *values;
} BoolOp; } BoolOp;
struct { struct {
expr_ty left; expr_ty left;
operator_ty op; operator_ty op;
expr_ty right; expr_ty right;
} BinOp; } BinOp;
struct { struct {
unaryop_ty op; unaryop_ty op;
expr_ty operand; expr_ty operand;
} UnaryOp; } UnaryOp;
struct { struct {
arguments_ty args; arguments_ty args;
expr_ty body; expr_ty body;
} Lambda; } Lambda;
struct { struct {
expr_ty test; expr_ty test;
expr_ty body; expr_ty body;
expr_ty orelse; expr_ty orelse;
} IfExp; } IfExp;
struct { struct {
asdl_seq *keys; asdl_seq *keys;
asdl_seq *values; asdl_seq *values;
} Dict; } Dict;
struct { struct {
asdl_seq *elts; asdl_seq *elts;
} Set; } Set;
struct { struct {
expr_ty elt; expr_ty elt;
asdl_seq *generators; asdl_seq *generators;
} ListComp; } ListComp;
struct { struct {
expr_ty elt; expr_ty elt;
asdl_seq *generators; asdl_seq *generators;
} SetComp; } SetComp;
struct { struct {
expr_ty key; expr_ty key;
expr_ty value; expr_ty value;
asdl_seq *generators; asdl_seq *generators;
} DictComp; } DictComp;
struct { struct {
expr_ty elt; expr_ty elt;
asdl_seq *generators; asdl_seq *generators;
} GeneratorExp; } GeneratorExp;
struct { struct {
expr_ty value; expr_ty value;
} Await; } Await;
struct { struct {
expr_ty value; expr_ty value;
} Yield; } Yield;
struct { struct {
expr_ty value; expr_ty value;
} YieldFrom; } YieldFrom;
struct { struct {
expr_ty left; expr_ty left;
asdl_int_seq *ops; asdl_int_seq *ops;
asdl_seq *comparators; asdl_seq *comparators;
} Compare; } Compare;
struct { struct {
expr_ty func; expr_ty func;
asdl_seq *args; asdl_seq *args;
asdl_seq *keywords; asdl_seq *keywords;
} Call; } Call;
struct { struct {
object n; object n;
} Num; } Num;
struct { struct {
string s; string s;
} Str; } Str;
struct { struct {
expr_ty value; expr_ty value;
int conversion; int conversion;
expr_ty format_spec; expr_ty format_spec;
} FormattedValue; } FormattedValue;
struct { struct {
asdl_seq *values; asdl_seq *values;
} JoinedStr; } JoinedStr;
struct { struct {
bytes s; bytes s;
} Bytes; } Bytes;
struct { struct {
singleton value; singleton value;
} NameConstant; } NameConstant;
struct { struct {
constant value; constant value;
} Constant; } Constant;
struct { struct {
expr_ty value; expr_ty value;
identifier attr; identifier attr;
expr_context_ty ctx; expr_context_ty ctx;
} Attribute; } Attribute;
struct { struct {
expr_ty value; expr_ty value;
slice_ty slice; slice_ty slice;
expr_context_ty ctx; expr_context_ty ctx;
} Subscript; } Subscript;
struct { struct {
expr_ty value; expr_ty value;
expr_context_ty ctx; expr_context_ty ctx;
} Starred; } Starred;
struct { struct {
identifier id; identifier id;
expr_context_ty ctx; expr_context_ty ctx;
} Name; } Name;
struct { struct {
asdl_seq *elts; asdl_seq *elts;
expr_context_ty ctx; expr_context_ty ctx;
} List; } List;
struct { struct {
asdl_seq *elts; asdl_seq *elts;
expr_context_ty ctx; expr_context_ty ctx;
} Tuple; } Tuple;
} v; } v;
int lineno; int lineno;
int col_offset; int col_offset;
@ -377,15 +377,15 @@ struct _slice {
expr_ty upper; expr_ty upper;
expr_ty step; expr_ty step;
} Slice; } Slice;
struct { struct {
asdl_seq *dims; asdl_seq *dims;
} ExtSlice; } ExtSlice;
struct { struct {
expr_ty value; expr_ty value;
} Index; } Index;
} v; } v;
}; };
@ -405,7 +405,7 @@ struct _excepthandler {
identifier name; identifier name;
asdl_seq *body; asdl_seq *body;
} ExceptHandler; } ExceptHandler;
} v; } v;
int lineno; int lineno;
int col_offset; int col_offset;

View file

@ -2,9 +2,9 @@
#define Py_PYTHON_H #define Py_PYTHON_H
/* clang-format off */ /* clang-format off */
/* /*
* PYTHON DIAMOND DEPENDENCY HEADER * PYTHON DIAMOND DEPENDENCY HEADER
* *
* If your editor isn't able to automatically insert #include lines, * If your editor isn't able to automatically insert #include lines,
* then this header can make development easier. It's also great for * then this header can make development easier. It's also great for
* making beginner's tutorials simpler and more attractive. * making beginner's tutorials simpler and more attractive.
@ -12,7 +12,7 @@
* However it's sloppy to use something like this in the long term since * However it's sloppy to use something like this in the long term since
* it's not a scalable dependency model. It makes builds slower, because * it's not a scalable dependency model. It makes builds slower, because
* changing any single header will invalidate all the build artifacts. * changing any single header will invalidate all the build artifacts.
* *
* So please consider doing the conscientious thing and avoid using it! * So please consider doing the conscientious thing and avoid using it!
*/ */

View file

@ -454,8 +454,8 @@ inline T _Py_ANNOTATE_UNPROTECTED_READ(const volatile T &x) {
#define _Py_ANNOTATE_HAPPENS_BEFORE(obj) #define _Py_ANNOTATE_HAPPENS_BEFORE(obj)
#define _Py_ANNOTATE_HAPPENS_AFTER(obj) #define _Py_ANNOTATE_HAPPENS_AFTER(obj)
#define _Py_ANNOTATE_PUBLISH_MEMORY_RANGE(address, size) #define _Py_ANNOTATE_PUBLISH_MEMORY_RANGE(address, size)
#define _Py_ANNOTATE_UNPUBLISH_MEMORY_RANGE(address, size) #define _Py_ANNOTATE_UNPUBLISH_MEMORY_RANGE(address, size)
#define _Py_ANNOTATE_SWAP_MEMORY_RANGE(address, size) #define _Py_ANNOTATE_SWAP_MEMORY_RANGE(address, size)
#define _Py_ANNOTATE_PCQ_CREATE(pcq) #define _Py_ANNOTATE_PCQ_CREATE(pcq)
#define _Py_ANNOTATE_PCQ_DESTROY(pcq) #define _Py_ANNOTATE_PCQ_DESTROY(pcq)
#define _Py_ANNOTATE_PCQ_PUT(pcq) #define _Py_ANNOTATE_PCQ_PUT(pcq)

View file

@ -28,6 +28,6 @@ class x(Command):
def finalize_options(self): def finalize_options(self):
if self.x is None: if self.x is None:
self.x = self.x =
def run(self): def run(self):

View file

@ -14,7 +14,7 @@ PORTTIME = -lporttime
#--EndConfig #--EndConfig
#DEBUG = -C-W -C-Wall #DEBUG = -C-W -C-Wall
DEBUG = DEBUG =
#the following modules are optional. you will want to compile #the following modules are optional. you will want to compile
#everything you can, but you can ignore ones you don't have #everything you can, but you can ignore ones you don't have
@ -31,8 +31,8 @@ scrap src/scrap.c $(SDL) $(SCRAP) $(DEBUG)
_camera src/_camera.c src/camera_v4l2.c src/camera_v4l.c $(SDL) $(DEBUG) _camera src/_camera.c src/camera_v4l2.c src/camera_v4l.c $(SDL) $(DEBUG)
pypm src/pypm.c $(SDL) $(PORTMIDI) $(PORTTIME) $(DEBUG) pypm src/pypm.c $(SDL) $(PORTMIDI) $(PORTTIME) $(DEBUG)
GFX = src/SDL_gfx/SDL_gfxPrimitives.c GFX = src/SDL_gfx/SDL_gfxPrimitives.c
#GFX = src/SDL_gfx/SDL_gfxBlitFunc.c src/SDL_gfx/SDL_gfxPrimitives.c #GFX = src/SDL_gfx/SDL_gfxBlitFunc.c src/SDL_gfx/SDL_gfxPrimitives.c
gfxdraw src/gfxdraw.c $(SDL) $(GFX) $(DEBUG) gfxdraw src/gfxdraw.c $(SDL) $(GFX) $(DEBUG)

View file

@ -3,19 +3,19 @@
# here. Samba has a huge number of configurable options (perhaps too # here. Samba has a huge number of configurable options (perhaps too
# many!) most of which are not shown in this example # many!) most of which are not shown in this example
# #
# Any line which starts with a ; (semi-colon) or a # (hash) # Any line which starts with a ; (semi-colon) or a # (hash)
# is a comment and is ignored. In this example we will use a # # is a comment and is ignored. In this example we will use a #
# for commentry and a ; for parts of the config file that you # for commentry and a ; for parts of the config file that you
# may wish to enable # may wish to enable
# #
# NOTE: Whenever you modify this file you should run the command #"testparm" # to check that you have not made any basic syntactic #errors. # NOTE: Whenever you modify this file you should run the command #"testparm" # to check that you have not made any basic syntactic #errors.
# #
#======================= Global Settings ===================================== #======================= Global Settings =====================================
[global] [global]
# 1. Server Naming Options: # 1. Server Naming Options:
# workgroup = NT-Domain-Name or Workgroup-Name # workgroup = NT-Domain-Name or Workgroup-Name
workgroup = MDKGROUP workgroup = MDKGROUP
# netbios name is the name you will see in "Network Neighbourhood", # netbios name is the name you will see in "Network Neighbourhood",
@ -24,7 +24,7 @@
; netbios name = <name_of_this_server> ; netbios name = <name_of_this_server>
# server string is the equivalent of the NT Description field # server string is the equivalent of the NT Description field
server string = Samba Server %v server string = Samba Server %v
# Message command is run by samba when a "popup" message is sent to it. # Message command is run by samba when a "popup" message is sent to it.
@ -36,20 +36,20 @@
# (as cups is now used in linux-mandrake 7.2 by default) # (as cups is now used in linux-mandrake 7.2 by default)
# if you want to automatically load your printer list rather # if you want to automatically load your printer list rather
# than setting them up individually then you'll need this # than setting them up individually then you'll need this
printcap name = lpstat printcap name = lpstat
load printers = yes load printers = yes
# It should not be necessary to spell out the print system type unless # It should not be necessary to spell out the print system type unless
# yours is non-standard. Currently supported print systems include: # yours is non-standard. Currently supported print systems include:
# bsd, sysv, plp, lprng, aix, hpux, qnx, cups # bsd, sysv, plp, lprng, aix, hpux, qnx, cups
printing = cups printing = cups
# Samba 2.2 supports the Windows NT-style point-and-print feature. To # Samba 2.2 supports the Windows NT-style point-and-print feature. To
# use this, you need to be able to upload print drivers to the samba # use this, you need to be able to upload print drivers to the samba
# server. The printer admins (or root) may install drivers onto samba. # server. The printer admins (or root) may install drivers onto samba.
# Note that this feature uses the print$ share, so you will need to # Note that this feature uses the print$ share, so you will need to
# enable it below. # enable it below.
# This parameter works like domain admin group: # This parameter works like domain admin group:
# printer admin = @<group> <user> # printer admin = @<group> <user>
@ -92,7 +92,7 @@
# Use password server option only with security = server or security = # domain # Use password server option only with security = server or security = # domain
# When using security = domain, you should use password server = * # When using security = domain, you should use password server = *
; password server = ; password server =
; password server = * ; password server = *
# Password Level allows matching of _n_ characters of the password for # Password Level allows matching of _n_ characters of the password for
@ -122,7 +122,7 @@
# enable pam password change # enable pam password change
; pam password change = yes ; pam password change = yes
; passwd program = /usr/bin/passwd %u ; passwd program = /usr/bin/passwd %u
; passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* ; passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password*
# %n\n # %n\n
;*passwd:*all*authentication*tokens*updated*successfully* ;*passwd:*all*authentication*tokens*updated*successfully*
@ -137,7 +137,7 @@
# Options for using winbind. Winbind allows you to do all account and # Options for using winbind. Winbind allows you to do all account and
# authentication from a Windows or samba domain controller, creating # authentication from a Windows or samba domain controller, creating
# accounts on the fly, and maintaining a mapping of Windows RIDs to # accounts on the fly, and maintaining a mapping of Windows RIDs to
# unix uid's # unix uid's
# and gid's. winbind uid and winbind gid are the only required # and gid's. winbind uid and winbind gid are the only required
# parameters. # parameters.
# #
@ -163,8 +163,8 @@
; template homedir = /home/%D/%U ; template homedir = /home/%D/%U
# When using winbind, you may want to have samba create home # When using winbind, you may want to have samba create home
# directories on the fly for authenticated users. Ensure that # directories on the fly for authenticated users. Ensure that
# /etc/pam.d/samba is using 'service=system-auth-winbind' in pam_stack # /etc/pam.d/samba is using 'service=system-auth-winbind' in pam_stack
# modules, and then enable obedience of pam restrictions below: # modules, and then enable obedience of pam restrictions below:
; obey pam restrictions = yes ; obey pam restrictions = yes
@ -181,7 +181,7 @@
# Configure Samba to use multiple interfaces # Configure Samba to use multiple interfaces
# If you have multiple network interfaces then you must list them # If you have multiple network interfaces then you must list them
# here. See the man page for details. # here. See the man page for details.
; interfaces = 192.168.12.2/24 192.168.13.2/24 ; interfaces = 192.168.12.2/24 192.168.13.2/24
# Configure remote browse list synchronisation here # Configure remote browse list synchronisation here
# request announcement to, or browse list sync from: # request announcement to, or browse list sync from:
@ -201,14 +201,14 @@
# Domain Master specifies Samba to be the Domain Master Browser. This # Domain Master specifies Samba to be the Domain Master Browser. This
# allows Samba to collate browse lists between subnets. Don't use this # allows Samba to collate browse lists between subnets. Don't use this
# if you already have a Windows NT domain controller doing this job # if you already have a Windows NT domain controller doing this job
; domain master = yes ; domain master = yes
# Preferred Master causes Samba to force a local browser election on # Preferred Master causes Samba to force a local browser election on
# startup and gives it a slightly higher chance of winning the election # startup and gives it a slightly higher chance of winning the election
; preferred master = yes ; preferred master = yes
# 6. Domain Control Options: # 6. Domain Control Options:
# Enable this if you want Samba to be a domain logon server for # Enable this if you want Samba to be a domain logon server for
# Windows95 workstations or Primary Domain Controller for WinNT and # Windows95 workstations or Primary Domain Controller for WinNT and
# Win2k # Win2k
@ -232,16 +232,16 @@
; logon home = \\%L\%U\.profile ; logon home = \\%L\%U\.profile
# The add user script is used by a domain member to add local user # The add user script is used by a domain member to add local user
# accounts that have been authenticated by the domain controller, or by # accounts that have been authenticated by the domain controller, or by
# the domain controller to add local machine accounts when adding # the domain controller to add local machine accounts when adding
# machines to the domain. # machines to the domain.
# The script must work from the command line when replacing the macros, # The script must work from the command line when replacing the macros,
# or the operation will fail. Check that groups exist if forcing a # or the operation will fail. Check that groups exist if forcing a
# group. # group.
# Script for domain controller for adding machines: # Script for domain controller for adding machines:
; add user script = /usr/sbin/useradd -d /dev/null -g machines c ; add user script = /usr/sbin/useradd -d /dev/null -g machines c
# 'Machine Account' -s /bin/false -M %u # 'Machine Account' -s /bin/false -M %u
# Script for domain controller with LDAP backend for adding machines # Script for domain controller with LDAP backend for adding machines
#(please #(please
# configure in /etc/samba/smbldap_conf.pm first): # configure in /etc/samba/smbldap_conf.pm first):
; add user script = /usr/share/samba/scripts/smbldap-useradd.pl -w d ; add user script = /usr/share/samba/scripts/smbldap-useradd.pl -w d
@ -264,7 +264,7 @@
# LDAP configuration for Domain Controlling: # LDAP configuration for Domain Controlling:
# The account (dn) that samba uses to access the LDAP server # The account (dn) that samba uses to access the LDAP server
# This account needs to have write access to the LDAP tree # This account needs to have write access to the LDAP tree
# You will need to give samba the password for this dn, by # You will need to give samba the password for this dn, by
# running 'smbpasswd -w mypassword' # running 'smbpasswd -w mypassword'
; ldap admin dn = cn=root,dc=mydomain,dc=com ; ldap admin dn = cn=root,dc=mydomain,dc=com
; ldap ssl = start_tls ; ldap ssl = start_tls
@ -277,16 +277,16 @@
# 7. Name Resolution Options: # 7. Name Resolution Options:
# All NetBIOS names must be resolved to IP Addresses # All NetBIOS names must be resolved to IP Addresses
# 'Name Resolve Order' allows the named resolution mechanism to be # 'Name Resolve Order' allows the named resolution mechanism to be
# specified the default order is "host lmhosts wins bcast". "host" # specified the default order is "host lmhosts wins bcast". "host"
# means use the unix system gethostbyname() function call that will use # means use the unix system gethostbyname() function call that will use
# either /etc/hosts OR DNS or NIS depending on the settings of # either /etc/hosts OR DNS or NIS depending on the settings of
# /etc/host.config, /etc/nsswitch.conf # /etc/host.config, /etc/nsswitch.conf
# and the /etc/resolv.conf file. "host" therefore is system # and the /etc/resolv.conf file. "host" therefore is system
# configuration dependent. This parameter is most often of use to # configuration dependent. This parameter is most often of use to
# prevent DNS lookups # prevent DNS lookups
# in order to resolve NetBIOS names to IP Addresses. Use with care! # in order to resolve NetBIOS names to IP Addresses. Use with care!
# The example below excludes use of name resolution for machines that # The example below excludes use of name resolution for machines that
# are NOT on the local network segment - OR - are not deliberately to # are NOT on the local network segment - OR - are not deliberately to
# be known via lmhosts or via WINS. # be known via lmhosts or via WINS.
; name resolve order = wins lmhosts bcast ; name resolve order = wins lmhosts bcast
@ -296,7 +296,7 @@
; wins support = yes ; wins support = yes
# WINS Server - Tells the NMBD components of Samba to be a WINS Client # WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but # Note: Samba can be either a WINS Server, or a WINS Client, but
# NOT both # NOT both
; wins server = w.x.y.z ; wins server = w.x.y.z
@ -305,11 +305,11 @@
# at least one WINS Server on the network. The default is NO. # at least one WINS Server on the network. The default is NO.
; wins proxy = yes ; wins proxy = yes
# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS # DNS Proxy - tells Samba whether or not to try to resolve NetBIOS
# names via DNS nslookups. The built-in default for versions 1.9.17 is # names via DNS nslookups. The built-in default for versions 1.9.17 is
# yes, this has been changed in version 1.9.18 to no. # yes, this has been changed in version 1.9.18 to no.
dns proxy = no dns proxy = no
# 8. File Naming Options: # 8. File Naming Options:
# Case Preservation can be handy - system default is _no_ # Case Preservation can be handy - system default is _no_
@ -325,7 +325,7 @@
# you can match a Windows code page with a UNIX character set. # you can match a Windows code page with a UNIX character set.
# Windows: 437 (US), 737 (GREEK), 850 (Latin1 - Western European), # Windows: 437 (US), 737 (GREEK), 850 (Latin1 - Western European),
# 852 (Eastern Eu.), 861 (Icelandic), 932 (Cyrillic - Russian), # 852 (Eastern Eu.), 861 (Icelandic), 932 (Cyrillic - Russian),
# 936 (Japanese - Shift-JIS), 936 (Simpl. Chinese), 949 (Korean # 936 (Japanese - Shift-JIS), 936 (Simpl. Chinese), 949 (Korean
# Hangul), # Hangul),
# 950 (Trad. Chin.). # 950 (Trad. Chin.).
# UNIX: ISO8859-1 (Western European), ISO8859-2 (Eastern Eu.), # UNIX: ISO8859-1 (Western European), ISO8859-2 (Eastern Eu.),
@ -373,7 +373,7 @@
; guest ok = yes ; guest ok = yes
# NOTE: If you have a CUPS print system there is no need to # NOTE: If you have a CUPS print system there is no need to
# specifically define each individual printer. # specifically define each individual printer.
# You must configure the samba printers with the appropriate Windows # You must configure the samba printers with the appropriate Windows
# drivers on your Windows clients. On the Samba server no filtering is # drivers on your Windows clients. On the Samba server no filtering is
@ -395,9 +395,9 @@
# print command: see above for details. # print command: see above for details.
# ===================================== # =====================================
print command = lpr-cups -P %p -o raw %s -r print command = lpr-cups -P %p -o raw %s -r
# using client side printer drivers. # using client side printer drivers.
; print command = lpr-cups -P %p %s ; print command = lpr-cups -P %p %s
# using cups own drivers (use generic PostScript on clients). # using cups own drivers (use generic PostScript on clients).
# The following two commands are the samba defaults for printing=cups # The following two commands are the samba defaults for printing=cups
# change them only if you need different options: # change them only if you need different options:
@ -406,11 +406,11 @@
# This share is used for Windows NT-style point-and-print support. # This share is used for Windows NT-style point-and-print support.
# To be able to install drivers, you need to be either root, or listed # To be able to install drivers, you need to be either root, or listed
# in the printer admin parameter above. Note that you also need write # in the printer admin parameter above. Note that you also need write
# access to the directory and share definition to be able to upload the # access to the directory and share definition to be able to upload the
# drivers. # drivers.
# For more information on this, please see the Printing Support Section # For more information on this, please see the Printing Support Section
# of /usr/share/doc/samba-/docs/Samba-HOWTO-Collection.pdf # of /usr/share/doc/samba-/docs/Samba-HOWTO-Collection.pdf
[print$] [print$]
path = /var/lib/samba/printers path = /var/lib/samba/printers
@ -419,7 +419,7 @@
write list = @adm root write list = @adm root
# A useful application of samba is to make a PDF-generation service # A useful application of samba is to make a PDF-generation service
# To streamline this, install windows postscript drivers (preferably # To streamline this, install windows postscript drivers (preferably
# colour)on the samba server, so that clients can automatically install # colour)on the samba server, so that clients can automatically install
# them. # them.
@ -455,11 +455,11 @@
# Uncomment next line. # Uncomment next line.
; vfs object = /usr/lib/samba/vfs/audit.so ; vfs object = /usr/lib/samba/vfs/audit.so
# Other examples. # Other examples.
# #
# A private printer, usable only by Fred. Spool data will be placed in # A private printer, usable only by Fred. Spool data will be placed in
# Fred's # Fred's
# home directory. Note that fred must have write access to the spool # home directory. Note that fred must have write access to the spool
# directory, # directory,
# wherever it is. # wherever it is.
;[fredsprn] ;[fredsprn]
@ -473,7 +473,7 @@
----------------------------------------------------------- -----------------------------------------------------------
# A private directory, usable only by Fred. Note that Fred requires # A private directory, usable only by Fred. Note that Fred requires
# write access to the directory. # write access to the directory.
;[fredsdir] ;[fredsdir]
@ -493,8 +493,8 @@
----------------------------------------------------------- -----------------------------------------------------------
# a service which has a different directory for each machine that # a service which has a different directory for each machine that
# connects this allows you to tailor configurations to incoming # connects this allows you to tailor configurations to incoming
# machines. You could also use the %u option to tailor it by user name. # machines. You could also use the %u option to tailor it by user name.
# The %m gets replaced with the machine name that is connecting. # The %m gets replaced with the machine name that is connecting.
;[pchome] ;[pchome]
@ -506,10 +506,10 @@
----------------------------------------------------------- -----------------------------------------------------------
# A publicly accessible directory, read/write to all users. Note that # A publicly accessible directory, read/write to all users. Note that
# all files created in the directory by users will be owned by the # all files created in the directory by users will be owned by the
# default user, so any user with access can delete any other user's # default user, so any user with access can delete any other user's
# files. Obviously this directory must be writable by the default user. # files. Obviously this directory must be writable by the default user.
# Another user could of course be specified, in which case all files # Another user could of course be specified, in which case all files
# would be owned by that user instead. # would be owned by that user instead.
;[public] ;[public]
@ -521,10 +521,10 @@
----------------------------------------------------------- -----------------------------------------------------------
# The following two entries demonstrate how to share a directory so # The following two entries demonstrate how to share a directory so
# that two users can place files there that will be owned by the # that two users can place files there that will be owned by the
# specific users. In this setup, the directory should be writable by # specific users. In this setup, the directory should be writable by
# both users and should have the sticky bit set on it to prevent abuse. # both users and should have the sticky bit set on it to prevent abuse.
# Obviously this could be extended to as many users as required. # Obviously this could be extended to as many users as required.
;[myshare] ;[myshare]

Some files were not shown because too many files have changed in this diff Show more