Function BZ2_bzWriteOpen

Source
#[export_name = "BZ2_bzWriteOpen"]
pub unsafe extern "C" fn BZ2_bzWriteOpen(
    bzerror: *mut c_int,
    f: *mut FILE,
    blockSize100k: c_int,
    verbosity: c_int,
    workFactor: c_int,
) -> *mut BZFILE
Expand description

Prepare to write compressed data to a file handle.

The file handle f should refer to a file which has been opened for writing, and for which the error indicator libc::ferror(f) is not set.

For the meaning of parameters blockSize100k, verbosity and workFactor, see BZ2_bzCompressInit.

§Returns

  • if *bzerror is BZ_OK, a valid pointer to an abstract BZFILE
  • otherwise NULL

§Possible assignments to bzerror

  • BZ_PARAM_ERROR if any of
    • f.is_null
    • !(1..=9).contains(&blockSize100k)
    • !(0..=4).contains(&verbosity)
    • !(0..=250).contains(&workFactor)
  • BZ_CONFIG_ERROR if no default allocator is configured
  • BZ_IO_ERROR if libc::ferror(f) is nonzero
  • BZ_MEM_ERROR if insufficient memory is available
  • BZ_OK otherwise

§Safety

The caller must guarantee that

  • bzerror satisfies the requirements of pointer::as_mut
  • Either
    • f is NULL
    • f a valid pointer to a FILE