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.56.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 = 32;
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 = 7;
160 pub const ZSTD_VERSION_NUMBER: u32 = 10407;
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 const ZSTD_FRAMEHEADERSIZE_MAX: u32 = 18;
171 pub const ZSTD_SKIPPABLEHEADERSIZE: u32 = 8;
172 pub const ZSTD_WINDOWLOG_MAX_32: u32 = 30;
173 pub const ZSTD_WINDOWLOG_MAX_64: u32 = 31;
174 pub const ZSTD_WINDOWLOG_MIN: u32 = 10;
175 pub const ZSTD_HASHLOG_MIN: u32 = 6;
176 pub const ZSTD_CHAINLOG_MAX_32: u32 = 29;
177 pub const ZSTD_CHAINLOG_MAX_64: u32 = 30;
178 pub const ZSTD_CHAINLOG_MIN: u32 = 6;
179 pub const ZSTD_SEARCHLOG_MIN: u32 = 1;
180 pub const ZSTD_MINMATCH_MAX: u32 = 7;
181 pub const ZSTD_MINMATCH_MIN: u32 = 3;
182 pub const ZSTD_TARGETLENGTH_MAX: u32 = 131072;
183 pub const ZSTD_TARGETLENGTH_MIN: u32 = 0;
184 pub const ZSTD_OVERLAPLOG_MIN: u32 = 0;
185 pub const ZSTD_OVERLAPLOG_MAX: u32 = 9;
186 pub const ZSTD_WINDOWLOG_LIMIT_DEFAULT: u32 = 27;
187 pub const ZSTD_LDM_HASHLOG_MIN: u32 = 6;
188 pub const ZSTD_LDM_MINMATCH_MIN: u32 = 4;
189 pub const ZSTD_LDM_MINMATCH_MAX: u32 = 4096;
190 pub const ZSTD_LDM_BUCKETSIZELOG_MIN: u32 = 1;
191 pub const ZSTD_LDM_BUCKETSIZELOG_MAX: u32 = 8;
192 pub const ZSTD_LDM_HASHRATELOG_MIN: u32 = 0;
193 pub const ZSTD_TARGETCBLOCKSIZE_MIN: u32 = 64;
194 pub const ZSTD_TARGETCBLOCKSIZE_MAX: u32 = 131072;
195 pub const ZSTD_SRCSIZEHINT_MIN: u32 = 0;
196 pub const ZSTD_HASHLOG3_MAX: u32 = 17;
197 pub const ZDICT_CONTENTSIZE_MIN: u32 = 128;
198 pub const ZDICT_DICTSIZE_MIN: u32 = 256;
199 pub const _STRING_H: u32 = 1;
200 pub const _BITS_TYPES_LOCALE_T_H: u32 = 1;
201 pub const _BITS_TYPES___LOCALE_T_H: u32 = 1;
202 pub const _STRINGS_H: u32 = 1;
203 pub const ZSTDMT_NBWORKERS_MAX: u32 = 200;
204 pub type wchar_t = libc::c_int;
205 extern "C" {
206 #[doc = " ZSTD_versionNumber() :"]
207 #[doc = " Return runtime library version, the value is (MAJOR*100*100 + MINOR*100 + RELEASE)."]
ZSTD_versionNumber() -> libc::c_uint208 pub fn ZSTD_versionNumber() -> libc::c_uint;
209 }
210 extern "C" {
211 #[doc = " ZSTD_versionString() :"]
212 #[doc = " Return runtime library version, like \"1.4.5\". Requires v1.3.0+."]
ZSTD_versionString() -> *const libc::c_char213 pub fn ZSTD_versionString() -> *const libc::c_char;
214 }
215 extern "C" {
216 #[doc = " Simple API"]
217 #[doc = " Compresses `src` content as a single zstd compressed frame into already allocated `dst`."]
218 #[doc = " Hint : compression runs faster if `dstCapacity` >= `ZSTD_compressBound(srcSize)`."]
219 #[doc = " @return : compressed size written into `dst` (<= `dstCapacity),"]
220 #[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, ) -> usize221 pub fn ZSTD_compress(
222 dst: *mut libc::c_void,
223 dstCapacity: usize,
224 src: *const libc::c_void,
225 srcSize: usize,
226 compressionLevel: libc::c_int,
227 ) -> usize;
228 }
229 extern "C" {
230 #[doc = " ZSTD_decompress() :"]
231 #[doc = " `compressedSize` : must be the _exact_ size of some number of compressed and/or skippable frames."]
232 #[doc = " `dstCapacity` is an upper bound of originalSize to regenerate."]
233 #[doc = " If user cannot imply a maximum upper bound, it's better to use streaming mode to decompress data."]
234 #[doc = " @return : the number of bytes decompressed into `dst` (<= `dstCapacity`),"]
235 #[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, ) -> usize236 pub fn ZSTD_decompress(
237 dst: *mut libc::c_void,
238 dstCapacity: usize,
239 src: *const libc::c_void,
240 compressedSize: usize,
241 ) -> usize;
242 }
243 extern "C" {
ZSTD_getFrameContentSize( src: *const libc::c_void, srcSize: usize, ) -> libc::c_ulonglong244 pub fn ZSTD_getFrameContentSize(
245 src: *const libc::c_void,
246 srcSize: usize,
247 ) -> libc::c_ulonglong;
248 }
249 extern "C" {
250 #[doc = " ZSTD_getDecompressedSize() :"]
251 #[doc = " NOTE: This function is now obsolete, in favor of ZSTD_getFrameContentSize()."]
252 #[doc = " Both functions work the same way, but ZSTD_getDecompressedSize() blends"]
253 #[doc = " \"empty\", \"unknown\" and \"error\" results to the same return value (0),"]
254 #[doc = " while ZSTD_getFrameContentSize() gives them separate return values."]
255 #[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_ulonglong256 pub fn ZSTD_getDecompressedSize(
257 src: *const libc::c_void,
258 srcSize: usize,
259 ) -> libc::c_ulonglong;
260 }
261 extern "C" {
262 #[doc = " ZSTD_findFrameCompressedSize() :"]
263 #[doc = " `src` should point to the start of a ZSTD frame or skippable frame."]
264 #[doc = " `srcSize` must be >= first frame size"]
265 #[doc = " @return : the compressed size of the first frame starting at `src`,"]
266 #[doc = " suitable to pass as `srcSize` to `ZSTD_decompress` or similar,"]
267 #[doc = " or an error code if input is invalid"]
ZSTD_findFrameCompressedSize( src: *const libc::c_void, srcSize: usize, ) -> usize268 pub fn ZSTD_findFrameCompressedSize(
269 src: *const libc::c_void,
270 srcSize: usize,
271 ) -> usize;
272 }
273 extern "C" {
ZSTD_compressBound(srcSize: usize) -> usize274 pub fn ZSTD_compressBound(srcSize: usize) -> usize;
275 }
276 extern "C" {
ZSTD_isError(code: usize) -> libc::c_uint277 pub fn ZSTD_isError(code: usize) -> libc::c_uint;
278 }
279 extern "C" {
ZSTD_getErrorName(code: usize) -> *const libc::c_char280 pub fn ZSTD_getErrorName(code: usize) -> *const libc::c_char;
281 }
282 extern "C" {
ZSTD_minCLevel() -> libc::c_int283 pub fn ZSTD_minCLevel() -> libc::c_int;
284 }
285 extern "C" {
ZSTD_maxCLevel() -> libc::c_int286 pub fn ZSTD_maxCLevel() -> libc::c_int;
287 }
288 #[repr(C)]
289 #[derive(Debug, Copy, Clone)]
290 pub struct ZSTD_CCtx_s {
291 _unused: [u8; 0],
292 }
293 #[doc = " Explicit context"]
294 pub type ZSTD_CCtx = ZSTD_CCtx_s;
295 extern "C" {
ZSTD_createCCtx() -> *mut ZSTD_CCtx296 pub fn ZSTD_createCCtx() -> *mut ZSTD_CCtx;
297 }
298 extern "C" {
ZSTD_freeCCtx(cctx: *mut ZSTD_CCtx) -> usize299 pub fn ZSTD_freeCCtx(cctx: *mut ZSTD_CCtx) -> usize;
300 }
301 extern "C" {
302 #[doc = " ZSTD_compressCCtx() :"]
303 #[doc = " Same as ZSTD_compress(), using an explicit ZSTD_CCtx."]
304 #[doc = " Important : in order to behave similarly to `ZSTD_compress()`,"]
305 #[doc = " this function compresses at requested compression level,"]
306 #[doc = " __ignoring any other parameter__ ."]
307 #[doc = " If any advanced parameter was set using the advanced API,"]
308 #[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, ) -> usize309 pub fn ZSTD_compressCCtx(
310 cctx: *mut ZSTD_CCtx,
311 dst: *mut libc::c_void,
312 dstCapacity: usize,
313 src: *const libc::c_void,
314 srcSize: usize,
315 compressionLevel: libc::c_int,
316 ) -> usize;
317 }
318 #[repr(C)]
319 #[derive(Debug, Copy, Clone)]
320 pub struct ZSTD_DCtx_s {
321 _unused: [u8; 0],
322 }
323 pub type ZSTD_DCtx = ZSTD_DCtx_s;
324 extern "C" {
ZSTD_createDCtx() -> *mut ZSTD_DCtx325 pub fn ZSTD_createDCtx() -> *mut ZSTD_DCtx;
326 }
327 extern "C" {
ZSTD_freeDCtx(dctx: *mut ZSTD_DCtx) -> usize328 pub fn ZSTD_freeDCtx(dctx: *mut ZSTD_DCtx) -> usize;
329 }
330 extern "C" {
331 #[doc = " ZSTD_decompressDCtx() :"]
332 #[doc = " Same as ZSTD_decompress(),"]
333 #[doc = " requires an allocated ZSTD_DCtx."]
334 #[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, ) -> usize335 pub fn ZSTD_decompressDCtx(
336 dctx: *mut ZSTD_DCtx,
337 dst: *mut libc::c_void,
338 dstCapacity: usize,
339 src: *const libc::c_void,
340 srcSize: usize,
341 ) -> usize;
342 }
343 #[repr(u32)]
344 #[doc = " Advanced compression API"]
345 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
346 pub enum ZSTD_strategy {
347 ZSTD_fast = 1,
348 ZSTD_dfast = 2,
349 ZSTD_greedy = 3,
350 ZSTD_lazy = 4,
351 ZSTD_lazy2 = 5,
352 ZSTD_btlazy2 = 6,
353 ZSTD_btopt = 7,
354 ZSTD_btultra = 8,
355 ZSTD_btultra2 = 9,
356 }
357 #[repr(u32)]
358 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
359 pub enum ZSTD_cParameter {
360 ZSTD_c_compressionLevel = 100,
361 ZSTD_c_windowLog = 101,
362 ZSTD_c_hashLog = 102,
363 ZSTD_c_chainLog = 103,
364 ZSTD_c_searchLog = 104,
365 ZSTD_c_minMatch = 105,
366 ZSTD_c_targetLength = 106,
367 ZSTD_c_strategy = 107,
368 ZSTD_c_enableLongDistanceMatching = 160,
369 ZSTD_c_ldmHashLog = 161,
370 ZSTD_c_ldmMinMatch = 162,
371 ZSTD_c_ldmBucketSizeLog = 163,
372 ZSTD_c_ldmHashRateLog = 164,
373 ZSTD_c_contentSizeFlag = 200,
374 ZSTD_c_checksumFlag = 201,
375 ZSTD_c_dictIDFlag = 202,
376 ZSTD_c_nbWorkers = 400,
377 ZSTD_c_jobSize = 401,
378 ZSTD_c_overlapLog = 402,
379 ZSTD_c_experimentalParam1 = 500,
380 ZSTD_c_experimentalParam2 = 10,
381 ZSTD_c_experimentalParam3 = 1000,
382 ZSTD_c_experimentalParam4 = 1001,
383 ZSTD_c_experimentalParam5 = 1002,
384 ZSTD_c_experimentalParam6 = 1003,
385 ZSTD_c_experimentalParam7 = 1004,
386 ZSTD_c_experimentalParam8 = 1005,
387 ZSTD_c_experimentalParam9 = 1006,
388 ZSTD_c_experimentalParam10 = 1007,
389 ZSTD_c_experimentalParam11 = 1008,
390 ZSTD_c_experimentalParam12 = 1009,
391 }
392 #[repr(C)]
393 #[derive(Debug, Copy, Clone)]
394 pub struct ZSTD_bounds {
395 pub error: usize,
396 pub lowerBound: libc::c_int,
397 pub upperBound: libc::c_int,
398 }
399 #[test]
bindgen_test_layout_ZSTD_bounds()400 fn bindgen_test_layout_ZSTD_bounds() {
401 assert_eq!(
402 ::core::mem::size_of::<ZSTD_bounds>(),
403 16usize,
404 concat!("Size of: ", stringify!(ZSTD_bounds))
405 );
406 assert_eq!(
407 ::core::mem::align_of::<ZSTD_bounds>(),
408 8usize,
409 concat!("Alignment of ", stringify!(ZSTD_bounds))
410 );
411 assert_eq!(
412 unsafe {
413 &(*(::core::ptr::null::<ZSTD_bounds>())).error as *const _ as usize
414 },
415 0usize,
416 concat!(
417 "Offset of field: ",
418 stringify!(ZSTD_bounds),
419 "::",
420 stringify!(error)
421 )
422 );
423 assert_eq!(
424 unsafe {
425 &(*(::core::ptr::null::<ZSTD_bounds>())).lowerBound as *const _
426 as usize
427 },
428 8usize,
429 concat!(
430 "Offset of field: ",
431 stringify!(ZSTD_bounds),
432 "::",
433 stringify!(lowerBound)
434 )
435 );
436 assert_eq!(
437 unsafe {
438 &(*(::core::ptr::null::<ZSTD_bounds>())).upperBound as *const _
439 as usize
440 },
441 12usize,
442 concat!(
443 "Offset of field: ",
444 stringify!(ZSTD_bounds),
445 "::",
446 stringify!(upperBound)
447 )
448 );
449 }
450 extern "C" {
451 #[doc = " ZSTD_cParam_getBounds() :"]
452 #[doc = " All parameters must belong to an interval with lower and upper bounds,"]
453 #[doc = " otherwise they will either trigger an error or be automatically clamped."]
454 #[doc = " @return : a structure, ZSTD_bounds, which contains"]
455 #[doc = " - an error status field, which must be tested using ZSTD_isError()"]
456 #[doc = " - lower and upper bounds, both inclusive"]
ZSTD_cParam_getBounds(cParam: ZSTD_cParameter) -> ZSTD_bounds457 pub fn ZSTD_cParam_getBounds(cParam: ZSTD_cParameter) -> ZSTD_bounds;
458 }
459 extern "C" {
460 #[doc = " ZSTD_CCtx_setParameter() :"]
461 #[doc = " Set one compression parameter, selected by enum ZSTD_cParameter."]
462 #[doc = " All parameters have valid bounds. Bounds can be queried using ZSTD_cParam_getBounds()."]
463 #[doc = " Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter)."]
464 #[doc = " Setting a parameter is generally only possible during frame initialization (before starting compression)."]
465 #[doc = " Exception : when using multi-threading mode (nbWorkers >= 1),"]
466 #[doc = " the following parameters can be updated _during_ compression (within same frame):"]
467 #[doc = " => compressionLevel, hashLog, chainLog, searchLog, minMatch, targetLength and strategy."]
468 #[doc = " new parameters will be active for next job only (after a flush())."]
469 #[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, ) -> usize470 pub fn ZSTD_CCtx_setParameter(
471 cctx: *mut ZSTD_CCtx,
472 param: ZSTD_cParameter,
473 value: libc::c_int,
474 ) -> usize;
475 }
476 extern "C" {
477 #[doc = " ZSTD_CCtx_setPledgedSrcSize() :"]
478 #[doc = " Total input data size to be compressed as a single frame."]
479 #[doc = " Value will be written in frame header, unless if explicitly forbidden using ZSTD_c_contentSizeFlag."]
480 #[doc = " This value will also be controlled at end of frame, and trigger an error if not respected."]
481 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
482 #[doc = " Note 1 : pledgedSrcSize==0 actually means zero, aka an empty frame."]
483 #[doc = " In order to mean \"unknown content size\", pass constant ZSTD_CONTENTSIZE_UNKNOWN."]
484 #[doc = " ZSTD_CONTENTSIZE_UNKNOWN is default value for any new frame."]
485 #[doc = " Note 2 : pledgedSrcSize is only valid once, for the next frame."]
486 #[doc = " It's discarded at the end of the frame, and replaced by ZSTD_CONTENTSIZE_UNKNOWN."]
487 #[doc = " Note 3 : Whenever all input data is provided and consumed in a single round,"]
488 #[doc = " for example with ZSTD_compress2(),"]
489 #[doc = " or invoking immediately ZSTD_compressStream2(,,,ZSTD_e_end),"]
490 #[doc = " this value is automatically overridden by srcSize instead."]
ZSTD_CCtx_setPledgedSrcSize( cctx: *mut ZSTD_CCtx, pledgedSrcSize: libc::c_ulonglong, ) -> usize491 pub fn ZSTD_CCtx_setPledgedSrcSize(
492 cctx: *mut ZSTD_CCtx,
493 pledgedSrcSize: libc::c_ulonglong,
494 ) -> usize;
495 }
496 #[repr(u32)]
497 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
498 pub enum ZSTD_ResetDirective {
499 ZSTD_reset_session_only = 1,
500 ZSTD_reset_parameters = 2,
501 ZSTD_reset_session_and_parameters = 3,
502 }
503 extern "C" {
504 #[doc = " ZSTD_CCtx_reset() :"]
505 #[doc = " There are 2 different things that can be reset, independently or jointly :"]
506 #[doc = " - The session : will stop compressing current frame, and make CCtx ready to start a new one."]
507 #[doc = " Useful after an error, or to interrupt any ongoing compression."]
508 #[doc = " Any internal data not yet flushed is cancelled."]
509 #[doc = " Compression parameters and dictionary remain unchanged."]
510 #[doc = " They will be used to compress next frame."]
511 #[doc = " Resetting session never fails."]
512 #[doc = " - The parameters : changes all parameters back to \"default\"."]
513 #[doc = " This removes any reference to any dictionary too."]
514 #[doc = " Parameters can only be changed between 2 sessions (i.e. no compression is currently ongoing)"]
515 #[doc = " otherwise the reset fails, and function returns an error value (which can be tested using ZSTD_isError())"]
516 #[doc = " - Both : similar to resetting the session, followed by resetting parameters."]
ZSTD_CCtx_reset( cctx: *mut ZSTD_CCtx, reset: ZSTD_ResetDirective, ) -> usize517 pub fn ZSTD_CCtx_reset(
518 cctx: *mut ZSTD_CCtx,
519 reset: ZSTD_ResetDirective,
520 ) -> usize;
521 }
522 extern "C" {
523 #[doc = " ZSTD_compress2() :"]
524 #[doc = " Behave the same as ZSTD_compressCCtx(), but compression parameters are set using the advanced API."]
525 #[doc = " ZSTD_compress2() always starts a new frame."]
526 #[doc = " Should cctx hold data from a previously unfinished frame, everything about it is forgotten."]
527 #[doc = " - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()"]
528 #[doc = " - The function is always blocking, returns when compression is completed."]
529 #[doc = " Hint : compression runs faster if `dstCapacity` >= `ZSTD_compressBound(srcSize)`."]
530 #[doc = " @return : compressed size written into `dst` (<= `dstCapacity),"]
531 #[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, ) -> usize532 pub fn ZSTD_compress2(
533 cctx: *mut ZSTD_CCtx,
534 dst: *mut libc::c_void,
535 dstCapacity: usize,
536 src: *const libc::c_void,
537 srcSize: usize,
538 ) -> usize;
539 }
540 #[repr(u32)]
541 #[doc = " Advanced decompression API"]
542 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
543 pub enum ZSTD_dParameter {
544 ZSTD_d_windowLogMax = 100,
545 ZSTD_d_experimentalParam1 = 1000,
546 ZSTD_d_experimentalParam2 = 1001,
547 ZSTD_d_experimentalParam3 = 1002,
548 }
549 extern "C" {
550 #[doc = " ZSTD_dParam_getBounds() :"]
551 #[doc = " All parameters must belong to an interval with lower and upper bounds,"]
552 #[doc = " otherwise they will either trigger an error or be automatically clamped."]
553 #[doc = " @return : a structure, ZSTD_bounds, which contains"]
554 #[doc = " - an error status field, which must be tested using ZSTD_isError()"]
555 #[doc = " - both lower and upper bounds, inclusive"]
ZSTD_dParam_getBounds(dParam: ZSTD_dParameter) -> ZSTD_bounds556 pub fn ZSTD_dParam_getBounds(dParam: ZSTD_dParameter) -> ZSTD_bounds;
557 }
558 extern "C" {
559 #[doc = " ZSTD_DCtx_setParameter() :"]
560 #[doc = " Set one compression parameter, selected by enum ZSTD_dParameter."]
561 #[doc = " All parameters have valid bounds. Bounds can be queried using ZSTD_dParam_getBounds()."]
562 #[doc = " Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter)."]
563 #[doc = " Setting a parameter is only possible during frame initialization (before starting decompression)."]
564 #[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, ) -> usize565 pub fn ZSTD_DCtx_setParameter(
566 dctx: *mut ZSTD_DCtx,
567 param: ZSTD_dParameter,
568 value: libc::c_int,
569 ) -> usize;
570 }
571 extern "C" {
572 #[doc = " ZSTD_DCtx_reset() :"]
573 #[doc = " Return a DCtx to clean state."]
574 #[doc = " Session and parameters can be reset jointly or separately."]
575 #[doc = " Parameters can only be reset when no active frame is being decompressed."]
576 #[doc = " @return : 0, or an error code, which can be tested with ZSTD_isError()"]
ZSTD_DCtx_reset( dctx: *mut ZSTD_DCtx, reset: ZSTD_ResetDirective, ) -> usize577 pub fn ZSTD_DCtx_reset(
578 dctx: *mut ZSTD_DCtx,
579 reset: ZSTD_ResetDirective,
580 ) -> usize;
581 }
582 #[doc = " Streaming"]
583 #[repr(C)]
584 #[derive(Debug, Copy, Clone)]
585 pub struct ZSTD_inBuffer_s {
586 #[doc = "< start of input buffer"]
587 pub src: *const libc::c_void,
588 #[doc = "< size of input buffer"]
589 pub size: usize,
590 #[doc = "< position where reading stopped. Will be updated. Necessarily 0 <= pos <= size"]
591 pub pos: usize,
592 }
593 #[test]
bindgen_test_layout_ZSTD_inBuffer_s()594 fn bindgen_test_layout_ZSTD_inBuffer_s() {
595 assert_eq!(
596 ::core::mem::size_of::<ZSTD_inBuffer_s>(),
597 24usize,
598 concat!("Size of: ", stringify!(ZSTD_inBuffer_s))
599 );
600 assert_eq!(
601 ::core::mem::align_of::<ZSTD_inBuffer_s>(),
602 8usize,
603 concat!("Alignment of ", stringify!(ZSTD_inBuffer_s))
604 );
605 assert_eq!(
606 unsafe {
607 &(*(::core::ptr::null::<ZSTD_inBuffer_s>())).src as *const _
608 as usize
609 },
610 0usize,
611 concat!(
612 "Offset of field: ",
613 stringify!(ZSTD_inBuffer_s),
614 "::",
615 stringify!(src)
616 )
617 );
618 assert_eq!(
619 unsafe {
620 &(*(::core::ptr::null::<ZSTD_inBuffer_s>())).size as *const _
621 as usize
622 },
623 8usize,
624 concat!(
625 "Offset of field: ",
626 stringify!(ZSTD_inBuffer_s),
627 "::",
628 stringify!(size)
629 )
630 );
631 assert_eq!(
632 unsafe {
633 &(*(::core::ptr::null::<ZSTD_inBuffer_s>())).pos as *const _
634 as usize
635 },
636 16usize,
637 concat!(
638 "Offset of field: ",
639 stringify!(ZSTD_inBuffer_s),
640 "::",
641 stringify!(pos)
642 )
643 );
644 }
645 #[doc = " Streaming"]
646 pub type ZSTD_inBuffer = ZSTD_inBuffer_s;
647 #[repr(C)]
648 #[derive(Debug, Copy, Clone)]
649 pub struct ZSTD_outBuffer_s {
650 #[doc = "< start of output buffer"]
651 pub dst: *mut libc::c_void,
652 #[doc = "< size of output buffer"]
653 pub size: usize,
654 #[doc = "< position where writing stopped. Will be updated. Necessarily 0 <= pos <= size"]
655 pub pos: usize,
656 }
657 #[test]
bindgen_test_layout_ZSTD_outBuffer_s()658 fn bindgen_test_layout_ZSTD_outBuffer_s() {
659 assert_eq!(
660 ::core::mem::size_of::<ZSTD_outBuffer_s>(),
661 24usize,
662 concat!("Size of: ", stringify!(ZSTD_outBuffer_s))
663 );
664 assert_eq!(
665 ::core::mem::align_of::<ZSTD_outBuffer_s>(),
666 8usize,
667 concat!("Alignment of ", stringify!(ZSTD_outBuffer_s))
668 );
669 assert_eq!(
670 unsafe {
671 &(*(::core::ptr::null::<ZSTD_outBuffer_s>())).dst as *const _
672 as usize
673 },
674 0usize,
675 concat!(
676 "Offset of field: ",
677 stringify!(ZSTD_outBuffer_s),
678 "::",
679 stringify!(dst)
680 )
681 );
682 assert_eq!(
683 unsafe {
684 &(*(::core::ptr::null::<ZSTD_outBuffer_s>())).size as *const _
685 as usize
686 },
687 8usize,
688 concat!(
689 "Offset of field: ",
690 stringify!(ZSTD_outBuffer_s),
691 "::",
692 stringify!(size)
693 )
694 );
695 assert_eq!(
696 unsafe {
697 &(*(::core::ptr::null::<ZSTD_outBuffer_s>())).pos as *const _
698 as usize
699 },
700 16usize,
701 concat!(
702 "Offset of field: ",
703 stringify!(ZSTD_outBuffer_s),
704 "::",
705 stringify!(pos)
706 )
707 );
708 }
709 pub type ZSTD_outBuffer = ZSTD_outBuffer_s;
710 pub type ZSTD_CStream = ZSTD_CCtx;
711 extern "C" {
ZSTD_createCStream() -> *mut ZSTD_CStream712 pub fn ZSTD_createCStream() -> *mut ZSTD_CStream;
713 }
714 extern "C" {
ZSTD_freeCStream(zcs: *mut ZSTD_CStream) -> usize715 pub fn ZSTD_freeCStream(zcs: *mut ZSTD_CStream) -> usize;
716 }
717 #[repr(u32)]
718 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
719 pub enum ZSTD_EndDirective {
720 ZSTD_e_continue = 0,
721 ZSTD_e_flush = 1,
722 ZSTD_e_end = 2,
723 }
724 extern "C" {
725 #[doc = " ZSTD_compressStream2() :"]
726 #[doc = " Behaves about the same as ZSTD_compressStream, with additional control on end directive."]
727 #[doc = " - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()"]
728 #[doc = " - Compression parameters cannot be changed once compression is started (save a list of exceptions in multi-threading mode)"]
729 #[doc = " - output->pos must be <= dstCapacity, input->pos must be <= srcSize"]
730 #[doc = " - output->pos and input->pos will be updated. They are guaranteed to remain below their respective limit."]
731 #[doc = " - endOp must be a valid directive"]
732 #[doc = " - When nbWorkers==0 (default), function is blocking : it completes its job before returning to caller."]
733 #[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,"]
734 #[doc = " and then immediately returns, just indicating that there is some data remaining to be flushed."]
735 #[doc = " The function nonetheless guarantees forward progress : it will return only after it reads or write at least 1+ byte."]
736 #[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."]
737 #[doc = " - @return provides a minimum amount of data remaining to be flushed from internal buffers"]
738 #[doc = " or an error code, which can be tested using ZSTD_isError()."]
739 #[doc = " if @return != 0, flush is not fully completed, there is still some data left within internal buffers."]
740 #[doc = " This is useful for ZSTD_e_flush, since in this case more flushes are necessary to empty all buffers."]
741 #[doc = " For ZSTD_e_end, @return == 0 when internal buffers are fully flushed and frame is completed."]
742 #[doc = " - after a ZSTD_e_end directive, if internal buffer is not fully flushed (@return != 0),"]
743 #[doc = " only ZSTD_e_end or ZSTD_e_flush operations are allowed."]
744 #[doc = " Before starting a new compression job, or changing compression parameters,"]
745 #[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, ) -> usize746 pub fn ZSTD_compressStream2(
747 cctx: *mut ZSTD_CCtx,
748 output: *mut ZSTD_outBuffer,
749 input: *mut ZSTD_inBuffer,
750 endOp: ZSTD_EndDirective,
751 ) -> usize;
752 }
753 extern "C" {
ZSTD_CStreamInSize() -> usize754 pub fn ZSTD_CStreamInSize() -> usize;
755 }
756 extern "C" {
ZSTD_CStreamOutSize() -> usize757 pub fn ZSTD_CStreamOutSize() -> usize;
758 }
759 extern "C" {
760 #[doc = " Equivalent to:"]
761 #[doc = ""]
762 #[doc = " ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);"]
763 #[doc = " ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any)"]
764 #[doc = " ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);"]
ZSTD_initCStream( zcs: *mut ZSTD_CStream, compressionLevel: libc::c_int, ) -> usize765 pub fn ZSTD_initCStream(
766 zcs: *mut ZSTD_CStream,
767 compressionLevel: libc::c_int,
768 ) -> usize;
769 }
770 extern "C" {
771 #[doc = " Alternative for ZSTD_compressStream2(zcs, output, input, ZSTD_e_continue)."]
772 #[doc = " NOTE: The return value is different. ZSTD_compressStream() returns a hint for"]
773 #[doc = " the next read size (if non-zero and not an error). ZSTD_compressStream2()"]
774 #[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, ) -> usize775 pub fn ZSTD_compressStream(
776 zcs: *mut ZSTD_CStream,
777 output: *mut ZSTD_outBuffer,
778 input: *mut ZSTD_inBuffer,
779 ) -> usize;
780 }
781 extern "C" {
782 #[doc = " Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_flush)."]
ZSTD_flushStream( zcs: *mut ZSTD_CStream, output: *mut ZSTD_outBuffer, ) -> usize783 pub fn ZSTD_flushStream(
784 zcs: *mut ZSTD_CStream,
785 output: *mut ZSTD_outBuffer,
786 ) -> usize;
787 }
788 extern "C" {
789 #[doc = " Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_end)."]
ZSTD_endStream( zcs: *mut ZSTD_CStream, output: *mut ZSTD_outBuffer, ) -> usize790 pub fn ZSTD_endStream(
791 zcs: *mut ZSTD_CStream,
792 output: *mut ZSTD_outBuffer,
793 ) -> usize;
794 }
795 pub type ZSTD_DStream = ZSTD_DCtx;
796 extern "C" {
ZSTD_createDStream() -> *mut ZSTD_DStream797 pub fn ZSTD_createDStream() -> *mut ZSTD_DStream;
798 }
799 extern "C" {
ZSTD_freeDStream(zds: *mut ZSTD_DStream) -> usize800 pub fn ZSTD_freeDStream(zds: *mut ZSTD_DStream) -> usize;
801 }
802 extern "C" {
ZSTD_initDStream(zds: *mut ZSTD_DStream) -> usize803 pub fn ZSTD_initDStream(zds: *mut ZSTD_DStream) -> usize;
804 }
805 extern "C" {
ZSTD_decompressStream( zds: *mut ZSTD_DStream, output: *mut ZSTD_outBuffer, input: *mut ZSTD_inBuffer, ) -> usize806 pub fn ZSTD_decompressStream(
807 zds: *mut ZSTD_DStream,
808 output: *mut ZSTD_outBuffer,
809 input: *mut ZSTD_inBuffer,
810 ) -> usize;
811 }
812 extern "C" {
ZSTD_DStreamInSize() -> usize813 pub fn ZSTD_DStreamInSize() -> usize;
814 }
815 extern "C" {
ZSTD_DStreamOutSize() -> usize816 pub fn ZSTD_DStreamOutSize() -> usize;
817 }
818 extern "C" {
819 #[doc = " Simple dictionary API"]
820 #[doc = " Compression at an explicit compression level using a Dictionary."]
821 #[doc = " A dictionary can be any arbitrary data segment (also called a prefix),"]
822 #[doc = " or a buffer with specified information (see dictBuilder/zdict.h)."]
823 #[doc = " Note : This function loads the dictionary, resulting in significant startup delay."]
824 #[doc = " It's intended for a dictionary used only once."]
825 #[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, ) -> usize826 pub fn ZSTD_compress_usingDict(
827 ctx: *mut ZSTD_CCtx,
828 dst: *mut libc::c_void,
829 dstCapacity: usize,
830 src: *const libc::c_void,
831 srcSize: usize,
832 dict: *const libc::c_void,
833 dictSize: usize,
834 compressionLevel: libc::c_int,
835 ) -> usize;
836 }
837 extern "C" {
838 #[doc = " ZSTD_decompress_usingDict() :"]
839 #[doc = " Decompression using a known Dictionary."]
840 #[doc = " Dictionary must be identical to the one used during compression."]
841 #[doc = " Note : This function loads the dictionary, resulting in significant startup delay."]
842 #[doc = " It's intended for a dictionary used only once."]
843 #[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, ) -> usize844 pub fn ZSTD_decompress_usingDict(
845 dctx: *mut ZSTD_DCtx,
846 dst: *mut libc::c_void,
847 dstCapacity: usize,
848 src: *const libc::c_void,
849 srcSize: usize,
850 dict: *const libc::c_void,
851 dictSize: usize,
852 ) -> usize;
853 }
854 #[repr(C)]
855 #[derive(Debug, Copy, Clone)]
856 pub struct ZSTD_CDict_s {
857 _unused: [u8; 0],
858 }
859 #[doc = " Bulk processing dictionary API"]
860 pub type ZSTD_CDict = ZSTD_CDict_s;
861 extern "C" {
862 #[doc = " ZSTD_createCDict() :"]
863 #[doc = " When compressing multiple messages or blocks using the same dictionary,"]
864 #[doc = " it's recommended to digest the dictionary only once, since it's a costly operation."]
865 #[doc = " ZSTD_createCDict() will create a state from digesting a dictionary."]
866 #[doc = " The resulting state can be used for future compression operations with very limited startup cost."]
867 #[doc = " ZSTD_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only."]
868 #[doc = " @dictBuffer can be released after ZSTD_CDict creation, because its content is copied within CDict."]
869 #[doc = " Note 1 : Consider experimental function `ZSTD_createCDict_byReference()` if you prefer to not duplicate @dictBuffer content."]
870 #[doc = " Note 2 : A ZSTD_CDict can be created from an empty @dictBuffer,"]
871 #[doc = " in which case the only thing that it transports is the @compressionLevel."]
872 #[doc = " This can be useful in a pipeline featuring ZSTD_compress_usingCDict() exclusively,"]
873 #[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_CDict874 pub fn ZSTD_createCDict(
875 dictBuffer: *const libc::c_void,
876 dictSize: usize,
877 compressionLevel: libc::c_int,
878 ) -> *mut ZSTD_CDict;
879 }
880 extern "C" {
881 #[doc = " ZSTD_freeCDict() :"]
882 #[doc = " Function frees memory allocated by ZSTD_createCDict()."]
ZSTD_freeCDict(CDict: *mut ZSTD_CDict) -> usize883 pub fn ZSTD_freeCDict(CDict: *mut ZSTD_CDict) -> usize;
884 }
885 extern "C" {
886 #[doc = " ZSTD_compress_usingCDict() :"]
887 #[doc = " Compression using a digested Dictionary."]
888 #[doc = " Recommended when same dictionary is used multiple times."]
889 #[doc = " Note : compression level is _decided at dictionary creation time_,"]
890 #[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, ) -> usize891 pub fn ZSTD_compress_usingCDict(
892 cctx: *mut ZSTD_CCtx,
893 dst: *mut libc::c_void,
894 dstCapacity: usize,
895 src: *const libc::c_void,
896 srcSize: usize,
897 cdict: *const ZSTD_CDict,
898 ) -> usize;
899 }
900 #[repr(C)]
901 #[derive(Debug, Copy, Clone)]
902 pub struct ZSTD_DDict_s {
903 _unused: [u8; 0],
904 }
905 pub type ZSTD_DDict = ZSTD_DDict_s;
906 extern "C" {
907 #[doc = " ZSTD_createDDict() :"]
908 #[doc = " Create a digested dictionary, ready to start decompression operation without startup delay."]
909 #[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_DDict910 pub fn ZSTD_createDDict(
911 dictBuffer: *const libc::c_void,
912 dictSize: usize,
913 ) -> *mut ZSTD_DDict;
914 }
915 extern "C" {
916 #[doc = " ZSTD_freeDDict() :"]
917 #[doc = " Function frees memory allocated with ZSTD_createDDict()"]
ZSTD_freeDDict(ddict: *mut ZSTD_DDict) -> usize918 pub fn ZSTD_freeDDict(ddict: *mut ZSTD_DDict) -> usize;
919 }
920 extern "C" {
921 #[doc = " ZSTD_decompress_usingDDict() :"]
922 #[doc = " Decompression using a digested Dictionary."]
923 #[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, ) -> usize924 pub fn ZSTD_decompress_usingDDict(
925 dctx: *mut ZSTD_DCtx,
926 dst: *mut libc::c_void,
927 dstCapacity: usize,
928 src: *const libc::c_void,
929 srcSize: usize,
930 ddict: *const ZSTD_DDict,
931 ) -> usize;
932 }
933 extern "C" {
934 #[doc = " ZSTD_getDictID_fromDict() :"]
935 #[doc = " Provides the dictID stored within dictionary."]
936 #[doc = " if @return == 0, the dictionary is not conformant with Zstandard specification."]
937 #[doc = " It can still be loaded, but as a content-only dictionary."]
ZSTD_getDictID_fromDict( dict: *const libc::c_void, dictSize: usize, ) -> libc::c_uint938 pub fn ZSTD_getDictID_fromDict(
939 dict: *const libc::c_void,
940 dictSize: usize,
941 ) -> libc::c_uint;
942 }
943 extern "C" {
944 #[doc = " ZSTD_getDictID_fromDDict() :"]
945 #[doc = " Provides the dictID of the dictionary loaded into `ddict`."]
946 #[doc = " If @return == 0, the dictionary is not conformant to Zstandard specification, or empty."]
947 #[doc = " Non-conformant dictionaries can still be loaded, but as content-only dictionaries."]
ZSTD_getDictID_fromDDict(ddict: *const ZSTD_DDict) -> libc::c_uint948 pub fn ZSTD_getDictID_fromDDict(ddict: *const ZSTD_DDict) -> libc::c_uint;
949 }
950 extern "C" {
951 #[doc = " ZSTD_getDictID_fromFrame() :"]
952 #[doc = " Provides the dictID required to decompressed the frame stored within `src`."]
953 #[doc = " If @return == 0, the dictID could not be decoded."]
954 #[doc = " This could for one of the following reasons :"]
955 #[doc = " - The frame does not require a dictionary to be decoded (most common case)."]
956 #[doc = " - The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a hidden information."]
957 #[doc = " Note : this use case also happens when using a non-conformant dictionary."]
958 #[doc = " - `srcSize` is too small, and as a result, the frame header could not be decoded (only possible if `srcSize < ZSTD_FRAMEHEADERSIZE_MAX`)."]
959 #[doc = " - This is not a Zstandard frame."]
960 #[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_uint961 pub fn ZSTD_getDictID_fromFrame(
962 src: *const libc::c_void,
963 srcSize: usize,
964 ) -> libc::c_uint;
965 }
966 extern "C" {
967 #[doc = " ZSTD_CCtx_loadDictionary() :"]
968 #[doc = " Create an internal CDict from `dict` buffer."]
969 #[doc = " Decompression will have to use same dictionary."]
970 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
971 #[doc = " Special: Loading a NULL (or 0-size) dictionary invalidates previous dictionary,"]
972 #[doc = " meaning \"return to no-dictionary mode\"."]
973 #[doc = " Note 1 : Dictionary is sticky, it will be used for all future compressed frames."]
974 #[doc = " To return to \"no-dictionary\" situation, load a NULL dictionary (or reset parameters)."]
975 #[doc = " Note 2 : Loading a dictionary involves building tables."]
976 #[doc = " It's also a CPU consuming operation, with non-negligible impact on latency."]
977 #[doc = " Tables are dependent on compression parameters, and for this reason,"]
978 #[doc = " compression parameters can no longer be changed after loading a dictionary."]
979 #[doc = " Note 3 :`dict` content will be copied internally."]
980 #[doc = " Use experimental ZSTD_CCtx_loadDictionary_byReference() to reference content instead."]
981 #[doc = " In such a case, dictionary buffer must outlive its users."]
982 #[doc = " Note 4 : Use ZSTD_CCtx_loadDictionary_advanced()"]
983 #[doc = " to precisely select how dictionary content must be interpreted."]
ZSTD_CCtx_loadDictionary( cctx: *mut ZSTD_CCtx, dict: *const libc::c_void, dictSize: usize, ) -> usize984 pub fn ZSTD_CCtx_loadDictionary(
985 cctx: *mut ZSTD_CCtx,
986 dict: *const libc::c_void,
987 dictSize: usize,
988 ) -> usize;
989 }
990 extern "C" {
991 #[doc = " ZSTD_CCtx_refCDict() :"]
992 #[doc = " Reference a prepared dictionary, to be used for all next compressed frames."]
993 #[doc = " Note that compression parameters are enforced from within CDict,"]
994 #[doc = " and supersede any compression parameter previously set within CCtx."]
995 #[doc = " The parameters ignored are labled as \"superseded-by-cdict\" in the ZSTD_cParameter enum docs."]
996 #[doc = " The ignored parameters will be used again if the CCtx is returned to no-dictionary mode."]
997 #[doc = " The dictionary will remain valid for future compressed frames using same CCtx."]
998 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
999 #[doc = " Special : Referencing a NULL CDict means \"return to no-dictionary mode\"."]
1000 #[doc = " Note 1 : Currently, only one dictionary can be managed."]
1001 #[doc = " Referencing a new dictionary effectively \"discards\" any previous one."]
1002 #[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, ) -> usize1003 pub fn ZSTD_CCtx_refCDict(
1004 cctx: *mut ZSTD_CCtx,
1005 cdict: *const ZSTD_CDict,
1006 ) -> usize;
1007 }
1008 extern "C" {
1009 #[doc = " ZSTD_CCtx_refPrefix() :"]
1010 #[doc = " Reference a prefix (single-usage dictionary) for next compressed frame."]
1011 #[doc = " A prefix is **only used once**. Tables are discarded at end of frame (ZSTD_e_end)."]
1012 #[doc = " Decompression will need same prefix to properly regenerate data."]
1013 #[doc = " Compressing with a prefix is similar in outcome as performing a diff and compressing it,"]
1014 #[doc = " but performs much faster, especially during decompression (compression speed is tunable with compression level)."]
1015 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
1016 #[doc = " Special: Adding any prefix (including NULL) invalidates any previous prefix or dictionary"]
1017 #[doc = " Note 1 : Prefix buffer is referenced. It **must** outlive compression."]
1018 #[doc = " Its content must remain unmodified during compression."]
1019 #[doc = " Note 2 : If the intention is to diff some large src data blob with some prior version of itself,"]
1020 #[doc = " ensure that the window size is large enough to contain the entire source."]
1021 #[doc = " See ZSTD_c_windowLog."]
1022 #[doc = " Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters."]
1023 #[doc = " It's a CPU consuming operation, with non-negligible impact on latency."]
1024 #[doc = " If there is a need to use the same prefix multiple times, consider loadDictionary instead."]
1025 #[doc = " Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dct_rawContent)."]
1026 #[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, ) -> usize1027 pub fn ZSTD_CCtx_refPrefix(
1028 cctx: *mut ZSTD_CCtx,
1029 prefix: *const libc::c_void,
1030 prefixSize: usize,
1031 ) -> usize;
1032 }
1033 extern "C" {
1034 #[doc = " ZSTD_DCtx_loadDictionary() :"]
1035 #[doc = " Create an internal DDict from dict buffer,"]
1036 #[doc = " to be used to decompress next frames."]
1037 #[doc = " The dictionary remains valid for all future frames, until explicitly invalidated."]
1038 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
1039 #[doc = " Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary,"]
1040 #[doc = " meaning \"return to no-dictionary mode\"."]
1041 #[doc = " Note 1 : Loading a dictionary involves building tables,"]
1042 #[doc = " which has a non-negligible impact on CPU usage and latency."]
1043 #[doc = " It's recommended to \"load once, use many times\", to amortize the cost"]
1044 #[doc = " Note 2 :`dict` content will be copied internally, so `dict` can be released after loading."]
1045 #[doc = " Use ZSTD_DCtx_loadDictionary_byReference() to reference dictionary content instead."]
1046 #[doc = " Note 3 : Use ZSTD_DCtx_loadDictionary_advanced() to take control of"]
1047 #[doc = " how dictionary content is loaded and interpreted."]
ZSTD_DCtx_loadDictionary( dctx: *mut ZSTD_DCtx, dict: *const libc::c_void, dictSize: usize, ) -> usize1048 pub fn ZSTD_DCtx_loadDictionary(
1049 dctx: *mut ZSTD_DCtx,
1050 dict: *const libc::c_void,
1051 dictSize: usize,
1052 ) -> usize;
1053 }
1054 extern "C" {
1055 #[doc = " ZSTD_DCtx_refDDict() :"]
1056 #[doc = " Reference a prepared dictionary, to be used to decompress next frames."]
1057 #[doc = " The dictionary remains active for decompression of future frames using same DCtx."]
1058 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
1059 #[doc = " Note 1 : Currently, only one dictionary can be managed."]
1060 #[doc = " Referencing a new dictionary effectively \"discards\" any previous one."]
1061 #[doc = " Special: referencing a NULL DDict means \"return to no-dictionary mode\"."]
1062 #[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, ) -> usize1063 pub fn ZSTD_DCtx_refDDict(
1064 dctx: *mut ZSTD_DCtx,
1065 ddict: *const ZSTD_DDict,
1066 ) -> usize;
1067 }
1068 extern "C" {
1069 #[doc = " ZSTD_DCtx_refPrefix() :"]
1070 #[doc = " Reference a prefix (single-usage dictionary) to decompress next frame."]
1071 #[doc = " This is the reverse operation of ZSTD_CCtx_refPrefix(),"]
1072 #[doc = " and must use the same prefix as the one used during compression."]
1073 #[doc = " Prefix is **only used once**. Reference is discarded at end of frame."]
1074 #[doc = " End of frame is reached when ZSTD_decompressStream() returns 0."]
1075 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
1076 #[doc = " Note 1 : Adding any prefix (including NULL) invalidates any previously set prefix or dictionary"]
1077 #[doc = " Note 2 : Prefix buffer is referenced. It **must** outlive decompression."]
1078 #[doc = " Prefix buffer must remain unmodified up to the end of frame,"]
1079 #[doc = " reached when ZSTD_decompressStream() returns 0."]
1080 #[doc = " Note 3 : By default, the prefix is treated as raw content (ZSTD_dct_rawContent)."]
1081 #[doc = " Use ZSTD_CCtx_refPrefix_advanced() to alter dictMode (Experimental section)"]
1082 #[doc = " Note 4 : Referencing a raw content prefix has almost no cpu nor memory cost."]
1083 #[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, ) -> usize1084 pub fn ZSTD_DCtx_refPrefix(
1085 dctx: *mut ZSTD_DCtx,
1086 prefix: *const libc::c_void,
1087 prefixSize: usize,
1088 ) -> usize;
1089 }
1090 extern "C" {
1091 #[doc = " ZSTD_sizeof_*() :"]
1092 #[doc = " These functions give the _current_ memory usage of selected object."]
1093 #[doc = " Note that object memory usage can evolve (increase or decrease) over time."]
ZSTD_sizeof_CCtx(cctx: *const ZSTD_CCtx) -> usize1094 pub fn ZSTD_sizeof_CCtx(cctx: *const ZSTD_CCtx) -> usize;
1095 }
1096 extern "C" {
ZSTD_sizeof_DCtx(dctx: *const ZSTD_DCtx) -> usize1097 pub fn ZSTD_sizeof_DCtx(dctx: *const ZSTD_DCtx) -> usize;
1098 }
1099 extern "C" {
ZSTD_sizeof_CStream(zcs: *const ZSTD_CStream) -> usize1100 pub fn ZSTD_sizeof_CStream(zcs: *const ZSTD_CStream) -> usize;
1101 }
1102 extern "C" {
ZSTD_sizeof_DStream(zds: *const ZSTD_DStream) -> usize1103 pub fn ZSTD_sizeof_DStream(zds: *const ZSTD_DStream) -> usize;
1104 }
1105 extern "C" {
ZSTD_sizeof_CDict(cdict: *const ZSTD_CDict) -> usize1106 pub fn ZSTD_sizeof_CDict(cdict: *const ZSTD_CDict) -> usize;
1107 }
1108 extern "C" {
ZSTD_sizeof_DDict(ddict: *const ZSTD_DDict) -> usize1109 pub fn ZSTD_sizeof_DDict(ddict: *const ZSTD_DDict) -> usize;
1110 }
1111 #[repr(C)]
1112 #[derive(Debug, Copy, Clone)]
1113 pub struct ZSTD_CCtx_params_s {
1114 _unused: [u8; 0],
1115 }
1116 pub type ZSTD_CCtx_params = ZSTD_CCtx_params_s;
1117 #[repr(C)]
1118 #[derive(Debug, Copy, Clone)]
1119 pub struct ZSTD_Sequence {
1120 pub offset: libc::c_uint,
1121 pub litLength: libc::c_uint,
1122 pub matchLength: libc::c_uint,
1123 pub rep: libc::c_uint,
1124 }
1125 #[test]
bindgen_test_layout_ZSTD_Sequence()1126 fn bindgen_test_layout_ZSTD_Sequence() {
1127 assert_eq!(
1128 ::core::mem::size_of::<ZSTD_Sequence>(),
1129 16usize,
1130 concat!("Size of: ", stringify!(ZSTD_Sequence))
1131 );
1132 assert_eq!(
1133 ::core::mem::align_of::<ZSTD_Sequence>(),
1134 4usize,
1135 concat!("Alignment of ", stringify!(ZSTD_Sequence))
1136 );
1137 assert_eq!(
1138 unsafe {
1139 &(*(::core::ptr::null::<ZSTD_Sequence>())).offset as *const _
1140 as usize
1141 },
1142 0usize,
1143 concat!(
1144 "Offset of field: ",
1145 stringify!(ZSTD_Sequence),
1146 "::",
1147 stringify!(offset)
1148 )
1149 );
1150 assert_eq!(
1151 unsafe {
1152 &(*(::core::ptr::null::<ZSTD_Sequence>())).litLength as *const _
1153 as usize
1154 },
1155 4usize,
1156 concat!(
1157 "Offset of field: ",
1158 stringify!(ZSTD_Sequence),
1159 "::",
1160 stringify!(litLength)
1161 )
1162 );
1163 assert_eq!(
1164 unsafe {
1165 &(*(::core::ptr::null::<ZSTD_Sequence>())).matchLength as *const _
1166 as usize
1167 },
1168 8usize,
1169 concat!(
1170 "Offset of field: ",
1171 stringify!(ZSTD_Sequence),
1172 "::",
1173 stringify!(matchLength)
1174 )
1175 );
1176 assert_eq!(
1177 unsafe {
1178 &(*(::core::ptr::null::<ZSTD_Sequence>())).rep as *const _ as usize
1179 },
1180 12usize,
1181 concat!(
1182 "Offset of field: ",
1183 stringify!(ZSTD_Sequence),
1184 "::",
1185 stringify!(rep)
1186 )
1187 );
1188 }
1189 #[repr(C)]
1190 #[derive(Debug, Copy, Clone)]
1191 pub struct ZSTD_compressionParameters {
1192 #[doc = "< largest match distance : larger == more compression, more memory needed during decompression"]
1193 pub windowLog: libc::c_uint,
1194 #[doc = "< fully searched segment : larger == more compression, slower, more memory (useless for fast)"]
1195 pub chainLog: libc::c_uint,
1196 #[doc = "< dispatch table : larger == faster, more memory"]
1197 pub hashLog: libc::c_uint,
1198 #[doc = "< nb of searches : larger == more compression, slower"]
1199 pub searchLog: libc::c_uint,
1200 #[doc = "< match length searched : larger == faster decompression, sometimes less compression"]
1201 pub minMatch: libc::c_uint,
1202 #[doc = "< acceptable match size for optimal parser (only) : larger == more compression, slower"]
1203 pub targetLength: libc::c_uint,
1204 #[doc = "< see ZSTD_strategy definition above"]
1205 pub strategy: ZSTD_strategy,
1206 }
1207 #[test]
bindgen_test_layout_ZSTD_compressionParameters()1208 fn bindgen_test_layout_ZSTD_compressionParameters() {
1209 assert_eq!(
1210 ::core::mem::size_of::<ZSTD_compressionParameters>(),
1211 28usize,
1212 concat!("Size of: ", stringify!(ZSTD_compressionParameters))
1213 );
1214 assert_eq!(
1215 ::core::mem::align_of::<ZSTD_compressionParameters>(),
1216 4usize,
1217 concat!("Alignment of ", stringify!(ZSTD_compressionParameters))
1218 );
1219 assert_eq!(
1220 unsafe {
1221 &(*(::core::ptr::null::<ZSTD_compressionParameters>())).windowLog
1222 as *const _ as usize
1223 },
1224 0usize,
1225 concat!(
1226 "Offset of field: ",
1227 stringify!(ZSTD_compressionParameters),
1228 "::",
1229 stringify!(windowLog)
1230 )
1231 );
1232 assert_eq!(
1233 unsafe {
1234 &(*(::core::ptr::null::<ZSTD_compressionParameters>())).chainLog
1235 as *const _ as usize
1236 },
1237 4usize,
1238 concat!(
1239 "Offset of field: ",
1240 stringify!(ZSTD_compressionParameters),
1241 "::",
1242 stringify!(chainLog)
1243 )
1244 );
1245 assert_eq!(
1246 unsafe {
1247 &(*(::core::ptr::null::<ZSTD_compressionParameters>())).hashLog
1248 as *const _ as usize
1249 },
1250 8usize,
1251 concat!(
1252 "Offset of field: ",
1253 stringify!(ZSTD_compressionParameters),
1254 "::",
1255 stringify!(hashLog)
1256 )
1257 );
1258 assert_eq!(
1259 unsafe {
1260 &(*(::core::ptr::null::<ZSTD_compressionParameters>())).searchLog
1261 as *const _ as usize
1262 },
1263 12usize,
1264 concat!(
1265 "Offset of field: ",
1266 stringify!(ZSTD_compressionParameters),
1267 "::",
1268 stringify!(searchLog)
1269 )
1270 );
1271 assert_eq!(
1272 unsafe {
1273 &(*(::core::ptr::null::<ZSTD_compressionParameters>())).minMatch
1274 as *const _ as usize
1275 },
1276 16usize,
1277 concat!(
1278 "Offset of field: ",
1279 stringify!(ZSTD_compressionParameters),
1280 "::",
1281 stringify!(minMatch)
1282 )
1283 );
1284 assert_eq!(
1285 unsafe {
1286 &(*(::core::ptr::null::<ZSTD_compressionParameters>()))
1287 .targetLength as *const _ as usize
1288 },
1289 20usize,
1290 concat!(
1291 "Offset of field: ",
1292 stringify!(ZSTD_compressionParameters),
1293 "::",
1294 stringify!(targetLength)
1295 )
1296 );
1297 assert_eq!(
1298 unsafe {
1299 &(*(::core::ptr::null::<ZSTD_compressionParameters>())).strategy
1300 as *const _ as usize
1301 },
1302 24usize,
1303 concat!(
1304 "Offset of field: ",
1305 stringify!(ZSTD_compressionParameters),
1306 "::",
1307 stringify!(strategy)
1308 )
1309 );
1310 }
1311 #[repr(C)]
1312 #[derive(Debug, Copy, Clone)]
1313 pub struct ZSTD_frameParameters {
1314 #[doc = "< 1: content size will be in frame header (when known)"]
1315 pub contentSizeFlag: libc::c_int,
1316 #[doc = "< 1: generate a 32-bits checksum using XXH64 algorithm at end of frame, for error detection"]
1317 pub checksumFlag: libc::c_int,
1318 #[doc = "< 1: no dictID will be saved into frame header (dictID is only useful for dictionary compression)"]
1319 pub noDictIDFlag: libc::c_int,
1320 }
1321 #[test]
bindgen_test_layout_ZSTD_frameParameters()1322 fn bindgen_test_layout_ZSTD_frameParameters() {
1323 assert_eq!(
1324 ::core::mem::size_of::<ZSTD_frameParameters>(),
1325 12usize,
1326 concat!("Size of: ", stringify!(ZSTD_frameParameters))
1327 );
1328 assert_eq!(
1329 ::core::mem::align_of::<ZSTD_frameParameters>(),
1330 4usize,
1331 concat!("Alignment of ", stringify!(ZSTD_frameParameters))
1332 );
1333 assert_eq!(
1334 unsafe {
1335 &(*(::core::ptr::null::<ZSTD_frameParameters>())).contentSizeFlag
1336 as *const _ as usize
1337 },
1338 0usize,
1339 concat!(
1340 "Offset of field: ",
1341 stringify!(ZSTD_frameParameters),
1342 "::",
1343 stringify!(contentSizeFlag)
1344 )
1345 );
1346 assert_eq!(
1347 unsafe {
1348 &(*(::core::ptr::null::<ZSTD_frameParameters>())).checksumFlag
1349 as *const _ as usize
1350 },
1351 4usize,
1352 concat!(
1353 "Offset of field: ",
1354 stringify!(ZSTD_frameParameters),
1355 "::",
1356 stringify!(checksumFlag)
1357 )
1358 );
1359 assert_eq!(
1360 unsafe {
1361 &(*(::core::ptr::null::<ZSTD_frameParameters>())).noDictIDFlag
1362 as *const _ as usize
1363 },
1364 8usize,
1365 concat!(
1366 "Offset of field: ",
1367 stringify!(ZSTD_frameParameters),
1368 "::",
1369 stringify!(noDictIDFlag)
1370 )
1371 );
1372 }
1373 #[repr(C)]
1374 #[derive(Debug, Copy, Clone)]
1375 pub struct ZSTD_parameters {
1376 pub cParams: ZSTD_compressionParameters,
1377 pub fParams: ZSTD_frameParameters,
1378 }
1379 #[test]
bindgen_test_layout_ZSTD_parameters()1380 fn bindgen_test_layout_ZSTD_parameters() {
1381 assert_eq!(
1382 ::core::mem::size_of::<ZSTD_parameters>(),
1383 40usize,
1384 concat!("Size of: ", stringify!(ZSTD_parameters))
1385 );
1386 assert_eq!(
1387 ::core::mem::align_of::<ZSTD_parameters>(),
1388 4usize,
1389 concat!("Alignment of ", stringify!(ZSTD_parameters))
1390 );
1391 assert_eq!(
1392 unsafe {
1393 &(*(::core::ptr::null::<ZSTD_parameters>())).cParams as *const _
1394 as usize
1395 },
1396 0usize,
1397 concat!(
1398 "Offset of field: ",
1399 stringify!(ZSTD_parameters),
1400 "::",
1401 stringify!(cParams)
1402 )
1403 );
1404 assert_eq!(
1405 unsafe {
1406 &(*(::core::ptr::null::<ZSTD_parameters>())).fParams as *const _
1407 as usize
1408 },
1409 28usize,
1410 concat!(
1411 "Offset of field: ",
1412 stringify!(ZSTD_parameters),
1413 "::",
1414 stringify!(fParams)
1415 )
1416 );
1417 }
1418 #[repr(u32)]
1419 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1420 pub enum ZSTD_dictContentType_e {
1421 ZSTD_dct_auto = 0,
1422 ZSTD_dct_rawContent = 1,
1423 ZSTD_dct_fullDict = 2,
1424 }
1425 #[repr(u32)]
1426 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1427 pub enum ZSTD_dictLoadMethod_e {
1428 #[doc = "< Copy dictionary content internally"]
1429 ZSTD_dlm_byCopy = 0,
1430 #[doc = "< Reference dictionary content -- the dictionary buffer must outlive its users."]
1431 ZSTD_dlm_byRef = 1,
1432 }
1433 #[repr(u32)]
1434 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1435 pub enum ZSTD_format_e {
1436 ZSTD_f_zstd1 = 0,
1437 ZSTD_f_zstd1_magicless = 1,
1438 }
1439 #[repr(u32)]
1440 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1441 pub enum ZSTD_forceIgnoreChecksum_e {
1442 ZSTD_d_validateChecksum = 0,
1443 ZSTD_d_ignoreChecksum = 1,
1444 }
1445 #[repr(u32)]
1446 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1447 pub enum ZSTD_dictAttachPref_e {
1448 ZSTD_dictDefaultAttach = 0,
1449 ZSTD_dictForceAttach = 1,
1450 ZSTD_dictForceCopy = 2,
1451 ZSTD_dictForceLoad = 3,
1452 }
1453 #[repr(u32)]
1454 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1455 pub enum ZSTD_literalCompressionMode_e {
1456 #[doc = "< Automatically determine the compression mode based on the compression level."]
1457 #[doc = " Negative compression levels will be uncompressed, and positive compression"]
1458 #[doc = " levels will be compressed."]
1459 ZSTD_lcm_auto = 0,
1460 #[doc = "< Always attempt Huffman compression. Uncompressed literals will still be"]
1461 #[doc = " emitted if Huffman compression is not profitable."]
1462 ZSTD_lcm_huffman = 1,
1463 #[doc = "< Always emit uncompressed literals."]
1464 ZSTD_lcm_uncompressed = 2,
1465 }
1466 extern "C" {
1467 #[doc = " ZSTD_findDecompressedSize() :"]
1468 #[doc = " `src` should point to the start of a series of ZSTD encoded and/or skippable frames"]
1469 #[doc = " `srcSize` must be the _exact_ size of this series"]
1470 #[doc = " (i.e. there should be a frame boundary at `src + srcSize`)"]
1471 #[doc = " @return : - decompressed size of all data in all successive frames"]
1472 #[doc = " - if the decompressed size cannot be determined: ZSTD_CONTENTSIZE_UNKNOWN"]
1473 #[doc = " - if an error occurred: ZSTD_CONTENTSIZE_ERROR"]
1474 #[doc = ""]
1475 #[doc = " note 1 : decompressed size is an optional field, that may not be present, especially in streaming mode."]
1476 #[doc = " When `return==ZSTD_CONTENTSIZE_UNKNOWN`, data to decompress could be any size."]
1477 #[doc = " In which case, it's necessary to use streaming mode to decompress data."]
1478 #[doc = " note 2 : decompressed size is always present when compression is done with ZSTD_compress()"]
1479 #[doc = " note 3 : decompressed size can be very large (64-bits value),"]
1480 #[doc = " potentially larger than what local system can handle as a single memory segment."]
1481 #[doc = " In which case, it's necessary to use streaming mode to decompress data."]
1482 #[doc = " note 4 : If source is untrusted, decompressed size could be wrong or intentionally modified."]
1483 #[doc = " Always ensure result fits within application's authorized limits."]
1484 #[doc = " Each application can set its own limits."]
1485 #[doc = " note 5 : ZSTD_findDecompressedSize handles multiple frames, and so it must traverse the input to"]
1486 #[doc = " read each contained frame header. This is fast as most of the data is skipped,"]
1487 #[doc = " however it does mean that all frame data must be present and valid."]
ZSTD_findDecompressedSize( src: *const libc::c_void, srcSize: usize, ) -> libc::c_ulonglong1488 pub fn ZSTD_findDecompressedSize(
1489 src: *const libc::c_void,
1490 srcSize: usize,
1491 ) -> libc::c_ulonglong;
1492 }
1493 extern "C" {
1494 #[doc = " ZSTD_decompressBound() :"]
1495 #[doc = " `src` should point to the start of a series of ZSTD encoded and/or skippable frames"]
1496 #[doc = " `srcSize` must be the _exact_ size of this series"]
1497 #[doc = " (i.e. there should be a frame boundary at `src + srcSize`)"]
1498 #[doc = " @return : - upper-bound for the decompressed size of all data in all successive frames"]
1499 #[doc = " - if an error occured: ZSTD_CONTENTSIZE_ERROR"]
1500 #[doc = ""]
1501 #[doc = " note 1 : an error can occur if `src` contains an invalid or incorrectly formatted frame."]
1502 #[doc = " note 2 : the upper-bound is exact when the decompressed size field is available in every ZSTD encoded frame of `src`."]
1503 #[doc = " in this case, `ZSTD_findDecompressedSize` and `ZSTD_decompressBound` return the same value."]
1504 #[doc = " note 3 : when the decompressed size field isn't available, the upper-bound for that frame is calculated by:"]
1505 #[doc = " upper-bound = # blocks * min(128 KB, Window_Size)"]
ZSTD_decompressBound( src: *const libc::c_void, srcSize: usize, ) -> libc::c_ulonglong1506 pub fn ZSTD_decompressBound(
1507 src: *const libc::c_void,
1508 srcSize: usize,
1509 ) -> libc::c_ulonglong;
1510 }
1511 extern "C" {
1512 #[doc = " ZSTD_frameHeaderSize() :"]
1513 #[doc = " srcSize must be >= ZSTD_FRAMEHEADERSIZE_PREFIX."]
1514 #[doc = " @return : size of the Frame Header,"]
1515 #[doc = " or an error code (if srcSize is too small)"]
ZSTD_frameHeaderSize( src: *const libc::c_void, srcSize: usize, ) -> usize1516 pub fn ZSTD_frameHeaderSize(
1517 src: *const libc::c_void,
1518 srcSize: usize,
1519 ) -> usize;
1520 }
1521 #[repr(u32)]
1522 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1523 pub enum ZSTD_sequenceFormat_e {
1524 ZSTD_sf_noBlockDelimiters = 0,
1525 ZSTD_sf_explicitBlockDelimiters = 1,
1526 }
1527 extern "C" {
1528 #[doc = " ZSTD_generateSequences() :"]
1529 #[doc = " Generate sequences using ZSTD_compress2, given a source buffer."]
1530 #[doc = ""]
1531 #[doc = " Each block will end with a dummy sequence"]
1532 #[doc = " with offset == 0, matchLength == 0, and litLength == length of last literals."]
1533 #[doc = " litLength may be == 0, and if so, then the sequence of (of: 0 ml: 0 ll: 0)"]
1534 #[doc = " simply acts as a block delimiter."]
1535 #[doc = ""]
1536 #[doc = " zc can be used to insert custom compression params."]
1537 #[doc = " This function invokes ZSTD_compress2"]
1538 #[doc = ""]
1539 #[doc = " The output of this function can be fed into ZSTD_compressSequences() with CCtx"]
1540 #[doc = " setting of ZSTD_c_blockDelimiters as ZSTD_sf_explicitBlockDelimiters"]
1541 #[doc = " @return : number of sequences generated"]
ZSTD_generateSequences( zc: *mut ZSTD_CCtx, outSeqs: *mut ZSTD_Sequence, outSeqsSize: usize, src: *const libc::c_void, srcSize: usize, ) -> usize1542 pub fn ZSTD_generateSequences(
1543 zc: *mut ZSTD_CCtx,
1544 outSeqs: *mut ZSTD_Sequence,
1545 outSeqsSize: usize,
1546 src: *const libc::c_void,
1547 srcSize: usize,
1548 ) -> usize;
1549 }
1550 extern "C" {
1551 #[doc = " ZSTD_mergeBlockDelimiters() :"]
1552 #[doc = " Given an array of ZSTD_Sequence, remove all sequences that represent block delimiters/last literals"]
1553 #[doc = " by merging them into into the literals of the next sequence."]
1554 #[doc = ""]
1555 #[doc = " As such, the final generated result has no explicit representation of block boundaries,"]
1556 #[doc = " and the final last literals segment is not represented in the sequences."]
1557 #[doc = ""]
1558 #[doc = " The output of this function can be fed into ZSTD_compressSequences() with CCtx"]
1559 #[doc = " setting of ZSTD_c_blockDelimiters as ZSTD_sf_noBlockDelimiters"]
1560 #[doc = " @return : number of sequences left after merging"]
ZSTD_mergeBlockDelimiters( sequences: *mut ZSTD_Sequence, seqsSize: usize, ) -> usize1561 pub fn ZSTD_mergeBlockDelimiters(
1562 sequences: *mut ZSTD_Sequence,
1563 seqsSize: usize,
1564 ) -> usize;
1565 }
1566 extern "C" {
1567 #[doc = " ZSTD_compressSequences() :"]
1568 #[doc = " Compress an array of ZSTD_Sequence, generated from the original source buffer, into dst."]
1569 #[doc = " If a dictionary is included, then the cctx should reference the dict. (see: ZSTD_CCtx_refCDict(), ZSTD_CCtx_loadDictionary(), etc.)"]
1570 #[doc = " The entire source is compressed into a single frame."]
1571 #[doc = ""]
1572 #[doc = " The compression behavior changes based on cctx params. In particular:"]
1573 #[doc = " If ZSTD_c_blockDelimiters == ZSTD_sf_noBlockDelimiters, the array of ZSTD_Sequence is expected to contain"]
1574 #[doc = " no block delimiters (defined in ZSTD_Sequence). Block boundaries are roughly determined based on"]
1575 #[doc = " the block size derived from the cctx, and sequences may be split. This is the default setting."]
1576 #[doc = ""]
1577 #[doc = " If ZSTD_c_blockDelimiters == ZSTD_sf_explicitBlockDelimiters, the array of ZSTD_Sequence is expected to contain"]
1578 #[doc = " block delimiters (defined in ZSTD_Sequence). Behavior is undefined if no block delimiters are provided."]
1579 #[doc = ""]
1580 #[doc = " If ZSTD_c_validateSequences == 0, this function will blindly accept the sequences provided. Invalid sequences cause undefined"]
1581 #[doc = " behavior. If ZSTD_c_validateSequences == 1, then if sequence is invalid (see doc/zstd_compression_format.md for"]
1582 #[doc = " specifics regarding offset/matchlength requirements) then the function will bail out and return an error."]
1583 #[doc = ""]
1584 #[doc = " In addition to the two adjustable experimental params, there are other important cctx params."]
1585 #[doc = " - ZSTD_c_minMatch MUST be set as less than or equal to the smallest match generated by the match finder. It has a minimum value of ZSTD_MINMATCH_MIN."]
1586 #[doc = " - ZSTD_c_compressionLevel accordingly adjusts the strength of the entropy coder, as it would in typical compression."]
1587 #[doc = " - ZSTD_c_windowLog affects offset validation: this function will return an error at higher debug levels if a provided offset"]
1588 #[doc = " is larger than what the spec allows for a given window log and dictionary (if present). See: doc/zstd_compression_format.md"]
1589 #[doc = ""]
1590 #[doc = " Note: Repcodes are, as of now, always re-calculated within this function, so ZSTD_Sequence::rep is unused."]
1591 #[doc = " Note 2: Once we integrate ability to ingest repcodes, the explicit block delims mode must respect those repcodes exactly,"]
1592 #[doc = " and cannot emit an RLE block that disagrees with the repcode history"]
1593 #[doc = " @return : final compressed size or a ZSTD error."]
ZSTD_compressSequences( cctx: *mut ZSTD_CCtx, dst: *mut libc::c_void, dstSize: usize, inSeqs: *const ZSTD_Sequence, inSeqsSize: usize, src: *const libc::c_void, srcSize: usize, ) -> usize1594 pub fn ZSTD_compressSequences(
1595 cctx: *mut ZSTD_CCtx,
1596 dst: *mut libc::c_void,
1597 dstSize: usize,
1598 inSeqs: *const ZSTD_Sequence,
1599 inSeqsSize: usize,
1600 src: *const libc::c_void,
1601 srcSize: usize,
1602 ) -> usize;
1603 }
1604 extern "C" {
1605 #[doc = " ZSTD_estimate*() :"]
1606 #[doc = " These functions make it possible to estimate memory usage"]
1607 #[doc = " of a future {D,C}Ctx, before its creation."]
1608 #[doc = ""]
1609 #[doc = " ZSTD_estimateCCtxSize() will provide a memory budget large enough"]
1610 #[doc = " for any compression level up to selected one."]
1611 #[doc = " Note : Unlike ZSTD_estimateCStreamSize*(), this estimate"]
1612 #[doc = " does not include space for a window buffer."]
1613 #[doc = " Therefore, the estimation is only guaranteed for single-shot compressions, not streaming."]
1614 #[doc = " The estimate will assume the input may be arbitrarily large,"]
1615 #[doc = " which is the worst case."]
1616 #[doc = ""]
1617 #[doc = " When srcSize can be bound by a known and rather \"small\" value,"]
1618 #[doc = " this fact can be used to provide a tighter estimation"]
1619 #[doc = " because the CCtx compression context will need less memory."]
1620 #[doc = " This tighter estimation can be provided by more advanced functions"]
1621 #[doc = " ZSTD_estimateCCtxSize_usingCParams(), which can be used in tandem with ZSTD_getCParams(),"]
1622 #[doc = " and ZSTD_estimateCCtxSize_usingCCtxParams(), which can be used in tandem with ZSTD_CCtxParams_setParameter()."]
1623 #[doc = " Both can be used to estimate memory using custom compression parameters and arbitrary srcSize limits."]
1624 #[doc = ""]
1625 #[doc = " Note 2 : only single-threaded compression is supported."]
1626 #[doc = " ZSTD_estimateCCtxSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1."]
ZSTD_estimateCCtxSize(compressionLevel: libc::c_int) -> usize1627 pub fn ZSTD_estimateCCtxSize(compressionLevel: libc::c_int) -> usize;
1628 }
1629 extern "C" {
ZSTD_estimateCCtxSize_usingCParams( cParams: ZSTD_compressionParameters, ) -> usize1630 pub fn ZSTD_estimateCCtxSize_usingCParams(
1631 cParams: ZSTD_compressionParameters,
1632 ) -> usize;
1633 }
1634 extern "C" {
ZSTD_estimateCCtxSize_usingCCtxParams( params: *const ZSTD_CCtx_params, ) -> usize1635 pub fn ZSTD_estimateCCtxSize_usingCCtxParams(
1636 params: *const ZSTD_CCtx_params,
1637 ) -> usize;
1638 }
1639 extern "C" {
ZSTD_estimateDCtxSize() -> usize1640 pub fn ZSTD_estimateDCtxSize() -> usize;
1641 }
1642 extern "C" {
1643 #[doc = " ZSTD_estimateCStreamSize() :"]
1644 #[doc = " ZSTD_estimateCStreamSize() will provide a budget large enough for any compression level up to selected one."]
1645 #[doc = " It will also consider src size to be arbitrarily \"large\", which is worst case."]
1646 #[doc = " If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation."]
1647 #[doc = " ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel."]
1648 #[doc = " ZSTD_estimateCStreamSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParams_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1."]
1649 #[doc = " Note : CStream size estimation is only correct for single-threaded compression."]
1650 #[doc = " ZSTD_DStream memory budget depends on window Size."]
1651 #[doc = " This information can be passed manually, using ZSTD_estimateDStreamSize,"]
1652 #[doc = " or deducted from a valid frame Header, using ZSTD_estimateDStreamSize_fromFrame();"]
1653 #[doc = " Note : if streaming is init with function ZSTD_init?Stream_usingDict(),"]
1654 #[doc = " an internal ?Dict will be created, which additional size is not estimated here."]
1655 #[doc = " In this case, get total size by adding ZSTD_estimate?DictSize"]
ZSTD_estimateCStreamSize(compressionLevel: libc::c_int) -> usize1656 pub fn ZSTD_estimateCStreamSize(compressionLevel: libc::c_int) -> usize;
1657 }
1658 extern "C" {
ZSTD_estimateCStreamSize_usingCParams( cParams: ZSTD_compressionParameters, ) -> usize1659 pub fn ZSTD_estimateCStreamSize_usingCParams(
1660 cParams: ZSTD_compressionParameters,
1661 ) -> usize;
1662 }
1663 extern "C" {
ZSTD_estimateCStreamSize_usingCCtxParams( params: *const ZSTD_CCtx_params, ) -> usize1664 pub fn ZSTD_estimateCStreamSize_usingCCtxParams(
1665 params: *const ZSTD_CCtx_params,
1666 ) -> usize;
1667 }
1668 extern "C" {
ZSTD_estimateDStreamSize(windowSize: usize) -> usize1669 pub fn ZSTD_estimateDStreamSize(windowSize: usize) -> usize;
1670 }
1671 extern "C" {
ZSTD_estimateDStreamSize_fromFrame( src: *const libc::c_void, srcSize: usize, ) -> usize1672 pub fn ZSTD_estimateDStreamSize_fromFrame(
1673 src: *const libc::c_void,
1674 srcSize: usize,
1675 ) -> usize;
1676 }
1677 extern "C" {
1678 #[doc = " ZSTD_estimate?DictSize() :"]
1679 #[doc = " ZSTD_estimateCDictSize() will bet that src size is relatively \"small\", and content is copied, like ZSTD_createCDict()."]
1680 #[doc = " ZSTD_estimateCDictSize_advanced() makes it possible to control compression parameters precisely, like ZSTD_createCDict_advanced()."]
1681 #[doc = " Note : dictionaries created by reference (`ZSTD_dlm_byRef`) are logically smaller."]
ZSTD_estimateCDictSize( dictSize: usize, compressionLevel: libc::c_int, ) -> usize1682 pub fn ZSTD_estimateCDictSize(
1683 dictSize: usize,
1684 compressionLevel: libc::c_int,
1685 ) -> usize;
1686 }
1687 extern "C" {
ZSTD_estimateCDictSize_advanced( dictSize: usize, cParams: ZSTD_compressionParameters, dictLoadMethod: ZSTD_dictLoadMethod_e, ) -> usize1688 pub fn ZSTD_estimateCDictSize_advanced(
1689 dictSize: usize,
1690 cParams: ZSTD_compressionParameters,
1691 dictLoadMethod: ZSTD_dictLoadMethod_e,
1692 ) -> usize;
1693 }
1694 extern "C" {
ZSTD_estimateDDictSize( dictSize: usize, dictLoadMethod: ZSTD_dictLoadMethod_e, ) -> usize1695 pub fn ZSTD_estimateDDictSize(
1696 dictSize: usize,
1697 dictLoadMethod: ZSTD_dictLoadMethod_e,
1698 ) -> usize;
1699 }
1700 extern "C" {
1701 #[doc = " ZSTD_initStatic*() :"]
1702 #[doc = " Initialize an object using a pre-allocated fixed-size buffer."]
1703 #[doc = " workspace: The memory area to emplace the object into."]
1704 #[doc = " Provided pointer *must be 8-bytes aligned*."]
1705 #[doc = " Buffer must outlive object."]
1706 #[doc = " workspaceSize: Use ZSTD_estimate*Size() to determine"]
1707 #[doc = " how large workspace must be to support target scenario."]
1708 #[doc = " @return : pointer to object (same address as workspace, just different type),"]
1709 #[doc = " or NULL if error (size too small, incorrect alignment, etc.)"]
1710 #[doc = " Note : zstd will never resize nor malloc() when using a static buffer."]
1711 #[doc = " If the object requires more memory than available,"]
1712 #[doc = " zstd will just error out (typically ZSTD_error_memory_allocation)."]
1713 #[doc = " Note 2 : there is no corresponding \"free\" function."]
1714 #[doc = " Since workspace is allocated externally, it must be freed externally too."]
1715 #[doc = " Note 3 : cParams : use ZSTD_getCParams() to convert a compression level"]
1716 #[doc = " into its associated cParams."]
1717 #[doc = " Limitation 1 : currently not compatible with internal dictionary creation, triggered by"]
1718 #[doc = " ZSTD_CCtx_loadDictionary(), ZSTD_initCStream_usingDict() or ZSTD_initDStream_usingDict()."]
1719 #[doc = " Limitation 2 : static cctx currently not compatible with multi-threading."]
1720 #[doc = " Limitation 3 : static dctx is incompatible with legacy support."]
ZSTD_initStaticCCtx( workspace: *mut libc::c_void, workspaceSize: usize, ) -> *mut ZSTD_CCtx1721 pub fn ZSTD_initStaticCCtx(
1722 workspace: *mut libc::c_void,
1723 workspaceSize: usize,
1724 ) -> *mut ZSTD_CCtx;
1725 }
1726 extern "C" {
ZSTD_initStaticCStream( workspace: *mut libc::c_void, workspaceSize: usize, ) -> *mut ZSTD_CStream1727 pub fn ZSTD_initStaticCStream(
1728 workspace: *mut libc::c_void,
1729 workspaceSize: usize,
1730 ) -> *mut ZSTD_CStream;
1731 }
1732 extern "C" {
ZSTD_initStaticDCtx( workspace: *mut libc::c_void, workspaceSize: usize, ) -> *mut ZSTD_DCtx1733 pub fn ZSTD_initStaticDCtx(
1734 workspace: *mut libc::c_void,
1735 workspaceSize: usize,
1736 ) -> *mut ZSTD_DCtx;
1737 }
1738 extern "C" {
ZSTD_initStaticDStream( workspace: *mut libc::c_void, workspaceSize: usize, ) -> *mut ZSTD_DStream1739 pub fn ZSTD_initStaticDStream(
1740 workspace: *mut libc::c_void,
1741 workspaceSize: usize,
1742 ) -> *mut ZSTD_DStream;
1743 }
1744 extern "C" {
ZSTD_initStaticCDict( workspace: *mut libc::c_void, workspaceSize: usize, dict: *const libc::c_void, dictSize: usize, dictLoadMethod: ZSTD_dictLoadMethod_e, dictContentType: ZSTD_dictContentType_e, cParams: ZSTD_compressionParameters, ) -> *const ZSTD_CDict1745 pub fn ZSTD_initStaticCDict(
1746 workspace: *mut libc::c_void,
1747 workspaceSize: usize,
1748 dict: *const libc::c_void,
1749 dictSize: usize,
1750 dictLoadMethod: ZSTD_dictLoadMethod_e,
1751 dictContentType: ZSTD_dictContentType_e,
1752 cParams: ZSTD_compressionParameters,
1753 ) -> *const ZSTD_CDict;
1754 }
1755 extern "C" {
ZSTD_initStaticDDict( workspace: *mut libc::c_void, workspaceSize: usize, dict: *const libc::c_void, dictSize: usize, dictLoadMethod: ZSTD_dictLoadMethod_e, dictContentType: ZSTD_dictContentType_e, ) -> *const ZSTD_DDict1756 pub fn ZSTD_initStaticDDict(
1757 workspace: *mut libc::c_void,
1758 workspaceSize: usize,
1759 dict: *const libc::c_void,
1760 dictSize: usize,
1761 dictLoadMethod: ZSTD_dictLoadMethod_e,
1762 dictContentType: ZSTD_dictContentType_e,
1763 ) -> *const ZSTD_DDict;
1764 }
1765 #[doc = " Custom memory allocation :"]
1766 #[doc = " These prototypes make it possible to pass your own allocation/free functions."]
1767 #[doc = " ZSTD_customMem is provided at creation time, using ZSTD_create*_advanced() variants listed below."]
1768 #[doc = " All allocation/free operations will be completed using these custom variants instead of regular <stdlib.h> ones."]
1769 pub type ZSTD_allocFunction = ::core::option::Option<
1770 unsafe extern "C" fn(
1771 opaque: *mut libc::c_void,
1772 size: usize,
1773 ) -> *mut libc::c_void,
1774 >;
1775 pub type ZSTD_freeFunction = ::core::option::Option<
1776 unsafe extern "C" fn(
1777 opaque: *mut libc::c_void,
1778 address: *mut libc::c_void,
1779 ),
1780 >;
1781 #[repr(C)]
1782 #[derive(Debug, Copy, Clone)]
1783 pub struct ZSTD_customMem {
1784 pub customAlloc: ZSTD_allocFunction,
1785 pub customFree: ZSTD_freeFunction,
1786 pub opaque: *mut libc::c_void,
1787 }
1788 #[test]
bindgen_test_layout_ZSTD_customMem()1789 fn bindgen_test_layout_ZSTD_customMem() {
1790 assert_eq!(
1791 ::core::mem::size_of::<ZSTD_customMem>(),
1792 24usize,
1793 concat!("Size of: ", stringify!(ZSTD_customMem))
1794 );
1795 assert_eq!(
1796 ::core::mem::align_of::<ZSTD_customMem>(),
1797 8usize,
1798 concat!("Alignment of ", stringify!(ZSTD_customMem))
1799 );
1800 assert_eq!(
1801 unsafe {
1802 &(*(::core::ptr::null::<ZSTD_customMem>())).customAlloc as *const _
1803 as usize
1804 },
1805 0usize,
1806 concat!(
1807 "Offset of field: ",
1808 stringify!(ZSTD_customMem),
1809 "::",
1810 stringify!(customAlloc)
1811 )
1812 );
1813 assert_eq!(
1814 unsafe {
1815 &(*(::core::ptr::null::<ZSTD_customMem>())).customFree as *const _
1816 as usize
1817 },
1818 8usize,
1819 concat!(
1820 "Offset of field: ",
1821 stringify!(ZSTD_customMem),
1822 "::",
1823 stringify!(customFree)
1824 )
1825 );
1826 assert_eq!(
1827 unsafe {
1828 &(*(::core::ptr::null::<ZSTD_customMem>())).opaque as *const _
1829 as usize
1830 },
1831 16usize,
1832 concat!(
1833 "Offset of field: ",
1834 stringify!(ZSTD_customMem),
1835 "::",
1836 stringify!(opaque)
1837 )
1838 );
1839 }
1840 extern "C" {
1841 pub static ZSTD_defaultCMem: ZSTD_customMem;
1842 }
1843 extern "C" {
ZSTD_createCCtx_advanced( customMem: ZSTD_customMem, ) -> *mut ZSTD_CCtx1844 pub fn ZSTD_createCCtx_advanced(
1845 customMem: ZSTD_customMem,
1846 ) -> *mut ZSTD_CCtx;
1847 }
1848 extern "C" {
ZSTD_createCStream_advanced( customMem: ZSTD_customMem, ) -> *mut ZSTD_CStream1849 pub fn ZSTD_createCStream_advanced(
1850 customMem: ZSTD_customMem,
1851 ) -> *mut ZSTD_CStream;
1852 }
1853 extern "C" {
ZSTD_createDCtx_advanced( customMem: ZSTD_customMem, ) -> *mut ZSTD_DCtx1854 pub fn ZSTD_createDCtx_advanced(
1855 customMem: ZSTD_customMem,
1856 ) -> *mut ZSTD_DCtx;
1857 }
1858 extern "C" {
ZSTD_createDStream_advanced( customMem: ZSTD_customMem, ) -> *mut ZSTD_DStream1859 pub fn ZSTD_createDStream_advanced(
1860 customMem: ZSTD_customMem,
1861 ) -> *mut ZSTD_DStream;
1862 }
1863 extern "C" {
ZSTD_createCDict_advanced( dict: *const libc::c_void, dictSize: usize, dictLoadMethod: ZSTD_dictLoadMethod_e, dictContentType: ZSTD_dictContentType_e, cParams: ZSTD_compressionParameters, customMem: ZSTD_customMem, ) -> *mut ZSTD_CDict1864 pub fn ZSTD_createCDict_advanced(
1865 dict: *const libc::c_void,
1866 dictSize: usize,
1867 dictLoadMethod: ZSTD_dictLoadMethod_e,
1868 dictContentType: ZSTD_dictContentType_e,
1869 cParams: ZSTD_compressionParameters,
1870 customMem: ZSTD_customMem,
1871 ) -> *mut ZSTD_CDict;
1872 }
1873 #[repr(C)]
1874 #[derive(Debug, Copy, Clone)]
1875 pub struct POOL_ctx_s {
1876 _unused: [u8; 0],
1877 }
1878 pub type ZSTD_threadPool = POOL_ctx_s;
1879 extern "C" {
ZSTD_createThreadPool(numThreads: usize) -> *mut ZSTD_threadPool1880 pub fn ZSTD_createThreadPool(numThreads: usize) -> *mut ZSTD_threadPool;
1881 }
1882 extern "C" {
ZSTD_freeThreadPool(pool: *mut ZSTD_threadPool)1883 pub fn ZSTD_freeThreadPool(pool: *mut ZSTD_threadPool);
1884 }
1885 extern "C" {
ZSTD_CCtx_refThreadPool( cctx: *mut ZSTD_CCtx, pool: *mut ZSTD_threadPool, ) -> usize1886 pub fn ZSTD_CCtx_refThreadPool(
1887 cctx: *mut ZSTD_CCtx,
1888 pool: *mut ZSTD_threadPool,
1889 ) -> usize;
1890 }
1891 extern "C" {
ZSTD_createCDict_advanced2( dict: *const libc::c_void, dictSize: usize, dictLoadMethod: ZSTD_dictLoadMethod_e, dictContentType: ZSTD_dictContentType_e, cctxParams: *const ZSTD_CCtx_params, customMem: ZSTD_customMem, ) -> *mut ZSTD_CDict1892 pub fn ZSTD_createCDict_advanced2(
1893 dict: *const libc::c_void,
1894 dictSize: usize,
1895 dictLoadMethod: ZSTD_dictLoadMethod_e,
1896 dictContentType: ZSTD_dictContentType_e,
1897 cctxParams: *const ZSTD_CCtx_params,
1898 customMem: ZSTD_customMem,
1899 ) -> *mut ZSTD_CDict;
1900 }
1901 extern "C" {
ZSTD_createDDict_advanced( dict: *const libc::c_void, dictSize: usize, dictLoadMethod: ZSTD_dictLoadMethod_e, dictContentType: ZSTD_dictContentType_e, customMem: ZSTD_customMem, ) -> *mut ZSTD_DDict1902 pub fn ZSTD_createDDict_advanced(
1903 dict: *const libc::c_void,
1904 dictSize: usize,
1905 dictLoadMethod: ZSTD_dictLoadMethod_e,
1906 dictContentType: ZSTD_dictContentType_e,
1907 customMem: ZSTD_customMem,
1908 ) -> *mut ZSTD_DDict;
1909 }
1910 extern "C" {
1911 #[doc = " ZSTD_createCDict_byReference() :"]
1912 #[doc = " Create a digested dictionary for compression"]
1913 #[doc = " Dictionary content is just referenced, not duplicated."]
1914 #[doc = " As a consequence, `dictBuffer` **must** outlive CDict,"]
1915 #[doc = " and its content must remain unmodified throughout the lifetime of CDict."]
1916 #[doc = " note: equivalent to ZSTD_createCDict_advanced(), with dictLoadMethod==ZSTD_dlm_byRef"]
ZSTD_createCDict_byReference( dictBuffer: *const libc::c_void, dictSize: usize, compressionLevel: libc::c_int, ) -> *mut ZSTD_CDict1917 pub fn ZSTD_createCDict_byReference(
1918 dictBuffer: *const libc::c_void,
1919 dictSize: usize,
1920 compressionLevel: libc::c_int,
1921 ) -> *mut ZSTD_CDict;
1922 }
1923 extern "C" {
1924 #[doc = " ZSTD_getDictID_fromCDict() :"]
1925 #[doc = " Provides the dictID of the dictionary loaded into `cdict`."]
1926 #[doc = " If @return == 0, the dictionary is not conformant to Zstandard specification, or empty."]
1927 #[doc = " Non-conformant dictionaries can still be loaded, but as content-only dictionaries."]
ZSTD_getDictID_fromCDict(cdict: *const ZSTD_CDict) -> libc::c_uint1928 pub fn ZSTD_getDictID_fromCDict(cdict: *const ZSTD_CDict) -> libc::c_uint;
1929 }
1930 extern "C" {
1931 #[doc = " ZSTD_getCParams() :"]
1932 #[doc = " @return ZSTD_compressionParameters structure for a selected compression level and estimated srcSize."]
1933 #[doc = " `estimatedSrcSize` value is optional, select 0 if not known"]
ZSTD_getCParams( compressionLevel: libc::c_int, estimatedSrcSize: libc::c_ulonglong, dictSize: usize, ) -> ZSTD_compressionParameters1934 pub fn ZSTD_getCParams(
1935 compressionLevel: libc::c_int,
1936 estimatedSrcSize: libc::c_ulonglong,
1937 dictSize: usize,
1938 ) -> ZSTD_compressionParameters;
1939 }
1940 extern "C" {
1941 #[doc = " ZSTD_getParams() :"]
1942 #[doc = " same as ZSTD_getCParams(), but @return a full `ZSTD_parameters` object instead of sub-component `ZSTD_compressionParameters`."]
1943 #[doc = " All fields of `ZSTD_frameParameters` are set to default : contentSize=1, checksum=0, noDictID=0"]
ZSTD_getParams( compressionLevel: libc::c_int, estimatedSrcSize: libc::c_ulonglong, dictSize: usize, ) -> ZSTD_parameters1944 pub fn ZSTD_getParams(
1945 compressionLevel: libc::c_int,
1946 estimatedSrcSize: libc::c_ulonglong,
1947 dictSize: usize,
1948 ) -> ZSTD_parameters;
1949 }
1950 extern "C" {
1951 #[doc = " ZSTD_checkCParams() :"]
1952 #[doc = " Ensure param values remain within authorized range."]
1953 #[doc = " @return 0 on success, or an error code (can be checked with ZSTD_isError())"]
ZSTD_checkCParams(params: ZSTD_compressionParameters) -> usize1954 pub fn ZSTD_checkCParams(params: ZSTD_compressionParameters) -> usize;
1955 }
1956 extern "C" {
1957 #[doc = " ZSTD_adjustCParams() :"]
1958 #[doc = " optimize params for a given `srcSize` and `dictSize`."]
1959 #[doc = " `srcSize` can be unknown, in which case use ZSTD_CONTENTSIZE_UNKNOWN."]
1960 #[doc = " `dictSize` must be `0` when there is no dictionary."]
1961 #[doc = " cPar can be invalid : all parameters will be clamped within valid range in the @return struct."]
1962 #[doc = " This function never fails (wide contract)"]
ZSTD_adjustCParams( cPar: ZSTD_compressionParameters, srcSize: libc::c_ulonglong, dictSize: usize, ) -> ZSTD_compressionParameters1963 pub fn ZSTD_adjustCParams(
1964 cPar: ZSTD_compressionParameters,
1965 srcSize: libc::c_ulonglong,
1966 dictSize: usize,
1967 ) -> ZSTD_compressionParameters;
1968 }
1969 extern "C" {
1970 #[doc = " ZSTD_compress_advanced() :"]
1971 #[doc = " Note : this function is now DEPRECATED."]
1972 #[doc = " It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_setParameter() and other parameter setters."]
1973 #[doc = " This prototype will be marked as deprecated and generate compilation warning on reaching v1.5.x"]
ZSTD_compress_advanced( cctx: *mut ZSTD_CCtx, dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, dict: *const libc::c_void, dictSize: usize, params: ZSTD_parameters, ) -> usize1974 pub fn ZSTD_compress_advanced(
1975 cctx: *mut ZSTD_CCtx,
1976 dst: *mut libc::c_void,
1977 dstCapacity: usize,
1978 src: *const libc::c_void,
1979 srcSize: usize,
1980 dict: *const libc::c_void,
1981 dictSize: usize,
1982 params: ZSTD_parameters,
1983 ) -> usize;
1984 }
1985 extern "C" {
1986 #[doc = " ZSTD_compress_usingCDict_advanced() :"]
1987 #[doc = " Note : this function is now REDUNDANT."]
1988 #[doc = " It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_loadDictionary() and other parameter setters."]
1989 #[doc = " This prototype will be marked as deprecated and generate compilation warning in some future version"]
ZSTD_compress_usingCDict_advanced( cctx: *mut ZSTD_CCtx, dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, cdict: *const ZSTD_CDict, fParams: ZSTD_frameParameters, ) -> usize1990 pub fn ZSTD_compress_usingCDict_advanced(
1991 cctx: *mut ZSTD_CCtx,
1992 dst: *mut libc::c_void,
1993 dstCapacity: usize,
1994 src: *const libc::c_void,
1995 srcSize: usize,
1996 cdict: *const ZSTD_CDict,
1997 fParams: ZSTD_frameParameters,
1998 ) -> usize;
1999 }
2000 extern "C" {
2001 #[doc = " ZSTD_CCtx_loadDictionary_byReference() :"]
2002 #[doc = " Same as ZSTD_CCtx_loadDictionary(), but dictionary content is referenced, instead of being copied into CCtx."]
2003 #[doc = " It saves some memory, but also requires that `dict` outlives its usage within `cctx`"]
ZSTD_CCtx_loadDictionary_byReference( cctx: *mut ZSTD_CCtx, dict: *const libc::c_void, dictSize: usize, ) -> usize2004 pub fn ZSTD_CCtx_loadDictionary_byReference(
2005 cctx: *mut ZSTD_CCtx,
2006 dict: *const libc::c_void,
2007 dictSize: usize,
2008 ) -> usize;
2009 }
2010 extern "C" {
2011 #[doc = " ZSTD_CCtx_loadDictionary_advanced() :"]
2012 #[doc = " Same as ZSTD_CCtx_loadDictionary(), but gives finer control over"]
2013 #[doc = " how to load the dictionary (by copy ? by reference ?)"]
2014 #[doc = " and how to interpret it (automatic ? force raw mode ? full mode only ?)"]
ZSTD_CCtx_loadDictionary_advanced( cctx: *mut ZSTD_CCtx, dict: *const libc::c_void, dictSize: usize, dictLoadMethod: ZSTD_dictLoadMethod_e, dictContentType: ZSTD_dictContentType_e, ) -> usize2015 pub fn ZSTD_CCtx_loadDictionary_advanced(
2016 cctx: *mut ZSTD_CCtx,
2017 dict: *const libc::c_void,
2018 dictSize: usize,
2019 dictLoadMethod: ZSTD_dictLoadMethod_e,
2020 dictContentType: ZSTD_dictContentType_e,
2021 ) -> usize;
2022 }
2023 extern "C" {
2024 #[doc = " ZSTD_CCtx_refPrefix_advanced() :"]
2025 #[doc = " Same as ZSTD_CCtx_refPrefix(), but gives finer control over"]
2026 #[doc = " how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?)"]
ZSTD_CCtx_refPrefix_advanced( cctx: *mut ZSTD_CCtx, prefix: *const libc::c_void, prefixSize: usize, dictContentType: ZSTD_dictContentType_e, ) -> usize2027 pub fn ZSTD_CCtx_refPrefix_advanced(
2028 cctx: *mut ZSTD_CCtx,
2029 prefix: *const libc::c_void,
2030 prefixSize: usize,
2031 dictContentType: ZSTD_dictContentType_e,
2032 ) -> usize;
2033 }
2034 extern "C" {
2035 #[doc = " ZSTD_CCtx_getParameter() :"]
2036 #[doc = " Get the requested compression parameter value, selected by enum ZSTD_cParameter,"]
2037 #[doc = " and store it into int* value."]
2038 #[doc = " @return : 0, or an error code (which can be tested with ZSTD_isError())."]
ZSTD_CCtx_getParameter( cctx: *mut ZSTD_CCtx, param: ZSTD_cParameter, value: *mut libc::c_int, ) -> usize2039 pub fn ZSTD_CCtx_getParameter(
2040 cctx: *mut ZSTD_CCtx,
2041 param: ZSTD_cParameter,
2042 value: *mut libc::c_int,
2043 ) -> usize;
2044 }
2045 extern "C" {
2046 #[doc = " ZSTD_CCtx_params :"]
2047 #[doc = " Quick howto :"]
2048 #[doc = " - ZSTD_createCCtxParams() : Create a ZSTD_CCtx_params structure"]
2049 #[doc = " - ZSTD_CCtxParams_setParameter() : Push parameters one by one into"]
2050 #[doc = " an existing ZSTD_CCtx_params structure."]
2051 #[doc = " This is similar to"]
2052 #[doc = " ZSTD_CCtx_setParameter()."]
2053 #[doc = " - ZSTD_CCtx_setParametersUsingCCtxParams() : Apply parameters to"]
2054 #[doc = " an existing CCtx."]
2055 #[doc = " These parameters will be applied to"]
2056 #[doc = " all subsequent frames."]
2057 #[doc = " - ZSTD_compressStream2() : Do compression using the CCtx."]
2058 #[doc = " - ZSTD_freeCCtxParams() : Free the memory."]
2059 #[doc = ""]
2060 #[doc = " This can be used with ZSTD_estimateCCtxSize_advanced_usingCCtxParams()"]
2061 #[doc = " for static allocation of CCtx for single-threaded compression."]
ZSTD_createCCtxParams() -> *mut ZSTD_CCtx_params2062 pub fn ZSTD_createCCtxParams() -> *mut ZSTD_CCtx_params;
2063 }
2064 extern "C" {
ZSTD_freeCCtxParams(params: *mut ZSTD_CCtx_params) -> usize2065 pub fn ZSTD_freeCCtxParams(params: *mut ZSTD_CCtx_params) -> usize;
2066 }
2067 extern "C" {
2068 #[doc = " ZSTD_CCtxParams_reset() :"]
2069 #[doc = " Reset params to default values."]
ZSTD_CCtxParams_reset(params: *mut ZSTD_CCtx_params) -> usize2070 pub fn ZSTD_CCtxParams_reset(params: *mut ZSTD_CCtx_params) -> usize;
2071 }
2072 extern "C" {
2073 #[doc = " ZSTD_CCtxParams_init() :"]
2074 #[doc = " Initializes the compression parameters of cctxParams according to"]
2075 #[doc = " compression level. All other parameters are reset to their default values."]
ZSTD_CCtxParams_init( cctxParams: *mut ZSTD_CCtx_params, compressionLevel: libc::c_int, ) -> usize2076 pub fn ZSTD_CCtxParams_init(
2077 cctxParams: *mut ZSTD_CCtx_params,
2078 compressionLevel: libc::c_int,
2079 ) -> usize;
2080 }
2081 extern "C" {
2082 #[doc = " ZSTD_CCtxParams_init_advanced() :"]
2083 #[doc = " Initializes the compression and frame parameters of cctxParams according to"]
2084 #[doc = " params. All other parameters are reset to their default values."]
ZSTD_CCtxParams_init_advanced( cctxParams: *mut ZSTD_CCtx_params, params: ZSTD_parameters, ) -> usize2085 pub fn ZSTD_CCtxParams_init_advanced(
2086 cctxParams: *mut ZSTD_CCtx_params,
2087 params: ZSTD_parameters,
2088 ) -> usize;
2089 }
2090 extern "C" {
2091 #[doc = " ZSTD_CCtxParams_setParameter() :"]
2092 #[doc = " Similar to ZSTD_CCtx_setParameter."]
2093 #[doc = " Set one compression parameter, selected by enum ZSTD_cParameter."]
2094 #[doc = " Parameters must be applied to a ZSTD_CCtx using"]
2095 #[doc = " ZSTD_CCtx_setParametersUsingCCtxParams()."]
2096 #[doc = " @result : a code representing success or failure (which can be tested with"]
2097 #[doc = " ZSTD_isError())."]
ZSTD_CCtxParams_setParameter( params: *mut ZSTD_CCtx_params, param: ZSTD_cParameter, value: libc::c_int, ) -> usize2098 pub fn ZSTD_CCtxParams_setParameter(
2099 params: *mut ZSTD_CCtx_params,
2100 param: ZSTD_cParameter,
2101 value: libc::c_int,
2102 ) -> usize;
2103 }
2104 extern "C" {
2105 #[doc = " ZSTD_CCtxParams_getParameter() :"]
2106 #[doc = " Similar to ZSTD_CCtx_getParameter."]
2107 #[doc = " Get the requested value of one compression parameter, selected by enum ZSTD_cParameter."]
2108 #[doc = " @result : 0, or an error code (which can be tested with ZSTD_isError())."]
ZSTD_CCtxParams_getParameter( params: *mut ZSTD_CCtx_params, param: ZSTD_cParameter, value: *mut libc::c_int, ) -> usize2109 pub fn ZSTD_CCtxParams_getParameter(
2110 params: *mut ZSTD_CCtx_params,
2111 param: ZSTD_cParameter,
2112 value: *mut libc::c_int,
2113 ) -> usize;
2114 }
2115 extern "C" {
2116 #[doc = " ZSTD_CCtx_setParametersUsingCCtxParams() :"]
2117 #[doc = " Apply a set of ZSTD_CCtx_params to the compression context."]
2118 #[doc = " This can be done even after compression is started,"]
2119 #[doc = " if nbWorkers==0, this will have no impact until a new compression is started."]
2120 #[doc = " if nbWorkers>=1, new parameters will be picked up at next job,"]
2121 #[doc = " with a few restrictions (windowLog, pledgedSrcSize, nbWorkers, jobSize, and overlapLog are not updated)."]
ZSTD_CCtx_setParametersUsingCCtxParams( cctx: *mut ZSTD_CCtx, params: *const ZSTD_CCtx_params, ) -> usize2122 pub fn ZSTD_CCtx_setParametersUsingCCtxParams(
2123 cctx: *mut ZSTD_CCtx,
2124 params: *const ZSTD_CCtx_params,
2125 ) -> usize;
2126 }
2127 extern "C" {
2128 #[doc = " ZSTD_compressStream2_simpleArgs() :"]
2129 #[doc = " Same as ZSTD_compressStream2(),"]
2130 #[doc = " but using only integral types as arguments."]
2131 #[doc = " This variant might be helpful for binders from dynamic languages"]
2132 #[doc = " which have troubles handling structures containing memory pointers."]
ZSTD_compressStream2_simpleArgs( cctx: *mut ZSTD_CCtx, dst: *mut libc::c_void, dstCapacity: usize, dstPos: *mut usize, src: *const libc::c_void, srcSize: usize, srcPos: *mut usize, endOp: ZSTD_EndDirective, ) -> usize2133 pub fn ZSTD_compressStream2_simpleArgs(
2134 cctx: *mut ZSTD_CCtx,
2135 dst: *mut libc::c_void,
2136 dstCapacity: usize,
2137 dstPos: *mut usize,
2138 src: *const libc::c_void,
2139 srcSize: usize,
2140 srcPos: *mut usize,
2141 endOp: ZSTD_EndDirective,
2142 ) -> usize;
2143 }
2144 extern "C" {
2145 #[doc = " ZSTD_isFrame() :"]
2146 #[doc = " Tells if the content of `buffer` starts with a valid Frame Identifier."]
2147 #[doc = " Note : Frame Identifier is 4 bytes. If `size < 4`, @return will always be 0."]
2148 #[doc = " Note 2 : Legacy Frame Identifiers are considered valid only if Legacy Support is enabled."]
2149 #[doc = " Note 3 : Skippable Frame Identifiers are considered valid."]
ZSTD_isFrame( buffer: *const libc::c_void, size: usize, ) -> libc::c_uint2150 pub fn ZSTD_isFrame(
2151 buffer: *const libc::c_void,
2152 size: usize,
2153 ) -> libc::c_uint;
2154 }
2155 extern "C" {
2156 #[doc = " ZSTD_createDDict_byReference() :"]
2157 #[doc = " Create a digested dictionary, ready to start decompression operation without startup delay."]
2158 #[doc = " Dictionary content is referenced, and therefore stays in dictBuffer."]
2159 #[doc = " It is important that dictBuffer outlives DDict,"]
2160 #[doc = " it must remain read accessible throughout the lifetime of DDict"]
ZSTD_createDDict_byReference( dictBuffer: *const libc::c_void, dictSize: usize, ) -> *mut ZSTD_DDict2161 pub fn ZSTD_createDDict_byReference(
2162 dictBuffer: *const libc::c_void,
2163 dictSize: usize,
2164 ) -> *mut ZSTD_DDict;
2165 }
2166 extern "C" {
2167 #[doc = " ZSTD_DCtx_loadDictionary_byReference() :"]
2168 #[doc = " Same as ZSTD_DCtx_loadDictionary(),"]
2169 #[doc = " but references `dict` content instead of copying it into `dctx`."]
2170 #[doc = " This saves memory if `dict` remains around.,"]
2171 #[doc = " However, it's imperative that `dict` remains accessible (and unmodified) while being used, so it must outlive decompression."]
ZSTD_DCtx_loadDictionary_byReference( dctx: *mut ZSTD_DCtx, dict: *const libc::c_void, dictSize: usize, ) -> usize2172 pub fn ZSTD_DCtx_loadDictionary_byReference(
2173 dctx: *mut ZSTD_DCtx,
2174 dict: *const libc::c_void,
2175 dictSize: usize,
2176 ) -> usize;
2177 }
2178 extern "C" {
2179 #[doc = " ZSTD_DCtx_loadDictionary_advanced() :"]
2180 #[doc = " Same as ZSTD_DCtx_loadDictionary(),"]
2181 #[doc = " but gives direct control over"]
2182 #[doc = " how to load the dictionary (by copy ? by reference ?)"]
2183 #[doc = " and how to interpret it (automatic ? force raw mode ? full mode only ?)."]
ZSTD_DCtx_loadDictionary_advanced( dctx: *mut ZSTD_DCtx, dict: *const libc::c_void, dictSize: usize, dictLoadMethod: ZSTD_dictLoadMethod_e, dictContentType: ZSTD_dictContentType_e, ) -> usize2184 pub fn ZSTD_DCtx_loadDictionary_advanced(
2185 dctx: *mut ZSTD_DCtx,
2186 dict: *const libc::c_void,
2187 dictSize: usize,
2188 dictLoadMethod: ZSTD_dictLoadMethod_e,
2189 dictContentType: ZSTD_dictContentType_e,
2190 ) -> usize;
2191 }
2192 extern "C" {
2193 #[doc = " ZSTD_DCtx_refPrefix_advanced() :"]
2194 #[doc = " Same as ZSTD_DCtx_refPrefix(), but gives finer control over"]
2195 #[doc = " how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?)"]
ZSTD_DCtx_refPrefix_advanced( dctx: *mut ZSTD_DCtx, prefix: *const libc::c_void, prefixSize: usize, dictContentType: ZSTD_dictContentType_e, ) -> usize2196 pub fn ZSTD_DCtx_refPrefix_advanced(
2197 dctx: *mut ZSTD_DCtx,
2198 prefix: *const libc::c_void,
2199 prefixSize: usize,
2200 dictContentType: ZSTD_dictContentType_e,
2201 ) -> usize;
2202 }
2203 extern "C" {
2204 #[doc = " ZSTD_DCtx_setMaxWindowSize() :"]
2205 #[doc = " Refuses allocating internal buffers for frames requiring a window size larger than provided limit."]
2206 #[doc = " This protects a decoder context from reserving too much memory for itself (potential attack scenario)."]
2207 #[doc = " This parameter is only useful in streaming mode, since no internal buffer is allocated in single-pass mode."]
2208 #[doc = " By default, a decompression context accepts all window sizes <= (1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT)"]
2209 #[doc = " @return : 0, or an error code (which can be tested using ZSTD_isError())."]
ZSTD_DCtx_setMaxWindowSize( dctx: *mut ZSTD_DCtx, maxWindowSize: usize, ) -> usize2210 pub fn ZSTD_DCtx_setMaxWindowSize(
2211 dctx: *mut ZSTD_DCtx,
2212 maxWindowSize: usize,
2213 ) -> usize;
2214 }
2215 extern "C" {
2216 #[doc = " ZSTD_DCtx_getParameter() :"]
2217 #[doc = " Get the requested decompression parameter value, selected by enum ZSTD_dParameter,"]
2218 #[doc = " and store it into int* value."]
2219 #[doc = " @return : 0, or an error code (which can be tested with ZSTD_isError())."]
ZSTD_DCtx_getParameter( dctx: *mut ZSTD_DCtx, param: ZSTD_dParameter, value: *mut libc::c_int, ) -> usize2220 pub fn ZSTD_DCtx_getParameter(
2221 dctx: *mut ZSTD_DCtx,
2222 param: ZSTD_dParameter,
2223 value: *mut libc::c_int,
2224 ) -> usize;
2225 }
2226 extern "C" {
2227 #[doc = " ZSTD_DCtx_setFormat() :"]
2228 #[doc = " Instruct the decoder context about what kind of data to decode next."]
2229 #[doc = " This instruction is mandatory to decode data without a fully-formed header,"]
2230 #[doc = " such ZSTD_f_zstd1_magicless for example."]
2231 #[doc = " @return : 0, or an error code (which can be tested using ZSTD_isError())."]
ZSTD_DCtx_setFormat( dctx: *mut ZSTD_DCtx, format: ZSTD_format_e, ) -> usize2232 pub fn ZSTD_DCtx_setFormat(
2233 dctx: *mut ZSTD_DCtx,
2234 format: ZSTD_format_e,
2235 ) -> usize;
2236 }
2237 extern "C" {
2238 #[doc = " ZSTD_decompressStream_simpleArgs() :"]
2239 #[doc = " Same as ZSTD_decompressStream(),"]
2240 #[doc = " but using only integral types as arguments."]
2241 #[doc = " This can be helpful for binders from dynamic languages"]
2242 #[doc = " which have troubles handling structures containing memory pointers."]
ZSTD_decompressStream_simpleArgs( dctx: *mut ZSTD_DCtx, dst: *mut libc::c_void, dstCapacity: usize, dstPos: *mut usize, src: *const libc::c_void, srcSize: usize, srcPos: *mut usize, ) -> usize2243 pub fn ZSTD_decompressStream_simpleArgs(
2244 dctx: *mut ZSTD_DCtx,
2245 dst: *mut libc::c_void,
2246 dstCapacity: usize,
2247 dstPos: *mut usize,
2248 src: *const libc::c_void,
2249 srcSize: usize,
2250 srcPos: *mut usize,
2251 ) -> usize;
2252 }
2253 extern "C" {
2254 #[doc = " ZSTD_initCStream_srcSize() :"]
2255 #[doc = " This function is deprecated, and equivalent to:"]
2256 #[doc = " ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);"]
2257 #[doc = " ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any)"]
2258 #[doc = " ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);"]
2259 #[doc = " ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);"]
2260 #[doc = ""]
2261 #[doc = " pledgedSrcSize must be correct. If it is not known at init time, use"]
2262 #[doc = " ZSTD_CONTENTSIZE_UNKNOWN. Note that, for compatibility with older programs,"]
2263 #[doc = " \"0\" also disables frame content size field. It may be enabled in the future."]
2264 #[doc = " Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x"]
ZSTD_initCStream_srcSize( zcs: *mut ZSTD_CStream, compressionLevel: libc::c_int, pledgedSrcSize: libc::c_ulonglong, ) -> usize2265 pub fn ZSTD_initCStream_srcSize(
2266 zcs: *mut ZSTD_CStream,
2267 compressionLevel: libc::c_int,
2268 pledgedSrcSize: libc::c_ulonglong,
2269 ) -> usize;
2270 }
2271 extern "C" {
2272 #[doc = " ZSTD_initCStream_usingDict() :"]
2273 #[doc = " This function is deprecated, and is equivalent to:"]
2274 #[doc = " ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);"]
2275 #[doc = " ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);"]
2276 #[doc = " ZSTD_CCtx_loadDictionary(zcs, dict, dictSize);"]
2277 #[doc = ""]
2278 #[doc = " Creates of an internal CDict (incompatible with static CCtx), except if"]
2279 #[doc = " dict == NULL or dictSize < 8, in which case no dict is used."]
2280 #[doc = " Note: dict is loaded with ZSTD_dct_auto (treated as a full zstd dictionary if"]
2281 #[doc = " it begins with ZSTD_MAGIC_DICTIONARY, else as raw content) and ZSTD_dlm_byCopy."]
2282 #[doc = " Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x"]
ZSTD_initCStream_usingDict( zcs: *mut ZSTD_CStream, dict: *const libc::c_void, dictSize: usize, compressionLevel: libc::c_int, ) -> usize2283 pub fn ZSTD_initCStream_usingDict(
2284 zcs: *mut ZSTD_CStream,
2285 dict: *const libc::c_void,
2286 dictSize: usize,
2287 compressionLevel: libc::c_int,
2288 ) -> usize;
2289 }
2290 extern "C" {
2291 #[doc = " ZSTD_initCStream_advanced() :"]
2292 #[doc = " This function is deprecated, and is approximately equivalent to:"]
2293 #[doc = " ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);"]
2294 #[doc = " // Pseudocode: Set each zstd parameter and leave the rest as-is."]
2295 #[doc = " for ((param, value) : params) {"]
2296 #[doc = " ZSTD_CCtx_setParameter(zcs, param, value);"]
2297 #[doc = " }"]
2298 #[doc = " ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);"]
2299 #[doc = " ZSTD_CCtx_loadDictionary(zcs, dict, dictSize);"]
2300 #[doc = ""]
2301 #[doc = " dict is loaded with ZSTD_dct_auto and ZSTD_dlm_byCopy."]
2302 #[doc = " pledgedSrcSize must be correct."]
2303 #[doc = " If srcSize is not known at init time, use value ZSTD_CONTENTSIZE_UNKNOWN."]
2304 #[doc = " Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x"]
ZSTD_initCStream_advanced( zcs: *mut ZSTD_CStream, dict: *const libc::c_void, dictSize: usize, params: ZSTD_parameters, pledgedSrcSize: libc::c_ulonglong, ) -> usize2305 pub fn ZSTD_initCStream_advanced(
2306 zcs: *mut ZSTD_CStream,
2307 dict: *const libc::c_void,
2308 dictSize: usize,
2309 params: ZSTD_parameters,
2310 pledgedSrcSize: libc::c_ulonglong,
2311 ) -> usize;
2312 }
2313 extern "C" {
2314 #[doc = " ZSTD_initCStream_usingCDict() :"]
2315 #[doc = " This function is deprecated, and equivalent to:"]
2316 #[doc = " ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);"]
2317 #[doc = " ZSTD_CCtx_refCDict(zcs, cdict);"]
2318 #[doc = ""]
2319 #[doc = " note : cdict will just be referenced, and must outlive compression session"]
2320 #[doc = " Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x"]
ZSTD_initCStream_usingCDict( zcs: *mut ZSTD_CStream, cdict: *const ZSTD_CDict, ) -> usize2321 pub fn ZSTD_initCStream_usingCDict(
2322 zcs: *mut ZSTD_CStream,
2323 cdict: *const ZSTD_CDict,
2324 ) -> usize;
2325 }
2326 extern "C" {
2327 #[doc = " ZSTD_initCStream_usingCDict_advanced() :"]
2328 #[doc = " This function is DEPRECATED, and is approximately equivalent to:"]
2329 #[doc = " ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);"]
2330 #[doc = " // Pseudocode: Set each zstd frame parameter and leave the rest as-is."]
2331 #[doc = " for ((fParam, value) : fParams) {"]
2332 #[doc = " ZSTD_CCtx_setParameter(zcs, fParam, value);"]
2333 #[doc = " }"]
2334 #[doc = " ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);"]
2335 #[doc = " ZSTD_CCtx_refCDict(zcs, cdict);"]
2336 #[doc = ""]
2337 #[doc = " same as ZSTD_initCStream_usingCDict(), with control over frame parameters."]
2338 #[doc = " pledgedSrcSize must be correct. If srcSize is not known at init time, use"]
2339 #[doc = " value ZSTD_CONTENTSIZE_UNKNOWN."]
2340 #[doc = " Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x"]
ZSTD_initCStream_usingCDict_advanced( zcs: *mut ZSTD_CStream, cdict: *const ZSTD_CDict, fParams: ZSTD_frameParameters, pledgedSrcSize: libc::c_ulonglong, ) -> usize2341 pub fn ZSTD_initCStream_usingCDict_advanced(
2342 zcs: *mut ZSTD_CStream,
2343 cdict: *const ZSTD_CDict,
2344 fParams: ZSTD_frameParameters,
2345 pledgedSrcSize: libc::c_ulonglong,
2346 ) -> usize;
2347 }
2348 extern "C" {
2349 #[doc = " ZSTD_resetCStream() :"]
2350 #[doc = " This function is deprecated, and is equivalent to:"]
2351 #[doc = " ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);"]
2352 #[doc = " ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);"]
2353 #[doc = ""]
2354 #[doc = " start a new frame, using same parameters from previous frame."]
2355 #[doc = " This is typically useful to skip dictionary loading stage, since it will re-use it in-place."]
2356 #[doc = " Note that zcs must be init at least once before using ZSTD_resetCStream()."]
2357 #[doc = " If pledgedSrcSize is not known at reset time, use macro ZSTD_CONTENTSIZE_UNKNOWN."]
2358 #[doc = " If pledgedSrcSize > 0, its value must be correct, as it will be written in header, and controlled at the end."]
2359 #[doc = " For the time being, pledgedSrcSize==0 is interpreted as \"srcSize unknown\" for compatibility with older programs,"]
2360 #[doc = " but it will change to mean \"empty\" in future version, so use macro ZSTD_CONTENTSIZE_UNKNOWN instead."]
2361 #[doc = " @return : 0, or an error code (which can be tested using ZSTD_isError())"]
2362 #[doc = " Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x"]
ZSTD_resetCStream( zcs: *mut ZSTD_CStream, pledgedSrcSize: libc::c_ulonglong, ) -> usize2363 pub fn ZSTD_resetCStream(
2364 zcs: *mut ZSTD_CStream,
2365 pledgedSrcSize: libc::c_ulonglong,
2366 ) -> usize;
2367 }
2368 #[repr(C)]
2369 #[derive(Debug, Copy, Clone)]
2370 pub struct ZSTD_frameProgression {
2371 pub ingested: libc::c_ulonglong,
2372 pub consumed: libc::c_ulonglong,
2373 pub produced: libc::c_ulonglong,
2374 pub flushed: libc::c_ulonglong,
2375 pub currentJobID: libc::c_uint,
2376 pub nbActiveWorkers: libc::c_uint,
2377 }
2378 #[test]
bindgen_test_layout_ZSTD_frameProgression()2379 fn bindgen_test_layout_ZSTD_frameProgression() {
2380 assert_eq!(
2381 ::core::mem::size_of::<ZSTD_frameProgression>(),
2382 40usize,
2383 concat!("Size of: ", stringify!(ZSTD_frameProgression))
2384 );
2385 assert_eq!(
2386 ::core::mem::align_of::<ZSTD_frameProgression>(),
2387 8usize,
2388 concat!("Alignment of ", stringify!(ZSTD_frameProgression))
2389 );
2390 assert_eq!(
2391 unsafe {
2392 &(*(::core::ptr::null::<ZSTD_frameProgression>())).ingested
2393 as *const _ as usize
2394 },
2395 0usize,
2396 concat!(
2397 "Offset of field: ",
2398 stringify!(ZSTD_frameProgression),
2399 "::",
2400 stringify!(ingested)
2401 )
2402 );
2403 assert_eq!(
2404 unsafe {
2405 &(*(::core::ptr::null::<ZSTD_frameProgression>())).consumed
2406 as *const _ as usize
2407 },
2408 8usize,
2409 concat!(
2410 "Offset of field: ",
2411 stringify!(ZSTD_frameProgression),
2412 "::",
2413 stringify!(consumed)
2414 )
2415 );
2416 assert_eq!(
2417 unsafe {
2418 &(*(::core::ptr::null::<ZSTD_frameProgression>())).produced
2419 as *const _ as usize
2420 },
2421 16usize,
2422 concat!(
2423 "Offset of field: ",
2424 stringify!(ZSTD_frameProgression),
2425 "::",
2426 stringify!(produced)
2427 )
2428 );
2429 assert_eq!(
2430 unsafe {
2431 &(*(::core::ptr::null::<ZSTD_frameProgression>())).flushed
2432 as *const _ as usize
2433 },
2434 24usize,
2435 concat!(
2436 "Offset of field: ",
2437 stringify!(ZSTD_frameProgression),
2438 "::",
2439 stringify!(flushed)
2440 )
2441 );
2442 assert_eq!(
2443 unsafe {
2444 &(*(::core::ptr::null::<ZSTD_frameProgression>())).currentJobID
2445 as *const _ as usize
2446 },
2447 32usize,
2448 concat!(
2449 "Offset of field: ",
2450 stringify!(ZSTD_frameProgression),
2451 "::",
2452 stringify!(currentJobID)
2453 )
2454 );
2455 assert_eq!(
2456 unsafe {
2457 &(*(::core::ptr::null::<ZSTD_frameProgression>())).nbActiveWorkers
2458 as *const _ as usize
2459 },
2460 36usize,
2461 concat!(
2462 "Offset of field: ",
2463 stringify!(ZSTD_frameProgression),
2464 "::",
2465 stringify!(nbActiveWorkers)
2466 )
2467 );
2468 }
2469 extern "C" {
ZSTD_getFrameProgression( cctx: *const ZSTD_CCtx, ) -> ZSTD_frameProgression2470 pub fn ZSTD_getFrameProgression(
2471 cctx: *const ZSTD_CCtx,
2472 ) -> ZSTD_frameProgression;
2473 }
2474 extern "C" {
2475 #[doc = " ZSTD_toFlushNow() :"]
2476 #[doc = " Tell how many bytes are ready to be flushed immediately."]
2477 #[doc = " Useful for multithreading scenarios (nbWorkers >= 1)."]
2478 #[doc = " Probe the oldest active job, defined as oldest job not yet entirely flushed,"]
2479 #[doc = " and check its output buffer."]
2480 #[doc = " @return : amount of data stored in oldest job and ready to be flushed immediately."]
2481 #[doc = " if @return == 0, it means either :"]
2482 #[doc = " + there is no active job (could be checked with ZSTD_frameProgression()), or"]
2483 #[doc = " + oldest job is still actively compressing data,"]
2484 #[doc = " but everything it has produced has also been flushed so far,"]
2485 #[doc = " therefore flush speed is limited by production speed of oldest job"]
2486 #[doc = " irrespective of the speed of concurrent (and newer) jobs."]
ZSTD_toFlushNow(cctx: *mut ZSTD_CCtx) -> usize2487 pub fn ZSTD_toFlushNow(cctx: *mut ZSTD_CCtx) -> usize;
2488 }
2489 extern "C" {
2490 #[doc = " This function is deprecated, and is equivalent to:"]
2491 #[doc = ""]
2492 #[doc = " ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);"]
2493 #[doc = " ZSTD_DCtx_loadDictionary(zds, dict, dictSize);"]
2494 #[doc = ""]
2495 #[doc = " note: no dictionary will be used if dict == NULL or dictSize < 8"]
2496 #[doc = " Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x"]
ZSTD_initDStream_usingDict( zds: *mut ZSTD_DStream, dict: *const libc::c_void, dictSize: usize, ) -> usize2497 pub fn ZSTD_initDStream_usingDict(
2498 zds: *mut ZSTD_DStream,
2499 dict: *const libc::c_void,
2500 dictSize: usize,
2501 ) -> usize;
2502 }
2503 extern "C" {
2504 #[doc = " This function is deprecated, and is equivalent to:"]
2505 #[doc = ""]
2506 #[doc = " ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);"]
2507 #[doc = " ZSTD_DCtx_refDDict(zds, ddict);"]
2508 #[doc = ""]
2509 #[doc = " note : ddict is referenced, it must outlive decompression session"]
2510 #[doc = " Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x"]
ZSTD_initDStream_usingDDict( zds: *mut ZSTD_DStream, ddict: *const ZSTD_DDict, ) -> usize2511 pub fn ZSTD_initDStream_usingDDict(
2512 zds: *mut ZSTD_DStream,
2513 ddict: *const ZSTD_DDict,
2514 ) -> usize;
2515 }
2516 extern "C" {
2517 #[doc = " This function is deprecated, and is equivalent to:"]
2518 #[doc = ""]
2519 #[doc = " ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);"]
2520 #[doc = ""]
2521 #[doc = " re-use decompression parameters from previous init; saves dictionary loading"]
2522 #[doc = " Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x"]
ZSTD_resetDStream(zds: *mut ZSTD_DStream) -> usize2523 pub fn ZSTD_resetDStream(zds: *mut ZSTD_DStream) -> usize;
2524 }
2525 extern "C" {
2526 #[doc = "Buffer-less streaming compression (synchronous mode)"]
2527 #[doc = ""]
2528 #[doc = "A ZSTD_CCtx object is required to track streaming operations."]
2529 #[doc = "Use ZSTD_createCCtx() / ZSTD_freeCCtx() to manage resource."]
2530 #[doc = "ZSTD_CCtx object can be re-used multiple times within successive compression operations."]
2531 #[doc = ""]
2532 #[doc = "Start by initializing a context."]
2533 #[doc = "Use ZSTD_compressBegin(), or ZSTD_compressBegin_usingDict() for dictionary compression,"]
2534 #[doc = "or ZSTD_compressBegin_advanced(), for finer parameter control."]
2535 #[doc = "It's also possible to duplicate a reference context which has already been initialized, using ZSTD_copyCCtx()"]
2536 #[doc = ""]
2537 #[doc = "Then, consume your input using ZSTD_compressContinue()."]
2538 #[doc = "There are some important considerations to keep in mind when using this advanced function :"]
2539 #[doc = "- ZSTD_compressContinue() has no internal buffer. It uses externally provided buffers only."]
2540 #[doc = "- Interface is synchronous : input is consumed entirely and produces 1+ compressed blocks."]
2541 #[doc = "- Caller must ensure there is enough space in `dst` to store compressed data under worst case scenario."]
2542 #[doc = "Worst case evaluation is provided by ZSTD_compressBound()."]
2543 #[doc = "ZSTD_compressContinue() doesn't guarantee recover after a failed compression."]
2544 #[doc = "- ZSTD_compressContinue() presumes prior input ***is still accessible and unmodified*** (up to maximum distance size, see WindowLog)."]
2545 #[doc = "It remembers all previous contiguous blocks, plus one separated memory segment (which can itself consists of multiple contiguous blocks)"]
2546 #[doc = "- ZSTD_compressContinue() detects that prior input has been overwritten when `src` buffer overlaps."]
2547 #[doc = "In which case, it will \"discard\" the relevant memory section from its history."]
2548 #[doc = ""]
2549 #[doc = "Finish a frame with ZSTD_compressEnd(), which will write the last block(s) and optional checksum."]
2550 #[doc = "It's possible to use srcSize==0, in which case, it will write a final empty block to end the frame."]
2551 #[doc = "Without last block mark, frames are considered unfinished (hence corrupted) by compliant decoders."]
2552 #[doc = ""]
2553 #[doc = "`ZSTD_CCtx` object can be re-used (ZSTD_compressBegin()) to compress again."]
ZSTD_compressBegin( cctx: *mut ZSTD_CCtx, compressionLevel: libc::c_int, ) -> usize2554 pub fn ZSTD_compressBegin(
2555 cctx: *mut ZSTD_CCtx,
2556 compressionLevel: libc::c_int,
2557 ) -> usize;
2558 }
2559 extern "C" {
ZSTD_compressBegin_usingDict( cctx: *mut ZSTD_CCtx, dict: *const libc::c_void, dictSize: usize, compressionLevel: libc::c_int, ) -> usize2560 pub fn ZSTD_compressBegin_usingDict(
2561 cctx: *mut ZSTD_CCtx,
2562 dict: *const libc::c_void,
2563 dictSize: usize,
2564 compressionLevel: libc::c_int,
2565 ) -> usize;
2566 }
2567 extern "C" {
ZSTD_compressBegin_advanced( cctx: *mut ZSTD_CCtx, dict: *const libc::c_void, dictSize: usize, params: ZSTD_parameters, pledgedSrcSize: libc::c_ulonglong, ) -> usize2568 pub fn ZSTD_compressBegin_advanced(
2569 cctx: *mut ZSTD_CCtx,
2570 dict: *const libc::c_void,
2571 dictSize: usize,
2572 params: ZSTD_parameters,
2573 pledgedSrcSize: libc::c_ulonglong,
2574 ) -> usize;
2575 }
2576 extern "C" {
ZSTD_compressBegin_usingCDict( cctx: *mut ZSTD_CCtx, cdict: *const ZSTD_CDict, ) -> usize2577 pub fn ZSTD_compressBegin_usingCDict(
2578 cctx: *mut ZSTD_CCtx,
2579 cdict: *const ZSTD_CDict,
2580 ) -> usize;
2581 }
2582 extern "C" {
ZSTD_compressBegin_usingCDict_advanced( cctx: *mut ZSTD_CCtx, cdict: *const ZSTD_CDict, fParams: ZSTD_frameParameters, pledgedSrcSize: libc::c_ulonglong, ) -> usize2583 pub fn ZSTD_compressBegin_usingCDict_advanced(
2584 cctx: *mut ZSTD_CCtx,
2585 cdict: *const ZSTD_CDict,
2586 fParams: ZSTD_frameParameters,
2587 pledgedSrcSize: libc::c_ulonglong,
2588 ) -> usize;
2589 }
2590 extern "C" {
ZSTD_copyCCtx( cctx: *mut ZSTD_CCtx, preparedCCtx: *const ZSTD_CCtx, pledgedSrcSize: libc::c_ulonglong, ) -> usize2591 pub fn ZSTD_copyCCtx(
2592 cctx: *mut ZSTD_CCtx,
2593 preparedCCtx: *const ZSTD_CCtx,
2594 pledgedSrcSize: libc::c_ulonglong,
2595 ) -> usize;
2596 }
2597 extern "C" {
ZSTD_compressContinue( cctx: *mut ZSTD_CCtx, dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, ) -> usize2598 pub fn ZSTD_compressContinue(
2599 cctx: *mut ZSTD_CCtx,
2600 dst: *mut libc::c_void,
2601 dstCapacity: usize,
2602 src: *const libc::c_void,
2603 srcSize: usize,
2604 ) -> usize;
2605 }
2606 extern "C" {
ZSTD_compressEnd( cctx: *mut ZSTD_CCtx, dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, ) -> usize2607 pub fn ZSTD_compressEnd(
2608 cctx: *mut ZSTD_CCtx,
2609 dst: *mut libc::c_void,
2610 dstCapacity: usize,
2611 src: *const libc::c_void,
2612 srcSize: usize,
2613 ) -> usize;
2614 }
2615 #[repr(u32)]
2616 #[doc = "Buffer-less streaming decompression (synchronous mode)"]
2617 #[doc = ""]
2618 #[doc = "A ZSTD_DCtx object is required to track streaming operations."]
2619 #[doc = "Use ZSTD_createDCtx() / ZSTD_freeDCtx() to manage it."]
2620 #[doc = "A ZSTD_DCtx object can be re-used multiple times."]
2621 #[doc = ""]
2622 #[doc = "First typical operation is to retrieve frame parameters, using ZSTD_getFrameHeader()."]
2623 #[doc = "Frame header is extracted from the beginning of compressed frame, so providing only the frame's beginning is enough."]
2624 #[doc = "Data fragment must be large enough to ensure successful decoding."]
2625 #[doc = "`ZSTD_frameHeaderSize_max` bytes is guaranteed to always be large enough."]
2626 #[doc = "@result : 0 : successful decoding, the `ZSTD_frameHeader` structure is correctly filled."]
2627 #[doc = ">0 : `srcSize` is too small, please provide at least @result bytes on next attempt."]
2628 #[doc = "errorCode, which can be tested using ZSTD_isError()."]
2629 #[doc = ""]
2630 #[doc = "It fills a ZSTD_frameHeader structure with important information to correctly decode the frame,"]
2631 #[doc = "such as the dictionary ID, content size, or maximum back-reference distance (`windowSize`)."]
2632 #[doc = "Note that these values could be wrong, either because of data corruption, or because a 3rd party deliberately spoofs false information."]
2633 #[doc = "As a consequence, check that values remain within valid application range."]
2634 #[doc = "For example, do not allocate memory blindly, check that `windowSize` is within expectation."]
2635 #[doc = "Each application can set its own limits, depending on local restrictions."]
2636 #[doc = "For extended interoperability, it is recommended to support `windowSize` of at least 8 MB."]
2637 #[doc = ""]
2638 #[doc = "ZSTD_decompressContinue() needs previous data blocks during decompression, up to `windowSize` bytes."]
2639 #[doc = "ZSTD_decompressContinue() is very sensitive to contiguity,"]
2640 #[doc = "if 2 blocks don't follow each other, make sure that either the compressor breaks contiguity at the same place,"]
2641 #[doc = "or that previous contiguous segment is large enough to properly handle maximum back-reference distance."]
2642 #[doc = "There are multiple ways to guarantee this condition."]
2643 #[doc = ""]
2644 #[doc = "The most memory efficient way is to use a round buffer of sufficient size."]
2645 #[doc = "Sufficient size is determined by invoking ZSTD_decodingBufferSize_min(),"]
2646 #[doc = "which can @return an error code if required value is too large for current system (in 32-bits mode)."]
2647 #[doc = "In a round buffer methodology, ZSTD_decompressContinue() decompresses each block next to previous one,"]
2648 #[doc = "up to the moment there is not enough room left in the buffer to guarantee decoding another full block,"]
2649 #[doc = "which maximum size is provided in `ZSTD_frameHeader` structure, field `blockSizeMax`."]
2650 #[doc = "At which point, decoding can resume from the beginning of the buffer."]
2651 #[doc = "Note that already decoded data stored in the buffer should be flushed before being overwritten."]
2652 #[doc = ""]
2653 #[doc = "There are alternatives possible, for example using two or more buffers of size `windowSize` each, though they consume more memory."]
2654 #[doc = ""]
2655 #[doc = "Finally, if you control the compression process, you can also ignore all buffer size rules,"]
2656 #[doc = "as long as the encoder and decoder progress in \"lock-step\","]
2657 #[doc = "aka use exactly the same buffer sizes, break contiguity at the same place, etc."]
2658 #[doc = ""]
2659 #[doc = "Once buffers are setup, start decompression, with ZSTD_decompressBegin()."]
2660 #[doc = "If decompression requires a dictionary, use ZSTD_decompressBegin_usingDict() or ZSTD_decompressBegin_usingDDict()."]
2661 #[doc = ""]
2662 #[doc = "Then use ZSTD_nextSrcSizeToDecompress() and ZSTD_decompressContinue() alternatively."]
2663 #[doc = "ZSTD_nextSrcSizeToDecompress() tells how many bytes to provide as 'srcSize' to ZSTD_decompressContinue()."]
2664 #[doc = "ZSTD_decompressContinue() requires this _exact_ amount of bytes, or it will fail."]
2665 #[doc = ""]
2666 #[doc = "@result of ZSTD_decompressContinue() is the number of bytes regenerated within 'dst' (necessarily <= dstCapacity)."]
2667 #[doc = "It can be zero : it just means ZSTD_decompressContinue() has decoded some metadata item."]
2668 #[doc = "It can also be an error code, which can be tested with ZSTD_isError()."]
2669 #[doc = ""]
2670 #[doc = "A frame is fully decoded when ZSTD_nextSrcSizeToDecompress() returns zero."]
2671 #[doc = "Context can then be reset to start a new decompression."]
2672 #[doc = ""]
2673 #[doc = "Note : it's possible to know if next input to present is a header or a block, using ZSTD_nextInputType()."]
2674 #[doc = "This information is not required to properly decode a frame."]
2675 #[doc = ""]
2676 #[doc = "== Special case : skippable frames =="]
2677 #[doc = ""]
2678 #[doc = "Skippable frames allow integration of user-defined data into a flow of concatenated frames."]
2679 #[doc = "Skippable frames will be ignored (skipped) by decompressor."]
2680 #[doc = "The format of skippable frames is as follows :"]
2681 #[doc = "a) Skippable frame ID - 4 Bytes, Little endian format, any value from 0x184D2A50 to 0x184D2A5F"]
2682 #[doc = "b) Frame Size - 4 Bytes, Little endian format, unsigned 32-bits"]
2683 #[doc = "c) Frame Content - any content (User Data) of length equal to Frame Size"]
2684 #[doc = "For skippable frames ZSTD_getFrameHeader() returns zfhPtr->frameType==ZSTD_skippableFrame."]
2685 #[doc = "For skippable frames ZSTD_decompressContinue() always returns 0 : it only skips the content."]
2686 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
2687 pub enum ZSTD_frameType_e {
2688 ZSTD_frame = 0,
2689 ZSTD_skippableFrame = 1,
2690 }
2691 #[repr(C)]
2692 #[derive(Debug, Copy, Clone)]
2693 pub struct ZSTD_frameHeader {
2694 pub frameContentSize: libc::c_ulonglong,
2695 pub windowSize: libc::c_ulonglong,
2696 pub blockSizeMax: libc::c_uint,
2697 pub frameType: ZSTD_frameType_e,
2698 pub headerSize: libc::c_uint,
2699 pub dictID: libc::c_uint,
2700 pub checksumFlag: libc::c_uint,
2701 }
2702 #[test]
bindgen_test_layout_ZSTD_frameHeader()2703 fn bindgen_test_layout_ZSTD_frameHeader() {
2704 assert_eq!(
2705 ::core::mem::size_of::<ZSTD_frameHeader>(),
2706 40usize,
2707 concat!("Size of: ", stringify!(ZSTD_frameHeader))
2708 );
2709 assert_eq!(
2710 ::core::mem::align_of::<ZSTD_frameHeader>(),
2711 8usize,
2712 concat!("Alignment of ", stringify!(ZSTD_frameHeader))
2713 );
2714 assert_eq!(
2715 unsafe {
2716 &(*(::core::ptr::null::<ZSTD_frameHeader>())).frameContentSize
2717 as *const _ as usize
2718 },
2719 0usize,
2720 concat!(
2721 "Offset of field: ",
2722 stringify!(ZSTD_frameHeader),
2723 "::",
2724 stringify!(frameContentSize)
2725 )
2726 );
2727 assert_eq!(
2728 unsafe {
2729 &(*(::core::ptr::null::<ZSTD_frameHeader>())).windowSize
2730 as *const _ as usize
2731 },
2732 8usize,
2733 concat!(
2734 "Offset of field: ",
2735 stringify!(ZSTD_frameHeader),
2736 "::",
2737 stringify!(windowSize)
2738 )
2739 );
2740 assert_eq!(
2741 unsafe {
2742 &(*(::core::ptr::null::<ZSTD_frameHeader>())).blockSizeMax
2743 as *const _ as usize
2744 },
2745 16usize,
2746 concat!(
2747 "Offset of field: ",
2748 stringify!(ZSTD_frameHeader),
2749 "::",
2750 stringify!(blockSizeMax)
2751 )
2752 );
2753 assert_eq!(
2754 unsafe {
2755 &(*(::core::ptr::null::<ZSTD_frameHeader>())).frameType as *const _
2756 as usize
2757 },
2758 20usize,
2759 concat!(
2760 "Offset of field: ",
2761 stringify!(ZSTD_frameHeader),
2762 "::",
2763 stringify!(frameType)
2764 )
2765 );
2766 assert_eq!(
2767 unsafe {
2768 &(*(::core::ptr::null::<ZSTD_frameHeader>())).headerSize
2769 as *const _ as usize
2770 },
2771 24usize,
2772 concat!(
2773 "Offset of field: ",
2774 stringify!(ZSTD_frameHeader),
2775 "::",
2776 stringify!(headerSize)
2777 )
2778 );
2779 assert_eq!(
2780 unsafe {
2781 &(*(::core::ptr::null::<ZSTD_frameHeader>())).dictID as *const _
2782 as usize
2783 },
2784 28usize,
2785 concat!(
2786 "Offset of field: ",
2787 stringify!(ZSTD_frameHeader),
2788 "::",
2789 stringify!(dictID)
2790 )
2791 );
2792 assert_eq!(
2793 unsafe {
2794 &(*(::core::ptr::null::<ZSTD_frameHeader>())).checksumFlag
2795 as *const _ as usize
2796 },
2797 32usize,
2798 concat!(
2799 "Offset of field: ",
2800 stringify!(ZSTD_frameHeader),
2801 "::",
2802 stringify!(checksumFlag)
2803 )
2804 );
2805 }
2806 extern "C" {
2807 #[doc = " ZSTD_getFrameHeader() :"]
2808 #[doc = " decode Frame Header, or requires larger `srcSize`."]
2809 #[doc = " @return : 0, `zfhPtr` is correctly filled,"]
2810 #[doc = " >0, `srcSize` is too small, value is wanted `srcSize` amount,"]
2811 #[doc = " or an error code, which can be tested using ZSTD_isError()"]
ZSTD_getFrameHeader( zfhPtr: *mut ZSTD_frameHeader, src: *const libc::c_void, srcSize: usize, ) -> usize2812 pub fn ZSTD_getFrameHeader(
2813 zfhPtr: *mut ZSTD_frameHeader,
2814 src: *const libc::c_void,
2815 srcSize: usize,
2816 ) -> usize;
2817 }
2818 extern "C" {
2819 #[doc = " ZSTD_getFrameHeader_advanced() :"]
2820 #[doc = " same as ZSTD_getFrameHeader(),"]
2821 #[doc = " with added capability to select a format (like ZSTD_f_zstd1_magicless)"]
ZSTD_getFrameHeader_advanced( zfhPtr: *mut ZSTD_frameHeader, src: *const libc::c_void, srcSize: usize, format: ZSTD_format_e, ) -> usize2822 pub fn ZSTD_getFrameHeader_advanced(
2823 zfhPtr: *mut ZSTD_frameHeader,
2824 src: *const libc::c_void,
2825 srcSize: usize,
2826 format: ZSTD_format_e,
2827 ) -> usize;
2828 }
2829 extern "C" {
ZSTD_decodingBufferSize_min( windowSize: libc::c_ulonglong, frameContentSize: libc::c_ulonglong, ) -> usize2830 pub fn ZSTD_decodingBufferSize_min(
2831 windowSize: libc::c_ulonglong,
2832 frameContentSize: libc::c_ulonglong,
2833 ) -> usize;
2834 }
2835 extern "C" {
ZSTD_decompressBegin(dctx: *mut ZSTD_DCtx) -> usize2836 pub fn ZSTD_decompressBegin(dctx: *mut ZSTD_DCtx) -> usize;
2837 }
2838 extern "C" {
ZSTD_decompressBegin_usingDict( dctx: *mut ZSTD_DCtx, dict: *const libc::c_void, dictSize: usize, ) -> usize2839 pub fn ZSTD_decompressBegin_usingDict(
2840 dctx: *mut ZSTD_DCtx,
2841 dict: *const libc::c_void,
2842 dictSize: usize,
2843 ) -> usize;
2844 }
2845 extern "C" {
ZSTD_decompressBegin_usingDDict( dctx: *mut ZSTD_DCtx, ddict: *const ZSTD_DDict, ) -> usize2846 pub fn ZSTD_decompressBegin_usingDDict(
2847 dctx: *mut ZSTD_DCtx,
2848 ddict: *const ZSTD_DDict,
2849 ) -> usize;
2850 }
2851 extern "C" {
ZSTD_nextSrcSizeToDecompress(dctx: *mut ZSTD_DCtx) -> usize2852 pub fn ZSTD_nextSrcSizeToDecompress(dctx: *mut ZSTD_DCtx) -> usize;
2853 }
2854 extern "C" {
ZSTD_decompressContinue( dctx: *mut ZSTD_DCtx, dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, ) -> usize2855 pub fn ZSTD_decompressContinue(
2856 dctx: *mut ZSTD_DCtx,
2857 dst: *mut libc::c_void,
2858 dstCapacity: usize,
2859 src: *const libc::c_void,
2860 srcSize: usize,
2861 ) -> usize;
2862 }
2863 extern "C" {
ZSTD_copyDCtx(dctx: *mut ZSTD_DCtx, preparedDCtx: *const ZSTD_DCtx)2864 pub fn ZSTD_copyDCtx(dctx: *mut ZSTD_DCtx, preparedDCtx: *const ZSTD_DCtx);
2865 }
2866 #[repr(u32)]
2867 #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
2868 pub enum ZSTD_nextInputType_e {
2869 ZSTDnit_frameHeader = 0,
2870 ZSTDnit_blockHeader = 1,
2871 ZSTDnit_block = 2,
2872 ZSTDnit_lastBlock = 3,
2873 ZSTDnit_checksum = 4,
2874 ZSTDnit_skippableFrame = 5,
2875 }
2876 extern "C" {
ZSTD_nextInputType(dctx: *mut ZSTD_DCtx) -> ZSTD_nextInputType_e2877 pub fn ZSTD_nextInputType(dctx: *mut ZSTD_DCtx) -> ZSTD_nextInputType_e;
2878 }
2879 extern "C" {
2880 #[doc = "Block functions produce and decode raw zstd blocks, without frame metadata."]
2881 #[doc = "Frame metadata cost is typically ~12 bytes, which can be non-negligible for very small blocks (< 100 bytes)."]
2882 #[doc = "But users will have to take in charge needed metadata to regenerate data, such as compressed and content sizes."]
2883 #[doc = ""]
2884 #[doc = "A few rules to respect :"]
2885 #[doc = "- Compressing and decompressing require a context structure"]
2886 #[doc = "+ Use ZSTD_createCCtx() and ZSTD_createDCtx()"]
2887 #[doc = "- It is necessary to init context before starting"]
2888 #[doc = "+ compression : any ZSTD_compressBegin*() variant, including with dictionary"]
2889 #[doc = "+ decompression : any ZSTD_decompressBegin*() variant, including with dictionary"]
2890 #[doc = "+ copyCCtx() and copyDCtx() can be used too"]
2891 #[doc = "- Block size is limited, it must be <= ZSTD_getBlockSize() <= ZSTD_BLOCKSIZE_MAX == 128 KB"]
2892 #[doc = "+ If input is larger than a block size, it's necessary to split input data into multiple blocks"]
2893 #[doc = "+ For inputs larger than a single block, consider using regular ZSTD_compress() instead."]
2894 #[doc = "Frame metadata is not that costly, and quickly becomes negligible as source size grows larger than a block."]
2895 #[doc = "- When a block is considered not compressible enough, ZSTD_compressBlock() result will be 0 (zero) !"]
2896 #[doc = "===> In which case, nothing is produced into `dst` !"]
2897 #[doc = "+ User __must__ test for such outcome and deal directly with uncompressed data"]
2898 #[doc = "+ A block cannot be declared incompressible if ZSTD_compressBlock() return value was != 0."]
2899 #[doc = "Doing so would mess up with statistics history, leading to potential data corruption."]
2900 #[doc = "+ ZSTD_decompressBlock() _doesn't accept uncompressed data as input_ !!"]
2901 #[doc = "+ In case of multiple successive blocks, should some of them be uncompressed,"]
2902 #[doc = "decoder must be informed of their existence in order to follow proper history."]
2903 #[doc = "Use ZSTD_insertBlock() for such a case."]
ZSTD_getBlockSize(cctx: *const ZSTD_CCtx) -> usize2904 pub fn ZSTD_getBlockSize(cctx: *const ZSTD_CCtx) -> usize;
2905 }
2906 extern "C" {
ZSTD_compressBlock( cctx: *mut ZSTD_CCtx, dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, ) -> usize2907 pub fn ZSTD_compressBlock(
2908 cctx: *mut ZSTD_CCtx,
2909 dst: *mut libc::c_void,
2910 dstCapacity: usize,
2911 src: *const libc::c_void,
2912 srcSize: usize,
2913 ) -> usize;
2914 }
2915 extern "C" {
ZSTD_decompressBlock( dctx: *mut ZSTD_DCtx, dst: *mut libc::c_void, dstCapacity: usize, src: *const libc::c_void, srcSize: usize, ) -> usize2916 pub fn ZSTD_decompressBlock(
2917 dctx: *mut ZSTD_DCtx,
2918 dst: *mut libc::c_void,
2919 dstCapacity: usize,
2920 src: *const libc::c_void,
2921 srcSize: usize,
2922 ) -> usize;
2923 }
2924 extern "C" {
ZSTD_insertBlock( dctx: *mut ZSTD_DCtx, blockStart: *const libc::c_void, blockSize: usize, ) -> usize2925 pub fn ZSTD_insertBlock(
2926 dctx: *mut ZSTD_DCtx,
2927 blockStart: *const libc::c_void,
2928 blockSize: usize,
2929 ) -> usize;
2930 }
2931 extern "C" {
2932 #[doc = " ZDICT_trainFromBuffer():"]
2933 #[doc = " Train a dictionary from an array of samples."]
2934 #[doc = " Redirect towards ZDICT_optimizeTrainFromBuffer_fastCover() single-threaded, with d=8, steps=4,"]
2935 #[doc = " f=20, and accel=1."]
2936 #[doc = " Samples must be stored concatenated in a single flat buffer `samplesBuffer`,"]
2937 #[doc = " supplied with an array of sizes `samplesSizes`, providing the size of each sample, in order."]
2938 #[doc = " The resulting dictionary will be saved into `dictBuffer`."]
2939 #[doc = " @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`)"]
2940 #[doc = " or an error code, which can be tested with ZDICT_isError()."]
2941 #[doc = " Note: Dictionary training will fail if there are not enough samples to construct a"]
2942 #[doc = " dictionary, or if most of the samples are too small (< 8 bytes being the lower limit)."]
2943 #[doc = " If dictionary training fails, you should use zstd without a dictionary, as the dictionary"]
2944 #[doc = " would've been ineffective anyways. If you believe your samples would benefit from a dictionary"]
2945 #[doc = " please open an issue with details, and we can look into it."]
2946 #[doc = " Note: ZDICT_trainFromBuffer()'s memory usage is about 6 MB."]
2947 #[doc = " Tips: In general, a reasonable dictionary has a size of ~ 100 KB."]
2948 #[doc = " It's possible to select smaller or larger size, just by specifying `dictBufferCapacity`."]
2949 #[doc = " In general, it's recommended to provide a few thousands samples, though this can vary a lot."]
2950 #[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, ) -> usize2951 pub fn ZDICT_trainFromBuffer(
2952 dictBuffer: *mut libc::c_void,
2953 dictBufferCapacity: usize,
2954 samplesBuffer: *const libc::c_void,
2955 samplesSizes: *const usize,
2956 nbSamples: libc::c_uint,
2957 ) -> usize;
2958 }
2959 #[repr(C)]
2960 #[derive(Debug, Copy, Clone)]
2961 pub struct ZDICT_params_t {
2962 pub compressionLevel: libc::c_int,
2963 pub notificationLevel: libc::c_uint,
2964 pub dictID: libc::c_uint,
2965 }
2966 #[test]
bindgen_test_layout_ZDICT_params_t()2967 fn bindgen_test_layout_ZDICT_params_t() {
2968 assert_eq!(
2969 ::core::mem::size_of::<ZDICT_params_t>(),
2970 12usize,
2971 concat!("Size of: ", stringify!(ZDICT_params_t))
2972 );
2973 assert_eq!(
2974 ::core::mem::align_of::<ZDICT_params_t>(),
2975 4usize,
2976 concat!("Alignment of ", stringify!(ZDICT_params_t))
2977 );
2978 assert_eq!(
2979 unsafe {
2980 &(*(::core::ptr::null::<ZDICT_params_t>())).compressionLevel
2981 as *const _ as usize
2982 },
2983 0usize,
2984 concat!(
2985 "Offset of field: ",
2986 stringify!(ZDICT_params_t),
2987 "::",
2988 stringify!(compressionLevel)
2989 )
2990 );
2991 assert_eq!(
2992 unsafe {
2993 &(*(::core::ptr::null::<ZDICT_params_t>())).notificationLevel
2994 as *const _ as usize
2995 },
2996 4usize,
2997 concat!(
2998 "Offset of field: ",
2999 stringify!(ZDICT_params_t),
3000 "::",
3001 stringify!(notificationLevel)
3002 )
3003 );
3004 assert_eq!(
3005 unsafe {
3006 &(*(::core::ptr::null::<ZDICT_params_t>())).dictID as *const _
3007 as usize
3008 },
3009 8usize,
3010 concat!(
3011 "Offset of field: ",
3012 stringify!(ZDICT_params_t),
3013 "::",
3014 stringify!(dictID)
3015 )
3016 );
3017 }
3018 extern "C" {
3019 #[doc = " ZDICT_finalizeDictionary():"]
3020 #[doc = " Given a custom content as a basis for dictionary, and a set of samples,"]
3021 #[doc = " finalize dictionary by adding headers and statistics according to the zstd"]
3022 #[doc = " dictionary format."]
3023 #[doc = ""]
3024 #[doc = " Samples must be stored concatenated in a flat buffer `samplesBuffer`,"]
3025 #[doc = " supplied with an array of sizes `samplesSizes`, providing the size of each"]
3026 #[doc = " sample in order. The samples are used to construct the statistics, so they"]
3027 #[doc = " should be representative of what you will compress with this dictionary."]
3028 #[doc = ""]
3029 #[doc = " The compression level can be set in `parameters`. You should pass the"]
3030 #[doc = " compression level you expect to use in production. The statistics for each"]
3031 #[doc = " compression level differ, so tuning the dictionary for the compression level"]
3032 #[doc = " can help quite a bit."]
3033 #[doc = ""]
3034 #[doc = " You can set an explicit dictionary ID in `parameters`, or allow us to pick"]
3035 #[doc = " a random dictionary ID for you, but we can't guarantee no collisions."]
3036 #[doc = ""]
3037 #[doc = " The dstDictBuffer and the dictContent may overlap, and the content will be"]
3038 #[doc = " appended to the end of the header. If the header + the content doesn't fit in"]
3039 #[doc = " maxDictSize the beginning of the content is truncated to make room, since it"]
3040 #[doc = " is presumed that the most profitable content is at the end of the dictionary,"]
3041 #[doc = " since that is the cheapest to reference."]
3042 #[doc = ""]
3043 #[doc = " `dictContentSize` must be >= ZDICT_CONTENTSIZE_MIN bytes."]
3044 #[doc = " `maxDictSize` must be >= max(dictContentSize, ZSTD_DICTSIZE_MIN)."]
3045 #[doc = ""]
3046 #[doc = " @return: size of dictionary stored into `dstDictBuffer` (<= `maxDictSize`),"]
3047 #[doc = " or an error code, which can be tested by ZDICT_isError()."]
3048 #[doc = " Note: ZDICT_finalizeDictionary() will push notifications into stderr if"]
3049 #[doc = " instructed to, using notificationLevel>0."]
3050 #[doc = " NOTE: This function currently may fail in several edge cases including:"]
3051 #[doc = " * Not enough samples"]
3052 #[doc = " * Samples are uncompressible"]
3053 #[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, ) -> usize3054 pub fn ZDICT_finalizeDictionary(
3055 dstDictBuffer: *mut libc::c_void,
3056 maxDictSize: usize,
3057 dictContent: *const libc::c_void,
3058 dictContentSize: usize,
3059 samplesBuffer: *const libc::c_void,
3060 samplesSizes: *const usize,
3061 nbSamples: libc::c_uint,
3062 parameters: ZDICT_params_t,
3063 ) -> usize;
3064 }
3065 extern "C" {
ZDICT_getDictID( dictBuffer: *const libc::c_void, dictSize: usize, ) -> libc::c_uint3066 pub fn ZDICT_getDictID(
3067 dictBuffer: *const libc::c_void,
3068 dictSize: usize,
3069 ) -> libc::c_uint;
3070 }
3071 extern "C" {
ZDICT_getDictHeaderSize( dictBuffer: *const libc::c_void, dictSize: usize, ) -> usize3072 pub fn ZDICT_getDictHeaderSize(
3073 dictBuffer: *const libc::c_void,
3074 dictSize: usize,
3075 ) -> usize;
3076 }
3077 extern "C" {
ZDICT_isError(errorCode: usize) -> libc::c_uint3078 pub fn ZDICT_isError(errorCode: usize) -> libc::c_uint;
3079 }
3080 extern "C" {
ZDICT_getErrorName(errorCode: usize) -> *const libc::c_char3081 pub fn ZDICT_getErrorName(errorCode: usize) -> *const libc::c_char;
3082 }
3083 #[doc = " ZDICT_cover_params_t:"]
3084 #[doc = " k and d are the only required parameters."]
3085 #[doc = " For others, value 0 means default."]
3086 #[repr(C)]
3087 #[derive(Debug, Copy, Clone)]
3088 pub struct ZDICT_cover_params_t {
3089 pub k: libc::c_uint,
3090 pub d: libc::c_uint,
3091 pub steps: libc::c_uint,
3092 pub nbThreads: libc::c_uint,
3093 pub splitPoint: f64,
3094 pub shrinkDict: libc::c_uint,
3095 pub shrinkDictMaxRegression: libc::c_uint,
3096 pub zParams: ZDICT_params_t,
3097 }
3098 #[test]
bindgen_test_layout_ZDICT_cover_params_t()3099 fn bindgen_test_layout_ZDICT_cover_params_t() {
3100 assert_eq!(
3101 ::core::mem::size_of::<ZDICT_cover_params_t>(),
3102 48usize,
3103 concat!("Size of: ", stringify!(ZDICT_cover_params_t))
3104 );
3105 assert_eq!(
3106 ::core::mem::align_of::<ZDICT_cover_params_t>(),
3107 8usize,
3108 concat!("Alignment of ", stringify!(ZDICT_cover_params_t))
3109 );
3110 assert_eq!(
3111 unsafe {
3112 &(*(::core::ptr::null::<ZDICT_cover_params_t>())).k as *const _
3113 as usize
3114 },
3115 0usize,
3116 concat!(
3117 "Offset of field: ",
3118 stringify!(ZDICT_cover_params_t),
3119 "::",
3120 stringify!(k)
3121 )
3122 );
3123 assert_eq!(
3124 unsafe {
3125 &(*(::core::ptr::null::<ZDICT_cover_params_t>())).d as *const _
3126 as usize
3127 },
3128 4usize,
3129 concat!(
3130 "Offset of field: ",
3131 stringify!(ZDICT_cover_params_t),
3132 "::",
3133 stringify!(d)
3134 )
3135 );
3136 assert_eq!(
3137 unsafe {
3138 &(*(::core::ptr::null::<ZDICT_cover_params_t>())).steps as *const _
3139 as usize
3140 },
3141 8usize,
3142 concat!(
3143 "Offset of field: ",
3144 stringify!(ZDICT_cover_params_t),
3145 "::",
3146 stringify!(steps)
3147 )
3148 );
3149 assert_eq!(
3150 unsafe {
3151 &(*(::core::ptr::null::<ZDICT_cover_params_t>())).nbThreads
3152 as *const _ as usize
3153 },
3154 12usize,
3155 concat!(
3156 "Offset of field: ",
3157 stringify!(ZDICT_cover_params_t),
3158 "::",
3159 stringify!(nbThreads)
3160 )
3161 );
3162 assert_eq!(
3163 unsafe {
3164 &(*(::core::ptr::null::<ZDICT_cover_params_t>())).splitPoint
3165 as *const _ as usize
3166 },
3167 16usize,
3168 concat!(
3169 "Offset of field: ",
3170 stringify!(ZDICT_cover_params_t),
3171 "::",
3172 stringify!(splitPoint)
3173 )
3174 );
3175 assert_eq!(
3176 unsafe {
3177 &(*(::core::ptr::null::<ZDICT_cover_params_t>())).shrinkDict
3178 as *const _ as usize
3179 },
3180 24usize,
3181 concat!(
3182 "Offset of field: ",
3183 stringify!(ZDICT_cover_params_t),
3184 "::",
3185 stringify!(shrinkDict)
3186 )
3187 );
3188 assert_eq!(
3189 unsafe {
3190 &(*(::core::ptr::null::<ZDICT_cover_params_t>()))
3191 .shrinkDictMaxRegression as *const _ as usize
3192 },
3193 28usize,
3194 concat!(
3195 "Offset of field: ",
3196 stringify!(ZDICT_cover_params_t),
3197 "::",
3198 stringify!(shrinkDictMaxRegression)
3199 )
3200 );
3201 assert_eq!(
3202 unsafe {
3203 &(*(::core::ptr::null::<ZDICT_cover_params_t>())).zParams
3204 as *const _ as usize
3205 },
3206 32usize,
3207 concat!(
3208 "Offset of field: ",
3209 stringify!(ZDICT_cover_params_t),
3210 "::",
3211 stringify!(zParams)
3212 )
3213 );
3214 }
3215 #[repr(C)]
3216 #[derive(Debug, Copy, Clone)]
3217 pub struct ZDICT_fastCover_params_t {
3218 pub k: libc::c_uint,
3219 pub d: libc::c_uint,
3220 pub f: libc::c_uint,
3221 pub steps: libc::c_uint,
3222 pub nbThreads: libc::c_uint,
3223 pub splitPoint: f64,
3224 pub accel: libc::c_uint,
3225 pub shrinkDict: libc::c_uint,
3226 pub shrinkDictMaxRegression: libc::c_uint,
3227 pub zParams: ZDICT_params_t,
3228 }
3229 #[test]
bindgen_test_layout_ZDICT_fastCover_params_t()3230 fn bindgen_test_layout_ZDICT_fastCover_params_t() {
3231 assert_eq!(
3232 ::core::mem::size_of::<ZDICT_fastCover_params_t>(),
3233 56usize,
3234 concat!("Size of: ", stringify!(ZDICT_fastCover_params_t))
3235 );
3236 assert_eq!(
3237 ::core::mem::align_of::<ZDICT_fastCover_params_t>(),
3238 8usize,
3239 concat!("Alignment of ", stringify!(ZDICT_fastCover_params_t))
3240 );
3241 assert_eq!(
3242 unsafe {
3243 &(*(::core::ptr::null::<ZDICT_fastCover_params_t>())).k as *const _
3244 as usize
3245 },
3246 0usize,
3247 concat!(
3248 "Offset of field: ",
3249 stringify!(ZDICT_fastCover_params_t),
3250 "::",
3251 stringify!(k)
3252 )
3253 );
3254 assert_eq!(
3255 unsafe {
3256 &(*(::core::ptr::null::<ZDICT_fastCover_params_t>())).d as *const _
3257 as usize
3258 },
3259 4usize,
3260 concat!(
3261 "Offset of field: ",
3262 stringify!(ZDICT_fastCover_params_t),
3263 "::",
3264 stringify!(d)
3265 )
3266 );
3267 assert_eq!(
3268 unsafe {
3269 &(*(::core::ptr::null::<ZDICT_fastCover_params_t>())).f as *const _
3270 as usize
3271 },
3272 8usize,
3273 concat!(
3274 "Offset of field: ",
3275 stringify!(ZDICT_fastCover_params_t),
3276 "::",
3277 stringify!(f)
3278 )
3279 );
3280 assert_eq!(
3281 unsafe {
3282 &(*(::core::ptr::null::<ZDICT_fastCover_params_t>())).steps
3283 as *const _ as usize
3284 },
3285 12usize,
3286 concat!(
3287 "Offset of field: ",
3288 stringify!(ZDICT_fastCover_params_t),
3289 "::",
3290 stringify!(steps)
3291 )
3292 );
3293 assert_eq!(
3294 unsafe {
3295 &(*(::core::ptr::null::<ZDICT_fastCover_params_t>())).nbThreads
3296 as *const _ as usize
3297 },
3298 16usize,
3299 concat!(
3300 "Offset of field: ",
3301 stringify!(ZDICT_fastCover_params_t),
3302 "::",
3303 stringify!(nbThreads)
3304 )
3305 );
3306 assert_eq!(
3307 unsafe {
3308 &(*(::core::ptr::null::<ZDICT_fastCover_params_t>())).splitPoint
3309 as *const _ as usize
3310 },
3311 24usize,
3312 concat!(
3313 "Offset of field: ",
3314 stringify!(ZDICT_fastCover_params_t),
3315 "::",
3316 stringify!(splitPoint)
3317 )
3318 );
3319 assert_eq!(
3320 unsafe {
3321 &(*(::core::ptr::null::<ZDICT_fastCover_params_t>())).accel
3322 as *const _ as usize
3323 },
3324 32usize,
3325 concat!(
3326 "Offset of field: ",
3327 stringify!(ZDICT_fastCover_params_t),
3328 "::",
3329 stringify!(accel)
3330 )
3331 );
3332 assert_eq!(
3333 unsafe {
3334 &(*(::core::ptr::null::<ZDICT_fastCover_params_t>())).shrinkDict
3335 as *const _ as usize
3336 },
3337 36usize,
3338 concat!(
3339 "Offset of field: ",
3340 stringify!(ZDICT_fastCover_params_t),
3341 "::",
3342 stringify!(shrinkDict)
3343 )
3344 );
3345 assert_eq!(
3346 unsafe {
3347 &(*(::core::ptr::null::<ZDICT_fastCover_params_t>()))
3348 .shrinkDictMaxRegression as *const _ as usize
3349 },
3350 40usize,
3351 concat!(
3352 "Offset of field: ",
3353 stringify!(ZDICT_fastCover_params_t),
3354 "::",
3355 stringify!(shrinkDictMaxRegression)
3356 )
3357 );
3358 assert_eq!(
3359 unsafe {
3360 &(*(::core::ptr::null::<ZDICT_fastCover_params_t>())).zParams
3361 as *const _ as usize
3362 },
3363 44usize,
3364 concat!(
3365 "Offset of field: ",
3366 stringify!(ZDICT_fastCover_params_t),
3367 "::",
3368 stringify!(zParams)
3369 )
3370 );
3371 }
3372 extern "C" {
3373 #[doc = " ZDICT_trainFromBuffer_cover():"]
3374 #[doc = " Train a dictionary from an array of samples using the COVER algorithm."]
3375 #[doc = " Samples must be stored concatenated in a single flat buffer `samplesBuffer`,"]
3376 #[doc = " supplied with an array of sizes `samplesSizes`, providing the size of each sample, in order."]
3377 #[doc = " The resulting dictionary will be saved into `dictBuffer`."]
3378 #[doc = " @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`)"]
3379 #[doc = " or an error code, which can be tested with ZDICT_isError()."]
3380 #[doc = " See ZDICT_trainFromBuffer() for details on failure modes."]
3381 #[doc = " Note: ZDICT_trainFromBuffer_cover() requires about 9 bytes of memory for each input byte."]
3382 #[doc = " Tips: In general, a reasonable dictionary has a size of ~ 100 KB."]
3383 #[doc = " It's possible to select smaller or larger size, just by specifying `dictBufferCapacity`."]
3384 #[doc = " In general, it's recommended to provide a few thousands samples, though this can vary a lot."]
3385 #[doc = " It's recommended that total size of all samples be about ~x100 times the target size of dictionary."]
ZDICT_trainFromBuffer_cover( dictBuffer: *mut libc::c_void, dictBufferCapacity: usize, samplesBuffer: *const libc::c_void, samplesSizes: *const usize, nbSamples: libc::c_uint, parameters: ZDICT_cover_params_t, ) -> usize3386 pub fn ZDICT_trainFromBuffer_cover(
3387 dictBuffer: *mut libc::c_void,
3388 dictBufferCapacity: usize,
3389 samplesBuffer: *const libc::c_void,
3390 samplesSizes: *const usize,
3391 nbSamples: libc::c_uint,
3392 parameters: ZDICT_cover_params_t,
3393 ) -> usize;
3394 }
3395 extern "C" {
3396 #[doc = " ZDICT_optimizeTrainFromBuffer_cover():"]
3397 #[doc = " The same requirements as above hold for all the parameters except `parameters`."]
3398 #[doc = " This function tries many parameter combinations and picks the best parameters."]
3399 #[doc = " `*parameters` is filled with the best parameters found,"]
3400 #[doc = " dictionary constructed with those parameters is stored in `dictBuffer`."]
3401 #[doc = ""]
3402 #[doc = " All of the parameters d, k, steps are optional."]
3403 #[doc = " If d is non-zero then we don't check multiple values of d, otherwise we check d = {6, 8}."]
3404 #[doc = " if steps is zero it defaults to its default value."]
3405 #[doc = " If k is non-zero then we don't check multiple values of k, otherwise we check steps values in [50, 2000]."]
3406 #[doc = ""]
3407 #[doc = " @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`)"]
3408 #[doc = " or an error code, which can be tested with ZDICT_isError()."]
3409 #[doc = " On success `*parameters` contains the parameters selected."]
3410 #[doc = " See ZDICT_trainFromBuffer() for details on failure modes."]
3411 #[doc = " Note: ZDICT_optimizeTrainFromBuffer_cover() requires about 8 bytes of memory for each input byte and additionally another 5 bytes of memory for each byte of memory for each thread."]
ZDICT_optimizeTrainFromBuffer_cover( dictBuffer: *mut libc::c_void, dictBufferCapacity: usize, samplesBuffer: *const libc::c_void, samplesSizes: *const usize, nbSamples: libc::c_uint, parameters: *mut ZDICT_cover_params_t, ) -> usize3412 pub fn ZDICT_optimizeTrainFromBuffer_cover(
3413 dictBuffer: *mut libc::c_void,
3414 dictBufferCapacity: usize,
3415 samplesBuffer: *const libc::c_void,
3416 samplesSizes: *const usize,
3417 nbSamples: libc::c_uint,
3418 parameters: *mut ZDICT_cover_params_t,
3419 ) -> usize;
3420 }
3421 extern "C" {
3422 #[doc = " ZDICT_trainFromBuffer_fastCover():"]
3423 #[doc = " Train a dictionary from an array of samples using a modified version of COVER algorithm."]
3424 #[doc = " Samples must be stored concatenated in a single flat buffer `samplesBuffer`,"]
3425 #[doc = " supplied with an array of sizes `samplesSizes`, providing the size of each sample, in order."]
3426 #[doc = " d and k are required."]
3427 #[doc = " All other parameters are optional, will use default values if not provided"]
3428 #[doc = " The resulting dictionary will be saved into `dictBuffer`."]
3429 #[doc = " @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`)"]
3430 #[doc = " or an error code, which can be tested with ZDICT_isError()."]
3431 #[doc = " See ZDICT_trainFromBuffer() for details on failure modes."]
3432 #[doc = " Note: ZDICT_trainFromBuffer_fastCover() requires 6 * 2^f bytes of memory."]
3433 #[doc = " Tips: In general, a reasonable dictionary has a size of ~ 100 KB."]
3434 #[doc = " It's possible to select smaller or larger size, just by specifying `dictBufferCapacity`."]
3435 #[doc = " In general, it's recommended to provide a few thousands samples, though this can vary a lot."]
3436 #[doc = " It's recommended that total size of all samples be about ~x100 times the target size of dictionary."]
ZDICT_trainFromBuffer_fastCover( dictBuffer: *mut libc::c_void, dictBufferCapacity: usize, samplesBuffer: *const libc::c_void, samplesSizes: *const usize, nbSamples: libc::c_uint, parameters: ZDICT_fastCover_params_t, ) -> usize3437 pub fn ZDICT_trainFromBuffer_fastCover(
3438 dictBuffer: *mut libc::c_void,
3439 dictBufferCapacity: usize,
3440 samplesBuffer: *const libc::c_void,
3441 samplesSizes: *const usize,
3442 nbSamples: libc::c_uint,
3443 parameters: ZDICT_fastCover_params_t,
3444 ) -> usize;
3445 }
3446 extern "C" {
3447 #[doc = " ZDICT_optimizeTrainFromBuffer_fastCover():"]
3448 #[doc = " The same requirements as above hold for all the parameters except `parameters`."]
3449 #[doc = " This function tries many parameter combinations (specifically, k and d combinations)"]
3450 #[doc = " and picks the best parameters. `*parameters` is filled with the best parameters found,"]
3451 #[doc = " dictionary constructed with those parameters is stored in `dictBuffer`."]
3452 #[doc = " All of the parameters d, k, steps, f, and accel are optional."]
3453 #[doc = " If d is non-zero then we don't check multiple values of d, otherwise we check d = {6, 8}."]
3454 #[doc = " if steps is zero it defaults to its default value."]
3455 #[doc = " If k is non-zero then we don't check multiple values of k, otherwise we check steps values in [50, 2000]."]
3456 #[doc = " If f is zero, default value of 20 is used."]
3457 #[doc = " If accel is zero, default value of 1 is used."]
3458 #[doc = ""]
3459 #[doc = " @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`)"]
3460 #[doc = " or an error code, which can be tested with ZDICT_isError()."]
3461 #[doc = " On success `*parameters` contains the parameters selected."]
3462 #[doc = " See ZDICT_trainFromBuffer() for details on failure modes."]
3463 #[doc = " Note: ZDICT_optimizeTrainFromBuffer_fastCover() requires about 6 * 2^f bytes of memory for each thread."]
ZDICT_optimizeTrainFromBuffer_fastCover( dictBuffer: *mut libc::c_void, dictBufferCapacity: usize, samplesBuffer: *const libc::c_void, samplesSizes: *const usize, nbSamples: libc::c_uint, parameters: *mut ZDICT_fastCover_params_t, ) -> usize3464 pub fn ZDICT_optimizeTrainFromBuffer_fastCover(
3465 dictBuffer: *mut libc::c_void,
3466 dictBufferCapacity: usize,
3467 samplesBuffer: *const libc::c_void,
3468 samplesSizes: *const usize,
3469 nbSamples: libc::c_uint,
3470 parameters: *mut ZDICT_fastCover_params_t,
3471 ) -> usize;
3472 }
3473 #[repr(C)]
3474 #[derive(Debug, Copy, Clone)]
3475 pub struct ZDICT_legacy_params_t {
3476 pub selectivityLevel: libc::c_uint,
3477 pub zParams: ZDICT_params_t,
3478 }
3479 #[test]
bindgen_test_layout_ZDICT_legacy_params_t()3480 fn bindgen_test_layout_ZDICT_legacy_params_t() {
3481 assert_eq!(
3482 ::core::mem::size_of::<ZDICT_legacy_params_t>(),
3483 16usize,
3484 concat!("Size of: ", stringify!(ZDICT_legacy_params_t))
3485 );
3486 assert_eq!(
3487 ::core::mem::align_of::<ZDICT_legacy_params_t>(),
3488 4usize,
3489 concat!("Alignment of ", stringify!(ZDICT_legacy_params_t))
3490 );
3491 assert_eq!(
3492 unsafe {
3493 &(*(::core::ptr::null::<ZDICT_legacy_params_t>())).selectivityLevel
3494 as *const _ as usize
3495 },
3496 0usize,
3497 concat!(
3498 "Offset of field: ",
3499 stringify!(ZDICT_legacy_params_t),
3500 "::",
3501 stringify!(selectivityLevel)
3502 )
3503 );
3504 assert_eq!(
3505 unsafe {
3506 &(*(::core::ptr::null::<ZDICT_legacy_params_t>())).zParams
3507 as *const _ as usize
3508 },
3509 4usize,
3510 concat!(
3511 "Offset of field: ",
3512 stringify!(ZDICT_legacy_params_t),
3513 "::",
3514 stringify!(zParams)
3515 )
3516 );
3517 }
3518 extern "C" {
3519 #[doc = " ZDICT_trainFromBuffer_legacy():"]
3520 #[doc = " Train a dictionary from an array of samples."]
3521 #[doc = " Samples must be stored concatenated in a single flat buffer `samplesBuffer`,"]
3522 #[doc = " supplied with an array of sizes `samplesSizes`, providing the size of each sample, in order."]
3523 #[doc = " The resulting dictionary will be saved into `dictBuffer`."]
3524 #[doc = " `parameters` is optional and can be provided with values set to 0 to mean \"default\"."]
3525 #[doc = " @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`)"]
3526 #[doc = " or an error code, which can be tested with ZDICT_isError()."]
3527 #[doc = " See ZDICT_trainFromBuffer() for details on failure modes."]
3528 #[doc = " Tips: In general, a reasonable dictionary has a size of ~ 100 KB."]
3529 #[doc = " It's possible to select smaller or larger size, just by specifying `dictBufferCapacity`."]
3530 #[doc = " In general, it's recommended to provide a few thousands samples, though this can vary a lot."]
3531 #[doc = " It's recommended that total size of all samples be about ~x100 times the target size of dictionary."]
3532 #[doc = " Note: ZDICT_trainFromBuffer_legacy() will send notifications into stderr if instructed to, using notificationLevel>0."]
ZDICT_trainFromBuffer_legacy( dictBuffer: *mut libc::c_void, dictBufferCapacity: usize, samplesBuffer: *const libc::c_void, samplesSizes: *const usize, nbSamples: libc::c_uint, parameters: ZDICT_legacy_params_t, ) -> usize3533 pub fn ZDICT_trainFromBuffer_legacy(
3534 dictBuffer: *mut libc::c_void,
3535 dictBufferCapacity: usize,
3536 samplesBuffer: *const libc::c_void,
3537 samplesSizes: *const usize,
3538 nbSamples: libc::c_uint,
3539 parameters: ZDICT_legacy_params_t,
3540 ) -> usize;
3541 }
3542 extern "C" {
ZDICT_addEntropyTablesFromBuffer( dictBuffer: *mut libc::c_void, dictContentSize: usize, dictBufferCapacity: usize, samplesBuffer: *const libc::c_void, samplesSizes: *const usize, nbSamples: libc::c_uint, ) -> usize3543 pub fn ZDICT_addEntropyTablesFromBuffer(
3544 dictBuffer: *mut libc::c_void,
3545 dictContentSize: usize,
3546 dictBufferCapacity: usize,
3547 samplesBuffer: *const libc::c_void,
3548 samplesSizes: *const usize,
3549 nbSamples: libc::c_uint,
3550 ) -> usize;
3551 }
3552 extern "C" {
memcpy( __dest: *mut libc::c_void, __src: *const libc::c_void, __n: libc::c_ulong, ) -> *mut libc::c_void3553 pub fn memcpy(
3554 __dest: *mut libc::c_void,
3555 __src: *const libc::c_void,
3556 __n: libc::c_ulong,
3557 ) -> *mut libc::c_void;
3558 }
3559 extern "C" {
memmove( __dest: *mut libc::c_void, __src: *const libc::c_void, __n: libc::c_ulong, ) -> *mut libc::c_void3560 pub fn memmove(
3561 __dest: *mut libc::c_void,
3562 __src: *const libc::c_void,
3563 __n: libc::c_ulong,
3564 ) -> *mut libc::c_void;
3565 }
3566 extern "C" {
memccpy( __dest: *mut libc::c_void, __src: *const libc::c_void, __c: libc::c_int, __n: libc::c_ulong, ) -> *mut libc::c_void3567 pub fn memccpy(
3568 __dest: *mut libc::c_void,
3569 __src: *const libc::c_void,
3570 __c: libc::c_int,
3571 __n: libc::c_ulong,
3572 ) -> *mut libc::c_void;
3573 }
3574 extern "C" {
memset( __s: *mut libc::c_void, __c: libc::c_int, __n: libc::c_ulong, ) -> *mut libc::c_void3575 pub fn memset(
3576 __s: *mut libc::c_void,
3577 __c: libc::c_int,
3578 __n: libc::c_ulong,
3579 ) -> *mut libc::c_void;
3580 }
3581 extern "C" {
memcmp( __s1: *const libc::c_void, __s2: *const libc::c_void, __n: libc::c_ulong, ) -> libc::c_int3582 pub fn memcmp(
3583 __s1: *const libc::c_void,
3584 __s2: *const libc::c_void,
3585 __n: libc::c_ulong,
3586 ) -> libc::c_int;
3587 }
3588 extern "C" {
memchr( __s: *const libc::c_void, __c: libc::c_int, __n: libc::c_ulong, ) -> *mut libc::c_void3589 pub fn memchr(
3590 __s: *const libc::c_void,
3591 __c: libc::c_int,
3592 __n: libc::c_ulong,
3593 ) -> *mut libc::c_void;
3594 }
3595 extern "C" {
strcpy( __dest: *mut libc::c_char, __src: *const libc::c_char, ) -> *mut libc::c_char3596 pub fn strcpy(
3597 __dest: *mut libc::c_char,
3598 __src: *const libc::c_char,
3599 ) -> *mut libc::c_char;
3600 }
3601 extern "C" {
strncpy( __dest: *mut libc::c_char, __src: *const libc::c_char, __n: libc::c_ulong, ) -> *mut libc::c_char3602 pub fn strncpy(
3603 __dest: *mut libc::c_char,
3604 __src: *const libc::c_char,
3605 __n: libc::c_ulong,
3606 ) -> *mut libc::c_char;
3607 }
3608 extern "C" {
strcat( __dest: *mut libc::c_char, __src: *const libc::c_char, ) -> *mut libc::c_char3609 pub fn strcat(
3610 __dest: *mut libc::c_char,
3611 __src: *const libc::c_char,
3612 ) -> *mut libc::c_char;
3613 }
3614 extern "C" {
strncat( __dest: *mut libc::c_char, __src: *const libc::c_char, __n: libc::c_ulong, ) -> *mut libc::c_char3615 pub fn strncat(
3616 __dest: *mut libc::c_char,
3617 __src: *const libc::c_char,
3618 __n: libc::c_ulong,
3619 ) -> *mut libc::c_char;
3620 }
3621 extern "C" {
strcmp( __s1: *const libc::c_char, __s2: *const libc::c_char, ) -> libc::c_int3622 pub fn strcmp(
3623 __s1: *const libc::c_char,
3624 __s2: *const libc::c_char,
3625 ) -> libc::c_int;
3626 }
3627 extern "C" {
strncmp( __s1: *const libc::c_char, __s2: *const libc::c_char, __n: libc::c_ulong, ) -> libc::c_int3628 pub fn strncmp(
3629 __s1: *const libc::c_char,
3630 __s2: *const libc::c_char,
3631 __n: libc::c_ulong,
3632 ) -> libc::c_int;
3633 }
3634 extern "C" {
strcoll( __s1: *const libc::c_char, __s2: *const libc::c_char, ) -> libc::c_int3635 pub fn strcoll(
3636 __s1: *const libc::c_char,
3637 __s2: *const libc::c_char,
3638 ) -> libc::c_int;
3639 }
3640 extern "C" {
strxfrm( __dest: *mut libc::c_char, __src: *const libc::c_char, __n: libc::c_ulong, ) -> libc::c_ulong3641 pub fn strxfrm(
3642 __dest: *mut libc::c_char,
3643 __src: *const libc::c_char,
3644 __n: libc::c_ulong,
3645 ) -> libc::c_ulong;
3646 }
3647 #[repr(C)]
3648 #[derive(Debug, Copy, Clone)]
3649 pub struct __locale_struct {
3650 pub __locales: [*mut __locale_data; 13usize],
3651 pub __ctype_b: *const libc::c_ushort,
3652 pub __ctype_tolower: *const libc::c_int,
3653 pub __ctype_toupper: *const libc::c_int,
3654 pub __names: [*const libc::c_char; 13usize],
3655 }
3656 #[test]
bindgen_test_layout___locale_struct()3657 fn bindgen_test_layout___locale_struct() {
3658 assert_eq!(
3659 ::core::mem::size_of::<__locale_struct>(),
3660 232usize,
3661 concat!("Size of: ", stringify!(__locale_struct))
3662 );
3663 assert_eq!(
3664 ::core::mem::align_of::<__locale_struct>(),
3665 8usize,
3666 concat!("Alignment of ", stringify!(__locale_struct))
3667 );
3668 assert_eq!(
3669 unsafe {
3670 &(*(::core::ptr::null::<__locale_struct>())).__locales as *const _
3671 as usize
3672 },
3673 0usize,
3674 concat!(
3675 "Offset of field: ",
3676 stringify!(__locale_struct),
3677 "::",
3678 stringify!(__locales)
3679 )
3680 );
3681 assert_eq!(
3682 unsafe {
3683 &(*(::core::ptr::null::<__locale_struct>())).__ctype_b as *const _
3684 as usize
3685 },
3686 104usize,
3687 concat!(
3688 "Offset of field: ",
3689 stringify!(__locale_struct),
3690 "::",
3691 stringify!(__ctype_b)
3692 )
3693 );
3694 assert_eq!(
3695 unsafe {
3696 &(*(::core::ptr::null::<__locale_struct>())).__ctype_tolower
3697 as *const _ as usize
3698 },
3699 112usize,
3700 concat!(
3701 "Offset of field: ",
3702 stringify!(__locale_struct),
3703 "::",
3704 stringify!(__ctype_tolower)
3705 )
3706 );
3707 assert_eq!(
3708 unsafe {
3709 &(*(::core::ptr::null::<__locale_struct>())).__ctype_toupper
3710 as *const _ as usize
3711 },
3712 120usize,
3713 concat!(
3714 "Offset of field: ",
3715 stringify!(__locale_struct),
3716 "::",
3717 stringify!(__ctype_toupper)
3718 )
3719 );
3720 assert_eq!(
3721 unsafe {
3722 &(*(::core::ptr::null::<__locale_struct>())).__names as *const _
3723 as usize
3724 },
3725 128usize,
3726 concat!(
3727 "Offset of field: ",
3728 stringify!(__locale_struct),
3729 "::",
3730 stringify!(__names)
3731 )
3732 );
3733 }
3734 pub type __locale_t = *mut __locale_struct;
3735 pub type locale_t = __locale_t;
3736 extern "C" {
strcoll_l( __s1: *const libc::c_char, __s2: *const libc::c_char, __l: locale_t, ) -> libc::c_int3737 pub fn strcoll_l(
3738 __s1: *const libc::c_char,
3739 __s2: *const libc::c_char,
3740 __l: locale_t,
3741 ) -> libc::c_int;
3742 }
3743 extern "C" {
strxfrm_l( __dest: *mut libc::c_char, __src: *const libc::c_char, __n: usize, __l: locale_t, ) -> usize3744 pub fn strxfrm_l(
3745 __dest: *mut libc::c_char,
3746 __src: *const libc::c_char,
3747 __n: usize,
3748 __l: locale_t,
3749 ) -> usize;
3750 }
3751 extern "C" {
strdup(__s: *const libc::c_char) -> *mut libc::c_char3752 pub fn strdup(__s: *const libc::c_char) -> *mut libc::c_char;
3753 }
3754 extern "C" {
strndup( __string: *const libc::c_char, __n: libc::c_ulong, ) -> *mut libc::c_char3755 pub fn strndup(
3756 __string: *const libc::c_char,
3757 __n: libc::c_ulong,
3758 ) -> *mut libc::c_char;
3759 }
3760 extern "C" {
strchr( __s: *const libc::c_char, __c: libc::c_int, ) -> *mut libc::c_char3761 pub fn strchr(
3762 __s: *const libc::c_char,
3763 __c: libc::c_int,
3764 ) -> *mut libc::c_char;
3765 }
3766 extern "C" {
strrchr( __s: *const libc::c_char, __c: libc::c_int, ) -> *mut libc::c_char3767 pub fn strrchr(
3768 __s: *const libc::c_char,
3769 __c: libc::c_int,
3770 ) -> *mut libc::c_char;
3771 }
3772 extern "C" {
strcspn( __s: *const libc::c_char, __reject: *const libc::c_char, ) -> libc::c_ulong3773 pub fn strcspn(
3774 __s: *const libc::c_char,
3775 __reject: *const libc::c_char,
3776 ) -> libc::c_ulong;
3777 }
3778 extern "C" {
strspn( __s: *const libc::c_char, __accept: *const libc::c_char, ) -> libc::c_ulong3779 pub fn strspn(
3780 __s: *const libc::c_char,
3781 __accept: *const libc::c_char,
3782 ) -> libc::c_ulong;
3783 }
3784 extern "C" {
strpbrk( __s: *const libc::c_char, __accept: *const libc::c_char, ) -> *mut libc::c_char3785 pub fn strpbrk(
3786 __s: *const libc::c_char,
3787 __accept: *const libc::c_char,
3788 ) -> *mut libc::c_char;
3789 }
3790 extern "C" {
strstr( __haystack: *const libc::c_char, __needle: *const libc::c_char, ) -> *mut libc::c_char3791 pub fn strstr(
3792 __haystack: *const libc::c_char,
3793 __needle: *const libc::c_char,
3794 ) -> *mut libc::c_char;
3795 }
3796 extern "C" {
strtok( __s: *mut libc::c_char, __delim: *const libc::c_char, ) -> *mut libc::c_char3797 pub fn strtok(
3798 __s: *mut libc::c_char,
3799 __delim: *const libc::c_char,
3800 ) -> *mut libc::c_char;
3801 }
3802 extern "C" {
__strtok_r( __s: *mut libc::c_char, __delim: *const libc::c_char, __save_ptr: *mut *mut libc::c_char, ) -> *mut libc::c_char3803 pub fn __strtok_r(
3804 __s: *mut libc::c_char,
3805 __delim: *const libc::c_char,
3806 __save_ptr: *mut *mut libc::c_char,
3807 ) -> *mut libc::c_char;
3808 }
3809 extern "C" {
strtok_r( __s: *mut libc::c_char, __delim: *const libc::c_char, __save_ptr: *mut *mut libc::c_char, ) -> *mut libc::c_char3810 pub fn strtok_r(
3811 __s: *mut libc::c_char,
3812 __delim: *const libc::c_char,
3813 __save_ptr: *mut *mut libc::c_char,
3814 ) -> *mut libc::c_char;
3815 }
3816 extern "C" {
strlen(__s: *const libc::c_char) -> libc::c_ulong3817 pub fn strlen(__s: *const libc::c_char) -> libc::c_ulong;
3818 }
3819 extern "C" {
strnlen(__string: *const libc::c_char, __maxlen: usize) -> usize3820 pub fn strnlen(__string: *const libc::c_char, __maxlen: usize) -> usize;
3821 }
3822 extern "C" {
strerror(__errnum: libc::c_int) -> *mut libc::c_char3823 pub fn strerror(__errnum: libc::c_int) -> *mut libc::c_char;
3824 }
3825 extern "C" {
3826 #[link_name = "\u{1}__xpg_strerror_r"]
strerror_r( __errnum: libc::c_int, __buf: *mut libc::c_char, __buflen: usize, ) -> libc::c_int3827 pub fn strerror_r(
3828 __errnum: libc::c_int,
3829 __buf: *mut libc::c_char,
3830 __buflen: usize,
3831 ) -> libc::c_int;
3832 }
3833 extern "C" {
strerror_l( __errnum: libc::c_int, __l: locale_t, ) -> *mut libc::c_char3834 pub fn strerror_l(
3835 __errnum: libc::c_int,
3836 __l: locale_t,
3837 ) -> *mut libc::c_char;
3838 }
3839 extern "C" {
bcmp( __s1: *const libc::c_void, __s2: *const libc::c_void, __n: libc::c_ulong, ) -> libc::c_int3840 pub fn bcmp(
3841 __s1: *const libc::c_void,
3842 __s2: *const libc::c_void,
3843 __n: libc::c_ulong,
3844 ) -> libc::c_int;
3845 }
3846 extern "C" {
bcopy( __src: *const libc::c_void, __dest: *mut libc::c_void, __n: usize, )3847 pub fn bcopy(
3848 __src: *const libc::c_void,
3849 __dest: *mut libc::c_void,
3850 __n: usize,
3851 );
3852 }
3853 extern "C" {
bzero(__s: *mut libc::c_void, __n: libc::c_ulong)3854 pub fn bzero(__s: *mut libc::c_void, __n: libc::c_ulong);
3855 }
3856 extern "C" {
index( __s: *const libc::c_char, __c: libc::c_int, ) -> *mut libc::c_char3857 pub fn index(
3858 __s: *const libc::c_char,
3859 __c: libc::c_int,
3860 ) -> *mut libc::c_char;
3861 }
3862 extern "C" {
rindex( __s: *const libc::c_char, __c: libc::c_int, ) -> *mut libc::c_char3863 pub fn rindex(
3864 __s: *const libc::c_char,
3865 __c: libc::c_int,
3866 ) -> *mut libc::c_char;
3867 }
3868 extern "C" {
ffs(__i: libc::c_int) -> libc::c_int3869 pub fn ffs(__i: libc::c_int) -> libc::c_int;
3870 }
3871 extern "C" {
ffsl(__l: libc::c_long) -> libc::c_int3872 pub fn ffsl(__l: libc::c_long) -> libc::c_int;
3873 }
3874 extern "C" {
ffsll(__ll: libc::c_longlong) -> libc::c_int3875 pub fn ffsll(__ll: libc::c_longlong) -> libc::c_int;
3876 }
3877 extern "C" {
strcasecmp( __s1: *const libc::c_char, __s2: *const libc::c_char, ) -> libc::c_int3878 pub fn strcasecmp(
3879 __s1: *const libc::c_char,
3880 __s2: *const libc::c_char,
3881 ) -> libc::c_int;
3882 }
3883 extern "C" {
strncasecmp( __s1: *const libc::c_char, __s2: *const libc::c_char, __n: libc::c_ulong, ) -> libc::c_int3884 pub fn strncasecmp(
3885 __s1: *const libc::c_char,
3886 __s2: *const libc::c_char,
3887 __n: libc::c_ulong,
3888 ) -> libc::c_int;
3889 }
3890 extern "C" {
strcasecmp_l( __s1: *const libc::c_char, __s2: *const libc::c_char, __loc: locale_t, ) -> libc::c_int3891 pub fn strcasecmp_l(
3892 __s1: *const libc::c_char,
3893 __s2: *const libc::c_char,
3894 __loc: locale_t,
3895 ) -> libc::c_int;
3896 }
3897 extern "C" {
strncasecmp_l( __s1: *const libc::c_char, __s2: *const libc::c_char, __n: usize, __loc: locale_t, ) -> libc::c_int3898 pub fn strncasecmp_l(
3899 __s1: *const libc::c_char,
3900 __s2: *const libc::c_char,
3901 __n: usize,
3902 __loc: locale_t,
3903 ) -> libc::c_int;
3904 }
3905 extern "C" {
explicit_bzero(__s: *mut libc::c_void, __n: usize)3906 pub fn explicit_bzero(__s: *mut libc::c_void, __n: usize);
3907 }
3908 extern "C" {
strsep( __stringp: *mut *mut libc::c_char, __delim: *const libc::c_char, ) -> *mut libc::c_char3909 pub fn strsep(
3910 __stringp: *mut *mut libc::c_char,
3911 __delim: *const libc::c_char,
3912 ) -> *mut libc::c_char;
3913 }
3914 extern "C" {
strsignal(__sig: libc::c_int) -> *mut libc::c_char3915 pub fn strsignal(__sig: libc::c_int) -> *mut libc::c_char;
3916 }
3917 extern "C" {
__stpcpy( __dest: *mut libc::c_char, __src: *const libc::c_char, ) -> *mut libc::c_char3918 pub fn __stpcpy(
3919 __dest: *mut libc::c_char,
3920 __src: *const libc::c_char,
3921 ) -> *mut libc::c_char;
3922 }
3923 extern "C" {
stpcpy( __dest: *mut libc::c_char, __src: *const libc::c_char, ) -> *mut libc::c_char3924 pub fn stpcpy(
3925 __dest: *mut libc::c_char,
3926 __src: *const libc::c_char,
3927 ) -> *mut libc::c_char;
3928 }
3929 extern "C" {
__stpncpy( __dest: *mut libc::c_char, __src: *const libc::c_char, __n: usize, ) -> *mut libc::c_char3930 pub fn __stpncpy(
3931 __dest: *mut libc::c_char,
3932 __src: *const libc::c_char,
3933 __n: usize,
3934 ) -> *mut libc::c_char;
3935 }
3936 extern "C" {
stpncpy( __dest: *mut libc::c_char, __src: *const libc::c_char, __n: libc::c_ulong, ) -> *mut libc::c_char3937 pub fn stpncpy(
3938 __dest: *mut libc::c_char,
3939 __src: *const libc::c_char,
3940 __n: libc::c_ulong,
3941 ) -> *mut libc::c_char;
3942 }
3943 #[repr(C)]
3944 #[derive(Debug, Copy, Clone)]
3945 pub struct ZSTDMT_CCtx_s {
3946 _unused: [u8; 0],
3947 }
3948 pub type ZSTDMT_CCtx = ZSTDMT_CCtx_s;
3949 extern "C" {
ZSTDMT_createCCtx_advanced( nbWorkers: libc::c_uint, cMem: ZSTD_customMem, pool: *mut ZSTD_threadPool, ) -> *mut ZSTDMT_CCtx3950 pub fn ZSTDMT_createCCtx_advanced(
3951 nbWorkers: libc::c_uint,
3952 cMem: ZSTD_customMem,
3953 pool: *mut ZSTD_threadPool,
3954 ) -> *mut ZSTDMT_CCtx;
3955 }
3956 extern "C" {
ZSTDMT_freeCCtx(mtctx: *mut ZSTDMT_CCtx) -> usize3957 pub fn ZSTDMT_freeCCtx(mtctx: *mut ZSTDMT_CCtx) -> usize;
3958 }
3959 extern "C" {
ZSTDMT_sizeof_CCtx(mtctx: *mut ZSTDMT_CCtx) -> usize3960 pub fn ZSTDMT_sizeof_CCtx(mtctx: *mut ZSTDMT_CCtx) -> usize;
3961 }
3962 extern "C" {
ZSTDMT_nextInputSizeHint(mtctx: *const ZSTDMT_CCtx) -> usize3963 pub fn ZSTDMT_nextInputSizeHint(mtctx: *const ZSTDMT_CCtx) -> usize;
3964 }
3965 extern "C" {
3966 #[doc = " ZSTDMT_initCStream_internal() :"]
3967 #[doc = " Private use only. Init streaming operation."]
3968 #[doc = " expects params to be valid."]
3969 #[doc = " must receive dict, or cdict, or none, but not both."]
3970 #[doc = " @return : 0, or an error code"]
ZSTDMT_initCStream_internal( zcs: *mut ZSTDMT_CCtx, dict: *const libc::c_void, dictSize: usize, dictContentType: ZSTD_dictContentType_e, cdict: *const ZSTD_CDict, params: ZSTD_CCtx_params, pledgedSrcSize: libc::c_ulonglong, ) -> usize3971 pub fn ZSTDMT_initCStream_internal(
3972 zcs: *mut ZSTDMT_CCtx,
3973 dict: *const libc::c_void,
3974 dictSize: usize,
3975 dictContentType: ZSTD_dictContentType_e,
3976 cdict: *const ZSTD_CDict,
3977 params: ZSTD_CCtx_params,
3978 pledgedSrcSize: libc::c_ulonglong,
3979 ) -> usize;
3980 }
3981 extern "C" {
3982 #[doc = " ZSTDMT_compressStream_generic() :"]
3983 #[doc = " Combines ZSTDMT_compressStream() with optional ZSTDMT_flushStream() or ZSTDMT_endStream()"]
3984 #[doc = " depending on flush directive."]
3985 #[doc = " @return : minimum amount of data still to be flushed"]
3986 #[doc = " 0 if fully flushed"]
3987 #[doc = " or an error code"]
3988 #[doc = " note : needs to be init using any ZSTD_initCStream*() variant"]
ZSTDMT_compressStream_generic( mtctx: *mut ZSTDMT_CCtx, output: *mut ZSTD_outBuffer, input: *mut ZSTD_inBuffer, endOp: ZSTD_EndDirective, ) -> usize3989 pub fn ZSTDMT_compressStream_generic(
3990 mtctx: *mut ZSTDMT_CCtx,
3991 output: *mut ZSTD_outBuffer,
3992 input: *mut ZSTD_inBuffer,
3993 endOp: ZSTD_EndDirective,
3994 ) -> usize;
3995 }
3996 extern "C" {
3997 #[doc = " ZSTDMT_toFlushNow()"]
3998 #[doc = " Tell how many bytes are ready to be flushed immediately."]
3999 #[doc = " Probe the oldest active job (not yet entirely flushed) and check its output buffer."]
4000 #[doc = " If return 0, it means there is no active job,"]
4001 #[doc = " or, it means oldest job is still active, but everything produced has been flushed so far,"]
4002 #[doc = " therefore flushing is limited by speed of oldest job."]
ZSTDMT_toFlushNow(mtctx: *mut ZSTDMT_CCtx) -> usize4003 pub fn ZSTDMT_toFlushNow(mtctx: *mut ZSTDMT_CCtx) -> usize;
4004 }
4005 extern "C" {
4006 #[doc = " ZSTDMT_updateCParams_whileCompressing() :"]
4007 #[doc = " Updates only a selected set of compression parameters, to remain compatible with current frame."]
4008 #[doc = " New parameters will be applied to next compression job."]
ZSTDMT_updateCParams_whileCompressing( mtctx: *mut ZSTDMT_CCtx, cctxParams: *const ZSTD_CCtx_params, )4009 pub fn ZSTDMT_updateCParams_whileCompressing(
4010 mtctx: *mut ZSTDMT_CCtx,
4011 cctxParams: *const ZSTD_CCtx_params,
4012 );
4013 }
4014 extern "C" {
4015 #[doc = " ZSTDMT_getFrameProgression():"]
4016 #[doc = " tells how much data has been consumed (input) and produced (output) for current frame."]
4017 #[doc = " able to count progression inside worker threads."]
ZSTDMT_getFrameProgression( mtctx: *mut ZSTDMT_CCtx, ) -> ZSTD_frameProgression4018 pub fn ZSTDMT_getFrameProgression(
4019 mtctx: *mut ZSTDMT_CCtx,
4020 ) -> ZSTD_frameProgression;
4021 }
4022 #[repr(C)]
4023 #[derive(Debug, Copy, Clone)]
4024 pub struct __locale_data {
4025 pub _address: u8,
4026 }
4027