2016-08-30 10:04:33 -07:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2016-present, Przemyslaw Skibinski, 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 this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
2016-05-12 08:15:41 -07:00
|
|
|
|
|
|
|
#ifndef ZSTD_ZLIBWRAPPER_H
|
|
|
|
#define ZSTD_ZLIBWRAPPER_H
|
|
|
|
|
|
|
|
#if defined (__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define Z_PREFIX
|
|
|
|
#include <zlib.h>
|
|
|
|
|
2016-05-27 03:33:19 -07:00
|
|
|
#if !defined(z_const)
|
2016-06-02 01:19:35 -07:00
|
|
|
#if ZLIB_VERNUM >= 0x1260
|
2016-08-30 10:04:33 -07:00
|
|
|
#define z_const const
|
2016-06-02 01:19:35 -07:00
|
|
|
#else
|
|
|
|
#define z_const
|
|
|
|
#endif
|
2016-05-27 03:33:19 -07:00
|
|
|
#endif
|
2016-05-12 08:15:41 -07:00
|
|
|
|
2016-09-22 02:52:00 -07:00
|
|
|
/* returns a string with version of zstd library */
|
|
|
|
const char * zstdVersion(void);
|
|
|
|
|
|
|
|
|
|
|
|
/* COMPRESSION */
|
2016-09-21 07:46:35 -07:00
|
|
|
/* enables/disables zstd compression during runtime */
|
2016-09-23 00:08:40 -07:00
|
|
|
void ZWRAP_useZSTDcompression(int turn_on);
|
2016-09-21 07:46:35 -07:00
|
|
|
|
|
|
|
/* check if zstd compression is turned on */
|
2016-09-23 00:08:40 -07:00
|
|
|
int ZWRAP_isUsingZSTDcompression(void);
|
2016-05-12 08:15:41 -07:00
|
|
|
|
2016-09-21 08:17:29 -07:00
|
|
|
/* Changes a pledged source size for a given compression stream.
|
2016-09-22 01:23:26 -07:00
|
|
|
It will change ZSTD compression parameters what may improve compression speed and/or ratio.
|
2016-09-26 11:49:18 -07:00
|
|
|
The function should be called just after deflateInit(). It's only helpful when data is compressed in blocks.
|
|
|
|
There will be no change in case of deflateInit() immediately followed by deflate(strm, Z_FINISH)
|
|
|
|
as this case is automatically detected. */
|
2016-09-23 00:08:40 -07:00
|
|
|
int ZWRAP_setPledgedSrcSize(z_streamp strm, unsigned long long pledgedSrcSize);
|
2016-09-21 07:46:35 -07:00
|
|
|
|
2016-05-12 08:15:41 -07:00
|
|
|
|
2016-09-22 02:52:00 -07:00
|
|
|
/* DECOMPRESSION */
|
2016-09-23 00:08:40 -07:00
|
|
|
typedef enum { ZWRAP_FORCE_ZLIB, ZWRAP_AUTO } ZWRAP_decompress_type;
|
2016-09-22 02:52:00 -07:00
|
|
|
|
|
|
|
/* enables/disables automatic recognition of zstd/zlib compressed data during runtime */
|
2016-09-23 00:08:40 -07:00
|
|
|
void ZWRAP_setDecompressionType(ZWRAP_decompress_type type);
|
2016-09-22 02:52:00 -07:00
|
|
|
|
|
|
|
/* check zstd decompression type */
|
2016-09-23 00:08:40 -07:00
|
|
|
ZWRAP_decompress_type ZWRAP_getDecompressionType(void);
|
2016-09-22 02:52:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-12 08:15:41 -07:00
|
|
|
#if defined (__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* ZSTD_ZLIBWRAPPER_H */
|