1 #![doc(html_root_url = "https://docs.rs/miniz-sys/0.1")]
2 #![allow(bad_style)]
3 #![cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
4 
5 extern crate libc;
6 use libc::*;
7 
8 pub const MZ_NO_FLUSH: c_int = 0;
9 pub const MZ_PARTIAL_FLUSH: c_int = 1;
10 pub const MZ_SYNC_FLUSH: c_int = 2;
11 pub const MZ_FULL_FLUSH: c_int = 3;
12 pub const MZ_FINISH: c_int = 4;
13 pub const MZ_BLOCK: c_int = 5;
14 
15 pub const MZ_OK: c_int = 0;
16 pub const MZ_STREAM_END: c_int = 1;
17 pub const MZ_NEED_DICT: c_int = 2;
18 pub const MZ_ERRNO: c_int = -1;
19 pub const MZ_STREAM_ERROR: c_int = -2;
20 pub const MZ_DATA_ERROR: c_int = -3;
21 pub const MZ_MEM_ERROR: c_int = -4;
22 pub const MZ_BUF_ERROR: c_int = -5;
23 pub const MZ_VERSION_ERROR: c_int = -6;
24 pub const MZ_PARAM_ERROR: c_int = -10000;
25 
26 pub const MZ_DEFLATED: c_int = 8;
27 pub const MZ_DEFAULT_WINDOW_BITS: c_int = 15;
28 pub const MZ_DEFAULT_STRATEGY: c_int = 0;
29 
30 #[repr(C)]
31 pub struct mz_stream {
32     pub next_in: *const u8,
33     pub avail_in: c_uint,
34     pub total_in: c_ulong,
35 
36     pub next_out: *mut u8,
37     pub avail_out: c_uint,
38     pub total_out: c_ulong,
39 
40     pub msg: *const c_char,
41     pub state: *mut mz_internal_state,
42 
43     pub zalloc: Option<mz_alloc_func>,
44     pub zfree: Option<mz_free_func>,
45     pub opaque: *mut c_void,
46 
47     pub data_type: c_int,
48     pub adler: c_ulong,
49     pub reserved: c_ulong,
50 }
51 
52 pub enum mz_internal_state {}
53 
54 pub type mz_alloc_func = extern "C" fn(*mut c_void, size_t, size_t) -> *mut c_void;
55 pub type mz_free_func = extern "C" fn(*mut c_void, *mut c_void);
56 
57 extern "C" {
mz_deflateInit2( stream: *mut mz_stream, level: c_int, method: c_int, window_bits: c_int, mem_level: c_int, strategy: c_int, ) -> c_int58     pub fn mz_deflateInit2(
59         stream: *mut mz_stream,
60         level: c_int,
61         method: c_int,
62         window_bits: c_int,
63         mem_level: c_int,
64         strategy: c_int,
65     ) -> c_int;
mz_deflate(stream: *mut mz_stream, flush: c_int) -> c_int66     pub fn mz_deflate(stream: *mut mz_stream, flush: c_int) -> c_int;
mz_deflateEnd(stream: *mut mz_stream) -> c_int67     pub fn mz_deflateEnd(stream: *mut mz_stream) -> c_int;
mz_deflateReset(stream: *mut mz_stream) -> c_int68     pub fn mz_deflateReset(stream: *mut mz_stream) -> c_int;
69 
mz_inflateInit2(stream: *mut mz_stream, window_bits: c_int) -> c_int70     pub fn mz_inflateInit2(stream: *mut mz_stream, window_bits: c_int) -> c_int;
mz_inflate(stream: *mut mz_stream, flush: c_int) -> c_int71     pub fn mz_inflate(stream: *mut mz_stream, flush: c_int) -> c_int;
mz_inflateEnd(stream: *mut mz_stream) -> c_int72     pub fn mz_inflateEnd(stream: *mut mz_stream) -> c_int;
73 
mz_crc32(crc: c_ulong, ptr: *const u8, len: size_t) -> c_ulong74     pub fn mz_crc32(crc: c_ulong, ptr: *const u8, len: size_t) -> c_ulong;
75 }
76