zstd-ruby 1.5.0.0 → 1.5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -2
- data/README.md +1 -1
- data/ext/zstdruby/extconf.rb +1 -0
- data/ext/zstdruby/libzstd/Makefile +50 -175
- data/ext/zstdruby/libzstd/README.md +7 -1
- data/ext/zstdruby/libzstd/common/bitstream.h +24 -9
- data/ext/zstdruby/libzstd/common/compiler.h +89 -43
- data/ext/zstdruby/libzstd/common/entropy_common.c +11 -5
- data/ext/zstdruby/libzstd/common/error_private.h +79 -0
- data/ext/zstdruby/libzstd/common/fse.h +2 -1
- data/ext/zstdruby/libzstd/common/fse_decompress.c +1 -1
- data/ext/zstdruby/libzstd/common/huf.h +24 -22
- data/ext/zstdruby/libzstd/common/mem.h +18 -0
- data/ext/zstdruby/libzstd/common/portability_macros.h +131 -0
- data/ext/zstdruby/libzstd/common/xxhash.c +5 -805
- data/ext/zstdruby/libzstd/common/xxhash.h +5568 -167
- data/ext/zstdruby/libzstd/common/zstd_internal.h +92 -88
- data/ext/zstdruby/libzstd/common/zstd_trace.h +12 -3
- data/ext/zstdruby/libzstd/compress/clevels.h +134 -0
- data/ext/zstdruby/libzstd/compress/fse_compress.c +63 -27
- data/ext/zstdruby/libzstd/compress/huf_compress.c +537 -104
- data/ext/zstdruby/libzstd/compress/zstd_compress.c +194 -278
- data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +102 -44
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.c +4 -3
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.h +3 -1
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +5 -4
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +3 -2
- data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +3 -3
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +289 -114
- data/ext/zstdruby/libzstd/compress/zstd_fast.c +302 -123
- data/ext/zstdruby/libzstd/compress/zstd_lazy.c +418 -502
- data/ext/zstdruby/libzstd/compress/zstd_ldm.c +4 -4
- data/ext/zstdruby/libzstd/compress/zstd_ldm.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_ldm_geartab.h +4 -1
- data/ext/zstdruby/libzstd/compress/zstd_opt.c +186 -108
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +59 -29
- data/ext/zstdruby/libzstd/decompress/huf_decompress.c +727 -189
- data/ext/zstdruby/libzstd/decompress/huf_decompress_amd64.S +571 -0
- data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +85 -22
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.c +744 -220
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.h +8 -2
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h +34 -3
- data/ext/zstdruby/libzstd/deprecated/zbuff_compress.c +23 -3
- data/ext/zstdruby/libzstd/dictBuilder/cover.c +9 -2
- data/ext/zstdruby/libzstd/dictBuilder/fastcover.c +11 -4
- data/ext/zstdruby/libzstd/dictBuilder/zdict.c +99 -28
- data/ext/zstdruby/libzstd/legacy/zstd_v01.c +2 -6
- data/ext/zstdruby/libzstd/legacy/zstd_v02.c +3 -7
- data/ext/zstdruby/libzstd/legacy/zstd_v03.c +3 -7
- data/ext/zstdruby/libzstd/legacy/zstd_v04.c +3 -7
- data/ext/zstdruby/libzstd/legacy/zstd_v05.c +3 -7
- data/ext/zstdruby/libzstd/legacy/zstd_v06.c +3 -7
- data/ext/zstdruby/libzstd/legacy/zstd_v07.c +3 -7
- data/ext/zstdruby/libzstd/libzstd.mk +185 -0
- data/ext/zstdruby/libzstd/libzstd.pc.in +1 -0
- data/ext/zstdruby/libzstd/modulemap/module.modulemap +4 -0
- data/ext/zstdruby/libzstd/zdict.h +4 -4
- data/ext/zstdruby/libzstd/zstd.h +179 -136
- data/ext/zstdruby/zstdruby.c +2 -2
- data/lib/zstd-ruby/version.rb +1 -1
- metadata +8 -3
data/ext/zstdruby/libzstd/zstd.h
CHANGED
@@ -20,19 +20,21 @@ extern "C" {
|
|
20
20
|
|
21
21
|
|
22
22
|
/* ===== ZSTDLIB_API : control library symbols visibility ===== */
|
23
|
-
#ifndef
|
24
|
-
# if defined(__GNUC__) && (__GNUC__ >= 4)
|
25
|
-
# define
|
23
|
+
#ifndef ZSTDLIB_VISIBLE
|
24
|
+
# if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(__MINGW32__)
|
25
|
+
# define ZSTDLIB_VISIBLE __attribute__ ((visibility ("default")))
|
26
|
+
# define ZSTDLIB_HIDDEN __attribute__ ((visibility ("hidden")))
|
26
27
|
# else
|
27
|
-
# define
|
28
|
+
# define ZSTDLIB_VISIBLE
|
29
|
+
# define ZSTDLIB_HIDDEN
|
28
30
|
# endif
|
29
31
|
#endif
|
30
32
|
#if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1)
|
31
|
-
# define ZSTDLIB_API __declspec(dllexport)
|
33
|
+
# define ZSTDLIB_API __declspec(dllexport) ZSTDLIB_VISIBLE
|
32
34
|
#elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1)
|
33
|
-
# define ZSTDLIB_API __declspec(dllimport)
|
35
|
+
# define ZSTDLIB_API __declspec(dllimport) ZSTDLIB_VISIBLE /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
|
34
36
|
#else
|
35
|
-
# define ZSTDLIB_API
|
37
|
+
# define ZSTDLIB_API ZSTDLIB_VISIBLE
|
36
38
|
#endif
|
37
39
|
|
38
40
|
|
@@ -72,7 +74,7 @@ extern "C" {
|
|
72
74
|
/*------ Version ------*/
|
73
75
|
#define ZSTD_VERSION_MAJOR 1
|
74
76
|
#define ZSTD_VERSION_MINOR 5
|
75
|
-
#define ZSTD_VERSION_RELEASE
|
77
|
+
#define ZSTD_VERSION_RELEASE 1
|
76
78
|
#define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
|
77
79
|
|
78
80
|
/*! ZSTD_versionNumber() :
|
@@ -247,7 +249,7 @@ ZSTDLIB_API size_t ZSTD_decompressDCtx(ZSTD_DCtx* dctx,
|
|
247
249
|
*
|
248
250
|
* It's possible to reset all parameters to "default" using ZSTD_CCtx_reset().
|
249
251
|
*
|
250
|
-
* This API
|
252
|
+
* This API supersedes all other "advanced" API entry points in the experimental section.
|
251
253
|
* In the future, we expect to remove from experimental API entry points which are redundant with this API.
|
252
254
|
*/
|
253
255
|
|
@@ -417,7 +419,7 @@ typedef enum {
|
|
417
419
|
* ZSTD_c_stableOutBuffer
|
418
420
|
* ZSTD_c_blockDelimiters
|
419
421
|
* ZSTD_c_validateSequences
|
420
|
-
*
|
422
|
+
* ZSTD_c_useBlockSplitter
|
421
423
|
* ZSTD_c_useRowMatchFinder
|
422
424
|
* Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
|
423
425
|
* note : never ever use experimentalParam? names directly;
|
@@ -932,7 +934,7 @@ ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize);
|
|
932
934
|
* Advanced dictionary and prefix API (Requires v1.4.0+)
|
933
935
|
*
|
934
936
|
* This API allows dictionaries to be used with ZSTD_compress2(),
|
935
|
-
* ZSTD_compressStream2(), and
|
937
|
+
* ZSTD_compressStream2(), and ZSTD_decompressDCtx(). Dictionaries are sticky, and
|
936
938
|
* only reset with the context is reset with ZSTD_reset_parameters or
|
937
939
|
* ZSTD_reset_session_and_parameters. Prefixes are single-use.
|
938
940
|
******************************************************************************/
|
@@ -1073,25 +1075,36 @@ ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
|
|
1073
1075
|
#if defined(ZSTD_STATIC_LINKING_ONLY) && !defined(ZSTD_H_ZSTD_STATIC_LINKING_ONLY)
|
1074
1076
|
#define ZSTD_H_ZSTD_STATIC_LINKING_ONLY
|
1075
1077
|
|
1078
|
+
/* This can be overridden externally to hide static symbols. */
|
1079
|
+
#ifndef ZSTDLIB_STATIC_API
|
1080
|
+
# if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1)
|
1081
|
+
# define ZSTDLIB_STATIC_API __declspec(dllexport) ZSTDLIB_VISIBLE
|
1082
|
+
# elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1)
|
1083
|
+
# define ZSTDLIB_STATIC_API __declspec(dllimport) ZSTDLIB_VISIBLE
|
1084
|
+
# else
|
1085
|
+
# define ZSTDLIB_STATIC_API ZSTDLIB_VISIBLE
|
1086
|
+
# endif
|
1087
|
+
#endif
|
1088
|
+
|
1076
1089
|
/* Deprecation warnings :
|
1077
1090
|
* Should these warnings be a problem, it is generally possible to disable them,
|
1078
1091
|
* typically with -Wno-deprecated-declarations for gcc or _CRT_SECURE_NO_WARNINGS in Visual.
|
1079
1092
|
* Otherwise, it's also possible to define ZSTD_DISABLE_DEPRECATE_WARNINGS.
|
1080
1093
|
*/
|
1081
1094
|
#ifdef ZSTD_DISABLE_DEPRECATE_WARNINGS
|
1082
|
-
# define ZSTD_DEPRECATED(message)
|
1095
|
+
# define ZSTD_DEPRECATED(message) ZSTDLIB_STATIC_API /* disable deprecation warnings */
|
1083
1096
|
#else
|
1084
1097
|
# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */
|
1085
|
-
# define ZSTD_DEPRECATED(message) [[deprecated(message)]]
|
1098
|
+
# define ZSTD_DEPRECATED(message) [[deprecated(message)]] ZSTDLIB_STATIC_API
|
1086
1099
|
# elif (defined(GNUC) && (GNUC > 4 || (GNUC == 4 && GNUC_MINOR >= 5))) || defined(__clang__)
|
1087
|
-
# define ZSTD_DEPRECATED(message)
|
1100
|
+
# define ZSTD_DEPRECATED(message) ZSTDLIB_STATIC_API __attribute__((deprecated(message)))
|
1088
1101
|
# elif defined(__GNUC__) && (__GNUC__ >= 3)
|
1089
|
-
# define ZSTD_DEPRECATED(message)
|
1102
|
+
# define ZSTD_DEPRECATED(message) ZSTDLIB_STATIC_API __attribute__((deprecated))
|
1090
1103
|
# elif defined(_MSC_VER)
|
1091
|
-
# define ZSTD_DEPRECATED(message)
|
1104
|
+
# define ZSTD_DEPRECATED(message) ZSTDLIB_STATIC_API __declspec(deprecated(message))
|
1092
1105
|
# else
|
1093
1106
|
# pragma message("WARNING: You need to implement ZSTD_DEPRECATED for this compiler")
|
1094
|
-
# define ZSTD_DEPRECATED(message)
|
1107
|
+
# define ZSTD_DEPRECATED(message) ZSTDLIB_STATIC_API
|
1095
1108
|
# endif
|
1096
1109
|
#endif /* ZSTD_DISABLE_DEPRECATE_WARNINGS */
|
1097
1110
|
|
@@ -1157,9 +1170,6 @@ ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
|
|
1157
1170
|
#define ZSTD_SRCSIZEHINT_MIN 0
|
1158
1171
|
#define ZSTD_SRCSIZEHINT_MAX INT_MAX
|
1159
1172
|
|
1160
|
-
/* internal */
|
1161
|
-
#define ZSTD_HASHLOG3_MAX 17
|
1162
|
-
|
1163
1173
|
|
1164
1174
|
/* --- Advanced types --- */
|
1165
1175
|
|
@@ -1302,10 +1312,14 @@ typedef enum {
|
|
1302
1312
|
} ZSTD_literalCompressionMode_e;
|
1303
1313
|
|
1304
1314
|
typedef enum {
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1315
|
+
/* Note: This enum controls features which are conditionally beneficial. Zstd typically will make a final
|
1316
|
+
* decision on whether or not to enable the feature (ZSTD_ps_auto), but setting the switch to ZSTD_ps_enable
|
1317
|
+
* or ZSTD_ps_disable allow for a force enable/disable the feature.
|
1318
|
+
*/
|
1319
|
+
ZSTD_ps_auto = 0, /* Let the library automatically determine whether the feature shall be enabled */
|
1320
|
+
ZSTD_ps_enable = 1, /* Force-enable the feature */
|
1321
|
+
ZSTD_ps_disable = 2 /* Do not use the feature */
|
1322
|
+
} ZSTD_paramSwitch_e;
|
1309
1323
|
|
1310
1324
|
/***************************************
|
1311
1325
|
* Frame size functions
|
@@ -1332,7 +1346,7 @@ typedef enum {
|
|
1332
1346
|
* note 5 : ZSTD_findDecompressedSize handles multiple frames, and so it must traverse the input to
|
1333
1347
|
* read each contained frame header. This is fast as most of the data is skipped,
|
1334
1348
|
* however it does mean that all frame data must be present and valid. */
|
1335
|
-
|
1349
|
+
ZSTDLIB_STATIC_API unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize);
|
1336
1350
|
|
1337
1351
|
/*! ZSTD_decompressBound() :
|
1338
1352
|
* `src` should point to the start of a series of ZSTD encoded and/or skippable frames
|
@@ -1347,13 +1361,13 @@ ZSTDLIB_API unsigned long long ZSTD_findDecompressedSize(const void* src, size_t
|
|
1347
1361
|
* note 3 : when the decompressed size field isn't available, the upper-bound for that frame is calculated by:
|
1348
1362
|
* upper-bound = # blocks * min(128 KB, Window_Size)
|
1349
1363
|
*/
|
1350
|
-
|
1364
|
+
ZSTDLIB_STATIC_API unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize);
|
1351
1365
|
|
1352
1366
|
/*! ZSTD_frameHeaderSize() :
|
1353
1367
|
* srcSize must be >= ZSTD_FRAMEHEADERSIZE_PREFIX.
|
1354
1368
|
* @return : size of the Frame Header,
|
1355
1369
|
* or an error code (if srcSize is too small) */
|
1356
|
-
|
1370
|
+
ZSTDLIB_STATIC_API size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize);
|
1357
1371
|
|
1358
1372
|
typedef enum {
|
1359
1373
|
ZSTD_sf_noBlockDelimiters = 0, /* Representation of ZSTD_Sequence has no block delimiters, sequences only */
|
@@ -1376,7 +1390,7 @@ typedef enum {
|
|
1376
1390
|
* @return : number of sequences generated
|
1377
1391
|
*/
|
1378
1392
|
|
1379
|
-
|
1393
|
+
ZSTDLIB_STATIC_API size_t ZSTD_generateSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs,
|
1380
1394
|
size_t outSeqsSize, const void* src, size_t srcSize);
|
1381
1395
|
|
1382
1396
|
/*! ZSTD_mergeBlockDelimiters() :
|
@@ -1390,7 +1404,7 @@ ZSTDLIB_API size_t ZSTD_generateSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs,
|
|
1390
1404
|
* setting of ZSTD_c_blockDelimiters as ZSTD_sf_noBlockDelimiters
|
1391
1405
|
* @return : number of sequences left after merging
|
1392
1406
|
*/
|
1393
|
-
|
1407
|
+
ZSTDLIB_STATIC_API size_t ZSTD_mergeBlockDelimiters(ZSTD_Sequence* sequences, size_t seqsSize);
|
1394
1408
|
|
1395
1409
|
/*! ZSTD_compressSequences() :
|
1396
1410
|
* Compress an array of ZSTD_Sequence, generated from the original source buffer, into dst.
|
@@ -1420,7 +1434,7 @@ ZSTDLIB_API size_t ZSTD_mergeBlockDelimiters(ZSTD_Sequence* sequences, size_t se
|
|
1420
1434
|
* and cannot emit an RLE block that disagrees with the repcode history
|
1421
1435
|
* @return : final compressed size or a ZSTD error.
|
1422
1436
|
*/
|
1423
|
-
|
1437
|
+
ZSTDLIB_STATIC_API size_t ZSTD_compressSequences(ZSTD_CCtx* const cctx, void* dst, size_t dstSize,
|
1424
1438
|
const ZSTD_Sequence* inSeqs, size_t inSeqsSize,
|
1425
1439
|
const void* src, size_t srcSize);
|
1426
1440
|
|
@@ -1438,9 +1452,29 @@ ZSTDLIB_API size_t ZSTD_compressSequences(ZSTD_CCtx* const cctx, void* dst, size
|
|
1438
1452
|
*
|
1439
1453
|
* @return : number of bytes written or a ZSTD error.
|
1440
1454
|
*/
|
1441
|
-
|
1455
|
+
ZSTDLIB_STATIC_API size_t ZSTD_writeSkippableFrame(void* dst, size_t dstCapacity,
|
1442
1456
|
const void* src, size_t srcSize, unsigned magicVariant);
|
1443
1457
|
|
1458
|
+
/*! ZSTD_readSkippableFrame() :
|
1459
|
+
* Retrieves a zstd skippable frame containing data given by src, and writes it to dst buffer.
|
1460
|
+
*
|
1461
|
+
* The parameter magicVariant will receive the magicVariant that was supplied when the frame was written,
|
1462
|
+
* i.e. magicNumber - ZSTD_MAGIC_SKIPPABLE_START. This can be NULL if the caller is not interested
|
1463
|
+
* in the magicVariant.
|
1464
|
+
*
|
1465
|
+
* Returns an error if destination buffer is not large enough, or if the frame is not skippable.
|
1466
|
+
*
|
1467
|
+
* @return : number of bytes written or a ZSTD error.
|
1468
|
+
*/
|
1469
|
+
ZSTDLIB_API size_t ZSTD_readSkippableFrame(void* dst, size_t dstCapacity, unsigned* magicVariant,
|
1470
|
+
const void* src, size_t srcSize);
|
1471
|
+
|
1472
|
+
/*! ZSTD_isSkippableFrame() :
|
1473
|
+
* Tells if the content of `buffer` starts with a valid Frame Identifier for a skippable frame.
|
1474
|
+
*/
|
1475
|
+
ZSTDLIB_API unsigned ZSTD_isSkippableFrame(const void* buffer, size_t size);
|
1476
|
+
|
1477
|
+
|
1444
1478
|
|
1445
1479
|
/***************************************
|
1446
1480
|
* Memory management
|
@@ -1469,10 +1503,10 @@ ZSTDLIB_API size_t ZSTD_writeSkippableFrame(void* dst, size_t dstCapacity,
|
|
1469
1503
|
* Note 2 : only single-threaded compression is supported.
|
1470
1504
|
* ZSTD_estimateCCtxSize_usingCCtxParams() will return an error code if ZSTD_c_nbWorkers is >= 1.
|
1471
1505
|
*/
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1506
|
+
ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize(int compressionLevel);
|
1507
|
+
ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
|
1508
|
+
ZSTDLIB_STATIC_API size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params);
|
1509
|
+
ZSTDLIB_STATIC_API size_t ZSTD_estimateDCtxSize(void);
|
1476
1510
|
|
1477
1511
|
/*! ZSTD_estimateCStreamSize() :
|
1478
1512
|
* ZSTD_estimateCStreamSize() will provide a budget large enough for any compression level up to selected one.
|
@@ -1487,20 +1521,20 @@ ZSTDLIB_API size_t ZSTD_estimateDCtxSize(void);
|
|
1487
1521
|
* Note : if streaming is init with function ZSTD_init?Stream_usingDict(),
|
1488
1522
|
* an internal ?Dict will be created, which additional size is not estimated here.
|
1489
1523
|
* In this case, get total size by adding ZSTD_estimate?DictSize */
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1524
|
+
ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize(int compressionLevel);
|
1525
|
+
ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams);
|
1526
|
+
ZSTDLIB_STATIC_API size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params);
|
1527
|
+
ZSTDLIB_STATIC_API size_t ZSTD_estimateDStreamSize(size_t windowSize);
|
1528
|
+
ZSTDLIB_STATIC_API size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize);
|
1495
1529
|
|
1496
1530
|
/*! ZSTD_estimate?DictSize() :
|
1497
1531
|
* ZSTD_estimateCDictSize() will bet that src size is relatively "small", and content is copied, like ZSTD_createCDict().
|
1498
1532
|
* ZSTD_estimateCDictSize_advanced() makes it possible to control compression parameters precisely, like ZSTD_createCDict_advanced().
|
1499
1533
|
* Note : dictionaries created by reference (`ZSTD_dlm_byRef`) are logically smaller.
|
1500
1534
|
*/
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1535
|
+
ZSTDLIB_STATIC_API size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel);
|
1536
|
+
ZSTDLIB_STATIC_API size_t ZSTD_estimateCDictSize_advanced(size_t dictSize, ZSTD_compressionParameters cParams, ZSTD_dictLoadMethod_e dictLoadMethod);
|
1537
|
+
ZSTDLIB_STATIC_API size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod);
|
1504
1538
|
|
1505
1539
|
/*! ZSTD_initStatic*() :
|
1506
1540
|
* Initialize an object using a pre-allocated fixed-size buffer.
|
@@ -1523,20 +1557,20 @@ ZSTDLIB_API size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e
|
|
1523
1557
|
* Limitation 2 : static cctx currently not compatible with multi-threading.
|
1524
1558
|
* Limitation 3 : static dctx is incompatible with legacy support.
|
1525
1559
|
*/
|
1526
|
-
|
1527
|
-
|
1560
|
+
ZSTDLIB_STATIC_API ZSTD_CCtx* ZSTD_initStaticCCtx(void* workspace, size_t workspaceSize);
|
1561
|
+
ZSTDLIB_STATIC_API ZSTD_CStream* ZSTD_initStaticCStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticCCtx() */
|
1528
1562
|
|
1529
|
-
|
1530
|
-
|
1563
|
+
ZSTDLIB_STATIC_API ZSTD_DCtx* ZSTD_initStaticDCtx(void* workspace, size_t workspaceSize);
|
1564
|
+
ZSTDLIB_STATIC_API ZSTD_DStream* ZSTD_initStaticDStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticDCtx() */
|
1531
1565
|
|
1532
|
-
|
1566
|
+
ZSTDLIB_STATIC_API const ZSTD_CDict* ZSTD_initStaticCDict(
|
1533
1567
|
void* workspace, size_t workspaceSize,
|
1534
1568
|
const void* dict, size_t dictSize,
|
1535
1569
|
ZSTD_dictLoadMethod_e dictLoadMethod,
|
1536
1570
|
ZSTD_dictContentType_e dictContentType,
|
1537
1571
|
ZSTD_compressionParameters cParams);
|
1538
1572
|
|
1539
|
-
|
1573
|
+
ZSTDLIB_STATIC_API const ZSTD_DDict* ZSTD_initStaticDDict(
|
1540
1574
|
void* workspace, size_t workspaceSize,
|
1541
1575
|
const void* dict, size_t dictSize,
|
1542
1576
|
ZSTD_dictLoadMethod_e dictLoadMethod,
|
@@ -1557,44 +1591,44 @@ __attribute__((__unused__))
|
|
1557
1591
|
#endif
|
1558
1592
|
ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL }; /**< this constant defers to stdlib's functions */
|
1559
1593
|
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1594
|
+
ZSTDLIB_STATIC_API ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem);
|
1595
|
+
ZSTDLIB_STATIC_API ZSTD_CStream* ZSTD_createCStream_advanced(ZSTD_customMem customMem);
|
1596
|
+
ZSTDLIB_STATIC_API ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem);
|
1597
|
+
ZSTDLIB_STATIC_API ZSTD_DStream* ZSTD_createDStream_advanced(ZSTD_customMem customMem);
|
1564
1598
|
|
1565
|
-
|
1599
|
+
ZSTDLIB_STATIC_API ZSTD_CDict* ZSTD_createCDict_advanced(const void* dict, size_t dictSize,
|
1566
1600
|
ZSTD_dictLoadMethod_e dictLoadMethod,
|
1567
1601
|
ZSTD_dictContentType_e dictContentType,
|
1568
1602
|
ZSTD_compressionParameters cParams,
|
1569
1603
|
ZSTD_customMem customMem);
|
1570
1604
|
|
1571
|
-
|
1572
|
-
*
|
1573
|
-
*
|
1574
|
-
*
|
1575
|
-
*
|
1576
|
-
*
|
1577
|
-
*
|
1578
|
-
*
|
1579
|
-
*
|
1605
|
+
/*! Thread pool :
|
1606
|
+
* These prototypes make it possible to share a thread pool among multiple compression contexts.
|
1607
|
+
* This can limit resources for applications with multiple threads where each one uses
|
1608
|
+
* a threaded compression mode (via ZSTD_c_nbWorkers parameter).
|
1609
|
+
* ZSTD_createThreadPool creates a new thread pool with a given number of threads.
|
1610
|
+
* Note that the lifetime of such pool must exist while being used.
|
1611
|
+
* ZSTD_CCtx_refThreadPool assigns a thread pool to a context (use NULL argument value
|
1612
|
+
* to use an internal thread pool).
|
1613
|
+
* ZSTD_freeThreadPool frees a thread pool, accepts NULL pointer.
|
1580
1614
|
*/
|
1581
1615
|
typedef struct POOL_ctx_s ZSTD_threadPool;
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1616
|
+
ZSTDLIB_STATIC_API ZSTD_threadPool* ZSTD_createThreadPool(size_t numThreads);
|
1617
|
+
ZSTDLIB_STATIC_API void ZSTD_freeThreadPool (ZSTD_threadPool* pool); /* accept NULL pointer */
|
1618
|
+
ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refThreadPool(ZSTD_CCtx* cctx, ZSTD_threadPool* pool);
|
1585
1619
|
|
1586
1620
|
|
1587
1621
|
/*
|
1588
1622
|
* This API is temporary and is expected to change or disappear in the future!
|
1589
1623
|
*/
|
1590
|
-
|
1624
|
+
ZSTDLIB_STATIC_API ZSTD_CDict* ZSTD_createCDict_advanced2(
|
1591
1625
|
const void* dict, size_t dictSize,
|
1592
1626
|
ZSTD_dictLoadMethod_e dictLoadMethod,
|
1593
1627
|
ZSTD_dictContentType_e dictContentType,
|
1594
1628
|
const ZSTD_CCtx_params* cctxParams,
|
1595
1629
|
ZSTD_customMem customMem);
|
1596
1630
|
|
1597
|
-
|
1631
|
+
ZSTDLIB_STATIC_API ZSTD_DDict* ZSTD_createDDict_advanced(
|
1598
1632
|
const void* dict, size_t dictSize,
|
1599
1633
|
ZSTD_dictLoadMethod_e dictLoadMethod,
|
1600
1634
|
ZSTD_dictContentType_e dictContentType,
|
@@ -1611,22 +1645,22 @@ ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_advanced(
|
|
1611
1645
|
* As a consequence, `dictBuffer` **must** outlive CDict,
|
1612
1646
|
* and its content must remain unmodified throughout the lifetime of CDict.
|
1613
1647
|
* note: equivalent to ZSTD_createCDict_advanced(), with dictLoadMethod==ZSTD_dlm_byRef */
|
1614
|
-
|
1648
|
+
ZSTDLIB_STATIC_API ZSTD_CDict* ZSTD_createCDict_byReference(const void* dictBuffer, size_t dictSize, int compressionLevel);
|
1615
1649
|
|
1616
1650
|
/*! ZSTD_getCParams() :
|
1617
1651
|
* @return ZSTD_compressionParameters structure for a selected compression level and estimated srcSize.
|
1618
1652
|
* `estimatedSrcSize` value is optional, select 0 if not known */
|
1619
|
-
|
1653
|
+
ZSTDLIB_STATIC_API ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
|
1620
1654
|
|
1621
1655
|
/*! ZSTD_getParams() :
|
1622
1656
|
* same as ZSTD_getCParams(), but @return a full `ZSTD_parameters` object instead of sub-component `ZSTD_compressionParameters`.
|
1623
1657
|
* All fields of `ZSTD_frameParameters` are set to default : contentSize=1, checksum=0, noDictID=0 */
|
1624
|
-
|
1658
|
+
ZSTDLIB_STATIC_API ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
|
1625
1659
|
|
1626
1660
|
/*! ZSTD_checkCParams() :
|
1627
1661
|
* Ensure param values remain within authorized range.
|
1628
1662
|
* @return 0 on success, or an error code (can be checked with ZSTD_isError()) */
|
1629
|
-
|
1663
|
+
ZSTDLIB_STATIC_API size_t ZSTD_checkCParams(ZSTD_compressionParameters params);
|
1630
1664
|
|
1631
1665
|
/*! ZSTD_adjustCParams() :
|
1632
1666
|
* optimize params for a given `srcSize` and `dictSize`.
|
@@ -1634,7 +1668,7 @@ ZSTDLIB_API size_t ZSTD_checkCParams(ZSTD_compressionParameters params);
|
|
1634
1668
|
* `dictSize` must be `0` when there is no dictionary.
|
1635
1669
|
* cPar can be invalid : all parameters will be clamped within valid range in the @return struct.
|
1636
1670
|
* This function never fails (wide contract) */
|
1637
|
-
|
1671
|
+
ZSTDLIB_STATIC_API ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, unsigned long long srcSize, size_t dictSize);
|
1638
1672
|
|
1639
1673
|
/*! ZSTD_compress_advanced() :
|
1640
1674
|
* Note : this function is now DEPRECATED.
|
@@ -1662,18 +1696,18 @@ size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx,
|
|
1662
1696
|
/*! ZSTD_CCtx_loadDictionary_byReference() :
|
1663
1697
|
* Same as ZSTD_CCtx_loadDictionary(), but dictionary content is referenced, instead of being copied into CCtx.
|
1664
1698
|
* It saves some memory, but also requires that `dict` outlives its usage within `cctx` */
|
1665
|
-
|
1699
|
+
ZSTDLIB_STATIC_API size_t ZSTD_CCtx_loadDictionary_byReference(ZSTD_CCtx* cctx, const void* dict, size_t dictSize);
|
1666
1700
|
|
1667
1701
|
/*! ZSTD_CCtx_loadDictionary_advanced() :
|
1668
1702
|
* Same as ZSTD_CCtx_loadDictionary(), but gives finer control over
|
1669
1703
|
* how to load the dictionary (by copy ? by reference ?)
|
1670
1704
|
* and how to interpret it (automatic ? force raw mode ? full mode only ?) */
|
1671
|
-
|
1705
|
+
ZSTDLIB_STATIC_API size_t ZSTD_CCtx_loadDictionary_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType);
|
1672
1706
|
|
1673
1707
|
/*! ZSTD_CCtx_refPrefix_advanced() :
|
1674
1708
|
* Same as ZSTD_CCtx_refPrefix(), but gives finer control over
|
1675
1709
|
* how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?) */
|
1676
|
-
|
1710
|
+
ZSTDLIB_STATIC_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType);
|
1677
1711
|
|
1678
1712
|
/* === experimental parameters === */
|
1679
1713
|
/* these parameters can be used with ZSTD_setParameter()
|
@@ -1712,9 +1746,15 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* pre
|
|
1712
1746
|
* See the comments on that enum for an explanation of the feature. */
|
1713
1747
|
#define ZSTD_c_forceAttachDict ZSTD_c_experimentalParam4
|
1714
1748
|
|
1715
|
-
/*
|
1716
|
-
*
|
1717
|
-
*
|
1749
|
+
/* Controlled with ZSTD_paramSwitch_e enum.
|
1750
|
+
* Default is ZSTD_ps_auto.
|
1751
|
+
* Set to ZSTD_ps_disable to never compress literals.
|
1752
|
+
* Set to ZSTD_ps_enable to always compress literals. (Note: uncompressed literals
|
1753
|
+
* may still be emitted if huffman is not beneficial to use.)
|
1754
|
+
*
|
1755
|
+
* By default, in ZSTD_ps_auto, the library will decide at runtime whether to use
|
1756
|
+
* literals compression based on the compression parameters - specifically,
|
1757
|
+
* negative compression levels do not use literal compression.
|
1718
1758
|
*/
|
1719
1759
|
#define ZSTD_c_literalCompressionMode ZSTD_c_experimentalParam5
|
1720
1760
|
|
@@ -1777,7 +1817,7 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* pre
|
|
1777
1817
|
*
|
1778
1818
|
* Note that this means that the CDict tables can no longer be copied into the
|
1779
1819
|
* CCtx, so the dict attachment mode ZSTD_dictForceCopy will no longer be
|
1780
|
-
*
|
1820
|
+
* usable. The dictionary can only be attached or reloaded.
|
1781
1821
|
*
|
1782
1822
|
* In general, you should expect compression to be faster--sometimes very much
|
1783
1823
|
* so--and CDict creation to be slightly slower. Eventually, we will probably
|
@@ -1866,23 +1906,26 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* pre
|
|
1866
1906
|
*/
|
1867
1907
|
#define ZSTD_c_validateSequences ZSTD_c_experimentalParam12
|
1868
1908
|
|
1869
|
-
/*
|
1870
|
-
*
|
1909
|
+
/* ZSTD_c_useBlockSplitter
|
1910
|
+
* Controlled with ZSTD_paramSwitch_e enum.
|
1911
|
+
* Default is ZSTD_ps_auto.
|
1912
|
+
* Set to ZSTD_ps_disable to never use block splitter.
|
1913
|
+
* Set to ZSTD_ps_enable to always use block splitter.
|
1871
1914
|
*
|
1872
|
-
*
|
1915
|
+
* By default, in ZSTD_ps_auto, the library will decide at runtime whether to use
|
1916
|
+
* block splitting based on the compression parameters.
|
1873
1917
|
*/
|
1874
|
-
#define
|
1918
|
+
#define ZSTD_c_useBlockSplitter ZSTD_c_experimentalParam13
|
1875
1919
|
|
1876
1920
|
/* ZSTD_c_useRowMatchFinder
|
1877
|
-
*
|
1878
|
-
*
|
1921
|
+
* Controlled with ZSTD_paramSwitch_e enum.
|
1922
|
+
* Default is ZSTD_ps_auto.
|
1923
|
+
* Set to ZSTD_ps_disable to never use row-based matchfinder.
|
1924
|
+
* Set to ZSTD_ps_enable to force usage of row-based matchfinder.
|
1879
1925
|
*
|
1880
|
-
* By default, in
|
1881
|
-
*
|
1882
|
-
*
|
1883
|
-
*
|
1884
|
-
* Set to ZSTD_urm_disableRowMatchFinder to never use row-based matchfinder.
|
1885
|
-
* Set to ZSTD_urm_enableRowMatchFinder to force usage of row-based matchfinder.
|
1926
|
+
* By default, in ZSTD_ps_auto, the library will decide at runtime whether to use
|
1927
|
+
* the row-based matchfinder based on support for SIMD instructions and the window log.
|
1928
|
+
* Note that this only pertains to compression strategies: greedy, lazy, and lazy2
|
1886
1929
|
*/
|
1887
1930
|
#define ZSTD_c_useRowMatchFinder ZSTD_c_experimentalParam14
|
1888
1931
|
|
@@ -1911,7 +1954,7 @@ ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* pre
|
|
1911
1954
|
* and store it into int* value.
|
1912
1955
|
* @return : 0, or an error code (which can be tested with ZSTD_isError()).
|
1913
1956
|
*/
|
1914
|
-
|
1957
|
+
ZSTDLIB_STATIC_API size_t ZSTD_CCtx_getParameter(const ZSTD_CCtx* cctx, ZSTD_cParameter param, int* value);
|
1915
1958
|
|
1916
1959
|
|
1917
1960
|
/*! ZSTD_CCtx_params :
|
@@ -1931,25 +1974,25 @@ ZSTDLIB_API size_t ZSTD_CCtx_getParameter(const ZSTD_CCtx* cctx, ZSTD_cParameter
|
|
1931
1974
|
* This can be used with ZSTD_estimateCCtxSize_advanced_usingCCtxParams()
|
1932
1975
|
* for static allocation of CCtx for single-threaded compression.
|
1933
1976
|
*/
|
1934
|
-
|
1935
|
-
|
1977
|
+
ZSTDLIB_STATIC_API ZSTD_CCtx_params* ZSTD_createCCtxParams(void);
|
1978
|
+
ZSTDLIB_STATIC_API size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params); /* accept NULL pointer */
|
1936
1979
|
|
1937
1980
|
/*! ZSTD_CCtxParams_reset() :
|
1938
1981
|
* Reset params to default values.
|
1939
1982
|
*/
|
1940
|
-
|
1983
|
+
ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_reset(ZSTD_CCtx_params* params);
|
1941
1984
|
|
1942
1985
|
/*! ZSTD_CCtxParams_init() :
|
1943
1986
|
* Initializes the compression parameters of cctxParams according to
|
1944
1987
|
* compression level. All other parameters are reset to their default values.
|
1945
1988
|
*/
|
1946
|
-
|
1989
|
+
ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel);
|
1947
1990
|
|
1948
1991
|
/*! ZSTD_CCtxParams_init_advanced() :
|
1949
1992
|
* Initializes the compression and frame parameters of cctxParams according to
|
1950
1993
|
* params. All other parameters are reset to their default values.
|
1951
1994
|
*/
|
1952
|
-
|
1995
|
+
ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params);
|
1953
1996
|
|
1954
1997
|
/*! ZSTD_CCtxParams_setParameter() : Requires v1.4.0+
|
1955
1998
|
* Similar to ZSTD_CCtx_setParameter.
|
@@ -1959,14 +2002,14 @@ ZSTDLIB_API size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, Z
|
|
1959
2002
|
* @result : a code representing success or failure (which can be tested with
|
1960
2003
|
* ZSTD_isError()).
|
1961
2004
|
*/
|
1962
|
-
|
2005
|
+
ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int value);
|
1963
2006
|
|
1964
2007
|
/*! ZSTD_CCtxParams_getParameter() :
|
1965
2008
|
* Similar to ZSTD_CCtx_getParameter.
|
1966
2009
|
* Get the requested value of one compression parameter, selected by enum ZSTD_cParameter.
|
1967
2010
|
* @result : 0, or an error code (which can be tested with ZSTD_isError()).
|
1968
2011
|
*/
|
1969
|
-
|
2012
|
+
ZSTDLIB_STATIC_API size_t ZSTD_CCtxParams_getParameter(const ZSTD_CCtx_params* params, ZSTD_cParameter param, int* value);
|
1970
2013
|
|
1971
2014
|
/*! ZSTD_CCtx_setParametersUsingCCtxParams() :
|
1972
2015
|
* Apply a set of ZSTD_CCtx_params to the compression context.
|
@@ -1975,7 +2018,7 @@ ZSTDLIB_API size_t ZSTD_CCtxParams_getParameter(const ZSTD_CCtx_params* params,
|
|
1975
2018
|
* if nbWorkers>=1, new parameters will be picked up at next job,
|
1976
2019
|
* with a few restrictions (windowLog, pledgedSrcSize, nbWorkers, jobSize, and overlapLog are not updated).
|
1977
2020
|
*/
|
1978
|
-
|
2021
|
+
ZSTDLIB_STATIC_API size_t ZSTD_CCtx_setParametersUsingCCtxParams(
|
1979
2022
|
ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params);
|
1980
2023
|
|
1981
2024
|
/*! ZSTD_compressStream2_simpleArgs() :
|
@@ -1984,7 +2027,7 @@ ZSTDLIB_API size_t ZSTD_CCtx_setParametersUsingCCtxParams(
|
|
1984
2027
|
* This variant might be helpful for binders from dynamic languages
|
1985
2028
|
* which have troubles handling structures containing memory pointers.
|
1986
2029
|
*/
|
1987
|
-
|
2030
|
+
ZSTDLIB_STATIC_API size_t ZSTD_compressStream2_simpleArgs (
|
1988
2031
|
ZSTD_CCtx* cctx,
|
1989
2032
|
void* dst, size_t dstCapacity, size_t* dstPos,
|
1990
2033
|
const void* src, size_t srcSize, size_t* srcPos,
|
@@ -2000,33 +2043,33 @@ ZSTDLIB_API size_t ZSTD_compressStream2_simpleArgs (
|
|
2000
2043
|
* Note : Frame Identifier is 4 bytes. If `size < 4`, @return will always be 0.
|
2001
2044
|
* Note 2 : Legacy Frame Identifiers are considered valid only if Legacy Support is enabled.
|
2002
2045
|
* Note 3 : Skippable Frame Identifiers are considered valid. */
|
2003
|
-
|
2046
|
+
ZSTDLIB_STATIC_API unsigned ZSTD_isFrame(const void* buffer, size_t size);
|
2004
2047
|
|
2005
2048
|
/*! ZSTD_createDDict_byReference() :
|
2006
2049
|
* Create a digested dictionary, ready to start decompression operation without startup delay.
|
2007
2050
|
* Dictionary content is referenced, and therefore stays in dictBuffer.
|
2008
2051
|
* It is important that dictBuffer outlives DDict,
|
2009
2052
|
* it must remain read accessible throughout the lifetime of DDict */
|
2010
|
-
|
2053
|
+
ZSTDLIB_STATIC_API ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize);
|
2011
2054
|
|
2012
2055
|
/*! ZSTD_DCtx_loadDictionary_byReference() :
|
2013
2056
|
* Same as ZSTD_DCtx_loadDictionary(),
|
2014
2057
|
* but references `dict` content instead of copying it into `dctx`.
|
2015
2058
|
* This saves memory if `dict` remains around.,
|
2016
2059
|
* However, it's imperative that `dict` remains accessible (and unmodified) while being used, so it must outlive decompression. */
|
2017
|
-
|
2060
|
+
ZSTDLIB_STATIC_API size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
|
2018
2061
|
|
2019
2062
|
/*! ZSTD_DCtx_loadDictionary_advanced() :
|
2020
2063
|
* Same as ZSTD_DCtx_loadDictionary(),
|
2021
2064
|
* but gives direct control over
|
2022
2065
|
* how to load the dictionary (by copy ? by reference ?)
|
2023
2066
|
* and how to interpret it (automatic ? force raw mode ? full mode only ?). */
|
2024
|
-
|
2067
|
+
ZSTDLIB_STATIC_API size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType);
|
2025
2068
|
|
2026
2069
|
/*! ZSTD_DCtx_refPrefix_advanced() :
|
2027
2070
|
* Same as ZSTD_DCtx_refPrefix(), but gives finer control over
|
2028
2071
|
* how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?) */
|
2029
|
-
|
2072
|
+
ZSTDLIB_STATIC_API size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType);
|
2030
2073
|
|
2031
2074
|
/*! ZSTD_DCtx_setMaxWindowSize() :
|
2032
2075
|
* Refuses allocating internal buffers for frames requiring a window size larger than provided limit.
|
@@ -2035,14 +2078,14 @@ ZSTDLIB_API size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* pre
|
|
2035
2078
|
* By default, a decompression context accepts all window sizes <= (1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT)
|
2036
2079
|
* @return : 0, or an error code (which can be tested using ZSTD_isError()).
|
2037
2080
|
*/
|
2038
|
-
|
2081
|
+
ZSTDLIB_STATIC_API size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize);
|
2039
2082
|
|
2040
2083
|
/*! ZSTD_DCtx_getParameter() :
|
2041
2084
|
* Get the requested decompression parameter value, selected by enum ZSTD_dParameter,
|
2042
2085
|
* and store it into int* value.
|
2043
2086
|
* @return : 0, or an error code (which can be tested with ZSTD_isError()).
|
2044
2087
|
*/
|
2045
|
-
|
2088
|
+
ZSTDLIB_STATIC_API size_t ZSTD_DCtx_getParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param, int* value);
|
2046
2089
|
|
2047
2090
|
/* ZSTD_d_format
|
2048
2091
|
* experimental parameter,
|
@@ -2131,7 +2174,7 @@ size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format);
|
|
2131
2174
|
* This can be helpful for binders from dynamic languages
|
2132
2175
|
* which have troubles handling structures containing memory pointers.
|
2133
2176
|
*/
|
2134
|
-
|
2177
|
+
ZSTDLIB_STATIC_API size_t ZSTD_decompressStream_simpleArgs (
|
2135
2178
|
ZSTD_DCtx* dctx,
|
2136
2179
|
void* dst, size_t dstCapacity, size_t* dstPos,
|
2137
2180
|
const void* src, size_t srcSize, size_t* srcPos);
|
@@ -2205,7 +2248,7 @@ size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs,
|
|
2205
2248
|
* This function is DEPRECATED, and equivalent to:
|
2206
2249
|
* ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
|
2207
2250
|
* ZSTD_CCtx_refCDict(zcs, cdict);
|
2208
|
-
*
|
2251
|
+
*
|
2209
2252
|
* note : cdict will just be referenced, and must outlive compression session
|
2210
2253
|
* This prototype will generate compilation warnings.
|
2211
2254
|
*/
|
@@ -2270,7 +2313,7 @@ typedef struct {
|
|
2270
2313
|
* Note : (ingested - consumed) is amount of input data buffered internally, not yet compressed.
|
2271
2314
|
* Aggregates progression inside active worker threads.
|
2272
2315
|
*/
|
2273
|
-
|
2316
|
+
ZSTDLIB_STATIC_API ZSTD_frameProgression ZSTD_getFrameProgression(const ZSTD_CCtx* cctx);
|
2274
2317
|
|
2275
2318
|
/*! ZSTD_toFlushNow() :
|
2276
2319
|
* Tell how many bytes are ready to be flushed immediately.
|
@@ -2285,7 +2328,7 @@ ZSTDLIB_API ZSTD_frameProgression ZSTD_getFrameProgression(const ZSTD_CCtx* cctx
|
|
2285
2328
|
* therefore flush speed is limited by production speed of oldest job
|
2286
2329
|
* irrespective of the speed of concurrent (and newer) jobs.
|
2287
2330
|
*/
|
2288
|
-
|
2331
|
+
ZSTDLIB_STATIC_API size_t ZSTD_toFlushNow(ZSTD_CCtx* cctx);
|
2289
2332
|
|
2290
2333
|
|
2291
2334
|
/*===== Advanced Streaming decompression functions =====*/
|
@@ -2299,7 +2342,7 @@ ZSTDLIB_API size_t ZSTD_toFlushNow(ZSTD_CCtx* cctx);
|
|
2299
2342
|
* note: no dictionary will be used if dict == NULL or dictSize < 8
|
2300
2343
|
* Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x
|
2301
2344
|
*/
|
2302
|
-
|
2345
|
+
ZSTDLIB_STATIC_API size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize);
|
2303
2346
|
|
2304
2347
|
/*!
|
2305
2348
|
* This function is deprecated, and is equivalent to:
|
@@ -2310,7 +2353,7 @@ ZSTDLIB_API size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dic
|
|
2310
2353
|
* note : ddict is referenced, it must outlive decompression session
|
2311
2354
|
* Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x
|
2312
2355
|
*/
|
2313
|
-
|
2356
|
+
ZSTDLIB_STATIC_API size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDict* ddict);
|
2314
2357
|
|
2315
2358
|
/*!
|
2316
2359
|
* This function is deprecated, and is equivalent to:
|
@@ -2320,7 +2363,7 @@ ZSTDLIB_API size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDi
|
|
2320
2363
|
* re-use decompression parameters from previous init; saves dictionary loading
|
2321
2364
|
* Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x
|
2322
2365
|
*/
|
2323
|
-
|
2366
|
+
ZSTDLIB_STATIC_API size_t ZSTD_resetDStream(ZSTD_DStream* zds);
|
2324
2367
|
|
2325
2368
|
|
2326
2369
|
/*********************************************************************
|
@@ -2362,13 +2405,13 @@ ZSTDLIB_API size_t ZSTD_resetDStream(ZSTD_DStream* zds);
|
|
2362
2405
|
*/
|
2363
2406
|
|
2364
2407
|
/*===== Buffer-less streaming compression functions =====*/
|
2365
|
-
|
2366
|
-
|
2367
|
-
|
2368
|
-
|
2408
|
+
ZSTDLIB_STATIC_API size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, int compressionLevel);
|
2409
|
+
ZSTDLIB_STATIC_API size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel);
|
2410
|
+
ZSTDLIB_STATIC_API size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict); /**< note: fails if cdict==NULL */
|
2411
|
+
ZSTDLIB_STATIC_API size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned long long pledgedSrcSize); /**< note: if pledgedSrcSize is not known, use ZSTD_CONTENTSIZE_UNKNOWN */
|
2369
2412
|
|
2370
|
-
|
2371
|
-
|
2413
|
+
ZSTDLIB_STATIC_API size_t ZSTD_compressContinue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
|
2414
|
+
ZSTDLIB_STATIC_API size_t ZSTD_compressEnd(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
|
2372
2415
|
|
2373
2416
|
/* The ZSTD_compressBegin_advanced() and ZSTD_compressBegin_usingCDict_advanced() are now DEPRECATED and will generate a compiler warning */
|
2374
2417
|
ZSTD_DEPRECATED("use advanced API to access custom parameters")
|
@@ -2465,24 +2508,24 @@ typedef struct {
|
|
2465
2508
|
* @return : 0, `zfhPtr` is correctly filled,
|
2466
2509
|
* >0, `srcSize` is too small, value is wanted `srcSize` amount,
|
2467
2510
|
* or an error code, which can be tested using ZSTD_isError() */
|
2468
|
-
|
2511
|
+
ZSTDLIB_STATIC_API size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize); /**< doesn't consume input */
|
2469
2512
|
/*! ZSTD_getFrameHeader_advanced() :
|
2470
2513
|
* same as ZSTD_getFrameHeader(),
|
2471
2514
|
* with added capability to select a format (like ZSTD_f_zstd1_magicless) */
|
2472
|
-
|
2473
|
-
|
2515
|
+
ZSTDLIB_STATIC_API size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize, ZSTD_format_e format);
|
2516
|
+
ZSTDLIB_STATIC_API size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize); /**< when frame content size is not known, pass in frameContentSize == ZSTD_CONTENTSIZE_UNKNOWN */
|
2474
2517
|
|
2475
|
-
|
2476
|
-
|
2477
|
-
|
2518
|
+
ZSTDLIB_STATIC_API size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx);
|
2519
|
+
ZSTDLIB_STATIC_API size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
|
2520
|
+
ZSTDLIB_STATIC_API size_t ZSTD_decompressBegin_usingDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict);
|
2478
2521
|
|
2479
|
-
|
2480
|
-
|
2522
|
+
ZSTDLIB_STATIC_API size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx* dctx);
|
2523
|
+
ZSTDLIB_STATIC_API size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
|
2481
2524
|
|
2482
2525
|
/* misc */
|
2483
|
-
|
2526
|
+
ZSTDLIB_STATIC_API void ZSTD_copyDCtx(ZSTD_DCtx* dctx, const ZSTD_DCtx* preparedDCtx);
|
2484
2527
|
typedef enum { ZSTDnit_frameHeader, ZSTDnit_blockHeader, ZSTDnit_block, ZSTDnit_lastBlock, ZSTDnit_checksum, ZSTDnit_skippableFrame } ZSTD_nextInputType_e;
|
2485
|
-
|
2528
|
+
ZSTDLIB_STATIC_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx);
|
2486
2529
|
|
2487
2530
|
|
2488
2531
|
|
@@ -2519,10 +2562,10 @@ ZSTDLIB_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx);
|
|
2519
2562
|
*/
|
2520
2563
|
|
2521
2564
|
/*===== Raw zstd block functions =====*/
|
2522
|
-
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2565
|
+
ZSTDLIB_STATIC_API size_t ZSTD_getBlockSize (const ZSTD_CCtx* cctx);
|
2566
|
+
ZSTDLIB_STATIC_API size_t ZSTD_compressBlock (ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
|
2567
|
+
ZSTDLIB_STATIC_API size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
|
2568
|
+
ZSTDLIB_STATIC_API size_t ZSTD_insertBlock (ZSTD_DCtx* dctx, const void* blockStart, size_t blockSize); /**< insert uncompressed block into `dctx` history. Useful for multi-blocks decompression. */
|
2526
2569
|
|
2527
2570
|
|
2528
2571
|
#endif /* ZSTD_H_ZSTD_STATIC_LINKING_ONLY */
|