1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
#![allow(bad_style)]
#![doc(html_root_url = "https://docs.rs/lzma-sys/0.1")]
use libc::{c_char, c_uchar, c_void, size_t};
use std::u64;
#[cfg(target_env = "msvc")]
#[doc(hidden)]
pub type __enum_ty = libc::c_int;
#[cfg(not(target_env = "msvc"))]
#[doc(hidden)]
pub type __enum_ty = libc::c_uint;
pub type lzma_bool = c_uchar;
pub type lzma_ret = __enum_ty;
pub type lzma_action = __enum_ty;
type lzma_reserved_enum = __enum_ty;
pub type lzma_check = __enum_ty;
pub type lzma_vli = u64;
pub type lzma_mode = __enum_ty;
pub type lzma_match_finder = __enum_ty;
pub const LZMA_OK: lzma_ret = 0;
pub const LZMA_STREAM_END: lzma_ret = 1;
pub const LZMA_NO_CHECK: lzma_ret = 2;
pub const LZMA_UNSUPPORTED_CHECK: lzma_ret = 3;
pub const LZMA_GET_CHECK: lzma_ret = 4;
pub const LZMA_MEM_ERROR: lzma_ret = 5;
pub const LZMA_MEMLIMIT_ERROR: lzma_ret = 6;
pub const LZMA_FORMAT_ERROR: lzma_ret = 7;
pub const LZMA_OPTIONS_ERROR: lzma_ret = 8;
pub const LZMA_DATA_ERROR: lzma_ret = 9;
pub const LZMA_BUF_ERROR: lzma_ret = 10;
pub const LZMA_PROG_ERROR: lzma_ret = 11;
pub const LZMA_RUN: lzma_action = 0;
pub const LZMA_SYNC_FLUSH: lzma_action = 1;
pub const LZMA_FULL_FLUSH: lzma_action = 2;
pub const LZMA_FULL_BARRIER: lzma_action = 4;
pub const LZMA_FINISH: lzma_action = 3;
pub const LZMA_CHECK_NONE: lzma_check = 0;
pub const LZMA_CHECK_CRC32: lzma_check = 1;
pub const LZMA_CHECK_CRC64: lzma_check = 4;
pub const LZMA_CHECK_SHA256: lzma_check = 10;
pub const LZMA_MODE_FAST: lzma_mode = 1;
pub const LZMA_MODE_NORMAL: lzma_mode = 2;
pub const LZMA_MF_HC3: lzma_match_finder = 0x03;
pub const LZMA_MF_HC4: lzma_match_finder = 0x04;
pub const LZMA_MF_BT2: lzma_match_finder = 0x12;
pub const LZMA_MF_BT3: lzma_match_finder = 0x13;
pub const LZMA_MF_BT4: lzma_match_finder = 0x14;
pub const LZMA_TELL_NO_CHECK: u32 = 0x01;
pub const LZMA_TELL_UNSUPPORTED_CHECK: u32 = 0x02;
pub const LZMA_TELL_ANY_CHECK: u32 = 0x04;
pub const LZMA_IGNORE_CHECK: u32 = 0x10;
pub const LZMA_CONCATENATED: u32 = 0x08;
pub const LZMA_PRESET_DEFAULT: u32 = 6;
pub const LZMA_PRESET_LEVEL_MASK: u32 = 0x1f;
pub const LZMA_PRESET_EXTREME: u32 = 1 << 31;
pub const LZMA_DICT_SIZE_MIN: u32 = 4096;
pub const LZMA_DICT_SIZE_DEFAULT: u32 = 1 << 23;
pub const LZMA_LCLP_MIN: u32 = 0;
pub const LZMA_LCLP_MAX: u32 = 4;
pub const LZMA_LC_DEFAULT: u32 = 3;
pub const LZMA_LP_DEFAULT: u32 = 0;
pub const LZMA_PB_MIN: u32 = 0;
pub const LZMA_PB_MAX: u32 = 4;
pub const LZMA_PB_DEFAULT: u32 = 2;
pub const LZMA_BACKWARD_SIZE_MIN: lzma_vli = 4;
pub const LZMA_BACKWARD_SIZE_MAX: lzma_vli = 1 << 34;
pub const LZMA_VLI_MAX: lzma_vli = u64::MAX / 2;
pub const LZMA_VLI_UNKNOWN: lzma_vli = u64::MAX;
pub const LZMA_VLI_BYTES_MAX: usize = 9;
pub const LZMA_FILTER_X86: lzma_vli = 0x04;
pub const LZMA_FILTER_POWERPC: lzma_vli = 0x05;
pub const LZMA_FILTER_IA64: lzma_vli = 0x06;
pub const LZMA_FILTER_ARM: lzma_vli = 0x07;
pub const LZMA_FILTER_ARMTHUMB: lzma_vli = 0x08;
pub const LZMA_FILTER_SPARC: lzma_vli = 0x09;
pub const LZMA_FILTER_LZMA1: lzma_vli = 0x4000000000000001;
pub const LZMA_FILTER_LZMA2: lzma_vli = 0x21;
#[repr(C)]
pub struct lzma_allocator {
pub alloc: Option<extern "C" fn(*mut c_void, size_t, size_t) -> *mut c_void>,
pub free: Option<extern "C" fn(*mut c_void, *mut c_void)>,
pub opaque: *mut c_void,
}
pub enum lzma_internal {}
#[repr(C)]
pub struct lzma_stream {
pub next_in: *const u8,
pub avail_in: size_t,
pub total_in: u64,
pub next_out: *mut u8,
pub avail_out: size_t,
pub total_out: u64,
pub allocator: *const lzma_allocator,
internal: *mut lzma_internal,
reserved_ptr1: *mut c_void,
reserved_ptr2: *mut c_void,
reserved_ptr3: *mut c_void,
reserved_ptr4: *mut c_void,
reserved_int1: u64,
reserved_int2: u64,
reserved_int3: size_t,
reserved_int4: size_t,
reserved_enum1: lzma_reserved_enum,
reserved_enum2: lzma_reserved_enum,
}
#[repr(C)]
pub struct lzma_filter {
pub id: lzma_vli,
pub options: *mut c_void,
}
#[repr(C)]
pub struct lzma_mt {
pub flags: u32,
pub threads: u32,
pub block_size: u64,
pub timeout: u32,
pub preset: u32,
pub filters: *const lzma_filter,
pub check: lzma_check,
reserved_enum1: lzma_reserved_enum,
reserved_enum2: lzma_reserved_enum,
reserved_enum3: lzma_reserved_enum,
reserved_int1: u32,
reserved_int2: u32,
reserved_int3: u32,
reserved_int4: u32,
reserved_int5: u64,
reserved_int6: u64,
reserved_int7: u64,
reserved_int8: u64,
reserved_ptr1: *mut c_void,
reserved_ptr2: *mut c_void,
reserved_ptr3: *mut c_void,
reserved_ptr4: *mut c_void,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct lzma_options_lzma {
pub dict_size: u32,
pub preset_dict: *const u8,
pub preset_dict_size: u32,
pub lc: u32,
pub lp: u32,
pub pb: u32,
pub mode: lzma_mode,
pub nice_len: u32,
pub mf: lzma_match_finder,
pub depth: u32,
reserved_int1: u32,
reserved_int2: u32,
reserved_int3: u32,
reserved_int4: u32,
reserved_int5: u32,
reserved_int6: u32,
reserved_int7: u32,
reserved_int8: u32,
reserved_enum1: lzma_reserved_enum,
reserved_enum2: lzma_reserved_enum,
reserved_enum3: lzma_reserved_enum,
reserved_enum4: lzma_reserved_enum,
reserved_ptr1: *mut c_void,
reserved_ptr2: *mut c_void,
}
#[repr(C)]
pub struct lzma_stream_flags {
pub version: u32,
pub backward_size: lzma_vli,
pub check: lzma_check,
reserved_enum1: lzma_reserved_enum,
reserved_enum2: lzma_reserved_enum,
reserved_enum3: lzma_reserved_enum,
reserved_enum4: lzma_reserved_enum,
reserved_bool1: lzma_bool,
reserved_bool2: lzma_bool,
reserved_bool3: lzma_bool,
reserved_bool4: lzma_bool,
reserved_bool5: lzma_bool,
reserved_bool6: lzma_bool,
reserved_bool7: lzma_bool,
reserved_bool8: lzma_bool,
reserved_int1: u32,
reserved_int2: u32,
}
#[repr(C)]
pub struct lzma_options_bcj {
pub start_offset: u32,
}
extern "C" {
pub fn lzma_code(strm: *mut lzma_stream, action: lzma_action) -> lzma_ret;
pub fn lzma_end(strm: *mut lzma_stream);
pub fn lzma_get_progress(strm: *mut lzma_stream, progress_in: *mut u64, progress_out: *mut u64);
pub fn lzma_memusage(strm: *const lzma_stream) -> u64;
pub fn lzma_memlimit_get(strm: *const lzma_stream) -> u64;
pub fn lzma_memlimit_set(strm: *mut lzma_stream, memlimit: u64) -> lzma_ret;
pub fn lzma_easy_encoder_memusage(preset: u32) -> u64;
pub fn lzma_easy_decoder_memusage(preset: u32) -> u64;
pub fn lzma_easy_encoder(strm: *mut lzma_stream, preset: u32, check: lzma_check) -> lzma_ret;
pub fn lzma_easy_buffer_encode(
preset: u32,
check: lzma_check,
allocator: *const lzma_allocator,
input: *const u8,
in_size: size_t,
out: *mut u8,
out_pos: *mut size_t,
out_size: size_t,
) -> lzma_ret;
pub fn lzma_stream_encoder(
strm: *mut lzma_stream,
filters: *const lzma_filter,
check: lzma_check,
) -> lzma_ret;
pub fn lzma_stream_encoder_mt_memusage(options: *const lzma_mt) -> u64;
pub fn lzma_stream_encoder_mt(strm: *mut lzma_stream, options: *const lzma_mt) -> lzma_ret;
pub fn lzma_alone_encoder(
strm: *mut lzma_stream,
options: *const lzma_options_lzma,
) -> lzma_ret;
pub fn lzma_stream_buffer_bound(uncompressed_size: size_t) -> size_t;
pub fn lzma_stream_buffer_encode(
filters: *mut lzma_filter,
check: lzma_check,
allocator: *const lzma_allocator,
input: *const u8,
in_size: size_t,
out: *mut u8,
out_pos: *mut size_t,
out_size: size_t,
) -> lzma_ret;
pub fn lzma_stream_decoder(strm: *mut lzma_stream, memlimit: u64, flags: u32) -> lzma_ret;
pub fn lzma_auto_decoder(strm: *mut lzma_stream, memlimit: u64, flags: u32) -> lzma_ret;
pub fn lzma_alone_decoder(strm: *mut lzma_stream, memlimit: u64) -> lzma_ret;
pub fn lzma_stream_buffer_decode(
memlimit: *mut u64,
flags: u32,
allocator: *const lzma_allocator,
input: *const u8,
in_pos: *mut size_t,
in_size: size_t,
out: *mut u8,
out_pos: *mut size_t,
out_size: size_t,
) -> lzma_ret;
pub fn lzma_check_is_supported(check: lzma_check) -> lzma_bool;
pub fn lzma_check_size(check: lzma_check) -> u32;
pub fn lzma_crc32(buf: *const u8, size: size_t, crc: u32) -> u32;
pub fn lzma_crc64(buf: *const u8, size: size_t, crc: u64) -> u64;
pub fn lzma_get_check(strm: *const lzma_stream) -> lzma_check;
pub fn lzma_filter_encoder_is_supported(id: lzma_vli) -> lzma_bool;
pub fn lzma_filter_decoder_is_supported(id: lzma_vli) -> lzma_bool;
pub fn lzma_filters_copy(
src: *const lzma_filter,
dest: *mut lzma_filter,
allocator: *const lzma_allocator,
) -> lzma_ret;
pub fn lzma_raw_encoder_memusage(filters: *const lzma_filter) -> u64;
pub fn lzma_raw_decoder_memusage(filters: *const lzma_filter) -> u64;
pub fn lzma_raw_encoder(strm: *mut lzma_stream, filters: *const lzma_filter) -> lzma_ret;
pub fn lzma_raw_decoder(strm: *mut lzma_stream, filters: *const lzma_filter) -> lzma_ret;
pub fn lzma_filters_update(strm: *mut lzma_stream, filters: *const lzma_filter) -> lzma_ret;
pub fn lzma_raw_buffer_encode(
filters: *const lzma_filter,
allocator: *const lzma_allocator,
input: *const u8,
in_size: size_t,
out: *mut u8,
out_pos: *mut size_t,
out_size: size_t,
) -> lzma_ret;
pub fn lzma_raw_buffer_decode(
filters: *const lzma_filter,
allocator: *const lzma_allocator,
input: *const u8,
in_pos: *mut size_t,
in_size: size_t,
out: *mut u8,
out_pos: *mut size_t,
out_size: size_t,
) -> lzma_ret;
pub fn lzma_properties_size(size: *mut u32, filter: *const lzma_filter) -> lzma_ret;
pub fn lzma_properties_encode(filter: *const lzma_filter, props: *mut u8) -> lzma_ret;
pub fn lzma_properties_decode(
filter: *mut lzma_filter,
allocator: *const lzma_allocator,
props: *const u8,
props_size: size_t,
) -> lzma_ret;
pub fn lzma_physmem() -> u64;
pub fn lzma_cputhreads() -> u32;
pub fn lzma_stream_header_encode(options: *const lzma_stream_flags, out: *mut u8) -> lzma_ret;
pub fn lzma_stream_footer_encode(options: *const lzma_stream_flags, out: *mut u8) -> lzma_ret;
pub fn lzma_stream_header_decode(options: *mut lzma_stream_flags, input: *const u8)
-> lzma_ret;
pub fn lzma_stream_footer_decode(options: *mut lzma_stream_flags, input: *const u8)
-> lzma_ret;
pub fn lzma_stream_flags_compare(
a: *const lzma_stream_flags,
b: *const lzma_stream_flags,
) -> lzma_ret;
pub fn lzma_version_number() -> u32;
pub fn lzma_version_string() -> *const c_char;
pub fn lzma_vli_encode(
vli: lzma_vli,
vli_pos: *mut size_t,
out: *mut u8,
out_pos: *mut size_t,
out_size: size_t,
) -> lzma_ret;
pub fn lzma_vli_decode(
vli: *mut lzma_vli,
vli_pos: *mut size_t,
input: *const u8,
in_pos: *mut size_t,
in_size: size_t,
) -> lzma_ret;
pub fn lzma_vli_size(vli: lzma_vli) -> u32;
pub fn lzma_lzma_preset(options: *mut lzma_options_lzma, preset: u32) -> lzma_bool;
pub fn lzma_mf_is_supported(mf: lzma_match_finder) -> lzma_bool;
}
|