1 /*
2 This file is auto-generated from the public API of the zstd library.
3 It is released under the same BSD license.
4
5 BSD License
6
7 For Zstandard software
8
9 Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
10
11 Redistribution and use in source and binary forms, with or without modification,
12 are permitted provided that the following conditions are met:
13
14 * Redistributions of source code must retain the above copyright notice, this
15 list of conditions and the following disclaimer.
16
17 * Redistributions in binary form must reproduce the above copyright notice,
18 this list of conditions and the following disclaimer in the documentation
19 and/or other materials provided with the distribution.
20
21 * Neither the name Facebook nor the names of its contributors may be used to
22 endorse or promote products derived from this software without specific
23 prior written permission.
24
25 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
26 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
29 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
32 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36 /* automatically generated by rust-bindgen 0.57.0 */
37
38 pub const _LIBC_LIMITS_H_: u32 = 1;
39 pub const _FEATURES_H: u32 = 1;
40 pub const _DEFAULT_SOURCE: u32 = 1;
41 pub const __GLIBC_USE_ISOC2X: u32 = 0;
42 pub const __USE_ISOC11: u32 = 1;
43 pub const __USE_ISOC99: u32 = 1;
44 pub const __USE_ISOC95: u32 = 1;
45 pub const __USE_POSIX_IMPLICITLY: u32 = 1;
46 pub const _POSIX_SOURCE: u32 = 1;
47 pub const _POSIX_C_SOURCE: u32 = 200809;
48 pub const __USE_POSIX: u32 = 1;
49 pub const __USE_POSIX2: u32 = 1;
50 pub const __USE_POSIX199309: u32 = 1;
51 pub const __USE_POSIX199506: u32 = 1;
52 pub const __USE_XOPEN2K: u32 = 1;
53 pub const __USE_XOPEN2K8: u32 = 1;
54 pub const _ATFILE_SOURCE: u32 = 1;
55 pub const __USE_MISC: u32 = 1;
56 pub const __USE_ATFILE: u32 = 1;
57 pub const __USE_FORTIFY_LEVEL: u32 = 0;
58 pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
59 pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
60 pub const _STDC_PREDEF_H: u32 = 1;
61 pub const __STDC_IEC_559__: u32 = 1;
62 pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
63 pub const __STDC_ISO_10646__: u32 = 201706;
64 pub const __GNU_LIBRARY__: u32 = 6;
65 pub const __GLIBC__: u32 = 2;
66 pub const __GLIBC_MINOR__: u32 = 33;
67 pub const _SYS_CDEFS_H: u32 = 1;
68 pub const __glibc_c99_flexarr_available: u32 = 1;
69 pub const __WORDSIZE: u32 = 64;
70 pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
71 pub const __SYSCALL_WORDSIZE: u32 = 64;
72 pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0;
73 pub const __HAVE_GENERIC_SELECTION: u32 = 1;
74 pub const __GLIBC_USE_LIB_EXT2: u32 = 0;
75 pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0;
76 pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0;
77 pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0;
78 pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0;
79 pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0;
80 pub const MB_LEN_MAX: u32 = 16;
81 pub const _BITS_POSIX1_LIM_H: u32 = 1;
82 pub const _POSIX_AIO_LISTIO_MAX: u32 = 2;
83 pub const _POSIX_AIO_MAX: u32 = 1;
84 pub const _POSIX_ARG_MAX: u32 = 4096;
85 pub const _POSIX_CHILD_MAX: u32 = 25;
86 pub const _POSIX_DELAYTIMER_MAX: u32 = 32;
87 pub const _POSIX_HOST_NAME_MAX: u32 = 255;
88 pub const _POSIX_LINK_MAX: u32 = 8;
89 pub const _POSIX_LOGIN_NAME_MAX: u32 = 9;
90 pub const _POSIX_MAX_CANON: u32 = 255;
91 pub const _POSIX_MAX_INPUT: u32 = 255;
92 pub const _POSIX_MQ_OPEN_MAX: u32 = 8;
93 pub const _POSIX_MQ_PRIO_MAX: u32 = 32;
94 pub const _POSIX_NAME_MAX: u32 = 14;
95 pub const _POSIX_NGROUPS_MAX: u32 = 8;
96 pub const _POSIX_OPEN_MAX: u32 = 20;
97 pub const _POSIX_PATH_MAX: u32 = 256;
98 pub const _POSIX_PIPE_BUF: u32 = 512;
99 pub const _POSIX_RE_DUP_MAX: u32 = 255;
100 pub const _POSIX_RTSIG_MAX: u32 = 8;
101 pub const _POSIX_SEM_NSEMS_MAX: u32 = 256;
102 pub const _POSIX_SEM_VALUE_MAX: u32 = 32767;
103 pub const _POSIX_SIGQUEUE_MAX: u32 = 32;
104 pub const _POSIX_SSIZE_MAX: u32 = 32767;
105 pub const _POSIX_STREAM_MAX: u32 = 8;
106 pub const _POSIX_SYMLINK_MAX: u32 = 255;
107 pub const _POSIX_SYMLOOP_MAX: u32 = 8;
108 pub const _POSIX_TIMER_MAX: u32 = 32;
109 pub const _POSIX_TTY_NAME_MAX: u32 = 9;
110 pub const _POSIX_TZNAME_MAX: u32 = 6;
111 pub const _POSIX_CLOCKRES_MIN: u32 = 20000000;
112 pub const NR_OPEN: u32 = 1024;
113 pub const NGROUPS_MAX: u32 = 65536;
114 pub const ARG_MAX: u32 = 131072;
115 pub const LINK_MAX: u32 = 127;
116 pub const MAX_CANON: u32 = 255;
117 pub const MAX_INPUT: u32 = 255;
118 pub const NAME_MAX: u32 = 255;
119 pub const PATH_MAX: u32 = 4096;
120 pub const PIPE_BUF: u32 = 4096;
121 pub const XATTR_NAME_MAX: u32 = 255;
122 pub const XATTR_SIZE_MAX: u32 = 65536;
123 pub const XATTR_LIST_MAX: u32 = 65536;
124 pub const RTSIG_MAX: u32 = 32;
125 pub const _POSIX_THREAD_KEYS_MAX: u32 = 128;
126 pub const PTHREAD_KEYS_MAX: u32 = 1024;
127 pub const _POSIX_THREAD_DESTRUCTOR_ITERATIONS: u32 = 4;
128 pub const PTHREAD_DESTRUCTOR_ITERATIONS: u32 = 4;
129 pub const _POSIX_THREAD_THREADS_MAX: u32 = 64;
130 pub const AIO_PRIO_DELTA_MAX: u32 = 20;
131 pub const PTHREAD_STACK_MIN: u32 = 16384;
132 pub const DELAYTIMER_MAX: u32 = 2147483647;
133 pub const TTY_NAME_MAX: u32 = 32;
134 pub const LOGIN_NAME_MAX: u32 = 256;
135 pub const HOST_NAME_MAX: u32 = 64;
136 pub const MQ_PRIO_MAX: u32 = 32768;
137 pub const SEM_VALUE_MAX: u32 = 2147483647;
138 pub const _BITS_POSIX2_LIM_H: u32 = 1;
139 pub const _POSIX2_BC_BASE_MAX: u32 = 99;
140 pub const _POSIX2_BC_DIM_MAX: u32 = 2048;
141 pub const _POSIX2_BC_SCALE_MAX: u32 = 99;
142 pub const _POSIX2_BC_STRING_MAX: u32 = 1000;
143 pub const _POSIX2_COLL_WEIGHTS_MAX: u32 = 2;
144 pub const _POSIX2_EXPR_NEST_MAX: u32 = 32;
145 pub const _POSIX2_LINE_MAX: u32 = 2048;
146 pub const _POSIX2_RE_DUP_MAX: u32 = 255;
147 pub const _POSIX2_CHARCLASS_NAME_MAX: u32 = 14;
148 pub const BC_BASE_MAX: u32 = 99;
149 pub const BC_DIM_MAX: u32 = 2048;
150 pub const BC_SCALE_MAX: u32 = 99;
151 pub const BC_STRING_MAX: u32 = 1000;
152 pub const COLL_WEIGHTS_MAX: u32 = 255;
153 pub const EXPR_NEST_MAX: u32 = 32;
154 pub const LINE_MAX: u32 = 2048;
155 pub const CHARCLASS_NAME_MAX: u32 = 2048;
156 pub const RE_DUP_MAX: u32 = 32767;
157 pub const ZSTD_VERSION_MAJOR: u32 = 1;
158 pub const ZSTD_VERSION_MINOR: u32 = 4;
159 pub const ZSTD_VERSION_RELEASE: u32 = 9;
160 pub const ZSTD_VERSION_NUMBER: u32 = 10409;
161 pub const ZSTD_CLEVEL_DEFAULT: u32 = 3;
162 pub const ZSTD_MAGICNUMBER: u32 = 4247762216;
163 pub const ZSTD_MAGIC_DICTIONARY: u32 = 3962610743;
164 pub const ZSTD_MAGIC_SKIPPABLE_START: u32 = 407710288;
165 pub const ZSTD_MAGIC_SKIPPABLE_MASK: u32 = 4294967280;
166 pub const ZSTD_BLOCKSIZELOG_MAX: u32 = 17;
167 pub const ZSTD_BLOCKSIZE_MAX: u32 = 131072;
168 pub const ZSTD_CONTENTSIZE_UNKNOWN: i32 = -1;
169 pub const ZSTD_CONTENTSIZE_ERROR: i32 = -2;
170 pub type wchar_t = libc::c_int;
171 extern "C" {
172 #[doc = " ZSTD_versionNumber() :"]
173 #[doc = " Return runtime library version, the value is (MAJOR*100*100 + MINOR*100 + RELEASE)."]
ZSTD_versionNumber() -> libc::c_uint174 pub fn ZSTD_versionNumber() -> libc::c_uint;
175 }
176 extern "C" {
177 #[doc = " ZSTD_versionString() :"]
178 #[doc = " Return runtime library version, like \"1.4.5\". Requires v1.3.0+."]
ZSTD_versionString() -> *const libc::c_char179 pub fn ZSTD_versionString() -> *const libc::c_char;
180 }
181 extern "C" {
182 #[doc = " Simple API"]
183 #[doc = " Compresses `src` content as a single zstd compressed frame into already allocated `dst`."]
184 #[doc = " Hint : compression runs faster if `dstCapacity` >= `ZSTD_compressBound(srcSize)`."]
185 #[doc = " @return : compressed size written into `dst` (<= `dstCapacity),"]
186 #[doc = " or an error code if it fails (which can be tested using ZSTD_isError())."]
ZSTD_compress( dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, compressionLevel: libc::c_int, ) -> usize187 pub fn ZSTD_compress(
188 dst: *mut libc::c_void,
189 dstCapacity: usize,
190 src: *const libc::c_void,
191 srcSize: usize,
192 compressionLevel: libc::c_int,
193 ) -> usize;
194 }
195 extern "C" {
196 #[doc = " ZSTD_decompress() :"]
197 #[doc = " `compressedSize` : must be the _exact_ size of some number of compressed and/or skippable frames."]
198 #[doc = " `dstCapacity` is an upper bound of originalSize to regenerate."]
199 #[doc = " If user cannot imply a maximum upper bound, it's better to use streaming mode to decompress data."]
200 #[doc = " @return : the number of bytes decompressed into `dst` (<= `dstCapacity`),"]
201 #[doc = " or an errorCode if it fails (which can be tested using ZSTD_isError())."]
ZSTD_decompress( dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, compressedSize: usize, ) -> usize202 pub fn ZSTD_decompress(
203 dst: *mut libc::c_void,
204 dstCapacity: usize,
205 src: *const libc::c_void,
206 compressedSize: usize,
207 ) -> usize;
208 }
209 extern "C" {
ZSTD_getFrameContentSize( src: *const libc::c_void, srcSize: usize, ) -> libc::c_ulonglong210 pub fn ZSTD_getFrameContentSize(
211 src: *const libc::c_void,
212 srcSize: usize,
213 ) -> libc::c_ulonglong;
214 }
215 extern "C" {
216 #[doc = " ZSTD_getDecompressedSize() :"]
217 #[doc = " NOTE: This function is now obsolete, in favor of ZSTD_getFrameContentSize()."]
218 #[doc = " Both functions work the same way, but ZSTD_getDecompressedSize() blends"]
219 #[doc = " \"empty\", \"unknown\" and \"error\" results to the same return value (0),"]
220 #[doc = " while ZSTD_getFrameContentSize() gives them separate return values."]
221 #[doc = " @return : decompressed size of `src` frame content _if known and not empty_, 0 otherwise."]
ZSTD_getDecompressedSize( src: *const libc::c_void, srcSize: usize, ) -> libc::c_ulonglong222 pub fn ZSTD_getDecompressedSize(
223 src: *const libc::c_void,
224 srcSize: usize,
225 ) -> libc::c_ulonglong;
226 }
227 extern "C" {
228 #[doc = " ZSTD_findFrameCompressedSize() :"]
229 #[doc = " `src` should point to the start of a ZSTD frame or skippable frame."]
230 #[doc = " `srcSize` must be >= first frame size"]
231 #[doc = " @return : the compressed size of the first frame starting at `src`,"]
232 #[doc = " suitable to pass as `srcSize` to `ZSTD_decompress` or similar,"]
233 #[doc = " or an error code if input is invalid"]
ZSTD_findFrameCompressedSize( src: *const libc::c_void, srcSize: usize, ) -> usize234 pub fn ZSTD_findFrameCompressedSize(
235 src: *const libc::c_void,
236 srcSize: usize,
237 ) -> usize;
238 }
239 extern "C" {
ZSTD_compressBound(srcSize: usize) -> usize240 pub fn ZSTD_compressBound(srcSize: usize) -> usize;
241 }
242 extern "C" {
ZSTD_isError(code: usize) -> libc::c_uint243 pub fn ZSTD_isError(code: usize) -> libc::c_uint;
244 }
245 extern "C" {
ZSTD_getErrorName(code: usize) -> *const libc::c_char246 pub fn ZSTD_getErrorName(code: usize) -> *const libc::c_char;
247 }
248 extern "C" {
ZSTD_minCLevel() -> libc::c_int249 pub fn ZSTD_minCLevel() -> libc::c_int;
250 }
251 extern "C" {
ZSTD_maxCLevel() -> libc::c_int252 pub fn ZSTD_maxCLevel() -> libc::c_int;
253 }
254 #[repr(C)]
255 #[derive(Debug, Copy, Clone)]
256 pub struct ZSTD_CCtx_s {
257 _unused: [u8; 0],
258 }
259 #[doc = " Explicit context"]
260 pub type ZSTD_CCtx = ZSTD_CCtx_s;
261 extern "C" {
ZSTD_createCCtx() -> *mut ZSTD_CCtx262 pub fn ZSTD_createCCtx() -> *mut ZSTD_CCtx;
263 }
264 extern "C" {
ZSTD_freeCCtx(cctx: *mut ZSTD_CCtx) -> usize265 pub fn ZSTD_freeCCtx(cctx: *mut ZSTD_CCtx) -> usize;
266 }
267 extern "C" {
268 #[doc = " ZSTD_compressCCtx() :"]
269 #[doc = " Same as ZSTD_compress(), using an explicit ZSTD_CCtx."]
270 #[doc = " Important : in order to behave similarly to `ZSTD_compress()`,"]
271 #[doc = " this function compresses at requested compression level,"]
272 #[doc = " __ignoring any other parameter__ ."]
273 #[doc = " If any advanced parameter was set using the advanced API,"]
274 #[doc = " they will all be reset. Only `compressionLevel` remains."]
ZSTD_compressCCtx( cctx: *mut ZSTD_CCtx, dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, compressionLevel: libc::c_int, ) -> usize275 pub fn ZSTD_compressCCtx(
276 cctx: *mut ZSTD_CCtx,
277 dst: *mut libc::c_void,
278 dstCapacity: usize,
279 src: *const libc::c_void,
280 srcSize: usize,
281 compressionLevel: libc::c_int,
282 ) -> usize;
283 }
284 #[repr(C)]
285 #[derive(Debug, Copy, Clone)]
286 pub struct ZSTD_DCtx_s {
287 _unused: [u8; 0],
288 }
289 pub type ZSTD_DCtx = ZSTD_DCtx_s;
290 extern "C" {
ZSTD_createDCtx() -> *mut ZSTD_DCtx291 pub fn ZSTD_createDCtx() -> *mut ZSTD_DCtx;
292 }
293 extern "C" {
ZSTD_freeDCtx(dctx: *mut ZSTD_DCtx) -> usize294 pub fn ZSTD_freeDCtx(dctx: *mut ZSTD_DCtx) -> usize;
295 }
296 extern "C" {
297 #[doc = " ZSTD_decompressDCtx() :"]
298 #[doc = " Same as ZSTD_decompress(),"]
299 #[doc = " requires an allocated ZSTD_DCtx."]
300 #[doc = " Compatible with sticky parameters."]
ZSTD_decompressDCtx( dctx: *mut ZSTD_DCtx, dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, ) -> usize301 pub fn ZSTD_decompressDCtx(
302 dctx: *mut ZSTD_DCtx,
303 dst: *mut libc::c_void,
304 dstCapacity: usize,
305 src: *const libc::c_void,
306 srcSize: usize,
307 ) -> usize;
308 }
309 #[repr(u32)]
310 #[doc = " Advanced compression API"]
311 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
312 pub enum ZSTD_strategy {
313 ZSTD_fast = 1,
314 ZSTD_dfast = 2,
315 ZSTD_greedy = 3,
316 ZSTD_lazy = 4,
317 ZSTD_lazy2 = 5,
318 ZSTD_btlazy2 = 6,
319 ZSTD_btopt = 7,
320 ZSTD_btultra = 8,
321 ZSTD_btultra2 = 9,
322 }
323 #[repr(u32)]
324 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
325 pub enum ZSTD_cParameter {
326 ZSTD_c_compressionLevel = 100,
327 ZSTD_c_windowLog = 101,
328 ZSTD_c_hashLog = 102,
329 ZSTD_c_chainLog = 103,
330 ZSTD_c_searchLog = 104,
331 ZSTD_c_minMatch = 105,
332 ZSTD_c_targetLength = 106,
333 ZSTD_c_strategy = 107,
334 ZSTD_c_enableLongDistanceMatching = 160,
335 ZSTD_c_ldmHashLog = 161,
336 ZSTD_c_ldmMinMatch = 162,
337 ZSTD_c_ldmBucketSizeLog = 163,
338 ZSTD_c_ldmHashRateLog = 164,
339 ZSTD_c_contentSizeFlag = 200,
340 ZSTD_c_checksumFlag = 201,
341 ZSTD_c_dictIDFlag = 202,
342 ZSTD_c_nbWorkers = 400,
343 ZSTD_c_jobSize = 401,
344 ZSTD_c_overlapLog = 402,
345 ZSTD_c_experimentalParam1 = 500,
346 ZSTD_c_experimentalParam2 = 10,
347 ZSTD_c_experimentalParam3 = 1000,
348 ZSTD_c_experimentalParam4 = 1001,
349 ZSTD_c_experimentalParam5 = 1002,
350 ZSTD_c_experimentalParam6 = 1003,
351 ZSTD_c_experimentalParam7 = 1004,
352 ZSTD_c_experimentalParam8 = 1005,
353 ZSTD_c_experimentalParam9 = 1006,
354 ZSTD_c_experimentalParam10 = 1007,
355 ZSTD_c_experimentalParam11 = 1008,
356 ZSTD_c_experimentalParam12 = 1009,
357 }
358 #[repr(C)]
359 #[derive(Debug, Copy, Clone)]
360 pub struct ZSTD_bounds {
361 pub error: usize,
362 pub lowerBound: libc::c_int,
363 pub upperBound: libc::c_int,
364 }
365 #[test]
bindgen_test_layout_ZSTD_bounds()366 fn bindgen_test_layout_ZSTD_bounds() {
367 assert_eq!(
368 ::core::mem::size_of::<ZSTD_bounds>(),
369 16usize,
370 concat!("Size of: ", stringify!(ZSTD_bounds))
371 );
372 assert_eq!(
373 ::core::mem::align_of::<ZSTD_bounds>(),
374 8usize,
375 concat!("Alignment of ", stringify!(ZSTD_bounds))
376 );
377 assert_eq!(
378 unsafe {
379 &(*(::core::ptr::null::<ZSTD_bounds>())).error as *const _ as usize
380 },
381 0usize,
382 concat!(
383 "Offset of field: ",
384 stringify!(ZSTD_bounds),
385 "::",
386 stringify!(error)
387 )
388 );
389 assert_eq!(
390 unsafe {
391 &(*(::core::ptr::null::<ZSTD_bounds>())).lowerBound as *const _
392 as usize
393 },
394 8usize,
395 concat!(
396 "Offset of field: ",
397 stringify!(ZSTD_bounds),
398 "::",
399 stringify!(lowerBound)
400 )
401 );
402 assert_eq!(
403 unsafe {
404 &(*(::core::ptr::null::<ZSTD_bounds>())).upperBound as *const _
405 as usize
406 },
407 12usize,
408 concat!(
409 "Offset of field: ",
410 stringify!(ZSTD_bounds),
411 "::",
412 stringify!(upperBound)
413 )
414 );
415 }
416 extern "C" {
417 #[doc = " ZSTD_cParam_getBounds() :"]
418 #[doc = " All parameters must belong to an interval with lower and upper bounds,"]
419 #[doc = " otherwise they will either trigger an error or be automatically clamped."]
420 #[doc = " @return : a structure, ZSTD_bounds, which contains"]
421 #[doc = " - an error status field, which must be tested using ZSTD_isError()"]
422 #[doc = " - lower and upper bounds, both inclusive"]
ZSTD_cParam_getBounds(cParam: ZSTD_cParameter) -> ZSTD_bounds423 pub fn ZSTD_cParam_getBounds(cParam: ZSTD_cParameter) -> ZSTD_bounds;
424 }
425 extern "C" {
426 #[doc = " ZSTD_CCtx_setParameter() :"]
427 #[doc = " Set one compression parameter, selected by enum ZSTD_cParameter."]
428 #[doc = " All parameters have valid bounds. Bounds can be queried using ZSTD_cParam_getBounds()."]
429 #[doc = " Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter)."]
430 #[doc = " Setting a parameter is generally only possible during frame initialization (before starting compression)."]
431 #[doc = " Exception : when using multi-threading mode (nbWorkers >= 1),"]
432 #[doc = " the following parameters can be updated _during_ compression (within same frame):"]
433 #[doc = " => compressionLevel, hashLog, chainLog, searchLog, minMatch, targetLength and strategy."]
434 #[doc = " new parameters will be active for next job only (after a flush())."]
435 #[doc = " @return : an error code (which can be tested using ZSTD_isError())."]
ZSTD_CCtx_setParameter( cctx: *mut ZSTD_CCtx, param: ZSTD_cParameter, value: libc::c_int, ) -> usize436 pub fn ZSTD_CCtx_setParameter(
437 cctx: *mut ZSTD_CCtx,
438 param: ZSTD_cParameter,
439 value: libc::c_int,
440 ) -> usize;
441 }
442 extern "C" {
443 #[doc = " ZSTD_CCtx_setPledgedSrcSize() :"]
444 #[doc = " Total input data size to be compressed as a single frame."]
445 #[doc = " Value will be written in frame header, unless if explicitly forbidden using ZSTD_c_contentSizeFlag."]
446 #[doc = " This value will also be controlled at end of frame, and trigger an error if not respected."]
447 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
448 #[doc = " Note 1 : pledgedSrcSize==0 actually means zero, aka an empty frame."]
449 #[doc = " In order to mean \"unknown content size\", pass constant ZSTD_CONTENTSIZE_UNKNOWN."]
450 #[doc = " ZSTD_CONTENTSIZE_UNKNOWN is default value for any new frame."]
451 #[doc = " Note 2 : pledgedSrcSize is only valid once, for the next frame."]
452 #[doc = " It's discarded at the end of the frame, and replaced by ZSTD_CONTENTSIZE_UNKNOWN."]
453 #[doc = " Note 3 : Whenever all input data is provided and consumed in a single round,"]
454 #[doc = " for example with ZSTD_compress2(),"]
455 #[doc = " or invoking immediately ZSTD_compressStream2(,,,ZSTD_e_end),"]
456 #[doc = " this value is automatically overridden by srcSize instead."]
ZSTD_CCtx_setPledgedSrcSize( cctx: *mut ZSTD_CCtx, pledgedSrcSize: libc::c_ulonglong, ) -> usize457 pub fn ZSTD_CCtx_setPledgedSrcSize(
458 cctx: *mut ZSTD_CCtx,
459 pledgedSrcSize: libc::c_ulonglong,
460 ) -> usize;
461 }
462 #[repr(u32)]
463 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
464 pub enum ZSTD_ResetDirective {
465 ZSTD_reset_session_only = 1,
466 ZSTD_reset_parameters = 2,
467 ZSTD_reset_session_and_parameters = 3,
468 }
469 extern "C" {
470 #[doc = " ZSTD_CCtx_reset() :"]
471 #[doc = " There are 2 different things that can be reset, independently or jointly :"]
472 #[doc = " - The session : will stop compressing current frame, and make CCtx ready to start a new one."]
473 #[doc = " Useful after an error, or to interrupt any ongoing compression."]
474 #[doc = " Any internal data not yet flushed is cancelled."]
475 #[doc = " Compression parameters and dictionary remain unchanged."]
476 #[doc = " They will be used to compress next frame."]
477 #[doc = " Resetting session never fails."]
478 #[doc = " - The parameters : changes all parameters back to \"default\"."]
479 #[doc = " This removes any reference to any dictionary too."]
480 #[doc = " Parameters can only be changed between 2 sessions (i.e. no compression is currently ongoing)"]
481 #[doc = " otherwise the reset fails, and function returns an error value (which can be tested using ZSTD_isError())"]
482 #[doc = " - Both : similar to resetting the session, followed by resetting parameters."]
ZSTD_CCtx_reset( cctx: *mut ZSTD_CCtx, reset: ZSTD_ResetDirective, ) -> usize483 pub fn ZSTD_CCtx_reset(
484 cctx: *mut ZSTD_CCtx,
485 reset: ZSTD_ResetDirective,
486 ) -> usize;
487 }
488 extern "C" {
489 #[doc = " ZSTD_compress2() :"]
490 #[doc = " Behave the same as ZSTD_compressCCtx(), but compression parameters are set using the advanced API."]
491 #[doc = " ZSTD_compress2() always starts a new frame."]
492 #[doc = " Should cctx hold data from a previously unfinished frame, everything about it is forgotten."]
493 #[doc = " - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()"]
494 #[doc = " - The function is always blocking, returns when compression is completed."]
495 #[doc = " Hint : compression runs faster if `dstCapacity` >= `ZSTD_compressBound(srcSize)`."]
496 #[doc = " @return : compressed size written into `dst` (<= `dstCapacity),"]
497 #[doc = " or an error code if it fails (which can be tested using ZSTD_isError())."]
ZSTD_compress2( cctx: *mut ZSTD_CCtx, dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, ) -> usize498 pub fn ZSTD_compress2(
499 cctx: *mut ZSTD_CCtx,
500 dst: *mut libc::c_void,
501 dstCapacity: usize,
502 src: *const libc::c_void,
503 srcSize: usize,
504 ) -> usize;
505 }
506 #[repr(u32)]
507 #[doc = " Advanced decompression API"]
508 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
509 pub enum ZSTD_dParameter {
510 ZSTD_d_windowLogMax = 100,
511 ZSTD_d_experimentalParam1 = 1000,
512 ZSTD_d_experimentalParam2 = 1001,
513 ZSTD_d_experimentalParam3 = 1002,
514 ZSTD_d_experimentalParam4 = 1003,
515 }
516 extern "C" {
517 #[doc = " ZSTD_dParam_getBounds() :"]
518 #[doc = " All parameters must belong to an interval with lower and upper bounds,"]
519 #[doc = " otherwise they will either trigger an error or be automatically clamped."]
520 #[doc = " @return : a structure, ZSTD_bounds, which contains"]
521 #[doc = " - an error status field, which must be tested using ZSTD_isError()"]
522 #[doc = " - both lower and upper bounds, inclusive"]
ZSTD_dParam_getBounds(dParam: ZSTD_dParameter) -> ZSTD_bounds523 pub fn ZSTD_dParam_getBounds(dParam: ZSTD_dParameter) -> ZSTD_bounds;
524 }
525 extern "C" {
526 #[doc = " ZSTD_DCtx_setParameter() :"]
527 #[doc = " Set one compression parameter, selected by enum ZSTD_dParameter."]
528 #[doc = " All parameters have valid bounds. Bounds can be queried using ZSTD_dParam_getBounds()."]
529 #[doc = " Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter)."]
530 #[doc = " Setting a parameter is only possible during frame initialization (before starting decompression)."]
531 #[doc = " @return : 0, or an error code (which can be tested using ZSTD_isError())."]
ZSTD_DCtx_setParameter( dctx: *mut ZSTD_DCtx, param: ZSTD_dParameter, value: libc::c_int, ) -> usize532 pub fn ZSTD_DCtx_setParameter(
533 dctx: *mut ZSTD_DCtx,
534 param: ZSTD_dParameter,
535 value: libc::c_int,
536 ) -> usize;
537 }
538 extern "C" {
539 #[doc = " ZSTD_DCtx_reset() :"]
540 #[doc = " Return a DCtx to clean state."]
541 #[doc = " Session and parameters can be reset jointly or separately."]
542 #[doc = " Parameters can only be reset when no active frame is being decompressed."]
543 #[doc = " @return : 0, or an error code, which can be tested with ZSTD_isError()"]
ZSTD_DCtx_reset( dctx: *mut ZSTD_DCtx, reset: ZSTD_ResetDirective, ) -> usize544 pub fn ZSTD_DCtx_reset(
545 dctx: *mut ZSTD_DCtx,
546 reset: ZSTD_ResetDirective,
547 ) -> usize;
548 }
549 #[doc = " Streaming"]
550 #[repr(C)]
551 #[derive(Debug, Copy, Clone)]
552 pub struct ZSTD_inBuffer_s {
553 #[doc = "< start of input buffer"]
554 pub src: *const libc::c_void,
555 #[doc = "< size of input buffer"]
556 pub size: usize,
557 #[doc = "< position where reading stopped. Will be updated. Necessarily 0 <= pos <= size"]
558 pub pos: usize,
559 }
560 #[test]
bindgen_test_layout_ZSTD_inBuffer_s()561 fn bindgen_test_layout_ZSTD_inBuffer_s() {
562 assert_eq!(
563 ::core::mem::size_of::<ZSTD_inBuffer_s>(),
564 24usize,
565 concat!("Size of: ", stringify!(ZSTD_inBuffer_s))
566 );
567 assert_eq!(
568 ::core::mem::align_of::<ZSTD_inBuffer_s>(),
569 8usize,
570 concat!("Alignment of ", stringify!(ZSTD_inBuffer_s))
571 );
572 assert_eq!(
573 unsafe {
574 &(*(::core::ptr::null::<ZSTD_inBuffer_s>())).src as *const _
575 as usize
576 },
577 0usize,
578 concat!(
579 "Offset of field: ",
580 stringify!(ZSTD_inBuffer_s),
581 "::",
582 stringify!(src)
583 )
584 );
585 assert_eq!(
586 unsafe {
587 &(*(::core::ptr::null::<ZSTD_inBuffer_s>())).size as *const _
588 as usize
589 },
590 8usize,
591 concat!(
592 "Offset of field: ",
593 stringify!(ZSTD_inBuffer_s),
594 "::",
595 stringify!(size)
596 )
597 );
598 assert_eq!(
599 unsafe {
600 &(*(::core::ptr::null::<ZSTD_inBuffer_s>())).pos as *const _
601 as usize
602 },
603 16usize,
604 concat!(
605 "Offset of field: ",
606 stringify!(ZSTD_inBuffer_s),
607 "::",
608 stringify!(pos)
609 )
610 );
611 }
612 #[doc = " Streaming"]
613 pub type ZSTD_inBuffer = ZSTD_inBuffer_s;
614 #[repr(C)]
615 #[derive(Debug, Copy, Clone)]
616 pub struct ZSTD_outBuffer_s {
617 #[doc = "< start of output buffer"]
618 pub dst: *mut libc::c_void,
619 #[doc = "< size of output buffer"]
620 pub size: usize,
621 #[doc = "< position where writing stopped. Will be updated. Necessarily 0 <= pos <= size"]
622 pub pos: usize,
623 }
624 #[test]
bindgen_test_layout_ZSTD_outBuffer_s()625 fn bindgen_test_layout_ZSTD_outBuffer_s() {
626 assert_eq!(
627 ::core::mem::size_of::<ZSTD_outBuffer_s>(),
628 24usize,
629 concat!("Size of: ", stringify!(ZSTD_outBuffer_s))
630 );
631 assert_eq!(
632 ::core::mem::align_of::<ZSTD_outBuffer_s>(),
633 8usize,
634 concat!("Alignment of ", stringify!(ZSTD_outBuffer_s))
635 );
636 assert_eq!(
637 unsafe {
638 &(*(::core::ptr::null::<ZSTD_outBuffer_s>())).dst as *const _
639 as usize
640 },
641 0usize,
642 concat!(
643 "Offset of field: ",
644 stringify!(ZSTD_outBuffer_s),
645 "::",
646 stringify!(dst)
647 )
648 );
649 assert_eq!(
650 unsafe {
651 &(*(::core::ptr::null::<ZSTD_outBuffer_s>())).size as *const _
652 as usize
653 },
654 8usize,
655 concat!(
656 "Offset of field: ",
657 stringify!(ZSTD_outBuffer_s),
658 "::",
659 stringify!(size)
660 )
661 );
662 assert_eq!(
663 unsafe {
664 &(*(::core::ptr::null::<ZSTD_outBuffer_s>())).pos as *const _
665 as usize
666 },
667 16usize,
668 concat!(
669 "Offset of field: ",
670 stringify!(ZSTD_outBuffer_s),
671 "::",
672 stringify!(pos)
673 )
674 );
675 }
676 pub type ZSTD_outBuffer = ZSTD_outBuffer_s;
677 pub type ZSTD_CStream = ZSTD_CCtx;
678 extern "C" {
ZSTD_createCStream() -> *mut ZSTD_CStream679 pub fn ZSTD_createCStream() -> *mut ZSTD_CStream;
680 }
681 extern "C" {
ZSTD_freeCStream(zcs: *mut ZSTD_CStream) -> usize682 pub fn ZSTD_freeCStream(zcs: *mut ZSTD_CStream) -> usize;
683 }
684 #[repr(u32)]
685 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
686 pub enum ZSTD_EndDirective {
687 ZSTD_e_continue = 0,
688 ZSTD_e_flush = 1,
689 ZSTD_e_end = 2,
690 }
691 extern "C" {
692 #[doc = " ZSTD_compressStream2() :"]
693 #[doc = " Behaves about the same as ZSTD_compressStream, with additional control on end directive."]
694 #[doc = " - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()"]
695 #[doc = " - Compression parameters cannot be changed once compression is started (save a list of exceptions in multi-threading mode)"]
696 #[doc = " - output->pos must be <= dstCapacity, input->pos must be <= srcSize"]
697 #[doc = " - output->pos and input->pos will be updated. They are guaranteed to remain below their respective limit."]
698 #[doc = " - endOp must be a valid directive"]
699 #[doc = " - When nbWorkers==0 (default), function is blocking : it completes its job before returning to caller."]
700 #[doc = " - When nbWorkers>=1, function is non-blocking : it copies a portion of input, distributes jobs to internal worker threads, flush to output whatever is available,"]
701 #[doc = " and then immediately returns, just indicating that there is some data remaining to be flushed."]
702 #[doc = " The function nonetheless guarantees forward progress : it will return only after it reads or write at least 1+ byte."]
703 #[doc = " - Exception : if the first call requests a ZSTD_e_end directive and provides enough dstCapacity, the function delegates to ZSTD_compress2() which is always blocking."]
704 #[doc = " - @return provides a minimum amount of data remaining to be flushed from internal buffers"]
705 #[doc = " or an error code, which can be tested using ZSTD_isError()."]
706 #[doc = " if @return != 0, flush is not fully completed, there is still some data left within internal buffers."]
707 #[doc = " This is useful for ZSTD_e_flush, since in this case more flushes are necessary to empty all buffers."]
708 #[doc = " For ZSTD_e_end, @return == 0 when internal buffers are fully flushed and frame is completed."]
709 #[doc = " - after a ZSTD_e_end directive, if internal buffer is not fully flushed (@return != 0),"]
710 #[doc = " only ZSTD_e_end or ZSTD_e_flush operations are allowed."]
711 #[doc = " Before starting a new compression job, or changing compression parameters,"]
712 #[doc = " it is required to fully flush internal buffers."]
ZSTD_compressStream2( cctx: *mut ZSTD_CCtx, output: *mut ZSTD_outBuffer, input: *mut ZSTD_inBuffer, endOp: ZSTD_EndDirective, ) -> usize713 pub fn ZSTD_compressStream2(
714 cctx: *mut ZSTD_CCtx,
715 output: *mut ZSTD_outBuffer,
716 input: *mut ZSTD_inBuffer,
717 endOp: ZSTD_EndDirective,
718 ) -> usize;
719 }
720 extern "C" {
ZSTD_CStreamInSize() -> usize721 pub fn ZSTD_CStreamInSize() -> usize;
722 }
723 extern "C" {
ZSTD_CStreamOutSize() -> usize724 pub fn ZSTD_CStreamOutSize() -> usize;
725 }
726 extern "C" {
727 #[doc = " Equivalent to:"]
728 #[doc = ""]
729 #[doc = " ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);"]
730 #[doc = " ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any)"]
731 #[doc = " ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);"]
ZSTD_initCStream( zcs: *mut ZSTD_CStream, compressionLevel: libc::c_int, ) -> usize732 pub fn ZSTD_initCStream(
733 zcs: *mut ZSTD_CStream,
734 compressionLevel: libc::c_int,
735 ) -> usize;
736 }
737 extern "C" {
738 #[doc = " Alternative for ZSTD_compressStream2(zcs, output, input, ZSTD_e_continue)."]
739 #[doc = " NOTE: The return value is different. ZSTD_compressStream() returns a hint for"]
740 #[doc = " the next read size (if non-zero and not an error). ZSTD_compressStream2()"]
741 #[doc = " returns the minimum nb of bytes left to flush (if non-zero and not an error)."]
ZSTD_compressStream( zcs: *mut ZSTD_CStream, output: *mut ZSTD_outBuffer, input: *mut ZSTD_inBuffer, ) -> usize742 pub fn ZSTD_compressStream(
743 zcs: *mut ZSTD_CStream,
744 output: *mut ZSTD_outBuffer,
745 input: *mut ZSTD_inBuffer,
746 ) -> usize;
747 }
748 extern "C" {
749 #[doc = " Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_flush)."]
ZSTD_flushStream( zcs: *mut ZSTD_CStream, output: *mut ZSTD_outBuffer, ) -> usize750 pub fn ZSTD_flushStream(
751 zcs: *mut ZSTD_CStream,
752 output: *mut ZSTD_outBuffer,
753 ) -> usize;
754 }
755 extern "C" {
756 #[doc = " Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_end)."]
ZSTD_endStream( zcs: *mut ZSTD_CStream, output: *mut ZSTD_outBuffer, ) -> usize757 pub fn ZSTD_endStream(
758 zcs: *mut ZSTD_CStream,
759 output: *mut ZSTD_outBuffer,
760 ) -> usize;
761 }
762 pub type ZSTD_DStream = ZSTD_DCtx;
763 extern "C" {
ZSTD_createDStream() -> *mut ZSTD_DStream764 pub fn ZSTD_createDStream() -> *mut ZSTD_DStream;
765 }
766 extern "C" {
ZSTD_freeDStream(zds: *mut ZSTD_DStream) -> usize767 pub fn ZSTD_freeDStream(zds: *mut ZSTD_DStream) -> usize;
768 }
769 extern "C" {
ZSTD_initDStream(zds: *mut ZSTD_DStream) -> usize770 pub fn ZSTD_initDStream(zds: *mut ZSTD_DStream) -> usize;
771 }
772 extern "C" {
ZSTD_decompressStream( zds: *mut ZSTD_DStream, output: *mut ZSTD_outBuffer, input: *mut ZSTD_inBuffer, ) -> usize773 pub fn ZSTD_decompressStream(
774 zds: *mut ZSTD_DStream,
775 output: *mut ZSTD_outBuffer,
776 input: *mut ZSTD_inBuffer,
777 ) -> usize;
778 }
779 extern "C" {
ZSTD_DStreamInSize() -> usize780 pub fn ZSTD_DStreamInSize() -> usize;
781 }
782 extern "C" {
ZSTD_DStreamOutSize() -> usize783 pub fn ZSTD_DStreamOutSize() -> usize;
784 }
785 extern "C" {
786 #[doc = " Simple dictionary API"]
787 #[doc = " Compression at an explicit compression level using a Dictionary."]
788 #[doc = " A dictionary can be any arbitrary data segment (also called a prefix),"]
789 #[doc = " or a buffer with specified information (see dictBuilder/zdict.h)."]
790 #[doc = " Note : This function loads the dictionary, resulting in significant startup delay."]
791 #[doc = " It's intended for a dictionary used only once."]
792 #[doc = " Note 2 : When `dict == NULL || dictSize < 8` no dictionary is used."]
ZSTD_compress_usingDict( ctx: *mut ZSTD_CCtx, dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, dict: *const libc::c_void, dictSize: usize, compressionLevel: libc::c_int, ) -> usize793 pub fn ZSTD_compress_usingDict(
794 ctx: *mut ZSTD_CCtx,
795 dst: *mut libc::c_void,
796 dstCapacity: usize,
797 src: *const libc::c_void,
798 srcSize: usize,
799 dict: *const libc::c_void,
800 dictSize: usize,
801 compressionLevel: libc::c_int,
802 ) -> usize;
803 }
804 extern "C" {
805 #[doc = " ZSTD_decompress_usingDict() :"]
806 #[doc = " Decompression using a known Dictionary."]
807 #[doc = " Dictionary must be identical to the one used during compression."]
808 #[doc = " Note : This function loads the dictionary, resulting in significant startup delay."]
809 #[doc = " It's intended for a dictionary used only once."]
810 #[doc = " Note : When `dict == NULL || dictSize < 8` no dictionary is used."]
ZSTD_decompress_usingDict( dctx: *mut ZSTD_DCtx, dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, dict: *const libc::c_void, dictSize: usize, ) -> usize811 pub fn ZSTD_decompress_usingDict(
812 dctx: *mut ZSTD_DCtx,
813 dst: *mut libc::c_void,
814 dstCapacity: usize,
815 src: *const libc::c_void,
816 srcSize: usize,
817 dict: *const libc::c_void,
818 dictSize: usize,
819 ) -> usize;
820 }
821 #[repr(C)]
822 #[derive(Debug, Copy, Clone)]
823 pub struct ZSTD_CDict_s {
824 _unused: [u8; 0],
825 }
826 #[doc = " Bulk processing dictionary API"]
827 pub type ZSTD_CDict = ZSTD_CDict_s;
828 extern "C" {
829 #[doc = " ZSTD_createCDict() :"]
830 #[doc = " When compressing multiple messages or blocks using the same dictionary,"]
831 #[doc = " it's recommended to digest the dictionary only once, since it's a costly operation."]
832 #[doc = " ZSTD_createCDict() will create a state from digesting a dictionary."]
833 #[doc = " The resulting state can be used for future compression operations with very limited startup cost."]
834 #[doc = " ZSTD_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only."]
835 #[doc = " @dictBuffer can be released after ZSTD_CDict creation, because its content is copied within CDict."]
836 #[doc = " Note 1 : Consider experimental function `ZSTD_createCDict_byReference()` if you prefer to not duplicate @dictBuffer content."]
837 #[doc = " Note 2 : A ZSTD_CDict can be created from an empty @dictBuffer,"]
838 #[doc = " in which case the only thing that it transports is the @compressionLevel."]
839 #[doc = " This can be useful in a pipeline featuring ZSTD_compress_usingCDict() exclusively,"]
840 #[doc = " expecting a ZSTD_CDict parameter with any data, including those without a known dictionary."]
ZSTD_createCDict( dictBuffer: *const libc::c_void, dictSize: usize, compressionLevel: libc::c_int, ) -> *mut ZSTD_CDict841 pub fn ZSTD_createCDict(
842 dictBuffer: *const libc::c_void,
843 dictSize: usize,
844 compressionLevel: libc::c_int,
845 ) -> *mut ZSTD_CDict;
846 }
847 extern "C" {
848 #[doc = " ZSTD_freeCDict() :"]
849 #[doc = " Function frees memory allocated by ZSTD_createCDict()."]
ZSTD_freeCDict(CDict: *mut ZSTD_CDict) -> usize850 pub fn ZSTD_freeCDict(CDict: *mut ZSTD_CDict) -> usize;
851 }
852 extern "C" {
853 #[doc = " ZSTD_compress_usingCDict() :"]
854 #[doc = " Compression using a digested Dictionary."]
855 #[doc = " Recommended when same dictionary is used multiple times."]
856 #[doc = " Note : compression level is _decided at dictionary creation time_,"]
857 #[doc = " and frame parameters are hardcoded (dictID=yes, contentSize=yes, checksum=no)"]
ZSTD_compress_usingCDict( cctx: *mut ZSTD_CCtx, dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, cdict: *const ZSTD_CDict, ) -> usize858 pub fn ZSTD_compress_usingCDict(
859 cctx: *mut ZSTD_CCtx,
860 dst: *mut libc::c_void,
861 dstCapacity: usize,
862 src: *const libc::c_void,
863 srcSize: usize,
864 cdict: *const ZSTD_CDict,
865 ) -> usize;
866 }
867 #[repr(C)]
868 #[derive(Debug, Copy, Clone)]
869 pub struct ZSTD_DDict_s {
870 _unused: [u8; 0],
871 }
872 pub type ZSTD_DDict = ZSTD_DDict_s;
873 extern "C" {
874 #[doc = " ZSTD_createDDict() :"]
875 #[doc = " Create a digested dictionary, ready to start decompression operation without startup delay."]
876 #[doc = " dictBuffer can be released after DDict creation, as its content is copied inside DDict."]
ZSTD_createDDict( dictBuffer: *const libc::c_void, dictSize: usize, ) -> *mut ZSTD_DDict877 pub fn ZSTD_createDDict(
878 dictBuffer: *const libc::c_void,
879 dictSize: usize,
880 ) -> *mut ZSTD_DDict;
881 }
882 extern "C" {
883 #[doc = " ZSTD_freeDDict() :"]
884 #[doc = " Function frees memory allocated with ZSTD_createDDict()"]
ZSTD_freeDDict(ddict: *mut ZSTD_DDict) -> usize885 pub fn ZSTD_freeDDict(ddict: *mut ZSTD_DDict) -> usize;
886 }
887 extern "C" {
888 #[doc = " ZSTD_decompress_usingDDict() :"]
889 #[doc = " Decompression using a digested Dictionary."]
890 #[doc = " Recommended when same dictionary is used multiple times."]
ZSTD_decompress_usingDDict( dctx: *mut ZSTD_DCtx, dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, ddict: *const ZSTD_DDict, ) -> usize891 pub fn ZSTD_decompress_usingDDict(
892 dctx: *mut ZSTD_DCtx,
893 dst: *mut libc::c_void,
894 dstCapacity: usize,
895 src: *const libc::c_void,
896 srcSize: usize,
897 ddict: *const ZSTD_DDict,
898 ) -> usize;
899 }
900 extern "C" {
901 #[doc = " ZSTD_getDictID_fromDict() :"]
902 #[doc = " Provides the dictID stored within dictionary."]
903 #[doc = " if @return == 0, the dictionary is not conformant with Zstandard specification."]
904 #[doc = " It can still be loaded, but as a content-only dictionary."]
ZSTD_getDictID_fromDict( dict: *const libc::c_void, dictSize: usize, ) -> libc::c_uint905 pub fn ZSTD_getDictID_fromDict(
906 dict: *const libc::c_void,
907 dictSize: usize,
908 ) -> libc::c_uint;
909 }
910 extern "C" {
911 #[doc = " ZSTD_getDictID_fromDDict() :"]
912 #[doc = " Provides the dictID of the dictionary loaded into `ddict`."]
913 #[doc = " If @return == 0, the dictionary is not conformant to Zstandard specification, or empty."]
914 #[doc = " Non-conformant dictionaries can still be loaded, but as content-only dictionaries."]
ZSTD_getDictID_fromDDict(ddict: *const ZSTD_DDict) -> libc::c_uint915 pub fn ZSTD_getDictID_fromDDict(ddict: *const ZSTD_DDict) -> libc::c_uint;
916 }
917 extern "C" {
918 #[doc = " ZSTD_getDictID_fromFrame() :"]
919 #[doc = " Provides the dictID required to decompressed the frame stored within `src`."]
920 #[doc = " If @return == 0, the dictID could not be decoded."]
921 #[doc = " This could for one of the following reasons :"]
922 #[doc = " - The frame does not require a dictionary to be decoded (most common case)."]
923 #[doc = " - The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a hidden information."]
924 #[doc = " Note : this use case also happens when using a non-conformant dictionary."]
925 #[doc = " - `srcSize` is too small, and as a result, the frame header could not be decoded (only possible if `srcSize < ZSTD_FRAMEHEADERSIZE_MAX`)."]
926 #[doc = " - This is not a Zstandard frame."]
927 #[doc = " When identifying the exact failure cause, it's possible to use ZSTD_getFrameHeader(), which will provide a more precise error code."]
ZSTD_getDictID_fromFrame( src: *const libc::c_void, srcSize: usize, ) -> libc::c_uint928 pub fn ZSTD_getDictID_fromFrame(
929 src: *const libc::c_void,
930 srcSize: usize,
931 ) -> libc::c_uint;
932 }
933 extern "C" {
934 #[doc = " ZSTD_CCtx_loadDictionary() :"]
935 #[doc = " Create an internal CDict from `dict` buffer."]
936 #[doc = " Decompression will have to use same dictionary."]
937 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
938 #[doc = " Special: Loading a NULL (or 0-size) dictionary invalidates previous dictionary,"]
939 #[doc = " meaning \"return to no-dictionary mode\"."]
940 #[doc = " Note 1 : Dictionary is sticky, it will be used for all future compressed frames."]
941 #[doc = " To return to \"no-dictionary\" situation, load a NULL dictionary (or reset parameters)."]
942 #[doc = " Note 2 : Loading a dictionary involves building tables."]
943 #[doc = " It's also a CPU consuming operation, with non-negligible impact on latency."]
944 #[doc = " Tables are dependent on compression parameters, and for this reason,"]
945 #[doc = " compression parameters can no longer be changed after loading a dictionary."]
946 #[doc = " Note 3 :`dict` content will be copied internally."]
947 #[doc = " Use experimental ZSTD_CCtx_loadDictionary_byReference() to reference content instead."]
948 #[doc = " In such a case, dictionary buffer must outlive its users."]
949 #[doc = " Note 4 : Use ZSTD_CCtx_loadDictionary_advanced()"]
950 #[doc = " to precisely select how dictionary content must be interpreted."]
ZSTD_CCtx_loadDictionary( cctx: *mut ZSTD_CCtx, dict: *const libc::c_void, dictSize: usize, ) -> usize951 pub fn ZSTD_CCtx_loadDictionary(
952 cctx: *mut ZSTD_CCtx,
953 dict: *const libc::c_void,
954 dictSize: usize,
955 ) -> usize;
956 }
957 extern "C" {
958 #[doc = " ZSTD_CCtx_refCDict() :"]
959 #[doc = " Reference a prepared dictionary, to be used for all next compressed frames."]
960 #[doc = " Note that compression parameters are enforced from within CDict,"]
961 #[doc = " and supersede any compression parameter previously set within CCtx."]
962 #[doc = " The parameters ignored are labelled as \"superseded-by-cdict\" in the ZSTD_cParameter enum docs."]
963 #[doc = " The ignored parameters will be used again if the CCtx is returned to no-dictionary mode."]
964 #[doc = " The dictionary will remain valid for future compressed frames using same CCtx."]
965 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
966 #[doc = " Special : Referencing a NULL CDict means \"return to no-dictionary mode\"."]
967 #[doc = " Note 1 : Currently, only one dictionary can be managed."]
968 #[doc = " Referencing a new dictionary effectively \"discards\" any previous one."]
969 #[doc = " Note 2 : CDict is just referenced, its lifetime must outlive its usage within CCtx."]
ZSTD_CCtx_refCDict( cctx: *mut ZSTD_CCtx, cdict: *const ZSTD_CDict, ) -> usize970 pub fn ZSTD_CCtx_refCDict(
971 cctx: *mut ZSTD_CCtx,
972 cdict: *const ZSTD_CDict,
973 ) -> usize;
974 }
975 extern "C" {
976 #[doc = " ZSTD_CCtx_refPrefix() :"]
977 #[doc = " Reference a prefix (single-usage dictionary) for next compressed frame."]
978 #[doc = " A prefix is **only used once**. Tables are discarded at end of frame (ZSTD_e_end)."]
979 #[doc = " Decompression will need same prefix to properly regenerate data."]
980 #[doc = " Compressing with a prefix is similar in outcome as performing a diff and compressing it,"]
981 #[doc = " but performs much faster, especially during decompression (compression speed is tunable with compression level)."]
982 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
983 #[doc = " Special: Adding any prefix (including NULL) invalidates any previous prefix or dictionary"]
984 #[doc = " Note 1 : Prefix buffer is referenced. It **must** outlive compression."]
985 #[doc = " Its content must remain unmodified during compression."]
986 #[doc = " Note 2 : If the intention is to diff some large src data blob with some prior version of itself,"]
987 #[doc = " ensure that the window size is large enough to contain the entire source."]
988 #[doc = " See ZSTD_c_windowLog."]
989 #[doc = " Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters."]
990 #[doc = " It's a CPU consuming operation, with non-negligible impact on latency."]
991 #[doc = " If there is a need to use the same prefix multiple times, consider loadDictionary instead."]
992 #[doc = " Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dct_rawContent)."]
993 #[doc = " Use experimental ZSTD_CCtx_refPrefix_advanced() to alter dictionary interpretation."]
ZSTD_CCtx_refPrefix( cctx: *mut ZSTD_CCtx, prefix: *const libc::c_void, prefixSize: usize, ) -> usize994 pub fn ZSTD_CCtx_refPrefix(
995 cctx: *mut ZSTD_CCtx,
996 prefix: *const libc::c_void,
997 prefixSize: usize,
998 ) -> usize;
999 }
1000 extern "C" {
1001 #[doc = " ZSTD_DCtx_loadDictionary() :"]
1002 #[doc = " Create an internal DDict from dict buffer,"]
1003 #[doc = " to be used to decompress next frames."]
1004 #[doc = " The dictionary remains valid for all future frames, until explicitly invalidated."]
1005 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
1006 #[doc = " Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary,"]
1007 #[doc = " meaning \"return to no-dictionary mode\"."]
1008 #[doc = " Note 1 : Loading a dictionary involves building tables,"]
1009 #[doc = " which has a non-negligible impact on CPU usage and latency."]
1010 #[doc = " It's recommended to \"load once, use many times\", to amortize the cost"]
1011 #[doc = " Note 2 :`dict` content will be copied internally, so `dict` can be released after loading."]
1012 #[doc = " Use ZSTD_DCtx_loadDictionary_byReference() to reference dictionary content instead."]
1013 #[doc = " Note 3 : Use ZSTD_DCtx_loadDictionary_advanced() to take control of"]
1014 #[doc = " how dictionary content is loaded and interpreted."]
ZSTD_DCtx_loadDictionary( dctx: *mut ZSTD_DCtx, dict: *const libc::c_void, dictSize: usize, ) -> usize1015 pub fn ZSTD_DCtx_loadDictionary(
1016 dctx: *mut ZSTD_DCtx,
1017 dict: *const libc::c_void,
1018 dictSize: usize,
1019 ) -> usize;
1020 }
1021 extern "C" {
1022 #[doc = " ZSTD_DCtx_refDDict() :"]
1023 #[doc = " Reference a prepared dictionary, to be used to decompress next frames."]
1024 #[doc = " The dictionary remains active for decompression of future frames using same DCtx."]
1025 #[doc = ""]
1026 #[doc = " If called with ZSTD_d_refMultipleDDicts enabled, repeated calls of this function"]
1027 #[doc = " will store the DDict references in a table, and the DDict used for decompression"]
1028 #[doc = " will be determined at decompression time, as per the dict ID in the frame."]
1029 #[doc = " The memory for the table is allocated on the first call to refDDict, and can be"]
1030 #[doc = " freed with ZSTD_freeDCtx()."]
1031 #[doc = ""]
1032 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
1033 #[doc = " Note 1 : Currently, only one dictionary can be managed."]
1034 #[doc = " Referencing a new dictionary effectively \"discards\" any previous one."]
1035 #[doc = " Special: referencing a NULL DDict means \"return to no-dictionary mode\"."]
1036 #[doc = " Note 2 : DDict is just referenced, its lifetime must outlive its usage from DCtx."]
ZSTD_DCtx_refDDict( dctx: *mut ZSTD_DCtx, ddict: *const ZSTD_DDict, ) -> usize1037 pub fn ZSTD_DCtx_refDDict(
1038 dctx: *mut ZSTD_DCtx,
1039 ddict: *const ZSTD_DDict,
1040 ) -> usize;
1041 }
1042 extern "C" {
1043 #[doc = " ZSTD_DCtx_refPrefix() :"]
1044 #[doc = " Reference a prefix (single-usage dictionary) to decompress next frame."]
1045 #[doc = " This is the reverse operation of ZSTD_CCtx_refPrefix(),"]
1046 #[doc = " and must use the same prefix as the one used during compression."]
1047 #[doc = " Prefix is **only used once**. Reference is discarded at end of frame."]
1048 #[doc = " End of frame is reached when ZSTD_decompressStream() returns 0."]
1049 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
1050 #[doc = " Note 1 : Adding any prefix (including NULL) invalidates any previously set prefix or dictionary"]
1051 #[doc = " Note 2 : Prefix buffer is referenced. It **must** outlive decompression."]
1052 #[doc = " Prefix buffer must remain unmodified up to the end of frame,"]
1053 #[doc = " reached when ZSTD_decompressStream() returns 0."]
1054 #[doc = " Note 3 : By default, the prefix is treated as raw content (ZSTD_dct_rawContent)."]
1055 #[doc = " Use ZSTD_CCtx_refPrefix_advanced() to alter dictMode (Experimental section)"]
1056 #[doc = " Note 4 : Referencing a raw content prefix has almost no cpu nor memory cost."]
1057 #[doc = " A full dictionary is more costly, as it requires building tables."]
ZSTD_DCtx_refPrefix( dctx: *mut ZSTD_DCtx, prefix: *const libc::c_void, prefixSize: usize, ) -> usize1058 pub fn ZSTD_DCtx_refPrefix(
1059 dctx: *mut ZSTD_DCtx,
1060 prefix: *const libc::c_void,
1061 prefixSize: usize,
1062 ) -> usize;
1063 }
1064 extern "C" {
1065 #[doc = " ZSTD_sizeof_*() :"]
1066 #[doc = " These functions give the _current_ memory usage of selected object."]
1067 #[doc = " Note that object memory usage can evolve (increase or decrease) over time."]
ZSTD_sizeof_CCtx(cctx: *const ZSTD_CCtx) -> usize1068 pub fn ZSTD_sizeof_CCtx(cctx: *const ZSTD_CCtx) -> usize;
1069 }
1070 extern "C" {
ZSTD_sizeof_DCtx(dctx: *const ZSTD_DCtx) -> usize1071 pub fn ZSTD_sizeof_DCtx(dctx: *const ZSTD_DCtx) -> usize;
1072 }
1073 extern "C" {
ZSTD_sizeof_CStream(zcs: *const ZSTD_CStream) -> usize1074 pub fn ZSTD_sizeof_CStream(zcs: *const ZSTD_CStream) -> usize;
1075 }
1076 extern "C" {
ZSTD_sizeof_DStream(zds: *const ZSTD_DStream) -> usize1077 pub fn ZSTD_sizeof_DStream(zds: *const ZSTD_DStream) -> usize;
1078 }
1079 extern "C" {
ZSTD_sizeof_CDict(cdict: *const ZSTD_CDict) -> usize1080 pub fn ZSTD_sizeof_CDict(cdict: *const ZSTD_CDict) -> usize;
1081 }
1082 extern "C" {
ZSTD_sizeof_DDict(ddict: *const ZSTD_DDict) -> usize1083 pub fn ZSTD_sizeof_DDict(ddict: *const ZSTD_DDict) -> usize;
1084 }
1085 extern "C" {
1086 #[doc = " ZDICT_trainFromBuffer():"]
1087 #[doc = " Train a dictionary from an array of samples."]
1088 #[doc = " Redirect towards ZDICT_optimizeTrainFromBuffer_fastCover() single-threaded, with d=8, steps=4,"]
1089 #[doc = " f=20, and accel=1."]
1090 #[doc = " Samples must be stored concatenated in a single flat buffer `samplesBuffer`,"]
1091 #[doc = " supplied with an array of sizes `samplesSizes`, providing the size of each sample, in order."]
1092 #[doc = " The resulting dictionary will be saved into `dictBuffer`."]
1093 #[doc = " @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`)"]
1094 #[doc = " or an error code, which can be tested with ZDICT_isError()."]
1095 #[doc = " Note: Dictionary training will fail if there are not enough samples to construct a"]
1096 #[doc = " dictionary, or if most of the samples are too small (< 8 bytes being the lower limit)."]
1097 #[doc = " If dictionary training fails, you should use zstd without a dictionary, as the dictionary"]
1098 #[doc = " would've been ineffective anyways. If you believe your samples would benefit from a dictionary"]
1099 #[doc = " please open an issue with details, and we can look into it."]
1100 #[doc = " Note: ZDICT_trainFromBuffer()'s memory usage is about 6 MB."]
1101 #[doc = " Tips: In general, a reasonable dictionary has a size of ~ 100 KB."]
1102 #[doc = " It's possible to select smaller or larger size, just by specifying `dictBufferCapacity`."]
1103 #[doc = " In general, it's recommended to provide a few thousands samples, though this can vary a lot."]
1104 #[doc = " It's recommended that total size of all samples be about ~x100 times the target size of dictionary."]
ZDICT_trainFromBuffer( dictBuffer: *mut libc::c_void, dictBufferCapacity: usize, samplesBuffer: *const libc::c_void, samplesSizes: *const usize, nbSamples: libc::c_uint, ) -> usize1105 pub fn ZDICT_trainFromBuffer(
1106 dictBuffer: *mut libc::c_void,
1107 dictBufferCapacity: usize,
1108 samplesBuffer: *const libc::c_void,
1109 samplesSizes: *const usize,
1110 nbSamples: libc::c_uint,
1111 ) -> usize;
1112 }
1113 #[repr(C)]
1114 #[derive(Debug, Copy, Clone)]
1115 pub struct ZDICT_params_t {
1116 pub compressionLevel: libc::c_int,
1117 pub notificationLevel: libc::c_uint,
1118 pub dictID: libc::c_uint,
1119 }
1120 #[test]
bindgen_test_layout_ZDICT_params_t()1121 fn bindgen_test_layout_ZDICT_params_t() {
1122 assert_eq!(
1123 ::core::mem::size_of::<ZDICT_params_t>(),
1124 12usize,
1125 concat!("Size of: ", stringify!(ZDICT_params_t))
1126 );
1127 assert_eq!(
1128 ::core::mem::align_of::<ZDICT_params_t>(),
1129 4usize,
1130 concat!("Alignment of ", stringify!(ZDICT_params_t))
1131 );
1132 assert_eq!(
1133 unsafe {
1134 &(*(::core::ptr::null::<ZDICT_params_t>())).compressionLevel
1135 as *const _ as usize
1136 },
1137 0usize,
1138 concat!(
1139 "Offset of field: ",
1140 stringify!(ZDICT_params_t),
1141 "::",
1142 stringify!(compressionLevel)
1143 )
1144 );
1145 assert_eq!(
1146 unsafe {
1147 &(*(::core::ptr::null::<ZDICT_params_t>())).notificationLevel
1148 as *const _ as usize
1149 },
1150 4usize,
1151 concat!(
1152 "Offset of field: ",
1153 stringify!(ZDICT_params_t),
1154 "::",
1155 stringify!(notificationLevel)
1156 )
1157 );
1158 assert_eq!(
1159 unsafe {
1160 &(*(::core::ptr::null::<ZDICT_params_t>())).dictID as *const _
1161 as usize
1162 },
1163 8usize,
1164 concat!(
1165 "Offset of field: ",
1166 stringify!(ZDICT_params_t),
1167 "::",
1168 stringify!(dictID)
1169 )
1170 );
1171 }
1172 extern "C" {
1173 #[doc = " ZDICT_finalizeDictionary():"]
1174 #[doc = " Given a custom content as a basis for dictionary, and a set of samples,"]
1175 #[doc = " finalize dictionary by adding headers and statistics according to the zstd"]
1176 #[doc = " dictionary format."]
1177 #[doc = ""]
1178 #[doc = " Samples must be stored concatenated in a flat buffer `samplesBuffer`,"]
1179 #[doc = " supplied with an array of sizes `samplesSizes`, providing the size of each"]
1180 #[doc = " sample in order. The samples are used to construct the statistics, so they"]
1181 #[doc = " should be representative of what you will compress with this dictionary."]
1182 #[doc = ""]
1183 #[doc = " The compression level can be set in `parameters`. You should pass the"]
1184 #[doc = " compression level you expect to use in production. The statistics for each"]
1185 #[doc = " compression level differ, so tuning the dictionary for the compression level"]
1186 #[doc = " can help quite a bit."]
1187 #[doc = ""]
1188 #[doc = " You can set an explicit dictionary ID in `parameters`, or allow us to pick"]
1189 #[doc = " a random dictionary ID for you, but we can't guarantee no collisions."]
1190 #[doc = ""]
1191 #[doc = " The dstDictBuffer and the dictContent may overlap, and the content will be"]
1192 #[doc = " appended to the end of the header. If the header + the content doesn't fit in"]
1193 #[doc = " maxDictSize the beginning of the content is truncated to make room, since it"]
1194 #[doc = " is presumed that the most profitable content is at the end of the dictionary,"]
1195 #[doc = " since that is the cheapest to reference."]
1196 #[doc = ""]
1197 #[doc = " `dictContentSize` must be >= ZDICT_CONTENTSIZE_MIN bytes."]
1198 #[doc = " `maxDictSize` must be >= max(dictContentSize, ZSTD_DICTSIZE_MIN)."]
1199 #[doc = ""]
1200 #[doc = " @return: size of dictionary stored into `dstDictBuffer` (<= `maxDictSize`),"]
1201 #[doc = " or an error code, which can be tested by ZDICT_isError()."]
1202 #[doc = " Note: ZDICT_finalizeDictionary() will push notifications into stderr if"]
1203 #[doc = " instructed to, using notificationLevel>0."]
1204 #[doc = " NOTE: This function currently may fail in several edge cases including:"]
1205 #[doc = " * Not enough samples"]
1206 #[doc = " * Samples are uncompressible"]
1207 #[doc = " * Samples are all exactly the same"]
ZDICT_finalizeDictionary( dstDictBuffer: *mut libc::c_void, maxDictSize: usize, dictContent: *const libc::c_void, dictContentSize: usize, samplesBuffer: *const libc::c_void, samplesSizes: *const usize, nbSamples: libc::c_uint, parameters: ZDICT_params_t, ) -> usize1208 pub fn ZDICT_finalizeDictionary(
1209 dstDictBuffer: *mut libc::c_void,
1210 maxDictSize: usize,
1211 dictContent: *const libc::c_void,
1212 dictContentSize: usize,
1213 samplesBuffer: *const libc::c_void,
1214 samplesSizes: *const usize,
1215 nbSamples: libc::c_uint,
1216 parameters: ZDICT_params_t,
1217 ) -> usize;
1218 }
1219 extern "C" {
ZDICT_getDictID( dictBuffer: *const libc::c_void, dictSize: usize, ) -> libc::c_uint1220 pub fn ZDICT_getDictID(
1221 dictBuffer: *const libc::c_void,
1222 dictSize: usize,
1223 ) -> libc::c_uint;
1224 }
1225 extern "C" {
ZDICT_getDictHeaderSize( dictBuffer: *const libc::c_void, dictSize: usize, ) -> usize1226 pub fn ZDICT_getDictHeaderSize(
1227 dictBuffer: *const libc::c_void,
1228 dictSize: usize,
1229 ) -> usize;
1230 }
1231 extern "C" {
ZDICT_isError(errorCode: usize) -> libc::c_uint1232 pub fn ZDICT_isError(errorCode: usize) -> libc::c_uint;
1233 }
1234 extern "C" {
ZDICT_getErrorName(errorCode: usize) -> *const libc::c_char1235 pub fn ZDICT_getErrorName(errorCode: usize) -> *const libc::c_char;
1236 }
1237