zstd 1.1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +64 -0
- data/Rakefile +19 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/zstd +3 -0
- data/ext/zstd/extconf.rb +20 -0
- data/ext/zstd/libzstd/.gitignore +2 -0
- data/ext/zstd/libzstd/LICENSE +1262 -0
- data/ext/zstd/libzstd/Makefile +133 -0
- data/ext/zstd/libzstd/PATENTS +1272 -0
- data/ext/zstd/libzstd/README.md +77 -0
- data/ext/zstd/libzstd/common/bitstream.h +414 -0
- data/ext/zstd/libzstd/common/entropy_common.c +227 -0
- data/ext/zstd/libzstd/common/error_private.c +43 -0
- data/ext/zstd/libzstd/common/error_private.h +76 -0
- data/ext/zstd/libzstd/common/fse.h +668 -0
- data/ext/zstd/libzstd/common/fse_decompress.c +329 -0
- data/ext/zstd/libzstd/common/huf.h +238 -0
- data/ext/zstd/libzstd/common/mem.h +372 -0
- data/ext/zstd/libzstd/common/xxhash.c +867 -0
- data/ext/zstd/libzstd/common/xxhash.h +309 -0
- data/ext/zstd/libzstd/common/zstd_common.c +77 -0
- data/ext/zstd/libzstd/common/zstd_errors.h +60 -0
- data/ext/zstd/libzstd/common/zstd_internal.h +270 -0
- data/ext/zstd/libzstd/compress/fse_compress.c +850 -0
- data/ext/zstd/libzstd/compress/huf_compress.c +609 -0
- data/ext/zstd/libzstd/compress/zstd_compress.c +3291 -0
- data/ext/zstd/libzstd/compress/zstd_opt.h +919 -0
- data/ext/zstd/libzstd/decompress/huf_decompress.c +885 -0
- data/ext/zstd/libzstd/decompress/zstd_decompress.c +2154 -0
- data/ext/zstd/libzstd/deprecated/zbuff.h +210 -0
- data/ext/zstd/libzstd/deprecated/zbuff_compress.c +145 -0
- data/ext/zstd/libzstd/deprecated/zbuff_decompress.c +74 -0
- data/ext/zstd/libzstd/dictBuilder/divsufsort.c +1913 -0
- data/ext/zstd/libzstd/dictBuilder/divsufsort.h +67 -0
- data/ext/zstd/libzstd/dictBuilder/zdict.c +1012 -0
- data/ext/zstd/libzstd/dictBuilder/zdict.h +111 -0
- data/ext/zstd/libzstd/dll/example/Makefile +47 -0
- data/ext/zstd/libzstd/dll/example/README.md +69 -0
- data/ext/zstd/libzstd/dll/example/build_package.bat +17 -0
- data/ext/zstd/libzstd/dll/example/fullbench-dll.sln +25 -0
- data/ext/zstd/libzstd/dll/example/fullbench-dll.vcxproj +179 -0
- data/ext/zstd/libzstd/dll/libzstd.def +86 -0
- data/ext/zstd/libzstd/legacy/zstd_legacy.h +259 -0
- data/ext/zstd/libzstd/legacy/zstd_v01.c +2095 -0
- data/ext/zstd/libzstd/legacy/zstd_v01.h +80 -0
- data/ext/zstd/libzstd/legacy/zstd_v02.c +3518 -0
- data/ext/zstd/libzstd/legacy/zstd_v02.h +79 -0
- data/ext/zstd/libzstd/legacy/zstd_v03.c +3159 -0
- data/ext/zstd/libzstd/legacy/zstd_v03.h +79 -0
- data/ext/zstd/libzstd/legacy/zstd_v04.c +3795 -0
- data/ext/zstd/libzstd/legacy/zstd_v04.h +128 -0
- data/ext/zstd/libzstd/legacy/zstd_v05.c +4056 -0
- data/ext/zstd/libzstd/legacy/zstd_v05.h +149 -0
- data/ext/zstd/libzstd/legacy/zstd_v06.c +4167 -0
- data/ext/zstd/libzstd/legacy/zstd_v06.h +159 -0
- data/ext/zstd/libzstd/legacy/zstd_v07.c +4540 -0
- data/ext/zstd/libzstd/legacy/zstd_v07.h +173 -0
- data/ext/zstd/libzstd/libzstd.pc.in +14 -0
- data/ext/zstd/libzstd/zstd.h +673 -0
- data/ext/zstd/zstd.c +185 -0
- data/ext/zstd/zstd.h +7 -0
- data/lib/zstd/version.rb +3 -0
- data/lib/zstd.rb +6 -0
- data/zstd.gemspec +38 -0
- metadata +172 -0
@@ -0,0 +1,128 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
8
|
+
*/
|
9
|
+
|
10
|
+
#ifndef ZSTD_V04_H_91868324769238
|
11
|
+
#define ZSTD_V04_H_91868324769238
|
12
|
+
|
13
|
+
#if defined (__cplusplus)
|
14
|
+
extern "C" {
|
15
|
+
#endif
|
16
|
+
|
17
|
+
/* *************************************
|
18
|
+
* Includes
|
19
|
+
***************************************/
|
20
|
+
#include <stddef.h> /* size_t */
|
21
|
+
|
22
|
+
|
23
|
+
/* *************************************
|
24
|
+
* Simple one-step function
|
25
|
+
***************************************/
|
26
|
+
/**
|
27
|
+
ZSTDv04_decompress() : decompress ZSTD frames compliant with v0.4.x format
|
28
|
+
compressedSize : is the exact source size
|
29
|
+
maxOriginalSize : is the size of the 'dst' buffer, which must be already allocated.
|
30
|
+
It must be equal or larger than originalSize, otherwise decompression will fail.
|
31
|
+
return : the number of bytes decompressed into destination buffer (originalSize)
|
32
|
+
or an errorCode if it fails (which can be tested using ZSTDv01_isError())
|
33
|
+
*/
|
34
|
+
size_t ZSTDv04_decompress( void* dst, size_t maxOriginalSize,
|
35
|
+
const void* src, size_t compressedSize);
|
36
|
+
|
37
|
+
/**
|
38
|
+
ZSTDv04_isError() : tells if the result of ZSTDv04_decompress() is an error
|
39
|
+
*/
|
40
|
+
unsigned ZSTDv04_isError(size_t code);
|
41
|
+
|
42
|
+
|
43
|
+
/* *************************************
|
44
|
+
* Advanced functions
|
45
|
+
***************************************/
|
46
|
+
typedef struct ZSTDv04_Dctx_s ZSTDv04_Dctx;
|
47
|
+
ZSTDv04_Dctx* ZSTDv04_createDCtx(void);
|
48
|
+
size_t ZSTDv04_freeDCtx(ZSTDv04_Dctx* dctx);
|
49
|
+
|
50
|
+
size_t ZSTDv04_decompressDCtx(ZSTDv04_Dctx* dctx,
|
51
|
+
void* dst, size_t maxOriginalSize,
|
52
|
+
const void* src, size_t compressedSize);
|
53
|
+
|
54
|
+
|
55
|
+
/* *************************************
|
56
|
+
* Direct Streaming
|
57
|
+
***************************************/
|
58
|
+
size_t ZSTDv04_resetDCtx(ZSTDv04_Dctx* dctx);
|
59
|
+
|
60
|
+
size_t ZSTDv04_nextSrcSizeToDecompress(ZSTDv04_Dctx* dctx);
|
61
|
+
size_t ZSTDv04_decompressContinue(ZSTDv04_Dctx* dctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize);
|
62
|
+
/**
|
63
|
+
Use above functions alternatively.
|
64
|
+
ZSTD_nextSrcSizeToDecompress() tells how much bytes to provide as 'srcSize' to ZSTD_decompressContinue().
|
65
|
+
ZSTD_decompressContinue() will use previous data blocks to improve compression if they are located prior to current block.
|
66
|
+
Result is the number of bytes regenerated within 'dst'.
|
67
|
+
It can be zero, which is not an error; it just means ZSTD_decompressContinue() has decoded some header.
|
68
|
+
*/
|
69
|
+
|
70
|
+
|
71
|
+
/* *************************************
|
72
|
+
* Buffered Streaming
|
73
|
+
***************************************/
|
74
|
+
typedef struct ZBUFFv04_DCtx_s ZBUFFv04_DCtx;
|
75
|
+
ZBUFFv04_DCtx* ZBUFFv04_createDCtx(void);
|
76
|
+
size_t ZBUFFv04_freeDCtx(ZBUFFv04_DCtx* dctx);
|
77
|
+
|
78
|
+
size_t ZBUFFv04_decompressInit(ZBUFFv04_DCtx* dctx);
|
79
|
+
size_t ZBUFFv04_decompressWithDictionary(ZBUFFv04_DCtx* dctx, const void* dict, size_t dictSize);
|
80
|
+
|
81
|
+
size_t ZBUFFv04_decompressContinue(ZBUFFv04_DCtx* dctx, void* dst, size_t* maxDstSizePtr, const void* src, size_t* srcSizePtr);
|
82
|
+
|
83
|
+
/** ************************************************
|
84
|
+
* Streaming decompression
|
85
|
+
*
|
86
|
+
* A ZBUFF_DCtx object is required to track streaming operation.
|
87
|
+
* Use ZBUFF_createDCtx() and ZBUFF_freeDCtx() to create/release resources.
|
88
|
+
* Use ZBUFF_decompressInit() to start a new decompression operation.
|
89
|
+
* ZBUFF_DCtx objects can be reused multiple times.
|
90
|
+
*
|
91
|
+
* Optionally, a reference to a static dictionary can be set, using ZBUFF_decompressWithDictionary()
|
92
|
+
* It must be the same content as the one set during compression phase.
|
93
|
+
* Dictionary content must remain accessible during the decompression process.
|
94
|
+
*
|
95
|
+
* Use ZBUFF_decompressContinue() repetitively to consume your input.
|
96
|
+
* *srcSizePtr and *maxDstSizePtr can be any size.
|
97
|
+
* The function will report how many bytes were read or written by modifying *srcSizePtr and *maxDstSizePtr.
|
98
|
+
* Note that it may not consume the entire input, in which case it's up to the caller to present remaining input again.
|
99
|
+
* The content of dst will be overwritten (up to *maxDstSizePtr) at each function call, so save its content if it matters or change dst.
|
100
|
+
* @return : a hint to preferred nb of bytes to use as input for next function call (it's only a hint, to improve latency)
|
101
|
+
* or 0 when a frame is completely decoded
|
102
|
+
* or an error code, which can be tested using ZBUFF_isError().
|
103
|
+
*
|
104
|
+
* Hint : recommended buffer sizes (not compulsory) : ZBUFF_recommendedDInSize / ZBUFF_recommendedDOutSize
|
105
|
+
* output : ZBUFF_recommendedDOutSize==128 KB block size is the internal unit, it ensures it's always possible to write a full block when it's decoded.
|
106
|
+
* input : ZBUFF_recommendedDInSize==128Kb+3; just follow indications from ZBUFF_decompressContinue() to minimize latency. It should always be <= 128 KB + 3 .
|
107
|
+
* **************************************************/
|
108
|
+
unsigned ZBUFFv04_isError(size_t errorCode);
|
109
|
+
const char* ZBUFFv04_getErrorName(size_t errorCode);
|
110
|
+
|
111
|
+
|
112
|
+
/** The below functions provide recommended buffer sizes for Compression or Decompression operations.
|
113
|
+
* These sizes are not compulsory, they just tend to offer better latency */
|
114
|
+
size_t ZBUFFv04_recommendedDInSize(void);
|
115
|
+
size_t ZBUFFv04_recommendedDOutSize(void);
|
116
|
+
|
117
|
+
|
118
|
+
/* *************************************
|
119
|
+
* Prefix - version detection
|
120
|
+
***************************************/
|
121
|
+
#define ZSTDv04_magicNumber 0xFD2FB524 /* v0.4 */
|
122
|
+
|
123
|
+
|
124
|
+
#if defined (__cplusplus)
|
125
|
+
}
|
126
|
+
#endif
|
127
|
+
|
128
|
+
#endif /* ZSTD_V04_H_91868324769238 */
|