My favorites | Sign in
Project Home Downloads Wiki Issues Source
Repository:
Checkout   Browse   Changes   Clones  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "bz2.h"

#include <bzlib.h>

int bz2Compress(int blockSize100k, int verbosity, int workFactor, void *data, unsigned int avail_in, void *odata, unsigned int *avail_out)
{
int ret;
bz_stream strm;

strm.bzalloc = NULL;
strm.bzfree = NULL;
strm.opaque = NULL;

ret = BZ2_bzCompressInit(&strm, blockSize100k, verbosity, workFactor);
if (ret != BZ_OK) return ret;

strm.next_in = data;
strm.next_out = odata;
strm.avail_in = avail_in;
strm.avail_out = *avail_out;

ret = BZ2_bzCompress ( &strm, BZ_FINISH );
if (ret == BZ_FINISH_OK) goto output_overflow;
if (ret != BZ_STREAM_END) goto errhandler;

/* normal termination */
*avail_out -= strm.avail_out;
BZ2_bzCompressEnd ( &strm );
return BZ_OK;

output_overflow:
BZ2_bzCompressEnd ( &strm );
return BZ_OUTBUFF_FULL;

errhandler:
BZ2_bzCompressEnd ( &strm );

return ret;
}

Change log

0136ea839f68 by po...@camelot on Jan 6, 2011   Diff
add zlib to libncd
add pysco into bytecodes
Go to: 
Project members, sign in to write a code review

Older revisions

a3875c174f01 by po...@camelot on Jan 1, 2011   Diff
update dex
add bz2
All revisions of this file

File info

Size: 1079 bytes, 39 lines
Powered by Google Project Hosting