Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
zstd_zlibwrapper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016-2021, Przemyslaw Skibinski, Yann Collet, Facebook, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under both the BSD-style license (found in the
6 * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7 * in the COPYING file in the root directory of this source tree).
8 * You may select, at your option, one of the above-listed licenses.
9 */
10
11#ifndef ZSTD_ZLIBWRAPPER_H
12#define ZSTD_ZLIBWRAPPER_H
13
14#if defined (__cplusplus)
15extern "C" {
16#endif
17
18
19#define ZLIB_CONST
20#define Z_PREFIX
21#define ZLIB_INTERNAL /* disables gz*64 functions but fixes zlib 1.2.4 with Z_PREFIX */
22#include <zlib.h>
23
24#if !defined(z_const)
25 #define z_const
26#endif
27
28
29/* returns a string with version of zstd library */
30const char * zstdVersion(void);
31
32
33/*** COMPRESSION ***/
34/* ZWRAP_useZSTDcompression() enables/disables zstd compression during runtime.
35 By default zstd compression is disabled. To enable zstd compression please use one of the methods:
36 - compilation with the additional option -DZWRAP_USE_ZSTD=1
37 - using '#define ZWRAP_USE_ZSTD 1' in source code before '#include "zstd_zlibwrapper.h"'
38 - calling ZWRAP_useZSTDcompression(1)
39 All above-mentioned methods will enable zstd compression for all threads.
40 Be aware that ZWRAP_useZSTDcompression() is not thread-safe and may lead to a race condition. */
41void ZWRAP_useZSTDcompression(int turn_on);
42
43/* checks if zstd compression is turned on */
45
46/* Changes a pledged source size for a given compression stream.
47 It will change ZSTD compression parameters what may improve compression speed and/or ratio.
48 The function should be called just after deflateInit() or deflateReset() and before deflate() or deflateSetDictionary().
49 It's only helpful when data is compressed in blocks.
50 There will be no change in case of deflateInit() or deflateReset() immediately followed by deflate(strm, Z_FINISH)
51 as this case is automatically detected. */
52int ZWRAP_setPledgedSrcSize(z_streamp strm, unsigned long long pledgedSrcSize);
53
54/* Similar to deflateReset but preserves dictionary set using deflateSetDictionary.
55 It should improve compression speed because there will be less calls to deflateSetDictionary
56 When using zlib compression this method redirects to deflateReset. */
58
59
60
61/*** DECOMPRESSION ***/
63
64/* ZWRAP_setDecompressionType() enables/disables automatic recognition of zstd/zlib compressed data during runtime.
65 By default auto-detection of zstd and zlib streams in enabled (ZWRAP_AUTO).
66 Forcing zlib decompression with ZWRAP_setDecompressionType(ZWRAP_FORCE_ZLIB) slightly improves
67 decompression speed of zlib-encoded streams.
68 Be aware that ZWRAP_setDecompressionType() is not thread-safe and may lead to a race condition. */
70
71/* checks zstd decompression type */
73
74/* Checks if zstd decompression is used for a given stream.
75 If will return 1 only when inflate() was called and zstd header was detected. */
77
78/* Similar to inflateReset but preserves dictionary set using inflateSetDictionary.
79 inflate() will return Z_NEED_DICT only for the first time what will improve decompression speed.
80 For zlib streams this method redirects to inflateReset. */
82
83
84#if defined (__cplusplus)
85}
86#endif
87
88#endif /* ZSTD_ZLIBWRAPPER_H */
z_stream FAR * z_streamp
Definition zlib.h:108
int ZWRAP_deflateReset_keepDict(z_streamp strm)
Definition zstd_zlibwrapper.c:302
void ZWRAP_useZSTDcompression(int turn_on)
Definition zstd_zlibwrapper.c:88
int ZWRAP_isUsingZSTDcompression(void)
Definition zstd_zlibwrapper.c:90
ZWRAP_decompress_type
Definition zstd_zlibwrapper.h:62
@ ZWRAP_FORCE_ZLIB
Definition zstd_zlibwrapper.h:62
@ ZWRAP_AUTO
Definition zstd_zlibwrapper.h:62
ZWRAP_decompress_type ZWRAP_getDecompressionType(void)
Definition zstd_zlibwrapper.c:98
int ZWRAP_inflateReset_keepDict(z_streamp strm)
Definition zstd_zlibwrapper.c:644
int ZWRAP_isUsingZSTDdecompression(z_streamp strm)
Definition zstd_zlibwrapper.c:572
void ZWRAP_setDecompressionType(ZWRAP_decompress_type type)
Definition zstd_zlibwrapper.c:96
int ZWRAP_setPledgedSrcSize(z_streamp strm, unsigned long long pledgedSrcSize)
Definition zstd_zlibwrapper.c:248
const char * zstdVersion(void)
Definition zstd_zlibwrapper.c:102