zstd-ruby 1.4.5.0 → 1.4.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +35 -0
- data/README.md +2 -2
- data/ext/zstdruby/libzstd/Makefile +237 -138
- data/ext/zstdruby/libzstd/README.md +28 -0
- data/ext/zstdruby/libzstd/common/bitstream.h +25 -16
- data/ext/zstdruby/libzstd/common/compiler.h +118 -4
- data/ext/zstdruby/libzstd/common/cpu.h +1 -3
- data/ext/zstdruby/libzstd/common/debug.c +1 -1
- data/ext/zstdruby/libzstd/common/debug.h +12 -19
- data/ext/zstdruby/libzstd/common/entropy_common.c +189 -43
- data/ext/zstdruby/libzstd/common/error_private.c +2 -1
- data/ext/zstdruby/libzstd/common/error_private.h +2 -2
- data/ext/zstdruby/libzstd/common/fse.h +40 -12
- data/ext/zstdruby/libzstd/common/fse_decompress.c +124 -17
- data/ext/zstdruby/libzstd/common/huf.h +27 -6
- data/ext/zstdruby/libzstd/common/mem.h +67 -94
- data/ext/zstdruby/libzstd/common/pool.c +23 -17
- data/ext/zstdruby/libzstd/common/pool.h +2 -2
- data/ext/zstdruby/libzstd/common/threading.c +6 -5
- data/ext/zstdruby/libzstd/common/xxhash.c +19 -57
- data/ext/zstdruby/libzstd/common/xxhash.h +2 -2
- data/ext/zstdruby/libzstd/common/zstd_common.c +10 -10
- data/ext/zstdruby/libzstd/common/zstd_deps.h +111 -0
- data/ext/zstdruby/libzstd/common/zstd_errors.h +2 -1
- data/ext/zstdruby/libzstd/common/zstd_internal.h +90 -59
- data/ext/zstdruby/libzstd/common/zstd_trace.c +42 -0
- data/ext/zstdruby/libzstd/common/zstd_trace.h +152 -0
- data/ext/zstdruby/libzstd/compress/fse_compress.c +31 -24
- data/ext/zstdruby/libzstd/compress/hist.c +27 -29
- data/ext/zstdruby/libzstd/compress/hist.h +2 -2
- data/ext/zstdruby/libzstd/compress/huf_compress.c +217 -101
- data/ext/zstdruby/libzstd/compress/zstd_compress.c +1495 -478
- data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +143 -44
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.c +7 -7
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +18 -4
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +25 -21
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +62 -26
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +23 -23
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_fast.c +21 -21
- data/ext/zstdruby/libzstd/compress/zstd_fast.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstd_lazy.c +352 -78
- data/ext/zstdruby/libzstd/compress/zstd_lazy.h +21 -1
- data/ext/zstdruby/libzstd/compress/zstd_ldm.c +276 -209
- data/ext/zstdruby/libzstd/compress/zstd_ldm.h +8 -2
- data/ext/zstdruby/libzstd/compress/zstd_ldm_geartab.h +103 -0
- data/ext/zstdruby/libzstd/compress/zstd_opt.c +191 -46
- data/ext/zstdruby/libzstd/compress/zstd_opt.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +79 -410
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +27 -109
- data/ext/zstdruby/libzstd/decompress/huf_decompress.c +303 -201
- data/ext/zstdruby/libzstd/decompress/zstd_ddict.c +9 -9
- data/ext/zstdruby/libzstd/decompress/zstd_ddict.h +2 -2
- data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +370 -87
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.c +153 -45
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.h +6 -3
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h +28 -11
- data/ext/zstdruby/libzstd/deprecated/zbuff.h +1 -1
- data/ext/zstdruby/libzstd/deprecated/zbuff_common.c +1 -1
- data/ext/zstdruby/libzstd/deprecated/zbuff_compress.c +1 -1
- data/ext/zstdruby/libzstd/deprecated/zbuff_decompress.c +1 -1
- data/ext/zstdruby/libzstd/dictBuilder/cover.c +40 -31
- data/ext/zstdruby/libzstd/dictBuilder/cover.h +2 -2
- data/ext/zstdruby/libzstd/dictBuilder/divsufsort.c +1 -1
- data/ext/zstdruby/libzstd/dictBuilder/fastcover.c +26 -25
- data/ext/zstdruby/libzstd/dictBuilder/zdict.c +22 -24
- data/ext/zstdruby/libzstd/dictBuilder/zdict.h +5 -4
- data/ext/zstdruby/libzstd/dll/example/Makefile +1 -1
- data/ext/zstdruby/libzstd/dll/example/README.md +16 -22
- data/ext/zstdruby/libzstd/legacy/zstd_legacy.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v01.c +6 -2
- data/ext/zstdruby/libzstd/legacy/zstd_v01.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v02.c +6 -2
- data/ext/zstdruby/libzstd/legacy/zstd_v02.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v03.c +6 -2
- data/ext/zstdruby/libzstd/legacy/zstd_v03.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v04.c +7 -3
- data/ext/zstdruby/libzstd/legacy/zstd_v04.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v05.c +10 -6
- data/ext/zstdruby/libzstd/legacy/zstd_v05.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v06.c +10 -6
- data/ext/zstdruby/libzstd/legacy/zstd_v06.h +1 -1
- data/ext/zstdruby/libzstd/legacy/zstd_v07.c +10 -6
- data/ext/zstdruby/libzstd/legacy/zstd_v07.h +1 -1
- data/ext/zstdruby/libzstd/libzstd.pc.in +3 -3
- data/ext/zstdruby/libzstd/zstd.h +414 -54
- data/lib/zstd-ruby/version.rb +1 -1
- metadata +7 -3
- data/.travis.yml +0 -14
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c) 2016-
|
2
|
+
* Copyright (c) 2016-2021, 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
|
@@ -23,9 +23,13 @@
|
|
23
23
|
/* Unix Large Files support (>4GB) */
|
24
24
|
#define _FILE_OFFSET_BITS 64
|
25
25
|
#if (defined(__sun__) && (!defined(__LP64__))) /* Sun Solaris 32-bits requires specific definitions */
|
26
|
+
# ifndef _LARGEFILE_SOURCE
|
26
27
|
# define _LARGEFILE_SOURCE
|
28
|
+
# endif
|
27
29
|
#elif ! defined(__LP64__) /* No point defining Large file for 64 bit */
|
30
|
+
# ifndef _LARGEFILE64_SOURCE
|
28
31
|
# define _LARGEFILE64_SOURCE
|
32
|
+
# endif
|
29
33
|
#endif
|
30
34
|
|
31
35
|
|
@@ -62,14 +66,15 @@
|
|
62
66
|
|
63
67
|
#define NOISELENGTH 32
|
64
68
|
|
65
|
-
static const int g_compressionLevel_default = 3;
|
66
69
|
static const U32 g_selectivity_default = 9;
|
67
70
|
|
68
71
|
|
69
72
|
/*-*************************************
|
70
73
|
* Console display
|
71
74
|
***************************************/
|
75
|
+
#undef DISPLAY
|
72
76
|
#define DISPLAY(...) { fprintf(stderr, __VA_ARGS__); fflush( stderr ); }
|
77
|
+
#undef DISPLAYLEVEL
|
73
78
|
#define DISPLAYLEVEL(l, ...) if (notificationLevel>=l) { DISPLAY(__VA_ARGS__); } /* 0 : no display; 1: errors; 2: default; 3: details; 4: debug */
|
74
79
|
|
75
80
|
static clock_t ZDICT_clockSpan(clock_t nPrevious) { return clock() - nPrevious; }
|
@@ -105,20 +110,17 @@ size_t ZDICT_getDictHeaderSize(const void* dictBuffer, size_t dictSize)
|
|
105
110
|
size_t headerSize;
|
106
111
|
if (dictSize <= 8 || MEM_readLE32(dictBuffer) != ZSTD_MAGIC_DICTIONARY) return ERROR(dictionary_corrupted);
|
107
112
|
|
108
|
-
{
|
109
|
-
ZSTD_compressedBlockState_t* bs = (ZSTD_compressedBlockState_t*)malloc(sizeof(ZSTD_compressedBlockState_t));
|
113
|
+
{ ZSTD_compressedBlockState_t* bs = (ZSTD_compressedBlockState_t*)malloc(sizeof(ZSTD_compressedBlockState_t));
|
110
114
|
U32* wksp = (U32*)malloc(HUF_WORKSPACE_SIZE);
|
111
|
-
|
112
|
-
if (!bs || !wksp || !offcodeNCount) {
|
115
|
+
if (!bs || !wksp) {
|
113
116
|
headerSize = ERROR(memory_allocation);
|
114
117
|
} else {
|
115
118
|
ZSTD_reset_compressedBlockState(bs);
|
116
|
-
headerSize = ZSTD_loadCEntropy(bs, wksp,
|
119
|
+
headerSize = ZSTD_loadCEntropy(bs, wksp, dictBuffer, dictSize);
|
117
120
|
}
|
118
121
|
|
119
122
|
free(bs);
|
120
123
|
free(wksp);
|
121
|
-
free(offcodeNCount);
|
122
124
|
}
|
123
125
|
|
124
126
|
return headerSize;
|
@@ -532,6 +534,7 @@ static size_t ZDICT_trainBuffer_legacy(dictItem* dictList, U32 dictListSize,
|
|
532
534
|
clock_t displayClock = 0;
|
533
535
|
clock_t const refreshRate = CLOCKS_PER_SEC * 3 / 10;
|
534
536
|
|
537
|
+
# undef DISPLAYUPDATE
|
535
538
|
# define DISPLAYUPDATE(l, ...) if (notificationLevel>=l) { \
|
536
539
|
if (ZDICT_clockSpan(displayClock) > refreshRate) \
|
537
540
|
{ displayClock = clock(); DISPLAY(__VA_ARGS__); \
|
@@ -706,7 +709,7 @@ static void ZDICT_flatLit(unsigned* countLit)
|
|
706
709
|
|
707
710
|
#define OFFCODE_MAX 30 /* only applicable to first block */
|
708
711
|
static size_t ZDICT_analyzeEntropy(void* dstBuffer, size_t maxDstSize,
|
709
|
-
|
712
|
+
int compressionLevel,
|
710
713
|
const void* srcBuffer, const size_t* fileSizes, unsigned nbFiles,
|
711
714
|
const void* dictBuffer, size_t dictBufferSize,
|
712
715
|
unsigned notificationLevel)
|
@@ -741,7 +744,7 @@ static size_t ZDICT_analyzeEntropy(void* dstBuffer, size_t maxDstSize,
|
|
741
744
|
memset(repOffset, 0, sizeof(repOffset));
|
742
745
|
repOffset[1] = repOffset[4] = repOffset[8] = 1;
|
743
746
|
memset(bestRepOffset, 0, sizeof(bestRepOffset));
|
744
|
-
if (compressionLevel==0) compressionLevel =
|
747
|
+
if (compressionLevel==0) compressionLevel = ZSTD_CLEVEL_DEFAULT;
|
745
748
|
params = ZSTD_getParams(compressionLevel, averageSampleSize, dictBufferSize);
|
746
749
|
|
747
750
|
esr.dict = ZSTD_createCDict_advanced(dictBuffer, dictBufferSize, ZSTD_dlm_byRef, ZSTD_dct_rawContent, params.cParams, ZSTD_defaultCMem);
|
@@ -786,7 +789,7 @@ static size_t ZDICT_analyzeEntropy(void* dstBuffer, size_t maxDstSize,
|
|
786
789
|
/* note : the result of this phase should be used to better appreciate the impact on statistics */
|
787
790
|
|
788
791
|
total=0; for (u=0; u<=offcodeMax; u++) total+=offcodeCount[u];
|
789
|
-
errorCode = FSE_normalizeCount(offcodeNCount, Offlog, offcodeCount, total, offcodeMax);
|
792
|
+
errorCode = FSE_normalizeCount(offcodeNCount, Offlog, offcodeCount, total, offcodeMax, /* useLowProbCount */ 1);
|
790
793
|
if (FSE_isError(errorCode)) {
|
791
794
|
eSize = errorCode;
|
792
795
|
DISPLAYLEVEL(1, "FSE_normalizeCount error with offcodeCount \n");
|
@@ -795,7 +798,7 @@ static size_t ZDICT_analyzeEntropy(void* dstBuffer, size_t maxDstSize,
|
|
795
798
|
Offlog = (U32)errorCode;
|
796
799
|
|
797
800
|
total=0; for (u=0; u<=MaxML; u++) total+=matchLengthCount[u];
|
798
|
-
errorCode = FSE_normalizeCount(matchLengthNCount, mlLog, matchLengthCount, total, MaxML);
|
801
|
+
errorCode = FSE_normalizeCount(matchLengthNCount, mlLog, matchLengthCount, total, MaxML, /* useLowProbCount */ 1);
|
799
802
|
if (FSE_isError(errorCode)) {
|
800
803
|
eSize = errorCode;
|
801
804
|
DISPLAYLEVEL(1, "FSE_normalizeCount error with matchLengthCount \n");
|
@@ -804,7 +807,7 @@ static size_t ZDICT_analyzeEntropy(void* dstBuffer, size_t maxDstSize,
|
|
804
807
|
mlLog = (U32)errorCode;
|
805
808
|
|
806
809
|
total=0; for (u=0; u<=MaxLL; u++) total+=litLengthCount[u];
|
807
|
-
errorCode = FSE_normalizeCount(litLengthNCount, llLog, litLengthCount, total, MaxLL);
|
810
|
+
errorCode = FSE_normalizeCount(litLengthNCount, llLog, litLengthCount, total, MaxLL, /* useLowProbCount */ 1);
|
808
811
|
if (FSE_isError(errorCode)) {
|
809
812
|
eSize = errorCode;
|
810
813
|
DISPLAYLEVEL(1, "FSE_normalizeCount error with litLengthCount \n");
|
@@ -893,7 +896,7 @@ size_t ZDICT_finalizeDictionary(void* dictBuffer, size_t dictBufferCapacity,
|
|
893
896
|
size_t hSize;
|
894
897
|
#define HBUFFSIZE 256 /* should prove large enough for all entropy headers */
|
895
898
|
BYTE header[HBUFFSIZE];
|
896
|
-
int const compressionLevel = (params.compressionLevel == 0) ?
|
899
|
+
int const compressionLevel = (params.compressionLevel == 0) ? ZSTD_CLEVEL_DEFAULT : params.compressionLevel;
|
897
900
|
U32 const notificationLevel = params.notificationLevel;
|
898
901
|
|
899
902
|
/* check conditions */
|
@@ -939,7 +942,7 @@ static size_t ZDICT_addEntropyTablesFromBuffer_advanced(
|
|
939
942
|
const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples,
|
940
943
|
ZDICT_params_t params)
|
941
944
|
{
|
942
|
-
int const compressionLevel = (params.compressionLevel == 0) ?
|
945
|
+
int const compressionLevel = (params.compressionLevel == 0) ? ZSTD_CLEVEL_DEFAULT : params.compressionLevel;
|
943
946
|
U32 const notificationLevel = params.notificationLevel;
|
944
947
|
size_t hSize = 8;
|
945
948
|
|
@@ -968,16 +971,11 @@ static size_t ZDICT_addEntropyTablesFromBuffer_advanced(
|
|
968
971
|
return MIN(dictBufferCapacity, hSize+dictContentSize);
|
969
972
|
}
|
970
973
|
|
971
|
-
/* Hidden declaration for dbio.c */
|
972
|
-
size_t ZDICT_trainFromBuffer_unsafe_legacy(
|
973
|
-
void* dictBuffer, size_t maxDictSize,
|
974
|
-
const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples,
|
975
|
-
ZDICT_legacy_params_t params);
|
976
974
|
/*! ZDICT_trainFromBuffer_unsafe_legacy() :
|
977
|
-
* Warning : `samplesBuffer` must be followed by noisy guard band
|
975
|
+
* Warning : `samplesBuffer` must be followed by noisy guard band !!!
|
978
976
|
* @return : size of dictionary, or an error code which can be tested with ZDICT_isError()
|
979
977
|
*/
|
980
|
-
size_t ZDICT_trainFromBuffer_unsafe_legacy(
|
978
|
+
static size_t ZDICT_trainFromBuffer_unsafe_legacy(
|
981
979
|
void* dictBuffer, size_t maxDictSize,
|
982
980
|
const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples,
|
983
981
|
ZDICT_legacy_params_t params)
|
@@ -1114,8 +1112,8 @@ size_t ZDICT_trainFromBuffer(void* dictBuffer, size_t dictBufferCapacity,
|
|
1114
1112
|
memset(¶ms, 0, sizeof(params));
|
1115
1113
|
params.d = 8;
|
1116
1114
|
params.steps = 4;
|
1117
|
-
/*
|
1118
|
-
params.zParams.compressionLevel =
|
1115
|
+
/* Use default level since no compression level information is available */
|
1116
|
+
params.zParams.compressionLevel = ZSTD_CLEVEL_DEFAULT;
|
1119
1117
|
#if defined(DEBUGLEVEL) && (DEBUGLEVEL>=1)
|
1120
1118
|
params.zParams.notificationLevel = DEBUGLEVEL;
|
1121
1119
|
#endif
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c) 2016-
|
2
|
+
* Copyright (c) 2016-2021, 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
|
@@ -264,10 +264,11 @@ typedef struct {
|
|
264
264
|
* Note: ZDICT_trainFromBuffer_legacy() will send notifications into stderr if instructed to, using notificationLevel>0.
|
265
265
|
*/
|
266
266
|
ZDICTLIB_API size_t ZDICT_trainFromBuffer_legacy(
|
267
|
-
void
|
268
|
-
const void
|
267
|
+
void* dictBuffer, size_t dictBufferCapacity,
|
268
|
+
const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples,
|
269
269
|
ZDICT_legacy_params_t parameters);
|
270
270
|
|
271
|
+
|
271
272
|
/* Deprecation warnings */
|
272
273
|
/* It is generally possible to disable deprecation warnings from compiler,
|
273
274
|
for example with -Wno-deprecated-declarations for gcc
|
@@ -279,7 +280,7 @@ ZDICTLIB_API size_t ZDICT_trainFromBuffer_legacy(
|
|
279
280
|
# define ZDICT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
|
280
281
|
# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */
|
281
282
|
# define ZDICT_DEPRECATED(message) [[deprecated(message)]] ZDICTLIB_API
|
282
|
-
# elif (ZDICT_GCC_VERSION >= 405)
|
283
|
+
# elif defined(__clang__) || (ZDICT_GCC_VERSION >= 405)
|
283
284
|
# define ZDICT_DEPRECATED(message) ZDICTLIB_API __attribute__((deprecated(message)))
|
284
285
|
# elif (ZDICT_GCC_VERSION >= 301)
|
285
286
|
# define ZDICT_DEPRECATED(message) ZDICTLIB_API __attribute__((deprecated))
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# ################################################################
|
2
|
-
# Copyright (c) 2016-
|
2
|
+
# Copyright (c) 2016-2021, 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
|
@@ -1,23 +1,21 @@
|
|
1
|
-
ZSTD Windows binary package
|
2
|
-
====================================
|
1
|
+
# ZSTD Windows binary package
|
3
2
|
|
4
|
-
|
3
|
+
## The package contents
|
5
4
|
|
6
|
-
- `zstd.exe`
|
7
|
-
- `dll\libzstd.dll`
|
8
|
-
- `dll\libzstd.lib`
|
9
|
-
- `example\`
|
10
|
-
- `include\`
|
5
|
+
- `zstd.exe` : Command Line Utility, supporting gzip-like arguments
|
6
|
+
- `dll\libzstd.dll` : The ZSTD dynamic library (DLL)
|
7
|
+
- `dll\libzstd.lib` : The import library of the ZSTD dynamic library (DLL) for Visual C++
|
8
|
+
- `example\` : The example of usage of the ZSTD library
|
9
|
+
- `include\` : Header files required by the ZSTD library
|
11
10
|
- `static\libzstd_static.lib` : The static ZSTD library (LIB)
|
12
11
|
|
13
|
-
|
14
|
-
#### Usage of Command Line Interface
|
12
|
+
## Usage of Command Line Interface
|
15
13
|
|
16
14
|
Command Line Interface (CLI) supports gzip-like arguments.
|
17
15
|
By default CLI takes an input file and compresses it to an output file:
|
18
|
-
|
16
|
+
|
19
17
|
Usage: zstd [arg] [input] [output]
|
20
|
-
|
18
|
+
|
21
19
|
The full list of commands for CLI can be obtained with `-h` or `-H`. The ratio can
|
22
20
|
be improved with commands from `-3` to `-16` but higher levels also have slower
|
23
21
|
compression. CLI includes in-memory compression benchmark module with compression
|
@@ -25,36 +23,32 @@ levels starting from `-b` and ending with `-e` with iteration time of `-i` secon
|
|
25
23
|
CLI supports aggregation of parameters i.e. `-b1`, `-e18`, and `-i1` can be joined
|
26
24
|
into `-b1e18i1`.
|
27
25
|
|
28
|
-
|
29
|
-
#### The example of usage of static and dynamic ZSTD libraries with gcc/MinGW
|
26
|
+
## The example of usage of static and dynamic ZSTD libraries with gcc/MinGW
|
30
27
|
|
31
28
|
Use `cd example` and `make` to build `fullbench-dll` and `fullbench-lib`.
|
32
29
|
`fullbench-dll` uses a dynamic ZSTD library from the `dll` directory.
|
33
30
|
`fullbench-lib` uses a static ZSTD library from the `lib` directory.
|
34
31
|
|
35
|
-
|
36
|
-
#### Using ZSTD DLL with gcc/MinGW
|
32
|
+
## Using ZSTD DLL with gcc/MinGW
|
37
33
|
|
38
34
|
The header files from `include\` and the dynamic library `dll\libzstd.dll`
|
39
35
|
are required to compile a project using gcc/MinGW.
|
40
36
|
The dynamic library has to be added to linking options.
|
41
37
|
It means that if a project that uses ZSTD consists of a single `test-dll.c`
|
42
38
|
file it should be linked with `dll\libzstd.dll`. For example:
|
43
|
-
|
39
|
+
|
44
40
|
gcc $(CFLAGS) -Iinclude\ test-dll.c -o test-dll dll\libzstd.dll
|
45
|
-
```
|
46
|
-
The compiled executable will require ZSTD DLL which is available at `dll\libzstd.dll`.
|
47
41
|
|
42
|
+
The compiled executable will require ZSTD DLL which is available at `dll\libzstd.dll`.
|
48
43
|
|
49
|
-
|
44
|
+
## The example of usage of static and dynamic ZSTD libraries with Visual C++
|
50
45
|
|
51
46
|
Open `example\fullbench-dll.sln` to compile `fullbench-dll` that uses a
|
52
47
|
dynamic ZSTD library from the `dll` directory. The solution works with Visual C++
|
53
48
|
2010 or newer. When one will open the solution with Visual C++ newer than 2010
|
54
49
|
then the solution will upgraded to the current version.
|
55
50
|
|
56
|
-
|
57
|
-
#### Using ZSTD DLL with Visual C++
|
51
|
+
## Using ZSTD DLL with Visual C++
|
58
52
|
|
59
53
|
The header files from `include\` and the import library `dll\libzstd.lib`
|
60
54
|
are required to compile a project using Visual C++.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c) 2016-
|
2
|
+
* Copyright (c) 2016-2021, 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
|
@@ -1280,7 +1280,11 @@ static size_t HUF_decompress (void* dst, size_t maxDstSize, const void* cSrc, si
|
|
1280
1280
|
* Basic Types
|
1281
1281
|
*********************************************************/
|
1282
1282
|
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
|
1283
|
-
#
|
1283
|
+
# if defined(_AIX)
|
1284
|
+
# include <inttypes.h>
|
1285
|
+
# else
|
1286
|
+
# include <stdint.h> /* intptr_t */
|
1287
|
+
# endif
|
1284
1288
|
typedef uint8_t BYTE;
|
1285
1289
|
typedef uint16_t U16;
|
1286
1290
|
typedef int16_t S16;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c) 2016-
|
2
|
+
* Copyright (c) 2016-2021, 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
|
@@ -89,7 +89,11 @@ extern "C" {
|
|
89
89
|
* Basic Types
|
90
90
|
*****************************************************************/
|
91
91
|
#if defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
92
|
-
#
|
92
|
+
# if defined(_AIX)
|
93
|
+
# include <inttypes.h>
|
94
|
+
# else
|
95
|
+
# include <stdint.h> /* intptr_t */
|
96
|
+
# endif
|
93
97
|
typedef uint8_t BYTE;
|
94
98
|
typedef uint16_t U16;
|
95
99
|
typedef int16_t S16;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c) 2016-
|
2
|
+
* Copyright (c) 2016-2021, 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
|
@@ -90,7 +90,11 @@ extern "C" {
|
|
90
90
|
* Basic Types
|
91
91
|
*****************************************************************/
|
92
92
|
#if defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
93
|
-
#
|
93
|
+
# if defined(_AIX)
|
94
|
+
# include <inttypes.h>
|
95
|
+
# else
|
96
|
+
# include <stdint.h> /* intptr_t */
|
97
|
+
# endif
|
94
98
|
typedef uint8_t BYTE;
|
95
99
|
typedef uint16_t U16;
|
96
100
|
typedef int16_t S16;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c) 2016-
|
2
|
+
* Copyright (c) 2016-2021, 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
|
@@ -52,7 +52,11 @@ extern "C" {
|
|
52
52
|
* Basic Types
|
53
53
|
*****************************************************************/
|
54
54
|
#if defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
55
|
-
#
|
55
|
+
# if defined(_AIX)
|
56
|
+
# include <inttypes.h>
|
57
|
+
# else
|
58
|
+
# include <stdint.h> /* intptr_t */
|
59
|
+
# endif
|
56
60
|
typedef uint8_t BYTE;
|
57
61
|
typedef uint16_t U16;
|
58
62
|
typedef int16_t S16;
|
@@ -74,7 +78,7 @@ extern "C" {
|
|
74
78
|
/*-*************************************
|
75
79
|
* Debug
|
76
80
|
***************************************/
|
77
|
-
#include "debug.h"
|
81
|
+
#include "../common/debug.h"
|
78
82
|
#ifndef assert
|
79
83
|
# define assert(condition) ((void)0)
|
80
84
|
#endif
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (c) 2016-
|
2
|
+
* Copyright (c) 2016-2021, 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
|
@@ -80,7 +80,11 @@ extern "C" {
|
|
80
80
|
* Basic Types
|
81
81
|
*****************************************************************/
|
82
82
|
#if defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
|
83
|
-
#
|
83
|
+
# if defined(_AIX)
|
84
|
+
# include <inttypes.h>
|
85
|
+
# else
|
86
|
+
# include <stdint.h> /* intptr_t */
|
87
|
+
# endif
|
84
88
|
typedef uint8_t BYTE;
|
85
89
|
typedef uint16_t U16;
|
86
90
|
typedef int16_t S16;
|
@@ -2829,7 +2833,7 @@ static size_t ZSTDv05_decodeFrameHeader_Part2(ZSTDv05_DCtx* zc, const void* src,
|
|
2829
2833
|
|
2830
2834
|
static size_t ZSTDv05_getcBlockSize(const void* src, size_t srcSize, blockProperties_t* bpPtr)
|
2831
2835
|
{
|
2832
|
-
const BYTE* const in = (const BYTE*
|
2836
|
+
const BYTE* const in = (const BYTE*)src;
|
2833
2837
|
BYTE headerFlags;
|
2834
2838
|
U32 cSize;
|
2835
2839
|
|
@@ -2998,7 +3002,7 @@ static size_t ZSTDv05_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t
|
|
2998
3002
|
FSEv05_DTable* DTableLL, FSEv05_DTable* DTableML, FSEv05_DTable* DTableOffb,
|
2999
3003
|
const void* src, size_t srcSize, U32 flagStaticTable)
|
3000
3004
|
{
|
3001
|
-
const BYTE* const istart = (const BYTE*
|
3005
|
+
const BYTE* const istart = (const BYTE*)src;
|
3002
3006
|
const BYTE* ip = istart;
|
3003
3007
|
const BYTE* const iend = istart + srcSize;
|
3004
3008
|
U32 LLtype, Offtype, MLtype;
|
@@ -3306,7 +3310,7 @@ static size_t ZSTDv05_decompressSequences(
|
|
3306
3310
|
{
|
3307
3311
|
const BYTE* ip = (const BYTE*)seqStart;
|
3308
3312
|
const BYTE* const iend = ip + seqSize;
|
3309
|
-
BYTE* const ostart = (BYTE*
|
3313
|
+
BYTE* const ostart = (BYTE*)dst;
|
3310
3314
|
BYTE* op = ostart;
|
3311
3315
|
BYTE* const oend = ostart + maxDstSize;
|
3312
3316
|
size_t errorCode, dumpsLength=0;
|
@@ -3419,7 +3423,7 @@ static size_t ZSTDv05_decompress_continueDCtx(ZSTDv05_DCtx* dctx,
|
|
3419
3423
|
{
|
3420
3424
|
const BYTE* ip = (const BYTE*)src;
|
3421
3425
|
const BYTE* iend = ip + srcSize;
|
3422
|
-
BYTE* const ostart = (BYTE*
|
3426
|
+
BYTE* const ostart = (BYTE*)dst;
|
3423
3427
|
BYTE* op = ostart;
|
3424
3428
|
BYTE* const oend = ostart + maxDstSize;
|
3425
3429
|
size_t remainingSize = srcSize;
|