Function BZ2_bzCompressInit

Source
pub unsafe extern "C" fn BZ2_bzCompressInit(
    strm: *mut bz_stream,
    blockSize100k: c_int,
    verbosity: c_int,
    workFactor: c_int,
) -> c_int
Expand description

Prepares the stream for compression.

§Returns

  • BZ_PARAM_ERROR if any of
    • strm.is_null()
    • !(1..=9).contains(&blockSize100k)
    • !(0..=4).contains(&verbosity)
    • !(0..=250).contains(&workFactor)
    • no valid allocator could be configured
  • BZ_MEM_ERROR if insufficient memory is available
  • BZ_OK otherwise

§Safety

The caller must guarantee that

  • Either
    • strm is NULL
    • strm satisfies the requirements of &mut *strm
  • The bzalloc, bzfree and opaque fields form a valid allocator.