zstd 1.1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.travis.yml +5 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +64 -0
  7. data/Rakefile +19 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +8 -0
  10. data/exe/zstd +3 -0
  11. data/ext/zstd/extconf.rb +20 -0
  12. data/ext/zstd/libzstd/.gitignore +2 -0
  13. data/ext/zstd/libzstd/LICENSE +1262 -0
  14. data/ext/zstd/libzstd/Makefile +133 -0
  15. data/ext/zstd/libzstd/PATENTS +1272 -0
  16. data/ext/zstd/libzstd/README.md +77 -0
  17. data/ext/zstd/libzstd/common/bitstream.h +414 -0
  18. data/ext/zstd/libzstd/common/entropy_common.c +227 -0
  19. data/ext/zstd/libzstd/common/error_private.c +43 -0
  20. data/ext/zstd/libzstd/common/error_private.h +76 -0
  21. data/ext/zstd/libzstd/common/fse.h +668 -0
  22. data/ext/zstd/libzstd/common/fse_decompress.c +329 -0
  23. data/ext/zstd/libzstd/common/huf.h +238 -0
  24. data/ext/zstd/libzstd/common/mem.h +372 -0
  25. data/ext/zstd/libzstd/common/xxhash.c +867 -0
  26. data/ext/zstd/libzstd/common/xxhash.h +309 -0
  27. data/ext/zstd/libzstd/common/zstd_common.c +77 -0
  28. data/ext/zstd/libzstd/common/zstd_errors.h +60 -0
  29. data/ext/zstd/libzstd/common/zstd_internal.h +270 -0
  30. data/ext/zstd/libzstd/compress/fse_compress.c +850 -0
  31. data/ext/zstd/libzstd/compress/huf_compress.c +609 -0
  32. data/ext/zstd/libzstd/compress/zstd_compress.c +3291 -0
  33. data/ext/zstd/libzstd/compress/zstd_opt.h +919 -0
  34. data/ext/zstd/libzstd/decompress/huf_decompress.c +885 -0
  35. data/ext/zstd/libzstd/decompress/zstd_decompress.c +2154 -0
  36. data/ext/zstd/libzstd/deprecated/zbuff.h +210 -0
  37. data/ext/zstd/libzstd/deprecated/zbuff_compress.c +145 -0
  38. data/ext/zstd/libzstd/deprecated/zbuff_decompress.c +74 -0
  39. data/ext/zstd/libzstd/dictBuilder/divsufsort.c +1913 -0
  40. data/ext/zstd/libzstd/dictBuilder/divsufsort.h +67 -0
  41. data/ext/zstd/libzstd/dictBuilder/zdict.c +1012 -0
  42. data/ext/zstd/libzstd/dictBuilder/zdict.h +111 -0
  43. data/ext/zstd/libzstd/dll/example/Makefile +47 -0
  44. data/ext/zstd/libzstd/dll/example/README.md +69 -0
  45. data/ext/zstd/libzstd/dll/example/build_package.bat +17 -0
  46. data/ext/zstd/libzstd/dll/example/fullbench-dll.sln +25 -0
  47. data/ext/zstd/libzstd/dll/example/fullbench-dll.vcxproj +179 -0
  48. data/ext/zstd/libzstd/dll/libzstd.def +86 -0
  49. data/ext/zstd/libzstd/legacy/zstd_legacy.h +259 -0
  50. data/ext/zstd/libzstd/legacy/zstd_v01.c +2095 -0
  51. data/ext/zstd/libzstd/legacy/zstd_v01.h +80 -0
  52. data/ext/zstd/libzstd/legacy/zstd_v02.c +3518 -0
  53. data/ext/zstd/libzstd/legacy/zstd_v02.h +79 -0
  54. data/ext/zstd/libzstd/legacy/zstd_v03.c +3159 -0
  55. data/ext/zstd/libzstd/legacy/zstd_v03.h +79 -0
  56. data/ext/zstd/libzstd/legacy/zstd_v04.c +3795 -0
  57. data/ext/zstd/libzstd/legacy/zstd_v04.h +128 -0
  58. data/ext/zstd/libzstd/legacy/zstd_v05.c +4056 -0
  59. data/ext/zstd/libzstd/legacy/zstd_v05.h +149 -0
  60. data/ext/zstd/libzstd/legacy/zstd_v06.c +4167 -0
  61. data/ext/zstd/libzstd/legacy/zstd_v06.h +159 -0
  62. data/ext/zstd/libzstd/legacy/zstd_v07.c +4540 -0
  63. data/ext/zstd/libzstd/legacy/zstd_v07.h +173 -0
  64. data/ext/zstd/libzstd/libzstd.pc.in +14 -0
  65. data/ext/zstd/libzstd/zstd.h +673 -0
  66. data/ext/zstd/zstd.c +185 -0
  67. data/ext/zstd/zstd.h +7 -0
  68. data/lib/zstd/version.rb +3 -0
  69. data/lib/zstd.rb +6 -0
  70. data/zstd.gemspec +38 -0
  71. metadata +172 -0
@@ -0,0 +1,173 @@
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 ZSTDv07_H_235446
11
+ #define ZSTDv07_H_235446
12
+
13
+ #if defined (__cplusplus)
14
+ extern "C" {
15
+ #endif
16
+
17
+ /*====== Dependency ======*/
18
+ #include <stddef.h> /* size_t */
19
+
20
+
21
+ /*====== Export for Windows ======*/
22
+ /*!
23
+ * ZSTDv07_DLL_EXPORT :
24
+ * Enable exporting of functions when building a Windows DLL
25
+ */
26
+ #if defined(_WIN32) && defined(ZSTDv07_DLL_EXPORT) && (ZSTDv07_DLL_EXPORT==1)
27
+ # define ZSTDLIBv07_API __declspec(dllexport)
28
+ #else
29
+ # define ZSTDLIBv07_API
30
+ #endif
31
+
32
+
33
+ /* *************************************
34
+ * Simple API
35
+ ***************************************/
36
+ /*! ZSTDv07_getDecompressedSize() :
37
+ * @return : decompressed size if known, 0 otherwise.
38
+ note 1 : if `0`, follow up with ZSTDv07_getFrameParams() to know precise failure cause.
39
+ note 2 : decompressed size could be wrong or intentionally modified !
40
+ always ensure results fit within application's authorized limits */
41
+ unsigned long long ZSTDv07_getDecompressedSize(const void* src, size_t srcSize);
42
+
43
+ /*! ZSTDv07_decompress() :
44
+ `compressedSize` : must be _exact_ size of compressed input, otherwise decompression will fail.
45
+ `dstCapacity` must be equal or larger than originalSize.
46
+ @return : the number of bytes decompressed into `dst` (<= `dstCapacity`),
47
+ or an errorCode if it fails (which can be tested using ZSTDv07_isError()) */
48
+ ZSTDLIBv07_API size_t ZSTDv07_decompress( void* dst, size_t dstCapacity,
49
+ const void* src, size_t compressedSize);
50
+
51
+ /*====== Helper functions ======*/
52
+ ZSTDLIBv07_API unsigned ZSTDv07_isError(size_t code); /*!< tells if a `size_t` function result is an error code */
53
+ ZSTDLIBv07_API const char* ZSTDv07_getErrorName(size_t code); /*!< provides readable string from an error code */
54
+
55
+
56
+ /*-*************************************
57
+ * Explicit memory management
58
+ ***************************************/
59
+ /** Decompression context */
60
+ typedef struct ZSTDv07_DCtx_s ZSTDv07_DCtx;
61
+ ZSTDLIBv07_API ZSTDv07_DCtx* ZSTDv07_createDCtx(void);
62
+ ZSTDLIBv07_API size_t ZSTDv07_freeDCtx(ZSTDv07_DCtx* dctx); /*!< @return : errorCode */
63
+
64
+ /** ZSTDv07_decompressDCtx() :
65
+ * Same as ZSTDv07_decompress(), requires an allocated ZSTDv07_DCtx (see ZSTDv07_createDCtx()) */
66
+ ZSTDLIBv07_API size_t ZSTDv07_decompressDCtx(ZSTDv07_DCtx* ctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
67
+
68
+
69
+ /*-************************
70
+ * Simple dictionary API
71
+ ***************************/
72
+ /*! ZSTDv07_decompress_usingDict() :
73
+ * Decompression using a pre-defined Dictionary content (see dictBuilder).
74
+ * Dictionary must be identical to the one used during compression.
75
+ * Note : This function load the dictionary, resulting in a significant startup time */
76
+ ZSTDLIBv07_API size_t ZSTDv07_decompress_usingDict(ZSTDv07_DCtx* dctx,
77
+ void* dst, size_t dstCapacity,
78
+ const void* src, size_t srcSize,
79
+ const void* dict,size_t dictSize);
80
+
81
+
82
+ /*-**************************
83
+ * Advanced Dictionary API
84
+ ****************************/
85
+ /*! ZSTDv07_createDDict() :
86
+ * Create a digested dictionary, ready to start decompression operation without startup delay.
87
+ * `dict` can be released after creation */
88
+ typedef struct ZSTDv07_DDict_s ZSTDv07_DDict;
89
+ ZSTDLIBv07_API ZSTDv07_DDict* ZSTDv07_createDDict(const void* dict, size_t dictSize);
90
+ ZSTDLIBv07_API size_t ZSTDv07_freeDDict(ZSTDv07_DDict* ddict);
91
+
92
+ /*! ZSTDv07_decompress_usingDDict() :
93
+ * Decompression using a pre-digested Dictionary
94
+ * Faster startup than ZSTDv07_decompress_usingDict(), recommended when same dictionary is used multiple times. */
95
+ ZSTDLIBv07_API size_t ZSTDv07_decompress_usingDDict(ZSTDv07_DCtx* dctx,
96
+ void* dst, size_t dstCapacity,
97
+ const void* src, size_t srcSize,
98
+ const ZSTDv07_DDict* ddict);
99
+
100
+ typedef struct {
101
+ unsigned long long frameContentSize;
102
+ unsigned windowSize;
103
+ unsigned dictID;
104
+ unsigned checksumFlag;
105
+ } ZSTDv07_frameParams;
106
+
107
+ ZSTDLIBv07_API size_t ZSTDv07_getFrameParams(ZSTDv07_frameParams* fparamsPtr, const void* src, size_t srcSize); /**< doesn't consume input */
108
+
109
+
110
+
111
+
112
+ /* *************************************
113
+ * Streaming functions
114
+ ***************************************/
115
+ typedef struct ZBUFFv07_DCtx_s ZBUFFv07_DCtx;
116
+ ZSTDLIBv07_API ZBUFFv07_DCtx* ZBUFFv07_createDCtx(void);
117
+ ZSTDLIBv07_API size_t ZBUFFv07_freeDCtx(ZBUFFv07_DCtx* dctx);
118
+
119
+ ZSTDLIBv07_API size_t ZBUFFv07_decompressInit(ZBUFFv07_DCtx* dctx);
120
+ ZSTDLIBv07_API size_t ZBUFFv07_decompressInitDictionary(ZBUFFv07_DCtx* dctx, const void* dict, size_t dictSize);
121
+
122
+ ZSTDLIBv07_API size_t ZBUFFv07_decompressContinue(ZBUFFv07_DCtx* dctx,
123
+ void* dst, size_t* dstCapacityPtr,
124
+ const void* src, size_t* srcSizePtr);
125
+
126
+ /*-***************************************************************************
127
+ * Streaming decompression howto
128
+ *
129
+ * A ZBUFFv07_DCtx object is required to track streaming operations.
130
+ * Use ZBUFFv07_createDCtx() and ZBUFFv07_freeDCtx() to create/release resources.
131
+ * Use ZBUFFv07_decompressInit() to start a new decompression operation,
132
+ * or ZBUFFv07_decompressInitDictionary() if decompression requires a dictionary.
133
+ * Note that ZBUFFv07_DCtx objects can be re-init multiple times.
134
+ *
135
+ * Use ZBUFFv07_decompressContinue() repetitively to consume your input.
136
+ * *srcSizePtr and *dstCapacityPtr can be any size.
137
+ * The function will report how many bytes were read or written by modifying *srcSizePtr and *dstCapacityPtr.
138
+ * Note that it may not consume the entire input, in which case it's up to the caller to present remaining input again.
139
+ * The content of `dst` will be overwritten (up to *dstCapacityPtr) at each function call, so save its content if it matters, or change `dst`.
140
+ * @return : a hint to preferred nb of bytes to use as input for next function call (it's only a hint, to help latency),
141
+ * or 0 when a frame is completely decoded,
142
+ * or an error code, which can be tested using ZBUFFv07_isError().
143
+ *
144
+ * Hint : recommended buffer sizes (not compulsory) : ZBUFFv07_recommendedDInSize() and ZBUFFv07_recommendedDOutSize()
145
+ * output : ZBUFFv07_recommendedDOutSize== 128 KB block size is the internal unit, it ensures it's always possible to write a full block when decoded.
146
+ * input : ZBUFFv07_recommendedDInSize == 128KB + 3;
147
+ * just follow indications from ZBUFFv07_decompressContinue() to minimize latency. It should always be <= 128 KB + 3 .
148
+ * *******************************************************************************/
149
+
150
+
151
+ /* *************************************
152
+ * Tool functions
153
+ ***************************************/
154
+ ZSTDLIBv07_API unsigned ZBUFFv07_isError(size_t errorCode);
155
+ ZSTDLIBv07_API const char* ZBUFFv07_getErrorName(size_t errorCode);
156
+
157
+ /** Functions below provide recommended buffer sizes for Compression or Decompression operations.
158
+ * These sizes are just hints, they tend to offer better latency */
159
+ ZSTDLIBv07_API size_t ZBUFFv07_recommendedDInSize(void);
160
+ ZSTDLIBv07_API size_t ZBUFFv07_recommendedDOutSize(void);
161
+
162
+
163
+ /*-*************************************
164
+ * Constants
165
+ ***************************************/
166
+ #define ZSTDv07_MAGICNUMBER 0xFD2FB527 /* v0.7 */
167
+
168
+
169
+ #if defined (__cplusplus)
170
+ }
171
+ #endif
172
+
173
+ #endif /* ZSTDv07_H_235446 */
@@ -0,0 +1,14 @@
1
+ # ZSTD - standard compression algorithm
2
+ # Copyright (C) 2014-2016, Yann Collet, Facebook
3
+ # BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
4
+
5
+ prefix=@PREFIX@
6
+ libdir=@LIBDIR@
7
+ includedir=@INCLUDEDIR@
8
+
9
+ Name: zstd
10
+ Description: fast lossless compression algorithm library
11
+ URL: http://www.zstd.net/
12
+ Version: @VERSION@
13
+ Libs: -L${libdir} -lzstd
14
+ Cflags: -I${includedir}