zstd/lib
Yann Collet 14312d833e zstdmt : fix : loading prefix from previous segments
There used to be a (very small) chance that
loading prefix from previous segment
would be confused with a real zstd dictionary.
For that to happen, the prefix needs to start
with the same value as dictionary magic.
That's 1 chance in 4 billions if all values have equal probability.
But in fact, since some values are more common (0x00000000 for example)
others are less common, and dictionary magic was selected to be one of them,
so probabilities are likely even lower.

Anyway, this risk is no down to zero
by adding a new CCtx parameter : ZSTD_p_forceRawDict

Current parameter policy : the parameter "stick" to its CCtx,
so any dictionary loading after ZSTD_p_forceRawDict is set
will be loaded in "raw" ("content only") mode,
even if CCtx is re-used multiple times with multiple different dictionary.
It's up to the user to reset this value differently if it needs so.
2017-02-23 23:42:12 -08:00
..
common spelling fixes in comments 2017-02-20 12:08:59 -08:00
compress zstdmt : fix : loading prefix from previous segments 2017-02-23 23:42:12 -08:00
decompress Update comment 2017-02-22 12:28:21 -08:00
deprecated Fix deprecation warnings for clang with C++14 2017-02-08 17:38:17 -08:00
dictBuilder Fix deprecation warnings for clang with C++14 2017-02-08 17:38:17 -08:00
dll Merge branch 'dev' into multiframe 2017-02-10 10:08:55 -08:00
legacy Change name to to findFrameCompressedSize and add skippable support 2017-02-22 12:12:34 -08:00
.gitignore Added "dictionary decompression" example 2016-07-07 14:08:00 +02:00
BUCK Add BUCK files for Nuclide support 2017-01-27 10:43:12 -08:00
Makefile fixed Mac OS-X specific directory in $(RM) list 2017-02-05 10:22:58 -08:00
README.md moved zbuff source files into lib/deprecated 2016-12-05 19:28:19 -08:00
libzstd.pc.in updated pkg config file 2016-11-30 11:06:58 -08:00
zstd.h zstdmt : fix : loading prefix from previous segments 2017-02-23 23:42:12 -08:00

README.md

Zstandard library files

The lib directory contains several directories. Depending on target use case, it's enough to include only files from relevant directories.

API

Zstandard's stable API is exposed within zstd.h, at the root of lib directory.

Advanced API

Some additional API may be useful if you're looking into advanced features :

  • common/error_public.h : transforms size_t function results into an enum, for precise error handling.
  • ZSTD_STATIC_LINKING_ONLY : if you define this macro before including zstd.h, it will give access to advanced and experimental API. These APIs shall never be used with dynamic library ! They are not "stable", their definition may change in the future. Only static linking is allowed.

Modular build

Directory common/ is required in all circumstances. You can select to support compression only, by just adding files from the compress/ directory, In a similar way, you can build a decompressor-only library with the decompress/ directory.

Other optional functionalities provided are :

  • dictBuilder/ : source files to create dictionaries. The API can be consulted in dictBuilder/zdict.h. This module also depends on common/ and compress/ .

  • legacy/ : source code to decompress previous versions of zstd, starting from v0.1. This module also depends on common/ and decompress/ . Library compilation must include directive ZSTD_LEGACY_SUPPORT = 1 . The main API can be consulted in legacy/zstd_legacy.h. Advanced API from each version can be found in their relevant header file. For example, advanced API for version v0.4 is in legacy/zstd_v04.h .

Using MinGW+MSYS to create DLL

DLL can be created using MinGW+MSYS with the make libzstd command. This command creates dll\libzstd.dll and the import library dll\libzstd.lib. The import library is only required with Visual C++. The header file zstd.h and the dynamic library dll\libzstd.dll are required to compile a project using gcc/MinGW. The dynamic library has to be added to linking options. It means that if a project that uses ZSTD consists of a single test-dll.c file it should be linked with dll\libzstd.dll. For example:

    gcc $(CFLAGS) -Iinclude/ test-dll.c -o test-dll dll\libzstd.dll

The compiled executable will require ZSTD DLL which is available at dll\libzstd.dll.

Obsolete streaming API

Streaming is now provided within zstd.h. Older streaming API is still available within deprecated/zbuff.h. It will be removed in a future version. Consider migrating code towards newer streaming API in zstd.h.

Miscellaneous

The other files are not source code. There are :

  • LICENSE : contains the BSD license text
  • Makefile : script to compile or install zstd library (static and dynamic)
  • libzstd.pc.in : for pkg-config (make install)
  • README.md : this file