Skip to main content

zstd_sys/
bindings_zstd_experimental.rs

1/*
2This file is auto-generated from the public API of the zstd library.
3It is released under the same BSD license.
4
5BSD License
6
7For Zstandard software
8
9Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
10
11Redistribution and use in source and binary forms, with or without modification,
12are 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 Meta, nor the names of its contributors may
22   be used to endorse or promote products derived from this software without
23   specific prior written permission.
24
25THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
26ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
29ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
32ANY 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
34SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35*/
36/* automatically generated by rust-bindgen 0.73.2 */
37
38#[doc = "Introduction\n\nzstd, short for Zstandard, is a fast lossless compression algorithm, targeting\nreal-time compression scenarios at zlib-level and better compression ratios.\nThe zstd compression library provides in-memory compression and decompression\nfunctions.\n\nThe library supports regular compression levels from 1 up to ZSTD_maxCLevel(),\nwhich is currently 22. Levels >= 20, labeled `--ultra`, should be used with\ncaution, as they require more memory. The library also offers negative\ncompression levels, which extend the range of speed vs. ratio preferences.\nThe lower the level, the faster the speed (at the cost of compression).\n\nCompression can be done in:\n- a single step (described as Simple API)\n- a single step, reusing a context (described as Explicit context)\n- unbounded multiple steps (described as Streaming compression)\n\nThe compression ratio achievable on small data can be highly improved using\na dictionary. Dictionary compression can be performed in:\n- a single step (described as Simple dictionary API)\n- a single step, reusing a dictionary (described as Bulk-processing\ndictionary API)\n\nAdvanced experimental functions can be accessed using\n`#define ZSTD_STATIC_LINKING_ONLY` before including zstd.h.\n\nAdvanced experimental APIs should never be used with a dynamically-linked\nlibrary. They are not \"stable\"; their definitions or signatures may change in\nthe future. Only static linking is allowed."]
39pub const ZSTD_VERSION_MAJOR: u32 = 1;
40pub const ZSTD_VERSION_MINOR: u32 = 6;
41pub const ZSTD_VERSION_RELEASE: u32 = 0;
42pub const ZSTD_VERSION_NUMBER: u32 = 10600;
43pub const ZSTD_CLEVEL_DEFAULT: u32 = 3;
44pub const ZSTD_MAGICNUMBER: u32 = 4247762216;
45pub const ZSTD_MAGIC_DICTIONARY: u32 = 3962610743;
46pub const ZSTD_MAGIC_SKIPPABLE_START: u32 = 407710288;
47pub const ZSTD_MAGIC_SKIPPABLE_MASK: u32 = 4294967280;
48pub const ZSTD_BLOCKSIZELOG_MAX: u32 = 17;
49pub const ZSTD_BLOCKSIZE_MAX: u32 = 131072;
50#[doc = " @brief Returns the decompressed content size stored in a ZSTD frame header.\n\n  @since v1.3.0\n\n  @param src Pointer to the beginning of a ZSTD encoded frame.\n  @param srcSize Size of the buffer pointed to by @p src. It must be at least as large as the frame header.\n                 Any value greater than or equal to `ZSTD_frameHeaderSize_max` is sufficient.\n  @return The decompressed size in bytes when the value is available in the frame header.\n  @retval ZSTD_CONTENTSIZE_UNKNOWN The frame does not encode a decompressed size (typical for streaming).\n  @retval ZSTD_CONTENTSIZE_ERROR An error occurred (e.g. invalid magic number, @p srcSize too small).\n\n  @note The return value is not compatible with `ZSTD_isError()`.\n  @note A return value of 0 denotes a valid but empty frame. Skippable frames also report 0.\n  @note The decompressed size field is optional. When it is absent (the function returns @c ZSTD_CONTENTSIZE_UNKNOWN),\n        the caller must rely on streaming decompression or an application-specific upper bound. `ZSTD_decompress()`\n        only requires an upper bound, so applications may enforce their own block limits (for example 16 KB).\n  @note The decompressed size is guaranteed to be present when compression was performed with single-pass APIs such as\n        `ZSTD_compress()`, `ZSTD_compressCCtx()`, `ZSTD_compress_usingDict()`, or `ZSTD_compress_usingCDict()`.\n  @note The decompressed size is a 64-bit value and may exceed the addressable space of the system. Use streaming\n        decompression when the value is too large to materialize in contiguous memory.\n  @warning When processing untrusted input, validate the returned size against the application's limits; attackers may\n           forge an arbitrarily large value.\n  @note This function replaces `ZSTD_getDecompressedSize()`."]
51pub const ZSTD_CONTENTSIZE_UNKNOWN: i32 = -1;
52pub const ZSTD_CONTENTSIZE_ERROR: i32 = -2;
53pub const ZSTD_FRAMEHEADERSIZE_MAX: u32 = 18;
54pub const ZSTD_SKIPPABLEHEADERSIZE: u32 = 8;
55pub const ZSTD_WINDOWLOG_MAX_32: u32 = 30;
56pub const ZSTD_WINDOWLOG_MAX_64: u32 = 31;
57pub const ZSTD_WINDOWLOG_MIN: u32 = 10;
58pub const ZSTD_HASHLOG_MIN: u32 = 6;
59pub const ZSTD_CHAINLOG_MAX_32: u32 = 29;
60pub const ZSTD_CHAINLOG_MAX_64: u32 = 30;
61pub const ZSTD_CHAINLOG_MIN: u32 = 6;
62pub const ZSTD_SEARCHLOG_MIN: u32 = 1;
63pub const ZSTD_MINMATCH_MAX: u32 = 7;
64pub const ZSTD_MINMATCH_MIN: u32 = 3;
65pub const ZSTD_TARGETLENGTH_MAX: u32 = 131072;
66pub const ZSTD_TARGETLENGTH_MIN: u32 = 0;
67pub const ZSTD_BLOCKSIZE_MAX_MIN: u32 = 1024;
68pub const ZSTD_OVERLAPLOG_MIN: u32 = 0;
69pub const ZSTD_OVERLAPLOG_MAX: u32 = 9;
70pub const ZSTD_WINDOWLOG_LIMIT_DEFAULT: u32 = 27;
71pub const ZSTD_LDM_HASHLOG_MIN: u32 = 6;
72pub const ZSTD_LDM_MINMATCH_MIN: u32 = 4;
73pub const ZSTD_LDM_MINMATCH_MAX: u32 = 4096;
74pub const ZSTD_LDM_BUCKETSIZELOG_MIN: u32 = 1;
75pub const ZSTD_LDM_BUCKETSIZELOG_MAX: u32 = 8;
76pub const ZSTD_LDM_HASHRATELOG_MIN: u32 = 0;
77pub const ZSTD_TARGETCBLOCKSIZE_MIN: u32 = 1340;
78pub const ZSTD_TARGETCBLOCKSIZE_MAX: u32 = 131072;
79pub const ZSTD_SRCSIZEHINT_MIN: u32 = 0;
80pub const ZSTD_BLOCKSPLITTER_LEVEL_MAX: u32 = 6;
81#[repr(u32)]
82#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
83pub enum ZSTD_ErrorCode {
84    ZSTD_error_no_error = 0,
85    ZSTD_error_GENERIC = 1,
86    ZSTD_error_prefix_unknown = 10,
87    ZSTD_error_version_unsupported = 12,
88    ZSTD_error_frameParameter_unsupported = 14,
89    ZSTD_error_frameParameter_windowTooLarge = 16,
90    ZSTD_error_corruption_detected = 20,
91    ZSTD_error_checksum_wrong = 22,
92    ZSTD_error_literals_headerWrong = 24,
93    ZSTD_error_dictionary_corrupted = 30,
94    ZSTD_error_dictionary_wrong = 32,
95    ZSTD_error_dictionaryCreation_failed = 34,
96    ZSTD_error_parameter_unsupported = 40,
97    ZSTD_error_parameter_combination_unsupported = 41,
98    ZSTD_error_parameter_outOfBound = 42,
99    ZSTD_error_tableLog_tooLarge = 44,
100    ZSTD_error_maxSymbolValue_tooLarge = 46,
101    ZSTD_error_maxSymbolValue_tooSmall = 48,
102    ZSTD_error_cannotProduce_uncompressedBlock = 49,
103    ZSTD_error_stabilityCondition_notRespected = 50,
104    ZSTD_error_stage_wrong = 60,
105    ZSTD_error_init_missing = 62,
106    ZSTD_error_memory_allocation = 64,
107    ZSTD_error_workSpace_tooSmall = 66,
108    ZSTD_error_dstSize_tooSmall = 70,
109    ZSTD_error_srcSize_wrong = 72,
110    ZSTD_error_dstBuffer_null = 74,
111    ZSTD_error_noForwardProgress_destFull = 80,
112    ZSTD_error_noForwardProgress_inputEmpty = 82,
113    ZSTD_error_frameIndex_tooLarge = 100,
114    ZSTD_error_seekableIO = 102,
115    ZSTD_error_dstBuffer_wrong = 104,
116    ZSTD_error_srcBuffer_wrong = 105,
117    ZSTD_error_sequenceProducer_failed = 106,
118    ZSTD_error_externalSequences_invalid = 107,
119    ZSTD_error_maxCode = 120,
120}
121extern "C" {
122    pub fn ZSTD_getErrorString(
123        code: ZSTD_ErrorCode,
124    ) -> *const ::core::ffi::c_char;
125}
126extern "C" {
127    #[doc = " ZSTD_versionNumber() :\n  Return runtime library version, the value is (MAJOR*100*100 + MINOR*100 + RELEASE)."]
128    pub fn ZSTD_versionNumber() -> ::core::ffi::c_uint;
129}
130extern "C" {
131    #[doc = " ZSTD_versionString() :\n  Return runtime library version, like \"1.4.5\". Requires v1.3.0+."]
132    pub fn ZSTD_versionString() -> *const ::core::ffi::c_char;
133}
134extern "C" {
135    #[doc = "  Simple Core API\n/\n/*! ZSTD_compress() :\n  Compresses `src` content as a single zstd compressed frame into already allocated `dst`.\n  NOTE: Providing `dstCapacity >= ZSTD_compressBound(srcSize)` guarantees that zstd will have\n        enough space to successfully compress the data.\n  @return : compressed size written into `dst` (<= `dstCapacity),\n            or an error code if it fails (which can be tested using ZSTD_isError())."]
136    pub fn ZSTD_compress(
137        dst: *mut ::core::ffi::c_void,
138        dstCapacity: usize,
139        src: *const ::core::ffi::c_void,
140        srcSize: usize,
141        compressionLevel: ::core::ffi::c_int,
142    ) -> usize;
143}
144extern "C" {
145    #[doc = " ZSTD_decompress() :\n `compressedSize` : must be the _exact_ size of some number of compressed and/or skippable frames.\n  Multiple compressed frames can be decompressed at once with this method.\n  The result will be the concatenation of all decompressed frames, back to back.\n `dstCapacity` is an upper bound of originalSize to regenerate.\n  First frame's decompressed size can be extracted using ZSTD_getFrameContentSize().\n  If maximum upper bound isn't known, prefer using streaming mode to decompress data.\n @return : the number of bytes decompressed into `dst` (<= `dstCapacity`),\n           or an errorCode if it fails (which can be tested using ZSTD_isError())."]
146    pub fn ZSTD_decompress(
147        dst: *mut ::core::ffi::c_void,
148        dstCapacity: usize,
149        src: *const ::core::ffi::c_void,
150        compressedSize: usize,
151    ) -> usize;
152}
153extern "C" {
154    pub fn ZSTD_getFrameContentSize(
155        src: *const ::core::ffi::c_void,
156        srcSize: usize,
157    ) -> ::core::ffi::c_ulonglong;
158}
159extern "C" {
160    #[doc = " ZSTD_getDecompressedSize() (obsolete):\n  This function is now obsolete, in favor of ZSTD_getFrameContentSize().\n  Both functions work the same way, but ZSTD_getDecompressedSize() blends\n  \"empty\", \"unknown\" and \"error\" results to the same return value (0),\n  while ZSTD_getFrameContentSize() gives them separate return values.\n @return : decompressed size of `src` frame content _if known and not empty_, 0 otherwise."]
161    pub fn ZSTD_getDecompressedSize(
162        src: *const ::core::ffi::c_void,
163        srcSize: usize,
164    ) -> ::core::ffi::c_ulonglong;
165}
166extern "C" {
167    #[doc = " ZSTD_findFrameCompressedSize() : Requires v1.4.0+\n `src` should point to the start of a ZSTD frame or skippable frame.\n `srcSize` must be >= first frame size\n @return : the compressed size of the first frame starting at `src`,\n           suitable to pass as `srcSize` to `ZSTD_decompress` or similar,\n           or an error code if input is invalid\n  Note 1: this method is called _find*() because it's not enough to read the header,\n          it may have to scan through the frame's content, to reach its end.\n  Note 2: this method also works with Skippable Frames. In which case,\n          it returns the size of the complete skippable frame,\n          which is always equal to its content size + 8 bytes for headers."]
168    pub fn ZSTD_findFrameCompressedSize(
169        src: *const ::core::ffi::c_void,
170        srcSize: usize,
171    ) -> usize;
172}
173#[repr(u32)]
174#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
175pub enum ZSTD_FrameType_e {
176    ZSTD_frame = 0,
177    ZSTD_skippableFrame = 1,
178}
179#[repr(C)]
180#[derive(Debug, Copy, Clone)]
181pub struct ZSTD_FrameHeader {
182    #[doc = "< if == ZSTD_CONTENTSIZE_UNKNOWN, it means this field is not available. 0 means \"empty\""]
183    pub frameContentSize: ::core::ffi::c_ulonglong,
184    #[doc = "< can be very large, up to <= frameContentSize"]
185    pub windowSize: ::core::ffi::c_ulonglong,
186    pub blockSizeMax: ::core::ffi::c_uint,
187    #[doc = "< if == ZSTD_skippableFrame, frameContentSize is the size of skippable content"]
188    pub frameType: ZSTD_FrameType_e,
189    pub headerSize: ::core::ffi::c_uint,
190    #[doc = "< for ZSTD_skippableFrame, contains the skippable magic variant [0-15]"]
191    pub dictID: ::core::ffi::c_uint,
192    pub checksumFlag: ::core::ffi::c_uint,
193    pub _reserved1: ::core::ffi::c_uint,
194    pub _reserved2: ::core::ffi::c_uint,
195}
196extern "C" {
197    #[doc = " ZSTD_getFrameHeader() : Requires v1.6.0+\n  decode Frame Header into `zfhPtr`, or requires larger `srcSize`.\n @return : 0 => header is complete, `zfhPtr` is correctly filled,\n          >0 => `srcSize` is too small, @return value is the wanted `srcSize` amount, `zfhPtr` is not filled,\n           or an error code, which can be tested using ZSTD_isError()"]
198    pub fn ZSTD_getFrameHeader(
199        zfhPtr: *mut ZSTD_FrameHeader,
200        src: *const ::core::ffi::c_void,
201        srcSize: usize,
202    ) -> usize;
203}
204extern "C" {
205    pub fn ZSTD_compressBound(srcSize: usize) -> usize;
206}
207extern "C" {
208    pub fn ZSTD_isError(result: usize) -> ::core::ffi::c_uint;
209}
210extern "C" {
211    pub fn ZSTD_getErrorCode(functionResult: usize) -> ZSTD_ErrorCode;
212}
213extern "C" {
214    pub fn ZSTD_getErrorName(result: usize) -> *const ::core::ffi::c_char;
215}
216extern "C" {
217    pub fn ZSTD_minCLevel() -> ::core::ffi::c_int;
218}
219extern "C" {
220    pub fn ZSTD_maxCLevel() -> ::core::ffi::c_int;
221}
222extern "C" {
223    pub fn ZSTD_defaultCLevel() -> ::core::ffi::c_int;
224}
225#[repr(C)]
226#[derive(Debug, Copy, Clone)]
227pub struct ZSTD_CCtx_s {
228    _unused: [u8; 0],
229}
230#[doc = "  Explicit context"]
231pub type ZSTD_CCtx = ZSTD_CCtx_s;
232extern "C" {
233    pub fn ZSTD_createCCtx() -> *mut ZSTD_CCtx;
234}
235extern "C" {
236    pub fn ZSTD_freeCCtx(cctx: *mut ZSTD_CCtx) -> usize;
237}
238extern "C" {
239    #[doc = " ZSTD_compressCCtx() :\n  Same as ZSTD_compress(), using an explicit ZSTD_CCtx.\n  Important : in order to mirror `ZSTD_compress()` behavior,\n  this function compresses at the requested compression level,\n  __ignoring any other advanced parameter__ .\n  If any advanced parameter was set using the advanced API,\n  they will all be reset. Only @compressionLevel remains."]
240    pub fn ZSTD_compressCCtx(
241        cctx: *mut ZSTD_CCtx,
242        dst: *mut ::core::ffi::c_void,
243        dstCapacity: usize,
244        src: *const ::core::ffi::c_void,
245        srcSize: usize,
246        compressionLevel: ::core::ffi::c_int,
247    ) -> usize;
248}
249#[repr(C)]
250#[derive(Debug, Copy, Clone)]
251pub struct ZSTD_DCtx_s {
252    _unused: [u8; 0],
253}
254pub type ZSTD_DCtx = ZSTD_DCtx_s;
255extern "C" {
256    pub fn ZSTD_createDCtx() -> *mut ZSTD_DCtx;
257}
258extern "C" {
259    pub fn ZSTD_freeDCtx(dctx: *mut ZSTD_DCtx) -> usize;
260}
261extern "C" {
262    #[doc = " ZSTD_decompressDCtx() :\n  Same as ZSTD_decompress(),\n  requires an allocated ZSTD_DCtx.\n  Compatible with sticky parameters (see below).\n  The streaming session of @dctx is reset first, as with\n  ZSTD_DCtx_reset(dctx, ZSTD_reset_session_only).\n  See ZSTD_DCtx_refPrefix() for the effect on a referenced prefix."]
263    pub fn ZSTD_decompressDCtx(
264        dctx: *mut ZSTD_DCtx,
265        dst: *mut ::core::ffi::c_void,
266        dstCapacity: usize,
267        src: *const ::core::ffi::c_void,
268        srcSize: usize,
269    ) -> usize;
270}
271#[repr(u32)]
272#[doc = "  Advanced compression API (Requires v1.4.0+)"]
273#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
274pub enum ZSTD_strategy {
275    ZSTD_fast = 1,
276    ZSTD_dfast = 2,
277    ZSTD_greedy = 3,
278    ZSTD_lazy = 4,
279    ZSTD_lazy2 = 5,
280    ZSTD_btlazy2 = 6,
281    ZSTD_btopt = 7,
282    ZSTD_btultra = 8,
283    ZSTD_btultra2 = 9,
284}
285#[repr(u32)]
286#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
287pub enum ZSTD_cParameter {
288    ZSTD_c_compressionLevel = 100,
289    ZSTD_c_windowLog = 101,
290    ZSTD_c_hashLog = 102,
291    ZSTD_c_chainLog = 103,
292    ZSTD_c_searchLog = 104,
293    ZSTD_c_minMatch = 105,
294    ZSTD_c_targetLength = 106,
295    ZSTD_c_strategy = 107,
296    ZSTD_c_targetCBlockSize = 130,
297    ZSTD_c_enableLongDistanceMatching = 160,
298    ZSTD_c_ldmHashLog = 161,
299    ZSTD_c_ldmMinMatch = 162,
300    ZSTD_c_ldmBucketSizeLog = 163,
301    ZSTD_c_ldmHashRateLog = 164,
302    ZSTD_c_contentSizeFlag = 200,
303    ZSTD_c_checksumFlag = 201,
304    ZSTD_c_dictIDFlag = 202,
305    ZSTD_c_nbWorkers = 400,
306    ZSTD_c_jobSize = 401,
307    ZSTD_c_overlapLog = 402,
308    ZSTD_c_experimentalParam1 = 500,
309    ZSTD_c_experimentalParam2 = 10,
310    ZSTD_c_experimentalParam3 = 1000,
311    ZSTD_c_experimentalParam4 = 1001,
312    ZSTD_c_experimentalParam5 = 1002,
313    ZSTD_c_experimentalParam7 = 1004,
314    ZSTD_c_experimentalParam8 = 1005,
315    ZSTD_c_experimentalParam9 = 1006,
316    ZSTD_c_experimentalParam10 = 1007,
317    ZSTD_c_experimentalParam11 = 1008,
318    ZSTD_c_experimentalParam12 = 1009,
319    ZSTD_c_experimentalParam13 = 1010,
320    ZSTD_c_experimentalParam14 = 1011,
321    ZSTD_c_experimentalParam15 = 1012,
322    ZSTD_c_experimentalParam16 = 1013,
323    ZSTD_c_experimentalParam17 = 1014,
324    ZSTD_c_experimentalParam18 = 1015,
325    ZSTD_c_experimentalParam19 = 1016,
326    ZSTD_c_experimentalParam20 = 1017,
327}
328#[repr(C)]
329#[derive(Debug, Copy, Clone)]
330pub struct ZSTD_bounds {
331    pub error: usize,
332    pub lowerBound: ::core::ffi::c_int,
333    pub upperBound: ::core::ffi::c_int,
334}
335extern "C" {
336    #[doc = " ZSTD_cParam_getBounds() :\n  All parameters must belong to an interval with lower and upper bounds,\n  otherwise they will either trigger an error or be automatically clamped.\n @return : a structure, ZSTD_bounds, which contains\n         - an error status field, which must be tested using ZSTD_isError()\n         - lower and upper bounds, both inclusive"]
337    pub fn ZSTD_cParam_getBounds(cParam: ZSTD_cParameter) -> ZSTD_bounds;
338}
339extern "C" {
340    #[doc = " ZSTD_CCtx_setParameter() :\n  Set one compression parameter, selected by enum ZSTD_cParameter.\n  All parameters have valid bounds. Bounds can be queried using ZSTD_cParam_getBounds().\n  Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter).\n  Setting a parameter is generally only possible during frame initialization (before starting compression).\n  Exception : when using multi-threading mode (nbWorkers >= 1),\n              the following parameters can be updated _during_ compression (within same frame):\n              => compressionLevel, hashLog, chainLog, searchLog, minMatch, targetLength and strategy.\n              new parameters will be active for next job only (after a flush()).\n @return : an error code (which can be tested using ZSTD_isError())."]
341    pub fn ZSTD_CCtx_setParameter(
342        cctx: *mut ZSTD_CCtx,
343        param: ZSTD_cParameter,
344        value: ::core::ffi::c_int,
345    ) -> usize;
346}
347extern "C" {
348    #[doc = " ZSTD_CCtx_setPledgedSrcSize() :\n  Total input data size to be compressed as a single frame.\n  Value will be written in frame header, unless if explicitly forbidden using ZSTD_c_contentSizeFlag.\n  This value will also be controlled at end of frame, and trigger an error if not respected.\n @result : 0, or an error code (which can be tested with ZSTD_isError()).\n  Note 1 : pledgedSrcSize==0 actually means zero, aka an empty frame.\n           In order to mean \"unknown content size\", pass constant ZSTD_CONTENTSIZE_UNKNOWN.\n           ZSTD_CONTENTSIZE_UNKNOWN is default value for any new frame.\n  Note 2 : pledgedSrcSize is only valid once, for the next frame.\n           It's discarded at the end of the frame, and replaced by ZSTD_CONTENTSIZE_UNKNOWN.\n  Note 3 : Whenever all input data is provided and consumed in a single round,\n           for example with ZSTD_compress2(),\n           or invoking immediately ZSTD_compressStream2(,,,ZSTD_e_end),\n           this value is automatically overridden by srcSize instead."]
349    pub fn ZSTD_CCtx_setPledgedSrcSize(
350        cctx: *mut ZSTD_CCtx,
351        pledgedSrcSize: ::core::ffi::c_ulonglong,
352    ) -> usize;
353}
354#[repr(u32)]
355#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
356pub enum ZSTD_ResetDirective {
357    ZSTD_reset_session_only = 1,
358    ZSTD_reset_parameters = 2,
359    ZSTD_reset_session_and_parameters = 3,
360}
361extern "C" {
362    #[doc = " ZSTD_CCtx_reset() :\n  There are 2 different things that can be reset, independently or jointly :\n  - The session : will stop compressing current frame, and make CCtx ready to start a new one.\n                  Useful after an error, or to interrupt any ongoing compression.\n                  Any internal data not yet flushed is cancelled.\n                  With nbWorkers >= 1, it waits for the jobs already started to complete.\n                  Compression parameters and dictionary remain unchanged.\n                  They will be used to compress next frame.\n                  Resetting session never fails.\n  - The parameters : changes all parameters back to \"default\".\n                  This also removes any reference to any dictionary or external sequence producer.\n                  Parameters can only be changed between 2 sessions (i.e. no compression is currently ongoing)\n                  otherwise the reset fails, and function returns an error value (which can be tested using ZSTD_isError())\n  - Both : similar to resetting the session, followed by resetting parameters."]
363    pub fn ZSTD_CCtx_reset(
364        cctx: *mut ZSTD_CCtx,
365        reset: ZSTD_ResetDirective,
366    ) -> usize;
367}
368extern "C" {
369    #[doc = " ZSTD_compress2() :\n  Behave the same as ZSTD_compressCCtx(), but compression parameters are set using the advanced API.\n  (note that this entry point doesn't even expose a compression level parameter).\n  ZSTD_compress2() always starts a new frame.\n  Should cctx hold data from a previously unfinished frame, everything about it is forgotten.\n  - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()\n  - The function is always blocking, returns when compression is completed.\n  NOTE: Providing `dstCapacity >= ZSTD_compressBound(srcSize)` guarantees that zstd will have\n        enough space to successfully compress the data, though it is possible it fails for other reasons.\n @return : compressed size written into `dst` (<= `dstCapacity),\n           or an error code if it fails (which can be tested using ZSTD_isError())."]
370    pub fn ZSTD_compress2(
371        cctx: *mut ZSTD_CCtx,
372        dst: *mut ::core::ffi::c_void,
373        dstCapacity: usize,
374        src: *const ::core::ffi::c_void,
375        srcSize: usize,
376    ) -> usize;
377}
378#[repr(u32)]
379#[doc = "  Advanced decompression API (Requires v1.4.0+)"]
380#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
381pub enum ZSTD_dParameter {
382    ZSTD_d_windowLogMax = 100,
383    ZSTD_d_experimentalParam1 = 1000,
384    ZSTD_d_experimentalParam2 = 1001,
385    ZSTD_d_experimentalParam3 = 1002,
386    ZSTD_d_experimentalParam4 = 1003,
387    ZSTD_d_experimentalParam5 = 1004,
388    ZSTD_d_experimentalParam6 = 1005,
389}
390extern "C" {
391    #[doc = " ZSTD_dParam_getBounds() :\n  All parameters must belong to an interval with lower and upper bounds,\n  otherwise they will either trigger an error or be automatically clamped.\n @return : a structure, ZSTD_bounds, which contains\n         - an error status field, which must be tested using ZSTD_isError()\n         - both lower and upper bounds, inclusive"]
392    pub fn ZSTD_dParam_getBounds(dParam: ZSTD_dParameter) -> ZSTD_bounds;
393}
394extern "C" {
395    #[doc = " ZSTD_DCtx_setParameter() :\n  Set one compression parameter, selected by enum ZSTD_dParameter.\n  All parameters have valid bounds. Bounds can be queried using ZSTD_dParam_getBounds().\n  Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter).\n  Setting a parameter is only possible during frame initialization (before starting decompression).\n @return : 0, or an error code (which can be tested using ZSTD_isError())."]
396    pub fn ZSTD_DCtx_setParameter(
397        dctx: *mut ZSTD_DCtx,
398        param: ZSTD_dParameter,
399        value: ::core::ffi::c_int,
400    ) -> usize;
401}
402extern "C" {
403    #[doc = " ZSTD_DCtx_reset() :\n  Return a DCtx to clean state.\n  Session and parameters can be reset jointly or separately.\n  ZSTD_reset_parameters can only be used when no frame is being decompressed;\n  otherwise it returns ZSTD_error_stage_wrong without resetting the parameters.\n  ZSTD_reset_session_and_parameters also abandons any active frame.\n  A successful parameter reset discards any referenced prefix or dictionary.\n  See ZSTD_DCtx_refPrefix() for the effect of a session-only reset on a prefix.\n @return : 0, or an error code, which can be tested with ZSTD_isError()"]
404    pub fn ZSTD_DCtx_reset(
405        dctx: *mut ZSTD_DCtx,
406        reset: ZSTD_ResetDirective,
407    ) -> usize;
408}
409#[doc = "  Streaming"]
410#[repr(C)]
411#[derive(Debug, Copy, Clone)]
412pub struct ZSTD_inBuffer_s {
413    #[doc = "< start of input buffer"]
414    pub src: *const ::core::ffi::c_void,
415    #[doc = "< size of input buffer"]
416    pub size: usize,
417    #[doc = "< position where reading stopped. Will be updated. Necessarily 0 <= pos <= size"]
418    pub pos: usize,
419}
420#[doc = "  Streaming"]
421pub type ZSTD_inBuffer = ZSTD_inBuffer_s;
422#[repr(C)]
423#[derive(Debug, Copy, Clone)]
424pub struct ZSTD_outBuffer_s {
425    #[doc = "< start of output buffer"]
426    pub dst: *mut ::core::ffi::c_void,
427    #[doc = "< size of output buffer"]
428    pub size: usize,
429    #[doc = "< position where writing stopped. Will be updated. Necessarily 0 <= pos <= size"]
430    pub pos: usize,
431}
432pub type ZSTD_outBuffer = ZSTD_outBuffer_s;
433pub type ZSTD_CStream = ZSTD_CCtx;
434extern "C" {
435    pub fn ZSTD_createCStream() -> *mut ZSTD_CStream;
436}
437extern "C" {
438    pub fn ZSTD_freeCStream(zcs: *mut ZSTD_CStream) -> usize;
439}
440#[repr(u32)]
441#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
442pub enum ZSTD_EndDirective {
443    ZSTD_e_continue = 0,
444    ZSTD_e_flush = 1,
445    ZSTD_e_end = 2,
446}
447extern "C" {
448    #[doc = " ZSTD_compressStream2() : Requires v1.4.0+\n  Behaves about the same as ZSTD_compressStream, with additional control on end directive.\n  - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*()\n  - Compression parameters cannot be changed once compression is started (save a list of exceptions in multi-threading mode)\n  - output->pos must be <= dstCapacity, input->pos must be <= srcSize\n  - output->pos and input->pos will be updated. They are guaranteed to remain below their respective limit.\n  - endOp must be a valid directive\n  - When nbWorkers==0 (default), function is blocking : it completes its job before returning to caller.\n  - 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,\n                                                  and then immediately returns, just indicating that there is some data remaining to be flushed.\n                                                  The function nonetheless guarantees forward progress : it will return only after it reads or write at least 1+ byte.\n  - 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.\n  - @return provides a minimum amount of data remaining to be flushed from internal buffers\n            or an error code, which can be tested using ZSTD_isError().\n            if @return != 0, flush is not fully completed, there is still some data left within internal buffers.\n            This is useful for ZSTD_e_flush, since in this case more flushes are necessary to empty all buffers.\n            For ZSTD_e_end, @return == 0 when internal buffers are fully flushed and frame is completed.\n  - after a ZSTD_e_end directive, if internal buffer is not fully flushed (@return != 0),\n            only ZSTD_e_end or ZSTD_e_flush operations are allowed.\n            Before starting a new compression job, or changing compression parameters,\n            it is required to fully flush internal buffers.\n  - note: if an operation ends with an error, it may leave @cctx in an undefined state.\n          Therefore, it's UB to invoke ZSTD_compressStream2() of ZSTD_compressStream() on such a state.\n          In order to be re-employed after an error, a state must be reset,\n          which can be done explicitly (ZSTD_CCtx_reset()),\n          or is sometimes implied by methods starting a new compression job (ZSTD_initCStream(), ZSTD_compressCCtx())"]
449    pub fn ZSTD_compressStream2(
450        cctx: *mut ZSTD_CCtx,
451        output: *mut ZSTD_outBuffer,
452        input: *mut ZSTD_inBuffer,
453        endOp: ZSTD_EndDirective,
454    ) -> usize;
455}
456extern "C" {
457    pub fn ZSTD_CStreamInSize() -> usize;
458}
459extern "C" {
460    pub fn ZSTD_CStreamOutSize() -> usize;
461}
462extern "C" {
463    #[doc = " Equivalent to:\n\n     ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);\n     ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any)\n     ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);\n\n Note that ZSTD_initCStream() clears any previously set dictionary. Use the new API\n to compress with a dictionary."]
464    pub fn ZSTD_initCStream(
465        zcs: *mut ZSTD_CStream,
466        compressionLevel: ::core::ffi::c_int,
467    ) -> usize;
468}
469extern "C" {
470    #[doc = " Alternative for ZSTD_compressStream2(zcs, output, input, ZSTD_e_continue).\n NOTE: The return value is different. ZSTD_compressStream() returns a hint for\n the next read size (if non-zero and not an error). ZSTD_compressStream2()\n returns the minimum nb of bytes left to flush (if non-zero and not an error)."]
471    pub fn ZSTD_compressStream(
472        zcs: *mut ZSTD_CStream,
473        output: *mut ZSTD_outBuffer,
474        input: *mut ZSTD_inBuffer,
475    ) -> usize;
476}
477extern "C" {
478    #[doc = " Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_flush)."]
479    pub fn ZSTD_flushStream(
480        zcs: *mut ZSTD_CStream,
481        output: *mut ZSTD_outBuffer,
482    ) -> usize;
483}
484extern "C" {
485    #[doc = " Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_end)."]
486    pub fn ZSTD_endStream(
487        zcs: *mut ZSTD_CStream,
488        output: *mut ZSTD_outBuffer,
489    ) -> usize;
490}
491pub type ZSTD_DStream = ZSTD_DCtx;
492extern "C" {
493    pub fn ZSTD_createDStream() -> *mut ZSTD_DStream;
494}
495extern "C" {
496    pub fn ZSTD_freeDStream(zds: *mut ZSTD_DStream) -> usize;
497}
498extern "C" {
499    #[doc = " ZSTD_initDStream() :\n Initialize/reset DStream state for new decompression operation.\n Call before new decompression operation using same DStream.\n\n Note : This function is redundant with the advanced API and equivalent to:\n     ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);\n     ZSTD_DCtx_refDDict(zds, NULL);"]
500    pub fn ZSTD_initDStream(zds: *mut ZSTD_DStream) -> usize;
501}
502extern "C" {
503    #[doc = " ZSTD_decompressStream() :\n Streaming decompression function.\n Call repetitively to consume full input updating it as necessary.\n Function will update both input and output `pos` fields exposing current state via these fields:\n - `input.pos < input.size`, some input remaining and caller should provide remaining input\n   on the next call.\n - `output.pos < output.size`, decoder flushed internal output buffer.\n - `output.pos == output.size`, unflushed data potentially present in the internal buffers,\n   check ZSTD_decompressStream() @return value,\n   if > 0, invoke it again to flush remaining data to output.\n Note : with no additional input, amount of data flushed <= ZSTD_BLOCKSIZE_MAX.\n\n @return : 0 when a frame is completely decoded and fully flushed,\n           or an error code, which can be tested using ZSTD_isError(),\n           or any other value > 0, which means there is some decoding or flushing to do to complete current frame.\n\n Note: when an operation returns with an error code, the @zds state may be left in undefined state.\n       It's UB to invoke `ZSTD_decompressStream()` on such a state.\n       In order to re-use such a state, it must be first reset,\n       which can be done explicitly (`ZSTD_DCtx_reset(zds, ZSTD_reset_session_only)`),\n       or is implied for operations starting some new decompression job\n       (`ZSTD_initDStream()`, `ZSTD_decompressDCtx()`, `ZSTD_decompress_usingDict()`, `ZSTD_decompress_usingDDict()`).\n       The single-shot functions also leave the session clean:\n       streaming can start a new frame afterwards without an explicit reset."]
504    pub fn ZSTD_decompressStream(
505        zds: *mut ZSTD_DStream,
506        output: *mut ZSTD_outBuffer,
507        input: *mut ZSTD_inBuffer,
508    ) -> usize;
509}
510extern "C" {
511    pub fn ZSTD_DStreamInSize() -> usize;
512}
513extern "C" {
514    pub fn ZSTD_DStreamOutSize() -> usize;
515}
516extern "C" {
517    #[doc = "  Simple dictionary API\n/\n/*! ZSTD_compress_usingDict() :\n  Compression at an explicit compression level using a Dictionary.\n  A dictionary can be any arbitrary data segment (also called a prefix),\n  or a buffer with specified information (see zdict.h).\n  Note : This function loads the dictionary, resulting in significant startup delay.\n         It's intended for a dictionary used only once.\n  Note 2 : When `dict == NULL || dictSize < 8` no dictionary is used."]
518    pub fn ZSTD_compress_usingDict(
519        ctx: *mut ZSTD_CCtx,
520        dst: *mut ::core::ffi::c_void,
521        dstCapacity: usize,
522        src: *const ::core::ffi::c_void,
523        srcSize: usize,
524        dict: *const ::core::ffi::c_void,
525        dictSize: usize,
526        compressionLevel: ::core::ffi::c_int,
527    ) -> usize;
528}
529extern "C" {
530    #[doc = " ZSTD_decompress_usingDict() :\n  Decompression using a known Dictionary.\n  Dictionary must be identical to the one used during compression.\n  Note : This function loads the dictionary, resulting in significant startup delay.\n         It's intended for a dictionary used only once.\n  Note : When `dict == NULL || dictSize < 8` no dictionary is used.\n  Note : The streaming session of @dctx is reset first, as with\n         ZSTD_DCtx_reset(dctx, ZSTD_reset_session_only)."]
531    pub fn ZSTD_decompress_usingDict(
532        dctx: *mut ZSTD_DCtx,
533        dst: *mut ::core::ffi::c_void,
534        dstCapacity: usize,
535        src: *const ::core::ffi::c_void,
536        srcSize: usize,
537        dict: *const ::core::ffi::c_void,
538        dictSize: usize,
539    ) -> usize;
540}
541#[repr(C)]
542#[derive(Debug, Copy, Clone)]
543pub struct ZSTD_CDict_s {
544    _unused: [u8; 0],
545}
546#[doc = "  Bulk processing dictionary API"]
547pub type ZSTD_CDict = ZSTD_CDict_s;
548extern "C" {
549    #[doc = " ZSTD_createCDict() :\n  When compressing multiple messages or blocks using the same dictionary,\n  it's recommended to digest the dictionary only once, since it's a costly operation.\n  ZSTD_createCDict() will create a state from digesting a dictionary.\n  The resulting state can be used for future compression operations with very limited startup cost.\n  ZSTD_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only.\n @dictBuffer can be released after ZSTD_CDict creation, because its content is copied within CDict.\n  Note 1 : Consider experimental function `ZSTD_createCDict_byReference()` if you prefer to not duplicate @dictBuffer content.\n  Note 2 : A ZSTD_CDict can be created from an empty @dictBuffer,\n      in which case the only thing that it transports is the @compressionLevel.\n      This can be useful in a pipeline featuring ZSTD_compress_usingCDict() exclusively,\n      expecting a ZSTD_CDict parameter with any data, including those without a known dictionary."]
550    pub fn ZSTD_createCDict(
551        dictBuffer: *const ::core::ffi::c_void,
552        dictSize: usize,
553        compressionLevel: ::core::ffi::c_int,
554    ) -> *mut ZSTD_CDict;
555}
556extern "C" {
557    #[doc = " ZSTD_freeCDict() :\n  Function frees memory allocated by ZSTD_createCDict().\n  If a NULL pointer is passed, no operation is performed."]
558    pub fn ZSTD_freeCDict(CDict: *mut ZSTD_CDict) -> usize;
559}
560extern "C" {
561    #[doc = " ZSTD_compress_usingCDict() :\n  Compression using a digested Dictionary.\n  Recommended when same dictionary is used multiple times.\n  Note : compression level is _decided at dictionary creation time_,\n     and frame parameters are hardcoded (dictID=yes, contentSize=yes, checksum=no)"]
562    pub fn ZSTD_compress_usingCDict(
563        cctx: *mut ZSTD_CCtx,
564        dst: *mut ::core::ffi::c_void,
565        dstCapacity: usize,
566        src: *const ::core::ffi::c_void,
567        srcSize: usize,
568        cdict: *const ZSTD_CDict,
569    ) -> usize;
570}
571#[repr(C)]
572#[derive(Debug, Copy, Clone)]
573pub struct ZSTD_DDict_s {
574    _unused: [u8; 0],
575}
576pub type ZSTD_DDict = ZSTD_DDict_s;
577extern "C" {
578    #[doc = " ZSTD_createDDict() :\n  Create a digested dictionary, ready to start decompression operation without startup delay.\n  dictBuffer can be released after DDict creation, as its content is copied inside DDict."]
579    pub fn ZSTD_createDDict(
580        dictBuffer: *const ::core::ffi::c_void,
581        dictSize: usize,
582    ) -> *mut ZSTD_DDict;
583}
584extern "C" {
585    #[doc = " ZSTD_createDDict_byReference() : Requires v1.6.0+\n  Create a digested dictionary, ready to start decompression operation without startup delay.\n  Dictionary content is referenced, and therefore stays in dictBuffer.\n  It is important that dictBuffer outlives DDict,\n  it must remain read accessible throughout the lifetime of DDict"]
586    pub fn ZSTD_createDDict_byReference(
587        dictBuffer: *const ::core::ffi::c_void,
588        dictSize: usize,
589    ) -> *mut ZSTD_DDict;
590}
591extern "C" {
592    #[doc = " ZSTD_freeDDict() :\n  Function frees memory allocated with ZSTD_createDDict()\n  If a NULL pointer is passed, no operation is performed."]
593    pub fn ZSTD_freeDDict(ddict: *mut ZSTD_DDict) -> usize;
594}
595extern "C" {
596    #[doc = " ZSTD_decompress_usingDDict() :\n  Decompression using a digested Dictionary.\n  Recommended when same dictionary is used multiple times.\n  Uses the supplied DDict, regardless of dictionaries referenced in dctx.\n  The streaming session of @dctx is reset first, as with\n  ZSTD_DCtx_reset(dctx, ZSTD_reset_session_only)."]
597    pub fn ZSTD_decompress_usingDDict(
598        dctx: *mut ZSTD_DCtx,
599        dst: *mut ::core::ffi::c_void,
600        dstCapacity: usize,
601        src: *const ::core::ffi::c_void,
602        srcSize: usize,
603        ddict: *const ZSTD_DDict,
604    ) -> usize;
605}
606extern "C" {
607    #[doc = " ZSTD_getDictID_fromDict() : Requires v1.4.0+\n  Provides the dictID stored within dictionary.\n  if @return == 0, the dictionary is not conformant with Zstandard specification.\n  It can still be loaded, but as a content-only dictionary."]
608    pub fn ZSTD_getDictID_fromDict(
609        dict: *const ::core::ffi::c_void,
610        dictSize: usize,
611    ) -> ::core::ffi::c_uint;
612}
613extern "C" {
614    #[doc = " ZSTD_getDictID_fromCDict() : Requires v1.5.0+\n  Provides the dictID of the dictionary loaded into `cdict`.\n  If @return == 0, the dictionary is not conformant to Zstandard specification, or empty.\n  Non-conformant dictionaries can still be loaded, but as content-only dictionaries."]
615    pub fn ZSTD_getDictID_fromCDict(
616        cdict: *const ZSTD_CDict,
617    ) -> ::core::ffi::c_uint;
618}
619extern "C" {
620    #[doc = " ZSTD_getDictID_fromDDict() : Requires v1.4.0+\n  Provides the dictID of the dictionary loaded into `ddict`.\n  If @return == 0, the dictionary is not conformant to Zstandard specification, or empty.\n  Non-conformant dictionaries can still be loaded, but as content-only dictionaries."]
621    pub fn ZSTD_getDictID_fromDDict(
622        ddict: *const ZSTD_DDict,
623    ) -> ::core::ffi::c_uint;
624}
625extern "C" {
626    #[doc = " ZSTD_getDictID_fromFrame() : Requires v1.4.0+\n  Provides the dictID required to decompressed the frame stored within `src`.\n  If @return == 0, the dictID could not be decoded.\n  This could for one of the following reasons :\n  - The frame does not require a dictionary to be decoded (most common case).\n  - The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a hidden piece of information.\n    Note : this use case also happens when using a non-conformant dictionary.\n  - `srcSize` is too small, and as a result, the frame header could not be decoded (only possible if `srcSize < ZSTD_FRAMEHEADERSIZE_MAX`).\n  - This is not a Zstandard frame.\n  When identifying the exact failure cause, it's possible to use ZSTD_getFrameHeader(), which will provide a more precise error code."]
627    pub fn ZSTD_getDictID_fromFrame(
628        src: *const ::core::ffi::c_void,
629        srcSize: usize,
630    ) -> ::core::ffi::c_uint;
631}
632extern "C" {
633    #[doc = " ZSTD_CCtx_loadDictionary() : Requires v1.4.0+\n  Create an internal CDict from `dict` buffer.\n  Decompression will have to use same dictionary.\n @result : 0, or an error code (which can be tested with ZSTD_isError()).\n  Special: Loading a NULL (or 0-size) dictionary invalidates previous dictionary,\n           meaning \"return to no-dictionary mode\".\n  Note 1 : Dictionary is sticky, it will be used for all future compressed frames,\n           until parameters are reset, a new dictionary is loaded, or the dictionary\n           is explicitly invalidated by loading a NULL dictionary.\n  Note 2 : Loading a dictionary involves building tables.\n           It's also a CPU consuming operation, with non-negligible impact on latency.\n           Tables are dependent on compression parameters, and for this reason,\n           compression parameters can no longer be changed after loading a dictionary.\n  Note 3 :`dict` content will be copied internally.\n           Use experimental ZSTD_CCtx_loadDictionary_byReference() to reference content instead.\n           In such a case, dictionary buffer must outlive its users.\n  Note 4 : Use ZSTD_CCtx_loadDictionary_advanced()\n           to precisely select how dictionary content must be interpreted.\n  Note 5 : This method does not benefit from LDM (long distance mode).\n           If you want to employ LDM on some large dictionary content,\n           prefer employing ZSTD_CCtx_refPrefix() described below."]
634    pub fn ZSTD_CCtx_loadDictionary(
635        cctx: *mut ZSTD_CCtx,
636        dict: *const ::core::ffi::c_void,
637        dictSize: usize,
638    ) -> usize;
639}
640#[repr(u32)]
641#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
642pub enum ZSTD_dictContentType_e {
643    #[doc = "< dictionary is \"full\" when starting with ZSTD_MAGIC_DICTIONARY, otherwise it is \"rawContent\""]
644    ZSTD_dct_auto = 0,
645    #[doc = "< ensures dictionary is always loaded as rawContent, even if it starts with ZSTD_MAGIC_DICTIONARY"]
646    ZSTD_dct_rawContent = 1,
647    #[doc = "< refuses to load a dictionary if it does not respect Zstandard's specification, starting with ZSTD_MAGIC_DICTIONARY"]
648    ZSTD_dct_fullDict = 2,
649}
650#[repr(u32)]
651#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
652pub enum ZSTD_dictLoadMethod_e {
653    #[doc = "< Copy dictionary content internally"]
654    ZSTD_dlm_byCopy = 0,
655    #[doc = "< Reference dictionary content -- the dictionary buffer must outlive its users."]
656    ZSTD_dlm_byRef = 1,
657}
658extern "C" {
659    #[doc = " ZSTD_CCtx_loadDictionary_advanced() : Requires v1.6.0+\n  Same as ZSTD_CCtx_loadDictionary(), but gives finer control over\n  how to load the dictionary (by copy ? by reference ?)\n  and how to interpret it (automatic ? force raw mode ? full mode only ?)"]
660    pub fn ZSTD_CCtx_loadDictionary_advanced(
661        cctx: *mut ZSTD_CCtx,
662        dict: *const ::core::ffi::c_void,
663        dictSize: usize,
664        dictLoadMethod: ZSTD_dictLoadMethod_e,
665        dictContentType: ZSTD_dictContentType_e,
666    ) -> usize;
667}
668extern "C" {
669    #[doc = " ZSTD_CCtx_refCDict() : Requires v1.4.0+\n  Reference a prepared dictionary, to be used for all future compressed frames.\n  Note that compression parameters are enforced from within CDict,\n  and supersede any compression parameter previously set within CCtx.\n  The parameters ignored are labelled as \"superseded-by-cdict\" in the ZSTD_cParameter enum docs.\n  The ignored parameters will be used again if the CCtx is returned to no-dictionary mode.\n  The dictionary will remain valid for future compressed frames using same CCtx.\n @result : 0, or an error code (which can be tested with ZSTD_isError()).\n  Special : Referencing a NULL CDict means \"return to no-dictionary mode\".\n  Note 1 : Currently, only one dictionary can be managed.\n           Referencing a new dictionary effectively \"discards\" any previous one.\n  Note 2 : CDict is just referenced, its lifetime must outlive its usage within CCtx."]
670    pub fn ZSTD_CCtx_refCDict(
671        cctx: *mut ZSTD_CCtx,
672        cdict: *const ZSTD_CDict,
673    ) -> usize;
674}
675extern "C" {
676    #[doc = " ZSTD_CCtx_refPrefix() : Requires v1.4.0+\n  Reference a prefix (single-usage dictionary) for next compressed frame.\n  A prefix is **only used once**. Tables are discarded at end of frame (ZSTD_e_end).\n  Decompression will need same prefix to properly regenerate data.\n  Compressing with a prefix is similar in outcome as performing a diff and compressing it,\n  but performs much faster, especially during decompression (compression speed is tunable with compression level).\n  This method is compatible with LDM (long distance mode).\n @result : 0, or an error code (which can be tested with ZSTD_isError()).\n  Special: Adding any prefix (including NULL) invalidates any previous prefix or dictionary\n  Note 1 : Prefix buffer is referenced. It **must** outlive compression.\n           Its content must remain unmodified during compression.\n  Note 2 : If the intention is to diff some large src data blob with some prior version of itself,\n           ensure that the window size is large enough to contain the entire source.\n           See ZSTD_c_windowLog.\n  Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters.\n           It's a CPU consuming operation, with non-negligible impact on latency.\n           If there is a need to use the same prefix multiple times, consider loadDictionary instead.\n  Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dct_rawContent).\n           Use experimental ZSTD_CCtx_refPrefix_advanced() to alter dictionary interpretation."]
677    pub fn ZSTD_CCtx_refPrefix(
678        cctx: *mut ZSTD_CCtx,
679        prefix: *const ::core::ffi::c_void,
680        prefixSize: usize,
681    ) -> usize;
682}
683extern "C" {
684    #[doc = " ZSTD_DCtx_loadDictionary() : Requires v1.4.0+\n  Create an internal DDict from dict buffer, to be used to decompress all future frames.\n  The dictionary remains valid for all future frames, until explicitly invalidated, or\n  a new dictionary is loaded.\n @result : 0, or an error code (which can be tested with ZSTD_isError()).\n  Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary,\n            meaning \"return to no-dictionary mode\".\n  Loading any dictionary also discards the multiple-DDict reference table,\n  without disabling ZSTD_d_refMultipleDDicts.\n  Note 1 : Loading a dictionary involves building tables,\n           which has a non-negligible impact on CPU usage and latency.\n           It's recommended to \"load once, use many times\", to amortize the cost\n  Note 2 :`dict` content will be copied internally, so `dict` can be released after loading.\n           Use ZSTD_DCtx_loadDictionary_byReference() to reference dictionary content instead.\n  Note 3 : Use ZSTD_DCtx_loadDictionary_advanced() to take control of\n           how dictionary content is loaded and interpreted."]
685    pub fn ZSTD_DCtx_loadDictionary(
686        dctx: *mut ZSTD_DCtx,
687        dict: *const ::core::ffi::c_void,
688        dictSize: usize,
689    ) -> usize;
690}
691extern "C" {
692    #[doc = " ZSTD_DCtx_loadDictionary_advanced() : Requires v1.6.0+\n  Same as ZSTD_DCtx_loadDictionary(),\n  but gives direct control over\n  how to load the dictionary (by copy ? by reference ?)\n  and how to interpret it (automatic ? force raw mode ? full mode only ?)."]
693    pub fn ZSTD_DCtx_loadDictionary_advanced(
694        dctx: *mut ZSTD_DCtx,
695        dict: *const ::core::ffi::c_void,
696        dictSize: usize,
697        dictLoadMethod: ZSTD_dictLoadMethod_e,
698        dictContentType: ZSTD_dictContentType_e,
699    ) -> usize;
700}
701extern "C" {
702    #[doc = " ZSTD_DCtx_refDDict() : Requires v1.4.0+\n  Reference a prepared dictionary, to be used to decompress next frames.\n  In single-DDict mode, the dictionary remains active for decompression of\n  future frames using the same DCtx.\n\n  If called with ZSTD_d_refMultipleDDicts enabled, repeated calls of this function\n  will store the DDict references in a table, and the DDict used for decompression\n  will be determined at decompression time, as per the dict ID in the frame.\n  The memory for the table is allocated on the first call to refDDict.\n  The table is freed by ZSTD_DCtx_refDDict(dctx, NULL), by ZSTD_DCtx_reset()\n  with ZSTD_reset_parameters or ZSTD_reset_session_and_parameters, by any\n  ZSTD_DCtx_loadDictionary() or ZSTD_DCtx_refPrefix() call, by disabling\n  multiple-DDict mode, and by ZSTD_freeDCtx().\n  Disabling multiple-DDict mode releases all dictionary references from the set;\n  no dictionary from the set is retained for subsequent decompression.\n  Referencing a DDict invalidates any previously loaded dictionary or prefix.\n\n  If called with ZSTD_d_refMultipleDDicts disabled (the default), only one dictionary\n  will be managed, and referencing a dictionary effectively \"discards\" any previous one.\n\n @result : 0, or an error code (which can be tested with ZSTD_isError()).\n  Special: referencing a NULL DDict means \"return to no-dictionary mode\".\n  Note 2 : DDict is just referenced, its lifetime must outlive its usage from DCtx."]
703    pub fn ZSTD_DCtx_refDDict(
704        dctx: *mut ZSTD_DCtx,
705        ddict: *const ZSTD_DDict,
706    ) -> usize;
707}
708extern "C" {
709    #[doc = " ZSTD_DCtx_refPrefix() : Requires v1.4.0+\n  Reference a prefix (single-usage dictionary) for decompression.\n  This is the reverse operation of ZSTD_CCtx_refPrefix(),\n  and must use the same prefix as the one used during compression.\n  The prefix is **only used once**:\n  - ZSTD_decompressDCtx() uses it for exactly one call, including all frames\n    in concatenated input. The call consumes the prefix even if the input\n    is empty, contains only skippable frames, or produces an error.\n  - ZSTD_decompressStream() uses it until the first frame is completely\n    decoded and flushed, as indicated by a return value of 0. This includes\n    empty and skippable frames, even though they produce no output.\n  The explicit-dictionary functions ZSTD_decompress_usingDict() and\n  ZSTD_decompress_usingDDict() use their dictionary argument instead and\n  do not consume the prefix configured on the DCtx.\n\n  ZSTD_DCtx_reset(dctx, ZSTD_reset_session_only) preserves an unused prefix\n  if streaming decompression has not started. Once streaming has started,\n  even with an incomplete header, a session-only reset abandons the frame\n  and discards the prefix. After a streaming error the DCtx may be in an\n  undefined state and must be reset before streaming can resume. Errors\n  returned before streaming starts may leave an unused prefix installed.\n  To unconditionally discard it, use ZSTD_reset_session_and_parameters,\n  or ZSTD_reset_parameters when no frame is active. The latter can fail\n  with ZSTD_error_stage_wrong during decompression.\n @result : 0, or an error code (which can be tested with ZSTD_isError()).\n  Note 1 : Adding any prefix (including NULL or a zero-sized prefix) invalidates\n           any previously set prefix or dictionary,\n           including the multiple-DDict reference table.\n           Successfully loading or referencing another dictionary, or calling\n           ZSTD_initDStream(), also discards the prefix.\n  Note 2 : Prefix buffer is referenced. It **must** outlive decompression.\n           It must remain unmodified until the one-shot call returns, the\n           streaming frame completes, or the prefix is explicitly discarded.\n  Note 3 : By default, the prefix is treated as raw content (ZSTD_dct_rawContent).\n           Use ZSTD_DCtx_refPrefix_advanced() to alter dictMode (Experimental section)\n  Note 4 : Referencing a raw content prefix has almost no cpu nor memory cost.\n           A full dictionary is more costly, as it requires building tables."]
710    pub fn ZSTD_DCtx_refPrefix(
711        dctx: *mut ZSTD_DCtx,
712        prefix: *const ::core::ffi::c_void,
713        prefixSize: usize,
714    ) -> usize;
715}
716extern "C" {
717    #[doc = " ZSTD_sizeof_*() : Requires v1.4.0+\n  These functions give the _current_ memory usage of selected object.\n  Note that object memory usage can evolve (increase or decrease) over time."]
718    pub fn ZSTD_sizeof_CCtx(cctx: *const ZSTD_CCtx) -> usize;
719}
720extern "C" {
721    pub fn ZSTD_sizeof_DCtx(dctx: *const ZSTD_DCtx) -> usize;
722}
723extern "C" {
724    pub fn ZSTD_sizeof_CStream(zcs: *const ZSTD_CStream) -> usize;
725}
726extern "C" {
727    pub fn ZSTD_sizeof_DStream(zds: *const ZSTD_DStream) -> usize;
728}
729extern "C" {
730    pub fn ZSTD_sizeof_CDict(cdict: *const ZSTD_CDict) -> usize;
731}
732extern "C" {
733    pub fn ZSTD_sizeof_DDict(ddict: *const ZSTD_DDict) -> usize;
734}
735#[repr(C)]
736#[derive(Debug, Copy, Clone)]
737pub struct ZSTD_CCtx_params_s {
738    _unused: [u8; 0],
739}
740pub type ZSTD_CCtx_params = ZSTD_CCtx_params_s;
741#[repr(C)]
742#[derive(Debug, Copy, Clone)]
743pub struct ZSTD_Sequence {
744    pub offset: ::core::ffi::c_uint,
745    pub litLength: ::core::ffi::c_uint,
746    pub matchLength: ::core::ffi::c_uint,
747    pub rep: ::core::ffi::c_uint,
748}
749#[repr(C)]
750#[derive(Debug, Copy, Clone)]
751pub struct ZSTD_compressionParameters {
752    #[doc = "< largest match distance : larger == more compression, more memory needed during decompression"]
753    pub windowLog: ::core::ffi::c_uint,
754    #[doc = "< fully searched segment : larger == more compression, slower, more memory (useless for fast)"]
755    pub chainLog: ::core::ffi::c_uint,
756    #[doc = "< dispatch table : larger == faster, more memory"]
757    pub hashLog: ::core::ffi::c_uint,
758    #[doc = "< nb of searches : larger == more compression, slower"]
759    pub searchLog: ::core::ffi::c_uint,
760    #[doc = "< match length searched : larger == faster decompression, sometimes less compression"]
761    pub minMatch: ::core::ffi::c_uint,
762    #[doc = "< acceptable match size for optimal parser (only) : larger == more compression, slower"]
763    pub targetLength: ::core::ffi::c_uint,
764    #[doc = "< see ZSTD_strategy definition above"]
765    pub strategy: ZSTD_strategy,
766}
767#[repr(C)]
768#[derive(Debug, Copy, Clone)]
769pub struct ZSTD_frameParameters {
770    #[doc = "< 1: content size will be in frame header (when known)"]
771    pub contentSizeFlag: ::core::ffi::c_int,
772    #[doc = "< 1: generate a 32-bits checksum using XXH64 algorithm at end of frame, for error detection"]
773    pub checksumFlag: ::core::ffi::c_int,
774    #[doc = "< 1: no dictID will be saved into frame header (dictID is only useful for dictionary compression)"]
775    pub noDictIDFlag: ::core::ffi::c_int,
776}
777#[repr(C)]
778#[derive(Debug, Copy, Clone)]
779pub struct ZSTD_parameters {
780    pub cParams: ZSTD_compressionParameters,
781    pub fParams: ZSTD_frameParameters,
782}
783#[repr(u32)]
784#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
785pub enum ZSTD_format_e {
786    ZSTD_f_zstd1 = 0,
787    ZSTD_f_zstd1_magicless = 1,
788}
789#[repr(u32)]
790#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
791pub enum ZSTD_forceIgnoreChecksum_e {
792    ZSTD_d_validateChecksum = 0,
793    ZSTD_d_ignoreChecksum = 1,
794}
795#[repr(u32)]
796#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
797pub enum ZSTD_refMultipleDDicts_e {
798    ZSTD_rmd_refSingleDDict = 0,
799    ZSTD_rmd_refMultipleDDicts = 1,
800}
801#[repr(u32)]
802#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
803pub enum ZSTD_dictAttachPref_e {
804    ZSTD_dictDefaultAttach = 0,
805    ZSTD_dictForceAttach = 1,
806    ZSTD_dictForceCopy = 2,
807    ZSTD_dictForceLoad = 3,
808}
809#[repr(u32)]
810#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
811pub enum ZSTD_literalCompressionMode_e {
812    #[doc = "< Automatically determine the compression mode based on the compression level.\n   Negative compression levels will be uncompressed, and positive compression\n   levels will be compressed."]
813    ZSTD_lcm_auto = 0,
814    #[doc = "< Always attempt Huffman compression. Uncompressed literals will still be\n   emitted if Huffman compression is not profitable."]
815    ZSTD_lcm_huffman = 1,
816    #[doc = "< Always emit uncompressed literals."]
817    ZSTD_lcm_uncompressed = 2,
818}
819#[repr(u32)]
820#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
821pub enum ZSTD_ParamSwitch_e {
822    ZSTD_ps_auto = 0,
823    ZSTD_ps_enable = 1,
824    ZSTD_ps_disable = 2,
825}
826extern "C" {
827    #[doc = " ZSTD_findDecompressedSize() :\n  `src` should point to the start of a series of ZSTD encoded and/or skippable frames\n  `srcSize` must be the _exact_ size of this series\n       (i.e. there should be a frame boundary at `src + srcSize`)\n  @return : - decompressed size of all data in all successive frames\n            - if the decompressed size cannot be determined: ZSTD_CONTENTSIZE_UNKNOWN\n            - if an error occurred: ZSTD_CONTENTSIZE_ERROR\n\n   note 1 : decompressed size is an optional field, that may not be present, especially in streaming mode.\n            When `return==ZSTD_CONTENTSIZE_UNKNOWN`, data to decompress could be any size.\n            In which case, it's necessary to use streaming mode to decompress data.\n   note 2 : decompressed size is always present when compression is done with ZSTD_compress()\n   note 3 : decompressed size can be very large (64-bits value),\n            potentially larger than what local system can handle as a single memory segment.\n            In which case, it's necessary to use streaming mode to decompress data.\n   note 4 : If source is untrusted, decompressed size could be wrong or intentionally modified.\n            Always ensure result fits within application's authorized limits.\n            Each application can set its own limits.\n   note 5 : ZSTD_findDecompressedSize handles multiple frames, and so it must traverse the input to\n            read each contained frame header.  This is fast as most of the data is skipped,\n            however it does mean that all frame data must be present and valid."]
828    pub fn ZSTD_findDecompressedSize(
829        src: *const ::core::ffi::c_void,
830        srcSize: usize,
831    ) -> ::core::ffi::c_ulonglong;
832}
833extern "C" {
834    #[doc = " ZSTD_decompressBound() :\n  `src` should point to the start of a series of ZSTD encoded and/or skippable frames\n  `srcSize` must be the _exact_ size of this series\n       (i.e. there should be a frame boundary at `src + srcSize`)\n  @return : - upper-bound for the decompressed size of all data in all successive frames\n            - if an error occurred: ZSTD_CONTENTSIZE_ERROR\n\n  note 1  : an error can occur if `src` contains an invalid or incorrectly formatted frame,\n            or the bound exceeds the largest returnable value, ZSTD_CONTENTSIZE_ERROR - 1.\n  note 2  : the upper-bound is exact when the decompressed size field is available in every ZSTD encoded frame of `src`.\n            When this exact size is representable, `ZSTD_findDecompressedSize` and `ZSTD_decompressBound` return the same value.\n  note 3  : when the decompressed size field isn't available, the upper-bound for that frame is calculated by:\n              upper-bound = # blocks * min(128 KB, Window_Size)"]
835    pub fn ZSTD_decompressBound(
836        src: *const ::core::ffi::c_void,
837        srcSize: usize,
838    ) -> ::core::ffi::c_ulonglong;
839}
840extern "C" {
841    #[doc = " ZSTD_frameHeaderSize() :\n  srcSize must be large enough, aka >= ZSTD_FRAMEHEADERSIZE_PREFIX.\n @return : size of the Frame Header,\n           or an error code (if srcSize is too small)"]
842    pub fn ZSTD_frameHeaderSize(
843        src: *const ::core::ffi::c_void,
844        srcSize: usize,
845    ) -> usize;
846}
847extern "C" {
848    #[doc = " ZSTD_getFrameHeader_advanced() :\n  same as ZSTD_getFrameHeader(),\n  with added capability to select a format (like ZSTD_f_zstd1_magicless)"]
849    pub fn ZSTD_getFrameHeader_advanced(
850        zfhPtr: *mut ZSTD_FrameHeader,
851        src: *const ::core::ffi::c_void,
852        srcSize: usize,
853        format: ZSTD_format_e,
854    ) -> usize;
855}
856extern "C" {
857    #[doc = " ZSTD_decompressionMargin() :\n Zstd supports in-place decompression, where the input and output buffers overlap.\n In this case, the output buffer must be at least (Margin + Output_Size) bytes large,\n and the input buffer must be at the end of the output buffer.\n\n  _______________________ Output Buffer ________________________\n |                                                              |\n |                                        ____ Input Buffer ____|\n |                                       |                      |\n v                                       v                      v\n |---------------------------------------|-----------|----------|\n ^                                                   ^          ^\n |___________________ Output_Size ___________________|_ Margin _|\n\n NOTE: See also ZSTD_DECOMPRESSION_MARGIN().\n NOTE: This applies only to single-pass decompression through ZSTD_decompress() or\n ZSTD_decompressDCtx().\n NOTE: This function supports multi-frame input.\n\n @param src The compressed frame(s)\n @param srcSize The size of the compressed frame(s)\n @returns The decompression margin or an error that can be checked with ZSTD_isError()."]
858    pub fn ZSTD_decompressionMargin(
859        src: *const ::core::ffi::c_void,
860        srcSize: usize,
861    ) -> usize;
862}
863#[repr(u32)]
864#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
865pub enum ZSTD_SequenceFormat_e {
866    ZSTD_sf_noBlockDelimiters = 0,
867    ZSTD_sf_explicitBlockDelimiters = 1,
868}
869extern "C" {
870    #[doc = " ZSTD_sequenceBound() :\n `srcSize` : size of the input buffer\n  @return : upper-bound for the number of sequences that can be generated\n            from a buffer of srcSize bytes\n\n  note : returns number of sequences - to get bytes, multiply by sizeof(ZSTD_Sequence)."]
871    pub fn ZSTD_sequenceBound(srcSize: usize) -> usize;
872}
873extern "C" {
874    #[doc = " ZSTD_generateSequences() :\n WARNING: This function is meant for debugging and informational purposes ONLY!\n Its implementation is flawed, and it will be deleted in a future version.\n It is not guaranteed to succeed, as there are several cases where it will give\n up and fail. You should NOT use this function in production code.\n\n This function is deprecated, and will be removed in a future version.\n\n Generate sequences using ZSTD_compress2(), given a source buffer.\n\n @param zc The compression context to be used for ZSTD_compress2(). Set any\n           compression parameters you need on this context.\n @param outSeqs The output sequences buffer of size @p outSeqsSize\n @param outSeqsCapacity The size of the output sequences buffer.\n                    ZSTD_sequenceBound(srcSize) is an upper bound on the number\n                    of sequences that can be generated.\n @param src The source buffer to generate sequences from of size @p srcSize.\n @param srcSize The size of the source buffer.\n\n Each block will end with a dummy sequence\n with offset == 0, matchLength == 0, and litLength == length of last literals.\n litLength may be == 0, and if so, then the sequence of (of: 0 ml: 0 ll: 0)\n simply acts as a block delimiter.\n\n @returns The number of sequences generated, necessarily less than\n          ZSTD_sequenceBound(srcSize), or an error code that can be checked\n          with ZSTD_isError()."]
875    pub fn ZSTD_generateSequences(
876        zc: *mut ZSTD_CCtx,
877        outSeqs: *mut ZSTD_Sequence,
878        outSeqsCapacity: usize,
879        src: *const ::core::ffi::c_void,
880        srcSize: usize,
881    ) -> usize;
882}
883extern "C" {
884    #[doc = " ZSTD_mergeBlockDelimiters() :\n Given an array of ZSTD_Sequence, remove all sequences that represent block delimiters/last literals\n by merging them into the literals of the next sequence.\n\n As such, the final generated result has no explicit representation of block boundaries,\n and the final last literals segment is not represented in the sequences.\n\n The output of this function can be fed into ZSTD_compressSequences() with CCtx\n setting of ZSTD_c_blockDelimiters as ZSTD_sf_noBlockDelimiters\n @return : number of sequences left after merging"]
885    pub fn ZSTD_mergeBlockDelimiters(
886        sequences: *mut ZSTD_Sequence,
887        seqsSize: usize,
888    ) -> usize;
889}
890extern "C" {
891    #[doc = " ZSTD_compressSequences() :\n Compress an array of ZSTD_Sequence, associated with @src buffer, into dst.\n @src contains the entire input (not just the literals).\n If @srcSize > sum(sequence.length), the remaining bytes are considered all literals\n If a dictionary is included, then the cctx should reference the dict (see: ZSTD_CCtx_refCDict(), ZSTD_CCtx_loadDictionary(), etc.).\n The entire source is compressed into a single frame.\n\n The compression behavior changes based on cctx params. In particular:\n    If ZSTD_c_blockDelimiters == ZSTD_sf_noBlockDelimiters, the array of ZSTD_Sequence is expected to contain\n    no block delimiters (defined in ZSTD_Sequence). Block boundaries are roughly determined based on\n    the block size derived from the cctx, and sequences may be split. This is the default setting.\n\n    If ZSTD_c_blockDelimiters == ZSTD_sf_explicitBlockDelimiters, the array of ZSTD_Sequence is expected to contain\n    valid block delimiters (defined in ZSTD_Sequence). Behavior is undefined if no block delimiters are provided.\n\n    When ZSTD_c_blockDelimiters == ZSTD_sf_explicitBlockDelimiters, it's possible to decide generating repcodes\n    using the advanced parameter ZSTD_c_repcodeResolution. Repcodes will improve compression ratio, though the benefit\n    can vary greatly depending on Sequences. On the other hand, repcode resolution is an expensive operation.\n    By default, it's disabled at low (<10) compression levels, and enabled above the threshold (>=10).\n    ZSTD_c_repcodeResolution makes it possible to directly manage this processing in either direction.\n\n    If ZSTD_c_validateSequences == 0, this function blindly accepts the Sequences provided. Invalid Sequences cause undefined\n    behavior. If ZSTD_c_validateSequences == 1, then the function will detect invalid Sequences (see doc/zstd_compression_format.md for\n    specifics regarding offset/matchlength requirements) and then bail out and return an error.\n\n    In addition to the two adjustable experimental params, there are other important cctx params.\n    - 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.\n    - ZSTD_c_compressionLevel accordingly adjusts the strength of the entropy coder, as it would in typical compression.\n    - ZSTD_c_windowLog affects offset validation: this function will return an error at higher debug levels if a provided offset\n      is larger than what the spec allows for a given window log and dictionary (if present). See: doc/zstd_compression_format.md\n\n Note: Repcodes are, as of now, always re-calculated within this function, ZSTD_Sequence.rep is effectively unused.\n Dev Note: Once ability to ingest repcodes become available, the explicit block delims mode must respect those repcodes exactly,\n         and cannot emit an RLE block that disagrees with the repcode history.\n @return : final compressed size, or a ZSTD error code."]
892    pub fn ZSTD_compressSequences(
893        cctx: *mut ZSTD_CCtx,
894        dst: *mut ::core::ffi::c_void,
895        dstCapacity: usize,
896        inSeqs: *const ZSTD_Sequence,
897        inSeqsSize: usize,
898        src: *const ::core::ffi::c_void,
899        srcSize: usize,
900    ) -> usize;
901}
902extern "C" {
903    #[doc = " ZSTD_compressSequencesAndLiterals() :\n This is a variant of ZSTD_compressSequences() which,\n instead of receiving (src,srcSize) as input parameter, receives (literals,litSize),\n aka all the literals, already extracted and laid out into a single continuous buffer.\n This can be useful if the process generating the sequences also happens to generate the buffer of literals,\n thus skipping an extraction + caching stage.\n It's a speed optimization, useful when the right conditions are met,\n but it also features the following limitations:\n - Only supports explicit delimiter mode\n - Currently does not support Sequences validation (so input Sequences are trusted)\n - Not compatible with frame checksum, which must be disabled\n - If any block is incompressible, will fail and return an error\n - @litSize must be == sum of all @.litLength fields in @inSeqs. Any discrepancy will generate an error.\n - @litBufCapacity is the size of the underlying buffer into which literals are written, starting at address @literals.\n   @litBufCapacity must be at least 8 bytes larger than @litSize.\n - @decompressedSize must be correct, and correspond to the sum of all Sequences. Any discrepancy will generate an error.\n - Each block must regenerate at most ZSTD_BLOCKSIZE_MAX bytes, or less with a smaller window or ZSTD_c_maxBlockSize.\n   A larger block will generate an error.\n @return : final compressed size, or a ZSTD error code."]
904    pub fn ZSTD_compressSequencesAndLiterals(
905        cctx: *mut ZSTD_CCtx,
906        dst: *mut ::core::ffi::c_void,
907        dstCapacity: usize,
908        inSeqs: *const ZSTD_Sequence,
909        nbSequences: usize,
910        literals: *const ::core::ffi::c_void,
911        litSize: usize,
912        litBufCapacity: usize,
913        decompressedSize: usize,
914    ) -> usize;
915}
916extern "C" {
917    #[doc = " ZSTD_writeSkippableFrame() :\n Generates a zstd skippable frame containing data given by src, and writes it to dst buffer.\n\n Skippable frames begin with a 4-byte magic number. There are 16 possible choices of magic number,\n ranging from ZSTD_MAGIC_SKIPPABLE_START to ZSTD_MAGIC_SKIPPABLE_START+15.\n As such, the parameter magicVariant controls the exact skippable frame magic number variant used,\n so the magic number used will be ZSTD_MAGIC_SKIPPABLE_START + magicVariant.\n\n Returns an error if destination buffer is not large enough, if the source size is not representable\n with a 4-byte unsigned int, or if the parameter magicVariant is greater than 15 (and therefore invalid).\n\n @return : number of bytes written or a ZSTD error."]
918    pub fn ZSTD_writeSkippableFrame(
919        dst: *mut ::core::ffi::c_void,
920        dstCapacity: usize,
921        src: *const ::core::ffi::c_void,
922        srcSize: usize,
923        magicVariant: ::core::ffi::c_uint,
924    ) -> usize;
925}
926extern "C" {
927    #[doc = " ZSTD_readSkippableFrame() :\n Retrieves the content of a zstd skippable frame starting at @src, and writes it to @dst buffer.\n\n The parameter @magicVariant will receive the magicVariant that was supplied when the frame was written,\n i.e. magicNumber - ZSTD_MAGIC_SKIPPABLE_START.\n This can be NULL if the caller is not interested in the magicVariant.\n\n Returns an error if destination buffer is not large enough, or if the frame is not skippable.\n\n @return : number of bytes written or a ZSTD error."]
928    pub fn ZSTD_readSkippableFrame(
929        dst: *mut ::core::ffi::c_void,
930        dstCapacity: usize,
931        magicVariant: *mut ::core::ffi::c_uint,
932        src: *const ::core::ffi::c_void,
933        srcSize: usize,
934    ) -> usize;
935}
936extern "C" {
937    #[doc = " ZSTD_isSkippableFrame() :\n  Tells if the content of `buffer` starts with a valid Frame Identifier for a skippable frame."]
938    pub fn ZSTD_isSkippableFrame(
939        buffer: *const ::core::ffi::c_void,
940        size: usize,
941    ) -> ::core::ffi::c_uint;
942}
943extern "C" {
944    #[doc = " ZSTD_estimate*() :\n  These functions make it possible to estimate memory usage\n  of a future {D,C}Ctx, before its creation.\n  This is useful in combination with ZSTD_initStatic(),\n  which makes it possible to employ a static buffer for ZSTD_CCtx* state.\n\n  ZSTD_estimateCCtxSize() will provide a memory budget large enough\n  to compress data of any size using one-shot compression ZSTD_compressCCtx() or ZSTD_compress2()\n  associated with any compression level up to max specified one.\n  The estimate will assume the input may be arbitrarily large,\n  which is the worst case.\n\n  Note that the size estimation is specific for one-shot compression,\n  it is not valid for streaming (see ZSTD_estimateCStreamSize*())\n  nor other potential ways of using a ZSTD_CCtx* state.\n\n  When srcSize can be bound by a known and rather \"small\" value,\n  this knowledge can be used to provide a tighter budget estimation\n  because the ZSTD_CCtx* state will need less memory for small inputs.\n  This tighter estimation can be provided by employing more advanced functions\n  ZSTD_estimateCCtxSize_usingCParams(), which can be used in tandem with ZSTD_getCParams(),\n  and ZSTD_estimateCCtxSize_usingCCtxParams(), which can be used in tandem with ZSTD_CCtxParams_setParameter().\n  Both can be used to estimate memory using custom compression parameters and arbitrary srcSize limits.\n\n  Note : only single-threaded compression is supported.\n  ZSTD_estimateCCtxSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1."]
945    pub fn ZSTD_estimateCCtxSize(
946        maxCompressionLevel: ::core::ffi::c_int,
947    ) -> usize;
948}
949extern "C" {
950    pub fn ZSTD_estimateCCtxSize_usingCParams(
951        cParams: ZSTD_compressionParameters,
952    ) -> usize;
953}
954extern "C" {
955    pub fn ZSTD_estimateCCtxSize_usingCCtxParams(
956        params: *const ZSTD_CCtx_params,
957    ) -> usize;
958}
959extern "C" {
960    pub fn ZSTD_estimateDCtxSize() -> usize;
961}
962extern "C" {
963    #[doc = " ZSTD_estimateCStreamSize() :\n  ZSTD_estimateCStreamSize() will provide a memory budget large enough for streaming compression\n  using any compression level up to the max specified one.\n  It will also consider src size to be arbitrarily \"large\", which is a worst case scenario.\n  If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation.\n  ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.\n  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.\n  Note : CStream size estimation is only correct for single-threaded compression.\n  ZSTD_estimateCStreamSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1.\n  Note 2 : ZSTD_estimateCStreamSize* functions are not compatible with the Block-Level Sequence Producer API at this time.\n  Size estimates assume that no external sequence producer is registered.\n\n  ZSTD_DStream memory budget depends on frame's window Size.\n  This information can be passed manually, using ZSTD_estimateDStreamSize,\n  or deducted from a valid frame Header, using ZSTD_estimateDStreamSize_fromFrame();\n  Any frame requesting a window size larger than max specified one will be rejected.\n  Note : if streaming is init with function ZSTD_init?Stream_usingDict(),\n         an internal ?Dict will be created, which additional size is not estimated here.\n         In this case, get total size by adding ZSTD_estimate?DictSize"]
964    pub fn ZSTD_estimateCStreamSize(
965        maxCompressionLevel: ::core::ffi::c_int,
966    ) -> usize;
967}
968extern "C" {
969    pub fn ZSTD_estimateCStreamSize_usingCParams(
970        cParams: ZSTD_compressionParameters,
971    ) -> usize;
972}
973extern "C" {
974    pub fn ZSTD_estimateCStreamSize_usingCCtxParams(
975        params: *const ZSTD_CCtx_params,
976    ) -> usize;
977}
978extern "C" {
979    pub fn ZSTD_estimateDStreamSize(maxWindowSize: usize) -> usize;
980}
981extern "C" {
982    pub fn ZSTD_estimateDStreamSize_fromFrame(
983        src: *const ::core::ffi::c_void,
984        srcSize: usize,
985    ) -> usize;
986}
987extern "C" {
988    #[doc = " ZSTD_estimate?DictSize() :\n  ZSTD_estimateCDictSize() will bet that src size is relatively \"small\", and content is copied, like ZSTD_createCDict().\n  ZSTD_estimateCDictSize_advanced() makes it possible to control compression parameters precisely, like ZSTD_createCDict_advanced().\n  These estimates return an error code if dictSize is too large.\n  Check the result with ZSTD_isError().\n  Note : dictionaries created by reference (`ZSTD_dlm_byRef`) are logically smaller."]
989    pub fn ZSTD_estimateCDictSize(
990        dictSize: usize,
991        compressionLevel: ::core::ffi::c_int,
992    ) -> usize;
993}
994extern "C" {
995    pub fn ZSTD_estimateCDictSize_advanced(
996        dictSize: usize,
997        cParams: ZSTD_compressionParameters,
998        dictLoadMethod: ZSTD_dictLoadMethod_e,
999    ) -> usize;
1000}
1001extern "C" {
1002    pub fn ZSTD_estimateDDictSize(
1003        dictSize: usize,
1004        dictLoadMethod: ZSTD_dictLoadMethod_e,
1005    ) -> usize;
1006}
1007extern "C" {
1008    #[doc = " ZSTD_initStatic*() :\n  Initialize an object using a pre-allocated fixed-size buffer.\n  workspace: The memory area to emplace the object into.\n             Provided pointer *must be 8-bytes aligned*.\n             Buffer must outlive object.\n  workspaceSize: Use ZSTD_estimate*Size() to determine\n                 how large workspace must be to support target scenario.\n @return : pointer to object (same address as workspace, just different type),\n           or NULL if error (size too small, incorrect alignment, etc.)\n  Note : zstd will never resize nor malloc() when using a static buffer.\n         If the object requires more memory than available,\n         zstd will just error out (typically ZSTD_error_memory_allocation).\n  Note 2 : there is no corresponding \"free\" function.\n           Since workspace is allocated externally, it must be freed externally too.\n  Note 3 : cParams : use ZSTD_getCParams() to convert a compression level\n           into its associated cParams.\n  Limitation 1 : currently not compatible with internal dictionary creation, triggered by\n                 ZSTD_CCtx_loadDictionary(), ZSTD_DCtx_loadDictionary(), ZSTD_DCtx_refPrefix(),\n                 ZSTD_initCStream_usingDict() or ZSTD_initDStream_usingDict().\n                 For one-shot decompression, ZSTD_decompress_usingDict() needs no allocation.\n                 Otherwise, use ZSTD_initStaticDDict() + ZSTD_DCtx_refDDict().\n  Limitation 2 : static cctx currently not compatible with multi-threading.\n  Limitation 3 : static dctx is incompatible with legacy support."]
1009    pub fn ZSTD_initStaticCCtx(
1010        workspace: *mut ::core::ffi::c_void,
1011        workspaceSize: usize,
1012    ) -> *mut ZSTD_CCtx;
1013}
1014extern "C" {
1015    pub fn ZSTD_initStaticCStream(
1016        workspace: *mut ::core::ffi::c_void,
1017        workspaceSize: usize,
1018    ) -> *mut ZSTD_CStream;
1019}
1020extern "C" {
1021    pub fn ZSTD_initStaticDCtx(
1022        workspace: *mut ::core::ffi::c_void,
1023        workspaceSize: usize,
1024    ) -> *mut ZSTD_DCtx;
1025}
1026extern "C" {
1027    pub fn ZSTD_initStaticDStream(
1028        workspace: *mut ::core::ffi::c_void,
1029        workspaceSize: usize,
1030    ) -> *mut ZSTD_DStream;
1031}
1032extern "C" {
1033    pub fn ZSTD_initStaticCDict(
1034        workspace: *mut ::core::ffi::c_void,
1035        workspaceSize: usize,
1036        dict: *const ::core::ffi::c_void,
1037        dictSize: usize,
1038        dictLoadMethod: ZSTD_dictLoadMethod_e,
1039        dictContentType: ZSTD_dictContentType_e,
1040        cParams: ZSTD_compressionParameters,
1041    ) -> *const ZSTD_CDict;
1042}
1043extern "C" {
1044    pub fn ZSTD_initStaticDDict(
1045        workspace: *mut ::core::ffi::c_void,
1046        workspaceSize: usize,
1047        dict: *const ::core::ffi::c_void,
1048        dictSize: usize,
1049        dictLoadMethod: ZSTD_dictLoadMethod_e,
1050        dictContentType: ZSTD_dictContentType_e,
1051    ) -> *const ZSTD_DDict;
1052}
1053#[doc = " Custom memory allocation :\n  These prototypes make it possible to pass your own allocation/free functions.\n  ZSTD_customMem is provided at creation time, using ZSTD_create*_advanced() variants listed below.\n  All allocation/free operations will be completed using these custom variants instead of regular <stdlib.h> ones."]
1054pub type ZSTD_allocFunction = ::core::option::Option<
1055    unsafe extern "C" fn(
1056        opaque: *mut ::core::ffi::c_void,
1057        size: usize,
1058    ) -> *mut ::core::ffi::c_void,
1059>;
1060pub type ZSTD_freeFunction = ::core::option::Option<
1061    unsafe extern "C" fn(
1062        opaque: *mut ::core::ffi::c_void,
1063        address: *mut ::core::ffi::c_void,
1064    ),
1065>;
1066#[repr(C)]
1067#[derive(Debug, Copy, Clone)]
1068pub struct ZSTD_customMem {
1069    pub customAlloc: ZSTD_allocFunction,
1070    pub customFree: ZSTD_freeFunction,
1071    pub opaque: *mut ::core::ffi::c_void,
1072}
1073extern "C" {
1074    #[doc = "< this constant defers to stdlib's functions"]
1075    pub static ZSTD_defaultCMem: ZSTD_customMem;
1076}
1077extern "C" {
1078    pub fn ZSTD_createCCtx_advanced(
1079        customMem: ZSTD_customMem,
1080    ) -> *mut ZSTD_CCtx;
1081}
1082extern "C" {
1083    pub fn ZSTD_createCStream_advanced(
1084        customMem: ZSTD_customMem,
1085    ) -> *mut ZSTD_CStream;
1086}
1087extern "C" {
1088    pub fn ZSTD_createDCtx_advanced(
1089        customMem: ZSTD_customMem,
1090    ) -> *mut ZSTD_DCtx;
1091}
1092extern "C" {
1093    pub fn ZSTD_createDStream_advanced(
1094        customMem: ZSTD_customMem,
1095    ) -> *mut ZSTD_DStream;
1096}
1097extern "C" {
1098    pub fn ZSTD_createCDict_advanced(
1099        dict: *const ::core::ffi::c_void,
1100        dictSize: usize,
1101        dictLoadMethod: ZSTD_dictLoadMethod_e,
1102        dictContentType: ZSTD_dictContentType_e,
1103        cParams: ZSTD_compressionParameters,
1104        customMem: ZSTD_customMem,
1105    ) -> *mut ZSTD_CDict;
1106}
1107#[repr(C)]
1108#[derive(Debug, Copy, Clone)]
1109pub struct POOL_ctx_s {
1110    _unused: [u8; 0],
1111}
1112#[doc = " Thread pool :\n  These prototypes make it possible to share a thread pool among multiple compression contexts.\n  This can limit resources for applications with multiple threads where each one uses\n  a threaded compression mode (via ZSTD_c_nbWorkers parameter).\n  ZSTD_createThreadPool creates a new thread pool with a given number of threads.\n  ZSTD_c_nbWorkers does not change the number of threads of such a pool.\n  Note that the lifetime of such pool must exist while being used.\n  ZSTD_CCtx_refThreadPool assigns a thread pool to a context (use NULL argument value\n  to use an internal thread pool). The context then no longer uses its previous pool.\n  ZSTD_freeThreadPool frees a thread pool, accepts NULL pointer."]
1113pub type ZSTD_threadPool = POOL_ctx_s;
1114extern "C" {
1115    pub fn ZSTD_createThreadPool(numThreads: usize) -> *mut ZSTD_threadPool;
1116}
1117extern "C" {
1118    pub fn ZSTD_freeThreadPool(pool: *mut ZSTD_threadPool);
1119}
1120extern "C" {
1121    pub fn ZSTD_CCtx_refThreadPool(
1122        cctx: *mut ZSTD_CCtx,
1123        pool: *mut ZSTD_threadPool,
1124    ) -> usize;
1125}
1126extern "C" {
1127    pub fn ZSTD_createCDict_advanced2(
1128        dict: *const ::core::ffi::c_void,
1129        dictSize: usize,
1130        dictLoadMethod: ZSTD_dictLoadMethod_e,
1131        dictContentType: ZSTD_dictContentType_e,
1132        cctxParams: *const ZSTD_CCtx_params,
1133        customMem: ZSTD_customMem,
1134    ) -> *mut ZSTD_CDict;
1135}
1136extern "C" {
1137    pub fn ZSTD_createDDict_advanced(
1138        dict: *const ::core::ffi::c_void,
1139        dictSize: usize,
1140        dictLoadMethod: ZSTD_dictLoadMethod_e,
1141        dictContentType: ZSTD_dictContentType_e,
1142        customMem: ZSTD_customMem,
1143    ) -> *mut ZSTD_DDict;
1144}
1145extern "C" {
1146    #[doc = " ZSTD_createCDict_byReference() :\n  Create a digested dictionary for compression\n  Dictionary content is just referenced, not duplicated.\n  As a consequence, `dictBuffer` **must** outlive CDict,\n  and its content must remain unmodified throughout the lifetime of CDict.\n  note: equivalent to ZSTD_createCDict_advanced(), with dictLoadMethod==ZSTD_dlm_byRef"]
1147    pub fn ZSTD_createCDict_byReference(
1148        dictBuffer: *const ::core::ffi::c_void,
1149        dictSize: usize,
1150        compressionLevel: ::core::ffi::c_int,
1151    ) -> *mut ZSTD_CDict;
1152}
1153extern "C" {
1154    #[doc = " ZSTD_getCParams() :\n @return ZSTD_compressionParameters structure for a selected compression level and estimated srcSize.\n `estimatedSrcSize` value is optional, select 0 if not known"]
1155    pub fn ZSTD_getCParams(
1156        compressionLevel: ::core::ffi::c_int,
1157        estimatedSrcSize: ::core::ffi::c_ulonglong,
1158        dictSize: usize,
1159    ) -> ZSTD_compressionParameters;
1160}
1161extern "C" {
1162    #[doc = " ZSTD_getParams() :\n  same as ZSTD_getCParams(), but @return a full `ZSTD_parameters` object instead of sub-component `ZSTD_compressionParameters`.\n  All fields of `ZSTD_frameParameters` are set to default : contentSize=1, checksum=0, noDictID=0"]
1163    pub fn ZSTD_getParams(
1164        compressionLevel: ::core::ffi::c_int,
1165        estimatedSrcSize: ::core::ffi::c_ulonglong,
1166        dictSize: usize,
1167    ) -> ZSTD_parameters;
1168}
1169extern "C" {
1170    #[doc = " ZSTD_checkCParams() :\n  Ensure param values remain within authorized range.\n @return 0 on success, or an error code (can be checked with ZSTD_isError())"]
1171    pub fn ZSTD_checkCParams(params: ZSTD_compressionParameters) -> usize;
1172}
1173extern "C" {
1174    #[doc = " ZSTD_adjustCParams() :\n  optimize params for a given `srcSize` and `dictSize`.\n `srcSize` can be unknown, in which case use ZSTD_CONTENTSIZE_UNKNOWN.\n `dictSize` must be `0` when there is no dictionary.\n  cPar can be invalid : all parameters will be clamped within valid range in the @return struct.\n  This function never fails (wide contract)"]
1175    pub fn ZSTD_adjustCParams(
1176        cPar: ZSTD_compressionParameters,
1177        srcSize: ::core::ffi::c_ulonglong,
1178        dictSize: usize,
1179    ) -> ZSTD_compressionParameters;
1180}
1181extern "C" {
1182    #[doc = " ZSTD_CCtx_setCParams() :\n  Set all parameters provided within @p cparams into the working @p cctx.\n  Note : if modifying parameters during compression (MT mode only),\n         note that changes to the .windowLog parameter will be ignored.\n @return 0 on success, or an error code (can be checked with ZSTD_isError()).\n         On failure, no parameters are updated."]
1183    pub fn ZSTD_CCtx_setCParams(
1184        cctx: *mut ZSTD_CCtx,
1185        cparams: ZSTD_compressionParameters,
1186    ) -> usize;
1187}
1188extern "C" {
1189    #[doc = " ZSTD_CCtx_setFParams() :\n  Set all parameters provided within @p fparams into the working @p cctx.\n @return 0 on success, or an error code (can be checked with ZSTD_isError())."]
1190    pub fn ZSTD_CCtx_setFParams(
1191        cctx: *mut ZSTD_CCtx,
1192        fparams: ZSTD_frameParameters,
1193    ) -> usize;
1194}
1195extern "C" {
1196    #[doc = " ZSTD_CCtx_setParams() :\n  Set all parameters provided within @p params into the working @p cctx.\n @return 0 on success, or an error code (can be checked with ZSTD_isError())."]
1197    pub fn ZSTD_CCtx_setParams(
1198        cctx: *mut ZSTD_CCtx,
1199        params: ZSTD_parameters,
1200    ) -> usize;
1201}
1202extern "C" {
1203    #[doc = " ZSTD_compress_advanced() :\n  Note : this function is now DEPRECATED.\n         It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_setParameter() and other parameter setters.\n  This prototype will generate compilation warnings."]
1204    pub fn ZSTD_compress_advanced(
1205        cctx: *mut ZSTD_CCtx,
1206        dst: *mut ::core::ffi::c_void,
1207        dstCapacity: usize,
1208        src: *const ::core::ffi::c_void,
1209        srcSize: usize,
1210        dict: *const ::core::ffi::c_void,
1211        dictSize: usize,
1212        params: ZSTD_parameters,
1213    ) -> usize;
1214}
1215extern "C" {
1216    #[doc = " ZSTD_compress_usingCDict_advanced() :\n  Note : this function is now DEPRECATED.\n         It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_loadDictionary() and other parameter setters.\n  This prototype will generate compilation warnings."]
1217    pub fn ZSTD_compress_usingCDict_advanced(
1218        cctx: *mut ZSTD_CCtx,
1219        dst: *mut ::core::ffi::c_void,
1220        dstCapacity: usize,
1221        src: *const ::core::ffi::c_void,
1222        srcSize: usize,
1223        cdict: *const ZSTD_CDict,
1224        fParams: ZSTD_frameParameters,
1225    ) -> usize;
1226}
1227extern "C" {
1228    #[doc = " ZSTD_CCtx_loadDictionary_byReference() :\n  Same as ZSTD_CCtx_loadDictionary(), but dictionary content is referenced, instead of being copied into CCtx.\n  It saves some memory, but also requires that `dict` outlives its usage within `cctx`"]
1229    pub fn ZSTD_CCtx_loadDictionary_byReference(
1230        cctx: *mut ZSTD_CCtx,
1231        dict: *const ::core::ffi::c_void,
1232        dictSize: usize,
1233    ) -> usize;
1234}
1235extern "C" {
1236    #[doc = " ZSTD_CCtx_refPrefix_advanced() :\n  Same as ZSTD_CCtx_refPrefix(), but gives finer control over\n  how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?)"]
1237    pub fn ZSTD_CCtx_refPrefix_advanced(
1238        cctx: *mut ZSTD_CCtx,
1239        prefix: *const ::core::ffi::c_void,
1240        prefixSize: usize,
1241        dictContentType: ZSTD_dictContentType_e,
1242    ) -> usize;
1243}
1244extern "C" {
1245    #[doc = " ZSTD_CCtx_getParameter() :\n  Get the requested compression parameter value, selected by enum ZSTD_cParameter,\n  and store it into int* value.\n @return : 0, or an error code (which can be tested with ZSTD_isError())."]
1246    pub fn ZSTD_CCtx_getParameter(
1247        cctx: *const ZSTD_CCtx,
1248        param: ZSTD_cParameter,
1249        value: *mut ::core::ffi::c_int,
1250    ) -> usize;
1251}
1252extern "C" {
1253    #[doc = " ZSTD_CCtx_params :\n  Quick howto :\n  - ZSTD_createCCtxParams() : Create a ZSTD_CCtx_params structure\n  - ZSTD_CCtxParams_setParameter() : Push parameters one by one into\n                                     an existing ZSTD_CCtx_params structure.\n                                     This is similar to\n                                     ZSTD_CCtx_setParameter().\n  - ZSTD_CCtx_setParametersUsingCCtxParams() : Apply parameters to\n                                    an existing CCtx.\n                                    These parameters will be applied to\n                                    all subsequent frames.\n  - ZSTD_compressStream2() : Do compression using the CCtx.\n  - ZSTD_freeCCtxParams() : Free the memory, accept NULL pointer.\n\n  This can be used with ZSTD_estimateCCtxSize_advanced_usingCCtxParams()\n  for static allocation of CCtx for single-threaded compression."]
1254    pub fn ZSTD_createCCtxParams() -> *mut ZSTD_CCtx_params;
1255}
1256extern "C" {
1257    pub fn ZSTD_freeCCtxParams(params: *mut ZSTD_CCtx_params) -> usize;
1258}
1259extern "C" {
1260    #[doc = " ZSTD_CCtxParams_reset() :\n  Reset params to default values."]
1261    pub fn ZSTD_CCtxParams_reset(params: *mut ZSTD_CCtx_params) -> usize;
1262}
1263extern "C" {
1264    #[doc = " ZSTD_CCtxParams_init() :\n  Initializes the compression parameters of cctxParams according to\n  compression level. All other parameters are reset to their default values."]
1265    pub fn ZSTD_CCtxParams_init(
1266        cctxParams: *mut ZSTD_CCtx_params,
1267        compressionLevel: ::core::ffi::c_int,
1268    ) -> usize;
1269}
1270extern "C" {
1271    #[doc = " ZSTD_CCtxParams_init_advanced() :\n  Initializes the compression and frame parameters of cctxParams according to\n  params. All other parameters are reset to their default values."]
1272    pub fn ZSTD_CCtxParams_init_advanced(
1273        cctxParams: *mut ZSTD_CCtx_params,
1274        params: ZSTD_parameters,
1275    ) -> usize;
1276}
1277extern "C" {
1278    #[doc = " ZSTD_CCtxParams_setParameter() : Requires v1.4.0+\n  Similar to ZSTD_CCtx_setParameter.\n  Set one compression parameter, selected by enum ZSTD_cParameter.\n  Parameters must be applied to a ZSTD_CCtx using\n  ZSTD_CCtx_setParametersUsingCCtxParams().\n @result : a code representing success or failure (which can be tested with\n           ZSTD_isError())."]
1279    pub fn ZSTD_CCtxParams_setParameter(
1280        params: *mut ZSTD_CCtx_params,
1281        param: ZSTD_cParameter,
1282        value: ::core::ffi::c_int,
1283    ) -> usize;
1284}
1285extern "C" {
1286    #[doc = " ZSTD_CCtxParams_getParameter() :\n Similar to ZSTD_CCtx_getParameter.\n Get the requested value of one compression parameter, selected by enum ZSTD_cParameter.\n @result : 0, or an error code (which can be tested with ZSTD_isError())."]
1287    pub fn ZSTD_CCtxParams_getParameter(
1288        params: *const ZSTD_CCtx_params,
1289        param: ZSTD_cParameter,
1290        value: *mut ::core::ffi::c_int,
1291    ) -> usize;
1292}
1293extern "C" {
1294    #[doc = " ZSTD_CCtx_setParametersUsingCCtxParams() :\n  Apply a set of ZSTD_CCtx_params to the compression context.\n  This can be done even after compression is started,\n    if nbWorkers==0, this will have no impact until a new compression is started.\n    if nbWorkers>=1, new parameters will be picked up at next job,\n       with a few restrictions (windowLog, pledgedSrcSize, nbWorkers, jobSize, and overlapLog are not updated)."]
1295    pub fn ZSTD_CCtx_setParametersUsingCCtxParams(
1296        cctx: *mut ZSTD_CCtx,
1297        params: *const ZSTD_CCtx_params,
1298    ) -> usize;
1299}
1300extern "C" {
1301    #[doc = " ZSTD_compressStream2_simpleArgs() :\n  Same as ZSTD_compressStream2(),\n  but using only integral types as arguments.\n  This variant might be helpful for binders from dynamic languages\n  which have troubles handling structures containing memory pointers."]
1302    pub fn ZSTD_compressStream2_simpleArgs(
1303        cctx: *mut ZSTD_CCtx,
1304        dst: *mut ::core::ffi::c_void,
1305        dstCapacity: usize,
1306        dstPos: *mut usize,
1307        src: *const ::core::ffi::c_void,
1308        srcSize: usize,
1309        srcPos: *mut usize,
1310        endOp: ZSTD_EndDirective,
1311    ) -> usize;
1312}
1313extern "C" {
1314    #[doc = " ZSTD_isFrame() :\n  Tells if the content of `buffer` starts with a valid Frame Identifier.\n  Note : Frame Identifier is 4 bytes. If `size < 4`, @return will always be 0.\n  Note 2 : Legacy Frame Identifiers are considered valid only if Legacy Support is enabled.\n  Note 3 : Skippable Frame Identifiers are considered valid."]
1315    pub fn ZSTD_isFrame(
1316        buffer: *const ::core::ffi::c_void,
1317        size: usize,
1318    ) -> ::core::ffi::c_uint;
1319}
1320extern "C" {
1321    #[doc = " ZSTD_DCtx_loadDictionary_byReference() :\n  Same as ZSTD_DCtx_loadDictionary(),\n  but references `dict` content instead of copying it into `dctx`.\n  This saves memory if `dict` remains around.,\n  However, it's imperative that `dict` remains accessible (and unmodified) while being used, so it must outlive decompression."]
1322    pub fn ZSTD_DCtx_loadDictionary_byReference(
1323        dctx: *mut ZSTD_DCtx,
1324        dict: *const ::core::ffi::c_void,
1325        dictSize: usize,
1326    ) -> usize;
1327}
1328extern "C" {
1329    #[doc = " ZSTD_DCtx_refPrefix_advanced() :\n  Same as ZSTD_DCtx_refPrefix(), but gives finer control over\n  how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?).\n  The prefix has the same single-use lifetime and reset behavior described\n  by ZSTD_DCtx_refPrefix()."]
1330    pub fn ZSTD_DCtx_refPrefix_advanced(
1331        dctx: *mut ZSTD_DCtx,
1332        prefix: *const ::core::ffi::c_void,
1333        prefixSize: usize,
1334        dictContentType: ZSTD_dictContentType_e,
1335    ) -> usize;
1336}
1337extern "C" {
1338    #[doc = " ZSTD_DCtx_setMaxWindowSize() :\n  Refuses allocating internal buffers for frames requiring a window size larger than provided limit.\n  This protects a decoder context from reserving too much memory for itself (potential attack scenario).\n  This parameter is only useful in streaming mode, since no internal buffer is allocated in single-pass mode.\n  By default, a decompression context accepts all window sizes <= (1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT)\n @return : 0, or an error code (which can be tested using ZSTD_isError())."]
1339    pub fn ZSTD_DCtx_setMaxWindowSize(
1340        dctx: *mut ZSTD_DCtx,
1341        maxWindowSize: usize,
1342    ) -> usize;
1343}
1344extern "C" {
1345    #[doc = " ZSTD_DCtx_getParameter() :\n  Get the requested decompression parameter value, selected by enum ZSTD_dParameter,\n  and store it into int* value.\n @return : 0, or an error code (which can be tested with ZSTD_isError())."]
1346    pub fn ZSTD_DCtx_getParameter(
1347        dctx: *mut ZSTD_DCtx,
1348        param: ZSTD_dParameter,
1349        value: *mut ::core::ffi::c_int,
1350    ) -> usize;
1351}
1352extern "C" {
1353    #[doc = " ZSTD_DCtx_setFormat() :\n  This function is REDUNDANT. Prefer ZSTD_DCtx_setParameter().\n  Instruct the decoder context about what kind of data to decode next.\n  This instruction is mandatory to decode data without a fully-formed header,\n  such ZSTD_f_zstd1_magicless for example.\n @return : 0, or an error code (which can be tested using ZSTD_isError())."]
1354    pub fn ZSTD_DCtx_setFormat(
1355        dctx: *mut ZSTD_DCtx,
1356        format: ZSTD_format_e,
1357    ) -> usize;
1358}
1359extern "C" {
1360    #[doc = " ZSTD_decompressStream_simpleArgs() :\n  Same as ZSTD_decompressStream(),\n  but using only integral types as arguments.\n  This can be helpful for binders from dynamic languages\n  which have troubles handling structures containing memory pointers."]
1361    pub fn ZSTD_decompressStream_simpleArgs(
1362        dctx: *mut ZSTD_DCtx,
1363        dst: *mut ::core::ffi::c_void,
1364        dstCapacity: usize,
1365        dstPos: *mut usize,
1366        src: *const ::core::ffi::c_void,
1367        srcSize: usize,
1368        srcPos: *mut usize,
1369    ) -> usize;
1370}
1371extern "C" {
1372    #[doc = " ZSTD_initCStream_srcSize() :\n This function is DEPRECATED, and equivalent to:\n     ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);\n     ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any)\n     ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);\n     ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);\n\n pledgedSrcSize must be correct. If it is not known at init time, use\n ZSTD_CONTENTSIZE_UNKNOWN. Note that, for compatibility with older programs,\n \"0\" also disables frame content size field. It may be enabled in the future.\n This prototype will generate compilation warnings."]
1373    pub fn ZSTD_initCStream_srcSize(
1374        zcs: *mut ZSTD_CStream,
1375        compressionLevel: ::core::ffi::c_int,
1376        pledgedSrcSize: ::core::ffi::c_ulonglong,
1377    ) -> usize;
1378}
1379extern "C" {
1380    #[doc = " ZSTD_initCStream_usingDict() :\n This function is DEPRECATED, and is equivalent to:\n     ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);\n     ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);\n     ZSTD_CCtx_loadDictionary(zcs, dict, dictSize);\n\n Creates of an internal CDict (incompatible with static CCtx), except if\n dict == NULL or dictSize < 8, in which case no dict is used.\n Note: dict is loaded with ZSTD_dct_auto (treated as a full zstd dictionary if\n it begins with ZSTD_MAGIC_DICTIONARY, else as raw content) and ZSTD_dlm_byCopy.\n This prototype will generate compilation warnings."]
1381    pub fn ZSTD_initCStream_usingDict(
1382        zcs: *mut ZSTD_CStream,
1383        dict: *const ::core::ffi::c_void,
1384        dictSize: usize,
1385        compressionLevel: ::core::ffi::c_int,
1386    ) -> usize;
1387}
1388extern "C" {
1389    #[doc = " ZSTD_initCStream_advanced() :\n This function is DEPRECATED, and is equivalent to:\n     ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);\n     ZSTD_CCtx_setParams(zcs, params);\n     ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);\n     ZSTD_CCtx_loadDictionary(zcs, dict, dictSize);\n\n dict is loaded with ZSTD_dct_auto and ZSTD_dlm_byCopy.\n pledgedSrcSize must be correct.\n If srcSize is not known at init time, use value ZSTD_CONTENTSIZE_UNKNOWN.\n This prototype will generate compilation warnings."]
1390    pub fn ZSTD_initCStream_advanced(
1391        zcs: *mut ZSTD_CStream,
1392        dict: *const ::core::ffi::c_void,
1393        dictSize: usize,
1394        params: ZSTD_parameters,
1395        pledgedSrcSize: ::core::ffi::c_ulonglong,
1396    ) -> usize;
1397}
1398extern "C" {
1399    #[doc = " ZSTD_initCStream_usingCDict() :\n This function is DEPRECATED, and equivalent to:\n     ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);\n     ZSTD_CCtx_refCDict(zcs, cdict);\n\n note : cdict will just be referenced, and must outlive compression session\n This prototype will generate compilation warnings."]
1400    pub fn ZSTD_initCStream_usingCDict(
1401        zcs: *mut ZSTD_CStream,
1402        cdict: *const ZSTD_CDict,
1403    ) -> usize;
1404}
1405extern "C" {
1406    #[doc = " ZSTD_initCStream_usingCDict_advanced() :\n   This function is DEPRECATED, and is equivalent to:\n     ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);\n     ZSTD_CCtx_setFParams(zcs, fParams);\n     ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);\n     ZSTD_CCtx_refCDict(zcs, cdict);\n\n same as ZSTD_initCStream_usingCDict(), with control over frame parameters.\n pledgedSrcSize must be correct. If srcSize is not known at init time, use\n value ZSTD_CONTENTSIZE_UNKNOWN.\n This prototype will generate compilation warnings."]
1407    pub fn ZSTD_initCStream_usingCDict_advanced(
1408        zcs: *mut ZSTD_CStream,
1409        cdict: *const ZSTD_CDict,
1410        fParams: ZSTD_frameParameters,
1411        pledgedSrcSize: ::core::ffi::c_ulonglong,
1412    ) -> usize;
1413}
1414extern "C" {
1415    #[doc = " ZSTD_resetCStream() :\n This function is DEPRECATED, and is equivalent to:\n     ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);\n     ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);\n Note: ZSTD_resetCStream() interprets pledgedSrcSize == 0 as ZSTD_CONTENTSIZE_UNKNOWN, but\n       ZSTD_CCtx_setPledgedSrcSize() does not do the same, so ZSTD_CONTENTSIZE_UNKNOWN must be\n       explicitly specified.\n\n  start a new frame, using same parameters from previous frame.\n  This is typically useful to skip dictionary loading stage, since it will reuse it in-place.\n  Note that zcs must be init at least once before using ZSTD_resetCStream().\n  If pledgedSrcSize is not known at reset time, use macro ZSTD_CONTENTSIZE_UNKNOWN.\n  If pledgedSrcSize > 0, its value must be correct, as it will be written in header, and controlled at the end.\n  For the time being, pledgedSrcSize==0 is interpreted as \"srcSize unknown\" for compatibility with older programs,\n  but it will change to mean \"empty\" in future version, so use macro ZSTD_CONTENTSIZE_UNKNOWN instead.\n @return : 0, or an error code (which can be tested using ZSTD_isError())\n  This prototype will generate compilation warnings."]
1416    pub fn ZSTD_resetCStream(
1417        zcs: *mut ZSTD_CStream,
1418        pledgedSrcSize: ::core::ffi::c_ulonglong,
1419    ) -> usize;
1420}
1421#[repr(C)]
1422#[derive(Debug, Copy, Clone)]
1423pub struct ZSTD_frameProgression {
1424    pub ingested: ::core::ffi::c_ulonglong,
1425    pub consumed: ::core::ffi::c_ulonglong,
1426    pub produced: ::core::ffi::c_ulonglong,
1427    pub flushed: ::core::ffi::c_ulonglong,
1428    pub currentJobID: ::core::ffi::c_uint,
1429    pub nbActiveWorkers: ::core::ffi::c_uint,
1430}
1431extern "C" {
1432    pub fn ZSTD_getFrameProgression(
1433        cctx: *const ZSTD_CCtx,
1434    ) -> ZSTD_frameProgression;
1435}
1436extern "C" {
1437    #[doc = " ZSTD_toFlushNow() :\n  Tell how many bytes are ready to be flushed immediately.\n  Useful for multithreading scenarios (nbWorkers >= 1).\n  Probe the oldest active job, defined as oldest job not yet entirely flushed,\n  and check its output buffer.\n @return : amount of data stored in oldest job and ready to be flushed immediately.\n  if @return == 0, it means either :\n  + there is no active job (could be checked with ZSTD_frameProgression()), or\n  + oldest job is still actively compressing data,\n    but everything it has produced has also been flushed so far,\n    therefore flush speed is limited by production speed of oldest job\n    irrespective of the speed of concurrent (and newer) jobs."]
1438    pub fn ZSTD_toFlushNow(cctx: *mut ZSTD_CCtx) -> usize;
1439}
1440extern "C" {
1441    #[doc = " This function is deprecated, and is equivalent to:\n\n     ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);\n     ZSTD_DCtx_loadDictionary(zds, dict, dictSize);\n\n note: no dictionary will be used if dict == NULL or dictSize < 8"]
1442    pub fn ZSTD_initDStream_usingDict(
1443        zds: *mut ZSTD_DStream,
1444        dict: *const ::core::ffi::c_void,
1445        dictSize: usize,
1446    ) -> usize;
1447}
1448extern "C" {
1449    #[doc = " This function is deprecated, and is equivalent to:\n\n     ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);\n     ZSTD_DCtx_refDDict(zds, ddict);\n\n note : ddict is referenced, it must outlive decompression session"]
1450    pub fn ZSTD_initDStream_usingDDict(
1451        zds: *mut ZSTD_DStream,
1452        ddict: *const ZSTD_DDict,
1453    ) -> usize;
1454}
1455extern "C" {
1456    #[doc = " This function is deprecated, and is equivalent to:\n\n     ZSTD_DCtx_reset(zds, ZSTD_reset_session_only);\n\n reuse decompression parameters from previous init; saves dictionary loading"]
1457    pub fn ZSTD_resetDStream(zds: *mut ZSTD_DStream) -> usize;
1458}
1459pub type ZSTD_sequenceProducer_F = ::core::option::Option<
1460    unsafe extern "C" fn(
1461        sequenceProducerState: *mut ::core::ffi::c_void,
1462        outSeqs: *mut ZSTD_Sequence,
1463        outSeqsCapacity: usize,
1464        src: *const ::core::ffi::c_void,
1465        srcSize: usize,
1466        dict: *const ::core::ffi::c_void,
1467        dictSize: usize,
1468        compressionLevel: ::core::ffi::c_int,
1469        windowSize: usize,
1470    ) -> usize,
1471>;
1472extern "C" {
1473    #[doc = " ZSTD_registerSequenceProducer() :\n Instruct zstd to use a block-level external sequence producer function.\n\n The sequenceProducerState must be initialized by the caller, and the caller is\n responsible for managing its lifetime. This parameter is sticky across\n compressions. It will remain set until the user explicitly resets compression\n parameters.\n\n Sequence producer registration is considered to be an \"advanced parameter\",\n part of the \"advanced API\". This means it will only have an effect on compression\n APIs which respect advanced parameters, such as compress2() and compressStream2().\n Older compression APIs such as compressCCtx(), which predate the introduction of\n \"advanced parameters\", will ignore any external sequence producer setting.\n\n The sequence producer can be \"cleared\" by registering a NULL function pointer. This\n removes all limitations described above in the \"LIMITATIONS\" section of the API docs.\n\n The user is strongly encouraged to read the full API documentation (above) before\n calling this function."]
1474    pub fn ZSTD_registerSequenceProducer(
1475        cctx: *mut ZSTD_CCtx,
1476        sequenceProducerState: *mut ::core::ffi::c_void,
1477        sequenceProducer: ZSTD_sequenceProducer_F,
1478    );
1479}
1480extern "C" {
1481    #[doc = " ZSTD_CCtxParams_registerSequenceProducer() :\n Same as ZSTD_registerSequenceProducer(), but operates on ZSTD_CCtx_params.\n This is used for accurate size estimation with ZSTD_estimateCCtxSize_usingCCtxParams(),\n which is needed when creating a ZSTD_CCtx with ZSTD_initStaticCCtx().\n\n If you are using the external sequence producer API in a scenario where ZSTD_initStaticCCtx()\n is required, then this function is for you. Otherwise, you probably don't need it.\n\n See tests/zstreamtest.c for example usage."]
1482    pub fn ZSTD_CCtxParams_registerSequenceProducer(
1483        params: *mut ZSTD_CCtx_params,
1484        sequenceProducerState: *mut ::core::ffi::c_void,
1485        sequenceProducer: ZSTD_sequenceProducer_F,
1486    );
1487}
1488extern "C" {
1489    #[doc = "Buffer-less streaming compression (synchronous mode)\n\nA ZSTD_CCtx object is required to track streaming operations.\nUse ZSTD_createCCtx() / ZSTD_freeCCtx() to manage resource.\nZSTD_CCtx object can be reused multiple times within successive compression operations.\n\nStart by initializing a context.\nUse ZSTD_compressBegin(), or ZSTD_compressBegin_usingDict() for dictionary compression.\n\nThen, consume your input using ZSTD_compressContinue().\nThere are some important considerations to keep in mind when using this advanced function :\n- ZSTD_compressContinue() has no internal buffer. It uses externally provided buffers only.\n- Interface is synchronous : input is consumed entirely and produces 1+ compressed blocks.\n- Caller must ensure there is enough space in `dst` to store compressed data under worst case scenario.\nWorst case evaluation is provided by ZSTD_compressBound().\nZSTD_compressContinue() doesn't guarantee recover after a failed compression.\n- ZSTD_compressContinue() presumes prior input ***is still accessible and unmodified*** (up to maximum distance size, see WindowLog).\nIt remembers all previous contiguous blocks, plus one separated memory segment (which can itself consists of multiple contiguous blocks)\n- ZSTD_compressContinue() detects that prior input has been overwritten when `src` buffer overlaps.\nIn which case, it will \"discard\" the relevant memory section from its history.\n\nFinish a frame with ZSTD_compressEnd(), which will write the last block(s) and optional checksum.\nIt's possible to use srcSize==0, in which case, it will write a final empty block to end the frame.\nWithout last block mark, frames are considered unfinished (hence corrupted) by compliant decoders.\n\n`ZSTD_CCtx` object can be reused (ZSTD_compressBegin()) to compress again."]
1490    pub fn ZSTD_compressBegin(
1491        cctx: *mut ZSTD_CCtx,
1492        compressionLevel: ::core::ffi::c_int,
1493    ) -> usize;
1494}
1495extern "C" {
1496    pub fn ZSTD_compressBegin_usingDict(
1497        cctx: *mut ZSTD_CCtx,
1498        dict: *const ::core::ffi::c_void,
1499        dictSize: usize,
1500        compressionLevel: ::core::ffi::c_int,
1501    ) -> usize;
1502}
1503extern "C" {
1504    pub fn ZSTD_compressBegin_usingCDict(
1505        cctx: *mut ZSTD_CCtx,
1506        cdict: *const ZSTD_CDict,
1507    ) -> usize;
1508}
1509extern "C" {
1510    pub fn ZSTD_compressContinue(
1511        cctx: *mut ZSTD_CCtx,
1512        dst: *mut ::core::ffi::c_void,
1513        dstCapacity: usize,
1514        src: *const ::core::ffi::c_void,
1515        srcSize: usize,
1516    ) -> usize;
1517}
1518extern "C" {
1519    pub fn ZSTD_compressEnd(
1520        cctx: *mut ZSTD_CCtx,
1521        dst: *mut ::core::ffi::c_void,
1522        dstCapacity: usize,
1523        src: *const ::core::ffi::c_void,
1524        srcSize: usize,
1525    ) -> usize;
1526}
1527extern "C" {
1528    pub fn ZSTD_compressBegin_advanced(
1529        cctx: *mut ZSTD_CCtx,
1530        dict: *const ::core::ffi::c_void,
1531        dictSize: usize,
1532        params: ZSTD_parameters,
1533        pledgedSrcSize: ::core::ffi::c_ulonglong,
1534    ) -> usize;
1535}
1536extern "C" {
1537    pub fn ZSTD_compressBegin_usingCDict_advanced(
1538        cctx: *mut ZSTD_CCtx,
1539        cdict: *const ZSTD_CDict,
1540        fParams: ZSTD_frameParameters,
1541        pledgedSrcSize: ::core::ffi::c_ulonglong,
1542    ) -> usize;
1543}
1544extern "C" {
1545    #[doc = "Buffer-less streaming decompression (synchronous mode)\n\nA ZSTD_DCtx object is required to track streaming operations.\nUse ZSTD_createDCtx() / ZSTD_freeDCtx() to manage it.\nA ZSTD_DCtx object can be reused multiple times.\n\nFirst typical operation is to retrieve frame parameters, using ZSTD_getFrameHeader().\nFrame header is extracted from the beginning of compressed frame, so providing only the frame's beginning is enough.\nData fragment must be large enough to ensure successful decoding.\n`ZSTD_frameHeaderSize_max` bytes is guaranteed to always be large enough.\nresult  : 0 : successful decoding, the `ZSTD_frameHeader` structure is correctly filled.\n>0 : `srcSize` is too small, please provide at least result bytes on next attempt.\nerrorCode, which can be tested using ZSTD_isError().\n\nIt fills a ZSTD_FrameHeader structure with important information to correctly decode the frame,\nsuch as the dictionary ID, content size, or maximum back-reference distance (`windowSize`).\nNote that these values could be wrong, either because of data corruption, or because a 3rd party deliberately spoofs false information.\nAs a consequence, check that values remain within valid application range.\nFor example, do not allocate memory blindly, check that `windowSize` is within expectation.\nEach application can set its own limits, depending on local restrictions.\nFor extended interoperability, it is recommended to support `windowSize` of at least 8 MB.\n\nZSTD_decompressContinue() needs previous data blocks during decompression, up to `windowSize` bytes.\nZSTD_decompressContinue() is very sensitive to contiguity,\nif 2 blocks don't follow each other, make sure that either the compressor breaks contiguity at the same place,\nor that previous contiguous segment is large enough to properly handle maximum back-reference distance.\nThere are multiple ways to guarantee this condition.\n\nThe most memory efficient way is to use a round buffer of sufficient size.\nSufficient size is determined by invoking ZSTD_decodingBufferSize_min(),\nwhich can return an error code if required value is too large for current system (in 32-bits mode).\nIn a round buffer methodology, ZSTD_decompressContinue() decompresses each block next to previous one,\nup to the moment there is not enough room left in the buffer to guarantee decoding another full block,\nwhich maximum size is provided in `ZSTD_frameHeader` structure, field `blockSizeMax`.\nAt which point, decoding can resume from the beginning of the buffer.\nNote that already decoded data stored in the buffer should be flushed before being overwritten.\n\nThere are alternatives possible, for example using two or more buffers of size `windowSize` each, though they consume more memory.\n\nFinally, if you control the compression process, you can also ignore all buffer size rules,\nas long as the encoder and decoder progress in \"lock-step\",\naka use exactly the same buffer sizes, break contiguity at the same place, etc.\n\nOnce buffers are set up and decompression parameters are configured, initialize the decoder with ZSTD_decompressBegin().\nIf decompression requires a dictionary, use ZSTD_decompressBegin_usingDict() or ZSTD_decompressBegin_usingDDict().\nOne of these initialization functions must be called before the first ZSTD_decompressContinue() call for every frame,\nincluding when reusing a context or after calling ZSTD_DCtx_reset().\nZSTD_DCtx_reset() does not replace this initialization, and ZSTD_decompressContinue() does not initialize the decoder itself.\nAfter a session reset, an interrupted frame cannot be resumed : initialize the decoder again and restart from the frame's beginning.\n\nThen use ZSTD_nextSrcSizeToDecompress() and ZSTD_decompressContinue() alternatively.\nZSTD_nextSrcSizeToDecompress() tells how many bytes to provide as 'srcSize' to ZSTD_decompressContinue().\nZSTD_decompressContinue() requires this _exact_ amount of bytes, or it will fail.\n\nresult of ZSTD_decompressContinue() is the number of bytes regenerated within 'dst' (necessarily <= dstCapacity).\nIt can be zero : it just means ZSTD_decompressContinue() has decoded some metadata item.\nIt can also be an error code, which can be tested with ZSTD_isError().\n\nA frame is fully decoded when ZSTD_nextSrcSizeToDecompress() returns zero.\nBefore decoding another frame, call the appropriate ZSTD_decompressBegin*() function again.\n\nNote : it's possible to know if next input to present is a header or a block, using ZSTD_nextInputType().\nThis information is not required to properly decode a frame.\n\n== Special case : skippable frames ==\n\nSkippable frames allow integration of user-defined data into a flow of concatenated frames.\nSkippable frames will be ignored (skipped) by decompressor.\nThe format of skippable frames is as follows :\na) Skippable frame ID - 4 Bytes, Little endian format, any value from 0x184D2A50 to 0x184D2A5F\nb) Frame Size - 4 Bytes, Little endian format, unsigned 32-bits\nc) Frame Content - any content (User Data) of length equal to Frame Size\nFor skippable frames ZSTD_getFrameHeader() returns zfhPtr->frameType==ZSTD_skippableFrame.\nFor skippable frames ZSTD_decompressContinue() always returns 0 : it only skips the content."]
1546    pub fn ZSTD_decodingBufferSize_min(
1547        windowSize: ::core::ffi::c_ulonglong,
1548        frameContentSize: ::core::ffi::c_ulonglong,
1549    ) -> usize;
1550}
1551extern "C" {
1552    #[doc = " ZSTD_decompressBegin() :\n  Initialize the bufferless decoder to start a new frame without a dictionary.\n  Decompression parameters must be configured before calling this function.\n  Call this function, ZSTD_decompressBegin_usingDict(), or ZSTD_decompressBegin_usingDDict()\n  before the first ZSTD_decompressContinue() call for each frame, including after ZSTD_DCtx_reset().\n  Use the dictionary-taking variants when the frame requires a dictionary."]
1553    pub fn ZSTD_decompressBegin(dctx: *mut ZSTD_DCtx) -> usize;
1554}
1555extern "C" {
1556    pub fn ZSTD_decompressBegin_usingDict(
1557        dctx: *mut ZSTD_DCtx,
1558        dict: *const ::core::ffi::c_void,
1559        dictSize: usize,
1560    ) -> usize;
1561}
1562extern "C" {
1563    pub fn ZSTD_decompressBegin_usingDDict(
1564        dctx: *mut ZSTD_DCtx,
1565        ddict: *const ZSTD_DDict,
1566    ) -> usize;
1567}
1568extern "C" {
1569    pub fn ZSTD_nextSrcSizeToDecompress(dctx: *mut ZSTD_DCtx) -> usize;
1570}
1571extern "C" {
1572    #[doc = " ZSTD_decompressContinue() :\n  Decode the next part of a frame initialized with ZSTD_decompressBegin()\n  or one of its dictionary-taking variants. This function does not initialize the decoder.\n  After finishing a frame or resetting the session, initialize the decoder again\n  before calling this function for a new frame."]
1573    pub fn ZSTD_decompressContinue(
1574        dctx: *mut ZSTD_DCtx,
1575        dst: *mut ::core::ffi::c_void,
1576        dstCapacity: usize,
1577        src: *const ::core::ffi::c_void,
1578        srcSize: usize,
1579    ) -> usize;
1580}
1581#[repr(u32)]
1582#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1583pub enum ZSTD_nextInputType_e {
1584    ZSTDnit_frameHeader = 0,
1585    ZSTDnit_blockHeader = 1,
1586    ZSTDnit_block = 2,
1587    ZSTDnit_lastBlock = 3,
1588    ZSTDnit_checksum = 4,
1589    ZSTDnit_skippableFrame = 5,
1590}
1591extern "C" {
1592    pub fn ZSTD_nextInputType(dctx: *mut ZSTD_DCtx) -> ZSTD_nextInputType_e;
1593}
1594extern "C" {
1595    #[doc = " ZSTD_isDeterministicBuild() :\n Returns 1 if the library is built using standard compilation flags,\n and participates in determinism guarantees with other builds of the\n same version.\n If this function returns 0, it means the library was compiled with\n non-standard compilation flags that change the output of the\n compressor.\n This is mainly used for Zstd's determinism test suite, which is only\n run when this function returns 1."]
1596    pub fn ZSTD_isDeterministicBuild() -> ::core::ffi::c_int;
1597}
1598extern "C" {
1599    #[doc = "This API is deprecated in favor of the regular compression API.\nYou can get the frame header down to 2 bytes by setting:\n- ZSTD_c_format = ZSTD_f_zstd1_magicless\n- ZSTD_c_contentSizeFlag = 0\n- ZSTD_c_checksumFlag = 0\n- ZSTD_c_dictIDFlag = 0\n\nThis API is not as well tested as our normal API, so we recommend not using it.\nWe will be removing it in a future version. If the normal API doesn't provide\nthe functionality you need, please open a GitHub issue.\n\nBlock functions produce and decode raw zstd blocks, without frame metadata.\nFrame metadata cost is typically ~12 bytes, which can be non-negligible for very small blocks (< 100 bytes).\nBut users will have to take in charge needed metadata to regenerate data, such as compressed and content sizes.\n\nA few rules to respect :\n- Compressing and decompressing require a context structure\n+ Use ZSTD_createCCtx() and ZSTD_createDCtx()\n- It is necessary to init context before starting\n+ compression : any ZSTD_compressBegin*() variant, including with dictionary\n+ decompression : any ZSTD_decompressBegin*() variant, including with dictionary\n- Block size is limited, it must be <= ZSTD_getBlockSize() <= ZSTD_BLOCKSIZE_MAX == 128 KB\n+ If input is larger than a block size, it's necessary to split input data into multiple blocks\n+ For inputs larger than a single block, consider using regular ZSTD_compress() instead.\nFrame metadata is not that costly, and quickly becomes negligible as source size grows larger than a block.\n- When a block is considered not compressible enough, ZSTD_compressBlock() result will be 0 (zero) !\n===> In which case, nothing is produced into `dst` !\n+ User __must__ test for such outcome and deal directly with uncompressed data\n+ A block cannot be declared incompressible if ZSTD_compressBlock() return value was != 0.\nDoing so would mess up with statistics history, leading to potential data corruption.\n+ ZSTD_decompressBlock() _doesn't accept uncompressed data as input_ !!\n+ In case of multiple successive blocks, should some of them be uncompressed,\ndecoder must be informed of their existence in order to follow proper history.\nUse ZSTD_insertBlock() for such a case."]
1600    pub fn ZSTD_getBlockSize(cctx: *const ZSTD_CCtx) -> usize;
1601}
1602extern "C" {
1603    pub fn ZSTD_compressBlock(
1604        cctx: *mut ZSTD_CCtx,
1605        dst: *mut ::core::ffi::c_void,
1606        dstCapacity: usize,
1607        src: *const ::core::ffi::c_void,
1608        srcSize: usize,
1609    ) -> usize;
1610}
1611extern "C" {
1612    pub fn ZSTD_decompressBlock(
1613        dctx: *mut ZSTD_DCtx,
1614        dst: *mut ::core::ffi::c_void,
1615        dstCapacity: usize,
1616        src: *const ::core::ffi::c_void,
1617        srcSize: usize,
1618    ) -> usize;
1619}
1620extern "C" {
1621    pub fn ZSTD_insertBlock(
1622        dctx: *mut ZSTD_DCtx,
1623        blockStart: *const ::core::ffi::c_void,
1624        blockSize: usize,
1625    ) -> usize;
1626}