extzstd 0.0.3.CONCEPT-x86-mingw32 → 0.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.ja +5 -0
- data/LICENSE +6 -6
- data/README.md +35 -22
- data/contrib/zstd/LICENSE +13 -9
- data/contrib/zstd/README.md +37 -44
- data/contrib/zstd/common/entropy_common.c +33 -39
- data/contrib/zstd/common/error_private.c +43 -0
- data/contrib/zstd/common/error_private.h +11 -60
- data/contrib/zstd/common/fse.h +11 -5
- data/contrib/zstd/common/fse_decompress.c +14 -16
- data/contrib/zstd/common/huf.h +1 -1
- data/contrib/zstd/common/mem.h +36 -43
- data/contrib/zstd/common/xxhash.c +31 -18
- data/contrib/zstd/common/xxhash.h +71 -35
- data/contrib/zstd/common/zbuff.h +29 -35
- data/contrib/zstd/common/zstd_common.c +24 -32
- data/contrib/zstd/common/zstd_errors.h +60 -0
- data/contrib/zstd/common/zstd_internal.h +109 -80
- data/contrib/zstd/compress/fse_compress.c +9 -6
- data/contrib/zstd/compress/huf_compress.c +30 -74
- data/contrib/zstd/compress/zbuff_compress.c +43 -51
- data/contrib/zstd/compress/zstd_compress.c +953 -763
- data/contrib/zstd/compress/zstd_opt.h +115 -261
- data/contrib/zstd/decompress/huf_decompress.c +29 -40
- data/contrib/zstd/decompress/zbuff_decompress.c +36 -78
- data/contrib/zstd/decompress/zstd_decompress.c +976 -496
- data/contrib/zstd/dictBuilder/divsufsort.h +5 -5
- data/contrib/zstd/dictBuilder/zdict.c +194 -229
- data/contrib/zstd/dictBuilder/zdict.h +66 -68
- data/contrib/zstd/legacy/zstd_legacy.h +168 -49
- data/contrib/zstd/legacy/zstd_v01.c +95 -178
- data/contrib/zstd/legacy/zstd_v01.h +12 -32
- data/contrib/zstd/legacy/zstd_v02.c +48 -274
- data/contrib/zstd/legacy/zstd_v02.h +12 -32
- data/contrib/zstd/legacy/zstd_v03.c +48 -274
- data/contrib/zstd/legacy/zstd_v03.h +12 -32
- data/contrib/zstd/legacy/zstd_v04.c +63 -320
- data/contrib/zstd/legacy/zstd_v04.h +13 -33
- data/contrib/zstd/legacy/zstd_v05.c +80 -345
- data/contrib/zstd/legacy/zstd_v05.h +9 -31
- data/contrib/zstd/legacy/zstd_v06.c +48 -458
- data/contrib/zstd/legacy/zstd_v06.h +41 -67
- data/contrib/zstd/legacy/zstd_v07.c +4544 -0
- data/contrib/zstd/legacy/zstd_v07.h +173 -0
- data/contrib/zstd/zstd.h +640 -0
- data/ext/extconf.rb +7 -3
- data/ext/extzstd.c +263 -106
- data/ext/extzstd.h +8 -6
- data/ext/extzstd_nogvls.h +0 -117
- data/ext/extzstd_stream.c +347 -0
- data/ext/zstd_common.c +8 -0
- data/ext/zstd_compress.c +6 -0
- data/ext/zstd_decompress.c +5 -0
- data/ext/zstd_dictbuilder.c +5 -0
- data/ext/zstd_legacy_v07.c +1 -0
- data/gemstub.rb +18 -16
- data/lib/2.1/extzstd.so +0 -0
- data/lib/2.2/extzstd.so +0 -0
- data/lib/2.3/extzstd.so +0 -0
- data/lib/extzstd/version.rb +1 -1
- data/lib/extzstd.rb +77 -43
- data/test/test_basic.rb +11 -6
- metadata +23 -11
- data/contrib/zstd/common/error_public.h +0 -77
- data/contrib/zstd/common/zstd.h +0 -475
- data/ext/extzstd_buffered.c +0 -265
- data/ext/zstd_amalgam.c +0 -18
- data/lib/2.0/extzstd.so +0 -0
@@ -1,39 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
modification, are permitted provided that the following conditions are
|
10
|
-
met:
|
11
|
-
|
12
|
-
* Redistributions of source code must retain the above copyright
|
13
|
-
notice, this list of conditions and the following disclaimer.
|
14
|
-
* Redistributions in binary form must reproduce the above
|
15
|
-
copyright notice, this list of conditions and the following disclaimer
|
16
|
-
in the documentation and/or other materials provided with the
|
17
|
-
distribution.
|
18
|
-
|
19
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
23
|
-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
25
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
26
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
27
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
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
|
+
*/
|
30
9
|
|
31
|
-
You can contact the author at :
|
32
|
-
- Homepage : http://www.zstd.net/
|
33
|
-
****************************************************************** */
|
34
10
|
|
35
11
|
/*- Dependencies -*/
|
36
12
|
#include "zstd_v04.h"
|
13
|
+
#include "error_private.h"
|
37
14
|
|
38
15
|
|
39
16
|
/* ******************************************************************
|
@@ -87,6 +64,10 @@ extern "C" {
|
|
87
64
|
/******************************************
|
88
65
|
* Compiler-specific
|
89
66
|
******************************************/
|
67
|
+
#if defined(_MSC_VER) /* Visual Studio */
|
68
|
+
# include <stdlib.h> /* _byteswap_ulong */
|
69
|
+
# include <intrin.h> /* _byteswap_* */
|
70
|
+
#endif
|
90
71
|
#if defined(__GNUC__)
|
91
72
|
# define MEM_STATIC static __attribute__((unused))
|
92
73
|
#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
@@ -140,7 +121,7 @@ extern "C" {
|
|
140
121
|
#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
|
141
122
|
# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) )
|
142
123
|
# define MEM_FORCE_MEMORY_ACCESS 2
|
143
|
-
# elif defined(__INTEL_COMPILER) || \
|
124
|
+
# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \
|
144
125
|
(defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) ))
|
145
126
|
# define MEM_FORCE_MEMORY_ACCESS 1
|
146
127
|
# endif
|
@@ -164,8 +145,6 @@ MEM_STATIC U32 MEM_read32(const void* memPtr) { return *(const U32*) memPtr; }
|
|
164
145
|
MEM_STATIC U64 MEM_read64(const void* memPtr) { return *(const U64*) memPtr; }
|
165
146
|
|
166
147
|
MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; }
|
167
|
-
MEM_STATIC void MEM_write32(void* memPtr, U32 value) { *(U32*)memPtr = value; }
|
168
|
-
MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(U64*)memPtr = value; }
|
169
148
|
|
170
149
|
#elif defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==1)
|
171
150
|
|
@@ -178,8 +157,6 @@ MEM_STATIC U32 MEM_read32(const void* ptr) { return ((const unalign*)ptr)->u32;
|
|
178
157
|
MEM_STATIC U64 MEM_read64(const void* ptr) { return ((const unalign*)ptr)->u64; }
|
179
158
|
|
180
159
|
MEM_STATIC void MEM_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; }
|
181
|
-
MEM_STATIC void MEM_write32(void* memPtr, U32 value) { ((unalign*)memPtr)->u32 = value; }
|
182
|
-
MEM_STATIC void MEM_write64(void* memPtr, U64 value) { ((unalign*)memPtr)->u64 = value; }
|
183
160
|
|
184
161
|
#else
|
185
162
|
|
@@ -206,16 +183,6 @@ MEM_STATIC void MEM_write16(void* memPtr, U16 value)
|
|
206
183
|
memcpy(memPtr, &value, sizeof(value));
|
207
184
|
}
|
208
185
|
|
209
|
-
MEM_STATIC void MEM_write32(void* memPtr, U32 value)
|
210
|
-
{
|
211
|
-
memcpy(memPtr, &value, sizeof(value));
|
212
|
-
}
|
213
|
-
|
214
|
-
MEM_STATIC void MEM_write64(void* memPtr, U64 value)
|
215
|
-
{
|
216
|
-
memcpy(memPtr, &value, sizeof(value));
|
217
|
-
}
|
218
|
-
|
219
186
|
#endif // MEM_FORCE_MEMORY_ACCESS
|
220
187
|
|
221
188
|
|
@@ -255,21 +222,6 @@ MEM_STATIC U32 MEM_readLE32(const void* memPtr)
|
|
255
222
|
}
|
256
223
|
}
|
257
224
|
|
258
|
-
MEM_STATIC void MEM_writeLE32(void* memPtr, U32 val32)
|
259
|
-
{
|
260
|
-
if (MEM_isLittleEndian())
|
261
|
-
{
|
262
|
-
MEM_write32(memPtr, val32);
|
263
|
-
}
|
264
|
-
else
|
265
|
-
{
|
266
|
-
BYTE* p = (BYTE*)memPtr;
|
267
|
-
p[0] = (BYTE)val32;
|
268
|
-
p[1] = (BYTE)(val32>>8);
|
269
|
-
p[2] = (BYTE)(val32>>16);
|
270
|
-
p[3] = (BYTE)(val32>>24);
|
271
|
-
}
|
272
|
-
}
|
273
225
|
|
274
226
|
MEM_STATIC U64 MEM_readLE64(const void* memPtr)
|
275
227
|
{
|
@@ -283,25 +235,6 @@ MEM_STATIC U64 MEM_readLE64(const void* memPtr)
|
|
283
235
|
}
|
284
236
|
}
|
285
237
|
|
286
|
-
MEM_STATIC void MEM_writeLE64(void* memPtr, U64 val64)
|
287
|
-
{
|
288
|
-
if (MEM_isLittleEndian())
|
289
|
-
{
|
290
|
-
MEM_write64(memPtr, val64);
|
291
|
-
}
|
292
|
-
else
|
293
|
-
{
|
294
|
-
BYTE* p = (BYTE*)memPtr;
|
295
|
-
p[0] = (BYTE)val64;
|
296
|
-
p[1] = (BYTE)(val64>>8);
|
297
|
-
p[2] = (BYTE)(val64>>16);
|
298
|
-
p[3] = (BYTE)(val64>>24);
|
299
|
-
p[4] = (BYTE)(val64>>32);
|
300
|
-
p[5] = (BYTE)(val64>>40);
|
301
|
-
p[6] = (BYTE)(val64>>48);
|
302
|
-
p[7] = (BYTE)(val64>>56);
|
303
|
-
}
|
304
|
-
}
|
305
238
|
|
306
239
|
MEM_STATIC size_t MEM_readLEST(const void* memPtr)
|
307
240
|
{
|
@@ -311,13 +244,6 @@ MEM_STATIC size_t MEM_readLEST(const void* memPtr)
|
|
311
244
|
return (size_t)MEM_readLE64(memPtr);
|
312
245
|
}
|
313
246
|
|
314
|
-
MEM_STATIC void MEM_writeLEST(void* memPtr, size_t val)
|
315
|
-
{
|
316
|
-
if (MEM_32bits())
|
317
|
-
MEM_writeLE32(memPtr, (U32)val);
|
318
|
-
else
|
319
|
-
MEM_writeLE64(memPtr, (U64)val);
|
320
|
-
}
|
321
247
|
|
322
248
|
#if defined (__cplusplus)
|
323
249
|
}
|
@@ -325,79 +251,6 @@ MEM_STATIC void MEM_writeLEST(void* memPtr, size_t val)
|
|
325
251
|
|
326
252
|
#endif /* MEM_H_MODULE */
|
327
253
|
|
328
|
-
/* ******************************************************************
|
329
|
-
Error codes list
|
330
|
-
Copyright (C) 2016, Yann Collet
|
331
|
-
|
332
|
-
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
333
|
-
|
334
|
-
Redistribution and use in source and binary forms, with or without
|
335
|
-
modification, are permitted provided that the following conditions are
|
336
|
-
met:
|
337
|
-
|
338
|
-
* Redistributions of source code must retain the above copyright
|
339
|
-
notice, this list of conditions and the following disclaimer.
|
340
|
-
* Redistributions in binary form must reproduce the above
|
341
|
-
copyright notice, this list of conditions and the following disclaimer
|
342
|
-
in the documentation and/or other materials provided with the
|
343
|
-
distribution.
|
344
|
-
|
345
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
346
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
347
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
348
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
349
|
-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
350
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
351
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
352
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
353
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
354
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
355
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
356
|
-
|
357
|
-
You can contact the author at :
|
358
|
-
- Source repository : https://github.com/Cyan4973/zstd
|
359
|
-
****************************************************************** */
|
360
|
-
#ifndef ERROR_PUBLIC_H_MODULE
|
361
|
-
#define ERROR_PUBLIC_H_MODULE
|
362
|
-
|
363
|
-
#if defined (__cplusplus)
|
364
|
-
extern "C" {
|
365
|
-
#endif
|
366
|
-
|
367
|
-
|
368
|
-
/* ****************************************
|
369
|
-
* error list
|
370
|
-
******************************************/
|
371
|
-
enum {
|
372
|
-
ZSTD_error_No_Error,
|
373
|
-
ZSTD_error_GENERIC,
|
374
|
-
ZSTD_error_prefix_unknown,
|
375
|
-
ZSTD_error_frameParameter_unsupported,
|
376
|
-
ZSTD_error_frameParameter_unsupportedBy32bitsImplementation,
|
377
|
-
ZSTD_error_init_missing,
|
378
|
-
ZSTD_error_memory_allocation,
|
379
|
-
ZSTD_error_stage_wrong,
|
380
|
-
ZSTD_error_dstSize_tooSmall,
|
381
|
-
ZSTD_error_srcSize_wrong,
|
382
|
-
ZSTD_error_corruption_detected,
|
383
|
-
ZSTD_error_tableLog_tooLarge,
|
384
|
-
ZSTD_error_maxSymbolValue_tooLarge,
|
385
|
-
ZSTD_error_maxSymbolValue_tooSmall,
|
386
|
-
ZSTD_error_maxCode
|
387
|
-
};
|
388
|
-
|
389
|
-
/* note : functions provide error codes in reverse negative order,
|
390
|
-
so compare with (size_t)(0-enum) */
|
391
|
-
|
392
|
-
|
393
|
-
#if defined (__cplusplus)
|
394
|
-
}
|
395
|
-
#endif
|
396
|
-
|
397
|
-
#endif /* ERROR_PUBLIC_H_MODULE */
|
398
|
-
|
399
|
-
|
400
|
-
|
401
254
|
/*
|
402
255
|
zstd - standard compression library
|
403
256
|
Header File for static linking only
|
@@ -531,115 +384,6 @@ static size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t maxDstS
|
|
531
384
|
}
|
532
385
|
#endif
|
533
386
|
|
534
|
-
/* ******************************************************************
|
535
|
-
Error codes and messages
|
536
|
-
Copyright (C) 2013-2016, Yann Collet
|
537
|
-
|
538
|
-
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
539
|
-
|
540
|
-
Redistribution and use in source and binary forms, with or without
|
541
|
-
modification, are permitted provided that the following conditions are
|
542
|
-
met:
|
543
|
-
|
544
|
-
* Redistributions of source code must retain the above copyright
|
545
|
-
notice, this list of conditions and the following disclaimer.
|
546
|
-
* Redistributions in binary form must reproduce the above
|
547
|
-
copyright notice, this list of conditions and the following disclaimer
|
548
|
-
in the documentation and/or other materials provided with the
|
549
|
-
distribution.
|
550
|
-
|
551
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
552
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
553
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
554
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
555
|
-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
556
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
557
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
558
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
559
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
560
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
561
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
562
|
-
|
563
|
-
You can contact the author at :
|
564
|
-
- Source repository : https://github.com/Cyan4973/zstd
|
565
|
-
****************************************************************** */
|
566
|
-
/* Note : this module is expected to remain private, do not expose it */
|
567
|
-
|
568
|
-
#ifndef ERROR_H_MODULE
|
569
|
-
#define ERROR_H_MODULE
|
570
|
-
|
571
|
-
#if defined (__cplusplus)
|
572
|
-
extern "C" {
|
573
|
-
#endif
|
574
|
-
|
575
|
-
|
576
|
-
/* *****************************************
|
577
|
-
* Includes
|
578
|
-
******************************************/
|
579
|
-
#include <stddef.h> /* size_t, ptrdiff_t */
|
580
|
-
|
581
|
-
|
582
|
-
/* *****************************************
|
583
|
-
* Compiler-specific
|
584
|
-
******************************************/
|
585
|
-
#if defined(__GNUC__)
|
586
|
-
# define ERR_STATIC static __attribute__((unused))
|
587
|
-
#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
588
|
-
# define ERR_STATIC static inline
|
589
|
-
#elif defined(_MSC_VER)
|
590
|
-
# define ERR_STATIC static __inline
|
591
|
-
#else
|
592
|
-
# define ERR_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */
|
593
|
-
#endif
|
594
|
-
|
595
|
-
|
596
|
-
/* *****************************************
|
597
|
-
* Error Codes
|
598
|
-
******************************************/
|
599
|
-
#define PREFIX(name) ZSTD_error_##name
|
600
|
-
|
601
|
-
#ifdef ERROR
|
602
|
-
# undef ERROR /* reported already defined on VS 2015 by Rich Geldreich */
|
603
|
-
#endif
|
604
|
-
#define ERROR(name) (size_t)-PREFIX(name)
|
605
|
-
|
606
|
-
ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
|
607
|
-
|
608
|
-
|
609
|
-
/* *****************************************
|
610
|
-
* Error Strings
|
611
|
-
******************************************/
|
612
|
-
|
613
|
-
ERR_STATIC const char* ERR_getErrorName(size_t code)
|
614
|
-
{
|
615
|
-
static const char* codeError = "Unspecified error code";
|
616
|
-
switch( (size_t)(0-code) )
|
617
|
-
{
|
618
|
-
case ZSTD_error_No_Error: return "No error detected";
|
619
|
-
case ZSTD_error_GENERIC: return "Error (generic)";
|
620
|
-
case ZSTD_error_prefix_unknown: return "Unknown frame descriptor";
|
621
|
-
case ZSTD_error_frameParameter_unsupported: return "Unsupported frame parameter";
|
622
|
-
case ZSTD_error_frameParameter_unsupportedBy32bitsImplementation: return "Frame parameter unsupported in 32-bits mode";
|
623
|
-
case ZSTD_error_init_missing: return "Context should be init first";
|
624
|
-
case ZSTD_error_memory_allocation: return "Allocation error : not enough memory";
|
625
|
-
case ZSTD_error_dstSize_tooSmall: return "Destination buffer is too small";
|
626
|
-
case ZSTD_error_srcSize_wrong: return "Src size incorrect";
|
627
|
-
case ZSTD_error_corruption_detected: return "Corrupted block detected";
|
628
|
-
case ZSTD_error_tableLog_tooLarge: return "tableLog requires too much memory";
|
629
|
-
case ZSTD_error_maxSymbolValue_tooLarge: return "Unsupported max possible Symbol Value : too large";
|
630
|
-
case ZSTD_error_maxSymbolValue_tooSmall: return "Specified maxSymbolValue is too small";
|
631
|
-
case ZSTD_error_maxCode:
|
632
|
-
default: return codeError;
|
633
|
-
}
|
634
|
-
}
|
635
|
-
|
636
|
-
|
637
|
-
#if defined (__cplusplus)
|
638
|
-
}
|
639
|
-
#endif
|
640
|
-
|
641
|
-
#endif /* ERROR_H_MODULE */
|
642
|
-
|
643
387
|
|
644
388
|
#endif /* ZSTD_STATIC_H */
|
645
389
|
|
@@ -1455,12 +1199,15 @@ MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr)
|
|
1455
1199
|
# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
|
1456
1200
|
# pragma warning(disable : 4214) /* disable: C4214: non-int bitfields */
|
1457
1201
|
#else
|
1458
|
-
#
|
1459
|
-
#
|
1460
|
-
#
|
1202
|
+
# if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
|
1203
|
+
# ifdef __GNUC__
|
1204
|
+
# define FORCE_INLINE static inline __attribute__((always_inline))
|
1205
|
+
# else
|
1206
|
+
# define FORCE_INLINE static inline
|
1207
|
+
# endif
|
1461
1208
|
# else
|
1462
|
-
# define FORCE_INLINE static
|
1463
|
-
# endif
|
1209
|
+
# define FORCE_INLINE static
|
1210
|
+
# endif /* __STDC_VERSION__ */
|
1464
1211
|
#endif
|
1465
1212
|
|
1466
1213
|
|
@@ -2096,15 +1843,7 @@ static size_t HUF_decompress4X4_usingDTable(void* dst, size_t maxDstSize, const
|
|
2096
1843
|
|
2097
1844
|
|
2098
1845
|
#ifdef _MSC_VER /* Visual Studio */
|
2099
|
-
# define FORCE_INLINE static __forceinline
|
2100
1846
|
# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
|
2101
|
-
#else
|
2102
|
-
# ifdef __GNUC__
|
2103
|
-
# define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
|
2104
|
-
# define FORCE_INLINE static inline __attribute__((always_inline))
|
2105
|
-
# else
|
2106
|
-
# define FORCE_INLINE static inline
|
2107
|
-
# endif
|
2108
1847
|
#endif
|
2109
1848
|
|
2110
1849
|
|
@@ -2157,10 +1896,12 @@ static size_t HUF_readStats(BYTE* huffWeight, size_t hwSize, U32* rankStats,
|
|
2157
1896
|
U32 weightTotal;
|
2158
1897
|
U32 tableLog;
|
2159
1898
|
const BYTE* ip = (const BYTE*) src;
|
2160
|
-
size_t iSize
|
1899
|
+
size_t iSize;
|
2161
1900
|
size_t oSize;
|
2162
1901
|
U32 n;
|
2163
1902
|
|
1903
|
+
if (!srcSize) return ERROR(srcSize_wrong);
|
1904
|
+
iSize = ip[0];
|
2164
1905
|
//memset(huffWeight, 0, hwSize); /* is not necessary, even though some analyzer complain ... */
|
2165
1906
|
|
2166
1907
|
if (iSize >= 128) /* special header */
|
@@ -2202,6 +1943,7 @@ static size_t HUF_readStats(BYTE* huffWeight, size_t hwSize, U32* rankStats,
|
|
2202
1943
|
rankStats[huffWeight[n]]++;
|
2203
1944
|
weightTotal += (1 << huffWeight[n]) >> 1;
|
2204
1945
|
}
|
1946
|
+
if (weightTotal == 0) return ERROR(corruption_detected);
|
2205
1947
|
|
2206
1948
|
/* get last non-null symbol weight (implied, total must be 2^n) */
|
2207
1949
|
tableLog = BIT_highbit32(weightTotal) + 1;
|
@@ -2912,17 +2654,9 @@ static size_t HUF_decompress (void* dst, size_t dstSize, const void* cSrc, size_
|
|
2912
2654
|
* Compiler specifics
|
2913
2655
|
*********************************************************/
|
2914
2656
|
#ifdef _MSC_VER /* Visual Studio */
|
2915
|
-
# define FORCE_INLINE static __forceinline
|
2916
2657
|
# include <intrin.h> /* For Visual 2005 */
|
2917
2658
|
# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
|
2918
2659
|
# pragma warning(disable : 4324) /* disable: C4324: padded structure */
|
2919
|
-
#else
|
2920
|
-
# define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
|
2921
|
-
# ifdef __GNUC__
|
2922
|
-
# define FORCE_INLINE static inline __attribute__((always_inline))
|
2923
|
-
# else
|
2924
|
-
# define FORCE_INLINE static inline
|
2925
|
-
# endif
|
2926
2660
|
#endif
|
2927
2661
|
|
2928
2662
|
|
@@ -3043,7 +2777,7 @@ static size_t ZSTD_decodeFrameHeader_Part2(ZSTD_DCtx* zc, const void* src, size_
|
|
3043
2777
|
size_t result;
|
3044
2778
|
if (srcSize != zc->headerSize) return ERROR(srcSize_wrong);
|
3045
2779
|
result = ZSTD_getFrameParams(&(zc->params), src, srcSize);
|
3046
|
-
if ((MEM_32bits()) && (zc->params.windowLog > 25)) return ERROR(
|
2780
|
+
if ((MEM_32bits()) && (zc->params.windowLog > 25)) return ERROR(frameParameter_unsupportedBy32bits);
|
3047
2781
|
return result;
|
3048
2782
|
}
|
3049
2783
|
|
@@ -3196,7 +2930,6 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|
3196
2930
|
/* Build DTables */
|
3197
2931
|
switch(LLtype)
|
3198
2932
|
{
|
3199
|
-
U32 max;
|
3200
2933
|
case bt_rle :
|
3201
2934
|
LLlog = 0;
|
3202
2935
|
FSE_buildDTable_rle(DTableLL, *ip++); break;
|
@@ -3204,17 +2937,16 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|
3204
2937
|
LLlog = LLbits;
|
3205
2938
|
FSE_buildDTable_raw(DTableLL, LLbits); break;
|
3206
2939
|
default :
|
3207
|
-
max = MaxLL;
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
}
|
2940
|
+
{ U32 max = MaxLL;
|
2941
|
+
headerSize = FSE_readNCount(norm, &max, &LLlog, ip, iend-ip);
|
2942
|
+
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
2943
|
+
if (LLlog > LLFSELog) return ERROR(corruption_detected);
|
2944
|
+
ip += headerSize;
|
2945
|
+
FSE_buildDTable(DTableLL, norm, max, LLlog);
|
2946
|
+
} }
|
3214
2947
|
|
3215
2948
|
switch(Offtype)
|
3216
2949
|
{
|
3217
|
-
U32 max;
|
3218
2950
|
case bt_rle :
|
3219
2951
|
Offlog = 0;
|
3220
2952
|
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
@@ -3224,17 +2956,16 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|
3224
2956
|
Offlog = Offbits;
|
3225
2957
|
FSE_buildDTable_raw(DTableOffb, Offbits); break;
|
3226
2958
|
default :
|
3227
|
-
max = MaxOff;
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
}
|
2959
|
+
{ U32 max = MaxOff;
|
2960
|
+
headerSize = FSE_readNCount(norm, &max, &Offlog, ip, iend-ip);
|
2961
|
+
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
2962
|
+
if (Offlog > OffFSELog) return ERROR(corruption_detected);
|
2963
|
+
ip += headerSize;
|
2964
|
+
FSE_buildDTable(DTableOffb, norm, max, Offlog);
|
2965
|
+
} }
|
3234
2966
|
|
3235
2967
|
switch(MLtype)
|
3236
2968
|
{
|
3237
|
-
U32 max;
|
3238
2969
|
case bt_rle :
|
3239
2970
|
MLlog = 0;
|
3240
2971
|
if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */
|
@@ -3243,14 +2974,13 @@ static size_t ZSTD_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* d
|
|
3243
2974
|
MLlog = MLbits;
|
3244
2975
|
FSE_buildDTable_raw(DTableML, MLbits); break;
|
3245
2976
|
default :
|
3246
|
-
max = MaxML;
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
}
|
2977
|
+
{ U32 max = MaxML;
|
2978
|
+
headerSize = FSE_readNCount(norm, &max, &MLlog, ip, iend-ip);
|
2979
|
+
if (FSE_isError(headerSize)) return ERROR(GENERIC);
|
2980
|
+
if (MLlog > MLFSELog) return ERROR(corruption_detected);
|
2981
|
+
ip += headerSize;
|
2982
|
+
FSE_buildDTable(DTableML, norm, max, MLlog);
|
2983
|
+
} } }
|
3254
2984
|
|
3255
2985
|
return ip-istart;
|
3256
2986
|
}
|
@@ -3380,8 +3110,13 @@ static size_t ZSTD_execSequence(BYTE* op,
|
|
3380
3110
|
op = oLitEnd + length1;
|
3381
3111
|
sequence.matchLength -= length1;
|
3382
3112
|
match = base;
|
3113
|
+
if (op > oend_8) {
|
3114
|
+
while (op < oMatchEnd) *op++ = *match++;
|
3115
|
+
return sequenceLength;
|
3116
|
+
}
|
3383
3117
|
}
|
3384
3118
|
}
|
3119
|
+
/* Requirement: op <= oend_8 */
|
3385
3120
|
|
3386
3121
|
/* match within prefix */
|
3387
3122
|
if (sequence.offset < 8)
|
@@ -3752,7 +3487,7 @@ static void ZSTD_decompress_insertDictionary(ZSTD_DCtx* ctx, const void* dict, s
|
|
3752
3487
|
* The function will report how many bytes were read or written by modifying *srcSizePtr and *maxDstSizePtr.
|
3753
3488
|
* Note that it may not consume the entire input, in which case it's up to the caller to call again the function with remaining input.
|
3754
3489
|
* The content of dst will be overwritten (up to *maxDstSizePtr) at each function call, so save its content if it matters or change dst .
|
3755
|
-
*
|
3490
|
+
* return : a hint to preferred nb of bytes to use as input for next function call (it's only a hint, to improve latency)
|
3756
3491
|
* or 0 when a frame is completely decoded
|
3757
3492
|
* or an error code, which can be tested using ZBUFF_isError().
|
3758
3493
|
*
|
@@ -4024,7 +3759,7 @@ size_t ZSTDv04_decompress(void* dst, size_t maxDstSize, const void* src, size_t
|
|
4024
3759
|
return regenSize;
|
4025
3760
|
#else
|
4026
3761
|
ZSTD_DCtx dctx;
|
4027
|
-
return
|
3762
|
+
return ZSTDv04_decompressDCtx(&dctx, dst, maxDstSize, src, srcSize);
|
4028
3763
|
#endif
|
4029
3764
|
}
|
4030
3765
|
|
@@ -4054,3 +3789,11 @@ size_t ZBUFFv04_decompressContinue(ZBUFFv04_DCtx* dctx, void* dst, size_t* maxDs
|
|
4054
3789
|
{
|
4055
3790
|
return ZBUFF_decompressContinue(dctx, dst, maxDstSizePtr, src, srcSizePtr);
|
4056
3791
|
}
|
3792
|
+
|
3793
|
+
ZSTD_DCtx* ZSTDv04_createDCtx(void) { return ZSTD_createDCtx(); }
|
3794
|
+
size_t ZSTDv04_freeDCtx(ZSTD_DCtx* dctx) { return ZSTD_freeDCtx(dctx); }
|
3795
|
+
|
3796
|
+
size_t ZSTDv04_getFrameParams(ZSTD_parameters* params, const void* src, size_t srcSize)
|
3797
|
+
{
|
3798
|
+
return ZSTD_getFrameParams(params, src, srcSize);
|
3799
|
+
}
|
@@ -1,36 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
notice, this list of conditions and the following disclaimer.
|
13
|
-
* Redistributions in binary form must reproduce the above
|
14
|
-
copyright notice, this list of conditions and the following disclaimer
|
15
|
-
in the documentation and/or other materials provided with the
|
16
|
-
distribution.
|
17
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
18
|
-
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
19
|
-
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
20
|
-
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
21
|
-
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
22
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
23
|
-
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
24
|
-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
25
|
-
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
27
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
|
-
|
29
|
-
You can contact the author at :
|
30
|
-
- zstd source repository : https://github.com/Cyan4973/zstd
|
31
|
-
- ztsd public forum : https://groups.google.com/forum/#!forum/lz4c
|
32
|
-
*/
|
33
|
-
#pragma once
|
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
|
34
12
|
|
35
13
|
#if defined (__cplusplus)
|
36
14
|
extern "C" {
|
@@ -146,3 +124,5 @@ size_t ZBUFFv04_recommendedDOutSize(void);
|
|
146
124
|
#if defined (__cplusplus)
|
147
125
|
}
|
148
126
|
#endif
|
127
|
+
|
128
|
+
#endif /* ZSTD_V04_H_91868324769238 */
|