Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/zlib.h
Show All 40 Lines | /*- | ||||
3. This notice may not be removed or altered from any source distribution. | 3. This notice may not be removed or altered from any source distribution. | ||||
Jean-loup Gailly Mark Adler | Jean-loup Gailly Mark Adler | ||||
gzip@prep.ai.mit.edu madler@alumni.caltech.edu | gzip@prep.ai.mit.edu madler@alumni.caltech.edu | ||||
*/ | */ | ||||
/* | /* | ||||
The data format used by the zlib library is described by RFCs (Request for | The data format used by the zlib library is described by RFCs (Request for | ||||
Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt | Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt | ||||
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). | (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). | ||||
delphij: (see comment on sys/conf/kern.pre.mk: I think we could eliminate this need). | |||||
*/ | */ | ||||
#ifndef _ZLIB_H | #ifndef _ZLIB_H | ||||
#define _ZLIB_H | #define _ZLIB_H | ||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
extern "C" { | extern "C" { | ||||
#endif | #endif | ||||
Show All 9 Lines | |||||
#ifndef _ZCONF_H | #ifndef _ZCONF_H | ||||
#define _ZCONF_H | #define _ZCONF_H | ||||
/* | /* | ||||
* If you *really* need a unique prefix for all types and library functions, | * If you *really* need a unique prefix for all types and library functions, | ||||
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | ||||
*/ | */ | ||||
#ifdef Z_PREFIX | #ifdef _KERNEL | ||||
# define deflateInit_ z_deflateInit_ | # define deflateInit_ zlib104_deflateInit_ | ||||
# define deflate z_deflate | # define deflate zlib104_deflate | ||||
# define deflateEnd z_deflateEnd | # define deflateEnd zlib104_deflateEnd | ||||
# define inflateInit_ z_inflateInit_ | # define inflateInit_ zlib104_inflateInit_ | ||||
# define inflate z_inflate | # define inflate zlib104_inflate | ||||
# define inflateEnd z_inflateEnd | # define inflateEnd zlib104_inflateEnd | ||||
# define deflateInit2_ z_deflateInit2_ | # define deflateInit2_ zlib104_deflateInit2_ | ||||
# define deflateSetDictionary z_deflateSetDictionary | # define deflateSetDictionary zlib104_deflateSetDictionary | ||||
# define deflateCopy z_deflateCopy | # define deflateCopy zlib104_deflateCopy | ||||
# define deflateReset z_deflateReset | # define deflateReset zlib104_deflateReset | ||||
# define deflateParams z_deflateParams | # define deflateParams zlib104_deflateParams | ||||
# define inflateInit2_ z_inflateInit2_ | # define inflateInit2_ zlib104_inflateInit2_ | ||||
# define inflateSetDictionary z_inflateSetDictionary | # define inflateSetDictionary zlib104_inflateSetDictionary | ||||
# define inflateSync z_inflateSync | # define inflateSync zlib104_inflateSync | ||||
# define inflateReset z_inflateReset | # define inflateReset zlib104_inflateReset | ||||
# define compress z_compress | # define compress zlib104_compress | ||||
# define uncompress z_uncompress | # define uncompress zlib104_uncompress | ||||
# define adler32 z_adler32 | # define adler32 zlib104_adler32 | ||||
#if 0 | #if 0 | ||||
# define crc32 z_crc32 | # define crc32 zlib104_crc32 | ||||
# define get_crc_table z_get_crc_table | # define get_crc_table zlib104_get_crc_table | ||||
#endif | #endif | ||||
# define deflate_copyright zlib104_deflate_copyright | |||||
# define inflate_copyright zlib104_inflate_copyright | |||||
Done Inline Actions[OPTIONAL] I wonder if we can make deflate_copyright and inflate_copyright in sys/libkern/zlib.c static instead? delphij: [OPTIONAL] I wonder if we can make deflate_copyright and inflate_copyright in sys/libkern/zlib. | |||||
Done Inline ActionsIt appeared that these 2 variables are not used at all. Converting to static variable resulted in error. ota_j.email.ne.jp: It appeared that these 2 variables are not used at all. Converting to static variable resulted… | |||||
# define Byte z_Byte | # define Byte zlib104_Byte | ||||
# define uInt z_uInt | # define uInt zlib104_uInt | ||||
# define uLong z_uLong | # define uLong zlib104_uLong | ||||
# define Bytef z_Bytef | # define Bytef zlib104_Bytef | ||||
# define charf z_charf | # define charf zlib104_charf | ||||
# define intf z_intf | # define intf zlib104_intf | ||||
# define uIntf z_uIntf | # define uIntf zlib104_uIntf | ||||
# define uLongf z_uLongf | # define uLongf zlib104_uLongf | ||||
# define voidpf z_voidpf | # define voidpf zlib104_voidpf | ||||
# define voidp z_voidp | # define voidp zlib104_voidp | ||||
#endif | #endif | ||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) | #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) | ||||
# define WIN32 | # define WIN32 | ||||
#endif | #endif | ||||
#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(__i386__) | #if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(__i386__) | ||||
# ifndef __32BIT__ | # ifndef __32BIT__ | ||||
# define __32BIT__ | # define __32BIT__ | ||||
▲ Show 20 Lines • Show All 264 Lines • ▼ Show 20 Lines | |||||
extern const char * EXPORT zlibVersion OF((void)); | extern const char * EXPORT zlibVersion OF((void)); | ||||
/* The application can compare zlibVersion and ZLIB_VERSION for consistency. | /* The application can compare zlibVersion and ZLIB_VERSION for consistency. | ||||
If the first character differs, the library code actually used is | If the first character differs, the library code actually used is | ||||
not compatible with the zlib.h header file used by the application. | not compatible with the zlib.h header file used by the application. | ||||
This check is automatically made by deflateInit and inflateInit. | This check is automatically made by deflateInit and inflateInit. | ||||
*/ | */ | ||||
/* | /* | ||||
extern int EXPORT deflateInit OF((z_streamp strm, int level)); | extern int EXPORT deflateInit OF((z_streamp strm, int level)); | ||||
Done Inline ActionsMissed this one. ota_j.email.ne.jp: Missed this one. | |||||
Initializes the internal stream state for compression. The fields | Initializes the internal stream state for compression. The fields | ||||
zalloc, zfree and opaque must be initialized before by the caller. | zalloc, zfree and opaque must be initialized before by the caller. | ||||
If zalloc and zfree are set to Z_NULL, deflateInit updates them to | If zalloc and zfree are set to Z_NULL, deflateInit updates them to | ||||
use default allocation functions. | use default allocation functions. | ||||
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: | The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: | ||||
1 gives best speed, 9 gives best compression, 0 gives no compression at | 1 gives best speed, 9 gives best compression, 0 gives no compression at | ||||
▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | allocation functions. | ||||
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not | inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not | ||||
enough memory, Z_VERSION_ERROR if the zlib library version is incompatible | enough memory, Z_VERSION_ERROR if the zlib library version is incompatible | ||||
with the version assumed by the caller. msg is set to null if there is no | with the version assumed by the caller. msg is set to null if there is no | ||||
error message. inflateInit does not perform any decompression: this will be | error message. inflateInit does not perform any decompression: this will be | ||||
done by inflate(). | done by inflate(). | ||||
*/ | */ | ||||
#if defined(__FreeBSD__) && defined(_KERNEL) | #if defined(__FreeBSD__) && defined(_KERNEL) | ||||
#define inflate _zlib104_inflate /* FreeBSD already has an inflate :-( */ | #define inflate zlib104_inflate /* FreeBSD already has an inflate :-( */ | ||||
#endif | #endif | ||||
extern int EXPORT inflate OF((z_streamp strm, int flush)); | extern int EXPORT inflate OF((z_streamp strm, int flush)); | ||||
/* | /* | ||||
Performs one or both of the following actions: | Performs one or both of the following actions: | ||||
- Decompress more input starting at next_in and update next_in and avail_in | - Decompress more input starting at next_in and update next_in and avail_in | ||||
accordingly. If not all input can be processed (because there is not | accordingly. If not all input can be processed (because there is not | ||||
▲ Show 20 Lines • Show All 496 Lines • Show Last 20 Lines |
(see comment on sys/conf/kern.pre.mk: I think we could eliminate this need).