Function BZ2_bzBuffToBuffCompress
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
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_ERRORif any ofdest.is_null()destLen.is_null()source.is_null()!(1..=9).contains(&blockSize100k)!(0..=4).contains(&verbosity)!(0..=250).contains(&workFactor)
BZ_MEM_ERRORif insufficient memory is availableBZ_OUTBUFF_FULLif the size of the compressed data exceeds*destLenBZ_OKotherwise
Safety
The caller must guarantee that
destLensatisfies the requirements ofpointer::as_mut- Either
destisNULLdestis writable for*destLenbytes
- Either
sourceisNULLsourceis readable forsourceLen