/rust/registry/src/index.crates.io-6f17d22bba15001f/bzip2-sys-0.1.13+1.0.8/lib.rs
Line | Count | Source (jump to first uncovered line) |
1 | | #![doc(html_root_url = "https://docs.rs/bzip2-sys/0.1")] |
2 | | #![no_std] |
3 | | |
4 | | use core::ffi::{c_char, c_int, c_uint, c_void}; |
5 | | |
6 | | pub const BZ_RUN: c_int = 0; |
7 | | pub const BZ_FLUSH: c_int = 1; |
8 | | pub const BZ_FINISH: c_int = 2; |
9 | | |
10 | | pub const BZ_OK: c_int = 0; |
11 | | pub const BZ_RUN_OK: c_int = 1; |
12 | | pub const BZ_FLUSH_OK: c_int = 2; |
13 | | pub const BZ_FINISH_OK: c_int = 3; |
14 | | pub const BZ_STREAM_END: c_int = 4; |
15 | | pub const BZ_SEQUENCE_ERROR: c_int = -1; |
16 | | pub const BZ_PARAM_ERROR: c_int = -2; |
17 | | pub const BZ_MEM_ERROR: c_int = -3; |
18 | | pub const BZ_DATA_ERROR: c_int = -4; |
19 | | pub const BZ_DATA_ERROR_MAGIC: c_int = -5; |
20 | | pub const BZ_IO_ERROR: c_int = -6; |
21 | | pub const BZ_UNEXPECTED_EOF: c_int = -7; |
22 | | pub const BZ_OUTBUFF_FULL: c_int = -8; |
23 | | pub const BZ_CONFIG_ERROR: c_int = -9; |
24 | | |
25 | | #[repr(C)] |
26 | | pub struct bz_stream { |
27 | | pub next_in: *mut c_char, |
28 | | pub avail_in: c_uint, |
29 | | pub total_in_lo32: c_uint, |
30 | | pub total_in_hi32: c_uint, |
31 | | |
32 | | pub next_out: *mut c_char, |
33 | | pub avail_out: c_uint, |
34 | | pub total_out_lo32: c_uint, |
35 | | pub total_out_hi32: c_uint, |
36 | | |
37 | | pub state: *mut c_void, |
38 | | |
39 | | pub bzalloc: Option<extern "C" fn(*mut c_void, c_int, c_int) -> *mut c_void>, |
40 | | pub bzfree: Option<extern "C" fn(*mut c_void, *mut c_void)>, |
41 | | pub opaque: *mut c_void, |
42 | | } |
43 | | |
44 | | macro_rules! abi_compat { |
45 | | ($(pub fn $name:ident($($arg:ident: $t:ty),*) -> $ret:ty,)*) => { |
46 | | #[cfg(windows)] |
47 | | extern "system" { |
48 | | $(pub fn $name($($arg: $t),*) -> $ret;)* |
49 | | } |
50 | | #[cfg(not(windows))] |
51 | | extern { |
52 | | $(pub fn $name($($arg: $t),*) -> $ret;)* |
53 | | } |
54 | | } |
55 | | } |
56 | | |
57 | | abi_compat! { |
58 | | pub fn BZ2_bzCompressInit(stream: *mut bz_stream, |
59 | | blockSize100k: c_int, |
60 | | verbosity: c_int, |
61 | | workFactor: c_int) -> c_int, |
62 | | pub fn BZ2_bzCompress(stream: *mut bz_stream, action: c_int) -> c_int, |
63 | | pub fn BZ2_bzCompressEnd(stream: *mut bz_stream) -> c_int, |
64 | | pub fn BZ2_bzDecompressInit(stream: *mut bz_stream, |
65 | | verbosity: c_int, |
66 | | small: c_int) -> c_int, |
67 | | pub fn BZ2_bzDecompress(stream: *mut bz_stream) -> c_int, |
68 | | pub fn BZ2_bzDecompressEnd(stream: *mut bz_stream) -> c_int, |
69 | | } |
70 | | |
71 | | #[no_mangle] |
72 | 0 | pub extern "C" fn bz_internal_error(errcode: c_int) { |
73 | 0 | panic!("bz internal error: {}", errcode); |
74 | | } |