pub unsafe extern "C" fn BZ2_bzBuffToBuffDecompress(
dest: *mut c_char,
destLen: *mut c_uint,
source: *mut c_char,
sourceLen: c_uint,
small: c_int,
verbosity: c_int,
) -> c_intExpand description
Decompress the input data into the destination buffer.
This function attempts to decompress 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 decompressed data, and BZ_OK is returned.
If the decompressed data won’t fit, *destLen is unchanged, and BZ_OUTBUFF_FULL is returned.
For the meaning of parameters small, verbosity, see BZ2_bzDecompressInit.
Because the compression ratio of the compressed data cannot be known in advance, there is no easy way to guarantee that the output buffer will be big enough. You may of course make arrangements in your code to record the size of the uncompressed data, but such a mechanism is beyond the scope of this library.
§Returns
BZ_PARAM_ERRORif any ofdest.is_null()destLen.is_null()source.is_null()!(0..=1).contains(&small)!(0..=4).contains(&verbosity)
BZ_MEM_ERRORif insufficient memory is availableBZ_OUTBUFF_FULLif the size of the compressed data exceeds*destLenBZ_DATA_ERRORif a data integrity error is detected in the compressed streamBZ_DATA_ERROR_MAGICif the compressed stream doesn’t begin with the right magic bytesBZ_UNEXPECTED_EOFif the compressed data ends before the logical end-of-stream was detectedBZ_OKotherwise
§Safety
The caller must guarantee that
destLensatisfies the requirements ofpointer::as_mut- Either
destisNULLdestis writable for*destLenbytes
- Either
sourceisNULLsourceis readable forsourceLen