JFLib

img_core/inflate.rs#

Source: lib/img_core/inflate.rs

inflate -- DEFLATE (RFC 1951) and zlib (RFC 1950) decompression with img_core's error codes

The decoder lives in jflib-compress since 0.2.2 (compress::deflate, compress::zlib); these are
the calls of before, for the codecs and for code written against them.  New code calls
compress directly.

  zlib_inflate(src, dst) -> Ok(bytes written) / Err(ERR_*)
  inflate_raw(src, dst) -> Ok(bytes) / Err(ERR_*)
  inflate_raw_ex(src, dst) -> Ok((bytes, consumed)) / Err(ERR_*)   consumed = input bytes
                                    of the deflate data (up to the end of the final block)
  InflateState::new() -> Box      reusable decoder state (one thread at a time; an error
                                    never affects later calls)
  zlib_inflate_st(st, src, dst) / inflate_raw_st(st, src, dst)   the same with a state
                                    (None = a temporary one, like the classic calls)

Errors: ERR_OVERFLOW (the output does not fit), ERR_DIST, ERR_TRUNC, ERR_HDR (zlib header),
ERR_CHECKSUM (Adler-32), ERR_BLOCK, ERR_CODE -- the same codes for the same input as before.

Re-exports: compress::deflate::InflateState

  • fn zlib_inflate(src: &[u8], dst: &mut [u8]) -> Result<usize, i32> zlib stream src -> dst [zlib_inflate]

  • fn zlib_inflate_st(st: Option<&mut InflateState>, src: &[u8], dst: &mut [u8]) -> Result<usize, i32> zlib_inflate with a reusable state (None = a temporary one) [zlib_inflate_st]

  • fn inflate_raw(src: &[u8], dst: &mut [u8]) -> Result<usize, i32> raw deflate data src -> dst [inflate_raw]

  • fn inflate_raw_ex(src: &[u8], dst: &mut [u8]) -> Result<(usize, usize), i32> inflate_raw that also gives the input bytes the deflate data occupied [inflate_raw_ex]

  • fn inflate_raw_st(st: Option<&mut InflateState>, src: &[u8], dst: &mut [u8]) -> Result<(usize, usize), i32> inflate_raw_ex with a reusable state (None = a temporary one) [inflate_raw_st]

Source: docs/API.md in the JFLib repository.