zstdlib 0.7.0-x64-mingw32 → 0.8.0-x64-mingw32
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/CHANGES.md +5 -0
- data/ext/zstdlib/extconf.rb +1 -1
- data/ext/zstdlib/ruby/zlib-3.0/zstdlib.c +4994 -0
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/bitstream.h +25 -16
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/compiler.h +118 -4
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/cpu.h +1 -3
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/debug.c +1 -1
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/debug.h +12 -19
- data/ext/zstdlib/zstd-1.5.0/lib/common/entropy_common.c +362 -0
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/error_private.c +2 -1
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/error_private.h +3 -3
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/fse.h +40 -12
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/fse_decompress.c +139 -22
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/huf.h +29 -7
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/mem.h +69 -98
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/pool.c +23 -17
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/pool.h +2 -2
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/threading.c +6 -5
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/threading.h +0 -0
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/xxhash.c +20 -60
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/xxhash.h +2 -2
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/zstd_common.c +10 -10
- data/ext/zstdlib/zstd-1.5.0/lib/common/zstd_deps.h +111 -0
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/common/zstd_internal.h +105 -62
- data/ext/zstdlib/zstd-1.5.0/lib/common/zstd_trace.h +154 -0
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/fse_compress.c +31 -24
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/hist.c +27 -29
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/hist.h +2 -2
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/huf_compress.c +265 -126
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_compress.c +2843 -728
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_compress_internal.h +305 -63
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_compress_literals.c +8 -8
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_compress_literals.h +1 -1
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_compress_sequences.c +29 -7
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_compress_sequences.h +1 -1
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_compress_superblock.c +22 -295
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_compress_superblock.h +1 -1
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_cwksp.h +204 -67
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_double_fast.c +25 -25
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_double_fast.h +1 -1
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_fast.c +23 -23
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_fast.h +1 -1
- data/ext/zstdlib/zstd-1.5.0/lib/compress/zstd_lazy.c +2184 -0
- data/ext/zstdlib/zstd-1.5.0/lib/compress/zstd_lazy.h +125 -0
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_ldm.c +314 -211
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_ldm.h +9 -2
- data/ext/zstdlib/zstd-1.5.0/lib/compress/zstd_ldm_geartab.h +103 -0
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_opt.c +191 -46
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstd_opt.h +1 -1
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/compress/zstdmt_compress.c +93 -415
- data/ext/zstdlib/zstd-1.5.0/lib/compress/zstdmt_compress.h +110 -0
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/decompress/huf_decompress.c +342 -239
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/decompress/zstd_ddict.c +9 -9
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/decompress/zstd_ddict.h +2 -2
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/decompress/zstd_decompress.c +369 -87
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/decompress/zstd_decompress_block.c +191 -75
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/decompress/zstd_decompress_block.h +6 -3
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/decompress/zstd_decompress_internal.h +27 -11
- data/ext/zstdlib/zstd-1.5.0/lib/zdict.h +452 -0
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/lib/zstd.h +568 -126
- data/ext/zstdlib/{zstd-1.4.5/lib/common → zstd-1.5.0/lib}/zstd_errors.h +2 -1
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/zlibWrapper/gzclose.c +0 -0
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/zlibWrapper/gzcompatibility.h +1 -1
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/zlibWrapper/gzguts.h +0 -0
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/zlibWrapper/gzlib.c +0 -0
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/zlibWrapper/gzread.c +0 -0
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/zlibWrapper/gzwrite.c +0 -0
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/zlibWrapper/zstd_zlibwrapper.c +126 -44
- data/ext/zstdlib/{zstd-1.4.5 → zstd-1.5.0}/zlibWrapper/zstd_zlibwrapper.h +1 -1
- data/lib/2.2/zstdlib.so +0 -0
- data/lib/2.3/zstdlib.so +0 -0
- data/lib/2.4/zstdlib.so +0 -0
- data/lib/2.5/zstdlib.so +0 -0
- data/lib/2.6/zstdlib.so +0 -0
- data/lib/2.7/zstdlib.so +0 -0
- metadata +69 -64
- data/ext/zstdlib/zstd-1.4.5/lib/common/entropy_common.c +0 -216
- data/ext/zstdlib/zstd-1.4.5/lib/compress/zstd_lazy.c +0 -1138
- data/ext/zstdlib/zstd-1.4.5/lib/compress/zstd_lazy.h +0 -67
- data/ext/zstdlib/zstd-1.4.5/lib/compress/zstdmt_compress.h +0 -192
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Yann Collet, Facebook, Inc.
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
@@ -77,6 +77,7 @@ typedef enum {
|
|
77
77
|
ZSTD_error_frameIndex_tooLarge = 100,
|
78
78
|
ZSTD_error_seekableIO = 102,
|
79
79
|
ZSTD_error_dstBuffer_wrong = 104,
|
80
|
+
ZSTD_error_srcBuffer_wrong = 105,
|
80
81
|
ZSTD_error_maxCode = 120 /* never EVER use this value directly, it can change in future versions! Use ZSTD_isError() instead */
|
81
82
|
} ZSTD_ErrorCode;
|
82
83
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c) 2016-
|
2
|
+
* Copyright (c) 2016-2021, Przemyslaw Skibinski, Yann Collet, Facebook, Inc.
|
3
3
|
* All rights reserved.
|
4
4
|
*
|
5
5
|
* This source code is licensed under both the BSD-style license (found in the
|
@@ -19,13 +19,13 @@
|
|
19
19
|
#include <stdlib.h>
|
20
20
|
#include <stdio.h> /* vsprintf */
|
21
21
|
#include <stdarg.h> /* va_list, for z_gzprintf */
|
22
|
+
#include <string.h>
|
22
23
|
#define NO_DUMMY_DECL
|
23
24
|
#define ZLIB_CONST
|
24
25
|
#include <zlib.h> /* without #define Z_PREFIX */
|
25
26
|
#include "zstd_zlibwrapper.h"
|
26
|
-
#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_isFrame, ZSTD_MAGICNUMBER */
|
27
|
+
#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_isFrame, ZSTD_MAGICNUMBER, ZSTD_customMem */
|
27
28
|
#include "zstd.h"
|
28
|
-
#include "zstd_internal.h" /* ZSTD_malloc, ZSTD_free */
|
29
29
|
|
30
30
|
|
31
31
|
/* === Constants === */
|
@@ -42,6 +42,45 @@
|
|
42
42
|
#define FINISH_WITH_GZ_ERR(msg) { (void)msg; return Z_STREAM_ERROR; }
|
43
43
|
#define FINISH_WITH_NULL_ERR(msg) { (void)msg; return NULL; }
|
44
44
|
|
45
|
+
/* === Utility === */
|
46
|
+
|
47
|
+
#define MIN(x,y) ((x) < (y) ? (x) : (y))
|
48
|
+
|
49
|
+
static unsigned ZWRAP_isLittleEndian(void)
|
50
|
+
{
|
51
|
+
const union { unsigned u; char c[4]; } one = { 1 }; /* don't use static : performance detrimental */
|
52
|
+
return one.c[0];
|
53
|
+
}
|
54
|
+
|
55
|
+
#ifndef __has_builtin
|
56
|
+
# define __has_builtin(x) 0
|
57
|
+
#endif
|
58
|
+
|
59
|
+
static unsigned ZWRAP_swap32(unsigned in)
|
60
|
+
{
|
61
|
+
#if defined(_MSC_VER) /* Visual Studio */
|
62
|
+
return _byteswap_ulong(in);
|
63
|
+
#elif (defined (__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 403)) \
|
64
|
+
|| (defined(__clang__) && __has_builtin(__builtin_bswap32))
|
65
|
+
return __builtin_bswap32(in);
|
66
|
+
#else
|
67
|
+
return ((in << 24) & 0xff000000 ) |
|
68
|
+
((in << 8) & 0x00ff0000 ) |
|
69
|
+
((in >> 8) & 0x0000ff00 ) |
|
70
|
+
((in >> 24) & 0x000000ff );
|
71
|
+
#endif
|
72
|
+
}
|
73
|
+
|
74
|
+
static unsigned ZWRAP_readLE32(const void* ptr)
|
75
|
+
{
|
76
|
+
unsigned value;
|
77
|
+
memcpy(&value, ptr, sizeof(value));
|
78
|
+
if (ZWRAP_isLittleEndian())
|
79
|
+
return value;
|
80
|
+
else
|
81
|
+
return ZWRAP_swap32(value);
|
82
|
+
}
|
83
|
+
|
45
84
|
|
46
85
|
/* === Wrapper === */
|
47
86
|
static int g_ZWRAP_useZSTDcompression = ZWRAP_USE_ZSTD; /* 0 = don't use ZSTD */
|
@@ -64,8 +103,6 @@ const char * zstdVersion(void) { return ZSTD_VERSION_STRING; }
|
|
64
103
|
|
65
104
|
ZEXTERN const char * ZEXPORT z_zlibVersion OF((void)) { return zlibVersion(); }
|
66
105
|
|
67
|
-
|
68
|
-
|
69
106
|
static void* ZWRAP_allocFunction(void* opaque, size_t size)
|
70
107
|
{
|
71
108
|
z_streamp strm = (z_streamp) opaque;
|
@@ -81,6 +118,35 @@ static void ZWRAP_freeFunction(void* opaque, void* address)
|
|
81
118
|
/* if (address) LOG_WRAPPERC("ZWRAP free %p \n", address); */
|
82
119
|
}
|
83
120
|
|
121
|
+
static void* ZWRAP_customMalloc(size_t size, ZSTD_customMem customMem)
|
122
|
+
{
|
123
|
+
if (customMem.customAlloc)
|
124
|
+
return customMem.customAlloc(customMem.opaque, size);
|
125
|
+
return malloc(size);
|
126
|
+
}
|
127
|
+
|
128
|
+
static void* ZWRAP_customCalloc(size_t size, ZSTD_customMem customMem)
|
129
|
+
{
|
130
|
+
if (customMem.customAlloc) {
|
131
|
+
/* calloc implemented as malloc+memset;
|
132
|
+
* not as efficient as calloc, but next best guess for custom malloc */
|
133
|
+
void* const ptr = customMem.customAlloc(customMem.opaque, size);
|
134
|
+
memset(ptr, 0, size);
|
135
|
+
return ptr;
|
136
|
+
}
|
137
|
+
return calloc(1, size);
|
138
|
+
}
|
139
|
+
|
140
|
+
static void ZWRAP_customFree(void* ptr, ZSTD_customMem customMem)
|
141
|
+
{
|
142
|
+
if (ptr!=NULL) {
|
143
|
+
if (customMem.customFree)
|
144
|
+
customMem.customFree(customMem.opaque, ptr);
|
145
|
+
else
|
146
|
+
free(ptr);
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
84
150
|
|
85
151
|
|
86
152
|
/* === Compression === */
|
@@ -107,7 +173,7 @@ static size_t ZWRAP_freeCCtx(ZWRAP_CCtx* zwc)
|
|
107
173
|
{
|
108
174
|
if (zwc==NULL) return 0; /* support free on NULL */
|
109
175
|
ZSTD_freeCStream(zwc->zbc);
|
110
|
-
|
176
|
+
ZWRAP_customFree(zwc, zwc->customMem);
|
111
177
|
return 0;
|
112
178
|
}
|
113
179
|
|
@@ -115,20 +181,19 @@ static size_t ZWRAP_freeCCtx(ZWRAP_CCtx* zwc)
|
|
115
181
|
static ZWRAP_CCtx* ZWRAP_createCCtx(z_streamp strm)
|
116
182
|
{
|
117
183
|
ZWRAP_CCtx* zwc;
|
184
|
+
ZSTD_customMem customMem = { NULL, NULL, NULL };
|
118
185
|
|
119
186
|
if (strm->zalloc && strm->zfree) {
|
120
|
-
|
121
|
-
|
122
|
-
memset(zwc, 0, sizeof(ZWRAP_CCtx));
|
123
|
-
memcpy(&zwc->allocFunc, strm, sizeof(z_stream));
|
124
|
-
{ ZSTD_customMem ZWRAP_customMem = { ZWRAP_allocFunction, ZWRAP_freeFunction, NULL };
|
125
|
-
ZWRAP_customMem.opaque = &zwc->allocFunc;
|
126
|
-
zwc->customMem = ZWRAP_customMem;
|
127
|
-
}
|
128
|
-
} else {
|
129
|
-
zwc = (ZWRAP_CCtx*)calloc(1, sizeof(*zwc));
|
130
|
-
if (zwc==NULL) return NULL;
|
187
|
+
customMem.customAlloc = ZWRAP_allocFunction;
|
188
|
+
customMem.customFree = ZWRAP_freeFunction;
|
131
189
|
}
|
190
|
+
customMem.opaque = strm;
|
191
|
+
|
192
|
+
zwc = (ZWRAP_CCtx*)ZWRAP_customCalloc(sizeof(ZWRAP_CCtx), customMem);
|
193
|
+
if (zwc == NULL) return NULL;
|
194
|
+
zwc->allocFunc = *strm;
|
195
|
+
customMem.opaque = &zwc->allocFunc;
|
196
|
+
zwc->customMem = customMem;
|
132
197
|
|
133
198
|
return zwc;
|
134
199
|
}
|
@@ -140,12 +205,21 @@ static int ZWRAP_initializeCStream(ZWRAP_CCtx* zwc, const void* dict, size_t dic
|
|
140
205
|
if (zwc == NULL || zwc->zbc == NULL) return Z_STREAM_ERROR;
|
141
206
|
|
142
207
|
if (!pledgedSrcSize) pledgedSrcSize = zwc->pledgedSrcSize;
|
143
|
-
{
|
144
|
-
|
208
|
+
{ unsigned initErr = 0;
|
209
|
+
ZSTD_parameters const params = ZSTD_getParams(zwc->compressionLevel, pledgedSrcSize, dictSize);
|
210
|
+
ZSTD_CCtx_params* cctxParams = ZSTD_createCCtxParams();
|
211
|
+
if (!cctxParams) return Z_STREAM_ERROR;
|
145
212
|
LOG_WRAPPERC("pledgedSrcSize=%d windowLog=%d chainLog=%d hashLog=%d searchLog=%d minMatch=%d strategy=%d\n",
|
146
213
|
(int)pledgedSrcSize, params.cParams.windowLog, params.cParams.chainLog, params.cParams.hashLog, params.cParams.searchLog, params.cParams.minMatch, params.cParams.strategy);
|
147
|
-
|
148
|
-
|
214
|
+
|
215
|
+
initErr |= ZSTD_isError(ZSTD_CCtx_reset(zwc->zbc, ZSTD_reset_session_only));
|
216
|
+
initErr |= ZSTD_isError(ZSTD_CCtxParams_init_advanced(cctxParams, params));
|
217
|
+
initErr |= ZSTD_isError(ZSTD_CCtx_setParametersUsingCCtxParams(zwc->zbc, cctxParams));
|
218
|
+
initErr |= ZSTD_isError(ZSTD_CCtx_setPledgedSrcSize(zwc->zbc, pledgedSrcSize));
|
219
|
+
initErr |= ZSTD_isError(ZSTD_CCtx_loadDictionary(zwc->zbc, dict, dictSize));
|
220
|
+
|
221
|
+
ZSTD_freeCCtxParams(cctxParams);
|
222
|
+
if (initErr) return Z_STREAM_ERROR;
|
149
223
|
}
|
150
224
|
|
151
225
|
return Z_OK;
|
@@ -181,6 +255,10 @@ int ZWRAP_setPledgedSrcSize(z_streamp strm, unsigned long long pledgedSrcSize)
|
|
181
255
|
return Z_OK;
|
182
256
|
}
|
183
257
|
|
258
|
+
static struct internal_state* convert_into_sis(void* ptr)
|
259
|
+
{
|
260
|
+
return (struct internal_state*) ptr;
|
261
|
+
}
|
184
262
|
|
185
263
|
ZEXTERN int ZEXPORT z_deflateInit_ OF((z_streamp strm, int level,
|
186
264
|
const char *version, int stream_size))
|
@@ -201,7 +279,7 @@ ZEXTERN int ZEXPORT z_deflateInit_ OF((z_streamp strm, int level,
|
|
201
279
|
zwc->streamEnd = 0;
|
202
280
|
zwc->totalInBytes = 0;
|
203
281
|
zwc->compressionLevel = level;
|
204
|
-
strm->state = (
|
282
|
+
strm->state = convert_into_sis(zwc); /* use state which in not used by user */
|
205
283
|
strm->total_in = 0;
|
206
284
|
strm->total_out = 0;
|
207
285
|
strm->adler = 0;
|
@@ -303,9 +381,15 @@ ZEXTERN int ZEXPORT z_deflate OF((z_streamp strm, int flush))
|
|
303
381
|
} else {
|
304
382
|
if (zwc->totalInBytes == 0) {
|
305
383
|
if (zwc->comprState == ZWRAP_useReset) {
|
306
|
-
size_t
|
384
|
+
size_t resetErr = ZSTD_CCtx_reset(zwc->zbc, ZSTD_reset_session_only);
|
385
|
+
if (ZSTD_isError(resetErr)) {
|
386
|
+
LOG_WRAPPERC("ERROR: ZSTD_CCtx_reset errorCode=%s\n",
|
387
|
+
ZSTD_getErrorName(resetErr));
|
388
|
+
return ZWRAPC_finishWithError(zwc, strm, 0);
|
389
|
+
}
|
390
|
+
resetErr = ZSTD_CCtx_setPledgedSrcSize(zwc->zbc, (flush == Z_FINISH) ? strm->avail_in : zwc->pledgedSrcSize);
|
307
391
|
if (ZSTD_isError(resetErr)) {
|
308
|
-
LOG_WRAPPERC("ERROR:
|
392
|
+
LOG_WRAPPERC("ERROR: ZSTD_CCtx_setPledgedSrcSize errorCode=%s\n",
|
309
393
|
ZSTD_getErrorName(resetErr));
|
310
394
|
return ZWRAPC_finishWithError(zwc, strm, 0);
|
311
395
|
}
|
@@ -457,21 +541,19 @@ static void ZWRAP_initDCtx(ZWRAP_DCtx* zwd)
|
|
457
541
|
static ZWRAP_DCtx* ZWRAP_createDCtx(z_streamp strm)
|
458
542
|
{
|
459
543
|
ZWRAP_DCtx* zwd;
|
460
|
-
|
544
|
+
ZSTD_customMem customMem = { NULL, NULL, NULL };
|
461
545
|
|
462
546
|
if (strm->zalloc && strm->zfree) {
|
463
|
-
|
464
|
-
|
465
|
-
memset(zwd, 0, sizeof(ZWRAP_DCtx));
|
466
|
-
zwd->allocFunc = *strm; /* just to copy zalloc, zfree & opaque */
|
467
|
-
{ ZSTD_customMem ZWRAP_customMem = { ZWRAP_allocFunction, ZWRAP_freeFunction, NULL };
|
468
|
-
ZWRAP_customMem.opaque = &zwd->allocFunc;
|
469
|
-
zwd->customMem = ZWRAP_customMem;
|
470
|
-
}
|
471
|
-
} else {
|
472
|
-
zwd = (ZWRAP_DCtx*)calloc(1, sizeof(*zwd));
|
473
|
-
if (zwd==NULL) return NULL;
|
547
|
+
customMem.customAlloc = ZWRAP_allocFunction;
|
548
|
+
customMem.customFree = ZWRAP_freeFunction;
|
474
549
|
}
|
550
|
+
customMem.opaque = strm;
|
551
|
+
|
552
|
+
zwd = (ZWRAP_DCtx*)ZWRAP_customCalloc(sizeof(ZWRAP_DCtx), customMem);
|
553
|
+
if (zwd == NULL) return NULL;
|
554
|
+
zwd->allocFunc = *strm;
|
555
|
+
customMem.opaque = &zwd->allocFunc;
|
556
|
+
zwd->customMem = customMem;
|
475
557
|
|
476
558
|
ZWRAP_initDCtx(zwd);
|
477
559
|
return zwd;
|
@@ -481,8 +563,8 @@ static size_t ZWRAP_freeDCtx(ZWRAP_DCtx* zwd)
|
|
481
563
|
{
|
482
564
|
if (zwd==NULL) return 0; /* support free on null */
|
483
565
|
ZSTD_freeDStream(zwd->zbd);
|
484
|
-
|
485
|
-
|
566
|
+
ZWRAP_customFree(zwd->version, zwd->customMem);
|
567
|
+
ZWRAP_customFree(zwd, zwd->customMem);
|
486
568
|
return 0;
|
487
569
|
}
|
488
570
|
|
@@ -524,13 +606,13 @@ ZEXTERN int ZEXPORT z_inflateInit_ OF((z_streamp strm,
|
|
524
606
|
LOG_WRAPPERD("- inflateInit\n");
|
525
607
|
if (zwd == NULL) return ZWRAPD_finishWithError(zwd, strm, 0);
|
526
608
|
|
527
|
-
zwd->version = (char*)
|
609
|
+
zwd->version = (char*)ZWRAP_customMalloc(strlen(version)+1, zwd->customMem);
|
528
610
|
if (zwd->version == NULL) return ZWRAPD_finishWithError(zwd, strm, 0);
|
529
611
|
strcpy(zwd->version, version);
|
530
612
|
|
531
613
|
zwd->stream_size = stream_size;
|
532
614
|
zwd->totalInBytes = 0;
|
533
|
-
strm->state = (
|
615
|
+
strm->state = convert_into_sis(zwd);
|
534
616
|
strm->total_in = 0;
|
535
617
|
strm->total_out = 0;
|
536
618
|
strm->reserved = ZWRAP_UNKNOWN_STREAM;
|
@@ -670,7 +752,7 @@ ZEXTERN int ZEXPORT z_inflate OF((z_streamp strm, int flush))
|
|
670
752
|
|
671
753
|
if (zwd->totalInBytes < ZLIB_HEADERSIZE) {
|
672
754
|
if (zwd->totalInBytes == 0 && strm->avail_in >= ZLIB_HEADERSIZE) {
|
673
|
-
if (
|
755
|
+
if (ZWRAP_readLE32(strm->next_in) != ZSTD_MAGICNUMBER) {
|
674
756
|
{ int const initErr = (zwd->windowBits) ?
|
675
757
|
inflateInit2_(strm, zwd->windowBits, zwd->version, zwd->stream_size) :
|
676
758
|
inflateInit_(strm, zwd->version, zwd->stream_size);
|
@@ -698,7 +780,7 @@ ZEXTERN int ZEXPORT z_inflate OF((z_streamp strm, int flush))
|
|
698
780
|
strm->avail_in -= srcSize;
|
699
781
|
if (zwd->totalInBytes < ZLIB_HEADERSIZE) return Z_OK;
|
700
782
|
|
701
|
-
if (
|
783
|
+
if (ZWRAP_readLE32(zwd->headerBuf) != ZSTD_MAGICNUMBER) {
|
702
784
|
z_stream strm2;
|
703
785
|
strm2.next_in = strm->next_in;
|
704
786
|
strm2.avail_in = strm->avail_in;
|
@@ -762,7 +844,7 @@ ZEXTERN int ZEXPORT z_inflate OF((z_streamp strm, int flush))
|
|
762
844
|
goto error;
|
763
845
|
}
|
764
846
|
} else {
|
765
|
-
size_t const resetErr =
|
847
|
+
size_t const resetErr = ZSTD_DCtx_reset(zwd->zbd, ZSTD_reset_session_only);
|
766
848
|
if (ZSTD_isError(resetErr)) goto error;
|
767
849
|
}
|
768
850
|
} else {
|
@@ -782,7 +864,7 @@ ZEXTERN int ZEXPORT z_inflate OF((z_streamp strm, int flush))
|
|
782
864
|
goto error;
|
783
865
|
}
|
784
866
|
} else {
|
785
|
-
size_t const resetErr =
|
867
|
+
size_t const resetErr = ZSTD_DCtx_reset(zwd->zbd, ZSTD_reset_session_only);
|
786
868
|
if (ZSTD_isError(resetErr)) goto error;
|
787
869
|
}
|
788
870
|
|
data/lib/2.2/zstdlib.so
CHANGED
Binary file
|
data/lib/2.3/zstdlib.so
CHANGED
Binary file
|
data/lib/2.4/zstdlib.so
CHANGED
Binary file
|
data/lib/2.5/zstdlib.so
CHANGED
Binary file
|
data/lib/2.6/zstdlib.so
CHANGED
Binary file
|
data/lib/2.7/zstdlib.so
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zstdlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: x64-mingw32
|
6
6
|
authors:
|
7
7
|
- Oleg A. Khlybov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- ext/zstdlib/ruby/zlib-2.5/zstdlib.c
|
100
100
|
- ext/zstdlib/ruby/zlib-2.6/zstdlib.c
|
101
101
|
- ext/zstdlib/ruby/zlib-2.7/zstdlib.c
|
102
|
+
- ext/zstdlib/ruby/zlib-3.0/zstdlib.c
|
102
103
|
- ext/zstdlib/zlib-1.2.11/adler32.c
|
103
104
|
- ext/zstdlib/zlib-1.2.11/compress.c
|
104
105
|
- ext/zstdlib/zlib-1.2.11/crc32.c
|
@@ -128,68 +129,72 @@ files:
|
|
128
129
|
- ext/zstdlib/zlib.mk
|
129
130
|
- ext/zstdlib/zlibwrapper.mk
|
130
131
|
- ext/zstdlib/zlibwrapper/zlibwrapper.c
|
131
|
-
- ext/zstdlib/zstd-1.
|
132
|
-
- ext/zstdlib/zstd-1.
|
133
|
-
- ext/zstdlib/zstd-1.
|
134
|
-
- ext/zstdlib/zstd-1.
|
135
|
-
- ext/zstdlib/zstd-1.
|
136
|
-
- ext/zstdlib/zstd-1.
|
137
|
-
- ext/zstdlib/zstd-1.
|
138
|
-
- ext/zstdlib/zstd-1.
|
139
|
-
- ext/zstdlib/zstd-1.
|
140
|
-
- ext/zstdlib/zstd-1.
|
141
|
-
- ext/zstdlib/zstd-1.
|
142
|
-
- ext/zstdlib/zstd-1.
|
143
|
-
- ext/zstdlib/zstd-1.
|
144
|
-
- ext/zstdlib/zstd-1.
|
145
|
-
- ext/zstdlib/zstd-1.
|
146
|
-
- ext/zstdlib/zstd-1.
|
147
|
-
- ext/zstdlib/zstd-1.
|
148
|
-
- ext/zstdlib/zstd-1.
|
149
|
-
- ext/zstdlib/zstd-1.
|
150
|
-
- ext/zstdlib/zstd-1.
|
151
|
-
- ext/zstdlib/zstd-1.
|
152
|
-
- ext/zstdlib/zstd-1.
|
153
|
-
- ext/zstdlib/zstd-1.
|
154
|
-
- ext/zstdlib/zstd-1.
|
155
|
-
- ext/zstdlib/zstd-1.
|
156
|
-
- ext/zstdlib/zstd-1.
|
157
|
-
- ext/zstdlib/zstd-1.
|
158
|
-
- ext/zstdlib/zstd-1.
|
159
|
-
- ext/zstdlib/zstd-1.
|
160
|
-
- ext/zstdlib/zstd-1.
|
161
|
-
- ext/zstdlib/zstd-1.
|
162
|
-
- ext/zstdlib/zstd-1.
|
163
|
-
- ext/zstdlib/zstd-1.
|
164
|
-
- ext/zstdlib/zstd-1.
|
165
|
-
- ext/zstdlib/zstd-1.
|
166
|
-
- ext/zstdlib/zstd-1.
|
167
|
-
- ext/zstdlib/zstd-1.
|
168
|
-
- ext/zstdlib/zstd-1.
|
169
|
-
- ext/zstdlib/zstd-1.
|
170
|
-
- ext/zstdlib/zstd-1.
|
171
|
-
- ext/zstdlib/zstd-1.
|
172
|
-
- ext/zstdlib/zstd-1.
|
173
|
-
- ext/zstdlib/zstd-1.
|
174
|
-
- ext/zstdlib/zstd-1.
|
175
|
-
- ext/zstdlib/zstd-1.
|
176
|
-
- ext/zstdlib/zstd-1.
|
177
|
-
- ext/zstdlib/zstd-1.
|
178
|
-
- ext/zstdlib/zstd-1.
|
179
|
-
- ext/zstdlib/zstd-1.
|
180
|
-
- ext/zstdlib/zstd-1.
|
181
|
-
- ext/zstdlib/zstd-1.
|
182
|
-
- ext/zstdlib/zstd-1.
|
183
|
-
- ext/zstdlib/zstd-1.
|
184
|
-
- ext/zstdlib/zstd-1.
|
185
|
-
- ext/zstdlib/zstd-1.
|
186
|
-
- ext/zstdlib/zstd-1.
|
187
|
-
- ext/zstdlib/zstd-1.
|
188
|
-
- ext/zstdlib/zstd-1.
|
189
|
-
- ext/zstdlib/zstd-1.
|
190
|
-
- ext/zstdlib/zstd-1.
|
191
|
-
- ext/zstdlib/zstd-1.
|
192
|
-
- ext/zstdlib/zstd-1.
|
132
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/bitstream.h
|
133
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/compiler.h
|
134
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/cpu.h
|
135
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/debug.c
|
136
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/debug.h
|
137
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/entropy_common.c
|
138
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/error_private.c
|
139
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/error_private.h
|
140
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/fse.h
|
141
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/fse_decompress.c
|
142
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/huf.h
|
143
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/mem.h
|
144
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/pool.c
|
145
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/pool.h
|
146
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/threading.c
|
147
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/threading.h
|
148
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/xxhash.c
|
149
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/xxhash.h
|
150
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/zstd_common.c
|
151
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/zstd_deps.h
|
152
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/zstd_internal.h
|
153
|
+
- ext/zstdlib/zstd-1.5.0/lib/common/zstd_trace.h
|
154
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/fse_compress.c
|
155
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/hist.c
|
156
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/hist.h
|
157
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/huf_compress.c
|
158
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress.c
|
159
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_internal.h
|
160
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_literals.c
|
161
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_literals.h
|
162
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_sequences.c
|
163
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_sequences.h
|
164
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_superblock.c
|
165
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_compress_superblock.h
|
166
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_cwksp.h
|
167
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_double_fast.c
|
168
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_double_fast.h
|
169
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_fast.c
|
170
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_fast.h
|
171
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_lazy.c
|
172
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_lazy.h
|
173
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_ldm.c
|
174
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_ldm.h
|
175
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_ldm_geartab.h
|
176
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_opt.c
|
177
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstd_opt.h
|
178
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstdmt_compress.c
|
179
|
+
- ext/zstdlib/zstd-1.5.0/lib/compress/zstdmt_compress.h
|
180
|
+
- ext/zstdlib/zstd-1.5.0/lib/decompress/huf_decompress.c
|
181
|
+
- ext/zstdlib/zstd-1.5.0/lib/decompress/zstd_ddict.c
|
182
|
+
- ext/zstdlib/zstd-1.5.0/lib/decompress/zstd_ddict.h
|
183
|
+
- ext/zstdlib/zstd-1.5.0/lib/decompress/zstd_decompress.c
|
184
|
+
- ext/zstdlib/zstd-1.5.0/lib/decompress/zstd_decompress_block.c
|
185
|
+
- ext/zstdlib/zstd-1.5.0/lib/decompress/zstd_decompress_block.h
|
186
|
+
- ext/zstdlib/zstd-1.5.0/lib/decompress/zstd_decompress_internal.h
|
187
|
+
- ext/zstdlib/zstd-1.5.0/lib/zdict.h
|
188
|
+
- ext/zstdlib/zstd-1.5.0/lib/zstd.h
|
189
|
+
- ext/zstdlib/zstd-1.5.0/lib/zstd_errors.h
|
190
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/gzclose.c
|
191
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/gzcompatibility.h
|
192
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/gzguts.h
|
193
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/gzlib.c
|
194
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/gzread.c
|
195
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/gzwrite.c
|
196
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/zstd_zlibwrapper.c
|
197
|
+
- ext/zstdlib/zstd-1.5.0/zlibWrapper/zstd_zlibwrapper.h
|
193
198
|
- ext/zstdlib/zstd.mk
|
194
199
|
- lib/2.2/zstdlib.so
|
195
200
|
- lib/2.3/zstdlib.so
|