⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zlib.h

📁 经典的ppp程序
💻 H
📖 第 1 页 / 共 3 页
字号:
                                  z_streamp source));/*     Sets the destination stream as a complete copy of the source stream.  If   the source stream is using an application-supplied history buffer, a new   buffer is allocated for the destination stream.  The compressed output   buffer is always application-supplied. It's the responsibility of the   application to provide the correct values of next_out and avail_out for the   next call of deflate.     This function can be useful when several compression strategies will be   tried, for example when there are several ways of pre-processing the input   data with a filter. The streams that will be discarded should then be freed   by calling deflateEnd.  Note that deflateCopy duplicates the internal   compression state which can be quite large, so this strategy is slow and   can consume lots of memory.     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent   (such as zalloc being NULL). msg is left unchanged in both source and   destination.*/extern int EXPORT deflateReset OF((z_streamp strm));/*     This function is equivalent to deflateEnd followed by deflateInit,   but does not free and reallocate all the internal compression state.   The stream will keep the same compression level and any other attributes   that may have been set by deflateInit2.      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source   stream state was inconsistent (such as zalloc or state being NULL).*/extern int EXPORT deflateParams OF((z_streamp strm, int level, int strategy));/*     Dynamically update the compression level and compression strategy.   This can be used to switch between compression and straight copy of   the input data, or to switch to a different kind of input data requiring   a different strategy. If the compression level is changed, the input   available so far is compressed with the old level (and may be flushed);   the new level will take effect only at the next call of deflate().     Before the call of deflateParams, the stream state must be set as for   a call of deflate(), since the currently available input may have to   be compressed and flushed. In particular, strm->avail_out must be non-zero.     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR   if strm->avail_out was zero.*/extern int EXPORT deflateOutputPending OF((z_streamp strm));/*     Returns the number of bytes of output which are immediately   available from the compressor (i.e. without any further input   or flush).*//*   extern int EXPORT inflateInit2 OF((z_streamp strm,                                   int  windowBits));     This is another version of inflateInit with more compression options. The   fields next_out, zalloc, zfree and opaque must be initialized before by   the caller.     The windowBits parameter is the base two logarithm of the maximum window   size (the size of the history buffer).  It should be in the range 8..15 for   this version of the library (the value 16 will be allowed soon). The   default value is 15 if inflateInit is used instead. If a compressed stream   with a larger window size is given as input, inflate() will return with   the error code Z_DATA_ERROR instead of trying to allocate a larger window.     If next_out is not null, the library will use this buffer for the history   buffer; the buffer must either be large enough to hold the entire output   data, or have at least 1<<windowBits bytes.  If next_out is null, the   library will allocate its own buffer (and leave next_out null). next_in   need not be provided here but must be provided by the application for the   next call of inflate().     If the history buffer is provided by the application, next_out must   never be changed by the application since the decompressor maintains   history information inside this buffer from call to call; the application   can only reset next_out to the beginning of the history buffer when   avail_out is zero and all output has been consumed.      inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was   not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as   windowBits < 8). msg is set to null if there is no error message.   inflateInit2 does not perform any decompression: this will be done by   inflate().*/extern int EXPORT inflateSetDictionary OF((z_streamp strm,				           const Bytef *dictionary,					   uInt  dictLength));/*     Initializes the decompression dictionary (history buffer) from the given   uncompressed byte sequence. This function must be called immediately after   a call of inflate if this call returned Z_NEED_DICT. The dictionary chosen   by the compressor can be determined from the Adler32 value returned by this   call of inflate. The compressor and decompressor must use exactly the same   dictionary (see deflateSetDictionary).     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a   parameter is invalid (such as NULL dictionary) or the stream state is   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the   expected one (incorrect Adler32 value). inflateSetDictionary does not   perform any decompression: this will be done by subsequent calls of   inflate().*/extern int EXPORT inflateSync OF((z_streamp strm));/*     Skips invalid compressed data until the special marker (see deflate()  above) can be found, or until all available input is skipped. No output  is provided.    inflateSync returns Z_OK if the special marker has been found, Z_BUF_ERROR  if no more input was provided, Z_DATA_ERROR if no marker has been found,  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success  case, the application may save the current current value of total_in which  indicates where valid compressed data was found. In the error case, the  application may repeatedly call inflateSync, providing more input each time,  until success or end of the input data.*/extern int EXPORT inflateReset OF((z_streamp strm));/*     This function is equivalent to inflateEnd followed by inflateInit,   but does not free and reallocate all the internal decompression state.   The stream will keep attributes that may have been set by inflateInit2.      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source   stream state was inconsistent (such as zalloc or state being NULL).*/extern int inflateIncomp OF((z_stream *strm));/*     This function adds the data at next_in (avail_in bytes) to the output   history without performing any output.  There must be no pending output,   and the decompressor must be expecting to see the start of a block.   Calling this function is equivalent to decompressing a stored block   containing the data at next_in (except that the data is not output).*/                        /* utility functions *//*     The following utility functions are implemented on top of the   basic stream-oriented functions. To simplify the interface, some   default options are assumed (compression level, window size,   standard memory allocation functions). The source code of these   utility functions can easily be modified if you need special options.*/extern int EXPORT compress OF((Bytef *dest,   uLongf *destLen,			       const Bytef *source, uLong sourceLen));/*     Compresses the source buffer into the destination buffer.  sourceLen is   the byte length of the source buffer. Upon entry, destLen is the total   size of the destination buffer, which must be at least 0.1% larger than   sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the   compressed buffer.     This function can be used to compress a whole file at once if the   input file is mmap'ed.     compress returns Z_OK if success, Z_MEM_ERROR if there was not   enough memory, Z_BUF_ERROR if there was not enough room in the output   buffer.*/extern int EXPORT uncompress OF((Bytef *dest,   uLongf *destLen,				 const Bytef *source, uLong sourceLen));/*     Decompresses the source buffer into the destination buffer.  sourceLen is   the byte length of the source buffer. Upon entry, destLen is the total   size of the destination buffer, which must be large enough to hold the   entire uncompressed data. (The size of the uncompressed data must have   been saved previously by the compressor and transmitted to the decompressor   by some mechanism outside the scope of this compression library.)   Upon exit, destLen is the actual size of the compressed buffer.     This function can be used to decompress a whole file at once if the   input file is mmap'ed.     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not   enough memory, Z_BUF_ERROR if there was not enough room in the output   buffer, or Z_DATA_ERROR if the input data was corrupted.*/typedef voidp gzFile;extern gzFile EXPORT gzopen  OF((const char *path, const char *mode));/*     Opens a gzip (.gz) file for reading or writing. The mode parameter   is as in fopen ("rb" or "wb") but can also include a compression level   ("wb9").  gzopen can be used to read a file which is not in gzip format;   in this case gzread will directly read from the file without decompression.     gzopen returns NULL if the file could not be opened or if there was   insufficient memory to allocate the (de)compression state; errno   can be checked to distinguish the two cases (if errno is zero, the   zlib error is Z_MEM_ERROR).*/extern gzFile EXPORT gzdopen  OF((int fd, const char *mode));/*     gzdopen() associates a gzFile with the file descriptor fd.  File   descriptors are obtained from calls like open, dup, creat, pipe or   fileno (in the file has been previously opened with fopen).   The mode parameter is as in gzopen.     The next call of gzclose on the returned gzFile will also close the   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).     gzdopen returns NULL if there was insufficient memory to allocate   the (de)compression state.*/extern int EXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));/*     Reads the given number of uncompressed bytes from the compressed file.   If the input file was not in gzip format, gzread copies the given number   of bytes into the buffer.     gzread returns the number of uncompressed bytes actually read (0 for   end of file, -1 for error). */extern int EXPORT    gzwrite OF((gzFile file, const voidp buf, unsigned len));/*     Writes the given number of uncompressed bytes into the compressed file.   gzwrite returns the number of uncompressed bytes actually written   (0 in case of error).*/extern int EXPORT    gzflush OF((gzFile file, int flush));/*     Flushes all pending output into the compressed file. The parameter   flush is as in the deflate() function. The return value is the zlib   error number (see function gzerror below). gzflush returns Z_OK if   the flush parameter is Z_FINISH and all output could be flushed.     gzflush should be called only when strictly necessary because it can   degrade compression.*/extern int EXPORT    gzclose OF((gzFile file));/*     Flushes all pending output if necessary, closes the compressed file   and deallocates all the (de)compression state. The return value is the zlib   error number (see function gzerror below).*/extern const char * EXPORT gzerror OF((gzFile file, int *errnum));/*     Returns the error message for the last error which occurred on the   given compressed file. errnum is set to zlib error number. If an   error occurred in the file system and not in the compression library,   errnum is set to Z_ERRNO and the application may consult errno   to get the exact error code.*/                        /* checksum functions *//*     These functions are not related to compression but are exported   anyway because they might be useful in applications using the   compression library.*/extern uLong EXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));/*     Update a running Adler-32 checksum with the bytes buf[0..len-1] and   return the updated checksum. If buf is NULL, this function returns   the required initial value for the checksum.   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed   much faster. Usage example:     uLong adler = adler32(0L, Z_NULL, 0);     while (read_buffer(buffer, length) != EOF) {       adler = adler32(adler, buffer, length);     }     if (adler != original_adler) error();*/extern uLong EXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));/*     Update a running crc with the bytes buf[0..len-1] and return the updated   crc. If buf is NULL, this function returns the required initial value   for the crc. Pre- and post-conditioning (one's complement) is performed   within this function so it shouldn't be done by the application.   Usage example:     uLong crc = crc32(0L, Z_NULL, 0);     while (read_buffer(buffer, length) != EOF) {       crc = crc32(crc, buffer, length);     }     if (crc != original_crc) error();*/                        /* various hacks, don't look :) *//* deflateInit and inflateInit are macros to allow checking the zlib version * and the compiler's view of z_stream: */extern int EXPORT deflateInit_ OF((z_streamp strm, int level,			           const char *version, int stream_size));extern int EXPORT inflateInit_ OF((z_streamp strm,				   const char *version, int stream_size));extern int EXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,				    int windowBits, int memLevel, int strategy,				    const char *version, int stream_size));extern int EXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,				    const char *version, int stream_size));#define deflateInit(strm, level) \        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))#define inflateInit(strm) \        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\		      (strategy),           ZLIB_VERSION, sizeof(z_stream))#define inflateInit2(strm, windowBits) \        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)    struct internal_state {int dummy;}; /* hack for buggy compilers */#endifuLongf *get_crc_table OF((void)); /* can be used by asm versions of crc32() */#ifdef __cplusplus}#endif#endif /* _ZLIB_H *//* --- zlib.h */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -