zstd-ruby 1.3.5.0 → 1.3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -2
- data/README.md +2 -1
- data/ext/zstdruby/libzstd/BUCK +1 -0
- data/ext/zstdruby/libzstd/Makefile +25 -13
- data/ext/zstdruby/libzstd/README.md +11 -10
- data/ext/zstdruby/libzstd/common/bitstream.h +8 -11
- data/ext/zstdruby/libzstd/common/compiler.h +30 -8
- data/ext/zstdruby/libzstd/common/cpu.h +1 -1
- data/ext/zstdruby/libzstd/common/mem.h +20 -2
- data/ext/zstdruby/libzstd/common/xxhash.c +1 -0
- data/ext/zstdruby/libzstd/common/zstd_internal.h +3 -2
- data/ext/zstdruby/libzstd/compress/fse_compress.c +55 -48
- data/ext/zstdruby/libzstd/compress/hist.h +1 -1
- data/ext/zstdruby/libzstd/compress/huf_compress.c +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_compress.c +290 -147
- data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +5 -2
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +63 -51
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.h +3 -4
- data/ext/zstdruby/libzstd/compress/zstd_fast.c +44 -33
- data/ext/zstdruby/libzstd/compress/zstd_fast.h +3 -4
- data/ext/zstdruby/libzstd/compress/zstd_lazy.c +125 -116
- data/ext/zstdruby/libzstd/compress/zstd_lazy.h +13 -15
- data/ext/zstdruby/libzstd/compress/zstd_ldm.c +9 -11
- data/ext/zstdruby/libzstd/compress/zstd_ldm.h +0 -1
- data/ext/zstdruby/libzstd/compress/zstd_opt.c +42 -36
- data/ext/zstdruby/libzstd/compress/zstd_opt.h +8 -9
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +96 -51
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +16 -6
- data/ext/zstdruby/libzstd/decompress/huf_decompress.c +3 -3
- data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +169 -101
- data/ext/zstdruby/libzstd/dictBuilder/cover.c +111 -87
- data/ext/zstdruby/libzstd/dictBuilder/cover.h +83 -0
- data/ext/zstdruby/libzstd/dictBuilder/divsufsort.c +3 -3
- data/ext/zstdruby/libzstd/dictBuilder/fastcover.c +728 -0
- data/ext/zstdruby/libzstd/dictBuilder/zdict.c +34 -31
- data/ext/zstdruby/libzstd/dictBuilder/zdict.h +60 -5
- data/ext/zstdruby/libzstd/legacy/zstd_v01.c +9 -3
- data/ext/zstdruby/libzstd/legacy/zstd_v02.c +6 -0
- data/ext/zstdruby/libzstd/legacy/zstd_v03.c +6 -0
- data/ext/zstdruby/libzstd/legacy/zstd_v04.c +1 -5
- data/ext/zstdruby/libzstd/legacy/zstd_v05.c +12 -9
- data/ext/zstdruby/libzstd/legacy/zstd_v06.c +10 -10
- data/ext/zstdruby/libzstd/legacy/zstd_v07.c +20 -18
- data/ext/zstdruby/libzstd/zstd.h +109 -50
- data/lib/zstd-ruby/version.rb +1 -1
- metadata +4 -2
@@ -2628,7 +2628,7 @@ const char* ZBUFFv07_getErrorName(size_t errorCode) { return ERR_getErrorName(er
|
|
2628
2628
|
|
2629
2629
|
|
2630
2630
|
|
2631
|
-
void* ZSTDv07_defaultAllocFunction(void* opaque, size_t size)
|
2631
|
+
static void* ZSTDv07_defaultAllocFunction(void* opaque, size_t size)
|
2632
2632
|
{
|
2633
2633
|
void* address = malloc(size);
|
2634
2634
|
(void)opaque;
|
@@ -2636,7 +2636,7 @@ void* ZSTDv07_defaultAllocFunction(void* opaque, size_t size)
|
|
2636
2636
|
return address;
|
2637
2637
|
}
|
2638
2638
|
|
2639
|
-
void ZSTDv07_defaultFreeFunction(void* opaque, void* address)
|
2639
|
+
static void ZSTDv07_defaultFreeFunction(void* opaque, void* address)
|
2640
2640
|
{
|
2641
2641
|
(void)opaque;
|
2642
2642
|
/* if (address) printf("free %p opaque=%p \n", address, opaque); */
|
@@ -3150,10 +3150,10 @@ size_t ZSTDv07_getFrameParams(ZSTDv07_frameParams* fparamsPtr, const void* src,
|
|
3150
3150
|
const BYTE* ip = (const BYTE*)src;
|
3151
3151
|
|
3152
3152
|
if (srcSize < ZSTDv07_frameHeaderSize_min) return ZSTDv07_frameHeaderSize_min;
|
3153
|
+
memset(fparamsPtr, 0, sizeof(*fparamsPtr));
|
3153
3154
|
if (MEM_readLE32(src) != ZSTDv07_MAGICNUMBER) {
|
3154
3155
|
if ((MEM_readLE32(src) & 0xFFFFFFF0U) == ZSTDv07_MAGIC_SKIPPABLE_START) {
|
3155
3156
|
if (srcSize < ZSTDv07_skippableHeaderSize) return ZSTDv07_skippableHeaderSize; /* magic number + skippable frame length */
|
3156
|
-
memset(fparamsPtr, 0, sizeof(*fparamsPtr));
|
3157
3157
|
fparamsPtr->frameContentSize = MEM_readLE32((const char *)src + 4);
|
3158
3158
|
fparamsPtr->windowSize = 0; /* windowSize==0 means a frame is skippable */
|
3159
3159
|
return 0;
|
@@ -3175,11 +3175,13 @@ size_t ZSTDv07_getFrameParams(ZSTDv07_frameParams* fparamsPtr, const void* src,
|
|
3175
3175
|
U32 windowSize = 0;
|
3176
3176
|
U32 dictID = 0;
|
3177
3177
|
U64 frameContentSize = 0;
|
3178
|
-
if ((fhdByte & 0x08) != 0)
|
3178
|
+
if ((fhdByte & 0x08) != 0) /* reserved bits, which must be zero */
|
3179
|
+
return ERROR(frameParameter_unsupported);
|
3179
3180
|
if (!directMode) {
|
3180
3181
|
BYTE const wlByte = ip[pos++];
|
3181
3182
|
U32 const windowLog = (wlByte >> 3) + ZSTDv07_WINDOWLOG_ABSOLUTEMIN;
|
3182
|
-
if (windowLog > ZSTDv07_WINDOWLOG_MAX)
|
3183
|
+
if (windowLog > ZSTDv07_WINDOWLOG_MAX)
|
3184
|
+
return ERROR(frameParameter_unsupported);
|
3183
3185
|
windowSize = (1U << windowLog);
|
3184
3186
|
windowSize += (windowSize >> 3) * (wlByte&7);
|
3185
3187
|
}
|
@@ -3201,7 +3203,8 @@ size_t ZSTDv07_getFrameParams(ZSTDv07_frameParams* fparamsPtr, const void* src,
|
|
3201
3203
|
case 3 : frameContentSize = MEM_readLE64(ip+pos); break;
|
3202
3204
|
}
|
3203
3205
|
if (!windowSize) windowSize = (U32)frameContentSize;
|
3204
|
-
if (windowSize > windowSizeMax)
|
3206
|
+
if (windowSize > windowSizeMax)
|
3207
|
+
return ERROR(frameParameter_unsupported);
|
3205
3208
|
fparamsPtr->frameContentSize = frameContentSize;
|
3206
3209
|
fparamsPtr->windowSize = windowSize;
|
3207
3210
|
fparamsPtr->dictID = dictID;
|
@@ -3220,11 +3223,10 @@ size_t ZSTDv07_getFrameParams(ZSTDv07_frameParams* fparamsPtr, const void* src,
|
|
3220
3223
|
- frame header not completely provided (`srcSize` too small) */
|
3221
3224
|
unsigned long long ZSTDv07_getDecompressedSize(const void* src, size_t srcSize)
|
3222
3225
|
{
|
3223
|
-
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
}
|
3226
|
+
ZSTDv07_frameParams fparams;
|
3227
|
+
size_t const frResult = ZSTDv07_getFrameParams(&fparams, src, srcSize);
|
3228
|
+
if (frResult!=0) return 0;
|
3229
|
+
return fparams.frameContentSize;
|
3228
3230
|
}
|
3229
3231
|
|
3230
3232
|
|
@@ -3248,7 +3250,7 @@ typedef struct
|
|
3248
3250
|
|
3249
3251
|
/*! ZSTDv07_getcBlockSize() :
|
3250
3252
|
* Provides the size of compressed block from block header `src` */
|
3251
|
-
size_t ZSTDv07_getcBlockSize(const void* src, size_t srcSize, blockProperties_t* bpPtr)
|
3253
|
+
static size_t ZSTDv07_getcBlockSize(const void* src, size_t srcSize, blockProperties_t* bpPtr)
|
3252
3254
|
{
|
3253
3255
|
const BYTE* const in = (const BYTE* const)src;
|
3254
3256
|
U32 cSize;
|
@@ -3275,7 +3277,7 @@ static size_t ZSTDv07_copyRawBlock(void* dst, size_t dstCapacity, const void* sr
|
|
3275
3277
|
|
3276
3278
|
/*! ZSTDv07_decodeLiteralsBlock() :
|
3277
3279
|
@return : nb of bytes read from src (< srcSize ) */
|
3278
|
-
size_t ZSTDv07_decodeLiteralsBlock(ZSTDv07_DCtx* dctx,
|
3280
|
+
static size_t ZSTDv07_decodeLiteralsBlock(ZSTDv07_DCtx* dctx,
|
3279
3281
|
const void* src, size_t srcSize) /* note : srcSize < BLOCKSIZE */
|
3280
3282
|
{
|
3281
3283
|
const BYTE* const istart = (const BYTE*) src;
|
@@ -3409,7 +3411,7 @@ size_t ZSTDv07_decodeLiteralsBlock(ZSTDv07_DCtx* dctx,
|
|
3409
3411
|
@return : nb bytes read from src,
|
3410
3412
|
or an error code if it fails, testable with ZSTDv07_isError()
|
3411
3413
|
*/
|
3412
|
-
size_t ZSTDv07_buildSeqTable(FSEv07_DTable* DTable, U32 type, U32 max, U32 maxLog,
|
3414
|
+
static size_t ZSTDv07_buildSeqTable(FSEv07_DTable* DTable, U32 type, U32 max, U32 maxLog,
|
3413
3415
|
const void* src, size_t srcSize,
|
3414
3416
|
const S16* defaultNorm, U32 defaultLog, U32 flagRepeatTable)
|
3415
3417
|
{
|
@@ -3439,7 +3441,7 @@ size_t ZSTDv07_buildSeqTable(FSEv07_DTable* DTable, U32 type, U32 max, U32 maxLo
|
|
3439
3441
|
}
|
3440
3442
|
|
3441
3443
|
|
3442
|
-
size_t ZSTDv07_decodeSeqHeaders(int* nbSeqPtr,
|
3444
|
+
static size_t ZSTDv07_decodeSeqHeaders(int* nbSeqPtr,
|
3443
3445
|
FSEv07_DTable* DTableLL, FSEv07_DTable* DTableML, FSEv07_DTable* DTableOffb, U32 flagRepeatTable,
|
3444
3446
|
const void* src, size_t srcSize)
|
3445
3447
|
{
|
@@ -3771,7 +3773,7 @@ ZSTDLIBv07_API size_t ZSTDv07_insertBlock(ZSTDv07_DCtx* dctx, const void* blockS
|
|
3771
3773
|
}
|
3772
3774
|
|
3773
3775
|
|
3774
|
-
size_t ZSTDv07_generateNxBytes(void* dst, size_t dstCapacity, BYTE byte, size_t length)
|
3776
|
+
static size_t ZSTDv07_generateNxBytes(void* dst, size_t dstCapacity, BYTE byte, size_t length)
|
3775
3777
|
{
|
3776
3778
|
if (length > dstCapacity) return ERROR(dstSize_tooSmall);
|
3777
3779
|
memset(dst, byte, length);
|
@@ -3851,7 +3853,7 @@ static size_t ZSTDv07_decompressFrame(ZSTDv07_DCtx* dctx,
|
|
3851
3853
|
* It avoids reloading the dictionary each time.
|
3852
3854
|
* `preparedDCtx` must have been properly initialized using ZSTDv07_decompressBegin_usingDict().
|
3853
3855
|
* Requires 2 contexts : 1 for reference (preparedDCtx), which will not be modified, and 1 to run the decompression operation (dctx) */
|
3854
|
-
size_t ZSTDv07_decompress_usingPreparedDCtx(ZSTDv07_DCtx* dctx, const ZSTDv07_DCtx* refDCtx,
|
3856
|
+
static size_t ZSTDv07_decompress_usingPreparedDCtx(ZSTDv07_DCtx* dctx, const ZSTDv07_DCtx* refDCtx,
|
3855
3857
|
void* dst, size_t dstCapacity,
|
3856
3858
|
const void* src, size_t srcSize)
|
3857
3859
|
{
|
@@ -4146,7 +4148,7 @@ struct ZSTDv07_DDict_s {
|
|
4146
4148
|
ZSTDv07_DCtx* refContext;
|
4147
4149
|
}; /* typedef'd tp ZSTDv07_CDict within zstd.h */
|
4148
4150
|
|
4149
|
-
ZSTDv07_DDict* ZSTDv07_createDDict_advanced(const void* dict, size_t dictSize, ZSTDv07_customMem customMem)
|
4151
|
+
static ZSTDv07_DDict* ZSTDv07_createDDict_advanced(const void* dict, size_t dictSize, ZSTDv07_customMem customMem)
|
4150
4152
|
{
|
4151
4153
|
if (!customMem.customAlloc && !customMem.customFree)
|
4152
4154
|
customMem = defaultCustomMem;
|
data/ext/zstdruby/libzstd/zstd.h
CHANGED
@@ -35,31 +35,43 @@ extern "C" {
|
|
35
35
|
#endif
|
36
36
|
|
37
37
|
|
38
|
-
|
38
|
+
/*******************************************************************************
|
39
39
|
Introduction
|
40
40
|
|
41
|
-
zstd, short for Zstandard, is a fast lossless compression algorithm,
|
42
|
-
|
43
|
-
The zstd compression library provides in-memory compression and decompression
|
44
|
-
|
45
|
-
|
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
|
+
|
46
52
|
Compression can be done in:
|
47
53
|
- a single step (described as Simple API)
|
48
54
|
- a single step, reusing a context (described as Explicit context)
|
49
55
|
- unbounded multiple steps (described as Streaming compression)
|
50
|
-
|
56
|
+
|
57
|
+
The compression ratio achievable on small data can be highly improved using
|
58
|
+
a dictionary. Dictionary compression can be performed in:
|
51
59
|
- a single step (described as Simple dictionary API)
|
52
|
-
- a single step, reusing a dictionary (described as Bulk-processing
|
60
|
+
- a single step, reusing a dictionary (described as Bulk-processing
|
61
|
+
dictionary API)
|
53
62
|
|
54
|
-
Advanced experimental functions can be accessed using
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
+
*******************************************************************************/
|
58
70
|
|
59
71
|
/*------ Version ------*/
|
60
72
|
#define ZSTD_VERSION_MAJOR 1
|
61
73
|
#define ZSTD_VERSION_MINOR 3
|
62
|
-
#define ZSTD_VERSION_RELEASE
|
74
|
+
#define ZSTD_VERSION_RELEASE 7
|
63
75
|
|
64
76
|
#define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE)
|
65
77
|
ZSTDLIB_API unsigned ZSTD_versionNumber(void); /**< useful to check dll version */
|
@@ -68,7 +80,7 @@ ZSTDLIB_API unsigned ZSTD_versionNumber(void); /**< useful to check dll versio
|
|
68
80
|
#define ZSTD_QUOTE(str) #str
|
69
81
|
#define ZSTD_EXPAND_AND_QUOTE(str) ZSTD_QUOTE(str)
|
70
82
|
#define ZSTD_VERSION_STRING ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION)
|
71
|
-
ZSTDLIB_API const char* ZSTD_versionString(void); /*
|
83
|
+
ZSTDLIB_API const char* ZSTD_versionString(void); /* v1.3.0+ */
|
72
84
|
|
73
85
|
/***************************************
|
74
86
|
* Default constant
|
@@ -211,7 +223,8 @@ typedef struct ZSTD_CDict_s ZSTD_CDict;
|
|
211
223
|
* When compressing multiple messages / blocks with the same dictionary, it's recommended to load it just once.
|
212
224
|
* ZSTD_createCDict() will create a digested dictionary, ready to start future compression operations without startup delay.
|
213
225
|
* ZSTD_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only.
|
214
|
-
* `dictBuffer` can be released after ZSTD_CDict creation, since its content is copied within CDict
|
226
|
+
* `dictBuffer` can be released after ZSTD_CDict creation, since its content is copied within CDict
|
227
|
+
* Note : A ZSTD_CDict can be created with an empty dictionary, but it is inefficient for small data. */
|
215
228
|
ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict(const void* dictBuffer, size_t dictSize,
|
216
229
|
int compressionLevel);
|
217
230
|
|
@@ -223,7 +236,9 @@ ZSTDLIB_API size_t ZSTD_freeCDict(ZSTD_CDict* CDict);
|
|
223
236
|
* Compression using a digested Dictionary.
|
224
237
|
* Faster startup than ZSTD_compress_usingDict(), recommended when same dictionary is used multiple times.
|
225
238
|
* Note that compression level is decided during dictionary creation.
|
226
|
-
* Frame parameters are hardcoded (dictID=yes, contentSize=yes, checksum=no)
|
239
|
+
* Frame parameters are hardcoded (dictID=yes, contentSize=yes, checksum=no)
|
240
|
+
* Note : ZSTD_compress_usingCDict() can be used with a ZSTD_CDict created from an empty dictionary.
|
241
|
+
* But it is inefficient for small data, and it is recommended to use ZSTD_compressCCtx(). */
|
227
242
|
ZSTDLIB_API size_t ZSTD_compress_usingCDict(ZSTD_CCtx* cctx,
|
228
243
|
void* dst, size_t dstCapacity,
|
229
244
|
const void* src, size_t srcSize,
|
@@ -315,7 +330,7 @@ typedef struct ZSTD_outBuffer_s {
|
|
315
330
|
* *******************************************************************/
|
316
331
|
|
317
332
|
typedef ZSTD_CCtx ZSTD_CStream; /**< CCtx and CStream are now effectively same object (>= v1.3.0) */
|
318
|
-
/* Continue to distinguish them for compatibility with versions <= v1.2.0 */
|
333
|
+
/* Continue to distinguish them for compatibility with older versions <= v1.2.0 */
|
319
334
|
/*===== ZSTD_CStream management functions =====*/
|
320
335
|
ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream(void);
|
321
336
|
ZSTDLIB_API size_t ZSTD_freeCStream(ZSTD_CStream* zcs);
|
@@ -346,15 +361,21 @@ ZSTDLIB_API size_t ZSTD_CStreamOutSize(void); /**< recommended size for output
|
|
346
361
|
* The function will update both `pos` fields.
|
347
362
|
* If `input.pos < input.size`, some input has not been consumed.
|
348
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.
|
349
365
|
* If `output.pos < output.size`, decoder has flushed everything it could.
|
350
|
-
*
|
351
|
-
*
|
352
|
-
*
|
353
|
-
*
|
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.
|
354
375
|
* *******************************************************************************/
|
355
376
|
|
356
377
|
typedef ZSTD_DCtx ZSTD_DStream; /**< DCtx and DStream are now effectively same object (>= v1.3.0) */
|
357
|
-
/* For compatibility with versions <= v1.2.0,
|
378
|
+
/* For compatibility with versions <= v1.2.0, prefer differentiating them. */
|
358
379
|
/*===== ZSTD_DStream management functions =====*/
|
359
380
|
ZSTDLIB_API ZSTD_DStream* ZSTD_createDStream(void);
|
360
381
|
ZSTDLIB_API size_t ZSTD_freeDStream(ZSTD_DStream* zds);
|
@@ -370,21 +391,28 @@ ZSTDLIB_API size_t ZSTD_DStreamOutSize(void); /*!< recommended size for output
|
|
370
391
|
|
371
392
|
|
372
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
|
+
|
373
398
|
/****************************************************************************************
|
374
|
-
*
|
399
|
+
* ADVANCED AND EXPERIMENTAL FUNCTIONS
|
400
|
+
****************************************************************************************
|
375
401
|
* The definitions in this section are considered experimental.
|
376
402
|
* They should never be used with a dynamic library, as prototypes may change in the future.
|
377
403
|
* They are provided for advanced scenarios.
|
378
404
|
* Use them only in association with static linking.
|
379
405
|
* ***************************************************************************************/
|
380
406
|
|
381
|
-
|
382
|
-
#define ZSTD_H_ZSTD_STATIC_LINKING_ONLY
|
407
|
+
ZSTDLIB_API int ZSTD_minCLevel(void); /*!< minimum negative compression level allowed */
|
383
408
|
|
384
|
-
/* ---
|
385
|
-
#define ZSTD_MAGICNUMBER 0xFD2FB528 /*
|
409
|
+
/* --- Constants ---*/
|
410
|
+
#define ZSTD_MAGICNUMBER 0xFD2FB528 /* v0.8+ */
|
411
|
+
#define ZSTD_MAGIC_DICTIONARY 0xEC30A437 /* v0.7+ */
|
386
412
|
#define ZSTD_MAGIC_SKIPPABLE_START 0x184D2A50U
|
387
|
-
|
413
|
+
|
414
|
+
#define ZSTD_BLOCKSIZELOG_MAX 17
|
415
|
+
#define ZSTD_BLOCKSIZE_MAX (1<<ZSTD_BLOCKSIZELOG_MAX) /* define, for static allocation */
|
388
416
|
|
389
417
|
#define ZSTD_WINDOWLOG_MAX_32 30
|
390
418
|
#define ZSTD_WINDOWLOG_MAX_64 31
|
@@ -401,8 +429,10 @@ ZSTDLIB_API size_t ZSTD_DStreamOutSize(void); /*!< recommended size for output
|
|
401
429
|
#define ZSTD_SEARCHLOG_MIN 1
|
402
430
|
#define ZSTD_SEARCHLENGTH_MAX 7 /* only for ZSTD_fast, other strategies are limited to 6 */
|
403
431
|
#define ZSTD_SEARCHLENGTH_MIN 3 /* only for ZSTD_btopt, other strategies are limited to 4 */
|
404
|
-
#define
|
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 */
|
405
434
|
#define ZSTD_LDM_MINMATCH_MAX 4096
|
435
|
+
#define ZSTD_LDM_MINMATCH_MIN 4
|
406
436
|
#define ZSTD_LDM_BUCKETSIZELOG_MAX 8
|
407
437
|
|
408
438
|
#define ZSTD_FRAMEHEADERSIZE_PREFIX 5 /* minimum input size to know frame header size */
|
@@ -414,7 +444,8 @@ static const size_t ZSTD_frameHeaderSize_max = ZSTD_FRAMEHEADERSIZE_MAX;
|
|
414
444
|
static const size_t ZSTD_skippableHeaderSize = 8; /* magic number + skippable frame length */
|
415
445
|
|
416
446
|
|
417
|
-
|
447
|
+
|
448
|
+
/* --- Advanced types --- */
|
418
449
|
typedef enum { ZSTD_fast=1, ZSTD_dfast, ZSTD_greedy, ZSTD_lazy, ZSTD_lazy2,
|
419
450
|
ZSTD_btlazy2, ZSTD_btopt, ZSTD_btultra } ZSTD_strategy; /* from faster to stronger */
|
420
451
|
|
@@ -489,7 +520,7 @@ ZSTDLIB_API size_t ZSTD_findFrameCompressedSize(const void* src, size_t srcSize)
|
|
489
520
|
* however it does mean that all frame data must be present and valid. */
|
490
521
|
ZSTDLIB_API unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize);
|
491
522
|
|
492
|
-
|
523
|
+
/*! ZSTD_frameHeaderSize() :
|
493
524
|
* srcSize must be >= ZSTD_frameHeaderSize_prefix.
|
494
525
|
* @return : size of the Frame Header,
|
495
526
|
* or an error code (if srcSize is too small) */
|
@@ -721,29 +752,48 @@ ZSTDLIB_API size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs, const
|
|
721
752
|
|
722
753
|
/*! ZSTD_resetCStream() :
|
723
754
|
* start a new compression job, using same parameters from previous job.
|
724
|
-
* This is typically useful to skip dictionary loading stage, since it will re-use it in-place
|
755
|
+
* This is typically useful to skip dictionary loading stage, since it will re-use it in-place.
|
725
756
|
* Note that zcs must be init at least once before using ZSTD_resetCStream().
|
726
757
|
* If pledgedSrcSize is not known at reset time, use macro ZSTD_CONTENTSIZE_UNKNOWN.
|
727
758
|
* If pledgedSrcSize > 0, its value must be correct, as it will be written in header, and controlled at the end.
|
728
759
|
* For the time being, pledgedSrcSize==0 is interpreted as "srcSize unknown" for compatibility with older programs,
|
729
760
|
* but it will change to mean "empty" in future version, so use macro ZSTD_CONTENTSIZE_UNKNOWN instead.
|
730
|
-
* @return : 0, or an error code (which can be tested using ZSTD_isError())
|
761
|
+
* @return : 0, or an error code (which can be tested using ZSTD_isError())
|
762
|
+
*/
|
731
763
|
ZSTDLIB_API size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize);
|
732
764
|
|
733
765
|
|
734
766
|
typedef struct {
|
735
|
-
unsigned long long ingested;
|
736
|
-
unsigned long long consumed;
|
737
|
-
unsigned long long produced;
|
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 */
|
738
773
|
} ZSTD_frameProgression;
|
739
774
|
|
740
|
-
/* ZSTD_getFrameProgression():
|
775
|
+
/* ZSTD_getFrameProgression() :
|
741
776
|
* tells how much data has been ingested (read from input)
|
742
777
|
* consumed (input actually compressed) and produced (output) for current frame.
|
743
|
-
*
|
744
|
-
*
|
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
|
+
|
783
|
+
/*! ZSTD_toFlushNow() :
|
784
|
+
* Tell how many bytes are ready to be flushed immediately.
|
785
|
+
* Useful for multithreading scenarios (nbWorkers >= 1).
|
786
|
+
* Probe the oldest active job, defined as oldest job not yet entirely flushed,
|
787
|
+
* and check its output buffer.
|
788
|
+
* @return : amount of data stored in oldest job and ready to be flushed immediately.
|
789
|
+
* if @return == 0, it means either :
|
790
|
+
* + there is no active job (could be checked with ZSTD_frameProgression()), or
|
791
|
+
* + oldest job is still actively compressing data,
|
792
|
+
* but everything it has produced has also been flushed so far,
|
793
|
+
* therefore flushing speed is currently limited by production speed of oldest job
|
794
|
+
* irrespective of the speed of concurrent newer jobs.
|
745
795
|
*/
|
746
|
-
|
796
|
+
ZSTDLIB_API size_t ZSTD_toFlushNow(ZSTD_CCtx* cctx);
|
747
797
|
|
748
798
|
|
749
799
|
|
@@ -1149,16 +1199,21 @@ ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict);
|
|
1149
1199
|
|
1150
1200
|
/*! ZSTD_CCtx_refPrefix() :
|
1151
1201
|
* Reference a prefix (single-usage dictionary) for next compression job.
|
1152
|
-
* Decompression need same prefix to properly regenerate data.
|
1153
|
-
*
|
1202
|
+
* Decompression will need same prefix to properly regenerate data.
|
1203
|
+
* Compressing with a prefix is similar in outcome as performing a diff and compressing it,
|
1204
|
+
* but performs much faster, especially during decompression (compression speed is tunable with compression level).
|
1205
|
+
* Note that prefix is **only used once**. Tables are discarded at end of compression job (ZSTD_e_end).
|
1154
1206
|
* @result : 0, or an error code (which can be tested with ZSTD_isError()).
|
1155
1207
|
* Special: Adding any prefix (including NULL) invalidates any previous prefix or dictionary
|
1156
1208
|
* Note 1 : Prefix buffer is referenced. It **must** outlive compression job.
|
1157
1209
|
* Its contain must remain unmodified up to end of compression (ZSTD_e_end).
|
1158
|
-
* Note 2 :
|
1210
|
+
* Note 2 : If the intention is to diff some large src data blob with some prior version of itself,
|
1211
|
+
* ensure that the window size is large enough to contain the entire source.
|
1212
|
+
* See ZSTD_p_windowLog.
|
1213
|
+
* Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters.
|
1159
1214
|
* It's a CPU consuming operation, with non-negligible impact on latency.
|
1160
1215
|
* If there is a need to use same prefix multiple times, consider loadDictionary instead.
|
1161
|
-
* Note
|
1216
|
+
* Note 4 : By default, the prefix is treated as raw content (ZSTD_dm_rawContent).
|
1162
1217
|
* Use ZSTD_CCtx_refPrefix_advanced() to alter dictMode. */
|
1163
1218
|
ZSTDLIB_API size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx,
|
1164
1219
|
const void* prefix, size_t prefixSize);
|
@@ -1186,9 +1241,13 @@ ZSTDLIB_API size_t ZSTD_CCtx_resetParameters(ZSTD_CCtx* cctx);
|
|
1186
1241
|
|
1187
1242
|
|
1188
1243
|
typedef enum {
|
1189
|
-
ZSTD_e_continue=0, /* collect more data, encoder decides when to output compressed result, for optimal
|
1190
|
-
ZSTD_e_flush, /* flush any data provided so far
|
1191
|
-
|
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). */
|
1192
1251
|
} ZSTD_EndDirective;
|
1193
1252
|
|
1194
1253
|
/*! ZSTD_compress_generic() :
|
@@ -1341,6 +1400,8 @@ ZSTDLIB_API size_t ZSTD_DCtx_refDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict);
|
|
1341
1400
|
|
1342
1401
|
/*! ZSTD_DCtx_refPrefix() :
|
1343
1402
|
* Reference a prefix (single-usage dictionary) for next compression job.
|
1403
|
+
* This is the reverse operation of ZSTD_CCtx_refPrefix(),
|
1404
|
+
* and must use the same prefix as the one used during compression.
|
1344
1405
|
* Prefix is **only used once**. Reference is discarded at end of frame.
|
1345
1406
|
* End of frame is reached when ZSTD_DCtx_decompress_generic() returns 0.
|
1346
1407
|
* @result : 0, or an error code (which can be tested with ZSTD_isError()).
|
@@ -1379,7 +1440,7 @@ ZSTDLIB_API size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowS
|
|
1379
1440
|
ZSTDLIB_API size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format);
|
1380
1441
|
|
1381
1442
|
|
1382
|
-
|
1443
|
+
/*! ZSTD_getFrameHeader_advanced() :
|
1383
1444
|
* same as ZSTD_getFrameHeader(),
|
1384
1445
|
* with added capability to select a format (like ZSTD_f_zstd1_magicless) */
|
1385
1446
|
ZSTDLIB_API size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr,
|
@@ -1451,8 +1512,6 @@ ZSTDLIB_API void ZSTD_DCtx_reset(ZSTD_DCtx* dctx);
|
|
1451
1512
|
Use ZSTD_insertBlock() for such a case.
|
1452
1513
|
*/
|
1453
1514
|
|
1454
|
-
#define ZSTD_BLOCKSIZELOG_MAX 17
|
1455
|
-
#define ZSTD_BLOCKSIZE_MAX (1<<ZSTD_BLOCKSIZELOG_MAX) /* define, for static allocation */
|
1456
1515
|
/*===== Raw zstd block functions =====*/
|
1457
1516
|
ZSTDLIB_API size_t ZSTD_getBlockSize (const ZSTD_CCtx* cctx);
|
1458
1517
|
ZSTDLIB_API size_t ZSTD_compressBlock (ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
|
data/lib/zstd-ruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zstd-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SpringMT
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -137,8 +137,10 @@ files:
|
|
137
137
|
- ext/zstdruby/libzstd/deprecated/zbuff_compress.c
|
138
138
|
- ext/zstdruby/libzstd/deprecated/zbuff_decompress.c
|
139
139
|
- ext/zstdruby/libzstd/dictBuilder/cover.c
|
140
|
+
- ext/zstdruby/libzstd/dictBuilder/cover.h
|
140
141
|
- ext/zstdruby/libzstd/dictBuilder/divsufsort.c
|
141
142
|
- ext/zstdruby/libzstd/dictBuilder/divsufsort.h
|
143
|
+
- ext/zstdruby/libzstd/dictBuilder/fastcover.c
|
142
144
|
- ext/zstdruby/libzstd/dictBuilder/zdict.c
|
143
145
|
- ext/zstdruby/libzstd/dictBuilder/zdict.h
|
144
146
|
- ext/zstdruby/libzstd/dll/example/Makefile
|