ReactOS  0.4.14-dev-552-g2fad488
zstd.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under both the BSD-style license (found in the
6  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7  * in the COPYING file in the root directory of this source tree).
8  * You may select, at your option, one of the above-listed licenses.
9  */
10 #if defined (__cplusplus)
11 extern "C" {
12 #endif
13 
14 #ifndef ZSTD_H_235446
15 #define ZSTD_H_235446
16 
17 /* ====== Dependency ======*/
18 #include <stddef.h> /* size_t */
19 
20 
21 /* ===== ZSTDLIB_API : control library symbols visibility ===== */
22 #ifndef ZSTDLIB_VISIBILITY
23 # if defined(__GNUC__) && (__GNUC__ >= 4)
24 # define ZSTDLIB_VISIBILITY __attribute__ ((visibility ("default")))
25 # else
26 # define ZSTDLIB_VISIBILITY
27 # endif
28 #endif
29 #if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1)
30 # define ZSTDLIB_API __declspec(dllexport) ZSTDLIB_VISIBILITY
31 #elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1)
32 # define ZSTDLIB_API __declspec(dllimport) ZSTDLIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
33 #else
34 # define ZSTDLIB_API ZSTDLIB_VISIBILITY
35 #endif
36 
37 
38 /*******************************************************************************
39  Introduction
40 
41  zstd, short for Zstandard, is a fast lossless compression algorithm, targeting
42  real-time compression scenarios at zlib-level and better compression ratios.
43  The zstd compression library provides in-memory compression and decompression
44  functions.
45 
46  The library supports regular compression levels from 1 up to ZSTD_maxCLevel(),
47  which is currently 22. Levels >= 20, labeled `--ultra`, should be used with
48  caution, as they require more memory. The library also offers negative
49  compression levels, which extend the range of speed vs. ratio preferences.
50  The lower the level, the faster the speed (at the cost of compression).
51 
52  Compression can be done in:
53  - a single step (described as Simple API)
54  - a single step, reusing a context (described as Explicit context)
55  - unbounded multiple steps (described as Streaming compression)
56 
57  The compression ratio achievable on small data can be highly improved using
58  a dictionary. Dictionary compression can be performed in:
59  - a single step (described as Simple dictionary API)
60  - a single step, reusing a dictionary (described as Bulk-processing
61  dictionary API)
62 
63  Advanced experimental functions can be accessed using
64  `#define ZSTD_STATIC_LINKING_ONLY` before including zstd.h.
65 
66  Advanced experimental APIs should never be used with a dynamically-linked
67  library. They are not "stable"; their definitions or signatures may change in
68  the future. Only static linking is allowed.
69 *******************************************************************************/
70 
71 /*------ Version ------*/
72 #define ZSTD_VERSION_MAJOR 1
73 #define ZSTD_VERSION_MINOR 3
74 #define ZSTD_VERSION_RELEASE 7
75 
76 #define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
77 ZSTDLIB_API unsigned ZSTD_versionNumber(void);
79 #define ZSTD_LIB_VERSION ZSTD_VERSION_MAJOR.ZSTD_VERSION_MINOR.ZSTD_VERSION_RELEASE
80 #define ZSTD_QUOTE(str) #str
81 #define ZSTD_EXPAND_AND_QUOTE(str) ZSTD_QUOTE(str)
82 #define ZSTD_VERSION_STRING ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION)
83 ZSTDLIB_API const char* ZSTD_versionString(void); /* v1.3.0+ */
84 
85 /***************************************
86 * Default constant
87 ***************************************/
88 #ifndef ZSTD_CLEVEL_DEFAULT
89 # define ZSTD_CLEVEL_DEFAULT 3
90 #endif
91 
92 /***************************************
93 * Simple API
94 ***************************************/
100 ZSTDLIB_API size_t ZSTD_compress( void* dst, size_t dstCapacity,
101  const void* src, size_t srcSize,
102  int compressionLevel);
103 
110 ZSTDLIB_API size_t ZSTD_decompress( void* dst, size_t dstCapacity,
111  const void* src, size_t compressedSize);
112 
136 #define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1)
137 #define ZSTD_CONTENTSIZE_ERROR (0ULL - 2)
138 ZSTDLIB_API unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize);
139 
146 ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize);
147 
148 
149 /*====== Helper functions ======*/
150 #define ZSTD_COMPRESSBOUND(srcSize) ((srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0)) /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */
151 ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize);
152 ZSTDLIB_API unsigned ZSTD_isError(size_t code);
153 ZSTDLIB_API const char* ZSTD_getErrorName(size_t code);
154 ZSTDLIB_API int ZSTD_maxCLevel(void);
157 /***************************************
158 * Explicit context
159 ***************************************/
160 /*= Compression context
161  * When compressing many times,
162  * it is recommended to allocate a context just once, and re-use it for each successive compression operation.
163  * This will make workload friendlier for system's memory.
164  * Use one context per thread for parallel execution in multi-threaded environments. */
165 typedef struct ZSTD_CCtx_s ZSTD_CCtx;
167 ZSTDLIB_API size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx);
168 
172  void* dst, size_t dstCapacity,
173  const void* src, size_t srcSize,
174  int compressionLevel);
175 
176 /*= Decompression context
177  * When decompressing many times,
178  * it is recommended to allocate a context only once,
179  * and re-use it for each successive compression operation.
180  * This will make workload friendlier for system's memory.
181  * Use one context per thread for parallel execution. */
182 typedef struct ZSTD_DCtx_s ZSTD_DCtx;
184 ZSTDLIB_API size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx);
185 
189  void* dst, size_t dstCapacity,
190  const void* src, size_t srcSize);
191 
192 
193 /**************************
194 * Simple dictionary API
195 ***************************/
201  void* dst, size_t dstCapacity,
202  const void* src, size_t srcSize,
203  const void* dict,size_t dictSize,
204  int compressionLevel);
205 
212  void* dst, size_t dstCapacity,
213  const void* src, size_t srcSize,
214  const void* dict,size_t dictSize);
215 
216 
217 /**********************************
218  * Bulk processing dictionary API
219  *********************************/
220 typedef struct ZSTD_CDict_s ZSTD_CDict;
221 
228 ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict(const void* dictBuffer, size_t dictSize,
229  int compressionLevel);
230 
233 ZSTDLIB_API size_t ZSTD_freeCDict(ZSTD_CDict* CDict);
234 
243  void* dst, size_t dstCapacity,
244  const void* src, size_t srcSize,
245  const ZSTD_CDict* cdict);
246 
247 
248 typedef struct ZSTD_DDict_s ZSTD_DDict;
249 
254 
257 ZSTDLIB_API size_t ZSTD_freeDDict(ZSTD_DDict* ddict);
258 
263  void* dst, size_t dstCapacity,
264  const void* src, size_t srcSize,
265  const ZSTD_DDict* ddict);
266 
267 
268 /****************************
269 * Streaming
270 ****************************/
271 
272 typedef struct ZSTD_inBuffer_s {
273  const void* src;
274  size_t size;
275  size_t pos;
276 } ZSTD_inBuffer;
277 
278 typedef struct ZSTD_outBuffer_s {
279  void* dst;
280  size_t size;
281  size_t pos;
283 
284 
285 
286 /*-***********************************************************************
287 * Streaming compression - HowTo
288 *
289 * A ZSTD_CStream object is required to track streaming operation.
290 * Use ZSTD_createCStream() and ZSTD_freeCStream() to create/release resources.
291 * ZSTD_CStream objects can be reused multiple times on consecutive compression operations.
292 * It is recommended to re-use ZSTD_CStream in situations where many streaming operations will be achieved consecutively,
293 * since it will play nicer with system's memory, by re-using already allocated memory.
294 * Use one separate ZSTD_CStream per thread for parallel execution.
295 *
296 * Start a new compression by initializing ZSTD_CStream context.
297 * Use ZSTD_initCStream() to start a new compression operation.
298 * Use variants ZSTD_initCStream_usingDict() or ZSTD_initCStream_usingCDict() for streaming with dictionary (experimental section)
299 *
300 * Use ZSTD_compressStream() as many times as necessary to consume input stream.
301 * The function will automatically update both `pos` fields within `input` and `output`.
302 * Note that the function may not consume the entire input,
303 * for example, because the output buffer is already full,
304 * in which case `input.pos < input.size`.
305 * The caller must check if input has been entirely consumed.
306 * If not, the caller must make some room to receive more compressed data,
307 * typically by emptying output buffer, or allocating a new output buffer,
308 * and then present again remaining input data.
309 * @return : a size hint, preferred nb of bytes to use as input for next function call
310 * or an error code, which can be tested using ZSTD_isError().
311 * Note 1 : it's just a hint, to help latency a little, any other value will work fine.
312 * Note 2 : size hint is guaranteed to be <= ZSTD_CStreamInSize()
313 *
314 * At any moment, it's possible to flush whatever data might remain stuck within internal buffer,
315 * using ZSTD_flushStream(). `output->pos` will be updated.
316 * Note that, if `output->size` is too small, a single invocation of ZSTD_flushStream() might not be enough (return code > 0).
317 * In which case, make some room to receive more compressed data, and call again ZSTD_flushStream().
318 * @return : 0 if internal buffers are entirely flushed,
319 * >0 if some data still present within internal buffer (the value is minimal estimation of remaining size),
320 * or an error code, which can be tested using ZSTD_isError().
321 *
322 * ZSTD_endStream() instructs to finish a frame.
323 * It will perform a flush and write frame epilogue.
324 * The epilogue is required for decoders to consider a frame completed.
325 * flush() operation is the same, and follows same rules as ZSTD_flushStream().
326 * @return : 0 if frame fully completed and fully flushed,
327 * >0 if some data still present within internal buffer (the value is minimal estimation of remaining size),
328 * or an error code, which can be tested using ZSTD_isError().
329 *
330 * *******************************************************************/
331 
333  /* Continue to distinguish them for compatibility with older versions <= v1.2.0 */
334 /*===== ZSTD_CStream management functions =====*/
337 
338 /*===== Streaming compression functions =====*/
339 ZSTDLIB_API size_t ZSTD_initCStream(ZSTD_CStream* zcs, int compressionLevel);
343 
344 ZSTDLIB_API size_t ZSTD_CStreamInSize(void);
345 ZSTDLIB_API size_t ZSTD_CStreamOutSize(void);
349 /*-***************************************************************************
350 * Streaming decompression - HowTo
351 *
352 * A ZSTD_DStream object is required to track streaming operations.
353 * Use ZSTD_createDStream() and ZSTD_freeDStream() to create/release resources.
354 * ZSTD_DStream objects can be re-used multiple times.
355 *
356 * Use ZSTD_initDStream() to start a new decompression operation,
357 * or ZSTD_initDStream_usingDict() if decompression requires a dictionary.
358 * @return : recommended first input size
359 *
360 * Use ZSTD_decompressStream() repetitively to consume your input.
361 * The function will update both `pos` fields.
362 * If `input.pos < input.size`, some input has not been consumed.
363 * It's up to the caller to present again remaining data.
364 * The function tries to flush all data decoded immediately, repecting buffer sizes.
365 * If `output.pos < output.size`, decoder has flushed everything it could.
366 * But if `output.pos == output.size`, there is no such guarantee,
367 * it's likely that some decoded data was not flushed and still remains within internal buffers.
368 * In which case, call ZSTD_decompressStream() again to flush whatever remains in the buffer.
369 * When no additional input is provided, amount of data flushed is necessarily <= ZSTD_BLOCKSIZE_MAX.
370 * @return : 0 when a frame is completely decoded and fully flushed,
371 * or an error code, which can be tested using ZSTD_isError(),
372 * or any other value > 0, which means there is still some decoding or flushing to do to complete current frame :
373 * the return value is a suggested next input size (a hint for better latency)
374 * that will never load more than the current frame.
375 * *******************************************************************************/
376 
378  /* For compatibility with versions <= v1.2.0, prefer differentiating them. */
379 /*===== ZSTD_DStream management functions =====*/
382 
383 /*===== Streaming decompression functions =====*/
386 
387 ZSTDLIB_API size_t ZSTD_DStreamInSize(void);
388 ZSTDLIB_API size_t ZSTD_DStreamOutSize(void);
390 #endif /* ZSTD_H_235446 */
391 
392 
393 
394 
395 #if defined(ZSTD_STATIC_LINKING_ONLY) && !defined(ZSTD_H_ZSTD_STATIC_LINKING_ONLY)
396 #define ZSTD_H_ZSTD_STATIC_LINKING_ONLY
397 
398 /****************************************************************************************
399  * ADVANCED AND EXPERIMENTAL FUNCTIONS
400  ****************************************************************************************
401  * The definitions in this section are considered experimental.
402  * They should never be used with a dynamic library, as prototypes may change in the future.
403  * They are provided for advanced scenarios.
404  * Use them only in association with static linking.
405  * ***************************************************************************************/
406 
407 ZSTDLIB_API int ZSTD_minCLevel(void);
409 /* --- Constants ---*/
410 #define ZSTD_MAGICNUMBER 0xFD2FB528 /* v0.8+ */
411 #define ZSTD_MAGIC_DICTIONARY 0xEC30A437 /* v0.7+ */
412 #define ZSTD_MAGIC_SKIPPABLE_START 0x184D2A50U
413 
414 #define ZSTD_BLOCKSIZELOG_MAX 17
415 #define ZSTD_BLOCKSIZE_MAX (1<<ZSTD_BLOCKSIZELOG_MAX) /* define, for static allocation */
416 
417 #define ZSTD_WINDOWLOG_MAX_32 30
418 #define ZSTD_WINDOWLOG_MAX_64 31
419 #define ZSTD_WINDOWLOG_MAX ((unsigned)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
420 #define ZSTD_WINDOWLOG_MIN 10
421 #define ZSTD_HASHLOG_MAX ((ZSTD_WINDOWLOG_MAX < 30) ? ZSTD_WINDOWLOG_MAX : 30)
422 #define ZSTD_HASHLOG_MIN 6
423 #define ZSTD_CHAINLOG_MAX_32 29
424 #define ZSTD_CHAINLOG_MAX_64 30
425 #define ZSTD_CHAINLOG_MAX ((unsigned)(sizeof(size_t) == 4 ? ZSTD_CHAINLOG_MAX_32 : ZSTD_CHAINLOG_MAX_64))
426 #define ZSTD_CHAINLOG_MIN ZSTD_HASHLOG_MIN
427 #define ZSTD_HASHLOG3_MAX 17
428 #define ZSTD_SEARCHLOG_MAX (ZSTD_WINDOWLOG_MAX-1)
429 #define ZSTD_SEARCHLOG_MIN 1
430 #define ZSTD_SEARCHLENGTH_MAX 7 /* only for ZSTD_fast, other strategies are limited to 6 */
431 #define ZSTD_SEARCHLENGTH_MIN 3 /* only for ZSTD_btopt, other strategies are limited to 4 */
432 #define ZSTD_TARGETLENGTH_MAX ZSTD_BLOCKSIZE_MAX
433 #define ZSTD_TARGETLENGTH_MIN 0 /* note : comparing this constant to an unsigned results in a tautological test */
434 #define ZSTD_LDM_MINMATCH_MAX 4096
435 #define ZSTD_LDM_MINMATCH_MIN 4
436 #define ZSTD_LDM_BUCKETSIZELOG_MAX 8
437 
438 #define ZSTD_FRAMEHEADERSIZE_PREFIX 5 /* minimum input size to know frame header size */
439 #define ZSTD_FRAMEHEADERSIZE_MIN 6
440 #define ZSTD_FRAMEHEADERSIZE_MAX 18 /* for static allocation */
441 static const size_t ZSTD_frameHeaderSize_prefix = ZSTD_FRAMEHEADERSIZE_PREFIX;
442 static const size_t ZSTD_frameHeaderSize_min = ZSTD_FRAMEHEADERSIZE_MIN;
443 static const size_t ZSTD_frameHeaderSize_max = ZSTD_FRAMEHEADERSIZE_MAX;
444 static const size_t ZSTD_skippableHeaderSize = 8; /* magic number + skippable frame length */
445 
446 
447 
448 /* --- Advanced types --- */
449 typedef enum { ZSTD_fast=1, ZSTD_dfast, ZSTD_greedy, ZSTD_lazy, ZSTD_lazy2,
450  ZSTD_btlazy2, ZSTD_btopt, ZSTD_btultra } ZSTD_strategy; /* from faster to stronger */
451 
452 typedef struct {
453  unsigned windowLog;
454  unsigned chainLog;
455  unsigned hashLog;
456  unsigned searchLog;
457  unsigned searchLength;
458  unsigned targetLength;
459  ZSTD_strategy strategy;
460 } ZSTD_compressionParameters;
461 
462 typedef struct {
463  unsigned contentSizeFlag;
464  unsigned checksumFlag;
465  unsigned noDictIDFlag;
466 } ZSTD_frameParameters;
467 
468 typedef struct {
469  ZSTD_compressionParameters cParams;
470  ZSTD_frameParameters fParams;
471 } ZSTD_parameters;
472 
473 typedef struct ZSTD_CCtx_params_s ZSTD_CCtx_params;
474 
475 typedef enum {
476  ZSTD_dct_auto=0, /* dictionary is "full" when starting with ZSTD_MAGIC_DICTIONARY, otherwise it is "rawContent" */
477  ZSTD_dct_rawContent, /* ensures dictionary is always loaded as rawContent, even if it starts with ZSTD_MAGIC_DICTIONARY */
478  ZSTD_dct_fullDict /* refuses to load a dictionary if it does not respect Zstandard's specification */
479 } ZSTD_dictContentType_e;
480 
481 typedef enum {
482  ZSTD_dlm_byCopy = 0,
483  ZSTD_dlm_byRef,
484 } ZSTD_dictLoadMethod_e;
485 
486 
487 
488 /***************************************
489 * Frame size functions
490 ***************************************/
491 
498 ZSTDLIB_API size_t ZSTD_findFrameCompressedSize(const void* src, size_t srcSize);
499 
521 ZSTDLIB_API unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize);
522 
527 ZSTDLIB_API size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize);
528 
529 
530 /***************************************
531 * Memory management
532 ***************************************/
533 
537 ZSTDLIB_API size_t ZSTD_sizeof_CCtx(const ZSTD_CCtx* cctx);
538 ZSTDLIB_API size_t ZSTD_sizeof_DCtx(const ZSTD_DCtx* dctx);
539 ZSTDLIB_API size_t ZSTD_sizeof_CStream(const ZSTD_CStream* zcs);
540 ZSTDLIB_API size_t ZSTD_sizeof_DStream(const ZSTD_DStream* zds);
541 ZSTDLIB_API size_t ZSTD_sizeof_CDict(const ZSTD_CDict* cdict);
542 ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
543 
554 ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
555 ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params);
557 
572 ZSTDLIB_API size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams);
573 ZSTDLIB_API size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params);
574 ZSTDLIB_API size_t ZSTD_estimateDStreamSize(size_t windowSize);
575 ZSTDLIB_API size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize);
576 
582 ZSTDLIB_API size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel);
583 ZSTDLIB_API size_t ZSTD_estimateCDictSize_advanced(size_t dictSize, ZSTD_compressionParameters cParams, ZSTD_dictLoadMethod_e dictLoadMethod);
584 ZSTDLIB_API size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod);
585 
607 ZSTDLIB_API ZSTD_CCtx* ZSTD_initStaticCCtx(void* workspace, size_t workspaceSize);
608 ZSTDLIB_API ZSTD_CStream* ZSTD_initStaticCStream(void* workspace, size_t workspaceSize);
610 ZSTDLIB_API ZSTD_DCtx* ZSTD_initStaticDCtx(void* workspace, size_t workspaceSize);
611 ZSTDLIB_API ZSTD_DStream* ZSTD_initStaticDStream(void* workspace, size_t workspaceSize);
614  void* workspace, size_t workspaceSize,
615  const void* dict, size_t dictSize,
616  ZSTD_dictLoadMethod_e dictLoadMethod,
617  ZSTD_dictContentType_e dictContentType,
618  ZSTD_compressionParameters cParams);
619 
621  void* workspace, size_t workspaceSize,
622  const void* dict, size_t dictSize,
623  ZSTD_dictLoadMethod_e dictLoadMethod,
624  ZSTD_dictContentType_e dictContentType);
625 
631 typedef void* (*ZSTD_allocFunction) (void* opaque, size_t size);
632 typedef void (*ZSTD_freeFunction) (void* opaque, void* address);
633 typedef struct { ZSTD_allocFunction customAlloc; ZSTD_freeFunction customFree; void* opaque; } ZSTD_customMem;
634 static ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL };
636 ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem);
637 ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream_advanced(ZSTD_customMem customMem);
638 ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem);
639 ZSTDLIB_API ZSTD_DStream* ZSTD_createDStream_advanced(ZSTD_customMem customMem);
640 
641 ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict_advanced(const void* dict, size_t dictSize,
642  ZSTD_dictLoadMethod_e dictLoadMethod,
643  ZSTD_dictContentType_e dictContentType,
644  ZSTD_compressionParameters cParams,
645  ZSTD_customMem customMem);
646 
647 ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize,
648  ZSTD_dictLoadMethod_e dictLoadMethod,
649  ZSTD_dictContentType_e dictContentType,
650  ZSTD_customMem customMem);
651 
652 
653 
654 /***************************************
655 * Advanced compression functions
656 ***************************************/
657 
662 ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict_byReference(const void* dictBuffer, size_t dictSize, int compressionLevel);
663 
667 ZSTDLIB_API ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
668 
672 ZSTDLIB_API ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
673 
676 ZSTDLIB_API size_t ZSTD_checkCParams(ZSTD_compressionParameters params);
677 
681 ZSTDLIB_API ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, unsigned long long srcSize, size_t dictSize);
682 
686  void* dst, size_t dstCapacity,
687  const void* src, size_t srcSize,
688  const void* dict,size_t dictSize,
689  ZSTD_parameters params);
690 
694  void* dst, size_t dstCapacity,
695  const void* src, size_t srcSize,
696  const ZSTD_CDict* cdict, ZSTD_frameParameters fParams);
697 
698 
699 /*--- Advanced decompression functions ---*/
700 
706 ZSTDLIB_API unsigned ZSTD_isFrame(const void* buffer, size_t size);
707 
713 ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize);
714 
715 
720 ZSTDLIB_API unsigned ZSTD_getDictID_fromDict(const void* dict, size_t dictSize);
721 
726 ZSTDLIB_API unsigned ZSTD_getDictID_fromDDict(const ZSTD_DDict* ddict);
727 
738 ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize);
739 
740 
741 /********************************************************************
742 * Advanced streaming functions
743 ********************************************************************/
744 
745 /*===== Advanced Streaming compression functions =====*/
746 ZSTDLIB_API size_t ZSTD_initCStream_srcSize(ZSTD_CStream* zcs, int compressionLevel, unsigned long long pledgedSrcSize);
747 ZSTDLIB_API size_t ZSTD_initCStream_usingDict(ZSTD_CStream* zcs, const void* dict, size_t dictSize, int compressionLevel);
748 ZSTDLIB_API size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs, const void* dict, size_t dictSize,
749  ZSTD_parameters params, unsigned long long pledgedSrcSize);
751 ZSTDLIB_API size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs, const ZSTD_CDict* cdict, ZSTD_frameParameters fParams, unsigned long long pledgedSrcSize);
763 ZSTDLIB_API size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize);
764 
765 
766 typedef struct {
767  unsigned long long ingested; /* nb input bytes read and buffered */
768  unsigned long long consumed; /* nb input bytes actually compressed */
769  unsigned long long produced; /* nb of compressed bytes generated and buffered */
770  unsigned long long flushed; /* nb of compressed bytes flushed : not provided; can be tracked from caller side */
771  unsigned currentJobID; /* MT only : latest started job nb */
772  unsigned nbActiveWorkers; /* MT only : nb of workers actively compressing at probe time */
773 } ZSTD_frameProgression;
774 
775 /* ZSTD_getFrameProgression() :
776  * tells how much data has been ingested (read from input)
777  * consumed (input actually compressed) and produced (output) for current frame.
778  * Note : (ingested - consumed) is amount of input data buffered internally, not yet compressed.
779  * Aggregates progression inside active worker threads.
780  */
781 ZSTDLIB_API ZSTD_frameProgression ZSTD_getFrameProgression(const ZSTD_CCtx* cctx);
782 
797 
798 
799 
800 /*===== Advanced Streaming decompression functions =====*/
801 typedef enum { DStream_p_maxWindowSize } ZSTD_DStreamParameter_e;
802 ZSTDLIB_API size_t ZSTD_setDStreamParameter(ZSTD_DStream* zds, ZSTD_DStreamParameter_e paramType, unsigned paramValue); /* obsolete : this API will be removed in a future version */
803 ZSTDLIB_API size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize);
808 /*********************************************************************
809 * Buffer-less and synchronous inner streaming functions
810 *
811 * This is an advanced API, giving full control over buffer management, for users which need direct control over memory.
812 * But it's also a complex one, with several restrictions, documented below.
813 * Prefer normal streaming API for an easier experience.
814 ********************************************************************* */
815 
847 /*===== Buffer-less streaming compression functions =====*/
848 ZSTDLIB_API size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, int compressionLevel);
849 ZSTDLIB_API size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel);
850 ZSTDLIB_API size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_parameters params, unsigned long long pledgedSrcSize);
852 ZSTDLIB_API size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx* const cctx, const ZSTD_CDict* const cdict, ZSTD_frameParameters const fParams, unsigned long long const pledgedSrcSize); /* compression parameters are already set within cdict. pledgedSrcSize must be correct. If srcSize is not known, use macro ZSTD_CONTENTSIZE_UNKNOWN */
853 ZSTDLIB_API size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned long long pledgedSrcSize);
855 ZSTDLIB_API size_t ZSTD_compressContinue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
856 ZSTDLIB_API size_t ZSTD_compressEnd(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
857 
858 
859 /*-
860  Buffer-less streaming decompression (synchronous mode)
861 
862  A ZSTD_DCtx object is required to track streaming operations.
863  Use ZSTD_createDCtx() / ZSTD_freeDCtx() to manage it.
864  A ZSTD_DCtx object can be re-used multiple times.
865 
866  First typical operation is to retrieve frame parameters, using ZSTD_getFrameHeader().
867  Frame header is extracted from the beginning of compressed frame, so providing only the frame's beginning is enough.
868  Data fragment must be large enough to ensure successful decoding.
869  `ZSTD_frameHeaderSize_max` bytes is guaranteed to always be large enough.
870  @result : 0 : successful decoding, the `ZSTD_frameHeader` structure is correctly filled.
871  >0 : `srcSize` is too small, please provide at least @result bytes on next attempt.
872  errorCode, which can be tested using ZSTD_isError().
873 
874  It fills a ZSTD_frameHeader structure with important information to correctly decode the frame,
875  such as the dictionary ID, content size, or maximum back-reference distance (`windowSize`).
876  Note that these values could be wrong, either because of data corruption, or because a 3rd party deliberately spoofs false information.
877  As a consequence, check that values remain within valid application range.
878  For example, do not allocate memory blindly, check that `windowSize` is within expectation.
879  Each application can set its own limits, depending on local restrictions.
880  For extended interoperability, it is recommended to support `windowSize` of at least 8 MB.
881 
882  ZSTD_decompressContinue() needs previous data blocks during decompression, up to `windowSize` bytes.
883  ZSTD_decompressContinue() is very sensitive to contiguity,
884  if 2 blocks don't follow each other, make sure that either the compressor breaks contiguity at the same place,
885  or that previous contiguous segment is large enough to properly handle maximum back-reference distance.
886  There are multiple ways to guarantee this condition.
887 
888  The most memory efficient way is to use a round buffer of sufficient size.
889  Sufficient size is determined by invoking ZSTD_decodingBufferSize_min(),
890  which can @return an error code if required value is too large for current system (in 32-bits mode).
891  In a round buffer methodology, ZSTD_decompressContinue() decompresses each block next to previous one,
892  up to the moment there is not enough room left in the buffer to guarantee decoding another full block,
893  which maximum size is provided in `ZSTD_frameHeader` structure, field `blockSizeMax`.
894  At which point, decoding can resume from the beginning of the buffer.
895  Note that already decoded data stored in the buffer should be flushed before being overwritten.
896 
897  There are alternatives possible, for example using two or more buffers of size `windowSize` each, though they consume more memory.
898 
899  Finally, if you control the compression process, you can also ignore all buffer size rules,
900  as long as the encoder and decoder progress in "lock-step",
901  aka use exactly the same buffer sizes, break contiguity at the same place, etc.
902 
903  Once buffers are setup, start decompression, with ZSTD_decompressBegin().
904  If decompression requires a dictionary, use ZSTD_decompressBegin_usingDict() or ZSTD_decompressBegin_usingDDict().
905 
906  Then use ZSTD_nextSrcSizeToDecompress() and ZSTD_decompressContinue() alternatively.
907  ZSTD_nextSrcSizeToDecompress() tells how many bytes to provide as 'srcSize' to ZSTD_decompressContinue().
908  ZSTD_decompressContinue() requires this _exact_ amount of bytes, or it will fail.
909 
910  @result of ZSTD_decompressContinue() is the number of bytes regenerated within 'dst' (necessarily <= dstCapacity).
911  It can be zero : it just means ZSTD_decompressContinue() has decoded some metadata item.
912  It can also be an error code, which can be tested with ZSTD_isError().
913 
914  A frame is fully decoded when ZSTD_nextSrcSizeToDecompress() returns zero.
915  Context can then be reset to start a new decompression.
916 
917  Note : it's possible to know if next input to present is a header or a block, using ZSTD_nextInputType().
918  This information is not required to properly decode a frame.
919 
920  == Special case : skippable frames ==
921 
922  Skippable frames allow integration of user-defined data into a flow of concatenated frames.
923  Skippable frames will be ignored (skipped) by decompressor.
924  The format of skippable frames is as follows :
925  a) Skippable frame ID - 4 Bytes, Little endian format, any value from 0x184D2A50 to 0x184D2A5F
926  b) Frame Size - 4 Bytes, Little endian format, unsigned 32-bits
927  c) Frame Content - any content (User Data) of length equal to Frame Size
928  For skippable frames ZSTD_getFrameHeader() returns zfhPtr->frameType==ZSTD_skippableFrame.
929  For skippable frames ZSTD_decompressContinue() always returns 0 : it only skips the content.
930 */
931 
932 /*===== Buffer-less streaming decompression functions =====*/
933 typedef enum { ZSTD_frame, ZSTD_skippableFrame } ZSTD_frameType_e;
934 typedef struct {
935  unsigned long long frameContentSize; /* if == ZSTD_CONTENTSIZE_UNKNOWN, it means this field is not available. 0 means "empty" */
936  unsigned long long windowSize; /* can be very large, up to <= frameContentSize */
937  unsigned blockSizeMax;
938  ZSTD_frameType_e frameType; /* if == ZSTD_skippableFrame, frameContentSize is the size of skippable content */
939  unsigned headerSize;
940  unsigned dictID;
941  unsigned checksumFlag;
942 } ZSTD_frameHeader;
948 ZSTDLIB_API size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize);
949 ZSTDLIB_API size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize);
952 ZSTDLIB_API size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
954 
956 ZSTDLIB_API size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
957 
958 /* misc */
959 ZSTDLIB_API void ZSTD_copyDCtx(ZSTD_DCtx* dctx, const ZSTD_DCtx* preparedDCtx);
960 typedef enum { ZSTDnit_frameHeader, ZSTDnit_blockHeader, ZSTDnit_block, ZSTDnit_lastBlock, ZSTDnit_checksum, ZSTDnit_skippableFrame } ZSTD_nextInputType_e;
961 ZSTDLIB_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx);
962 
963 
964 
965 /* ============================================ */
967 /* ============================================ */
968 
969 /* API design :
970  * In this advanced API, parameters are pushed one by one into an existing context,
971  * using ZSTD_CCtx_set*() functions.
972  * Pushed parameters are sticky : they are applied to next job, and any subsequent job.
973  * It's possible to reset parameters to "default" using ZSTD_CCtx_reset().
974  * Important : "sticky" parameters only work with `ZSTD_compress_generic()` !
975  * For any other entry point, "sticky" parameters are ignored !
976  *
977  * This API is intended to replace all others advanced / experimental API entry points.
978  */
979 
980 /* note on enum design :
981  * All enum will be pinned to explicit values before reaching "stable API" status */
982 
983 typedef enum {
984  /* Opened question : should we have a format ZSTD_f_auto ?
985  * Today, it would mean exactly the same as ZSTD_f_zstd1.
986  * But, in the future, should several formats become supported,
987  * on the compression side, it would mean "default format".
988  * On the decompression side, it would mean "automatic format detection",
989  * so that ZSTD_f_zstd1 would mean "accept *only* zstd frames".
990  * Since meaning is a little different, another option could be to define different enums for compression and decompression.
991  * This question could be kept for later, when there are actually multiple formats to support,
992  * but there is also the question of pinning enum values, and pinning value `0` is especially important */
993  ZSTD_f_zstd1 = 0, /* zstd frame format, specified in zstd_compression_format.md (default) */
994  ZSTD_f_zstd1_magicless, /* Variant of zstd frame format, without initial 4-bytes magic number.
995  * Useful to save 4 bytes per generated frame.
996  * Decoder cannot recognise automatically this format, requiring instructions. */
997 } ZSTD_format_e;
998 
999 typedef enum {
1000  /* compression format */
1001  ZSTD_p_format = 10, /* See ZSTD_format_e enum definition.
1002  * Cast selected format as unsigned for ZSTD_CCtx_setParameter() compatibility. */
1003 
1004  /* compression parameters */
1005  ZSTD_p_compressionLevel=100, /* Update all compression parameters according to pre-defined cLevel table
1006  * Default level is ZSTD_CLEVEL_DEFAULT==3.
1007  * Special: value 0 means default, which is controlled by ZSTD_CLEVEL_DEFAULT.
1008  * Note 1 : it's possible to pass a negative compression level by casting it to unsigned type.
1009  * Note 2 : setting a level sets all default values of other compression parameters.
1010  * Note 3 : setting compressionLevel automatically updates ZSTD_p_compressLiterals. */
1011  ZSTD_p_windowLog, /* Maximum allowed back-reference distance, expressed as power of 2.
1012  * Must be clamped between ZSTD_WINDOWLOG_MIN and ZSTD_WINDOWLOG_MAX.
1013  * Special: value 0 means "use default windowLog".
1014  * Note: Using a window size greater than ZSTD_MAXWINDOWSIZE_DEFAULT (default: 2^27)
1015  * requires explicitly allowing such window size during decompression stage. */
1016  ZSTD_p_hashLog, /* Size of the initial probe table, as a power of 2.
1017  * Resulting table size is (1 << (hashLog+2)).
1018  * Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX.
1019  * Larger tables improve compression ratio of strategies <= dFast,
1020  * and improve speed of strategies > dFast.
1021  * Special: value 0 means "use default hashLog". */
1022  ZSTD_p_chainLog, /* Size of the multi-probe search table, as a power of 2.
1023  * Resulting table size is (1 << (chainLog+2)).
1024  * Must be clamped between ZSTD_CHAINLOG_MIN and ZSTD_CHAINLOG_MAX.
1025  * Larger tables result in better and slower compression.
1026  * This parameter is useless when using "fast" strategy.
1027  * Note it's still useful when using "dfast" strategy,
1028  * in which case it defines a secondary probe table.
1029  * Special: value 0 means "use default chainLog". */
1030  ZSTD_p_searchLog, /* Number of search attempts, as a power of 2.
1031  * More attempts result in better and slower compression.
1032  * This parameter is useless when using "fast" and "dFast" strategies.
1033  * Special: value 0 means "use default searchLog". */
1034  ZSTD_p_minMatch, /* Minimum size of searched matches (note : repCode matches can be smaller).
1035  * Larger values make faster compression and decompression, but decrease ratio.
1036  * Must be clamped between ZSTD_SEARCHLENGTH_MIN and ZSTD_SEARCHLENGTH_MAX.
1037  * Note that currently, for all strategies < btopt, effective minimum is 4.
1038  * , for all strategies > fast, effective maximum is 6.
1039  * Special: value 0 means "use default minMatchLength". */
1040  ZSTD_p_targetLength, /* Impact of this field depends on strategy.
1041  * For strategies btopt & btultra:
1042  * Length of Match considered "good enough" to stop search.
1043  * Larger values make compression stronger, and slower.
1044  * For strategy fast:
1045  * Distance between match sampling.
1046  * Larger values make compression faster, and weaker.
1047  * Special: value 0 means "use default targetLength". */
1048  ZSTD_p_compressionStrategy, /* See ZSTD_strategy enum definition.
1049  * Cast selected strategy as unsigned for ZSTD_CCtx_setParameter() compatibility.
1050  * The higher the value of selected strategy, the more complex it is,
1051  * resulting in stronger and slower compression.
1052  * Special: value 0 means "use default strategy". */
1053 
1054  ZSTD_p_enableLongDistanceMatching=160, /* Enable long distance matching.
1055  * This parameter is designed to improve compression ratio
1056  * for large inputs, by finding large matches at long distance.
1057  * It increases memory usage and window size.
1058  * Note: enabling this parameter increases ZSTD_p_windowLog to 128 MB
1059  * except when expressly set to a different value. */
1060  ZSTD_p_ldmHashLog, /* Size of the table for long distance matching, as a power of 2.
1061  * Larger values increase memory usage and compression ratio,
1062  * but decrease compression speed.
1063  * Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX
1064  * default: windowlog - 7.
1065  * Special: value 0 means "automatically determine hashlog". */
1066  ZSTD_p_ldmMinMatch, /* Minimum match size for long distance matcher.
1067  * Larger/too small values usually decrease compression ratio.
1068  * Must be clamped between ZSTD_LDM_MINMATCH_MIN and ZSTD_LDM_MINMATCH_MAX.
1069  * Special: value 0 means "use default value" (default: 64). */
1070  ZSTD_p_ldmBucketSizeLog, /* Log size of each bucket in the LDM hash table for collision resolution.
1071  * Larger values improve collision resolution but decrease compression speed.
1072  * The maximum value is ZSTD_LDM_BUCKETSIZELOG_MAX .
1073  * Special: value 0 means "use default value" (default: 3). */
1074  ZSTD_p_ldmHashEveryLog, /* Frequency of inserting/looking up entries in the LDM hash table.
1075  * Must be clamped between 0 and (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN).
1076  * Default is MAX(0, (windowLog - ldmHashLog)), optimizing hash table usage.
1077  * Larger values improve compression speed.
1078  * Deviating far from default value will likely result in a compression ratio decrease.
1079  * Special: value 0 means "automatically determine hashEveryLog". */
1080 
1081  /* frame parameters */
1082  ZSTD_p_contentSizeFlag=200, /* Content size will be written into frame header _whenever known_ (default:1)
1083  * Content size must be known at the beginning of compression,
1084  * it is provided using ZSTD_CCtx_setPledgedSrcSize() */
1085  ZSTD_p_checksumFlag, /* A 32-bits checksum of content is written at end of frame (default:0) */
1086  ZSTD_p_dictIDFlag, /* When applicable, dictionary's ID is written into frame header (default:1) */
1087 
1088  /* multi-threading parameters */
1089  /* These parameters are only useful if multi-threading is enabled (ZSTD_MULTITHREAD).
1090  * They return an error otherwise. */
1091  ZSTD_p_nbWorkers=400, /* Select how many threads will be spawned to compress in parallel.
1092  * When nbWorkers >= 1, triggers asynchronous mode :
1093  * ZSTD_compress_generic() consumes some input, flush some output if possible, and immediately gives back control to caller,
1094  * while compression work is performed in parallel, within worker threads.
1095  * (note : a strong exception to this rule is when first invocation sets ZSTD_e_end : it becomes a blocking call).
1096  * More workers improve speed, but also increase memory usage.
1097  * Default value is `0`, aka "single-threaded mode" : no worker is spawned, compression is performed inside Caller's thread, all invocations are blocking */
1098  ZSTD_p_jobSize, /* Size of a compression job. This value is enforced only in non-blocking mode.
1099  * Each compression job is completed in parallel, so this value indirectly controls the nb of active threads.
1100  * 0 means default, which is dynamically determined based on compression parameters.
1101  * Job size must be a minimum of overlapSize, or 1 MB, whichever is largest.
1102  * The minimum size is automatically and transparently enforced */
1103  ZSTD_p_overlapSizeLog, /* Size of previous input reloaded at the beginning of each job.
1104  * 0 => no overlap, 6(default) => use 1/8th of windowSize, >=9 => use full windowSize */
1105 
1106  /* =================================================================== */
1107  /* experimental parameters - no stability guaranteed */
1108  /* =================================================================== */
1109 
1110  ZSTD_p_forceMaxWindow=1100, /* Force back-reference distances to remain < windowSize,
1111  * even when referencing into Dictionary content (default:0) */
1112  ZSTD_p_forceAttachDict, /* ZSTD supports usage of a CDict in-place
1113  * (avoiding having to copy the compression tables
1114  * from the CDict into the working context). Using
1115  * a CDict in this way saves an initial setup step,
1116  * but comes at the cost of more work per byte of
1117  * input. ZSTD has a simple internal heuristic that
1118  * guesses which strategy will be faster. You can
1119  * use this flag to override that guess.
1120  *
1121  * Note that the by-reference, in-place strategy is
1122  * only used when reusing a compression context
1123  * with compatible compression parameters. (If
1124  * incompatible / uninitialized, the working
1125  * context needs to be cleared anyways, which is
1126  * about as expensive as overwriting it with the
1127  * dictionary context, so there's no savings in
1128  * using the CDict by-ref.)
1129  *
1130  * Values greater than 0 force attaching the dict.
1131  * Values less than 0 force copying the dict.
1132  * 0 selects the default heuristic-guided behavior.
1133  */
1134 
1135 } ZSTD_cParameter;
1136 
1137 
1148 ZSTDLIB_API size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned value);
1149 
1154 ZSTDLIB_API size_t ZSTD_CCtx_getParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned* value);
1155 
1165 ZSTDLIB_API size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx* cctx, unsigned long long pledgedSrcSize);
1166 
1183 ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, size_t dictSize);
1184 ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_byReference(ZSTD_CCtx* cctx, const void* dict, size_t dictSize);
1185 ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType);
1186 
1187 
1198 ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict);
1199 
1219  const void* prefix, size_t prefixSize);
1221  const void* prefix, size_t prefixSize,
1222  ZSTD_dictContentType_e dictContentType);
1223 
1231 
1240 
1241 
1242 
1243 typedef enum {
1244  ZSTD_e_continue=0, /* collect more data, encoder decides when to output compressed result, for optimal compression ratio */
1245  ZSTD_e_flush, /* flush any data provided so far,
1246  * it creates (at least) one new block, that can be decoded immediately on reception;
1247  * frame will continue: any future data can still reference previously compressed data, improving compression. */
1248  ZSTD_e_end /* flush any remaining data and close current frame.
1249  * any additional data starts a new frame.
1250  * each frame is independent (does not reference any content from previous frame). */
1251 } ZSTD_EndDirective;
1252 
1277  ZSTD_EndDirective endOp);
1278 
1279 
1288  ZSTD_CCtx* cctx,
1289  void* dst, size_t dstCapacity, size_t* dstPos,
1290  const void* src, size_t srcSize, size_t* srcPos,
1291  ZSTD_EndDirective endOp);
1292 
1293 
1311 ZSTDLIB_API ZSTD_CCtx_params* ZSTD_createCCtxParams(void);
1312 ZSTDLIB_API size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);
1313 
1314 
1318 ZSTDLIB_API size_t ZSTD_CCtxParams_reset(ZSTD_CCtx_params* params);
1319 
1324 ZSTDLIB_API size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel);
1325 
1330 ZSTDLIB_API size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params);
1331 
1332 
1340 ZSTDLIB_API size_t ZSTD_CCtxParam_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, unsigned value);
1341 
1347 ZSTDLIB_API size_t ZSTD_CCtxParam_getParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, unsigned* value);
1348 
1357  ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params);
1358 
1359 
1360 /* ==================================== */
1361 /*=== Advanced decompression API ===*/
1362 /* ==================================== */
1363 
1364 /* The following API works the same way as the advanced compression API :
1365  * a context is created, parameters are pushed into it one by one,
1366  * then the context can be used to decompress data using an interface similar to the straming API.
1367  */
1368 
1384 ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
1385 ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
1386 ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType);
1387 
1388 
1398 ZSTDLIB_API size_t ZSTD_DCtx_refDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict);
1399 
1400 
1418  const void* prefix, size_t prefixSize);
1420  const void* prefix, size_t prefixSize,
1421  ZSTD_dictContentType_e dictContentType);
1422 
1423 
1431 ZSTDLIB_API size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize);
1432 
1433 
1440 ZSTDLIB_API size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format);
1441 
1442 
1446 ZSTDLIB_API size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr,
1447  const void* src, size_t srcSize, ZSTD_format_e format);
1448 
1449 
1459  ZSTD_inBuffer* input);
1460 
1461 
1470  ZSTD_DCtx* dctx,
1471  void* dst, size_t dstCapacity, size_t* dstPos,
1472  const void* src, size_t srcSize, size_t* srcPos);
1473 
1474 
1483 
1484 
1485 
1486 /* ============================ */
1488 /* ============================ */
1489 
1515 /*===== Raw zstd block functions =====*/
1516 ZSTDLIB_API size_t ZSTD_getBlockSize (const ZSTD_CCtx* cctx);
1517 ZSTDLIB_API size_t ZSTD_compressBlock (ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
1518 ZSTDLIB_API size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
1519 ZSTDLIB_API size_t ZSTD_insertBlock (ZSTD_DCtx* dctx, const void* blockStart, size_t blockSize);
1522 #endif /* ZSTD_H_ZSTD_STATIC_LINKING_ONLY */
1523 
1524 #if defined (__cplusplus)
1525 }
1526 #endif
size_t ZSTD_initCStream_srcSize(ZSTD_CStream *zcs, int compressionLevel, unsigned long long pss)
ZSTDLIB_API const char * ZSTD_getErrorName(size_t code)
Definition: zstd_common.c:39
size_t size
Definition: zstd.h:280
ZSTD_CCtx ZSTD_CStream
Definition: zstd.h:332
size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx *dctx, const void *prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType)
size_t ZSTD_initCStream_usingDict(ZSTD_CStream *zcs, const void *dict, size_t dictSize, int compressionLevel)
size_t ZSTD_sizeof_DCtx(const ZSTD_DCtx *dctx)
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize(const void *src, size_t srcSize)
const ZSTD_DDict * ZSTD_initStaticDDict(void *sBuffer, size_t sBufferSize, const void *dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType)
ZSTDLIB_API size_t ZSTD_DStreamInSize(void)
unsigned ZSTD_getDictID_fromDDict(const ZSTD_DDict *ddict)
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
ZSTDLIB_API size_t ZSTD_CStreamOutSize(void)
ZSTD_CCtx_params * ZSTD_createCCtxParams(void)
size_t ZSTD_initDStream_usingDict(ZSTD_DStream *zds, const void *dict, size_t dictSize)
ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx *dctx)
size_t ZSTD_DCtx_setFormat(ZSTD_DCtx *dctx, ZSTD_format_e format)
ZSTD_DStream * ZSTD_initStaticDStream(void *workspace, size_t workspaceSize)
size_t ZSTD_sizeof_CStream(const ZSTD_CStream *zcs)
size_t ZSTD_estimateCCtxSize(int compressionLevel)
size_t ZSTD_frameHeaderSize(const void *src, size_t srcSize)
size_t ZSTD_DCtx_refPrefix(ZSTD_DCtx *dctx, const void *prefix, size_t prefixSize)
struct ZSTD_inBuffer_s ZSTD_inBuffer
size_t ZSTD_compressBlock(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
size_t ZSTD_compressContinue(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel)
ZSTDLIB_API ZSTD_DCtx * ZSTD_createDCtx(void)
size_t ZSTD_initCStream_usingCDict(ZSTD_CStream *zcs, const ZSTD_CDict *cdict)
size_t ZSTD_decompressBegin(ZSTD_DCtx *dctx)
ZSTDLIB_API size_t ZSTD_compressStream(ZSTD_CStream *zcs, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
ZSTDLIB_API size_t ZSTD_flushStream(ZSTD_CStream *zcs, ZSTD_outBuffer *output)
ZSTDLIB_API size_t ZSTD_decompress_usingDict(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize)
ZSTD_DCtx ZSTD_DStream
Definition: zstd.h:377
GLuint buffer
Definition: glext.h:5915
size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx *cctx, const void *dict, size_t dictSize, int compressionLevel)
size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params *params)
size_t ZSTD_setDStreamParameter(ZSTD_DStream *dctx, ZSTD_DStreamParameter_e paramType, unsigned paramValue)
size_t ZSTD_sizeof_DStream(const ZSTD_DStream *dctx)
size_t ZSTD_compress_advanced(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize, ZSTD_parameters params)
size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx *cctx, const void *prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType)
ZSTD_CDict * ZSTD_createCDict_byReference(const void *dict, size_t dictSize, int compressionLevel)
ZSTD_DCtx * ZSTD_initStaticDCtx(void *workspace, size_t workspaceSize)
unsigned ZSTD_getDictID_fromFrame(const void *src, size_t srcSize)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
void * dictBuffer
Definition: zstd_compress.c:42
ZSTDLIB_API size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx *cctx, unsigned long long pledgedSrcSize)
size_t ZSTD_CCtx_resetParameters(ZSTD_CCtx *cctx)
size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
size_t ZSTD_estimateCDictSize_advanced(size_t dictSize, ZSTD_compressionParameters cParams, ZSTD_dictLoadMethod_e dictLoadMethod)
size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams)
size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx *dctx)
ZSTDLIB_API ZSTD_CCtx * ZSTD_createCCtx(void)
Definition: zstd_compress.c:53
GLenum const GLfloat * params
Definition: glext.h:5645
size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params *params)
size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod)
size_t ZSTD_CCtx_setParameter(ZSTD_CCtx *cctx, ZSTD_cParameter param, unsigned value)
ZSTDLIB_API size_t ZSTD_freeDStream(ZSTD_DStream *zds)
ZSTDLIB_API size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
ZSTDLIB_API size_t ZSTD_compress_usingDict(ZSTD_CCtx *ctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const void *dict, size_t dictSize, int compressionLevel)
size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params *params)
size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader *zfhPtr, const void *src, size_t srcSize, ZSTD_format_e format)
size_t ZSTD_estimateDCtxSize(void)
ZSTD_compressionParameters cParams
size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx *dctx, const void *dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType)
ZSTDLIB_API ZSTD_DStream * ZSTD_createDStream(void)
size_t ZSTD_compressBegin(ZSTD_CCtx *cctx, int compressionLevel)
size_t ZSTD_sizeof_DDict(const ZSTD_DDict *ddict)
ZSTD_DStream * ZSTD_createDStream_advanced(ZSTD_customMem customMem)
size_t ZSTD_decompressBegin_usingDDict(ZSTD_DCtx *dctx, const ZSTD_DDict *ddict)
smooth NULL
Definition: ftsmooth.c:416
size_t ZSTD_resetDStream(ZSTD_DStream *dctx)
ZSTDLIB_API size_t ZSTD_insertBlock(ZSTD_DCtx *dctx, const void *blockStart, size_t blockSize)
ZSTDLIB_API size_t ZSTD_DStreamOutSize(void)
size_t ZSTD_estimateDStreamSize(size_t windowSize)
ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long srcSizeHint, size_t dictSize)
ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx *cctx, const void *dict, size_t dictSize)
ZSTDLIB_API size_t ZSTD_decompress_usingDDict(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const ZSTD_DDict *ddict)
size_t ZSTD_resetCStream(ZSTD_CStream *zcs, unsigned long long pledgedSrcSize)
size_t ZSTD_compressBegin_advanced(ZSTD_CCtx *cctx, const void *dict, size_t dictSize, ZSTD_parameters params, unsigned long long pledgedSrcSize)
size_t ZSTD_copyCCtx(ZSTD_CCtx *dstCCtx, const ZSTD_CCtx *srcCCtx, unsigned long long pledgedSrcSize)
ZSTDLIB_API size_t ZSTD_CStreamInSize(void)
size_t ZSTD_CCtxParam_setParameter(ZSTD_CCtx_params *CCtxParams, ZSTD_cParameter param, unsigned value)
GLsizeiptr size
Definition: glext.h:5919
size_t ZSTD_decompress_generic(ZSTD_DCtx *dctx, ZSTD_outBuffer *output, ZSTD_inBuffer *input)
ZSTDLIB_API size_t ZSTD_compressCCtx(ZSTD_CCtx *ctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, int compressionLevel)
size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx *const cctx, const ZSTD_CDict *const cdict, ZSTD_frameParameters const fParams, unsigned long long const pledgedSrcSize)
ZSTDLIB_API size_t ZSTD_freeCStream(ZSTD_CStream *zcs)
ZSTDLIB_API unsigned ZSTD_isError(size_t code)
Definition: zstd_common.c:35
size_t ZSTD_checkCParams(ZSTD_compressionParameters cParams)
GLfloat param
Definition: glext.h:5796
size_t ZSTD_findFrameCompressedSize(const void *src, size_t srcSize)
size_t pos
Definition: zstd.h:275
size_t ZSTD_decompress_generic_simpleArgs(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, size_t *dstPos, const void *src, size_t srcSize, size_t *srcPos)
ZSTDLIB_API int ZSTD_maxCLevel(void)
size_t ZSTD_initCStream_advanced(ZSTD_CStream *zcs, const void *dict, size_t dictSize, ZSTD_parameters params, unsigned long long pledgedSrcSize)
ZSTDLIB_API ZSTD_DDict * ZSTD_createDDict(const void *dictBuffer, size_t dictSize)
ZSTD_CDict * ZSTD_createCDict_advanced(const void *dictBuffer, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType, ZSTD_compressionParameters cParams, ZSTD_customMem customMem)
GLuint address
Definition: glext.h:9393
ZSTDLIB_API size_t ZSTD_decompress(void *dst, size_t dstCapacity, const void *src, size_t compressedSize)
ZSTD_CCtx * ZSTD_createCCtx_advanced(ZSTD_customMem customMem)
Definition: zstd_compress.c:70
size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams)
ZSTDLIB_API size_t ZSTD_compress_usingCDict(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const ZSTD_CDict *cdict)
unsigned long long ZSTD_findDecompressedSize(const void *src, size_t srcSize)
ZSTD_CStream * ZSTD_initStaticCStream(void *workspace, size_t workspaceSize)
ZSTDLIB_API const char * ZSTD_versionString(void)
Definition: zstd_common.c:27
ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize)
Definition: zstd_compress.c:33
size_t ZSTD_CCtx_refCDict(ZSTD_CCtx *cctx, const ZSTD_CDict *cdict)
size_t ZSTD_CCtx_loadDictionary_advanced(ZSTD_CCtx *cctx, const void *dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType)
ZSTDLIB_API ZSTD_CStream * ZSTD_createCStream(void)
size_t ZSTD_getFrameHeader(ZSTD_frameHeader *zfhPtr, const void *src, size_t srcSize)
ZSTD_DDict * ZSTD_createDDict_advanced(const void *dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType, ZSTD_customMem customMem)
void ZSTD_CCtx_reset(ZSTD_CCtx *cctx)
ZSTDLIB_API size_t ZSTD_freeCDict(ZSTD_CDict *CDict)
GLenum src
Definition: glext.h:6340
size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream *zcs, const ZSTD_CDict *cdict, ZSTD_frameParameters fParams, unsigned long long pledgedSrcSize)
size_t ZSTD_toFlushNow(ZSTD_CCtx *cctx)
size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params *cctxParams, ZSTD_parameters params)
unsigned ZSTD_isFrame(const void *buffer, size_t size)
size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize, const ZSTD_CDict *cdict, ZSTD_frameParameters fParams)
size_t ZSTD_compress_generic(ZSTD_CCtx *cctx, ZSTD_outBuffer *output, ZSTD_inBuffer *input, ZSTD_EndDirective endOp)
size_t pos
Definition: zstd.h:281
size_t ZSTD_compress_generic_simpleArgs(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, size_t *dstPos, const void *src, size_t srcSize, size_t *srcPos, ZSTD_EndDirective endOp)
size_t ZSTD_initDStream_usingDDict(ZSTD_DStream *dctx, const ZSTD_DDict *ddict)
ZSTDLIB_API size_t ZSTD_compress(void *dst, size_t dstCapacity, const void *src, size_t srcSize, int compressionLevel)
size_t size
Definition: zstd.h:274
ZSTDLIB_API unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize)
size_t ZSTD_CCtx_getParameter(ZSTD_CCtx *cctx, ZSTD_cParameter param, unsigned *value)
ZSTDLIB_API size_t ZSTD_initCStream(ZSTD_CStream *zcs, int compressionLevel)
ZSTD_DCtx * ZSTD_createDCtx_advanced(ZSTD_customMem customMem)
size_t ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
size_t ZSTD_estimateCStreamSize(int compressionLevel)
GLenum GLenum GLenum input
Definition: glext.h:9031
size_t ZSTD_CCtx_setParametersUsingCCtxParams(ZSTD_CCtx *cctx, const ZSTD_CCtx_params *params)
void ZSTD_DCtx_reset(ZSTD_DCtx *dctx)
int consumed
Definition: scanf.h:134
ZSTDLIB_API unsigned ZSTD_versionNumber(void)
Definition: zstd_common.c:25
size_t ZSTD_CCtxParams_reset(ZSTD_CCtx_params *params)
void * dst
Definition: zstd.h:279
size_t ZSTD_estimateDStreamSize_fromFrame(const void *src, size_t srcSize)
int ZSTD_minCLevel(void)
size_t ZSTD_DCtx_refDDict(ZSTD_DCtx *dctx, const ZSTD_DDict *ddict)
ZSTDLIB_API size_t ZSTD_freeDDict(ZSTD_DDict *ddict)
GLenum GLenum dst
Definition: glext.h:6340
ZSTD_DDict * ZSTD_createDDict_byReference(const void *dictBuffer, size_t dictSize)
size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx *cctx, const void *prefix, size_t prefixSize)
size_t ZSTD_DCtx_loadDictionary(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, unsigned long long srcSize, size_t dictSize)
ZSTDLIB_API size_t ZSTD_freeDCtx(ZSTD_DCtx *dctx)
size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx *dctx, const void *dict, size_t dictSize)
size_t ZSTD_sizeof_CDict(const ZSTD_CDict *cdict)
const void * src
Definition: zstd.h:273
size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize)
size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx *dctx, size_t maxWindowSize)
size_t ZSTD_compressEnd(ZSTD_CCtx *cctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
ZSTD_CStream * ZSTD_createCStream_advanced(ZSTD_customMem customMem)
ZSTDLIB_API size_t ZSTD_decompressDCtx(ZSTD_DCtx *ctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)
ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long srcSizeHint, size_t dictSize)
ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_byReference(ZSTD_CCtx *cctx, const void *dict, size_t dictSize)
size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx *cctx, const ZSTD_CDict *cdict)
ZSTDLIB_API size_t ZSTD_freeCCtx(ZSTD_CCtx *cctx)
void ZSTD_copyDCtx(ZSTD_DCtx *dstDCtx, const ZSTD_DCtx *srcDCtx)
ZSTD_CCtx * ZSTD_initStaticCCtx(void *workspace, size_t workspaceSize)
Definition: zstd_compress.c:82
const ZSTD_CDict * ZSTD_initStaticCDict(void *workspace, size_t workspaceSize, const void *dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType, ZSTD_compressionParameters cParams)
ZSTDLIB_API ZSTD_CDict * ZSTD_createCDict(const void *dictBuffer, size_t dictSize, int compressionLevel)
size_t ZSTD_CCtxParam_getParameter(ZSTD_CCtx_params *CCtxParams, ZSTD_cParameter param, unsigned *value)
size_t ZSTD_sizeof_CCtx(const ZSTD_CCtx *cctx)
size_t ZSTD_getBlockSize(const ZSTD_CCtx *cctx)
ZSTD_frameProgression ZSTD_getFrameProgression(const ZSTD_CCtx *cctx)
ZSTDLIB_API size_t ZSTD_endStream(ZSTD_CStream *zcs, ZSTD_outBuffer *output)
unsigned ZSTD_getDictID_fromDict(const void *dict, size_t dictSize)
ZSTDLIB_API size_t ZSTD_initDStream(ZSTD_DStream *zds)
#define ZSTDLIB_API
Definition: zstd.h:34
struct ZSTD_outBuffer_s ZSTD_outBuffer
size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params *cctxParams, int compressionLevel)
size_t ZSTD_decompressBlock(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, const void *src, size_t srcSize)