zstd-ruby 1.4.5.0 → 1.5.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/README.md +78 -5
  4. data/Rakefile +8 -2
  5. data/ext/zstdruby/common.h +15 -0
  6. data/ext/zstdruby/extconf.rb +3 -2
  7. data/ext/zstdruby/libzstd/common/allocations.h +55 -0
  8. data/ext/zstdruby/libzstd/common/bits.h +200 -0
  9. data/ext/zstdruby/libzstd/common/bitstream.h +45 -62
  10. data/ext/zstdruby/libzstd/common/compiler.h +205 -22
  11. data/ext/zstdruby/libzstd/common/cpu.h +1 -3
  12. data/ext/zstdruby/libzstd/common/debug.c +1 -1
  13. data/ext/zstdruby/libzstd/common/debug.h +12 -19
  14. data/ext/zstdruby/libzstd/common/entropy_common.c +172 -48
  15. data/ext/zstdruby/libzstd/common/error_private.c +10 -2
  16. data/ext/zstdruby/libzstd/common/error_private.h +82 -3
  17. data/ext/zstdruby/libzstd/common/fse.h +37 -86
  18. data/ext/zstdruby/libzstd/common/fse_decompress.c +117 -92
  19. data/ext/zstdruby/libzstd/common/huf.h +99 -166
  20. data/ext/zstdruby/libzstd/common/mem.h +124 -142
  21. data/ext/zstdruby/libzstd/common/pool.c +54 -27
  22. data/ext/zstdruby/libzstd/common/pool.h +10 -4
  23. data/ext/zstdruby/libzstd/common/portability_macros.h +156 -0
  24. data/ext/zstdruby/libzstd/common/threading.c +74 -19
  25. data/ext/zstdruby/libzstd/common/threading.h +5 -10
  26. data/ext/zstdruby/libzstd/common/xxhash.c +7 -847
  27. data/ext/zstdruby/libzstd/common/xxhash.h +5568 -167
  28. data/ext/zstdruby/libzstd/common/zstd_common.c +2 -37
  29. data/ext/zstdruby/libzstd/common/zstd_deps.h +111 -0
  30. data/ext/zstdruby/libzstd/common/zstd_internal.h +132 -187
  31. data/ext/zstdruby/libzstd/common/zstd_trace.h +163 -0
  32. data/ext/zstdruby/libzstd/compress/clevels.h +134 -0
  33. data/ext/zstdruby/libzstd/compress/fse_compress.c +83 -157
  34. data/ext/zstdruby/libzstd/compress/hist.c +27 -29
  35. data/ext/zstdruby/libzstd/compress/hist.h +2 -2
  36. data/ext/zstdruby/libzstd/compress/huf_compress.c +916 -279
  37. data/ext/zstdruby/libzstd/compress/zstd_compress.c +3773 -1019
  38. data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +610 -203
  39. data/ext/zstdruby/libzstd/compress/zstd_compress_literals.c +119 -42
  40. data/ext/zstdruby/libzstd/compress/zstd_compress_literals.h +16 -6
  41. data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +42 -19
  42. data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.h +1 -1
  43. data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +49 -317
  44. data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.h +1 -1
  45. data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +320 -103
  46. data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +388 -151
  47. data/ext/zstdruby/libzstd/compress/zstd_double_fast.h +3 -2
  48. data/ext/zstdruby/libzstd/compress/zstd_fast.c +729 -265
  49. data/ext/zstdruby/libzstd/compress/zstd_fast.h +3 -2
  50. data/ext/zstdruby/libzstd/compress/zstd_lazy.c +1270 -251
  51. data/ext/zstdruby/libzstd/compress/zstd_lazy.h +61 -1
  52. data/ext/zstdruby/libzstd/compress/zstd_ldm.c +324 -219
  53. data/ext/zstdruby/libzstd/compress/zstd_ldm.h +9 -2
  54. data/ext/zstdruby/libzstd/compress/zstd_ldm_geartab.h +106 -0
  55. data/ext/zstdruby/libzstd/compress/zstd_opt.c +481 -209
  56. data/ext/zstdruby/libzstd/compress/zstd_opt.h +1 -1
  57. data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +181 -457
  58. data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +34 -113
  59. data/ext/zstdruby/libzstd/decompress/huf_decompress.c +1199 -565
  60. data/ext/zstdruby/libzstd/decompress/huf_decompress_amd64.S +576 -0
  61. data/ext/zstdruby/libzstd/decompress/zstd_ddict.c +12 -12
  62. data/ext/zstdruby/libzstd/decompress/zstd_ddict.h +2 -2
  63. data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +627 -157
  64. data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.c +1086 -326
  65. data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.h +19 -5
  66. data/ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h +62 -13
  67. data/ext/zstdruby/libzstd/dictBuilder/cover.c +73 -52
  68. data/ext/zstdruby/libzstd/dictBuilder/cover.h +7 -6
  69. data/ext/zstdruby/libzstd/dictBuilder/divsufsort.c +1 -1
  70. data/ext/zstdruby/libzstd/dictBuilder/fastcover.c +44 -35
  71. data/ext/zstdruby/libzstd/dictBuilder/zdict.c +103 -111
  72. data/ext/zstdruby/libzstd/{dictBuilder/zdict.h → zdict.h} +203 -34
  73. data/ext/zstdruby/libzstd/zstd.h +1217 -287
  74. data/ext/zstdruby/libzstd/{common/zstd_errors.h → zstd_errors.h} +28 -8
  75. data/ext/zstdruby/main.c +20 -0
  76. data/ext/zstdruby/skippable_frame.c +63 -0
  77. data/ext/zstdruby/streaming_compress.c +177 -0
  78. data/ext/zstdruby/streaming_compress.h +5 -0
  79. data/ext/zstdruby/streaming_decompress.c +123 -0
  80. data/ext/zstdruby/zstdruby.c +114 -32
  81. data/lib/zstd-ruby/version.rb +1 -1
  82. data/lib/zstd-ruby.rb +0 -1
  83. data/zstd-ruby.gemspec +1 -1
  84. metadata +19 -36
  85. data/.travis.yml +0 -14
  86. data/ext/zstdruby/libzstd/.gitignore +0 -3
  87. data/ext/zstdruby/libzstd/BUCK +0 -234
  88. data/ext/zstdruby/libzstd/Makefile +0 -354
  89. data/ext/zstdruby/libzstd/README.md +0 -179
  90. data/ext/zstdruby/libzstd/deprecated/zbuff.h +0 -214
  91. data/ext/zstdruby/libzstd/deprecated/zbuff_common.c +0 -26
  92. data/ext/zstdruby/libzstd/deprecated/zbuff_compress.c +0 -147
  93. data/ext/zstdruby/libzstd/deprecated/zbuff_decompress.c +0 -75
  94. data/ext/zstdruby/libzstd/dll/example/Makefile +0 -48
  95. data/ext/zstdruby/libzstd/dll/example/README.md +0 -69
  96. data/ext/zstdruby/libzstd/dll/example/build_package.bat +0 -20
  97. data/ext/zstdruby/libzstd/dll/example/fullbench-dll.sln +0 -25
  98. data/ext/zstdruby/libzstd/dll/example/fullbench-dll.vcxproj +0 -181
  99. data/ext/zstdruby/libzstd/legacy/zstd_legacy.h +0 -415
  100. data/ext/zstdruby/libzstd/legacy/zstd_v01.c +0 -2158
  101. data/ext/zstdruby/libzstd/legacy/zstd_v01.h +0 -94
  102. data/ext/zstdruby/libzstd/legacy/zstd_v02.c +0 -3518
  103. data/ext/zstdruby/libzstd/legacy/zstd_v02.h +0 -93
  104. data/ext/zstdruby/libzstd/legacy/zstd_v03.c +0 -3160
  105. data/ext/zstdruby/libzstd/legacy/zstd_v03.h +0 -93
  106. data/ext/zstdruby/libzstd/legacy/zstd_v04.c +0 -3647
  107. data/ext/zstdruby/libzstd/legacy/zstd_v04.h +0 -142
  108. data/ext/zstdruby/libzstd/legacy/zstd_v05.c +0 -4050
  109. data/ext/zstdruby/libzstd/legacy/zstd_v05.h +0 -162
  110. data/ext/zstdruby/libzstd/legacy/zstd_v06.c +0 -4154
  111. data/ext/zstdruby/libzstd/legacy/zstd_v06.h +0 -172
  112. data/ext/zstdruby/libzstd/legacy/zstd_v07.c +0 -4541
  113. data/ext/zstdruby/libzstd/legacy/zstd_v07.h +0 -187
  114. data/ext/zstdruby/libzstd/libzstd.pc.in +0 -15
  115. data/ext/zstdruby/zstdruby.h +0 -6
@@ -1,172 +0,0 @@
1
- /*
2
- * Copyright (c) 2016-2020, Yann Collet, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under both the BSD-style license (found in the
6
- * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7
- * in the COPYING file in the root directory of this source tree).
8
- * You may select, at your option, one of the above-listed licenses.
9
- */
10
-
11
- #ifndef ZSTDv06_H
12
- #define ZSTDv06_H
13
-
14
- #if defined (__cplusplus)
15
- extern "C" {
16
- #endif
17
-
18
- /*====== Dependency ======*/
19
- #include <stddef.h> /* size_t */
20
-
21
-
22
- /*====== Export for Windows ======*/
23
- /*!
24
- * ZSTDv06_DLL_EXPORT :
25
- * Enable exporting of functions when building a Windows DLL
26
- */
27
- #if defined(_WIN32) && defined(ZSTDv06_DLL_EXPORT) && (ZSTDv06_DLL_EXPORT==1)
28
- # define ZSTDLIBv06_API __declspec(dllexport)
29
- #else
30
- # define ZSTDLIBv06_API
31
- #endif
32
-
33
-
34
- /* *************************************
35
- * Simple functions
36
- ***************************************/
37
- /*! ZSTDv06_decompress() :
38
- `compressedSize` : is the _exact_ size of the compressed blob, otherwise decompression will fail.
39
- `dstCapacity` must be large enough, equal or larger than originalSize.
40
- @return : the number of bytes decompressed into `dst` (<= `dstCapacity`),
41
- or an errorCode if it fails (which can be tested using ZSTDv06_isError()) */
42
- ZSTDLIBv06_API size_t ZSTDv06_decompress( void* dst, size_t dstCapacity,
43
- const void* src, size_t compressedSize);
44
-
45
- /**
46
- ZSTDv06_findFrameSizeInfoLegacy() : get the source length and decompressed bound of a ZSTD frame compliant with v0.6.x format
47
- srcSize : The size of the 'src' buffer, at least as large as the frame pointed to by 'src'
48
- cSize (output parameter) : the number of bytes that would be read to decompress this frame
49
- or an error code if it fails (which can be tested using ZSTDv01_isError())
50
- dBound (output parameter) : an upper-bound for the decompressed size of the data in the frame
51
- or ZSTD_CONTENTSIZE_ERROR if an error occurs
52
-
53
- note : assumes `cSize` and `dBound` are _not_ NULL.
54
- */
55
- void ZSTDv06_findFrameSizeInfoLegacy(const void *src, size_t srcSize,
56
- size_t* cSize, unsigned long long* dBound);
57
-
58
- /* *************************************
59
- * Helper functions
60
- ***************************************/
61
- ZSTDLIBv06_API size_t ZSTDv06_compressBound(size_t srcSize); /*!< maximum compressed size (worst case scenario) */
62
-
63
- /* Error Management */
64
- ZSTDLIBv06_API unsigned ZSTDv06_isError(size_t code); /*!< tells if a `size_t` function result is an error code */
65
- ZSTDLIBv06_API const char* ZSTDv06_getErrorName(size_t code); /*!< provides readable string for an error code */
66
-
67
-
68
- /* *************************************
69
- * Explicit memory management
70
- ***************************************/
71
- /** Decompression context */
72
- typedef struct ZSTDv06_DCtx_s ZSTDv06_DCtx;
73
- ZSTDLIBv06_API ZSTDv06_DCtx* ZSTDv06_createDCtx(void);
74
- ZSTDLIBv06_API size_t ZSTDv06_freeDCtx(ZSTDv06_DCtx* dctx); /*!< @return : errorCode */
75
-
76
- /** ZSTDv06_decompressDCtx() :
77
- * Same as ZSTDv06_decompress(), but requires an already allocated ZSTDv06_DCtx (see ZSTDv06_createDCtx()) */
78
- ZSTDLIBv06_API size_t ZSTDv06_decompressDCtx(ZSTDv06_DCtx* ctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
79
-
80
-
81
- /*-***********************
82
- * Dictionary API
83
- *************************/
84
- /*! ZSTDv06_decompress_usingDict() :
85
- * Decompression using a pre-defined Dictionary content (see dictBuilder).
86
- * Dictionary must be identical to the one used during compression, otherwise regenerated data will be corrupted.
87
- * Note : dict can be NULL, in which case, it's equivalent to ZSTDv06_decompressDCtx() */
88
- ZSTDLIBv06_API size_t ZSTDv06_decompress_usingDict(ZSTDv06_DCtx* dctx,
89
- void* dst, size_t dstCapacity,
90
- const void* src, size_t srcSize,
91
- const void* dict,size_t dictSize);
92
-
93
-
94
- /*-************************
95
- * Advanced Streaming API
96
- ***************************/
97
- struct ZSTDv06_frameParams_s { unsigned long long frameContentSize; unsigned windowLog; };
98
- typedef struct ZSTDv06_frameParams_s ZSTDv06_frameParams;
99
-
100
- ZSTDLIBv06_API size_t ZSTDv06_getFrameParams(ZSTDv06_frameParams* fparamsPtr, const void* src, size_t srcSize); /**< doesn't consume input */
101
- ZSTDLIBv06_API size_t ZSTDv06_decompressBegin_usingDict(ZSTDv06_DCtx* dctx, const void* dict, size_t dictSize);
102
- ZSTDLIBv06_API void ZSTDv06_copyDCtx(ZSTDv06_DCtx* dctx, const ZSTDv06_DCtx* preparedDCtx);
103
-
104
- ZSTDLIBv06_API size_t ZSTDv06_nextSrcSizeToDecompress(ZSTDv06_DCtx* dctx);
105
- ZSTDLIBv06_API size_t ZSTDv06_decompressContinue(ZSTDv06_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize);
106
-
107
-
108
-
109
- /* *************************************
110
- * ZBUFF API
111
- ***************************************/
112
-
113
- typedef struct ZBUFFv06_DCtx_s ZBUFFv06_DCtx;
114
- ZSTDLIBv06_API ZBUFFv06_DCtx* ZBUFFv06_createDCtx(void);
115
- ZSTDLIBv06_API size_t ZBUFFv06_freeDCtx(ZBUFFv06_DCtx* dctx);
116
-
117
- ZSTDLIBv06_API size_t ZBUFFv06_decompressInit(ZBUFFv06_DCtx* dctx);
118
- ZSTDLIBv06_API size_t ZBUFFv06_decompressInitDictionary(ZBUFFv06_DCtx* dctx, const void* dict, size_t dictSize);
119
-
120
- ZSTDLIBv06_API size_t ZBUFFv06_decompressContinue(ZBUFFv06_DCtx* dctx,
121
- void* dst, size_t* dstCapacityPtr,
122
- const void* src, size_t* srcSizePtr);
123
-
124
- /*-***************************************************************************
125
- * Streaming decompression howto
126
- *
127
- * A ZBUFFv06_DCtx object is required to track streaming operations.
128
- * Use ZBUFFv06_createDCtx() and ZBUFFv06_freeDCtx() to create/release resources.
129
- * Use ZBUFFv06_decompressInit() to start a new decompression operation,
130
- * or ZBUFFv06_decompressInitDictionary() if decompression requires a dictionary.
131
- * Note that ZBUFFv06_DCtx objects can be re-init multiple times.
132
- *
133
- * Use ZBUFFv06_decompressContinue() repetitively to consume your input.
134
- * *srcSizePtr and *dstCapacityPtr can be any size.
135
- * The function will report how many bytes were read or written by modifying *srcSizePtr and *dstCapacityPtr.
136
- * Note that it may not consume the entire input, in which case it's up to the caller to present remaining input again.
137
- * The content of `dst` will be overwritten (up to *dstCapacityPtr) at each function call, so save its content if it matters, or change `dst`.
138
- * @return : a hint to preferred nb of bytes to use as input for next function call (it's only a hint, to help latency),
139
- * or 0 when a frame is completely decoded,
140
- * or an error code, which can be tested using ZBUFFv06_isError().
141
- *
142
- * Hint : recommended buffer sizes (not compulsory) : ZBUFFv06_recommendedDInSize() and ZBUFFv06_recommendedDOutSize()
143
- * output : ZBUFFv06_recommendedDOutSize== 128 KB block size is the internal unit, it ensures it's always possible to write a full block when decoded.
144
- * input : ZBUFFv06_recommendedDInSize == 128KB + 3;
145
- * just follow indications from ZBUFFv06_decompressContinue() to minimize latency. It should always be <= 128 KB + 3 .
146
- * *******************************************************************************/
147
-
148
-
149
- /* *************************************
150
- * Tool functions
151
- ***************************************/
152
- ZSTDLIBv06_API unsigned ZBUFFv06_isError(size_t errorCode);
153
- ZSTDLIBv06_API const char* ZBUFFv06_getErrorName(size_t errorCode);
154
-
155
- /** Functions below provide recommended buffer sizes for Compression or Decompression operations.
156
- * These sizes are just hints, they tend to offer better latency */
157
- ZSTDLIBv06_API size_t ZBUFFv06_recommendedDInSize(void);
158
- ZSTDLIBv06_API size_t ZBUFFv06_recommendedDOutSize(void);
159
-
160
-
161
- /*-*************************************
162
- * Constants
163
- ***************************************/
164
- #define ZSTDv06_MAGICNUMBER 0xFD2FB526 /* v0.6 */
165
-
166
-
167
-
168
- #if defined (__cplusplus)
169
- }
170
- #endif
171
-
172
- #endif /* ZSTDv06_BUFFERED_H */