40#define MIN_COMP_LEVEL 1
41#define MAX_COMP_LEVEL 9
102 size_t dlen,
size_t *clen)
110 uLong len = compressBound(dlen);
112 Bytef *cbuf = (
unsigned char *) cdata->
buf + 4;
113 const void *ubuf = data;
114 int rc = compress2(cbuf, &len, ubuf, dlen, cdata->
level);
120 unsigned char *cs = cdata->
buf;
144 const unsigned char *cs = (
const unsigned char *) cbuf;
147 uLong ulen = cs[0] + (cs[1] << 8) + (cs[2] << 16) + ((uLong) cs[3] << 24);
152 Bytef *ubuf = cdata->
buf;
153 cs = (
const unsigned char *) cbuf;
154 int rc = uncompress(ubuf, &ulen, cs + 4, clen - 4);
const struct ComprOps compr_zlib_ops
void ComprHandle
Opaque type for compression data.
#define COMPRESS_OPS(_name, _min_level, _max_level)
static void compr_zlib_close(ComprHandle **ptr)
Close a compression context - Implements ComprOps::close() -.
static void * compr_zlib_compress(ComprHandle *handle, const char *data, size_t dlen, size_t *clen)
Compress header cache data - Implements ComprOps::compress() -.
static void * compr_zlib_decompress(ComprHandle *handle, const char *cbuf, size_t clen)
Decompress header cache data - Implements ComprOps::decompress() -.
static ComprHandle * compr_zlib_open(short level)
Open a compression context - Implements ComprOps::open() -.
#define mutt_debug(LEVEL,...)
@ LL_DEBUG1
Log at debug level 1.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
void mutt_mem_realloc(void *pptr, size_t size)
Resize a block of memory on the heap.
#define MUTT_MEM_CALLOC(n, type)
Convenience wrapper for the library headers.
const char * name
Compression name.
Private Zlib Compression Data.
short level
Compression Level to be used.
void * buf
Temporary buffer.
void zlib_cdata_free(struct ZlibComprData **ptr)
Free Zlib Compression Data.
static struct ZlibComprData * zlib_cdata_new(void)
Create new Zlib Compression Data.
#define MAX_COMP_LEVEL
Maximum compression level for zlib.
#define MIN_COMP_LEVEL
Minimum compression level for zlib.