#[unsafe(export_name = "BZ2_bzReadOpen")]pub unsafe extern "C" fn BZ2_bzReadOpen(
bzerror: *mut c_int,
f: *mut FILE,
verbosity: c_int,
small: c_int,
unused: *mut c_void,
nUnused: c_int,
) -> *mut BZFILEExpand description
Prepare to read compressed data from a file handle.
The file handle f should refer to a file which has been opened for reading, and for which the error indicator libc::ferror(f) is not set.
If small is 1, the library will try to decompress using less memory, at the expense of speed.
For reasons explained below, BZ2_bzRead will decompress the nUnused bytes starting at unused, before starting to read from the file f.
At most BZ_MAX_UNUSED bytes may be supplied like this. If this facility is not required, you should pass NULL and 0 for unused and nUnused respectively.
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
- if
*bzerrorisBZ_OK, a valid pointer to an abstractBZFILE - otherwise
NULL
§Possible assignments to bzerror
BZ_PARAM_ERRORif any of(unused.is_null() && nUnused != 0)(!unused.is_null() && !(0..=BZ_MAX_UNUSED).contains(&nUnused))!(0..=1).contains(&small)!(0..=4).contains(&verbosity)
BZ_CONFIG_ERRORif no default allocator is configuredBZ_IO_ERRORiflibc::ferror(f)is nonzeroBZ_MEM_ERRORif insufficient memory is availableBZ_OKotherwise
§Safety
The caller must guarantee that
bzerrorsatisfies the requirements ofpointer::as_mut- Either
unusedisNULLunusedis readable fornUnusedbytes