mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 12:18:31 +00:00
Get bzip2 to build
This commit is contained in:
parent
a8fb68af4b
commit
5bb2275788
33 changed files with 568 additions and 5071 deletions
54
third_party/bzip2/bzlib.c
vendored
54
third_party/bzip2/bzlib.c
vendored
|
@ -1,3 +1,4 @@
|
|||
/* clang-format off */
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- Library top-level functions. ---*/
|
||||
|
@ -28,7 +29,8 @@
|
|||
bzBuffToBuffDecompress. Fixed.
|
||||
*/
|
||||
|
||||
#include "bzlib_private.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "third_party/bzip2/bzlib_private.inc"
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
|
@ -145,7 +147,7 @@ Bool isempty_RL ( EState* s )
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzCompressInit)
|
||||
int BZ2_bzCompressInit
|
||||
( bz_stream* strm,
|
||||
int blockSize100k,
|
||||
int verbosity,
|
||||
|
@ -404,7 +406,7 @@ Bool handle_compress ( bz_stream* strm )
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action )
|
||||
int BZ2_bzCompress ( bz_stream *strm, int action )
|
||||
{
|
||||
Bool progress;
|
||||
EState* s;
|
||||
|
@ -465,7 +467,7 @@ int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action )
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm )
|
||||
int BZ2_bzCompressEnd ( bz_stream *strm )
|
||||
{
|
||||
EState* s;
|
||||
if (strm == NULL) return BZ_PARAM_ERROR;
|
||||
|
@ -489,7 +491,7 @@ int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm )
|
|||
/*---------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzDecompressInit)
|
||||
int BZ2_bzDecompressInit
|
||||
( bz_stream* strm,
|
||||
int verbosity,
|
||||
int small )
|
||||
|
@ -805,7 +807,7 @@ Bool unRLE_obuf_to_output_SMALL ( DState* s )
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
|
||||
int BZ2_bzDecompress ( bz_stream *strm )
|
||||
{
|
||||
Bool corrupt;
|
||||
DState* s;
|
||||
|
@ -859,7 +861,7 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm )
|
||||
int BZ2_bzDecompressEnd ( bz_stream *strm )
|
||||
{
|
||||
DState* s;
|
||||
if (strm == NULL) return BZ_PARAM_ERROR;
|
||||
|
@ -878,7 +880,6 @@ int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm )
|
|||
}
|
||||
|
||||
|
||||
#ifndef BZ_NO_STDIO
|
||||
/*---------------------------------------------------*/
|
||||
/*--- File I/O stuff ---*/
|
||||
/*---------------------------------------------------*/
|
||||
|
@ -913,7 +914,7 @@ static Bool myfeof ( FILE* f )
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
BZFILE* BZ_API(BZ2_bzWriteOpen)
|
||||
BZFILE* BZ2_bzWriteOpen
|
||||
( int* bzerror,
|
||||
FILE* f,
|
||||
int blockSize100k,
|
||||
|
@ -961,7 +962,7 @@ BZFILE* BZ_API(BZ2_bzWriteOpen)
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
void BZ_API(BZ2_bzWrite)
|
||||
void BZ2_bzWrite
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
|
@ -1006,7 +1007,7 @@ void BZ_API(BZ2_bzWrite)
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
void BZ_API(BZ2_bzWriteClose)
|
||||
void BZ2_bzWriteClose
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
int abandon,
|
||||
|
@ -1018,7 +1019,7 @@ void BZ_API(BZ2_bzWriteClose)
|
|||
}
|
||||
|
||||
|
||||
void BZ_API(BZ2_bzWriteClose64)
|
||||
void BZ2_bzWriteClose64
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
int abandon,
|
||||
|
@ -1084,7 +1085,7 @@ void BZ_API(BZ2_bzWriteClose64)
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
BZFILE* BZ_API(BZ2_bzReadOpen)
|
||||
BZFILE* BZ2_bzReadOpen
|
||||
( int* bzerror,
|
||||
FILE* f,
|
||||
int verbosity,
|
||||
|
@ -1140,7 +1141,7 @@ BZFILE* BZ_API(BZ2_bzReadOpen)
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b )
|
||||
void BZ2_bzReadClose ( int *bzerror, BZFILE *b )
|
||||
{
|
||||
bzFile* bzf = (bzFile*)b;
|
||||
|
||||
|
@ -1158,7 +1159,7 @@ void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b )
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzRead)
|
||||
int BZ2_bzRead
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
|
@ -1218,7 +1219,7 @@ int BZ_API(BZ2_bzRead)
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
void BZ_API(BZ2_bzReadGetUnused)
|
||||
void BZ2_bzReadGetUnused
|
||||
( int* bzerror,
|
||||
BZFILE* b,
|
||||
void** unused,
|
||||
|
@ -1236,7 +1237,6 @@ void BZ_API(BZ2_bzReadGetUnused)
|
|||
*nUnused = bzf->strm.avail_in;
|
||||
*unused = bzf->strm.next_in;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
|
@ -1244,7 +1244,7 @@ void BZ_API(BZ2_bzReadGetUnused)
|
|||
/*---------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzBuffToBuffCompress)
|
||||
int BZ2_bzBuffToBuffCompress
|
||||
( char* dest,
|
||||
unsigned int* destLen,
|
||||
char* source,
|
||||
|
@ -1296,7 +1296,7 @@ int BZ_API(BZ2_bzBuffToBuffCompress)
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzBuffToBuffDecompress)
|
||||
int BZ2_bzBuffToBuffDecompress
|
||||
( char* dest,
|
||||
unsigned int* destLen,
|
||||
char* source,
|
||||
|
@ -1363,7 +1363,7 @@ int BZ_API(BZ2_bzBuffToBuffDecompress)
|
|||
/*--
|
||||
return version like "0.9.5d, 4-Sept-1999".
|
||||
--*/
|
||||
const char * BZ_API(BZ2_bzlibVersion)(void)
|
||||
const char * BZ2_bzlibVersion(void)
|
||||
{
|
||||
return BZ_VERSION;
|
||||
}
|
||||
|
@ -1457,7 +1457,7 @@ BZFILE * bzopen_or_bzdopen
|
|||
ex) bzopen("file","w9")
|
||||
case path="" or NULL => use stdin or stdout.
|
||||
--*/
|
||||
BZFILE * BZ_API(BZ2_bzopen)
|
||||
BZFILE * BZ2_bzopen
|
||||
( const char *path,
|
||||
const char *mode )
|
||||
{
|
||||
|
@ -1466,7 +1466,7 @@ BZFILE * BZ_API(BZ2_bzopen)
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
BZFILE * BZ_API(BZ2_bzdopen)
|
||||
BZFILE * BZ2_bzdopen
|
||||
( int fd,
|
||||
const char *mode )
|
||||
{
|
||||
|
@ -1475,7 +1475,7 @@ BZFILE * BZ_API(BZ2_bzdopen)
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len )
|
||||
int BZ2_bzread (BZFILE* b, void* buf, int len )
|
||||
{
|
||||
int bzerr, nread;
|
||||
if (((bzFile*)b)->lastErr == BZ_STREAM_END) return 0;
|
||||
|
@ -1489,7 +1489,7 @@ int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len )
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len )
|
||||
int BZ2_bzwrite (BZFILE* b, void* buf, int len )
|
||||
{
|
||||
int bzerr;
|
||||
|
||||
|
@ -1503,7 +1503,7 @@ int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len )
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
int BZ_API(BZ2_bzflush) (BZFILE *b)
|
||||
int BZ2_bzflush (BZFILE *b)
|
||||
{
|
||||
/* do nothing now... */
|
||||
return 0;
|
||||
|
@ -1511,7 +1511,7 @@ int BZ_API(BZ2_bzflush) (BZFILE *b)
|
|||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
void BZ_API(BZ2_bzclose) (BZFILE* b)
|
||||
void BZ2_bzclose (BZFILE* b)
|
||||
{
|
||||
int bzerr;
|
||||
FILE *fp;
|
||||
|
@ -1556,7 +1556,7 @@ static const char *bzerrorstrings[] = {
|
|||
};
|
||||
|
||||
|
||||
const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum)
|
||||
const char * BZ2_bzerror (BZFILE *b, int *errnum)
|
||||
{
|
||||
int err = ((bzFile *)b)->lastErr;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue