pub unsafe extern "C" fn BZ2_bzBuffToBuffCompress(
dest: *mut c_char,
destLen: *mut c_uint,
source: *mut c_char,
sourceLen: c_uint,
blockSize100k: c_int,
verbosity: c_int,
workFactor: c_int,
) -> c_int
Expand description
Compress the input data into the destination buffer.
This function attempts to compress the data in source[0 .. sourceLen]
into dest[0 .. *destLen]
.
If the destination buffer is big enough, *destLen
is set to the size of the compressed data, and BZ_OK
is returned.
If the compressed data won’t fit, *destLen
is unchanged, and BZ_OUTBUFF_FULL
is returned.
For the meaning of parameters blockSize100k
, verbosity
and workFactor
, see BZ2_bzCompressInit
.
A safe choice for the length of the output buffer is a size 1% larger than the input length, plus 600 extra bytes.
§Returns
BZ_PARAM_ERROR
if any ofdest.is_null()
destLen.is_null()
source.is_null()
!(1..=9).contains(&blockSize100k)
!(0..=4).contains(&verbosity)
!(0..=250).contains(&workFactor)
BZ_MEM_ERROR
if insufficient memory is availableBZ_OUTBUFF_FULL
if the size of the compressed data exceeds*destLen
BZ_OK
otherwise
§Safety
The caller must guarantee that
destLen
satisfies the requirements ofpointer::as_mut
- Either
dest
isNULL
dest
is writable for*destLen
bytes
- Either
source
isNULL
source
is readable forsourceLen