zstd-ruby 1.4.4.0 → 1.5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +78 -5
- data/Rakefile +8 -2
- data/ext/zstdruby/common.h +15 -0
- data/ext/zstdruby/extconf.rb +3 -2
- data/ext/zstdruby/libzstd/common/allocations.h +55 -0
- data/ext/zstdruby/libzstd/common/bits.h +200 -0
- data/ext/zstdruby/libzstd/common/bitstream.h +74 -97
- data/ext/zstdruby/libzstd/common/compiler.h +219 -20
- data/ext/zstdruby/libzstd/common/cpu.h +1 -3
- data/ext/zstdruby/libzstd/common/debug.c +11 -31
- data/ext/zstdruby/libzstd/common/debug.h +22 -49
- data/ext/zstdruby/libzstd/common/entropy_common.c +184 -80
- data/ext/zstdruby/libzstd/common/error_private.c +11 -2
- data/ext/zstdruby/libzstd/common/error_private.h +87 -4
- data/ext/zstdruby/libzstd/common/fse.h +47 -116
- data/ext/zstdruby/libzstd/common/fse_decompress.c +127 -127
- data/ext/zstdruby/libzstd/common/huf.h +112 -197
- data/ext/zstdruby/libzstd/common/mem.h +124 -142
- data/ext/zstdruby/libzstd/common/pool.c +54 -27
- data/ext/zstdruby/libzstd/common/pool.h +11 -5
- data/ext/zstdruby/libzstd/common/portability_macros.h +156 -0
- data/ext/zstdruby/libzstd/common/threading.c +78 -22
- data/ext/zstdruby/libzstd/common/threading.h +9 -13
- data/ext/zstdruby/libzstd/common/xxhash.c +15 -873
- data/ext/zstdruby/libzstd/common/xxhash.h +5572 -191
- data/ext/zstdruby/libzstd/common/zstd_common.c +2 -37
- data/ext/zstdruby/libzstd/common/zstd_deps.h +111 -0
- data/ext/zstdruby/libzstd/common/zstd_internal.h +186 -144
- data/ext/zstdruby/libzstd/common/zstd_trace.h +163 -0
- data/ext/zstdruby/libzstd/compress/clevels.h +134 -0
- data/ext/zstdruby/libzstd/compress/fse_compress.c +99 -196
- data/ext/zstdruby/libzstd/compress/hist.c +41 -63
- data/ext/zstdruby/libzstd/compress/hist.h +13 -33
- data/ext/zstdruby/libzstd/compress/huf_compress.c +968 -331
- data/ext/zstdruby/libzstd/compress/zstd_compress.c +4120 -1191
- data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +688 -159
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.c +121 -40
- data/ext/zstdruby/libzstd/compress/zstd_compress_literals.h +16 -6
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +62 -35
- data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.h +10 -3
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +577 -0
- data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.h +32 -0
- data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +322 -115
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +394 -154
- data/ext/zstdruby/libzstd/compress/zstd_double_fast.h +4 -3
- data/ext/zstdruby/libzstd/compress/zstd_fast.c +729 -253
- data/ext/zstdruby/libzstd/compress/zstd_fast.h +4 -3
- data/ext/zstdruby/libzstd/compress/zstd_lazy.c +1289 -247
- data/ext/zstdruby/libzstd/compress/zstd_lazy.h +61 -1
- data/ext/zstdruby/libzstd/compress/zstd_ldm.c +339 -212
- data/ext/zstdruby/libzstd/compress/zstd_ldm.h +15 -3
- data/ext/zstdruby/libzstd/compress/zstd_ldm_geartab.h +106 -0
- data/ext/zstdruby/libzstd/compress/zstd_opt.c +508 -282
- data/ext/zstdruby/libzstd/compress/zstd_opt.h +1 -1
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +217 -466
- data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +35 -114
- data/ext/zstdruby/libzstd/decompress/huf_decompress.c +1220 -572
- data/ext/zstdruby/libzstd/decompress/huf_decompress_amd64.S +576 -0
- data/ext/zstdruby/libzstd/decompress/zstd_ddict.c +23 -19
- data/ext/zstdruby/libzstd/decompress/zstd_ddict.h +3 -3
- data/ext/zstdruby/libzstd/decompress/zstd_decompress.c +859 -273
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.c +1244 -375
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_block.h +21 -7
- data/ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h +74 -11
- data/ext/zstdruby/libzstd/dictBuilder/cover.c +75 -54
- data/ext/zstdruby/libzstd/dictBuilder/cover.h +20 -9
- data/ext/zstdruby/libzstd/dictBuilder/divsufsort.c +1 -1
- data/ext/zstdruby/libzstd/dictBuilder/fastcover.c +55 -36
- data/ext/zstdruby/libzstd/dictBuilder/zdict.c +126 -110
- data/ext/zstdruby/libzstd/{dictBuilder/zdict.h → zdict.h} +248 -56
- data/ext/zstdruby/libzstd/zstd.h +1277 -306
- data/ext/zstdruby/libzstd/{common/zstd_errors.h → zstd_errors.h} +29 -8
- data/ext/zstdruby/main.c +20 -0
- data/ext/zstdruby/skippable_frame.c +63 -0
- data/ext/zstdruby/streaming_compress.c +177 -0
- data/ext/zstdruby/streaming_compress.h +5 -0
- data/ext/zstdruby/streaming_decompress.c +123 -0
- data/ext/zstdruby/zstdruby.c +114 -32
- data/lib/zstd-ruby/version.rb +1 -1
- data/lib/zstd-ruby.rb +0 -1
- data/zstd-ruby.gemspec +1 -1
- metadata +24 -39
- data/.travis.yml +0 -14
- data/ext/zstdruby/libzstd/.gitignore +0 -3
- data/ext/zstdruby/libzstd/BUCK +0 -234
- data/ext/zstdruby/libzstd/Makefile +0 -289
- data/ext/zstdruby/libzstd/README.md +0 -159
- data/ext/zstdruby/libzstd/deprecated/zbuff.h +0 -214
- data/ext/zstdruby/libzstd/deprecated/zbuff_common.c +0 -26
- data/ext/zstdruby/libzstd/deprecated/zbuff_compress.c +0 -147
- data/ext/zstdruby/libzstd/deprecated/zbuff_decompress.c +0 -75
- data/ext/zstdruby/libzstd/dll/example/Makefile +0 -47
- data/ext/zstdruby/libzstd/dll/example/README.md +0 -69
- data/ext/zstdruby/libzstd/dll/example/build_package.bat +0 -20
- data/ext/zstdruby/libzstd/dll/example/fullbench-dll.sln +0 -25
- data/ext/zstdruby/libzstd/dll/example/fullbench-dll.vcxproj +0 -181
- data/ext/zstdruby/libzstd/legacy/zstd_legacy.h +0 -415
- data/ext/zstdruby/libzstd/legacy/zstd_v01.c +0 -2152
- data/ext/zstdruby/libzstd/legacy/zstd_v01.h +0 -94
- data/ext/zstdruby/libzstd/legacy/zstd_v02.c +0 -3514
- data/ext/zstdruby/libzstd/legacy/zstd_v02.h +0 -93
- data/ext/zstdruby/libzstd/legacy/zstd_v03.c +0 -3156
- data/ext/zstdruby/libzstd/legacy/zstd_v03.h +0 -93
- data/ext/zstdruby/libzstd/legacy/zstd_v04.c +0 -3641
- data/ext/zstdruby/libzstd/legacy/zstd_v04.h +0 -142
- data/ext/zstdruby/libzstd/legacy/zstd_v05.c +0 -4046
- data/ext/zstdruby/libzstd/legacy/zstd_v05.h +0 -162
- data/ext/zstdruby/libzstd/legacy/zstd_v06.c +0 -4150
- data/ext/zstdruby/libzstd/legacy/zstd_v06.h +0 -172
- data/ext/zstdruby/libzstd/legacy/zstd_v07.c +0 -4533
- data/ext/zstdruby/libzstd/legacy/zstd_v07.h +0 -187
- data/ext/zstdruby/libzstd/libzstd.pc.in +0 -15
- data/ext/zstdruby/zstdruby.h +0 -6
@@ -1,159 +0,0 @@
|
|
1
|
-
Zstandard library files
|
2
|
-
================================
|
3
|
-
|
4
|
-
The __lib__ directory is split into several sub-directories,
|
5
|
-
in order to make it easier to select or exclude features.
|
6
|
-
|
7
|
-
|
8
|
-
#### Building
|
9
|
-
|
10
|
-
`Makefile` script is provided, supporting [Makefile conventions](https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html#Makefile-Conventions),
|
11
|
-
including commands variables, staged install, directory variables and standard targets.
|
12
|
-
- `make` : generates both static and dynamic libraries
|
13
|
-
- `make install` : install libraries and headers in target system directories
|
14
|
-
|
15
|
-
`libzstd` default scope is pretty large, including compression, decompression, dictionary builder,
|
16
|
-
and support for decoding legacy formats >= v0.5.0.
|
17
|
-
The scope can be reduced on demand (see paragraph _modular build_).
|
18
|
-
|
19
|
-
|
20
|
-
#### Multithreading support
|
21
|
-
|
22
|
-
Multithreading is disabled by default when building with `make`.
|
23
|
-
Enabling multithreading requires 2 conditions :
|
24
|
-
- set build macro `ZSTD_MULTITHREAD` (`-DZSTD_MULTITHREAD` for `gcc`)
|
25
|
-
- for POSIX systems : compile with pthread (`-pthread` compilation flag for `gcc`)
|
26
|
-
|
27
|
-
Both conditions are automatically applied when invoking `make lib-mt` target.
|
28
|
-
|
29
|
-
When linking a POSIX program with a multithreaded version of `libzstd`,
|
30
|
-
note that it's necessary to invoke the `-pthread` flag during link stage.
|
31
|
-
|
32
|
-
Multithreading capabilities are exposed
|
33
|
-
via the [advanced API defined in `lib/zstd.h`](https://github.com/facebook/zstd/blob/v1.4.3/lib/zstd.h#L351).
|
34
|
-
|
35
|
-
|
36
|
-
#### API
|
37
|
-
|
38
|
-
Zstandard's stable API is exposed within [lib/zstd.h](zstd.h).
|
39
|
-
|
40
|
-
|
41
|
-
#### Advanced API
|
42
|
-
|
43
|
-
Optional advanced features are exposed via :
|
44
|
-
|
45
|
-
- `lib/common/zstd_errors.h` : translates `size_t` function results
|
46
|
-
into a `ZSTD_ErrorCode`, for accurate error handling.
|
47
|
-
|
48
|
-
- `ZSTD_STATIC_LINKING_ONLY` : if this macro is defined _before_ including `zstd.h`,
|
49
|
-
it unlocks access to the experimental API,
|
50
|
-
exposed in the second part of `zstd.h`.
|
51
|
-
All definitions in the experimental APIs are unstable,
|
52
|
-
they may still change in the future, or even be removed.
|
53
|
-
As a consequence, experimental definitions shall ___never be used with dynamic library___ !
|
54
|
-
Only static linking is allowed.
|
55
|
-
|
56
|
-
|
57
|
-
#### Modular build
|
58
|
-
|
59
|
-
It's possible to compile only a limited set of features within `libzstd`.
|
60
|
-
The file structure is designed to make this selection manually achievable for any build system :
|
61
|
-
|
62
|
-
- Directory `lib/common` is always required, for all variants.
|
63
|
-
|
64
|
-
- Compression source code lies in `lib/compress`
|
65
|
-
|
66
|
-
- Decompression source code lies in `lib/decompress`
|
67
|
-
|
68
|
-
- It's possible to include only `compress` or only `decompress`, they don't depend on each other.
|
69
|
-
|
70
|
-
- `lib/dictBuilder` : makes it possible to generate dictionaries from a set of samples.
|
71
|
-
The API is exposed in `lib/dictBuilder/zdict.h`.
|
72
|
-
This module depends on both `lib/common` and `lib/compress` .
|
73
|
-
|
74
|
-
- `lib/legacy` : makes it possible to decompress legacy zstd formats, starting from `v0.1.0`.
|
75
|
-
This module depends on `lib/common` and `lib/decompress`.
|
76
|
-
To enable this feature, define `ZSTD_LEGACY_SUPPORT` during compilation.
|
77
|
-
Specifying a number limits versions supported to that version onward.
|
78
|
-
For example, `ZSTD_LEGACY_SUPPORT=2` means : "support legacy formats >= v0.2.0".
|
79
|
-
Conversely, `ZSTD_LEGACY_SUPPORT=0` means "do __not__ support legacy formats".
|
80
|
-
By default, this build macro is set as `ZSTD_LEGACY_SUPPORT=5`.
|
81
|
-
Decoding supported legacy format is a transparent capability triggered within decompression functions.
|
82
|
-
It's also allowed to invoke legacy API directly, exposed in `lib/legacy/zstd_legacy.h`.
|
83
|
-
Each version does also provide its own set of advanced API.
|
84
|
-
For example, advanced API for version `v0.4` is exposed in `lib/legacy/zstd_v04.h` .
|
85
|
-
|
86
|
-
- While invoking `make libzstd`, it's possible to define build macros
|
87
|
-
`ZSTD_LIB_COMPRESSION, ZSTD_LIB_DECOMPRESSION`, `ZSTD_LIB_DICTBUILDER`,
|
88
|
-
and `ZSTD_LIB_DEPRECATED` as `0` to forgo compilation of the corresponding features.
|
89
|
-
This will also disable compilation of all dependencies
|
90
|
-
(eg. `ZSTD_LIB_COMPRESSION=0` will also disable dictBuilder).
|
91
|
-
|
92
|
-
- There are some additional build macros that can be used to minify the decoder.
|
93
|
-
|
94
|
-
Zstandard often has more than one implementation of a piece of functionality,
|
95
|
-
where each implementation optimizes for different scenarios. For example, the
|
96
|
-
Huffman decoder has complementary implementations that decode the stream one
|
97
|
-
symbol at a time or two symbols at a time. Zstd normally includes both (and
|
98
|
-
dispatches between them at runtime), but by defining `HUF_FORCE_DECOMPRESS_X1`
|
99
|
-
or `HUF_FORCE_DECOMPRESS_X2`, you can force the use of one or the other, avoiding
|
100
|
-
compilation of the other. Similarly, `ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT`
|
101
|
-
and `ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG` force the compilation and use of
|
102
|
-
only one or the other of two decompression implementations. The smallest
|
103
|
-
binary is achieved by using `HUF_FORCE_DECOMPRESS_X1` and
|
104
|
-
`ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT`.
|
105
|
-
|
106
|
-
For squeezing the last ounce of size out, you can also define
|
107
|
-
`ZSTD_NO_INLINE`, which disables inlining, and `ZSTD_STRIP_ERROR_STRINGS`,
|
108
|
-
which removes the error messages that are otherwise returned by
|
109
|
-
`ZSTD_getErrorName`.
|
110
|
-
|
111
|
-
- While invoking `make libzstd`, the build macro `ZSTD_LEGACY_MULTITHREADED_API=1`
|
112
|
-
will expose the deprecated `ZSTDMT` API exposed by `zstdmt_compress.h` in
|
113
|
-
the shared library, which is now hidden by default.
|
114
|
-
|
115
|
-
- The build macro `DYNAMIC_BMI2` can be set to 1 or 0 in order to generate binaries
|
116
|
-
which can detect at runtime the presence of BMI2 instructions, and use them only if present.
|
117
|
-
These instructions contribute to better performance, notably on the decoder side.
|
118
|
-
By default, this feature is automatically enabled on detecting
|
119
|
-
the right instruction set (x64) and compiler (clang or gcc >= 5).
|
120
|
-
It's obviously disabled for different cpus,
|
121
|
-
or when BMI2 instruction set is _required_ by the compiler command line
|
122
|
-
(in this case, only the BMI2 code path is generated).
|
123
|
-
Setting this macro will either force to generate the BMI2 dispatcher (1)
|
124
|
-
or prevent it (0). It overrides automatic detection.
|
125
|
-
|
126
|
-
|
127
|
-
#### Windows : using MinGW+MSYS to create DLL
|
128
|
-
|
129
|
-
DLL can be created using MinGW+MSYS with the `make libzstd` command.
|
130
|
-
This command creates `dll\libzstd.dll` and the import library `dll\libzstd.lib`.
|
131
|
-
The import library is only required with Visual C++.
|
132
|
-
The header file `zstd.h` and the dynamic library `dll\libzstd.dll` are required to
|
133
|
-
compile a project using gcc/MinGW.
|
134
|
-
The dynamic library has to be added to linking options.
|
135
|
-
It means that if a project that uses ZSTD consists of a single `test-dll.c`
|
136
|
-
file it should be linked with `dll\libzstd.dll`. For example:
|
137
|
-
```
|
138
|
-
gcc $(CFLAGS) -Iinclude/ test-dll.c -o test-dll dll\libzstd.dll
|
139
|
-
```
|
140
|
-
The compiled executable will require ZSTD DLL which is available at `dll\libzstd.dll`.
|
141
|
-
|
142
|
-
|
143
|
-
#### Deprecated API
|
144
|
-
|
145
|
-
Obsolete API on their way out are stored in directory `lib/deprecated`.
|
146
|
-
At this stage, it contains older streaming prototypes, in `lib/deprecated/zbuff.h`.
|
147
|
-
These prototypes will be removed in some future version.
|
148
|
-
Consider migrating code towards supported streaming API exposed in `zstd.h`.
|
149
|
-
|
150
|
-
|
151
|
-
#### Miscellaneous
|
152
|
-
|
153
|
-
The other files are not source code. There are :
|
154
|
-
|
155
|
-
- `BUCK` : support for `buck` build system (https://buckbuild.com/)
|
156
|
-
- `Makefile` : `make` script to build and install zstd library (static and dynamic)
|
157
|
-
- `README.md` : this file
|
158
|
-
- `dll/` : resources directory for Windows compilation
|
159
|
-
- `libzstd.pc.in` : script for `pkg-config` (used in `make install`)
|
@@ -1,214 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (c) 2016-present, 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
|
-
/* ***************************************************************
|
12
|
-
* NOTES/WARNINGS
|
13
|
-
******************************************************************/
|
14
|
-
/* The streaming API defined here is deprecated.
|
15
|
-
* Consider migrating towards ZSTD_compressStream() API in `zstd.h`
|
16
|
-
* See 'lib/README.md'.
|
17
|
-
*****************************************************************/
|
18
|
-
|
19
|
-
|
20
|
-
#if defined (__cplusplus)
|
21
|
-
extern "C" {
|
22
|
-
#endif
|
23
|
-
|
24
|
-
#ifndef ZSTD_BUFFERED_H_23987
|
25
|
-
#define ZSTD_BUFFERED_H_23987
|
26
|
-
|
27
|
-
/* *************************************
|
28
|
-
* Dependencies
|
29
|
-
***************************************/
|
30
|
-
#include <stddef.h> /* size_t */
|
31
|
-
#include "zstd.h" /* ZSTD_CStream, ZSTD_DStream, ZSTDLIB_API */
|
32
|
-
|
33
|
-
|
34
|
-
/* ***************************************************************
|
35
|
-
* Compiler specifics
|
36
|
-
*****************************************************************/
|
37
|
-
/* Deprecation warnings */
|
38
|
-
/* Should these warnings be a problem,
|
39
|
-
* it is generally possible to disable them,
|
40
|
-
* typically with -Wno-deprecated-declarations for gcc
|
41
|
-
* or _CRT_SECURE_NO_WARNINGS in Visual.
|
42
|
-
* Otherwise, it's also possible to define ZBUFF_DISABLE_DEPRECATE_WARNINGS
|
43
|
-
*/
|
44
|
-
#ifdef ZBUFF_DISABLE_DEPRECATE_WARNINGS
|
45
|
-
# define ZBUFF_DEPRECATED(message) ZSTDLIB_API /* disable deprecation warnings */
|
46
|
-
#else
|
47
|
-
# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */
|
48
|
-
# define ZBUFF_DEPRECATED(message) [[deprecated(message)]] ZSTDLIB_API
|
49
|
-
# elif (defined(GNUC) && (GNUC > 4 || (GNUC == 4 && GNUC_MINOR >= 5))) || defined(__clang__)
|
50
|
-
# define ZBUFF_DEPRECATED(message) ZSTDLIB_API __attribute__((deprecated(message)))
|
51
|
-
# elif defined(__GNUC__) && (__GNUC__ >= 3)
|
52
|
-
# define ZBUFF_DEPRECATED(message) ZSTDLIB_API __attribute__((deprecated))
|
53
|
-
# elif defined(_MSC_VER)
|
54
|
-
# define ZBUFF_DEPRECATED(message) ZSTDLIB_API __declspec(deprecated(message))
|
55
|
-
# else
|
56
|
-
# pragma message("WARNING: You need to implement ZBUFF_DEPRECATED for this compiler")
|
57
|
-
# define ZBUFF_DEPRECATED(message) ZSTDLIB_API
|
58
|
-
# endif
|
59
|
-
#endif /* ZBUFF_DISABLE_DEPRECATE_WARNINGS */
|
60
|
-
|
61
|
-
|
62
|
-
/* *************************************
|
63
|
-
* Streaming functions
|
64
|
-
***************************************/
|
65
|
-
/* This is the easier "buffered" streaming API,
|
66
|
-
* using an internal buffer to lift all restrictions on user-provided buffers
|
67
|
-
* which can be any size, any place, for both input and output.
|
68
|
-
* ZBUFF and ZSTD are 100% interoperable,
|
69
|
-
* frames created by one can be decoded by the other one */
|
70
|
-
|
71
|
-
typedef ZSTD_CStream ZBUFF_CCtx;
|
72
|
-
ZBUFF_DEPRECATED("use ZSTD_createCStream") ZBUFF_CCtx* ZBUFF_createCCtx(void);
|
73
|
-
ZBUFF_DEPRECATED("use ZSTD_freeCStream") size_t ZBUFF_freeCCtx(ZBUFF_CCtx* cctx);
|
74
|
-
|
75
|
-
ZBUFF_DEPRECATED("use ZSTD_initCStream") size_t ZBUFF_compressInit(ZBUFF_CCtx* cctx, int compressionLevel);
|
76
|
-
ZBUFF_DEPRECATED("use ZSTD_initCStream_usingDict") size_t ZBUFF_compressInitDictionary(ZBUFF_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel);
|
77
|
-
|
78
|
-
ZBUFF_DEPRECATED("use ZSTD_compressStream") size_t ZBUFF_compressContinue(ZBUFF_CCtx* cctx, void* dst, size_t* dstCapacityPtr, const void* src, size_t* srcSizePtr);
|
79
|
-
ZBUFF_DEPRECATED("use ZSTD_flushStream") size_t ZBUFF_compressFlush(ZBUFF_CCtx* cctx, void* dst, size_t* dstCapacityPtr);
|
80
|
-
ZBUFF_DEPRECATED("use ZSTD_endStream") size_t ZBUFF_compressEnd(ZBUFF_CCtx* cctx, void* dst, size_t* dstCapacityPtr);
|
81
|
-
|
82
|
-
/*-*************************************************
|
83
|
-
* Streaming compression - howto
|
84
|
-
*
|
85
|
-
* A ZBUFF_CCtx object is required to track streaming operation.
|
86
|
-
* Use ZBUFF_createCCtx() and ZBUFF_freeCCtx() to create/release resources.
|
87
|
-
* ZBUFF_CCtx objects can be reused multiple times.
|
88
|
-
*
|
89
|
-
* Start by initializing ZBUF_CCtx.
|
90
|
-
* Use ZBUFF_compressInit() to start a new compression operation.
|
91
|
-
* Use ZBUFF_compressInitDictionary() for a compression which requires a dictionary.
|
92
|
-
*
|
93
|
-
* Use ZBUFF_compressContinue() repetitively to consume input stream.
|
94
|
-
* *srcSizePtr and *dstCapacityPtr can be any size.
|
95
|
-
* The function will report how many bytes were read or written within *srcSizePtr and *dstCapacityPtr.
|
96
|
-
* Note that it may not consume the entire input, in which case it's up to the caller to present again remaining data.
|
97
|
-
* The content of `dst` will be overwritten (up to *dstCapacityPtr) at each call, so save its content if it matters or change @dst .
|
98
|
-
* @return : a hint to preferred nb of bytes to use as input for next function call (it's just a hint, to improve latency)
|
99
|
-
* or an error code, which can be tested using ZBUFF_isError().
|
100
|
-
*
|
101
|
-
* At any moment, it's possible to flush whatever data remains within buffer, using ZBUFF_compressFlush().
|
102
|
-
* The nb of bytes written into `dst` will be reported into *dstCapacityPtr.
|
103
|
-
* Note that the function cannot output more than *dstCapacityPtr,
|
104
|
-
* therefore, some content might still be left into internal buffer if *dstCapacityPtr is too small.
|
105
|
-
* @return : nb of bytes still present into internal buffer (0 if it's empty)
|
106
|
-
* or an error code, which can be tested using ZBUFF_isError().
|
107
|
-
*
|
108
|
-
* ZBUFF_compressEnd() instructs to finish a frame.
|
109
|
-
* It will perform a flush and write frame epilogue.
|
110
|
-
* The epilogue is required for decoders to consider a frame completed.
|
111
|
-
* Similar to ZBUFF_compressFlush(), it may not be able to output the entire internal buffer content if *dstCapacityPtr is too small.
|
112
|
-
* In which case, call again ZBUFF_compressFlush() to complete the flush.
|
113
|
-
* @return : nb of bytes still present into internal buffer (0 if it's empty)
|
114
|
-
* or an error code, which can be tested using ZBUFF_isError().
|
115
|
-
*
|
116
|
-
* Hint : _recommended buffer_ sizes (not compulsory) : ZBUFF_recommendedCInSize() / ZBUFF_recommendedCOutSize()
|
117
|
-
* input : ZBUFF_recommendedCInSize==128 KB block size is the internal unit, use this value to reduce intermediate stages (better latency)
|
118
|
-
* output : ZBUFF_recommendedCOutSize==ZSTD_compressBound(128 KB) + 3 + 3 : ensures it's always possible to write/flush/end a full block. Skip some buffering.
|
119
|
-
* By using both, it ensures that input will be entirely consumed, and output will always contain the result, reducing intermediate buffering.
|
120
|
-
* **************************************************/
|
121
|
-
|
122
|
-
|
123
|
-
typedef ZSTD_DStream ZBUFF_DCtx;
|
124
|
-
ZBUFF_DEPRECATED("use ZSTD_createDStream") ZBUFF_DCtx* ZBUFF_createDCtx(void);
|
125
|
-
ZBUFF_DEPRECATED("use ZSTD_freeDStream") size_t ZBUFF_freeDCtx(ZBUFF_DCtx* dctx);
|
126
|
-
|
127
|
-
ZBUFF_DEPRECATED("use ZSTD_initDStream") size_t ZBUFF_decompressInit(ZBUFF_DCtx* dctx);
|
128
|
-
ZBUFF_DEPRECATED("use ZSTD_initDStream_usingDict") size_t ZBUFF_decompressInitDictionary(ZBUFF_DCtx* dctx, const void* dict, size_t dictSize);
|
129
|
-
|
130
|
-
ZBUFF_DEPRECATED("use ZSTD_decompressStream") size_t ZBUFF_decompressContinue(ZBUFF_DCtx* dctx,
|
131
|
-
void* dst, size_t* dstCapacityPtr,
|
132
|
-
const void* src, size_t* srcSizePtr);
|
133
|
-
|
134
|
-
/*-***************************************************************************
|
135
|
-
* Streaming decompression howto
|
136
|
-
*
|
137
|
-
* A ZBUFF_DCtx object is required to track streaming operations.
|
138
|
-
* Use ZBUFF_createDCtx() and ZBUFF_freeDCtx() to create/release resources.
|
139
|
-
* Use ZBUFF_decompressInit() to start a new decompression operation,
|
140
|
-
* or ZBUFF_decompressInitDictionary() if decompression requires a dictionary.
|
141
|
-
* Note that ZBUFF_DCtx objects can be re-init multiple times.
|
142
|
-
*
|
143
|
-
* Use ZBUFF_decompressContinue() repetitively to consume your input.
|
144
|
-
* *srcSizePtr and *dstCapacityPtr can be any size.
|
145
|
-
* The function will report how many bytes were read or written by modifying *srcSizePtr and *dstCapacityPtr.
|
146
|
-
* Note that it may not consume the entire input, in which case it's up to the caller to present remaining input again.
|
147
|
-
* The content of `dst` will be overwritten (up to *dstCapacityPtr) at each function call, so save its content if it matters, or change `dst`.
|
148
|
-
* @return : 0 when a frame is completely decoded and fully flushed,
|
149
|
-
* 1 when there is still some data left within internal buffer to flush,
|
150
|
-
* >1 when more data is expected, with value being a suggested next input size (it's just a hint, which helps latency),
|
151
|
-
* or an error code, which can be tested using ZBUFF_isError().
|
152
|
-
*
|
153
|
-
* Hint : recommended buffer sizes (not compulsory) : ZBUFF_recommendedDInSize() and ZBUFF_recommendedDOutSize()
|
154
|
-
* output : ZBUFF_recommendedDOutSize== 128 KB block size is the internal unit, it ensures it's always possible to write a full block when decoded.
|
155
|
-
* input : ZBUFF_recommendedDInSize == 128KB + 3;
|
156
|
-
* just follow indications from ZBUFF_decompressContinue() to minimize latency. It should always be <= 128 KB + 3 .
|
157
|
-
* *******************************************************************************/
|
158
|
-
|
159
|
-
|
160
|
-
/* *************************************
|
161
|
-
* Tool functions
|
162
|
-
***************************************/
|
163
|
-
ZBUFF_DEPRECATED("use ZSTD_isError") unsigned ZBUFF_isError(size_t errorCode);
|
164
|
-
ZBUFF_DEPRECATED("use ZSTD_getErrorName") const char* ZBUFF_getErrorName(size_t errorCode);
|
165
|
-
|
166
|
-
/** Functions below provide recommended buffer sizes for Compression or Decompression operations.
|
167
|
-
* These sizes are just hints, they tend to offer better latency */
|
168
|
-
ZBUFF_DEPRECATED("use ZSTD_CStreamInSize") size_t ZBUFF_recommendedCInSize(void);
|
169
|
-
ZBUFF_DEPRECATED("use ZSTD_CStreamOutSize") size_t ZBUFF_recommendedCOutSize(void);
|
170
|
-
ZBUFF_DEPRECATED("use ZSTD_DStreamInSize") size_t ZBUFF_recommendedDInSize(void);
|
171
|
-
ZBUFF_DEPRECATED("use ZSTD_DStreamOutSize") size_t ZBUFF_recommendedDOutSize(void);
|
172
|
-
|
173
|
-
#endif /* ZSTD_BUFFERED_H_23987 */
|
174
|
-
|
175
|
-
|
176
|
-
#ifdef ZBUFF_STATIC_LINKING_ONLY
|
177
|
-
#ifndef ZBUFF_STATIC_H_30298098432
|
178
|
-
#define ZBUFF_STATIC_H_30298098432
|
179
|
-
|
180
|
-
/* ====================================================================================
|
181
|
-
* The definitions in this section are considered experimental.
|
182
|
-
* They should never be used in association with a dynamic library, as they may change in the future.
|
183
|
-
* They are provided for advanced usages.
|
184
|
-
* Use them only in association with static linking.
|
185
|
-
* ==================================================================================== */
|
186
|
-
|
187
|
-
/*--- Dependency ---*/
|
188
|
-
#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_parameters, ZSTD_customMem */
|
189
|
-
#include "zstd.h"
|
190
|
-
|
191
|
-
|
192
|
-
/*--- Custom memory allocator ---*/
|
193
|
-
/*! ZBUFF_createCCtx_advanced() :
|
194
|
-
* Create a ZBUFF compression context using external alloc and free functions */
|
195
|
-
ZBUFF_DEPRECATED("use ZSTD_createCStream_advanced") ZBUFF_CCtx* ZBUFF_createCCtx_advanced(ZSTD_customMem customMem);
|
196
|
-
|
197
|
-
/*! ZBUFF_createDCtx_advanced() :
|
198
|
-
* Create a ZBUFF decompression context using external alloc and free functions */
|
199
|
-
ZBUFF_DEPRECATED("use ZSTD_createDStream_advanced") ZBUFF_DCtx* ZBUFF_createDCtx_advanced(ZSTD_customMem customMem);
|
200
|
-
|
201
|
-
|
202
|
-
/*--- Advanced Streaming Initialization ---*/
|
203
|
-
ZBUFF_DEPRECATED("use ZSTD_initDStream_usingDict") size_t ZBUFF_compressInit_advanced(ZBUFF_CCtx* zbc,
|
204
|
-
const void* dict, size_t dictSize,
|
205
|
-
ZSTD_parameters params, unsigned long long pledgedSrcSize);
|
206
|
-
|
207
|
-
|
208
|
-
#endif /* ZBUFF_STATIC_H_30298098432 */
|
209
|
-
#endif /* ZBUFF_STATIC_LINKING_ONLY */
|
210
|
-
|
211
|
-
|
212
|
-
#if defined (__cplusplus)
|
213
|
-
}
|
214
|
-
#endif
|
@@ -1,26 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (c) 2016-present, 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
|
-
/*-*************************************
|
12
|
-
* Dependencies
|
13
|
-
***************************************/
|
14
|
-
#include "error_private.h"
|
15
|
-
#include "zbuff.h"
|
16
|
-
|
17
|
-
/*-****************************************
|
18
|
-
* ZBUFF Error Management (deprecated)
|
19
|
-
******************************************/
|
20
|
-
|
21
|
-
/*! ZBUFF_isError() :
|
22
|
-
* tells if a return value is an error code */
|
23
|
-
unsigned ZBUFF_isError(size_t errorCode) { return ERR_isError(errorCode); }
|
24
|
-
/*! ZBUFF_getErrorName() :
|
25
|
-
* provides error code string from function result (useful for debugging) */
|
26
|
-
const char* ZBUFF_getErrorName(size_t errorCode) { return ERR_getErrorName(errorCode); }
|
@@ -1,147 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (c) 2016-present, 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
|
-
|
12
|
-
|
13
|
-
/* *************************************
|
14
|
-
* Dependencies
|
15
|
-
***************************************/
|
16
|
-
#define ZBUFF_STATIC_LINKING_ONLY
|
17
|
-
#include "zbuff.h"
|
18
|
-
|
19
|
-
|
20
|
-
/*-***********************************************************
|
21
|
-
* Streaming compression
|
22
|
-
*
|
23
|
-
* A ZBUFF_CCtx object is required to track streaming operation.
|
24
|
-
* Use ZBUFF_createCCtx() and ZBUFF_freeCCtx() to create/release resources.
|
25
|
-
* Use ZBUFF_compressInit() to start a new compression operation.
|
26
|
-
* ZBUFF_CCtx objects can be reused multiple times.
|
27
|
-
*
|
28
|
-
* Use ZBUFF_compressContinue() repetitively to consume your input.
|
29
|
-
* *srcSizePtr and *dstCapacityPtr can be any size.
|
30
|
-
* The function will report how many bytes were read or written by modifying *srcSizePtr and *dstCapacityPtr.
|
31
|
-
* 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.
|
32
|
-
* The content of dst will be overwritten (up to *dstCapacityPtr) at each function call, so save its content if it matters or change dst .
|
33
|
-
* @return : a hint to preferred nb of bytes to use as input for next function call (it's only a hint, to improve latency)
|
34
|
-
* or an error code, which can be tested using ZBUFF_isError().
|
35
|
-
*
|
36
|
-
* ZBUFF_compressFlush() can be used to instruct ZBUFF to compress and output whatever remains within its buffer.
|
37
|
-
* Note that it will not output more than *dstCapacityPtr.
|
38
|
-
* Therefore, some content might still be left into its internal buffer if dst buffer is too small.
|
39
|
-
* @return : nb of bytes still present into internal buffer (0 if it's empty)
|
40
|
-
* or an error code, which can be tested using ZBUFF_isError().
|
41
|
-
*
|
42
|
-
* ZBUFF_compressEnd() instructs to finish a frame.
|
43
|
-
* It will perform a flush and write frame epilogue.
|
44
|
-
* Similar to ZBUFF_compressFlush(), it may not be able to output the entire internal buffer content if *dstCapacityPtr is too small.
|
45
|
-
* @return : nb of bytes still present into internal buffer (0 if it's empty)
|
46
|
-
* or an error code, which can be tested using ZBUFF_isError().
|
47
|
-
*
|
48
|
-
* Hint : recommended buffer sizes (not compulsory)
|
49
|
-
* input : ZSTD_BLOCKSIZE_MAX (128 KB), internal unit size, it improves latency to use this value.
|
50
|
-
* output : ZSTD_compressBound(ZSTD_BLOCKSIZE_MAX) + ZSTD_blockHeaderSize + ZBUFF_endFrameSize : ensures it's always possible to write/flush/end a full block at best speed.
|
51
|
-
* ***********************************************************/
|
52
|
-
|
53
|
-
ZBUFF_CCtx* ZBUFF_createCCtx(void)
|
54
|
-
{
|
55
|
-
return ZSTD_createCStream();
|
56
|
-
}
|
57
|
-
|
58
|
-
ZBUFF_CCtx* ZBUFF_createCCtx_advanced(ZSTD_customMem customMem)
|
59
|
-
{
|
60
|
-
return ZSTD_createCStream_advanced(customMem);
|
61
|
-
}
|
62
|
-
|
63
|
-
size_t ZBUFF_freeCCtx(ZBUFF_CCtx* zbc)
|
64
|
-
{
|
65
|
-
return ZSTD_freeCStream(zbc);
|
66
|
-
}
|
67
|
-
|
68
|
-
|
69
|
-
/* ====== Initialization ====== */
|
70
|
-
|
71
|
-
size_t ZBUFF_compressInit_advanced(ZBUFF_CCtx* zbc,
|
72
|
-
const void* dict, size_t dictSize,
|
73
|
-
ZSTD_parameters params, unsigned long long pledgedSrcSize)
|
74
|
-
{
|
75
|
-
if (pledgedSrcSize==0) pledgedSrcSize = ZSTD_CONTENTSIZE_UNKNOWN; /* preserve "0 == unknown" behavior */
|
76
|
-
return ZSTD_initCStream_advanced(zbc, dict, dictSize, params, pledgedSrcSize);
|
77
|
-
}
|
78
|
-
|
79
|
-
|
80
|
-
size_t ZBUFF_compressInitDictionary(ZBUFF_CCtx* zbc, const void* dict, size_t dictSize, int compressionLevel)
|
81
|
-
{
|
82
|
-
return ZSTD_initCStream_usingDict(zbc, dict, dictSize, compressionLevel);
|
83
|
-
}
|
84
|
-
|
85
|
-
size_t ZBUFF_compressInit(ZBUFF_CCtx* zbc, int compressionLevel)
|
86
|
-
{
|
87
|
-
return ZSTD_initCStream(zbc, compressionLevel);
|
88
|
-
}
|
89
|
-
|
90
|
-
/* ====== Compression ====== */
|
91
|
-
|
92
|
-
|
93
|
-
size_t ZBUFF_compressContinue(ZBUFF_CCtx* zbc,
|
94
|
-
void* dst, size_t* dstCapacityPtr,
|
95
|
-
const void* src, size_t* srcSizePtr)
|
96
|
-
{
|
97
|
-
size_t result;
|
98
|
-
ZSTD_outBuffer outBuff;
|
99
|
-
ZSTD_inBuffer inBuff;
|
100
|
-
outBuff.dst = dst;
|
101
|
-
outBuff.pos = 0;
|
102
|
-
outBuff.size = *dstCapacityPtr;
|
103
|
-
inBuff.src = src;
|
104
|
-
inBuff.pos = 0;
|
105
|
-
inBuff.size = *srcSizePtr;
|
106
|
-
result = ZSTD_compressStream(zbc, &outBuff, &inBuff);
|
107
|
-
*dstCapacityPtr = outBuff.pos;
|
108
|
-
*srcSizePtr = inBuff.pos;
|
109
|
-
return result;
|
110
|
-
}
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
/* ====== Finalize ====== */
|
115
|
-
|
116
|
-
size_t ZBUFF_compressFlush(ZBUFF_CCtx* zbc, void* dst, size_t* dstCapacityPtr)
|
117
|
-
{
|
118
|
-
size_t result;
|
119
|
-
ZSTD_outBuffer outBuff;
|
120
|
-
outBuff.dst = dst;
|
121
|
-
outBuff.pos = 0;
|
122
|
-
outBuff.size = *dstCapacityPtr;
|
123
|
-
result = ZSTD_flushStream(zbc, &outBuff);
|
124
|
-
*dstCapacityPtr = outBuff.pos;
|
125
|
-
return result;
|
126
|
-
}
|
127
|
-
|
128
|
-
|
129
|
-
size_t ZBUFF_compressEnd(ZBUFF_CCtx* zbc, void* dst, size_t* dstCapacityPtr)
|
130
|
-
{
|
131
|
-
size_t result;
|
132
|
-
ZSTD_outBuffer outBuff;
|
133
|
-
outBuff.dst = dst;
|
134
|
-
outBuff.pos = 0;
|
135
|
-
outBuff.size = *dstCapacityPtr;
|
136
|
-
result = ZSTD_endStream(zbc, &outBuff);
|
137
|
-
*dstCapacityPtr = outBuff.pos;
|
138
|
-
return result;
|
139
|
-
}
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
/* *************************************
|
144
|
-
* Tool functions
|
145
|
-
***************************************/
|
146
|
-
size_t ZBUFF_recommendedCInSize(void) { return ZSTD_CStreamInSize(); }
|
147
|
-
size_t ZBUFF_recommendedCOutSize(void) { return ZSTD_CStreamOutSize(); }
|
@@ -1,75 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (c) 2016-present, 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
|
-
|
12
|
-
|
13
|
-
/* *************************************
|
14
|
-
* Dependencies
|
15
|
-
***************************************/
|
16
|
-
#define ZBUFF_STATIC_LINKING_ONLY
|
17
|
-
#include "zbuff.h"
|
18
|
-
|
19
|
-
|
20
|
-
ZBUFF_DCtx* ZBUFF_createDCtx(void)
|
21
|
-
{
|
22
|
-
return ZSTD_createDStream();
|
23
|
-
}
|
24
|
-
|
25
|
-
ZBUFF_DCtx* ZBUFF_createDCtx_advanced(ZSTD_customMem customMem)
|
26
|
-
{
|
27
|
-
return ZSTD_createDStream_advanced(customMem);
|
28
|
-
}
|
29
|
-
|
30
|
-
size_t ZBUFF_freeDCtx(ZBUFF_DCtx* zbd)
|
31
|
-
{
|
32
|
-
return ZSTD_freeDStream(zbd);
|
33
|
-
}
|
34
|
-
|
35
|
-
|
36
|
-
/* *** Initialization *** */
|
37
|
-
|
38
|
-
size_t ZBUFF_decompressInitDictionary(ZBUFF_DCtx* zbd, const void* dict, size_t dictSize)
|
39
|
-
{
|
40
|
-
return ZSTD_initDStream_usingDict(zbd, dict, dictSize);
|
41
|
-
}
|
42
|
-
|
43
|
-
size_t ZBUFF_decompressInit(ZBUFF_DCtx* zbd)
|
44
|
-
{
|
45
|
-
return ZSTD_initDStream(zbd);
|
46
|
-
}
|
47
|
-
|
48
|
-
|
49
|
-
/* *** Decompression *** */
|
50
|
-
|
51
|
-
size_t ZBUFF_decompressContinue(ZBUFF_DCtx* zbd,
|
52
|
-
void* dst, size_t* dstCapacityPtr,
|
53
|
-
const void* src, size_t* srcSizePtr)
|
54
|
-
{
|
55
|
-
ZSTD_outBuffer outBuff;
|
56
|
-
ZSTD_inBuffer inBuff;
|
57
|
-
size_t result;
|
58
|
-
outBuff.dst = dst;
|
59
|
-
outBuff.pos = 0;
|
60
|
-
outBuff.size = *dstCapacityPtr;
|
61
|
-
inBuff.src = src;
|
62
|
-
inBuff.pos = 0;
|
63
|
-
inBuff.size = *srcSizePtr;
|
64
|
-
result = ZSTD_decompressStream(zbd, &outBuff, &inBuff);
|
65
|
-
*dstCapacityPtr = outBuff.pos;
|
66
|
-
*srcSizePtr = inBuff.pos;
|
67
|
-
return result;
|
68
|
-
}
|
69
|
-
|
70
|
-
|
71
|
-
/* *************************************
|
72
|
-
* Tool functions
|
73
|
-
***************************************/
|
74
|
-
size_t ZBUFF_recommendedDInSize(void) { return ZSTD_DStreamInSize(); }
|
75
|
-
size_t ZBUFF_recommendedDOutSize(void) { return ZSTD_DStreamOutSize(); }
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# ################################################################
|
2
|
-
# Copyright (c) 2016-present, 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
|
-
# ################################################################
|
9
|
-
|
10
|
-
VOID := /dev/null
|
11
|
-
ZSTDDIR := ../include
|
12
|
-
LIBDIR := ../static
|
13
|
-
DLLDIR := ../dll
|
14
|
-
|
15
|
-
CFLAGS ?= -O3 # can select custom flags. For example : CFLAGS="-O2 -g" make
|
16
|
-
CFLAGS += -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum \
|
17
|
-
-Wdeclaration-after-statement -Wstrict-prototypes \
|
18
|
-
-Wpointer-arith -Wstrict-aliasing=1
|
19
|
-
CFLAGS += $(MOREFLAGS)
|
20
|
-
CPPFLAGS:= -I$(ZSTDDIR) -DXXH_NAMESPACE=ZSTD_
|
21
|
-
FLAGS := $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
|
22
|
-
|
23
|
-
|
24
|
-
# Define *.exe as extension for Windows systems
|
25
|
-
ifneq (,$(filter Windows%,$(OS)))
|
26
|
-
EXT =.exe
|
27
|
-
else
|
28
|
-
EXT =
|
29
|
-
endif
|
30
|
-
|
31
|
-
.PHONY: default fullbench-dll fullbench-lib
|
32
|
-
|
33
|
-
|
34
|
-
default: all
|
35
|
-
|
36
|
-
all: fullbench-dll fullbench-lib
|
37
|
-
|
38
|
-
|
39
|
-
fullbench-lib: fullbench.c datagen.c
|
40
|
-
$(CC) $(FLAGS) $^ -o $@$(EXT) $(LIBDIR)/libzstd_static.lib
|
41
|
-
|
42
|
-
fullbench-dll: fullbench.c datagen.c
|
43
|
-
$(CC) $(FLAGS) $^ -o $@$(EXT) -DZSTD_DLL_IMPORT=1 $(DLLDIR)/libzstd.dll
|
44
|
-
|
45
|
-
clean:
|
46
|
-
@$(RM) fullbench-dll$(EXT) fullbench-lib$(EXT) \
|
47
|
-
@echo Cleaning completed
|