Compare commits
173
Commits
staging
...
travisTest
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d99c70e426 | ||
|
|
705a62b612 | ||
|
|
a51e342ed1 | ||
|
|
8fae35591e | ||
|
|
d4548c96cb | ||
|
|
cb0cad9b79 | ||
|
|
c730b8c5a3 | ||
|
|
b35c250bf3 | ||
|
|
01fe4796fb | ||
|
|
8a53a882f2 | ||
|
|
9c23ea9e2b | ||
|
|
162f540402 | ||
|
|
28d0120b5a | ||
|
|
9fb5a0407c | ||
|
|
334ac69db7 | ||
|
|
439e58d060 | ||
|
|
5b6d38a99e | ||
|
|
6755baf940 | ||
|
|
4d9caa4928 | ||
|
|
1db5947591 | ||
|
|
13449d7ce1 | ||
|
|
66772efe73 | ||
|
|
9e94b7cac5 | ||
|
|
a4d55c8748 | ||
|
|
b4637d152a | ||
|
|
d8d6e48a0a | ||
|
|
91465e23b2 | ||
|
|
b2582de3c9 | ||
|
|
c2555f8c6f | ||
|
|
17b9e43c7d | ||
|
|
ee425faaa7 | ||
|
|
0d05846952 | ||
|
|
f36fbddbfa | ||
|
|
f44c720fa8 | ||
|
|
bd547232bc | ||
|
|
ee65162655 | ||
|
|
b052b583e5 | ||
|
|
698f261b35 | ||
|
|
e7e4b74b2b | ||
|
|
2b82948e58 | ||
|
|
1874f0844d | ||
|
|
6030cdfede | ||
|
|
2f7bbd6539 | ||
|
|
909925785a | ||
|
|
207e33bb61 | ||
|
|
2d34062836 | ||
|
|
fc8330b885 | ||
|
|
2e76bd7d10 | ||
|
|
d6be7659b0 | ||
|
|
26c7b0038e | ||
|
|
d2925de98a | ||
|
|
ce615d7fba | ||
|
|
172b4b6ac4 | ||
|
|
df05b2ba7c | ||
|
|
fed8589430 | ||
|
|
9750f3c87b | ||
|
|
4ba49af665 | ||
|
|
b062d97520 | ||
|
|
eb7e74ccb7 | ||
|
|
c2183d7cdf | ||
|
|
1d65917323 | ||
|
|
4f9c6fdb7f | ||
|
|
da61918c75 | ||
|
|
bea1b2ba70 | ||
|
|
45c4918ccf | ||
|
|
018ed6552a | ||
|
|
1fb10ba831 | ||
|
|
b87f97b3ea | ||
|
|
4e10ff15f5 | ||
|
|
2d10544b84 | ||
|
|
7ef6d7b36c | ||
|
|
8cde167a27 | ||
|
|
455fd1a067 | ||
|
|
53a60e98de | ||
|
|
c077f257b4 | ||
|
|
8389a5122b | ||
|
|
d40f55cd95 | ||
|
|
10e5513113 | ||
|
|
0b88c2582c | ||
|
|
e6c8a5dd40 | ||
|
|
94db4398a0 | ||
|
|
1026b9fa10 | ||
|
|
e58e9c7928 | ||
|
|
8a8899fc08 | ||
|
|
33f3e293e8 | ||
|
|
40cabd0efd | ||
|
|
1ffa80a09e | ||
|
|
a8ecf4ff88 | ||
|
|
da74f1c717 | ||
|
|
8f86c29c06 | ||
|
|
32823bc150 | ||
|
|
ee122baacf | ||
|
|
8aafbd3604 | ||
|
|
6f40571ae2 | ||
|
|
0b370e9da8 | ||
|
|
2e4fca38d8 | ||
|
|
34aff7ea06 | ||
|
|
cc31bb8b66 | ||
|
|
4c5cc345fb | ||
|
|
cdc979ddb3 | ||
|
|
0dabbd4ed7 | ||
|
|
61fe571af6 | ||
|
|
09149beaf8 | ||
|
|
0e2345b859 | ||
|
|
fbb9006e18 | ||
|
|
333dd60bff | ||
|
|
f8afc66573 | ||
|
|
6cee3c2c4f | ||
|
|
33abda4400 | ||
|
|
3e2fbfd056 | ||
|
|
3c595a4a79 | ||
|
|
14c11c7459 | ||
|
|
efa6dfa729 | ||
|
|
f80dec66b0 | ||
|
|
3eb3845898 | ||
|
|
a423305e7b | ||
|
|
3b98987496 | ||
|
|
c5869677d9 | ||
|
|
9c1ca3c00b | ||
|
|
12c045f74d | ||
|
|
ebd41ebe56 | ||
|
|
8844f93957 | ||
|
|
550f76f131 | ||
|
|
56421f34e4 | ||
|
|
4d63d6e8aa | ||
|
|
4694423c4f | ||
|
|
f71aabb5b5 | ||
|
|
f1e8b565c2 | ||
|
|
e38124555e | ||
|
|
8383fc828d | ||
|
|
e7647180cd | ||
|
|
980f3bbf83 | ||
|
|
255925c231 | ||
|
|
d334ad2ff4 | ||
|
|
a494308ae9 | ||
|
|
84ccb81e7c | ||
|
|
b1a43455f8 | ||
|
|
ab216bc2c5 | ||
|
|
bbbd578f45 | ||
|
|
4fe2e7ae14 | ||
|
|
f27e326456 | ||
|
|
1cadf86b39 | ||
|
|
b0407b9f0e | ||
|
|
ef4e26bda5 | ||
|
|
2a907bf4aa | ||
|
|
e398744a35 | ||
|
|
f8ac0ea7ef | ||
|
|
bf542c8a8d | ||
|
|
8889ca36fc | ||
|
|
5b566ebe08 | ||
|
|
0ef1f935b7 | ||
|
|
c90e81a692 | ||
|
|
e34332834a | ||
|
|
41c3eae6d9 | ||
|
|
0633bf17c3 | ||
|
|
eb1ee8686d | ||
|
|
e2bb215117 | ||
|
|
de52de1347 | ||
|
|
f06f6626ed | ||
|
|
c56d6e49e8 | ||
|
|
2949a95224 | ||
|
|
c05c090cc2 | ||
|
|
0f99a0d987 | ||
|
|
f5434663ea | ||
|
|
a5bf09d764 | ||
|
|
386111adec | ||
|
|
98764493cf | ||
|
|
ea288e0d8e | ||
|
|
cd1551d261 | ||
|
|
7222614a19 | ||
|
|
e4b914e663 | ||
|
|
49a9e070f5 | ||
|
|
d2dd35ae65 |
@@ -30,6 +30,9 @@ jobs:
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DEVNULLRIGHTS: 1
|
||||
READFROMBLOCKDEVICE: 1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: make test
|
||||
@@ -55,11 +58,9 @@ jobs:
|
||||
CC=gcc-7 CFLAGS=-Werror make -j all
|
||||
make clean
|
||||
LDFLAGS=-Wl,--no-undefined make -C lib libzstd-mt
|
||||
make -C tests zbufftest-dll
|
||||
|
||||
# candidate test (to check) : underlink test
|
||||
# LDFLAGS=-Wl,--no-undefined : will make the linker fail if dll is underlinked
|
||||
# zbufftest-dll : test that a user program can link to multi-threaded libzstd without specifying -pthread
|
||||
|
||||
gcc-8-asan-ubsan-testzstd:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -126,6 +127,16 @@ jobs:
|
||||
make libc6install
|
||||
CFLAGS="-O2 -m32" FUZZER_FLAGS="--long-tests" make uasan-fuzztest
|
||||
|
||||
clang-msan-fuzz:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: clang + MSan + Fuzz Test
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install clang
|
||||
CC=clang FUZZER_FLAGS="--long-tests" make clean msan-fuzztest
|
||||
|
||||
asan-ubsan-msan-regression:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
@@ -25,14 +25,6 @@ jobs:
|
||||
make test
|
||||
# make -c lib all (need to fix. not working right now)
|
||||
|
||||
zbuff:
|
||||
runs-on: ubuntu-16.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: zbuff test
|
||||
run: |
|
||||
make -C tests test-zbuff
|
||||
|
||||
tsan:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
@@ -50,3 +50,5 @@ googletest/
|
||||
*.code-workspace
|
||||
compile_commands.json
|
||||
.clangd
|
||||
perf.data
|
||||
perf.data.old
|
||||
|
||||
+2
-2
@@ -124,8 +124,8 @@ matrix:
|
||||
|
||||
# meson dedicated test
|
||||
- name: Xenial (Meson + clang) # ~15mn
|
||||
if: branch = release
|
||||
dist: xenial
|
||||
if: branch = travisTest
|
||||
dist: bionic
|
||||
language: cpp
|
||||
compiler: clang
|
||||
install:
|
||||
|
||||
@@ -1,3 +1,59 @@
|
||||
v1.5.0 (May 11, 2021)
|
||||
api: Various functions promoted from experimental to stable API: (#2579-2581, @senhuang42)
|
||||
`ZSTD_defaultCLevel()`
|
||||
`ZSTD_getDictID_fromCDict()`
|
||||
api: Several experimental functions have been deprecated and will emit a compiler warning (#2582, @senhuang42)
|
||||
`ZSTD_compress_advanced()`
|
||||
`ZSTD_compress_usingCDict_advanced()`
|
||||
`ZSTD_compressBegin_advanced()`
|
||||
`ZSTD_compressBegin_usingCDict_advanced()`
|
||||
`ZSTD_initCStream_srcSize()`
|
||||
`ZSTD_initCStream_usingDict()`
|
||||
`ZSTD_initCStream_usingCDict()`
|
||||
`ZSTD_initCStream_advanced()`
|
||||
`ZSTD_initCStream_usingCDict_advanced()`
|
||||
`ZSTD_resetCStream()`
|
||||
api: ZSTDMT_NBWORKERS_MAX reduced to 64 for 32-bit environments (@Cyan4973)
|
||||
perf: Significant speed improvements for middle compression levels (#2494, @senhuang42 @terrelln)
|
||||
perf: Block splitter to improve compression ratio, enabled by default for high compression levels (#2447, @senhuang42)
|
||||
perf: Decompression loop refactor, speed improvements on `clang` and for `--long` modes (#2614 #2630, @Cyan4973)
|
||||
perf: Reduced stack usage during compression and decompression entropy stage (#2522 #2524, @terrelln)
|
||||
bug: Improve setting permissions of created files (#2525, @felixhandte)
|
||||
bug: Fix large dictionary non-determinism (#2607, @terrelln)
|
||||
bug: Fix non-determinism test failures on Linux i686 (#2606, @terrelln)
|
||||
bug: Fix various dedicated dictionary search bugs (#2540 #2586, @senhuang42 @felixhandte)
|
||||
bug: Ensure `ZSTD_estimateCCtxSize*() `monotonically increases with compression level (#2538, @senhuang42)
|
||||
bug: Fix --patch-from mode parameter bound bug with small files (#2637, @occivink)
|
||||
bug: Fix UBSAN error in decompression (#2625, @terrelln)
|
||||
bug: Fix superblock compression divide by zero bug (#2592, @senhuang42)
|
||||
bug: Make the number of physical CPU cores detection more robust (#2517, @PaulBone)
|
||||
doc: Improve `zdict.h` dictionary training API documentation (#2622, @terrelln)
|
||||
doc: Note that public `ZSTD_free*()` functions accept NULL pointers (#2521, @animalize)
|
||||
doc: Add style guide docs for open source contributors (#2626, @Cyan4973)
|
||||
tests: Better regression test coverage for different dictionary modes (#2559, @senhuang42)
|
||||
tests: Better test coverage of index reduction (#2603, @terrelln)
|
||||
tests: OSS-Fuzz coverage for seekable format (#2617, @senhuang42)
|
||||
tests: Test coverage for ZSTD threadpool API (#2604, @senhuang42)
|
||||
build: Dynamic library built multithreaded by default (#2584, @senhuang42)
|
||||
build: Move `zstd_errors.h` and `zdict.h` to `lib/` root (#2597, @terrelln)
|
||||
build: Allow `ZSTDMT_JOBSIZE_MIN` to be configured at compile-time, reduce default to 512KB (#2611, @Cyan4973)
|
||||
build: Single file library build script moved to `build/` directory (#2618, @felixhandte)
|
||||
build: `ZBUFF_*()` is no longer built by default (#2583, @senhuang42)
|
||||
build: Fixed Meson build (#2548, @SupervisedThinking @kloczek)
|
||||
build: Fix excessive compiler warnings with clang-cl and CMake (#2600, @nickhutchinson)
|
||||
build: Detect presence of `md5` on Darwin (#2609, @felixhandte)
|
||||
build: Avoid SIGBUS on armv6 (#2633, @bmwiedmann)
|
||||
cli: `--progress` flag added to always display progress bar (#2595, @senhuang42)
|
||||
cli: Allow reading from block devices with `--force` (#2613, @felixhandte)
|
||||
cli: Fix CLI filesize display bug (#2550, @Cyan4973)
|
||||
cli: Fix windows CLI `--filelist` end-of-line bug (#2620, @Cyan4973)
|
||||
contrib: Various fixes for linux kernel patch (#2539, @terrelln)
|
||||
contrib: Seekable format - Decompression hanging edge case fix (#2516, @senhuang42)
|
||||
contrib: Seekable format - New seek table-only API (#2113 #2518, @mdittmer @Cyan4973)
|
||||
contrib: Seekable format - Fix seek table descriptor check when loading (#2534, @foxeng)
|
||||
contrib: Seekable format - Decompression fix for large offsets, (#2594, @azat)
|
||||
misc: Automatically published release tarballs available on Github (#2535, @felixhandte)
|
||||
|
||||
v1.4.9 (Mar 1, 2021)
|
||||
bug: Use `umask()` to Constrain Created File Permissions (#2495, @felixhandte)
|
||||
bug: Make Simple Single-Pass Functions Ignore Advanced Parameters (#2498, @terrelln)
|
||||
|
||||
@@ -399,7 +399,105 @@ disclosure of security bugs. In those cases, please go through the process
|
||||
outlined on that page and do not file a public issue.
|
||||
|
||||
## Coding Style
|
||||
It's a pretty long topic, which is difficult to summarize in a single paragraph.
|
||||
As a rule of thumbs, try to imitate the coding style of
|
||||
similar lines of codes around your contribution.
|
||||
The following is a non-exhaustive list of rules employed in zstd code base:
|
||||
|
||||
### C90
|
||||
This code base is following strict C90 standard,
|
||||
with 2 extensions : 64-bit `long long` types, and variadic macros.
|
||||
This rule is applied strictly to code within `lib/` and `programs/`.
|
||||
Sub-project in `contrib/` are allowed to use other conventions.
|
||||
|
||||
### C++ direct compatibility : symbol mangling
|
||||
All public symbol declarations must be wrapped in `extern “C” { … }`,
|
||||
so that this project can be compiled as C++98 code,
|
||||
and linked into C++ applications.
|
||||
|
||||
### Minimal Frugal
|
||||
This design requirement is fundamental to preserve the portability of the code base.
|
||||
#### Dependencies
|
||||
- Reduce dependencies to the minimum possible level.
|
||||
Any dependency should be considered “bad” by default,
|
||||
and only tolerated because it provides a service in a better way than can be achieved locally.
|
||||
The only external dependencies this repository tolerates are
|
||||
standard C libraries, and in rare cases, system level headers.
|
||||
- Within `lib/`, this policy is even more drastic.
|
||||
The only external dependencies allowed are `<assert.h>`, `<stdlib.h>`, `<string.h>`,
|
||||
and even then, not directly.
|
||||
In particular, no function shall ever allocate on heap directly,
|
||||
and must use instead `ZSTD_malloc()` and equivalent.
|
||||
Other accepted non-symbol headers are `<stddef.h>` and `<limits.h>`.
|
||||
- Within the project, there is a strict hierarchy of dependencies that must be respected.
|
||||
`programs/` is allowed to depend on `lib/`, but only its public API.
|
||||
Within `lib/`, `lib/common` doesn't depend on any other directory.
|
||||
`lib/compress` and `lib/decompress` shall not depend on each other.
|
||||
`lib/dictBuilder` can depend on `lib/common` and `lib/compress`, but not `lib/decompress`.
|
||||
#### Resources
|
||||
- Functions in `lib/` must use very little stack space,
|
||||
several dozens of bytes max.
|
||||
Everything larger must use the heap allocator,
|
||||
or require a scratch buffer to be emplaced manually.
|
||||
|
||||
### Naming
|
||||
* All public symbols are prefixed with `ZSTD_`
|
||||
+ private symbols, with a scope limited to their own unit, are free of this restriction.
|
||||
However, since `libzstd` source code can be amalgamated,
|
||||
each symbol name must attempt to be (and remain) unique.
|
||||
Avoid too generic names that could become ground for future collisions.
|
||||
This generally implies usage of some form of prefix.
|
||||
* For symbols (functions and variables), naming convention is `PREFIX_camelCase`.
|
||||
+ In some advanced cases, one can also find :
|
||||
- `PREFIX_prefix2_camelCase`
|
||||
- `PREFIX_camelCase_extendedQualifier`
|
||||
* Multi-words names generally consist of an action followed by object:
|
||||
- for example : `ZSTD_createCCtx()`
|
||||
* Prefer positive actions
|
||||
- `goBackward` rather than `notGoForward`
|
||||
* Type names (`struct`, etc.) follow similar convention,
|
||||
except that they are allowed and even invited to start by an Uppercase letter.
|
||||
Example : `ZSTD_CCtx`, `ZSTD_CDict`
|
||||
* Macro names are all Capital letters.
|
||||
The same composition rules (`PREFIX_NAME_QUALIFIER`) apply.
|
||||
* File names are all lowercase letters.
|
||||
The convention is `snake_case`.
|
||||
File names **must** be unique across the entire code base,
|
||||
even when they stand in clearly separated directories.
|
||||
|
||||
### Qualifiers
|
||||
* This code base is `const` friendly, if not `const` fanatical.
|
||||
Any variable that can be `const` (aka. read-only) **must** be `const`.
|
||||
Any pointer which content will not be modified must be `const`.
|
||||
This property is then controlled at compiler level.
|
||||
`const` variables are an important signal to readers that this variable isn’t modified.
|
||||
Conversely, non-const variables are a signal to readers to watch out for modifications later on in the function.
|
||||
* If a function must be inlined, mention it explicitly,
|
||||
using project's own portable macros, such as `FORCE_INLINE_ATTR`,
|
||||
defined in `lib/common/compiler.h`.
|
||||
|
||||
### Debugging
|
||||
* **Assertions** are welcome, and should be used very liberally,
|
||||
to control any condition the code expects for its correct execution.
|
||||
These assertion checks will be run in debug builds, and disabled in production.
|
||||
* For traces, this project provides its own debug macros,
|
||||
in particular `DEBUGLOG(level, ...)`, defined in `lib/common/debug.h`.
|
||||
|
||||
### Code documentation
|
||||
* Avoid code documentation that merely repeats what the code is already stating.
|
||||
Whenever applicable, prefer employing the code as the primary way to convey explanations.
|
||||
Example 1 : `int nbTokens = n;` instead of `int i = n; /* i is a nb of tokens *./`.
|
||||
Example 2 : `assert(size > 0);` instead of `/* here, size should be positive */`.
|
||||
* At declaration level, the documentation explains how to use the function or variable
|
||||
and when applicable why it's needed, of the scenarios where it can be useful.
|
||||
* At implementation level, the documentation explains the general outline of the algorithm employed,
|
||||
and when applicable why this specific choice was preferred.
|
||||
|
||||
### General layout
|
||||
* 4 spaces for indentation rather than tabs
|
||||
* Code documentation shall directly precede function declaration or implementation
|
||||
* Function implementations and its code documentation should be preceded and followed by an empty line
|
||||
|
||||
|
||||
## License
|
||||
By contributing to Zstandard, you agree that your contributions will be licensed
|
||||
|
||||
@@ -57,8 +57,8 @@ all32:
|
||||
$(MAKE) -C $(PRGDIR) zstd32
|
||||
$(MAKE) -C $(TESTDIR) all32
|
||||
|
||||
.PHONY: lib lib-release
|
||||
lib lib-release :
|
||||
.PHONY: lib lib-release lib-mt lib-nomt
|
||||
lib lib-release lib-mt lib-nomt:
|
||||
$(Q)$(MAKE) -C $(ZSTDDIR) $@
|
||||
|
||||
.PHONY: zstd zstd-release
|
||||
@@ -122,8 +122,8 @@ contrib: lib
|
||||
$(MAKE) -C contrib/seekable_format/examples all
|
||||
$(MAKE) -C contrib/seekable_format/tests test
|
||||
$(MAKE) -C contrib/largeNbDicts all
|
||||
cd contrib/single_file_libs/ ; ./build_decoder_test.sh
|
||||
cd contrib/single_file_libs/ ; ./build_library_test.sh
|
||||
cd build/single_file_libs/ ; ./build_decoder_test.sh
|
||||
cd build/single_file_libs/ ; ./build_library_test.sh
|
||||
|
||||
.PHONY: cleanTabs
|
||||
cleanTabs:
|
||||
@@ -151,7 +151,6 @@ clean:
|
||||
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT Haiku))
|
||||
|
||||
HOST_OS = POSIX
|
||||
CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
HAVE_COLORNEVER = $(shell echo a | egrep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
|
||||
EGREP_OPTIONS ?=
|
||||
@@ -179,7 +178,7 @@ list:
|
||||
done \
|
||||
} | column -t -s $$'\t'
|
||||
|
||||
.PHONY: install armtest usan asan uasan
|
||||
.PHONY: install armtest usan asan uasan msan asan32
|
||||
install:
|
||||
$(Q)$(MAKE) -C $(ZSTDDIR) $@
|
||||
$(Q)$(MAKE) -C $(PRGDIR) $@
|
||||
@@ -193,22 +192,19 @@ uninstall:
|
||||
travis-install:
|
||||
$(MAKE) install PREFIX=~/install_test_dir
|
||||
|
||||
.PHONY: gcc5build
|
||||
.PHONY: gcc5build gcc6build gcc7build clangbuild m32build armbuild aarch64build ppcbuild ppc64build
|
||||
gcc5build: clean
|
||||
gcc-5 -v
|
||||
CC=gcc-5 $(MAKE) all MOREFLAGS="-Werror"
|
||||
|
||||
.PHONY: gcc6build
|
||||
gcc6build: clean
|
||||
gcc-6 -v
|
||||
CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror"
|
||||
|
||||
.PHONY: gcc7build
|
||||
gcc7build: clean
|
||||
gcc-7 -v
|
||||
CC=gcc-7 $(MAKE) all MOREFLAGS="-Werror"
|
||||
|
||||
.PHONY: clangbuild
|
||||
clangbuild: clean
|
||||
clang -v
|
||||
CXX=clang++ CC=clang CFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation" $(MAKE) all
|
||||
@@ -229,6 +225,7 @@ ppcbuild: clean
|
||||
ppc64build: clean
|
||||
CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) -j allzstd
|
||||
|
||||
.PHONY: armfuzz aarch64fuzz ppcfuzz ppc64fuzz
|
||||
armfuzz: clean
|
||||
CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
|
||||
|
||||
@@ -242,7 +239,7 @@ ppcfuzz: clean
|
||||
ppc64fuzz: clean
|
||||
CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
|
||||
|
||||
.PHONY: cxxtest
|
||||
.PHONY: cxxtest gcc5test gcc6test armtest aarch64test ppctest ppc64test
|
||||
cxxtest: CXXFLAGS += -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror
|
||||
cxxtest: clean
|
||||
$(MAKE) -C $(PRGDIR) all CC="$(CXX) -Wno-deprecated" CFLAGS="$(CXXFLAGS)" # adding -Wno-deprecated to avoid clang++ warning on dealing with C files directly
|
||||
@@ -271,6 +268,7 @@ ppc64test: clean
|
||||
$(MAKE) -C $(TESTDIR) datagen # use native, faster
|
||||
$(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests
|
||||
|
||||
.PHONY: arm-ppc-compilation
|
||||
arm-ppc-compilation:
|
||||
$(MAKE) -C $(PRGDIR) clean zstd CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static"
|
||||
$(MAKE) -C $(PRGDIR) clean zstd CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static"
|
||||
@@ -288,7 +286,6 @@ msanregressiontest:
|
||||
|
||||
# run UBsan with -fsanitize-recover=pointer-overflow
|
||||
# this only works with recent compilers such as gcc 8+
|
||||
|
||||
usan: clean
|
||||
$(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=pointer-overflow -fsanitize=undefined -Werror"
|
||||
|
||||
@@ -316,13 +313,16 @@ uasan-%: clean
|
||||
tsan-%: clean
|
||||
LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=thread -Werror" $(MAKE) -C $(TESTDIR) $* FUZZER_FLAGS=--no-big-tests
|
||||
|
||||
.PHONY: apt-install
|
||||
apt-install:
|
||||
sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install $(APT_PACKAGES)
|
||||
|
||||
.PHONY: apt-add-repo
|
||||
apt-add-repo:
|
||||
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
sudo apt-get update -y -qq
|
||||
|
||||
.PHONY: ppcinstall arminstall valgrindinstall libc6install gcc6install gcc7install gcc8install gpp6install clang38install lz4install
|
||||
ppcinstall:
|
||||
APT_PACKAGES="qemu-system-ppc qemu-user-static gcc-powerpc-linux-gnu" $(MAKE) apt-install
|
||||
|
||||
@@ -357,16 +357,18 @@ lz4install:
|
||||
endif
|
||||
|
||||
|
||||
CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
ifneq (,$(filter MSYS%,$(shell uname)))
|
||||
HOST_OS = MSYS
|
||||
CMAKE_PARAMS = -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DZSTD_MULTITHREAD_SUPPORT:BOOL=OFF -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON
|
||||
endif
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# target specific tests
|
||||
#------------------------------------------------------------------------
|
||||
ifneq (,$(filter $(HOST_OS),MSYS POSIX))
|
||||
.PHONY: cmakebuild c89build gnu90build c99build gnu99build c11build bmix64build bmix32build bmi32build staticAnalyze
|
||||
cmakebuild:
|
||||
cmake --version
|
||||
$(RM) -r $(BUILDIR)/cmake/build
|
||||
|
||||
@@ -40,5 +40,4 @@ They consist of the following tests:
|
||||
- Versions test (ensuring `zstd` can decode files from all previous versions)
|
||||
- `pzstd` with asan and tsan, as well as in 32-bits mode
|
||||
- Testing `zstd` with legacy mode off
|
||||
- Testing `zbuff` (old streaming API)
|
||||
- Entire test suite and make install on macOS
|
||||
|
||||
+38
-3
@@ -52,6 +52,15 @@
|
||||
PLATFORM: "Win32"
|
||||
CONFIGURATION: "Release"
|
||||
|
||||
- COMPILER: "clang-cl"
|
||||
HOST: "cmake-visual"
|
||||
PLATFORM: "x64"
|
||||
CONFIGURATION: "Release"
|
||||
CMAKE_GENERATOR: "Visual Studio 15 2017"
|
||||
CMAKE_GENERATOR_PLATFORM: "x64"
|
||||
CMAKE_GENERATOR_TOOLSET: "LLVM"
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2017"
|
||||
|
||||
install:
|
||||
- ECHO Installing %COMPILER% %PLATFORM% %CONFIGURATION%
|
||||
- SET PATH_ORIGINAL=%PATH%
|
||||
@@ -154,6 +163,15 @@
|
||||
COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2015_%PLATFORM%_%CONFIGURATION%.exe &&
|
||||
COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe tests\
|
||||
)
|
||||
- if [%HOST%]==[cmake-visual] (
|
||||
ECHO *** &&
|
||||
ECHO *** Building %CMAKE_GENERATOR% ^(%CMAKE_GENERATOR_TOOLSET%^) %PLATFORM%\%CONFIGURATION% &&
|
||||
PUSHD build\cmake &&
|
||||
cmake -DBUILD_TESTING=ON . &&
|
||||
cmake --build . --config %CONFIGURATION% -j4 &&
|
||||
POPD &&
|
||||
ECHO ***
|
||||
)
|
||||
|
||||
test_script:
|
||||
- ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION%
|
||||
@@ -223,13 +241,21 @@
|
||||
PLATFORM: "Win32"
|
||||
CONFIGURATION: "Release"
|
||||
|
||||
- COMPILER: "clang-cl"
|
||||
HOST: "cmake-visual"
|
||||
PLATFORM: "x64"
|
||||
CONFIGURATION: "Release"
|
||||
CMAKE_GENERATOR: "Visual Studio 15 2017"
|
||||
CMAKE_GENERATOR_PLATFORM: "x64"
|
||||
CMAKE_GENERATOR_TOOLSET: "LLVM"
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: "Visual Studio 2017"
|
||||
|
||||
install:
|
||||
- ECHO Installing %COMPILER% %PLATFORM% %CONFIGURATION%
|
||||
- SET PATH_ORIGINAL=%PATH%
|
||||
- if [%HOST%]==[cygwin] (
|
||||
ECHO Installing Cygwin Packages &&
|
||||
C:\cygwin64\setup-x86_64.exe -qnNdO -R "C:\cygwin64" -g -P ^
|
||||
gcc-g++,^
|
||||
gcc,^
|
||||
cmake,^
|
||||
make
|
||||
@@ -252,8 +278,8 @@
|
||||
C:\cygwin64\bin\bash --login -c "
|
||||
set -e;
|
||||
cd build/cmake;
|
||||
CFLAGS='-Werror' cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Debug -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_FUZZER_FLAGS=-T30s -DZSTD_ZSTREAM_FLAGS=-T30s .;
|
||||
make -j4;
|
||||
CFLAGS='-Werror' cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Debug -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_FUZZER_FLAGS=-T20s -DZSTD_ZSTREAM_FLAGS=-T20s -DZSTD_FULLBENCH_FLAGS=-i0 .;
|
||||
make VERBOSE=1 -j;
|
||||
ctest -V -L Medium;
|
||||
"
|
||||
)
|
||||
@@ -281,6 +307,15 @@
|
||||
COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2015_%PLATFORM%_%CONFIGURATION%.exe &&
|
||||
COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe tests\
|
||||
)
|
||||
- if [%HOST%]==[cmake-visual] (
|
||||
ECHO *** &&
|
||||
ECHO *** Building %CMAKE_GENERATOR% ^(%CMAKE_GENERATOR_TOOLSET%^) %PLATFORM%\%CONFIGURATION% &&
|
||||
PUSHD build\cmake &&
|
||||
cmake -DBUILD_TESTING=ON . &&
|
||||
cmake --build . --config %CONFIGURATION% -j4 &&
|
||||
POPD &&
|
||||
ECHO ***
|
||||
)
|
||||
|
||||
|
||||
test_script:
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\programs\legacy"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
PreprocessorDefinitions="ZSTD_DISABLE_DEPRECATE_WARNINGS=1;WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
@@ -121,7 +121,7 @@
|
||||
EnableIntrinsicFunctions="true"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\programs\legacy"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
PreprocessorDefinitions="ZSTD_DISABLE_DEPRECATE_WARNINGS=1;WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
@@ -195,7 +195,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\programs\legacy"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
PreprocessorDefinitions="ZSTD_DISABLE_DEPRECATE_WARNINGS=1;WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
@@ -272,7 +272,7 @@
|
||||
EnableIntrinsicFunctions="true"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\programs;$(SolutionDir)..\..\programs\legacy"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
PreprocessorDefinitions="ZSTD_DISABLE_DEPRECATE_WARNINGS=1;WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
@@ -463,7 +463,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\common\zstd_errors.h"
|
||||
RelativePath="..\..\..\lib\zstd_errors.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\compress;$(SolutionDir)..\..\lib\dictBuilder;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\programs"
|
||||
PreprocessorDefinitions="ZSTD_MULTITHREAD=1;WIN32;_DEBUG;_CONSOLE"
|
||||
PreprocessorDefinitions="ZSTD_DISABLE_DEPRECATE_WARNINGS=1;ZSTD_MULTITHREAD=1;WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
@@ -121,7 +121,7 @@
|
||||
EnableIntrinsicFunctions="true"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\compress;$(SolutionDir)..\..\lib\dictBuilder;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\programs"
|
||||
PreprocessorDefinitions="ZSTD_MULTITHREAD=1;WIN32;NDEBUG;_CONSOLE"
|
||||
PreprocessorDefinitions="ZSTD_DISABLE_DEPRECATE_WARNINGS=1;ZSTD_MULTITHREAD=1;WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
@@ -195,7 +195,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\compress;$(SolutionDir)..\..\lib\dictBuilder;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\programs"
|
||||
PreprocessorDefinitions="ZSTD_MULTITHREAD=1;WIN32;_DEBUG;_CONSOLE"
|
||||
PreprocessorDefinitions="ZSTD_DISABLE_DEPRECATE_WARNINGS=1;ZSTD_MULTITHREAD=1;WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
@@ -272,7 +272,7 @@
|
||||
EnableIntrinsicFunctions="true"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="$(SolutionDir)..\..\lib;$(SolutionDir)..\..\lib\common;$(SolutionDir)..\..\lib\dictBuilder;$(SolutionDir)..\..\lib\legacy;$(SolutionDir)..\..\lib\compress;$(SolutionDir)..\..\programs"
|
||||
PreprocessorDefinitions="ZSTD_MULTITHREAD=1;WIN32;NDEBUG;_CONSOLE"
|
||||
PreprocessorDefinitions="ZSTD_DISABLE_DEPRECATE_WARNINGS=1;ZSTD_MULTITHREAD=1;WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
@@ -483,7 +483,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\common\zstd_errors.h"
|
||||
RelativePath="..\..\..\lib\zstd_errors.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -511,7 +511,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\dictBuilder\zdict.h"
|
||||
RelativePath="..\..\..\lib\zdict.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
||||
@@ -559,7 +559,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\dictBuilder\zdict.h"
|
||||
RelativePath="..\..\..\lib\zdict.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -575,7 +575,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\common\zstd_errors.h"
|
||||
RelativePath="..\..\..\lib\zstd_errors.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
||||
@@ -495,7 +495,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\common\zstd_errors.h"
|
||||
RelativePath="..\..\..\lib\zstd_errors.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -523,7 +523,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\dictBuilder\zdict.h"
|
||||
RelativePath="..\..\..\lib\zdict.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;ZSTD_DLL_IMPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>ZSTD_DISABLE_DEPRECATE_WARNINGS=1;WIN32;_DEBUG;_CONSOLE;ZSTD_DLL_IMPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
</ClCompile>
|
||||
@@ -108,7 +108,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;ZSTD_DLL_IMPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>ZSTD_DISABLE_DEPRECATE_WARNINGS=1;WIN32;_DEBUG;_CONSOLE;ZSTD_DLL_IMPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
</ClCompile>
|
||||
@@ -127,7 +127,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;ZSTD_DLL_IMPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>ZSTD_DISABLE_DEPRECATE_WARNINGS=1;WIN32;_DEBUG;_CONSOLE;ZSTD_DLL_IMPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
@@ -150,7 +150,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;ZSTD_DLL_IMPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>ZSTD_DISABLE_DEPRECATE_WARNINGS=1;WIN32;_DEBUG;_CONSOLE;ZSTD_DLL_IMPORT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>ZSTD_DISABLE_DEPRECATE_WARNINGS=1;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
</ClCompile>
|
||||
@@ -105,7 +105,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>ZSTD_DISABLE_DEPRECATE_WARNINGS=1;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
</ClCompile>
|
||||
@@ -122,7 +122,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>ZSTD_DISABLE_DEPRECATE_WARNINGS=1;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
@@ -142,7 +142,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>ZSTD_DISABLE_DEPRECATE_WARNINGS=1;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
@@ -190,7 +190,7 @@
|
||||
<ClInclude Include="..\..\..\lib\zstd.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\fse.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\huf.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\zstd_errors.h" />
|
||||
<ClInclude Include="..\..\..\lib\zstd_errors.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\zstd_internal.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\pool.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\threading.h" />
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>ZSTD_DISABLE_DEPRECATE_WARNINGS=1;ZSTD_MULTITHREAD=1;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
</ClCompile>
|
||||
@@ -105,7 +105,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>ZSTD_DISABLE_DEPRECATE_WARNINGS=1;ZSTD_MULTITHREAD=1;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
</ClCompile>
|
||||
@@ -122,7 +122,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>ZSTD_DISABLE_DEPRECATE_WARNINGS=1;ZSTD_MULTITHREAD=1;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
@@ -142,7 +142,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>ZSTD_DISABLE_DEPRECATE_WARNINGS=1;ZSTD_MULTITHREAD=1;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
@@ -196,7 +196,7 @@
|
||||
<ClInclude Include="..\..\..\lib\common\huf.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\xxhash.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\zstd_internal.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\zstd_errors.h" />
|
||||
<ClInclude Include="..\..\..\lib\zstd_errors.h" />
|
||||
<ClInclude Include="..\..\..\lib\zstd.h" />
|
||||
<ClInclude Include="..\..\..\lib\compress\zstd_compress.h" />
|
||||
<ClInclude Include="..\..\..\lib\compress\zstd_compress_literals.h" />
|
||||
@@ -211,7 +211,7 @@
|
||||
<ClInclude Include="..\..\..\lib\compress\zstdmt_compress.h" />
|
||||
<ClInclude Include="..\..\..\lib\decompress\zstd_ddict.h" />
|
||||
<ClInclude Include="..\..\..\lib\dictBuilder\divsufsort.h" />
|
||||
<ClInclude Include="..\..\..\lib\dictBuilder\zdict.h" />
|
||||
<ClInclude Include="..\..\..\lib\zdict.h" />
|
||||
<ClInclude Include="..\..\..\lib\dictBuilder\cover.h" />
|
||||
<ClInclude Include="..\..\..\lib\legacy\zstd_legacy.h" />
|
||||
<ClInclude Include="..\..\..\programs\datagen.h" />
|
||||
|
||||
@@ -44,9 +44,6 @@
|
||||
<ClCompile Include="..\..\..\lib\decompress\zstd_decompress.c" />
|
||||
<ClCompile Include="..\..\..\lib\decompress\zstd_decompress_block.c" />
|
||||
<ClCompile Include="..\..\..\lib\decompress\zstd_ddict.c" />
|
||||
<ClCompile Include="..\..\..\lib\deprecated\zbuff_common.c" />
|
||||
<ClCompile Include="..\..\..\lib\deprecated\zbuff_compress.c" />
|
||||
<ClCompile Include="..\..\..\lib\deprecated\zbuff_decompress.c" />
|
||||
<ClCompile Include="..\..\..\lib\dictBuilder\cover.c" />
|
||||
<ClCompile Include="..\..\..\lib\dictBuilder\fastcover.c" />
|
||||
<ClCompile Include="..\..\..\lib\dictBuilder\divsufsort.c" />
|
||||
@@ -64,12 +61,11 @@
|
||||
<ClInclude Include="..\..\..\lib\common\threading.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\bitstream.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\error_private.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\zstd_errors.h" />
|
||||
<ClInclude Include="..\..\..\lib\zstd_errors.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\mem.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\fse.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\huf.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\xxhash.h" />
|
||||
<ClInclude Include="..\..\..\lib\deprecated\zbuff.h" />
|
||||
<ClInclude Include="..\..\..\lib\legacy\zstd_legacy.h" />
|
||||
<ClInclude Include="..\..\..\lib\legacy\zstd_v01.h" />
|
||||
<ClInclude Include="..\..\..\lib\legacy\zstd_v02.h" />
|
||||
|
||||
@@ -44,9 +44,6 @@
|
||||
<ClCompile Include="..\..\..\lib\decompress\zstd_decompress.c" />
|
||||
<ClCompile Include="..\..\..\lib\decompress\zstd_decompress_block.c" />
|
||||
<ClCompile Include="..\..\..\lib\decompress\zstd_ddict.c" />
|
||||
<ClCompile Include="..\..\..\lib\deprecated\zbuff_common.c" />
|
||||
<ClCompile Include="..\..\..\lib\deprecated\zbuff_compress.c" />
|
||||
<ClCompile Include="..\..\..\lib\deprecated\zbuff_decompress.c" />
|
||||
<ClCompile Include="..\..\..\lib\dictBuilder\cover.c" />
|
||||
<ClCompile Include="..\..\..\lib\dictBuilder\fastcover.c" />
|
||||
<ClCompile Include="..\..\..\lib\dictBuilder\divsufsort.c" />
|
||||
@@ -64,12 +61,11 @@
|
||||
<ClInclude Include="..\..\..\lib\common\threading.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\bitstream.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\error_private.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\zstd_errors.h" />
|
||||
<ClInclude Include="..\..\..\lib\zstd_errors.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\mem.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\fse.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\huf.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\xxhash.h" />
|
||||
<ClInclude Include="..\..\..\lib\deprecated\zbuff.h" />
|
||||
<ClInclude Include="..\..\..\lib\legacy\zstd_legacy.h" />
|
||||
<ClInclude Include="..\..\..\lib\legacy\zstd_v01.h" />
|
||||
<ClInclude Include="..\..\..\lib\legacy\zstd_v02.h" />
|
||||
|
||||
@@ -70,14 +70,14 @@
|
||||
<ClInclude Include="..\..\..\lib\common\threading.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\xxhash.h" />
|
||||
<ClInclude Include="..\..\..\lib\compress\zstdmt_compress.h" />
|
||||
<ClInclude Include="..\..\..\lib\dictBuilder\zdict.h" />
|
||||
<ClInclude Include="..\..\..\lib\zdict.h" />
|
||||
<ClInclude Include="..\..\..\lib\dictBuilder\cover.h" />
|
||||
<ClInclude Include="..\..\..\lib\dictBuilder\divsufsort.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\fse.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\huf.h" />
|
||||
<ClInclude Include="..\..\..\lib\zstd.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\zstd_internal.h" />
|
||||
<ClInclude Include="..\..\..\lib\common\zstd_errors.h" />
|
||||
<ClInclude Include="..\..\..\lib\zstd_errors.h" />
|
||||
<ClInclude Include="..\..\..\lib\compress\zstd_compress.h" />
|
||||
<ClInclude Include="..\..\..\lib\compress\zstd_compress_literals.h" />
|
||||
<ClInclude Include="..\..\..\lib\compress\zstd_compress_sequences.h" />
|
||||
|
||||
@@ -26,7 +26,12 @@ macro(ADD_ZSTD_COMPILATION_FLAGS)
|
||||
EnableCompilerFlag("-std=c++11" false true)
|
||||
#Set c99 by default
|
||||
EnableCompilerFlag("-std=c99" true false)
|
||||
EnableCompilerFlag("-Wall" true true)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND MSVC)
|
||||
# clang-cl normally maps -Wall to -Weverything.
|
||||
EnableCompilerFlag("/clang:-Wall" true true)
|
||||
else ()
|
||||
EnableCompilerFlag("-Wall" true true)
|
||||
endif ()
|
||||
EnableCompilerFlag("-Wextra" true true)
|
||||
EnableCompilerFlag("-Wundef" true true)
|
||||
EnableCompilerFlag("-Wshadow" true true)
|
||||
|
||||
@@ -24,28 +24,24 @@ file(GLOB CommonSources ${LIBRARY_DIR}/common/*.c)
|
||||
file(GLOB CompressSources ${LIBRARY_DIR}/compress/*.c)
|
||||
file(GLOB DecompressSources ${LIBRARY_DIR}/decompress/*.c)
|
||||
file(GLOB DictBuilderSources ${LIBRARY_DIR}/dictBuilder/*.c)
|
||||
file(GLOB DeprecatedSources ${LIBRARY_DIR}/deprecated/*.c)
|
||||
|
||||
set(Sources
|
||||
${CommonSources}
|
||||
${CompressSources}
|
||||
${DecompressSources}
|
||||
${DictBuilderSources}
|
||||
${DeprecatedSources})
|
||||
${DictBuilderSources})
|
||||
|
||||
file(GLOB CommonHeaders ${LIBRARY_DIR}/common/*.h)
|
||||
file(GLOB CompressHeaders ${LIBRARY_DIR}/compress/*.h)
|
||||
file(GLOB DecompressHeaders ${LIBRARY_DIR}/decompress/*.h)
|
||||
file(GLOB DictBuilderHeaders ${LIBRARY_DIR}/dictBuilder/*.h)
|
||||
file(GLOB DeprecatedHeaders ${LIBRARY_DIR}/deprecated/*.h)
|
||||
|
||||
set(Headers
|
||||
${LIBRARY_DIR}/zstd.h
|
||||
${CommonHeaders}
|
||||
${CompressHeaders}
|
||||
${DecompressHeaders}
|
||||
${DictBuilderHeaders}
|
||||
${DeprecatedHeaders})
|
||||
${DictBuilderHeaders})
|
||||
|
||||
if (ZSTD_LEGACY_SUPPORT)
|
||||
set(LIBRARY_LEGACY_DIR ${LIBRARY_DIR}/legacy)
|
||||
@@ -162,8 +158,8 @@ endif ()
|
||||
# install target
|
||||
install(FILES
|
||||
"${LIBRARY_DIR}/zstd.h"
|
||||
"${LIBRARY_DIR}/dictBuilder/zdict.h"
|
||||
"${LIBRARY_DIR}/common/zstd_errors.h"
|
||||
"${LIBRARY_DIR}/zdict.h"
|
||||
"${LIBRARY_DIR}/zstd_errors.h"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
|
||||
install(TARGETS ${library_targets}
|
||||
|
||||
@@ -3,5 +3,4 @@ datagen
|
||||
fullbench
|
||||
fuzzer
|
||||
paramgrill
|
||||
zbufftest
|
||||
|
||||
|
||||
@@ -57,13 +57,15 @@ target_link_libraries(datagen libzstd_static)
|
||||
# fullbench
|
||||
#
|
||||
add_executable(fullbench ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${PROGRAMS_DIR}/benchfn.c ${PROGRAMS_DIR}/benchzstd.c ${TESTS_DIR}/fullbench.c)
|
||||
set_property(TARGET fullbench APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_DISABLE_DEPRECATE_WARNINGS")
|
||||
target_link_libraries(fullbench libzstd_static)
|
||||
add_test(NAME fullbench COMMAND fullbench)
|
||||
add_test(NAME fullbench COMMAND fullbench ${ZSTD_FULLBENCH_FLAGS})
|
||||
|
||||
#
|
||||
# fuzzer
|
||||
#
|
||||
add_executable(fuzzer ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${TESTS_DIR}/fuzzer.c)
|
||||
set_property(TARGET fuzzer APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_DISABLE_DEPRECATE_WARNINGS")
|
||||
target_link_libraries(fuzzer libzstd_static)
|
||||
AddTestFlagsOption(ZSTD_FUZZER_FLAGS "$ENV{FUZZERTEST} $ENV{FUZZER_FLAGS}"
|
||||
"Semicolon-separated list of flags to pass to the fuzzer test (see `fuzzer -h` for usage)")
|
||||
@@ -76,6 +78,7 @@ add_test(NAME fuzzer COMMAND fuzzer ${ZSTD_FUZZER_FLAGS})
|
||||
# zstreamtest
|
||||
#
|
||||
add_executable(zstreamtest ${PROGRAMS_DIR}/datagen.c ${PROGRAMS_DIR}/util.c ${PROGRAMS_DIR}/timefn.c ${TESTS_DIR}/seqgen.c ${TESTS_DIR}/zstreamtest.c)
|
||||
set_property(TARGET zstreamtest APPEND PROPERTY COMPILE_DEFINITIONS "ZSTD_DISABLE_DEPRECATE_WARNINGS")
|
||||
target_link_libraries(zstreamtest libzstd_static)
|
||||
AddTestFlagsOption(ZSTD_ZSTREAM_FLAGS "$ENV{ZSTREAM_TESTTIME} $ENV{FUZZER_FLAGS}"
|
||||
"Semicolon-separated list of flags to pass to the zstreamtest test (see `zstreamtest -h` for usage)")
|
||||
|
||||
@@ -14,15 +14,13 @@ libzstd_includes = [include_directories(join_paths(zstd_rootdir,'lib'),
|
||||
join_paths(zstd_rootdir, 'lib/common'),
|
||||
join_paths(zstd_rootdir, 'lib/compress'),
|
||||
join_paths(zstd_rootdir, 'lib/decompress'),
|
||||
join_paths(zstd_rootdir, 'lib/dictBuilder'),
|
||||
join_paths(zstd_rootdir, 'lib/deprecated'))]
|
||||
join_paths(zstd_rootdir, 'lib/dictBuilder'))]
|
||||
|
||||
libzstd_sources = [join_paths(zstd_rootdir, 'lib/common/entropy_common.c'),
|
||||
join_paths(zstd_rootdir, 'lib/common/fse_decompress.c'),
|
||||
join_paths(zstd_rootdir, 'lib/common/threading.c'),
|
||||
join_paths(zstd_rootdir, 'lib/common/pool.c'),
|
||||
join_paths(zstd_rootdir, 'lib/common/zstd_common.c'),
|
||||
join_paths(zstd_rootdir, 'lib/common/zstd_trace.c'),
|
||||
join_paths(zstd_rootdir, 'lib/common/error_private.c'),
|
||||
join_paths(zstd_rootdir, 'lib/common/xxhash.c'),
|
||||
join_paths(zstd_rootdir, 'lib/compress/hist.c'),
|
||||
@@ -45,10 +43,7 @@ libzstd_sources = [join_paths(zstd_rootdir, 'lib/common/entropy_common.c'),
|
||||
join_paths(zstd_rootdir, 'lib/dictBuilder/cover.c'),
|
||||
join_paths(zstd_rootdir, 'lib/dictBuilder/fastcover.c'),
|
||||
join_paths(zstd_rootdir, 'lib/dictBuilder/divsufsort.c'),
|
||||
join_paths(zstd_rootdir, 'lib/dictBuilder/zdict.c'),
|
||||
join_paths(zstd_rootdir, 'lib/deprecated/zbuff_common.c'),
|
||||
join_paths(zstd_rootdir, 'lib/deprecated/zbuff_compress.c'),
|
||||
join_paths(zstd_rootdir, 'lib/deprecated/zbuff_decompress.c')]
|
||||
join_paths(zstd_rootdir, 'lib/dictBuilder/zdict.c')]
|
||||
|
||||
# Explicit define legacy support
|
||||
add_project_arguments('-DZSTD_LEGACY_SUPPORT=@0@'.format(legacy_level),
|
||||
@@ -128,5 +123,5 @@ pkgconfig.generate(libzstd,
|
||||
url: 'http://www.zstd.net/')
|
||||
|
||||
install_headers(join_paths(zstd_rootdir, 'lib/zstd.h'),
|
||||
join_paths(zstd_rootdir, 'lib/dictBuilder/zdict.h'),
|
||||
join_paths(zstd_rootdir, 'lib/common/zstd_errors.h'))
|
||||
join_paths(zstd_rootdir, 'lib/zdict.h'),
|
||||
join_paths(zstd_rootdir, 'lib/zstd_errors.h'))
|
||||
|
||||
@@ -11,7 +11,7 @@ This is the most common use case. The decompression library is small, adding, fo
|
||||
|
||||
Create `zstddeclib.c` from the Zstd source using:
|
||||
```
|
||||
cd zstd/contrib/single_file_libs
|
||||
cd zstd/build/single_file_libs
|
||||
./combine.sh -r ../../lib -o zstddeclib.c zstddeclib-in.c
|
||||
```
|
||||
Then add the resulting file to your project (see the [example files](examples)).
|
||||
@@ -25,7 +25,7 @@ The same tool can amalgamate the entire Zstd library for ease of adding both com
|
||||
|
||||
Create `zstd.c` from the Zstd source using:
|
||||
```
|
||||
cd zstd/contrib/single_file_libs
|
||||
cd zstd/build/single_file_libs
|
||||
./combine.sh -r ../../lib -o zstd.c zstd-in.c
|
||||
```
|
||||
It's possible to create a compressor-only library but since the decompressor is so small in comparison this doesn't bring much of a gain (but for the curious, simply remove the files in the _decompress_ section at the end of `zstd-in.c`).
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -390,7 +390,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\common\zstd_errors.h"
|
||||
RelativePath="..\..\..\lib\zstd_errors.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
||||
@@ -426,7 +426,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\common\zstd_errors.h"
|
||||
RelativePath="..\..\..\lib\zstd_errors.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -454,7 +454,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\dictBuilder\zdict.h"
|
||||
RelativePath="..\..\..\lib\zdict.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
||||
@@ -454,7 +454,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\common\zstd_errors.h"
|
||||
RelativePath="..\..\..\lib\zstd_errors.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -482,7 +482,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\dictBuilder\zdict.h"
|
||||
RelativePath="..\..\..\lib\zdict.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
||||
@@ -371,18 +371,6 @@
|
||||
RelativePath="..\..\..\lib\common\xxhash.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\deprecated\zbuff_common.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\deprecated\zbuff_compress.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\deprecated\zbuff_decompress.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\dictBuilder\zdict.c"
|
||||
>
|
||||
@@ -458,7 +446,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\common\zstd_errors.h"
|
||||
RelativePath="..\..\..\lib\zstd_errors.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
@@ -486,11 +474,7 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\common\zbuff.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lib\dictBuilder\zdict.h"
|
||||
RelativePath="..\..\..\lib\zdict.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
||||
@@ -27,6 +27,8 @@ SKIPPED_FILES = [
|
||||
"common/pool.h",
|
||||
"common/threading.c",
|
||||
"common/threading.h",
|
||||
"common/zstd_trace.c",
|
||||
"common/zstd_trace.h",
|
||||
"compress/zstdmt_compress.h",
|
||||
"compress/zstdmt_compress.c",
|
||||
]
|
||||
@@ -430,7 +432,7 @@ class Freestanding(object):
|
||||
external_xxhash: bool, xxh64_state: Optional[str],
|
||||
xxh64_prefix: Optional[str], rewritten_includes: [(str, str)],
|
||||
defs: [(str, Optional[str])], replaces: [(str, str)],
|
||||
undefs: [str], excludes: [str]
|
||||
undefs: [str], excludes: [str], seds: [str],
|
||||
):
|
||||
self._zstd_deps = zstd_deps
|
||||
self._mem = mem
|
||||
@@ -444,6 +446,7 @@ class Freestanding(object):
|
||||
self._replaces = replaces
|
||||
self._undefs = undefs
|
||||
self._excludes = excludes
|
||||
self._seds = seds
|
||||
|
||||
def _dst_lib_file_paths(self):
|
||||
"""
|
||||
@@ -471,24 +474,25 @@ class Freestanding(object):
|
||||
dst_path = os.path.join(self._dst_lib, lib_path)
|
||||
self._log(f"\tCopying: {src_path} -> {dst_path}")
|
||||
shutil.copyfile(src_path, dst_path)
|
||||
|
||||
|
||||
def _copy_source_lib(self):
|
||||
self._log("Copying source library into output library")
|
||||
|
||||
assert os.path.exists(self._src_lib)
|
||||
os.makedirs(self._dst_lib, exist_ok=True)
|
||||
self._copy_file("zstd.h")
|
||||
self._copy_file("zstd_errors.h")
|
||||
for subdir in INCLUDED_SUBDIRS:
|
||||
src_dir = os.path.join(self._src_lib, subdir)
|
||||
dst_dir = os.path.join(self._dst_lib, subdir)
|
||||
|
||||
|
||||
assert os.path.exists(src_dir)
|
||||
os.makedirs(dst_dir, exist_ok=True)
|
||||
|
||||
for filename in os.listdir(src_dir):
|
||||
lib_path = os.path.join(subdir, filename)
|
||||
self._copy_file(lib_path)
|
||||
|
||||
|
||||
def _copy_zstd_deps(self):
|
||||
dst_zstd_deps = os.path.join(self._dst_lib, "common", "zstd_deps.h")
|
||||
self._log(f"Copying zstd_deps: {self._zstd_deps} -> {dst_zstd_deps}")
|
||||
@@ -508,7 +512,7 @@ class Freestanding(object):
|
||||
assert not (undef and value is not None)
|
||||
for filepath in self._dst_lib_file_paths():
|
||||
file = FileLines(filepath)
|
||||
|
||||
|
||||
def _hardwire_defines(self):
|
||||
self._log("Hardwiring macros")
|
||||
partial_preprocessor = PartialPreprocessor(self._defs, self._replaces, self._undefs)
|
||||
@@ -536,7 +540,7 @@ class Freestanding(object):
|
||||
skipped.append(line)
|
||||
if end_re.search(line) is not None:
|
||||
assert begin_re.search(line) is None
|
||||
self._log(f"\t\tRemoving excluded section: {exclude}")
|
||||
self._log(f"\t\tRemoving excluded section: {exclude}")
|
||||
for s in skipped:
|
||||
self._log(f"\t\t\t- {s}")
|
||||
emit = True
|
||||
@@ -559,12 +563,12 @@ class Freestanding(object):
|
||||
e = match.end('include')
|
||||
file.lines[i] = line[:s] + rewritten + line[e:]
|
||||
file.write()
|
||||
|
||||
|
||||
def _rewrite_includes(self):
|
||||
self._log("Rewriting includes")
|
||||
for original, rewritten in self._rewritten_includes:
|
||||
self._rewrite_include(original, rewritten)
|
||||
|
||||
|
||||
def _replace_xxh64_prefix(self):
|
||||
if self._xxh64_prefix is None:
|
||||
return
|
||||
@@ -596,6 +600,48 @@ class Freestanding(object):
|
||||
file.lines[i] = line
|
||||
file.write()
|
||||
|
||||
def _parse_sed(self, sed):
|
||||
assert sed[0] == 's'
|
||||
delim = sed[1]
|
||||
match = re.fullmatch(f's{delim}(.+){delim}(.*){delim}(.*)', sed)
|
||||
assert match is not None
|
||||
regex = re.compile(match.group(1))
|
||||
format_str = match.group(2)
|
||||
is_global = match.group(3) == 'g'
|
||||
return regex, format_str, is_global
|
||||
|
||||
def _process_sed(self, sed):
|
||||
self._log(f"Processing sed: {sed}")
|
||||
regex, format_str, is_global = self._parse_sed(sed)
|
||||
|
||||
for filepath in self._dst_lib_file_paths():
|
||||
file = FileLines(filepath)
|
||||
for i, line in enumerate(file.lines):
|
||||
modified = False
|
||||
while True:
|
||||
match = regex.search(line)
|
||||
if match is None:
|
||||
break
|
||||
replacement = format_str.format(match.groups(''), match.groupdict(''))
|
||||
b = match.start()
|
||||
e = match.end()
|
||||
line = line[:b] + replacement + line[e:]
|
||||
modified = True
|
||||
if not is_global:
|
||||
break
|
||||
if modified:
|
||||
self._log(f"\t- {file.lines[i][:-1]}")
|
||||
self._log(f"\t+ {line[:-1]}")
|
||||
file.lines[i] = line
|
||||
file.write()
|
||||
|
||||
def _process_seds(self):
|
||||
self._log("Processing seds")
|
||||
for sed in self._seds:
|
||||
self._process_sed(sed)
|
||||
|
||||
|
||||
|
||||
def go(self):
|
||||
self._copy_source_lib()
|
||||
self._copy_zstd_deps()
|
||||
@@ -604,6 +650,7 @@ class Freestanding(object):
|
||||
self._remove_excludes()
|
||||
self._rewrite_includes()
|
||||
self._replace_xxh64_prefix()
|
||||
self._process_seds()
|
||||
|
||||
|
||||
def parse_optional_pair(defines: [str]) -> [(str, Optional[str])]:
|
||||
@@ -641,6 +688,7 @@ def main(name, args):
|
||||
parser.add_argument("--xxh64-state", default=None, help="Alternate XXH64 state type (excluding _) e.g. --xxh64-state='struct xxh64_state'")
|
||||
parser.add_argument("--xxh64-prefix", default=None, help="Alternate XXH64 function prefix (excluding _) e.g. --xxh64-prefix=xxh64")
|
||||
parser.add_argument("--rewrite-include", default=[], dest="rewritten_includes", action="append", help="Rewrite an include REGEX=NEW (e.g. '<stddef\\.h>=<linux/types.h>')")
|
||||
parser.add_argument("--sed", default=[], dest="seds", action="append", help="Apply a sed replacement. Format: `s/REGEX/FORMAT/[g]`. REGEX is a Python regex. FORMAT is a Python format string formatted by the regex dict.")
|
||||
parser.add_argument("-D", "--define", default=[], dest="defs", action="append", help="Pre-define this macro (can be passed multiple times)")
|
||||
parser.add_argument("-U", "--undefine", default=[], dest="undefs", action="append", help="Pre-undefine this macro (can be passed mutliple times)")
|
||||
parser.add_argument("-R", "--replace", default=[], dest="replaces", action="append", help="Pre-define this macro and replace the first ifndef block with its definition")
|
||||
@@ -656,6 +704,11 @@ def main(name, args):
|
||||
if name in args.undefs:
|
||||
raise RuntimeError(f"{name} is both defined and undefined!")
|
||||
|
||||
# Always set tracing to 0
|
||||
if "ZSTD_NO_TRACE" not in (arg[0] for arg in args.defs):
|
||||
args.defs.append(("ZSTD_NO_TRACE", None))
|
||||
args.defs.append(("ZSTD_TRACE", "0"))
|
||||
|
||||
args.replaces = parse_pair(args.replaces)
|
||||
for name, _ in args.replaces:
|
||||
if name in args.undefs or name in args.defs:
|
||||
@@ -688,7 +741,8 @@ def main(name, args):
|
||||
args.defs,
|
||||
args.replaces,
|
||||
args.undefs,
|
||||
args.excludes
|
||||
args.excludes,
|
||||
args.seds,
|
||||
).go()
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# ################################################################
|
||||
# Copyright (c) 2015-2021, Facebook, Inc.
|
||||
# Copyright (c) Facebook, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
@@ -22,6 +22,10 @@ libzstd:
|
||||
--xxh64-prefix 'xxh64' \
|
||||
--rewrite-include '<limits\.h>=<linux/limits.h>' \
|
||||
--rewrite-include '<stddef\.h>=<linux/types.h>' \
|
||||
--rewrite-include '"\.\./zstd.h"=<linux/zstd.h>' \
|
||||
--rewrite-include '"(\.\./)?zstd_errors.h"=<linux/zstd_errors.h>' \
|
||||
--sed 's,/\*\*\*,/* *,g' \
|
||||
--sed 's,/\*\*,/*,g' \
|
||||
-DZSTD_NO_INTRINSICS \
|
||||
-DZSTD_NO_UNUSED_FUNCTIONS \
|
||||
-DZSTD_LEGACY_SUPPORT=0 \
|
||||
@@ -47,7 +51,10 @@ libzstd:
|
||||
-RZSTDLIB_VISIBILITY= \
|
||||
-RZSTDERRORLIB_VISIBILITY= \
|
||||
-DZSTD_HAVE_WEAK_SYMBOLS=0 \
|
||||
-DZSTD_TRACE=0
|
||||
-DZSTD_TRACE=0 \
|
||||
-DZSTD_NO_TRACE
|
||||
mv linux/lib/zstd/zstd.h linux/include/linux/zstd_lib.h
|
||||
mv linux/lib/zstd/zstd_errors.h linux/include/linux/
|
||||
cp linux_zstd.h linux/include/linux/zstd.h
|
||||
cp zstd_compress_module.c linux/lib/zstd
|
||||
cp zstd_decompress_module.c linux/lib/zstd
|
||||
@@ -62,15 +69,18 @@ import: libzstd
|
||||
rm -f $(LINUX)/include/linux/zstd_errors.h
|
||||
rm -rf $(LINUX)/lib/zstd
|
||||
cp linux/include/linux/zstd.h $(LINUX)/include/linux
|
||||
cp linux/include/linux/zstd_lib.h $(LINUX)/include/linux
|
||||
cp linux/include/linux/zstd_errors.h $(LINUX)/include/linux
|
||||
cp -r linux/lib/zstd $(LINUX)/lib
|
||||
|
||||
import-upstream:
|
||||
rm -rf $(LINUX)/lib/zstd
|
||||
mkdir $(LINUX)/lib/zstd
|
||||
cp ../../lib/zstd.h $(LINUX)/lib/zstd
|
||||
cp ../../lib/zstd.h $(LINUX)/include/linux/zstd_lib.h
|
||||
cp -r ../../lib/common $(LINUX)/lib/zstd
|
||||
cp -r ../../lib/compress $(LINUX)/lib/zstd
|
||||
cp -r ../../lib/decompress $(LINUX)/lib/zstd
|
||||
mv $(LINUX)/lib/zstd/zstd_errors.h $(LINUX)/include/linux
|
||||
rm $(LINUX)/lib/zstd/common/threading.*
|
||||
rm $(LINUX)/lib/zstd/common/pool.*
|
||||
rm $(LINUX)/lib/zstd/common/xxhash.*
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
* in the COPYING file in the root directory of this source tree).
|
||||
* You may select, at your option, one of the above-listed licenses.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file includes every .c file needed for decompression.
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# ################################################################
|
||||
# Copyright (c) Facebook, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
# in the COPYING file in the root directory of this source tree).
|
||||
# You may select, at your option, one of the above-listed licenses.
|
||||
# ################################################################
|
||||
obj-$(CONFIG_ZSTD_COMPRESS) += zstd_compress.o
|
||||
obj-$(CONFIG_ZSTD_DECOMPRESS) += zstd_decompress.o
|
||||
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of https://github.com/facebook/zstd.
|
||||
* An additional grant of patent rights can be found in the PATENTS file in the
|
||||
* same directory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 2 as published by the
|
||||
* Free Software Foundation. This program is dual-licensed; you may select
|
||||
* either version 2 of the GNU General Public License ("GPL") or BSD license
|
||||
* ("BSD").
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
* LICENSE file in the root directory of https://github.com/facebook/zstd) and
|
||||
* the GPLv2 (found in the COPYING file in the root directory of
|
||||
* https://github.com/facebook/zstd). You may select, at your option, one of the
|
||||
* above-listed licenses.
|
||||
*/
|
||||
|
||||
#ifndef LINUX_ZSTD_H
|
||||
@@ -27,6 +22,8 @@
|
||||
|
||||
/* ====== Dependency ====== */
|
||||
#include <linux/types.h>
|
||||
#include <linux/zstd_errors.h>
|
||||
#include <linux/zstd_lib.h>
|
||||
|
||||
/* ====== Helper Functions ====== */
|
||||
/**
|
||||
@@ -45,13 +42,18 @@ size_t zstd_compress_bound(size_t src_size);
|
||||
*/
|
||||
unsigned int zstd_is_error(size_t code);
|
||||
|
||||
/**
|
||||
* enum zstd_error_code - zstd error codes
|
||||
*/
|
||||
typedef ZSTD_ErrorCode zstd_error_code;
|
||||
|
||||
/**
|
||||
* zstd_get_error_code() - translates an error function result to an error code
|
||||
* @code: The function result for which zstd_is_error(code) is true.
|
||||
*
|
||||
* Return: A unique error code for this error.
|
||||
*/
|
||||
int zstd_get_error_code(size_t code);
|
||||
zstd_error_code zstd_get_error_code(size_t code);
|
||||
|
||||
/**
|
||||
* zstd_get_error_name() - translates an error function result to a string
|
||||
@@ -61,76 +63,67 @@ int zstd_get_error_code(size_t code);
|
||||
*/
|
||||
const char *zstd_get_error_name(size_t code);
|
||||
|
||||
/**
|
||||
* zstd_min_clevel() - minimum allowed compression level
|
||||
*
|
||||
* Return: The minimum allowed compression level.
|
||||
*/
|
||||
int zstd_min_clevel(void);
|
||||
|
||||
/**
|
||||
* zstd_max_clevel() - maximum allowed compression level
|
||||
*
|
||||
* Return: The maximum allowed compression level.
|
||||
*/
|
||||
int zstd_max_clevel(void);
|
||||
|
||||
/* ====== Parameter Selection ====== */
|
||||
|
||||
/**
|
||||
* enum zstd_strategy - zstd compression search strategy
|
||||
*
|
||||
* From faster to stronger.
|
||||
* From faster to stronger. See zstd_lib.h.
|
||||
*/
|
||||
enum zstd_strategy {
|
||||
zstd_fast = 1,
|
||||
zstd_dfast = 2,
|
||||
zstd_greedy = 3,
|
||||
zstd_lazy = 4,
|
||||
zstd_lazy2 = 5,
|
||||
zstd_btlazy2 = 6,
|
||||
zstd_btopt = 7,
|
||||
zstd_btultra = 8,
|
||||
zstd_btultra2 = 9
|
||||
};
|
||||
typedef ZSTD_strategy zstd_strategy;
|
||||
|
||||
/**
|
||||
* struct zstd_compression_parameters - zstd compression parameters
|
||||
* @window_log: Log of the largest match distance. Larger means more
|
||||
* compression, and more memory needed during decompression.
|
||||
* @chain_log: Fully searched segment. Larger means more compression,
|
||||
* slower, and more memory (useless for fast).
|
||||
* @hash_log: Dispatch table. Larger means more compression,
|
||||
* slower, and more memory.
|
||||
* @search_log: Number of searches. Larger means more compression and slower.
|
||||
* @search_length: Match length searched. Larger means faster decompression,
|
||||
* sometimes less compression.
|
||||
* @target_length: Acceptable match size for optimal parser (only). Larger means
|
||||
* more compression, and slower.
|
||||
* @strategy: The zstd compression strategy.
|
||||
* @windowLog: Log of the largest match distance. Larger means more
|
||||
* compression, and more memory needed during decompression.
|
||||
* @chainLog: Fully searched segment. Larger means more compression,
|
||||
* slower, and more memory (useless for fast).
|
||||
* @hashLog: Dispatch table. Larger means more compression,
|
||||
* slower, and more memory.
|
||||
* @searchLog: Number of searches. Larger means more compression and slower.
|
||||
* @searchLength: Match length searched. Larger means faster decompression,
|
||||
* sometimes less compression.
|
||||
* @targetLength: Acceptable match size for optimal parser (only). Larger means
|
||||
* more compression, and slower.
|
||||
* @strategy: The zstd compression strategy.
|
||||
*
|
||||
* See zstd_lib.h.
|
||||
*/
|
||||
struct zstd_compression_parameters {
|
||||
unsigned int window_log;
|
||||
unsigned int chain_log;
|
||||
unsigned int hash_log;
|
||||
unsigned int search_log;
|
||||
unsigned int search_length;
|
||||
unsigned int target_length;
|
||||
enum zstd_strategy strategy;
|
||||
};
|
||||
typedef ZSTD_compressionParameters zstd_compression_parameters;
|
||||
|
||||
/**
|
||||
* struct zstd_frame_parameters - zstd frame parameters
|
||||
* @content_size_flag: Controls whether content size will be present in the
|
||||
* frame header (when known).
|
||||
* @checksum_flag: Controls whether a 32-bit checksum is generated at the
|
||||
* end of the frame for error detection.
|
||||
* @no_dict_id_flag: Controls whether dictID will be saved into the frame
|
||||
* header when using dictionary compression.
|
||||
* @contentSizeFlag: Controls whether content size will be present in the
|
||||
* frame header (when known).
|
||||
* @checksumFlag: Controls whether a 32-bit checksum is generated at the
|
||||
* end of the frame for error detection.
|
||||
* @noDictIDFlag: Controls whether dictID will be saved into the frame
|
||||
* header when using dictionary compression.
|
||||
*
|
||||
* The default value is all fields set to 0.
|
||||
* The default value is all fields set to 0. See zstd_lib.h.
|
||||
*/
|
||||
struct zstd_frame_parameters {
|
||||
unsigned int content_size_flag;
|
||||
unsigned int checksum_flag;
|
||||
unsigned int no_dict_id_flag;
|
||||
};
|
||||
typedef ZSTD_frameParameters zstd_frame_parameters;
|
||||
|
||||
/**
|
||||
* struct zstd_parameters - zstd parameters
|
||||
* @cparams: The compression parameters.
|
||||
* @fparams: The frame parameters.
|
||||
* @cParams: The compression parameters.
|
||||
* @fParams: The frame parameters.
|
||||
*/
|
||||
struct zstd_parameters {
|
||||
struct zstd_compression_parameters cparams;
|
||||
struct zstd_frame_parameters fparams;
|
||||
};
|
||||
typedef ZSTD_parameters zstd_parameters;
|
||||
|
||||
/**
|
||||
* zstd_get_params() - returns zstd_parameters for selected level
|
||||
@@ -140,12 +133,12 @@ struct zstd_parameters {
|
||||
*
|
||||
* Return: The selected zstd_parameters.
|
||||
*/
|
||||
struct zstd_parameters zstd_get_params(int level,
|
||||
zstd_parameters zstd_get_params(int level,
|
||||
unsigned long long estimated_src_size);
|
||||
|
||||
/* ====== Single-pass Compression ====== */
|
||||
|
||||
typedef struct ZSTD_CCtx_s zstd_cctx;
|
||||
typedef ZSTD_CCtx zstd_cctx;
|
||||
|
||||
/**
|
||||
* zstd_cctx_workspace_bound() - max memory needed to initialize a zstd_cctx
|
||||
@@ -158,8 +151,7 @@ typedef struct ZSTD_CCtx_s zstd_cctx;
|
||||
* Return: A lower bound on the size of the workspace that is passed to
|
||||
* zstd_init_cctx().
|
||||
*/
|
||||
size_t zstd_cctx_workspace_bound(
|
||||
const struct zstd_compression_parameters *parameters);
|
||||
size_t zstd_cctx_workspace_bound(const zstd_compression_parameters *parameters);
|
||||
|
||||
/**
|
||||
* zstd_init_cctx() - initialize a zstd compression context
|
||||
@@ -186,11 +178,11 @@ zstd_cctx *zstd_init_cctx(void *workspace, size_t workspace_size);
|
||||
* zstd_is_error().
|
||||
*/
|
||||
size_t zstd_compress_cctx(zstd_cctx *cctx, void *dst, size_t dst_capacity,
|
||||
const void *src, size_t src_size, const struct zstd_parameters *parameters);
|
||||
const void *src, size_t src_size, const zstd_parameters *parameters);
|
||||
|
||||
/* ====== Single-pass Decompression ====== */
|
||||
|
||||
typedef struct ZSTD_DCtx_s zstd_dctx;
|
||||
typedef ZSTD_DCtx zstd_dctx;
|
||||
|
||||
/**
|
||||
* zstd_dctx_workspace_bound() - max memory needed to initialize a zstd_dctx
|
||||
@@ -236,12 +228,10 @@ size_t zstd_decompress_dctx(zstd_dctx *dctx, void *dst, size_t dst_capacity,
|
||||
* @size: Size of the input buffer.
|
||||
* @pos: Position where reading stopped. Will be updated.
|
||||
* Necessarily 0 <= pos <= size.
|
||||
*
|
||||
* See zstd_lib.h.
|
||||
*/
|
||||
struct zstd_in_buffer {
|
||||
const void *src;
|
||||
size_t size;
|
||||
size_t pos;
|
||||
};
|
||||
typedef ZSTD_inBuffer zstd_in_buffer;
|
||||
|
||||
/**
|
||||
* struct zstd_out_buffer - output buffer for streaming
|
||||
@@ -249,16 +239,14 @@ struct zstd_in_buffer {
|
||||
* @size: Size of the output buffer.
|
||||
* @pos: Position where writing stopped. Will be updated.
|
||||
* Necessarily 0 <= pos <= size.
|
||||
*
|
||||
* See zstd_lib.h.
|
||||
*/
|
||||
struct zstd_out_buffer {
|
||||
void *dst;
|
||||
size_t size;
|
||||
size_t pos;
|
||||
};
|
||||
typedef ZSTD_outBuffer zstd_out_buffer;
|
||||
|
||||
/* ====== Streaming Compression ====== */
|
||||
|
||||
typedef struct ZSTD_CCtx_s zstd_cstream;
|
||||
typedef ZSTD_CStream zstd_cstream;
|
||||
|
||||
/**
|
||||
* zstd_cstream_workspace_bound() - memory needed to initialize a zstd_cstream
|
||||
@@ -267,8 +255,7 @@ typedef struct ZSTD_CCtx_s zstd_cstream;
|
||||
* Return: A lower bound on the size of the workspace that is passed to
|
||||
* zstd_init_cstream().
|
||||
*/
|
||||
size_t zstd_cstream_workspace_bound(
|
||||
const struct zstd_compression_parameters *cparams);
|
||||
size_t zstd_cstream_workspace_bound(const zstd_compression_parameters *cparams);
|
||||
|
||||
/**
|
||||
* zstd_init_cstream() - initialize a zstd streaming compression context
|
||||
@@ -285,7 +272,7 @@ size_t zstd_cstream_workspace_bound(
|
||||
*
|
||||
* Return: The zstd streaming compression context or NULL on error.
|
||||
*/
|
||||
zstd_cstream *zstd_init_cstream(const struct zstd_parameters *parameters,
|
||||
zstd_cstream *zstd_init_cstream(const zstd_parameters *parameters,
|
||||
unsigned long long pledged_src_size, void *workspace, size_t workspace_size);
|
||||
|
||||
/**
|
||||
@@ -320,8 +307,8 @@ size_t zstd_reset_cstream(zstd_cstream *cstream,
|
||||
* function call or an error, which can be checked using
|
||||
* zstd_is_error().
|
||||
*/
|
||||
size_t zstd_compress_stream(zstd_cstream *cstream,
|
||||
struct zstd_out_buffer *output, struct zstd_in_buffer *input);
|
||||
size_t zstd_compress_stream(zstd_cstream *cstream, zstd_out_buffer *output,
|
||||
zstd_in_buffer *input);
|
||||
|
||||
/**
|
||||
* zstd_flush_stream() - flush internal buffers into output
|
||||
@@ -336,7 +323,7 @@ size_t zstd_compress_stream(zstd_cstream *cstream,
|
||||
* Return: The number of bytes still present within internal buffers or an
|
||||
* error, which can be checked using zstd_is_error().
|
||||
*/
|
||||
size_t zstd_flush_stream(zstd_cstream *cstream, struct zstd_out_buffer *output);
|
||||
size_t zstd_flush_stream(zstd_cstream *cstream, zstd_out_buffer *output);
|
||||
|
||||
/**
|
||||
* zstd_end_stream() - flush internal buffers into output and end the frame
|
||||
@@ -350,11 +337,11 @@ size_t zstd_flush_stream(zstd_cstream *cstream, struct zstd_out_buffer *output);
|
||||
* Return: The number of bytes still present within internal buffers or an
|
||||
* error, which can be checked using zstd_is_error().
|
||||
*/
|
||||
size_t zstd_end_stream(zstd_cstream *cstream, struct zstd_out_buffer *output);
|
||||
size_t zstd_end_stream(zstd_cstream *cstream, zstd_out_buffer *output);
|
||||
|
||||
/* ====== Streaming Decompression ====== */
|
||||
|
||||
typedef struct ZSTD_DCtx_s zstd_dstream;
|
||||
typedef ZSTD_DStream zstd_dstream;
|
||||
|
||||
/**
|
||||
* zstd_dstream_workspace_bound() - memory needed to initialize a zstd_dstream
|
||||
@@ -411,8 +398,8 @@ size_t zstd_reset_dstream(zstd_dstream *dstream);
|
||||
* using zstd_is_error(). The size hint will never load more than the
|
||||
* frame.
|
||||
*/
|
||||
size_t zstd_decompress_stream(zstd_dstream *dstream,
|
||||
struct zstd_out_buffer *output, struct zstd_in_buffer *input);
|
||||
size_t zstd_decompress_stream(zstd_dstream *dstream, zstd_out_buffer *output,
|
||||
zstd_in_buffer *input);
|
||||
|
||||
/* ====== Frame Inspection Functions ====== */
|
||||
|
||||
@@ -431,20 +418,21 @@ size_t zstd_find_frame_compressed_size(const void *src, size_t src_size);
|
||||
|
||||
/**
|
||||
* struct zstd_frame_params - zstd frame parameters stored in the frame header
|
||||
* @frame_content_size: The frame content size, or 0 if not present.
|
||||
* @window_size: The window size, or 0 if the frame is a skippable frame.
|
||||
* @dict_id: The dictionary id, or 0 if not present.
|
||||
* @checksum_flag: Whether a checksum was used.
|
||||
* @frameContentSize: The frame content size, or ZSTD_CONTENTSIZE_UNKNOWN if not
|
||||
* present.
|
||||
* @windowSize: The window size, or 0 if the frame is a skippable frame.
|
||||
* @blockSizeMax: The maximum block size.
|
||||
* @frameType: The frame type (zstd or skippable)
|
||||
* @headerSize: The size of the frame header.
|
||||
* @dictID: The dictionary id, or 0 if not present.
|
||||
* @checksumFlag: Whether a checksum was used.
|
||||
*
|
||||
* See zstd_lib.h.
|
||||
*/
|
||||
struct zstd_frame_params {
|
||||
unsigned long long frame_content_size;
|
||||
unsigned int window_size;
|
||||
unsigned int dict_id;
|
||||
unsigned int checksum_flag;
|
||||
};
|
||||
typedef ZSTD_frameHeader zstd_frame_header;
|
||||
|
||||
/**
|
||||
* zstd_get_frame_params() - extracts parameters from a zstd or skippable frame
|
||||
* zstd_get_frame_header() - extracts parameters from a zstd or skippable frame
|
||||
* @params: On success the frame parameters are written here.
|
||||
* @src: The source buffer. It must point to a zstd or skippable frame.
|
||||
* @src_size: The size of the source buffer.
|
||||
@@ -453,7 +441,7 @@ struct zstd_frame_params {
|
||||
* must be provided to make forward progress. Otherwise it returns
|
||||
* an error, which can be checked using zstd_is_error().
|
||||
*/
|
||||
size_t zstd_get_frame_params(struct zstd_frame_params *params, const void *src,
|
||||
size_t zstd_get_frame_header(zstd_frame_header *params, const void *src,
|
||||
size_t src_size);
|
||||
|
||||
#endif /* LINUX_ZSTD_H */
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
# ################################################################
|
||||
# Copyright (c) Facebook, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
# in the COPYING file in the root directory of this source tree).
|
||||
# You may select, at your option, one of the above-listed licenses.
|
||||
# ################################################################
|
||||
|
||||
LINUX := ../linux
|
||||
LINUX_ZSTDLIB := $(LINUX)/lib/zstd
|
||||
|
||||
CPPFLAGS += -I$(LINUX)/include -I$(LINUX_ZSTDLIB) -Iinclude -DNDEBUG
|
||||
CPPFLAGS += -I$(LINUX)/include -I$(LINUX_ZSTDLIB) -Iinclude -DNDEBUG -Wno-deprecated-declarations
|
||||
# Don't poison the workspace, it currently doesn't work with static allocation and workspace reuse
|
||||
CPPFLAGS += -DZSTD_ASAN_DONT_POISON_WORKSPACE
|
||||
|
||||
LINUX_ZSTD_MODULE := $(wildcard $(LINUX_ZSTDLIB)/*.c)
|
||||
LINUX_ZSTD_COMMON := $(wildcard $(LINUX_ZSTDLIB)/common/*.c)
|
||||
LINUX_ZSTD_COMPRESS := $(wildcard $(LINUX_ZSTDLIB)/compress/*.c)
|
||||
LINUX_ZSTD_DECOMPRESS := $(wildcard $(LINUX_ZSTDLIB)/decompress/*.c)
|
||||
LINUX_ZSTD_COMMON := $(wildcard $(LINUX_ZSTDLIB)/common/*.c)
|
||||
LINUX_ZSTD_COMPRESS := $(wildcard $(LINUX_ZSTDLIB)/compress/*.c)
|
||||
LINUX_ZSTD_DECOMPRESS := $(wildcard $(LINUX_ZSTDLIB)/decompress/*.c)
|
||||
LINUX_ZSTD_FILES := $(LINUX_ZSTD_MODULE) $(LINUX_ZSTD_COMMON) $(LINUX_ZSTD_COMPRESS) $(LINUX_ZSTD_DECOMPRESS)
|
||||
LINUX_ZSTD_OBJECTS := $(LINUX_ZSTD_FILES:.c=.o)
|
||||
|
||||
@@ -29,6 +38,7 @@ run-test: test static_test
|
||||
|
||||
.PHONY:
|
||||
clean:
|
||||
$(RM) -f $(LINUX_ZSTDLIB)/*.o
|
||||
$(RM) -f $(LINUX_ZSTDLIB)/**/*.o
|
||||
$(RM) -f *.o *.a
|
||||
$(RM) -f test
|
||||
|
||||
@@ -4,13 +4,23 @@
|
||||
#include <assert.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#define _LITTLE_ENDIAN 1
|
||||
#ifndef __LITTLE_ENDIAN
|
||||
# if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || defined(__LITTLE_ENDIAN__)
|
||||
# define __LITTLE_ENDIAN 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
# define _IS_LITTLE_ENDIAN 1
|
||||
#else
|
||||
# define _IS_LITTLE_ENDIAN 0
|
||||
#endif
|
||||
|
||||
static unsigned _isLittleEndian(void)
|
||||
{
|
||||
const union { uint32_t u; uint8_t c[4]; } one = { 1 };
|
||||
assert(_LITTLE_ENDIAN == one.c[0]);
|
||||
return _LITTLE_ENDIAN;
|
||||
assert(_IS_LITTLE_ENDIAN == one.c[0]);
|
||||
return _IS_LITTLE_ENDIAN;
|
||||
}
|
||||
|
||||
static uint16_t _swap16(uint16_t in)
|
||||
@@ -165,7 +175,7 @@ extern void __bad_unaligned_access_size(void);
|
||||
(void)0; \
|
||||
})
|
||||
|
||||
#if _LITTLE_ENDIAN
|
||||
#if _IS_LITTLE_ENDIAN
|
||||
# define get_unaligned __get_unaligned_le
|
||||
# define put_unaligned __put_unaligned_le
|
||||
#else
|
||||
|
||||
@@ -14,4 +14,8 @@
|
||||
#define inline __inline __attribute__((unused))
|
||||
#endif
|
||||
|
||||
#ifndef noinline
|
||||
#define noinline __attribute__((noinline))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,4 +12,8 @@
|
||||
|
||||
#define WARN_ON(x)
|
||||
|
||||
#define PTR_ALIGN(p, a) (typeof(p))ALIGN((unsigned long long)(p), (a))
|
||||
#define ALIGN(x, a) ALIGN_MASK((x), (a) - 1)
|
||||
#define ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Facebook, Inc.
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 7-2021, Facebook, Inc.
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
@@ -57,10 +57,10 @@ static void test_btrfs(test_data_t const *data) {
|
||||
fprintf(stderr, "testing btrfs use cases... ");
|
||||
size_t const size = MIN(data->dataSize, 128 * 1024);
|
||||
for (int level = -1; level < 16; ++level) {
|
||||
struct zstd_parameters params = zstd_get_params(level, size);
|
||||
CONTROL(params.cparams.window_log <= 17);
|
||||
zstd_parameters params = zstd_get_params(level, size);
|
||||
CONTROL(params.cParams.windowLog <= 17);
|
||||
size_t const workspaceSize =
|
||||
MAX(zstd_cstream_workspace_bound(¶ms.cparams),
|
||||
MAX(zstd_cstream_workspace_bound(¶ms.cParams),
|
||||
zstd_dstream_workspace_bound(size));
|
||||
void *workspace = malloc(workspaceSize);
|
||||
CONTROL(workspace != NULL);
|
||||
@@ -72,8 +72,8 @@ static void test_btrfs(test_data_t const *data) {
|
||||
{
|
||||
zstd_cstream *cctx = zstd_init_cstream(¶ms, size, workspace, workspaceSize);
|
||||
CONTROL(cctx != NULL);
|
||||
struct zstd_out_buffer out = {NULL, 0, 0};
|
||||
struct zstd_in_buffer in = {NULL, 0, 0};
|
||||
zstd_out_buffer out = {NULL, 0, 0};
|
||||
zstd_in_buffer in = {NULL, 0, 0};
|
||||
for (;;) {
|
||||
if (in.pos == in.size) {
|
||||
in.src = ip;
|
||||
@@ -107,10 +107,10 @@ static void test_btrfs(test_data_t const *data) {
|
||||
op = data->data2;
|
||||
oend = op + size;
|
||||
{
|
||||
zstd_dstream *dctx = zstd_init_dstream(1ULL << params.cparams.window_log, workspace, workspaceSize);
|
||||
zstd_dstream *dctx = zstd_init_dstream(1ULL << params.cParams.windowLog, workspace, workspaceSize);
|
||||
CONTROL(dctx != NULL);
|
||||
struct zstd_out_buffer out = {NULL, 0, 0};
|
||||
struct zstd_in_buffer in = {NULL, 0, 0};
|
||||
zstd_out_buffer out = {NULL, 0, 0};
|
||||
zstd_in_buffer in = {NULL, 0, 0};
|
||||
for (;;) {
|
||||
if (in.pos == in.size) {
|
||||
in.src = ip;
|
||||
@@ -144,8 +144,8 @@ static void test_decompress_unzstd(test_data_t const *data) {
|
||||
fprintf(stderr, "Testing decompress unzstd... ");
|
||||
size_t cSize;
|
||||
{
|
||||
struct zstd_parameters params = zstd_get_params(19, 0);
|
||||
size_t const wkspSize = zstd_cctx_workspace_bound(¶ms.cparams);
|
||||
zstd_parameters params = zstd_get_params(19, 0);
|
||||
size_t const wkspSize = zstd_cctx_workspace_bound(¶ms.cParams);
|
||||
void* wksp = malloc(wkspSize);
|
||||
CONTROL(wksp != NULL);
|
||||
zstd_cctx* cctx = zstd_init_cctx(wksp, wkspSize);
|
||||
@@ -169,6 +169,13 @@ static void test_decompress_unzstd(test_data_t const *data) {
|
||||
fprintf(stderr, "Ok\n");
|
||||
}
|
||||
|
||||
static void test_f2fs() {
|
||||
fprintf(stderr, "testing f2fs uses... ");
|
||||
CONTROL(zstd_min_clevel() < 0);
|
||||
CONTROL(zstd_max_clevel() == 22);
|
||||
fprintf(stderr, "Ok\n");
|
||||
}
|
||||
|
||||
static char *g_stack = NULL;
|
||||
|
||||
static void __attribute__((noinline)) use(void *x) {
|
||||
@@ -195,6 +202,7 @@ static void __attribute__((noinline)) check_stack() {
|
||||
|
||||
static void test_stack_usage(test_data_t const *data) {
|
||||
set_stack();
|
||||
test_f2fs();
|
||||
test_btrfs(data);
|
||||
test_decompress_unzstd(data);
|
||||
check_stack();
|
||||
@@ -202,6 +210,7 @@ static void test_stack_usage(test_data_t const *data) {
|
||||
|
||||
int main(void) {
|
||||
test_data_t data = create_test_data();
|
||||
test_f2fs();
|
||||
test_btrfs(&data);
|
||||
test_decompress_unzstd(&data);
|
||||
test_stack_usage(&data);
|
||||
|
||||
@@ -1,75 +1,33 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
* in the COPYING file in the root directory of this source tree).
|
||||
* You may select, at your option, one of the above-listed licenses.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/zstd.h>
|
||||
|
||||
#include "zstd.h"
|
||||
#include "common/zstd_deps.h"
|
||||
#include "common/zstd_internal.h"
|
||||
|
||||
static void zstd_check_structs(void) {
|
||||
/* Check that the structs have the same size. */
|
||||
ZSTD_STATIC_ASSERT(sizeof(ZSTD_parameters) ==
|
||||
sizeof(struct zstd_parameters));
|
||||
ZSTD_STATIC_ASSERT(sizeof(ZSTD_compressionParameters) ==
|
||||
sizeof(struct zstd_compression_parameters));
|
||||
ZSTD_STATIC_ASSERT(sizeof(ZSTD_frameParameters) ==
|
||||
sizeof(struct zstd_frame_parameters));
|
||||
/* Zstd guarantees that the layout of the structs never change. Verify it. */
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_parameters, cParams) ==
|
||||
offsetof(struct zstd_parameters, cparams));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_parameters, fParams) ==
|
||||
offsetof(struct zstd_parameters, fparams));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_compressionParameters, windowLog) ==
|
||||
offsetof(struct zstd_compression_parameters, window_log));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_compressionParameters, chainLog) ==
|
||||
offsetof(struct zstd_compression_parameters, chain_log));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_compressionParameters, hashLog) ==
|
||||
offsetof(struct zstd_compression_parameters, hash_log));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_compressionParameters, searchLog) ==
|
||||
offsetof(struct zstd_compression_parameters, search_log));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_compressionParameters, minMatch) ==
|
||||
offsetof(struct zstd_compression_parameters, search_length));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_compressionParameters, targetLength) ==
|
||||
offsetof(struct zstd_compression_parameters, target_length));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_compressionParameters, strategy) ==
|
||||
offsetof(struct zstd_compression_parameters, strategy));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_frameParameters, contentSizeFlag) ==
|
||||
offsetof(struct zstd_frame_parameters, content_size_flag));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_frameParameters, checksumFlag) ==
|
||||
offsetof(struct zstd_frame_parameters, checksum_flag));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_frameParameters, noDictIDFlag) ==
|
||||
offsetof(struct zstd_frame_parameters, no_dict_id_flag));
|
||||
/* Check that the strategies are the same. This can change. */
|
||||
ZSTD_STATIC_ASSERT((int)ZSTD_fast == (int)zstd_fast);
|
||||
ZSTD_STATIC_ASSERT((int)ZSTD_dfast == (int)zstd_dfast);
|
||||
ZSTD_STATIC_ASSERT((int)ZSTD_greedy == (int)zstd_greedy);
|
||||
ZSTD_STATIC_ASSERT((int)ZSTD_lazy == (int)zstd_lazy);
|
||||
ZSTD_STATIC_ASSERT((int)ZSTD_lazy2 == (int)zstd_lazy2);
|
||||
ZSTD_STATIC_ASSERT((int)ZSTD_btlazy2 == (int)zstd_btlazy2);
|
||||
ZSTD_STATIC_ASSERT((int)ZSTD_btopt == (int)zstd_btopt);
|
||||
ZSTD_STATIC_ASSERT((int)ZSTD_btultra == (int)zstd_btultra);
|
||||
ZSTD_STATIC_ASSERT((int)ZSTD_btultra2 == (int)zstd_btultra2);
|
||||
/* Check input buffer */
|
||||
ZSTD_STATIC_ASSERT(sizeof(ZSTD_inBuffer) == sizeof(struct zstd_in_buffer));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_inBuffer, src) ==
|
||||
offsetof(struct zstd_in_buffer, src));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_inBuffer, size) ==
|
||||
offsetof(struct zstd_in_buffer, size));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_inBuffer, pos) ==
|
||||
offsetof(struct zstd_in_buffer, pos));
|
||||
/* Check output buffer */
|
||||
ZSTD_STATIC_ASSERT(sizeof(ZSTD_outBuffer) ==
|
||||
sizeof(struct zstd_out_buffer));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_outBuffer, dst) ==
|
||||
offsetof(struct zstd_out_buffer, dst));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_outBuffer, size) ==
|
||||
offsetof(struct zstd_out_buffer, size));
|
||||
ZSTD_STATIC_ASSERT(offsetof(ZSTD_outBuffer, pos) ==
|
||||
offsetof(struct zstd_out_buffer, pos));
|
||||
int zstd_min_clevel(void)
|
||||
{
|
||||
return ZSTD_minCLevel();
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_min_clevel);
|
||||
|
||||
int zstd_max_clevel(void)
|
||||
{
|
||||
return ZSTD_maxCLevel();
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_max_clevel);
|
||||
|
||||
size_t zstd_compress_bound(size_t src_size)
|
||||
{
|
||||
@@ -77,26 +35,16 @@ size_t zstd_compress_bound(size_t src_size)
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_compress_bound);
|
||||
|
||||
struct zstd_parameters zstd_get_params(int level,
|
||||
zstd_parameters zstd_get_params(int level,
|
||||
unsigned long long estimated_src_size)
|
||||
{
|
||||
const ZSTD_parameters params = ZSTD_getParams(level, estimated_src_size, 0);
|
||||
struct zstd_parameters out;
|
||||
|
||||
/* no-op */
|
||||
zstd_check_structs();
|
||||
ZSTD_memcpy(&out, ¶ms, sizeof(out));
|
||||
return out;
|
||||
return ZSTD_getParams(level, estimated_src_size, 0);
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_get_params);
|
||||
|
||||
size_t zstd_cctx_workspace_bound(
|
||||
const struct zstd_compression_parameters *cparams)
|
||||
size_t zstd_cctx_workspace_bound(const zstd_compression_parameters *cparams)
|
||||
{
|
||||
ZSTD_compressionParameters p;
|
||||
|
||||
ZSTD_memcpy(&p, cparams, sizeof(p));
|
||||
return ZSTD_estimateCCtxSize_usingCParams(p);
|
||||
return ZSTD_estimateCCtxSize_usingCParams(*cparams);
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_cctx_workspace_bound);
|
||||
|
||||
@@ -109,29 +57,21 @@ zstd_cctx *zstd_init_cctx(void *workspace, size_t workspace_size)
|
||||
EXPORT_SYMBOL(zstd_init_cctx);
|
||||
|
||||
size_t zstd_compress_cctx(zstd_cctx *cctx, void *dst, size_t dst_capacity,
|
||||
const void *src, size_t src_size, const struct zstd_parameters *parameters)
|
||||
const void *src, size_t src_size, const zstd_parameters *parameters)
|
||||
{
|
||||
ZSTD_parameters p;
|
||||
|
||||
ZSTD_memcpy(&p, parameters, sizeof(p));
|
||||
return ZSTD_compress_advanced(cctx, dst, dst_capacity, src, src_size, NULL, 0, p);
|
||||
return ZSTD_compress_advanced(cctx, dst, dst_capacity, src, src_size, NULL, 0, *parameters);
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_compress_cctx);
|
||||
|
||||
size_t zstd_cstream_workspace_bound(
|
||||
const struct zstd_compression_parameters *cparams)
|
||||
size_t zstd_cstream_workspace_bound(const zstd_compression_parameters *cparams)
|
||||
{
|
||||
ZSTD_compressionParameters p;
|
||||
|
||||
ZSTD_memcpy(&p, cparams, sizeof(p));
|
||||
return ZSTD_estimateCStreamSize_usingCParams(p);
|
||||
return ZSTD_estimateCStreamSize_usingCParams(*cparams);
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_cstream_workspace_bound);
|
||||
|
||||
zstd_cstream *zstd_init_cstream(const struct zstd_parameters *parameters,
|
||||
zstd_cstream *zstd_init_cstream(const zstd_parameters *parameters,
|
||||
unsigned long long pledged_src_size, void *workspace, size_t workspace_size)
|
||||
{
|
||||
ZSTD_parameters p;
|
||||
zstd_cstream *cstream;
|
||||
size_t ret;
|
||||
|
||||
@@ -146,8 +86,7 @@ zstd_cstream *zstd_init_cstream(const struct zstd_parameters *parameters,
|
||||
if (pledged_src_size == 0)
|
||||
pledged_src_size = ZSTD_CONTENTSIZE_UNKNOWN;
|
||||
|
||||
ZSTD_memcpy(&p, parameters, sizeof(p));
|
||||
ret = ZSTD_initCStream_advanced(cstream, NULL, 0, p, pledged_src_size);
|
||||
ret = ZSTD_initCStream_advanced(cstream, NULL, 0, *parameters, pledged_src_size);
|
||||
if (ZSTD_isError(ret))
|
||||
return NULL;
|
||||
|
||||
@@ -162,43 +101,22 @@ size_t zstd_reset_cstream(zstd_cstream *cstream,
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_reset_cstream);
|
||||
|
||||
size_t zstd_compress_stream(zstd_cstream *cstream,
|
||||
struct zstd_out_buffer *output, struct zstd_in_buffer *input)
|
||||
size_t zstd_compress_stream(zstd_cstream *cstream, zstd_out_buffer *output,
|
||||
zstd_in_buffer *input)
|
||||
{
|
||||
ZSTD_outBuffer o;
|
||||
ZSTD_inBuffer i;
|
||||
size_t ret;
|
||||
|
||||
ZSTD_memcpy(&o, output, sizeof(o));
|
||||
ZSTD_memcpy(&i, input, sizeof(i));
|
||||
ret = ZSTD_compressStream(cstream, &o, &i);
|
||||
ZSTD_memcpy(output, &o, sizeof(o));
|
||||
ZSTD_memcpy(input, &i, sizeof(i));
|
||||
return ret;
|
||||
return ZSTD_compressStream(cstream, output, input);
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_compress_stream);
|
||||
|
||||
size_t zstd_flush_stream(zstd_cstream *cstream, struct zstd_out_buffer *output)
|
||||
size_t zstd_flush_stream(zstd_cstream *cstream, zstd_out_buffer *output)
|
||||
{
|
||||
ZSTD_outBuffer o;
|
||||
size_t ret;
|
||||
|
||||
ZSTD_memcpy(&o, output, sizeof(o));
|
||||
ret = ZSTD_flushStream(cstream, &o);
|
||||
ZSTD_memcpy(output, &o, sizeof(o));
|
||||
return ret;
|
||||
return ZSTD_flushStream(cstream, output);
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_flush_stream);
|
||||
|
||||
size_t zstd_end_stream(zstd_cstream *cstream, struct zstd_out_buffer *output)
|
||||
size_t zstd_end_stream(zstd_cstream *cstream, zstd_out_buffer *output)
|
||||
{
|
||||
ZSTD_outBuffer o;
|
||||
size_t ret;
|
||||
|
||||
ZSTD_memcpy(&o, output, sizeof(o));
|
||||
ret = ZSTD_endStream(cstream, &o);
|
||||
ZSTD_memcpy(output, &o, sizeof(o));
|
||||
return ret;
|
||||
return ZSTD_endStream(cstream, output);
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_end_stream);
|
||||
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
||||
* in the COPYING file in the root directory of this source tree).
|
||||
* You may select, at your option, one of the above-listed licenses.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/zstd.h>
|
||||
|
||||
#include "zstd.h"
|
||||
#include "common/zstd_deps.h"
|
||||
#include "common/zstd_errors.h"
|
||||
|
||||
/* Common symbols. zstd_compress must depend on zstd_decompress. */
|
||||
|
||||
@@ -17,7 +24,7 @@ unsigned int zstd_is_error(size_t code)
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_is_error);
|
||||
|
||||
int zstd_get_error_code(size_t code)
|
||||
zstd_error_code zstd_get_error_code(size_t code)
|
||||
{
|
||||
return ZSTD_getErrorCode(code);
|
||||
}
|
||||
@@ -74,19 +81,10 @@ size_t zstd_reset_dstream(zstd_dstream *dstream)
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_reset_dstream);
|
||||
|
||||
size_t zstd_decompress_stream(zstd_dstream *dstream,
|
||||
struct zstd_out_buffer *output, struct zstd_in_buffer *input)
|
||||
size_t zstd_decompress_stream(zstd_dstream *dstream, zstd_out_buffer *output,
|
||||
zstd_in_buffer *input)
|
||||
{
|
||||
ZSTD_outBuffer o;
|
||||
ZSTD_inBuffer i;
|
||||
size_t ret;
|
||||
|
||||
ZSTD_memcpy(&o, output, sizeof(o));
|
||||
ZSTD_memcpy(&i, input, sizeof(i));
|
||||
ret = ZSTD_decompressStream(dstream, &o, &i);
|
||||
ZSTD_memcpy(output, &o, sizeof(o));
|
||||
ZSTD_memcpy(input, &i, sizeof(i));
|
||||
return ret;
|
||||
return ZSTD_decompressStream(dstream, output, input);
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_decompress_stream);
|
||||
|
||||
@@ -96,27 +94,12 @@ size_t zstd_find_frame_compressed_size(const void *src, size_t src_size)
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_find_frame_compressed_size);
|
||||
|
||||
size_t zstd_get_frame_params(struct zstd_frame_params *params, const void *src,
|
||||
size_t zstd_get_frame_header(zstd_frame_header *header, const void *src,
|
||||
size_t src_size)
|
||||
{
|
||||
ZSTD_frameHeader h;
|
||||
const size_t ret = ZSTD_getFrameHeader(&h, src, src_size);
|
||||
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
if (h.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN)
|
||||
params->frame_content_size = h.frameContentSize;
|
||||
else
|
||||
params->frame_content_size = 0;
|
||||
|
||||
params->window_size = h.windowSize;
|
||||
params->dict_id = h.dictID;
|
||||
params->checksum_flag = h.checksumFlag;
|
||||
|
||||
return ret;
|
||||
return ZSTD_getFrameHeader(header, src, src_size);
|
||||
}
|
||||
EXPORT_SYMBOL(zstd_get_frame_params);
|
||||
EXPORT_SYMBOL(zstd_get_frame_header);
|
||||
|
||||
MODULE_LICENSE("Dual BSD/GPL");
|
||||
MODULE_DESCRIPTION("Zstd Decompressor");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Facebook, Inc.
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
@@ -71,7 +72,7 @@ static uint64_t ZSTD_div64(uint64_t dividend, uint32_t divisor) {
|
||||
#endif /* ZSTD_DEPS_MATH64 */
|
||||
#endif /* ZSTD_DEPS_NEED_MATH64 */
|
||||
|
||||
/*
|
||||
/*
|
||||
* This is only requested when DEBUGLEVEL >= 1, meaning
|
||||
* it is disabled in production.
|
||||
* Need:
|
||||
@@ -88,7 +89,7 @@ static uint64_t ZSTD_div64(uint64_t dividend, uint32_t divisor) {
|
||||
#endif /* ZSTD_DEPS_ASSERT */
|
||||
#endif /* ZSTD_DEPS_NEED_ASSERT */
|
||||
|
||||
/*
|
||||
/*
|
||||
* This is only requested when DEBUGLEVEL >= 2, meaning
|
||||
* it is disabled in production.
|
||||
* Need:
|
||||
@@ -105,7 +106,7 @@ static uint64_t ZSTD_div64(uint64_t dividend, uint32_t divisor) {
|
||||
#endif /* ZSTD_DEPS_IO */
|
||||
#endif /* ZSTD_DEPS_NEED_IO */
|
||||
|
||||
/*
|
||||
/*
|
||||
* Only requested when MSAN is enabled.
|
||||
* Need:
|
||||
* intptr_t
|
||||
|
||||
@@ -30,6 +30,9 @@ CXXFLAGS ?= -O3 -Wall -Wextra -pedantic
|
||||
CPPFLAGS ?=
|
||||
LDFLAGS ?=
|
||||
|
||||
# PZstd uses legacy APIs
|
||||
CFLAGS += -Wno-deprecated-declarations
|
||||
|
||||
# Include flags
|
||||
PZSTD_INC = -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(PROGDIR) -I.
|
||||
GTEST_INC = -isystem googletest/googletest/include
|
||||
|
||||
@@ -13,7 +13,7 @@ ZSTDLIB_PATH = ../../../lib
|
||||
ZSTDLIB_NAME = libzstd.a
|
||||
ZSTDLIB = $(ZSTDLIB_PATH)/$(ZSTDLIB_NAME)
|
||||
|
||||
CPPFLAGS += -I../ -I../../../lib -I../../../lib/common
|
||||
CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -I../ -I../../../lib -I../../../lib/common
|
||||
|
||||
CFLAGS ?= -O3
|
||||
CFLAGS += -g
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
# define SLEEP(x) usleep(x * 1000)
|
||||
#endif
|
||||
|
||||
#define XXH_NAMESPACE ZSTD_
|
||||
#include "xxhash.h"
|
||||
|
||||
#include "pool.h" // use zstd thread pool for demo
|
||||
|
||||
@@ -99,6 +99,9 @@ static void decompressFile_orDie(const char* fname, off_t startOffset, off_t end
|
||||
|
||||
while (startOffset < endOffset) {
|
||||
size_t const result = ZSTD_seekable_decompress(seekable, buffOut, MIN(endOffset - startOffset, buffOutSize), startOffset);
|
||||
if (!result) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (ZSTD_isError(result)) {
|
||||
fprintf(stderr, "ZSTD_seekable_decompress() error : %s \n",
|
||||
|
||||
@@ -104,6 +104,9 @@ static void decompressFile_orDie(const char* fname, off_t startOffset, off_t end
|
||||
|
||||
while (startOffset < endOffset) {
|
||||
size_t const result = ZSTD_seekable_decompress(seekable, buffOut, MIN(endOffset - startOffset, buffOutSize), startOffset);
|
||||
if (!result) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (ZSTD_isError(result)) {
|
||||
fprintf(stderr, "ZSTD_seekable_decompress() error : %s \n",
|
||||
|
||||
@@ -13,7 +13,7 @@ ZSTDLIB_PATH = ../../../lib
|
||||
ZSTDLIB_NAME = libzstd.a
|
||||
ZSTDLIB = $(ZSTDLIB_PATH)/$(ZSTDLIB_NAME)
|
||||
|
||||
CPPFLAGS += -I../ -I$(ZSTDLIB_PATH) -I$(ZSTDLIB_PATH)/common
|
||||
CPPFLAGS += -DXXH_NAMESPACE=ZSTD_ -I../ -I$(ZSTDLIB_PATH) -I$(ZSTDLIB_PATH)/common
|
||||
|
||||
CFLAGS ?= -O3
|
||||
CFLAGS += -g -Wall -Wextra -Wcast-qual -Wcast-align -Wconversion \
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <assert.h>
|
||||
|
||||
#define XXH_STATIC_LINKING_ONLY
|
||||
#define XXH_NAMESPACE ZSTD_
|
||||
#include "xxhash.h"
|
||||
|
||||
#define ZSTD_STATIC_LINKING_ONLY
|
||||
@@ -83,7 +82,7 @@ static size_t ZSTD_seekable_frameLog_freeVec(ZSTD_frameLog* fl)
|
||||
|
||||
ZSTD_frameLog* ZSTD_seekable_createFrameLog(int checksumFlag)
|
||||
{
|
||||
ZSTD_frameLog* const fl = malloc(sizeof(ZSTD_frameLog));
|
||||
ZSTD_frameLog* const fl = (ZSTD_frameLog*)malloc(sizeof(ZSTD_frameLog));
|
||||
if (fl == NULL) return NULL;
|
||||
|
||||
if (ZSTD_isError(ZSTD_seekable_frameLog_allocVec(fl))) {
|
||||
@@ -108,7 +107,7 @@ size_t ZSTD_seekable_freeFrameLog(ZSTD_frameLog* fl)
|
||||
|
||||
ZSTD_seekable_CStream* ZSTD_seekable_createCStream(void)
|
||||
{
|
||||
ZSTD_seekable_CStream* const zcs = malloc(sizeof(ZSTD_seekable_CStream));
|
||||
ZSTD_seekable_CStream* const zcs = (ZSTD_seekable_CStream*)malloc(sizeof(ZSTD_seekable_CStream));
|
||||
if (zcs == NULL) return NULL;
|
||||
|
||||
memset(zcs, 0, sizeof(*zcs));
|
||||
@@ -177,7 +176,7 @@ size_t ZSTD_seekable_logFrame(ZSTD_frameLog* fl,
|
||||
if (fl->size == fl->capacity) {
|
||||
/* exponential size increase for constant amortized runtime */
|
||||
size_t const newCapacity = fl->capacity * 2;
|
||||
framelogEntry_t* const newEntries = realloc(fl->entries,
|
||||
framelogEntry_t* const newEntries = (framelogEntry_t*)realloc(fl->entries,
|
||||
sizeof(framelogEntry_t) * newCapacity);
|
||||
|
||||
if (newEntries == NULL) return ERROR(memory_allocation);
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
#include <assert.h>
|
||||
|
||||
#define XXH_STATIC_LINKING_ONLY
|
||||
#define XXH_NAMESPACE ZSTD_
|
||||
#include "xxhash.h"
|
||||
|
||||
#define ZSTD_STATIC_LINKING_ONLY
|
||||
@@ -176,7 +175,7 @@ struct ZSTD_seekable_s {
|
||||
|
||||
ZSTD_seekable* ZSTD_seekable_create(void)
|
||||
{
|
||||
ZSTD_seekable* const zs = malloc(sizeof(ZSTD_seekable));
|
||||
ZSTD_seekable* const zs = (ZSTD_seekable*)malloc(sizeof(ZSTD_seekable));
|
||||
if (zs == NULL) return NULL;
|
||||
|
||||
/* also initializes stage to zsds_init */
|
||||
@@ -202,7 +201,7 @@ size_t ZSTD_seekable_free(ZSTD_seekable* zs)
|
||||
|
||||
ZSTD_seekTable* ZSTD_seekTable_create_fromSeekable(const ZSTD_seekable* zs)
|
||||
{
|
||||
ZSTD_seekTable* const st = malloc(sizeof(ZSTD_seekTable));
|
||||
ZSTD_seekTable* const st = (ZSTD_seekTable*)malloc(sizeof(ZSTD_seekTable));
|
||||
if (st==NULL) return NULL;
|
||||
|
||||
st->checksumFlag = zs->seekTable.checksumFlag;
|
||||
@@ -433,6 +432,11 @@ size_t ZSTD_seekable_initAdvanced(ZSTD_seekable* zs, ZSTD_seekable_customFile sr
|
||||
|
||||
size_t ZSTD_seekable_decompress(ZSTD_seekable* zs, void* dst, size_t len, unsigned long long offset)
|
||||
{
|
||||
unsigned long long const eos = zs->seekTable.entries[zs->seekTable.tableLen].dOffset;
|
||||
if (offset + len > eos) {
|
||||
len = eos - offset;
|
||||
}
|
||||
|
||||
U32 targetFrame = ZSTD_seekable_offsetToFrameIndex(zs, offset);
|
||||
U32 noOutputProgressCount = 0;
|
||||
size_t srcBytesRead = 0;
|
||||
@@ -449,7 +453,7 @@ size_t ZSTD_seekable_decompress(ZSTD_seekable* zs, void* dst, size_t len, unsign
|
||||
zs->in = (ZSTD_inBuffer){zs->inBuff, 0, 0};
|
||||
XXH64_reset(&zs->xxhState, 0);
|
||||
ZSTD_DCtx_reset(zs->dstream, ZSTD_reset_session_only);
|
||||
if (srcBytesRead > zs->buffWrapper.size) {
|
||||
if (zs->buffWrapper.size && srcBytesRead > zs->buffWrapper.size) {
|
||||
return ERROR(seekableIO);
|
||||
}
|
||||
}
|
||||
@@ -502,6 +506,8 @@ size_t ZSTD_seekable_decompress(ZSTD_seekable* zs, void* dst, size_t len, unsign
|
||||
if (zs->decompressedOffset < offset + len) {
|
||||
/* go back to the start and force a reset of the stream */
|
||||
targetFrame = ZSTD_seekable_offsetToFrameIndex(zs, zs->decompressedOffset);
|
||||
/* in this case it will fail later with corruption_detected, since last block does not have checksum */
|
||||
assert(targetFrame != zs->seekTable.tableLen);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# ################################################################
|
||||
# Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
# Copyright (c) Yann Collet, Facebook, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2021, Facebook, Inc.
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2021, Facebook, Inc.
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Facebook, Inc.
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
+81
-60
@@ -1,10 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>zstd 1.4.9 Manual</title>
|
||||
<title>zstd 1.5.0 Manual</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>zstd 1.4.9 Manual</h1>
|
||||
<h1>zstd 1.5.0 Manual</h1>
|
||||
<hr>
|
||||
<a name="Contents"></a><h2>Contents</h2>
|
||||
<ol>
|
||||
@@ -12,15 +12,15 @@
|
||||
<li><a href="#Chapter2">Version</a></li>
|
||||
<li><a href="#Chapter3">Simple API</a></li>
|
||||
<li><a href="#Chapter4">Explicit context</a></li>
|
||||
<li><a href="#Chapter5">Advanced compression API</a></li>
|
||||
<li><a href="#Chapter6">Advanced decompression API</a></li>
|
||||
<li><a href="#Chapter5">Advanced compression API (Requires v1.4.0+)</a></li>
|
||||
<li><a href="#Chapter6">Advanced decompression API (Requires v1.4.0+)</a></li>
|
||||
<li><a href="#Chapter7">Streaming</a></li>
|
||||
<li><a href="#Chapter8">Streaming compression - HowTo</a></li>
|
||||
<li><a href="#Chapter9">Streaming decompression - HowTo</a></li>
|
||||
<li><a href="#Chapter10">Simple dictionary API</a></li>
|
||||
<li><a href="#Chapter11">Bulk processing dictionary API</a></li>
|
||||
<li><a href="#Chapter12">Dictionary helper functions</a></li>
|
||||
<li><a href="#Chapter13">Advanced dictionary and prefix API</a></li>
|
||||
<li><a href="#Chapter13">Advanced dictionary and prefix API (Requires v1.4.0+)</a></li>
|
||||
<li><a href="#Chapter14">experimental API (static linking only)</a></li>
|
||||
<li><a href="#Chapter15">Frame size functions</a></li>
|
||||
<li><a href="#Chapter16">Memory management</a></li>
|
||||
@@ -141,8 +141,9 @@ unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize);
|
||||
size_t ZSTD_compressBound(size_t srcSize); </b>/*!< maximum compressed size in worst case single-pass scenario */<b>
|
||||
unsigned ZSTD_isError(size_t code); </b>/*!< tells if a `size_t` function result is an error code */<b>
|
||||
const char* ZSTD_getErrorName(size_t code); </b>/*!< provides readable string from an error code */<b>
|
||||
int ZSTD_minCLevel(void); </b>/*!< minimum negative compression level allowed */<b>
|
||||
int ZSTD_minCLevel(void); </b>/*!< minimum negative compression level allowed, requires v1.4.0+ */<b>
|
||||
int ZSTD_maxCLevel(void); </b>/*!< maximum compression level available */<b>
|
||||
int ZSTD_defaultCLevel(void); </b>/*!< default compression level, specified by ZSTD_CLEVEL_DEFAULT, requires v1.5.0+ */<b>
|
||||
</pre></b><BR>
|
||||
<a name="Chapter4"></a><h2>Explicit context</h2><pre></pre>
|
||||
|
||||
@@ -157,7 +158,7 @@ int ZSTD_maxCLevel(void); </b>/*!< maximum compression lev
|
||||
|
||||
</pre><b><pre>typedef struct ZSTD_CCtx_s ZSTD_CCtx;
|
||||
ZSTD_CCtx* ZSTD_createCCtx(void);
|
||||
size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx);
|
||||
size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx); </b>/* accept NULL pointer */<b>
|
||||
</pre></b><BR>
|
||||
<pre><b>size_t ZSTD_compressCCtx(ZSTD_CCtx* cctx,
|
||||
void* dst, size_t dstCapacity,
|
||||
@@ -179,7 +180,7 @@ size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx);
|
||||
Use one context per thread for parallel execution.
|
||||
</pre><b><pre>typedef struct ZSTD_DCtx_s ZSTD_DCtx;
|
||||
ZSTD_DCtx* ZSTD_createDCtx(void);
|
||||
size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx);
|
||||
size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx); </b>/* accept NULL pointer */<b>
|
||||
</pre></b><BR>
|
||||
<pre><b>size_t ZSTD_decompressDCtx(ZSTD_DCtx* dctx,
|
||||
void* dst, size_t dstCapacity,
|
||||
@@ -190,7 +191,7 @@ size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx);
|
||||
|
||||
</p></pre><BR>
|
||||
|
||||
<a name="Chapter5"></a><h2>Advanced compression API</h2><pre></pre>
|
||||
<a name="Chapter5"></a><h2>Advanced compression API (Requires v1.4.0+)</h2><pre></pre>
|
||||
|
||||
<pre><b>typedef enum { ZSTD_fast=1,
|
||||
ZSTD_dfast=2,
|
||||
@@ -270,7 +271,6 @@ size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx);
|
||||
* The higher the value of selected strategy, the more complex it is,
|
||||
* resulting in stronger and slower compression.
|
||||
* Special: value 0 means "use default strategy". */
|
||||
|
||||
</b>/* LDM mode parameters */<b>
|
||||
ZSTD_c_enableLongDistanceMatching=160, </b>/* Enable long distance matching.<b>
|
||||
* This parameter is designed to improve compression ratio
|
||||
@@ -327,7 +327,7 @@ size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx);
|
||||
ZSTD_c_jobSize=401, </b>/* Size of a compression job. This value is enforced only when nbWorkers >= 1.<b>
|
||||
* Each compression job is completed in parallel, so this value can indirectly impact the nb of active threads.
|
||||
* 0 means default, which is dynamically determined based on compression parameters.
|
||||
* Job size must be a minimum of overlap size, or 1 MB, whichever is largest.
|
||||
* Job size must be a minimum of overlap size, or ZSTDMT_JOBSIZE_MIN (= 512 KB), whichever is largest.
|
||||
* The minimum size is automatically and transparently enforced. */
|
||||
ZSTD_c_overlapLog=402, </b>/* Control the overlap size, as a fraction of window size.<b>
|
||||
* The overlap size is an amount of data reloaded from previous job at the beginning of a new job.
|
||||
@@ -357,6 +357,8 @@ size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx);
|
||||
* ZSTD_c_stableOutBuffer
|
||||
* ZSTD_c_blockDelimiters
|
||||
* ZSTD_c_validateSequences
|
||||
* ZSTD_c_splitBlocks
|
||||
* ZSTD_c_useRowMatchFinder
|
||||
* Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them.
|
||||
* note : never ever use experimentalParam? names directly;
|
||||
* also, the enums values themselves are unstable and can still change.
|
||||
@@ -372,7 +374,10 @@ size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx);
|
||||
ZSTD_c_experimentalParam9=1006,
|
||||
ZSTD_c_experimentalParam10=1007,
|
||||
ZSTD_c_experimentalParam11=1008,
|
||||
ZSTD_c_experimentalParam12=1009
|
||||
ZSTD_c_experimentalParam12=1009,
|
||||
ZSTD_c_experimentalParam13=1010,
|
||||
ZSTD_c_experimentalParam14=1011,
|
||||
ZSTD_c_experimentalParam15=1012
|
||||
} ZSTD_cParameter;
|
||||
</b></pre><BR>
|
||||
<pre><b>typedef struct {
|
||||
@@ -456,7 +461,7 @@ size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx);
|
||||
|
||||
</p></pre><BR>
|
||||
|
||||
<a name="Chapter6"></a><h2>Advanced decompression API</h2><pre></pre>
|
||||
<a name="Chapter6"></a><h2>Advanced decompression API (Requires v1.4.0+)</h2><pre></pre>
|
||||
|
||||
<pre><b>typedef enum {
|
||||
|
||||
@@ -587,7 +592,7 @@ size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx);
|
||||
<pre><b>typedef ZSTD_CCtx ZSTD_CStream; </b>/**< CCtx and CStream are now effectively same object (>= v1.3.0) */<b>
|
||||
</b></pre><BR>
|
||||
<h3>ZSTD_CStream management functions</h3><pre></pre><b><pre>ZSTD_CStream* ZSTD_createCStream(void);
|
||||
size_t ZSTD_freeCStream(ZSTD_CStream* zcs);
|
||||
size_t ZSTD_freeCStream(ZSTD_CStream* zcs); </b>/* accept NULL pointer */<b>
|
||||
</pre></b><BR>
|
||||
<h3>Streaming compression functions</h3><pre></pre><b><pre>typedef enum {
|
||||
ZSTD_e_continue=0, </b>/* collect more data, encoder decides when to output compressed result, for optimal compression ratio */<b>
|
||||
@@ -681,7 +686,7 @@ size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output);
|
||||
<pre><b>typedef ZSTD_DCtx ZSTD_DStream; </b>/**< DCtx and DStream are now effectively same object (>= v1.3.0) */<b>
|
||||
</b></pre><BR>
|
||||
<h3>ZSTD_DStream management functions</h3><pre></pre><b><pre>ZSTD_DStream* ZSTD_createDStream(void);
|
||||
size_t ZSTD_freeDStream(ZSTD_DStream* zds);
|
||||
size_t ZSTD_freeDStream(ZSTD_DStream* zds); </b>/* accept NULL pointer */<b>
|
||||
</pre></b><BR>
|
||||
<h3>Streaming decompression functions</h3><pre></pre><b><pre></pre></b><BR>
|
||||
<pre><b>size_t ZSTD_DStreamInSize(void); </b>/*!< recommended size for input buffer */<b>
|
||||
@@ -697,7 +702,7 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds);
|
||||
int compressionLevel);
|
||||
</b><p> Compression at an explicit compression level using a Dictionary.
|
||||
A dictionary can be any arbitrary data segment (also called a prefix),
|
||||
or a buffer with specified information (see dictBuilder/zdict.h).
|
||||
or a buffer with specified information (see zdict.h).
|
||||
Note : This function loads the dictionary, resulting in significant startup delay.
|
||||
It's intended for a dictionary used only once.
|
||||
Note 2 : When `dict == NULL || dictSize < 8` no dictionary is used.
|
||||
@@ -732,7 +737,8 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds);
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>size_t ZSTD_freeCDict(ZSTD_CDict* CDict);
|
||||
</b><p> Function frees memory allocated by ZSTD_createCDict().
|
||||
</b><p> Function frees memory allocated by ZSTD_createCDict().
|
||||
If a NULL pointer is passed, no operation is performed.
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>size_t ZSTD_compress_usingCDict(ZSTD_CCtx* cctx,
|
||||
@@ -751,7 +757,8 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds);
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>size_t ZSTD_freeDDict(ZSTD_DDict* ddict);
|
||||
</b><p> Function frees memory allocated with ZSTD_createDDict()
|
||||
</b><p> Function frees memory allocated with ZSTD_createDDict()
|
||||
If a NULL pointer is passed, no operation is performed.
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>size_t ZSTD_decompress_usingDDict(ZSTD_DCtx* dctx,
|
||||
@@ -770,6 +777,12 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds);
|
||||
It can still be loaded, but as a content-only dictionary.
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>unsigned ZSTD_getDictID_fromCDict(const ZSTD_CDict* cdict);
|
||||
</b><p> Provides the dictID of the dictionary loaded into `cdict`.
|
||||
If @return == 0, the dictionary is not conformant to Zstandard specification, or empty.
|
||||
Non-conformant dictionaries can still be loaded, but as content-only dictionaries.
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>unsigned ZSTD_getDictID_fromDDict(const ZSTD_DDict* ddict);
|
||||
</b><p> Provides the dictID of the dictionary loaded into `ddict`.
|
||||
If @return == 0, the dictionary is not conformant to Zstandard specification, or empty.
|
||||
@@ -788,7 +801,7 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds);
|
||||
When identifying the exact failure cause, it's possible to use ZSTD_getFrameHeader(), which will provide a more precise error code.
|
||||
</p></pre><BR>
|
||||
|
||||
<a name="Chapter13"></a><h2>Advanced dictionary and prefix API</h2><pre>
|
||||
<a name="Chapter13"></a><h2>Advanced dictionary and prefix API (Requires v1.4.0+)</h2><pre>
|
||||
This API allows dictionaries to be used with ZSTD_compress2(),
|
||||
ZSTD_compressStream2(), and ZSTD_decompress(). Dictionaries are sticky, and
|
||||
only reset with the context is reset with ZSTD_reset_parameters or
|
||||
@@ -1058,6 +1071,12 @@ size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict);
|
||||
ZSTD_lcm_uncompressed = 2 </b>/**< Always emit uncompressed literals. */<b>
|
||||
} ZSTD_literalCompressionMode_e;
|
||||
</b></pre><BR>
|
||||
<pre><b>typedef enum {
|
||||
ZSTD_urm_auto = 0, </b>/* Automatically determine whether or not we use row matchfinder */<b>
|
||||
ZSTD_urm_disableRowMatchFinder = 1, </b>/* Never use row matchfinder */<b>
|
||||
ZSTD_urm_enableRowMatchFinder = 2 </b>/* Always use row matchfinder when applicable */<b>
|
||||
} ZSTD_useRowMatchFinderMode_e;
|
||||
</b></pre><BR>
|
||||
<a name="Chapter15"></a><h2>Frame size functions</h2><pre></pre>
|
||||
|
||||
<pre><b>unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize);
|
||||
@@ -1294,12 +1313,6 @@ ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL }; </b>/**< this con
|
||||
note: equivalent to ZSTD_createCDict_advanced(), with dictLoadMethod==ZSTD_dlm_byRef
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>unsigned ZSTD_getDictID_fromCDict(const ZSTD_CDict* cdict);
|
||||
</b><p> Provides the dictID of the dictionary loaded into `cdict`.
|
||||
If @return == 0, the dictionary is not conformant to Zstandard specification, or empty.
|
||||
Non-conformant dictionaries can still be loaded, but as content-only dictionaries.
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
|
||||
</b><p> @return ZSTD_compressionParameters structure for a selected compression level and estimated srcSize.
|
||||
`estimatedSrcSize` value is optional, select 0 if not known
|
||||
@@ -1323,24 +1336,26 @@ ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL }; </b>/**< this con
|
||||
This function never fails (wide contract)
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>size_t ZSTD_compress_advanced(ZSTD_CCtx* cctx,
|
||||
<pre><b>ZSTD_DEPRECATED("use ZSTD_compress2")
|
||||
size_t ZSTD_compress_advanced(ZSTD_CCtx* cctx,
|
||||
void* dst, size_t dstCapacity,
|
||||
const void* src, size_t srcSize,
|
||||
const void* dict,size_t dictSize,
|
||||
ZSTD_parameters params);
|
||||
</b><p> Note : this function is now DEPRECATED.
|
||||
It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_setParameter() and other parameter setters.
|
||||
This prototype will be marked as deprecated and generate compilation warning on reaching v1.5.x
|
||||
This prototype will generate compilation warnings.
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx,
|
||||
<pre><b>ZSTD_DEPRECATED("use ZSTD_compress2 with ZSTD_CCtx_loadDictionary")
|
||||
size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx,
|
||||
void* dst, size_t dstCapacity,
|
||||
const void* src, size_t srcSize,
|
||||
const ZSTD_CDict* cdict,
|
||||
ZSTD_frameParameters fParams);
|
||||
</b><p> Note : this function is now REDUNDANT.
|
||||
</b><p> Note : this function is now DEPRECATED.
|
||||
It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_loadDictionary() and other parameter setters.
|
||||
This prototype will be marked as deprecated and generate compilation warning in some future version
|
||||
This prototype will generate compilation warnings.
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>size_t ZSTD_CCtx_loadDictionary_byReference(ZSTD_CCtx* cctx, const void* dict, size_t dictSize);
|
||||
@@ -1367,7 +1382,7 @@ ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL }; </b>/**< this con
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>ZSTD_CCtx_params* ZSTD_createCCtxParams(void);
|
||||
size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);
|
||||
size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params); </b>/* accept NULL pointer */<b>
|
||||
</b><p> Quick howto :
|
||||
- ZSTD_createCCtxParams() : Create a ZSTD_CCtx_params structure
|
||||
- ZSTD_CCtxParams_setParameter() : Push parameters one by one into
|
||||
@@ -1379,7 +1394,7 @@ size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);
|
||||
These parameters will be applied to
|
||||
all subsequent frames.
|
||||
- ZSTD_compressStream2() : Do compression using the CCtx.
|
||||
- ZSTD_freeCCtxParams() : Free the memory.
|
||||
- ZSTD_freeCCtxParams() : Free the memory, accept NULL pointer.
|
||||
|
||||
This can be used with ZSTD_estimateCCtxSize_advanced_usingCCtxParams()
|
||||
for static allocation of CCtx for single-threaded compression.
|
||||
@@ -1493,8 +1508,10 @@ size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);
|
||||
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format);
|
||||
</b><p> Instruct the decoder context about what kind of data to decode next.
|
||||
<pre><b>ZSTD_DEPRECATED("use ZSTD_DCtx_setParameter() instead")
|
||||
size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format);
|
||||
</b><p> This function is REDUNDANT. Prefer ZSTD_DCtx_setParameter().
|
||||
Instruct the decoder context about what kind of data to decode next.
|
||||
This instruction is mandatory to decode data without a fully-formed header,
|
||||
such ZSTD_f_zstd1_magicless for example.
|
||||
@return : 0, or an error code (which can be tested using ZSTD_isError()).
|
||||
@@ -1517,11 +1534,11 @@ size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);
|
||||
<BR></pre>
|
||||
|
||||
<h3>Advanced Streaming compression functions</h3><pre></pre><b><pre></pre></b><BR>
|
||||
<pre><b>size_t
|
||||
ZSTD_initCStream_srcSize(ZSTD_CStream* zcs,
|
||||
<pre><b>ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")
|
||||
size_t ZSTD_initCStream_srcSize(ZSTD_CStream* zcs,
|
||||
int compressionLevel,
|
||||
unsigned long long pledgedSrcSize);
|
||||
</b><p> This function is deprecated, and equivalent to:
|
||||
</b><p> This function is DEPRECATED, and equivalent to:
|
||||
ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
|
||||
ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any)
|
||||
ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);
|
||||
@@ -1530,15 +1547,15 @@ ZSTD_initCStream_srcSize(ZSTD_CStream* zcs,
|
||||
pledgedSrcSize must be correct. If it is not known at init time, use
|
||||
ZSTD_CONTENTSIZE_UNKNOWN. Note that, for compatibility with older programs,
|
||||
"0" also disables frame content size field. It may be enabled in the future.
|
||||
Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x
|
||||
This prototype will generate compilation warnings.
|
||||
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>size_t
|
||||
ZSTD_initCStream_usingDict(ZSTD_CStream* zcs,
|
||||
<pre><b>ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")
|
||||
size_t ZSTD_initCStream_usingDict(ZSTD_CStream* zcs,
|
||||
const void* dict, size_t dictSize,
|
||||
int compressionLevel);
|
||||
</b><p> This function is deprecated, and is equivalent to:
|
||||
</b><p> This function is DEPRECATED, and is equivalent to:
|
||||
ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
|
||||
ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel);
|
||||
ZSTD_CCtx_loadDictionary(zcs, dict, dictSize);
|
||||
@@ -1547,16 +1564,16 @@ ZSTD_initCStream_usingDict(ZSTD_CStream* zcs,
|
||||
dict == NULL or dictSize < 8, in which case no dict is used.
|
||||
Note: dict is loaded with ZSTD_dct_auto (treated as a full zstd dictionary if
|
||||
it begins with ZSTD_MAGIC_DICTIONARY, else as raw content) and ZSTD_dlm_byCopy.
|
||||
Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x
|
||||
This prototype will generate compilation warnings.
|
||||
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>size_t
|
||||
ZSTD_initCStream_advanced(ZSTD_CStream* zcs,
|
||||
<pre><b>ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")
|
||||
size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs,
|
||||
const void* dict, size_t dictSize,
|
||||
ZSTD_parameters params,
|
||||
unsigned long long pledgedSrcSize);
|
||||
</b><p> This function is deprecated, and is approximately equivalent to:
|
||||
</b><p> This function is DEPRECATED, and is approximately equivalent to:
|
||||
ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
|
||||
// Pseudocode: Set each zstd parameter and leave the rest as-is.
|
||||
for ((param, value) : params) {
|
||||
@@ -1568,22 +1585,23 @@ ZSTD_initCStream_advanced(ZSTD_CStream* zcs,
|
||||
dict is loaded with ZSTD_dct_auto and ZSTD_dlm_byCopy.
|
||||
pledgedSrcSize must be correct.
|
||||
If srcSize is not known at init time, use value ZSTD_CONTENTSIZE_UNKNOWN.
|
||||
Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x
|
||||
This prototype will generate compilation warnings.
|
||||
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict);
|
||||
</b><p> This function is deprecated, and equivalent to:
|
||||
<pre><b>ZSTD_DEPRECATED("use ZSTD_CCtx_reset and ZSTD_CCtx_refCDict, see zstd.h for detailed instructions")
|
||||
size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict);
|
||||
</b><p> This function is DEPRECATED, and equivalent to:
|
||||
ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
|
||||
ZSTD_CCtx_refCDict(zcs, cdict);
|
||||
|
||||
|
||||
note : cdict will just be referenced, and must outlive compression session
|
||||
Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x
|
||||
This prototype will generate compilation warnings.
|
||||
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>size_t
|
||||
ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs,
|
||||
<pre><b>ZSTD_DEPRECATED("use ZSTD_CCtx_reset and ZSTD_CCtx_refCDict, see zstd.h for detailed instructions")
|
||||
size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs,
|
||||
const ZSTD_CDict* cdict,
|
||||
ZSTD_frameParameters fParams,
|
||||
unsigned long long pledgedSrcSize);
|
||||
@@ -1599,14 +1617,18 @@ ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs,
|
||||
same as ZSTD_initCStream_usingCDict(), with control over frame parameters.
|
||||
pledgedSrcSize must be correct. If srcSize is not known at init time, use
|
||||
value ZSTD_CONTENTSIZE_UNKNOWN.
|
||||
Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x
|
||||
This prototype will generate compilation warnings.
|
||||
|
||||
</p></pre><BR>
|
||||
|
||||
<pre><b>size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize);
|
||||
</b><p> This function is deprecated, and is equivalent to:
|
||||
<pre><b>ZSTD_DEPRECATED("use ZSTD_CCtx_reset, see zstd.h for detailed instructions")
|
||||
size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize);
|
||||
</b><p> This function is DEPRECATED, and is equivalent to:
|
||||
ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only);
|
||||
ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize);
|
||||
Note: ZSTD_resetCStream() interprets pledgedSrcSize == 0 as ZSTD_CONTENTSIZE_UNKNOWN, but
|
||||
ZSTD_CCtx_setPledgedSrcSize() does not do the same, so ZSTD_CONTENTSIZE_UNKNOWN must be
|
||||
explicitly specified.
|
||||
|
||||
start a new frame, using same parameters from previous frame.
|
||||
This is typically useful to skip dictionary loading stage, since it will re-use it in-place.
|
||||
@@ -1616,7 +1638,7 @@ ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs,
|
||||
For the time being, pledgedSrcSize==0 is interpreted as "srcSize unknown" for compatibility with older programs,
|
||||
but it will change to mean "empty" in future version, so use macro ZSTD_CONTENTSIZE_UNKNOWN instead.
|
||||
@return : 0, or an error code (which can be tested using ZSTD_isError())
|
||||
Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x
|
||||
This prototype will generate compilation warnings.
|
||||
|
||||
</p></pre><BR>
|
||||
|
||||
@@ -1687,8 +1709,7 @@ ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs,
|
||||
ZSTD_CCtx object can be re-used multiple times within successive compression operations.
|
||||
|
||||
Start by initializing a context.
|
||||
Use ZSTD_compressBegin(), or ZSTD_compressBegin_usingDict() for dictionary compression,
|
||||
or ZSTD_compressBegin_advanced(), for finer parameter control.
|
||||
Use ZSTD_compressBegin(), or ZSTD_compressBegin_usingDict() for dictionary compression.
|
||||
It's also possible to duplicate a reference context which has already been initialized, using ZSTD_copyCCtx()
|
||||
|
||||
Then, consume your input using ZSTD_compressContinue().
|
||||
@@ -1712,11 +1733,11 @@ ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs,
|
||||
|
||||
<h3>Buffer-less streaming compression functions</h3><pre></pre><b><pre>size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, int compressionLevel);
|
||||
size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel);
|
||||
size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_parameters params, unsigned long long pledgedSrcSize); </b>/**< pledgedSrcSize : If srcSize is not known at init time, use ZSTD_CONTENTSIZE_UNKNOWN */<b>
|
||||
size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict); </b>/**< note: fails if cdict==NULL */<b>
|
||||
size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx* const cctx, const ZSTD_CDict* const cdict, ZSTD_frameParameters const fParams, unsigned long long const pledgedSrcSize); </b>/* compression parameters are already set within cdict. pledgedSrcSize must be correct. If srcSize is not known, use macro ZSTD_CONTENTSIZE_UNKNOWN */<b>
|
||||
size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned long long pledgedSrcSize); </b>/**< note: if pledgedSrcSize is not known, use ZSTD_CONTENTSIZE_UNKNOWN */<b>
|
||||
</pre></b><BR>
|
||||
<pre><b>size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_parameters params, unsigned long long pledgedSrcSize); </b>/**< pledgedSrcSize : If srcSize is not known at init time, use ZSTD_CONTENTSIZE_UNKNOWN */<b>
|
||||
</b></pre><BR>
|
||||
<a name="Chapter22"></a><h2>Buffer-less streaming decompression (synchronous mode)</h2><pre>
|
||||
A ZSTD_DCtx object is required to track streaming operations.
|
||||
Use ZSTD_createDCtx() / ZSTD_freeDCtx() to manage it.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# ################################################################
|
||||
# Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
# Copyright (c) Yann Collet, Facebook, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021 Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Martin Liska, SUSE, Facebook, Inc.
|
||||
* Copyright (c) Martin Liska, SUSE, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -65,9 +65,7 @@ cxx_library(
|
||||
name='zdict',
|
||||
header_namespace='',
|
||||
visibility=['PUBLIC'],
|
||||
exported_headers=subdir_glob([
|
||||
('dictBuilder', 'zdict.h'),
|
||||
]),
|
||||
exported_headers=['zdict.h'],
|
||||
headers=subdir_glob([
|
||||
('dictBuilder', 'divsufsort.h'),
|
||||
('dictBuilder', 'cover.h'),
|
||||
@@ -131,10 +129,10 @@ cxx_library(
|
||||
name='errors',
|
||||
header_namespace='',
|
||||
visibility=['PUBLIC'],
|
||||
exported_headers=subdir_glob([
|
||||
('common', 'error_private.h'),
|
||||
('common', 'zstd_errors.h'),
|
||||
]),
|
||||
exported_headers=[
|
||||
'zstd_errors.h',
|
||||
'common/error_private.h',
|
||||
]
|
||||
srcs=['common/error_private.c'],
|
||||
)
|
||||
|
||||
|
||||
+42
-13
@@ -1,5 +1,5 @@
|
||||
# ################################################################
|
||||
# Copyright (c) 2015-2021, Yann Collet, Facebook, Inc.
|
||||
# Copyright (c) Yann Collet, Facebook, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under both the BSD-style license (found in the
|
||||
@@ -8,6 +8,9 @@
|
||||
# You may select, at your option, one of the above-listed licenses.
|
||||
# ################################################################
|
||||
|
||||
# Note: by default, the static library is built single-threaded and dynamic library is built
|
||||
# multi-threaded. It is possible to force multi or single threaded builds by appending
|
||||
# -mt or -nomt to the build target (like lib-mt for multi-threaded, lib-nomt for single-threaded).
|
||||
.PHONY: default
|
||||
default: lib-release
|
||||
|
||||
@@ -68,6 +71,10 @@ DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
||||
CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
|
||||
FLAGS = $(CPPFLAGS) $(CFLAGS)
|
||||
|
||||
CPPFLAGS_DYNLIB = -DZSTD_MULTITHREAD # dynamic library build defaults to multi-threaded
|
||||
LDFLAGS_DYNLIB = -pthread
|
||||
CPPFLAGS_STATLIB = # static library build defaults to single-threaded
|
||||
|
||||
HAVE_COLORNEVER = $(shell echo a | grep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
|
||||
GREP_OPTIONS ?=
|
||||
ifeq ($HAVE_COLORNEVER, 1)
|
||||
@@ -91,7 +98,7 @@ endif
|
||||
ZSTD_LIB_COMPRESSION ?= 1
|
||||
ZSTD_LIB_DECOMPRESSION ?= 1
|
||||
ZSTD_LIB_DICTBUILDER ?= 1
|
||||
ZSTD_LIB_DEPRECATED ?= 1
|
||||
ZSTD_LIB_DEPRECATED ?= 0
|
||||
|
||||
# Legacy support
|
||||
ZSTD_LEGACY_SUPPORT ?= 5
|
||||
@@ -176,7 +183,9 @@ UNAME := $(shell uname)
|
||||
|
||||
ifndef BUILD_DIR
|
||||
ifeq ($(UNAME), Darwin)
|
||||
HASH ?= md5
|
||||
ifeq ($(shell md5 < /dev/null > /dev/null; echo $$?), 0)
|
||||
HASH ?= md5
|
||||
endif
|
||||
else ifeq ($(UNAME), FreeBSD)
|
||||
HASH ?= gmd5sum
|
||||
else ifeq ($(UNAME), NetBSD)
|
||||
@@ -222,6 +231,7 @@ all: lib
|
||||
|
||||
|
||||
.PHONY: libzstd.a # must be run every time
|
||||
libzstd.a: CPPFLAGS += $(CPPFLAGS_STATLIB)
|
||||
|
||||
ifndef BUILD_DIR
|
||||
# determine BUILD_DIR from compilation flags
|
||||
@@ -238,7 +248,10 @@ ZSTD_STATLIB_OBJ := $(addprefix $(ZSTD_STATLIB_DIR)/,$(ZSTD_LOCAL_OBJ))
|
||||
$(ZSTD_STATLIB): ARFLAGS = rcs
|
||||
$(ZSTD_STATLIB): | $(ZSTD_STATLIB_DIR)
|
||||
$(ZSTD_STATLIB): $(ZSTD_STATLIB_OBJ)
|
||||
@echo compiling static library
|
||||
# Check for multithread flag at target execution time
|
||||
$(if $(filter -DZSTD_MULTITHREAD,$(CPPFLAGS)),\
|
||||
@echo compiling multi-threaded static library $(LIBVER),\
|
||||
@echo compiling single-threaded static library $(LIBVER))
|
||||
$(AR) $(ARFLAGS) $@ $^
|
||||
|
||||
libzstd.a: $(ZSTD_STATLIB)
|
||||
@@ -257,8 +270,9 @@ else # not Windows
|
||||
|
||||
LIBZSTD = libzstd.$(SHARED_EXT_VER)
|
||||
.PHONY: $(LIBZSTD) # must be run every time
|
||||
$(LIBZSTD): CFLAGS += -fPIC -fvisibility=hidden
|
||||
$(LIBZSTD): LDFLAGS += -shared
|
||||
$(LIBZSTD): CPPFLAGS += $(CPPFLAGS_DYNLIB)
|
||||
$(LIBZSTD): CFLAGS += -fPIC -fvisibility=hidden
|
||||
$(LIBZSTD): LDFLAGS += -shared $(LDFLAGS_DYNLIB)
|
||||
|
||||
ifndef BUILD_DIR
|
||||
# determine BUILD_DIR from compilation flags
|
||||
@@ -275,7 +289,10 @@ ZSTD_DYNLIB_OBJ := $(addprefix $(ZSTD_DYNLIB_DIR)/,$(ZSTD_LOCAL_OBJ))
|
||||
|
||||
$(ZSTD_DYNLIB): | $(ZSTD_DYNLIB_DIR)
|
||||
$(ZSTD_DYNLIB): $(ZSTD_DYNLIB_OBJ)
|
||||
@echo compiling dynamic library $(LIBVER)
|
||||
# Check for multithread flag at target execution time
|
||||
$(if $(filter -DZSTD_MULTITHREAD,$(CPPFLAGS)),\
|
||||
@echo compiling multi-threaded dynamic library $(LIBVER),\
|
||||
@echo compiling single-threaded dynamic library $(LIBVER))
|
||||
$(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@
|
||||
@echo creating versioned links
|
||||
ln -sf $@ libzstd.$(SHARED_EXT_MAJOR)
|
||||
@@ -297,10 +314,17 @@ lib : libzstd.a libzstd
|
||||
# note : do not define lib-mt or lib-release as .PHONY
|
||||
# make does not consider implicit pattern rule for .PHONY target
|
||||
|
||||
%-mt : CPPFLAGS += -DZSTD_MULTITHREAD
|
||||
%-mt : LDFLAGS += -pthread
|
||||
%-mt : CPPFLAGS_DYNLIB := -DZSTD_MULTITHREAD
|
||||
%-mt : CPPFLAGS_STATLIB := -DZSTD_MULTITHREAD
|
||||
%-mt : LDFLAGS_DYNLIB := -pthread
|
||||
%-mt : %
|
||||
@echo multi-threading build completed
|
||||
@echo multi-threaded build completed
|
||||
|
||||
%-nomt : CPPFLAGS_DYNLIB :=
|
||||
%-nomt : LDFLAGS_DYNLIB :=
|
||||
%-nomt : CPPFLAGS_STATLIB :=
|
||||
%-nomt : %
|
||||
@echo single-threaded build completed
|
||||
|
||||
%-release : DEBUGFLAGS :=
|
||||
%-release : %
|
||||
@@ -332,7 +356,8 @@ include $(wildcard $(DEPFILES))
|
||||
# Special case : building library in single-thread mode _and_ without zstdmt_compress.c
|
||||
ZSTDMT_FILES = compress/zstdmt_compress.c
|
||||
ZSTD_NOMT_FILES = $(filter-out $(ZSTDMT_FILES),$(ZSTD_FILES))
|
||||
libzstd-nomt: LDFLAGS += -shared -fPIC -fvisibility=hidden
|
||||
libzstd-nomt: CFLAGS += -fPIC -fvisibility=hidden
|
||||
libzstd-nomt: LDFLAGS += -shared
|
||||
libzstd-nomt: $(ZSTD_NOMT_FILES)
|
||||
@echo compiling single-thread dynamic library $(LIBVER)
|
||||
@echo files : $(ZSTD_NOMT_FILES)
|
||||
@@ -411,10 +436,12 @@ libzstd.pc: libzstd.pc.in
|
||||
install: install-pc install-static install-shared install-includes
|
||||
@echo zstd static and shared library installed
|
||||
|
||||
.PHONY: install-pc
|
||||
install-pc: libzstd.pc
|
||||
[ -e $(DESTDIR)$(PKGCONFIGDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(PKGCONFIGDIR)/
|
||||
$(INSTALL_DATA) libzstd.pc $(DESTDIR)$(PKGCONFIGDIR)/
|
||||
|
||||
.PHONY: install-static
|
||||
install-static:
|
||||
# only generate libzstd.a if it's not already present
|
||||
[ -e libzstd.a ] || $(MAKE) libzstd.a-release
|
||||
@@ -422,6 +449,7 @@ install-static:
|
||||
@echo Installing static library
|
||||
$(INSTALL_DATA) libzstd.a $(DESTDIR)$(LIBDIR)
|
||||
|
||||
.PHONY: install-shared
|
||||
install-shared:
|
||||
# only generate libzstd.so if it's not already present
|
||||
[ -e $(LIBZSTD) ] || $(MAKE) libzstd-release
|
||||
@@ -431,12 +459,13 @@ install-shared:
|
||||
ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR)
|
||||
ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT)
|
||||
|
||||
.PHONY: install-includes
|
||||
install-includes:
|
||||
[ -e $(DESTDIR)$(INCLUDEDIR) ] || $(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR)/
|
||||
@echo Installing includes
|
||||
$(INSTALL_DATA) zstd.h $(DESTDIR)$(INCLUDEDIR)
|
||||
$(INSTALL_DATA) common/zstd_errors.h $(DESTDIR)$(INCLUDEDIR)
|
||||
$(INSTALL_DATA) dictBuilder/zdict.h $(DESTDIR)$(INCLUDEDIR)
|
||||
$(INSTALL_DATA) zstd_errors.h $(DESTDIR)$(INCLUDEDIR)
|
||||
$(INSTALL_DATA) zdict.h $(DESTDIR)$(INCLUDEDIR)
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
|
||||
+8
-4
@@ -19,12 +19,16 @@ The scope can be reduced on demand (see paragraph _modular build_).
|
||||
|
||||
#### Multithreading support
|
||||
|
||||
Multithreading is disabled by default when building with `make`.
|
||||
When building with `make`, by default the dynamic library is multithreaded and static library is single-threaded (for compatibility reasons).
|
||||
|
||||
Enabling multithreading requires 2 conditions :
|
||||
- set build macro `ZSTD_MULTITHREAD` (`-DZSTD_MULTITHREAD` for `gcc`)
|
||||
- for POSIX systems : compile with pthread (`-pthread` compilation flag for `gcc`)
|
||||
|
||||
Both conditions are automatically applied when invoking `make lib-mt` target.
|
||||
For convenience, we provide a build target to generate multi and single threaded libraries:
|
||||
- Force enable multithreading on both dynamic and static libraries by appending `-mt` to the target, e.g. `make lib-mt`.
|
||||
- Force disable multithreading on both dynamic and static libraries by appending `-nomt` to the target, e.g. `make lib-nomt`.
|
||||
- By default, as mentioned before, dynamic library is multithreaded, and static library is single-threaded, e.g. `make lib`.
|
||||
|
||||
When linking a POSIX program with a multithreaded version of `libzstd`,
|
||||
note that it's necessary to invoke the `-pthread` flag during link stage.
|
||||
@@ -42,8 +46,8 @@ Zstandard's stable API is exposed within [lib/zstd.h](zstd.h).
|
||||
|
||||
Optional advanced features are exposed via :
|
||||
|
||||
- `lib/common/zstd_errors.h` : translates `size_t` function results
|
||||
into a `ZSTD_ErrorCode`, for accurate error handling.
|
||||
- `lib/zstd_errors.h` : translates `size_t` function results
|
||||
into a `ZSTD_ErrorCode`, for accurate error handling.
|
||||
|
||||
- `ZSTD_STATIC_LINKING_ONLY` : if this macro is defined _before_ including `zstd.h`,
|
||||
it unlocks access to the experimental API,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* ******************************************************************
|
||||
* bitstream
|
||||
* Part of FSE library
|
||||
* Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
*
|
||||
* You can contact the author at :
|
||||
* - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2021, Facebook, Inc.
|
||||
* Copyright (c) Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/* ******************************************************************
|
||||
* debug
|
||||
* Part of FSE library
|
||||
* Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
*
|
||||
* You can contact the author at :
|
||||
* - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/* ******************************************************************
|
||||
* debug
|
||||
* Part of FSE library
|
||||
* Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
*
|
||||
* You can contact the author at :
|
||||
* - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* ******************************************************************
|
||||
* Common functions of New Generation Entropy library
|
||||
* Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
*
|
||||
* You can contact the author at :
|
||||
* - FSE+HUF source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
@@ -21,8 +21,8 @@ extern "C" {
|
||||
/* ****************************************
|
||||
* Dependencies
|
||||
******************************************/
|
||||
#include "zstd_deps.h" /* size_t */
|
||||
#include "zstd_errors.h" /* enum list */
|
||||
#include "../zstd_errors.h" /* enum list */
|
||||
#include "zstd_deps.h" /* size_t */
|
||||
|
||||
|
||||
/* ****************************************
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/* ******************************************************************
|
||||
* FSE : Finite State Entropy codec
|
||||
* Public Prototypes declaration
|
||||
* Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
*
|
||||
* You can contact the author at :
|
||||
* - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* ******************************************************************
|
||||
* FSE : Finite State Entropy decoder
|
||||
* Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
*
|
||||
* You can contact the author at :
|
||||
* - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/* ******************************************************************
|
||||
* huff0 huffman codec,
|
||||
* part of Finite State Entropy library
|
||||
* Copyright (c) 2013-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
*
|
||||
* You can contact the author at :
|
||||
* - Source repository : https://github.com/Cyan4973/FiniteStateEntropy
|
||||
|
||||
+2
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
|
||||
* Copyright (c) Yann Collet, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under both the BSD-style license (found in the
|
||||
@@ -143,9 +143,7 @@ MEM_STATIC size_t MEM_swapST(size_t in);
|
||||
* Prefer these methods in priority order (0 > 1 > 2)
|
||||
*/
|
||||
#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */
|
||||
# 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__) )
|
||||
# define MEM_FORCE_MEMORY_ACCESS 2
|
||||
# elif defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__)
|
||||
# if defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__)
|
||||
# define MEM_FORCE_MEMORY_ACCESS 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user