本文主要是介绍ZLIB 1.2.8 压缩整理,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
ZLIB 官网:http://www.zlib.net/ ,有详细的英文文档及代码。
ZLIB 数据压缩相关结构体:
typedef struct z_stream_s {z_const Bytef *next_in; /* next input byte */uInt avail_in; /* number of bytes available at next_in */uLong total_in; /* total number of input bytes read so far */Bytef *next_out; /* next output byte should be put there */uInt avail_out; /* remaining free space at next_out */uLong total_out; /* total number of bytes output so far */z_const char *msg; /* last error message, NULL if no error */struct internal_state FAR *state; /* not visible by applications */alloc_func zalloc; /* used to allocate the internal state */free_func zfree; /* used to free the internal state */voidpf opaque; /* private data object passed to zalloc and zfree */int data_type; /* best guess about the data type: binary or text */uLong adler; /* adler32 value of the uncompressed data */uLong reserved; /* reserved for future use */
} z_stream;
相关枚举值:
/* constants */#define Z_NO_FLUSH 0
#define Z_PARTIAL_FLUSH 1
#define Z_SYNC_FLUSH 2
#define Z_FULL_FLUSH 3
#define Z_FINISH 4
#define Z_BLOCK 5
#define Z_TREES 6
/* Allowed flush values; see deflate() and inflate() below for details */#define Z_OK 0
#define Z_STREAM_END 1
#define Z_NEED_DICT 2
#define Z_ERRNO (-1)
#define Z_STREAM_ERROR (-2)
#define Z_DATA_ERROR (-3)
#define Z_MEM_ERROR (-4)
#define Z_BUF_ERROR (-5)
#define Z_VERSION_ERROR (-6)
/* Return codes for the compression/decompression functions. Negative values* are errors, positive values are used for special but normal events.*/#define Z_NO_COMPRESSION 0
#define Z_BEST_SPEED 1
#define Z_BEST_COMPRESSION 9
#define Z_DEFAULT_COMPRESSION (-1)
/* compression levels */#define Z_FILTERED 1
#define Z_HUFFMAN_ONLY 2
#define Z_RLE 3
#define Z_FIXED 4
#define Z_DEFAULT_STRATEGY 0
/* compression strategy; see deflateInit2(
这篇关于ZLIB 1.2.8 压缩整理的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!