lz4hc.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. /*
  2. LZ4 HC - High Compression Mode of LZ4
  3. Header File
  4. Copyright (C) 2011-2017, Yann Collet.
  5. BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
  6. Redistribution and use in source and binary forms, with or without
  7. modification, are permitted provided that the following conditions are
  8. met:
  9. * Redistributions of source code must retain the above copyright
  10. notice, this list of conditions and the following disclaimer.
  11. * Redistributions in binary form must reproduce the above
  12. copyright notice, this list of conditions and the following disclaimer
  13. in the documentation and/or other materials provided with the
  14. distribution.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  16. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  17. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  18. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  19. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  20. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  21. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  25. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. You can contact the author at :
  27. - LZ4 source repository : https://github.com/lz4/lz4
  28. - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
  29. */
  30. #ifndef LZ4_HC_H_19834876238432
  31. #define LZ4_HC_H_19834876238432
  32. #if defined (__cplusplus)
  33. extern "C" {
  34. #endif
  35. /* --- Dependency --- */
  36. /* note : lz4hc requires lz4.h/lz4.c for compilation */
  37. #include "lz4.h" /* stddef, LZ4LIB_API, LZ4_DEPRECATED */
  38. /* --- Useful constants --- */
  39. #define LZ4HC_CLEVEL_MIN 3
  40. #define LZ4HC_CLEVEL_DEFAULT 9
  41. #define LZ4HC_CLEVEL_OPT_MIN 10
  42. #define LZ4HC_CLEVEL_MAX 12
  43. /*-************************************
  44. * Block Compression
  45. **************************************/
  46. /*! LZ4_compress_HC() :
  47. * Compress data from `src` into `dst`, using the powerful but slower "HC" algorithm.
  48. * `dst` must be already allocated.
  49. * Compression is guaranteed to succeed if `dstCapacity >= LZ4_compressBound(srcSize)` (see "lz4.h")
  50. * Max supported `srcSize` value is LZ4_MAX_INPUT_SIZE (see "lz4.h")
  51. * `compressionLevel` : any value between 1 and LZ4HC_CLEVEL_MAX will work.
  52. * Values > LZ4HC_CLEVEL_MAX behave the same as LZ4HC_CLEVEL_MAX.
  53. * @return : the number of bytes written into 'dst'
  54. * or 0 if compression fails.
  55. */
  56. LZ4LIB_API int LZ4_compress_HC (const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel);
  57. /* Note :
  58. * Decompression functions are provided within "lz4.h" (BSD license)
  59. */
  60. /*! LZ4_compress_HC_extStateHC() :
  61. * Same as LZ4_compress_HC(), but using an externally allocated memory segment for `state`.
  62. * `state` size is provided by LZ4_sizeofStateHC().
  63. * Memory segment must be aligned on 8-bytes boundaries (which a normal malloc() should do properly).
  64. */
  65. LZ4LIB_API int LZ4_sizeofStateHC(void);
  66. LZ4LIB_API int LZ4_compress_HC_extStateHC(void* stateHC, const char* src, char* dst, int srcSize, int maxDstSize, int compressionLevel);
  67. /*! LZ4_compress_HC_destSize() : v1.9.0+
  68. * Will compress as much data as possible from `src`
  69. * to fit into `targetDstSize` budget.
  70. * Result is provided in 2 parts :
  71. * @return : the number of bytes written into 'dst' (necessarily <= targetDstSize)
  72. * or 0 if compression fails.
  73. * `srcSizePtr` : on success, *srcSizePtr is updated to indicate how much bytes were read from `src`
  74. */
  75. LZ4LIB_API int LZ4_compress_HC_destSize(void* stateHC,
  76. const char* src, char* dst,
  77. int* srcSizePtr, int targetDstSize,
  78. int compressionLevel);
  79. /*-************************************
  80. * Streaming Compression
  81. * Bufferless synchronous API
  82. **************************************/
  83. typedef union LZ4_streamHC_u LZ4_streamHC_t; /* incomplete type (defined later) */
  84. /*! LZ4_createStreamHC() and LZ4_freeStreamHC() :
  85. * These functions create and release memory for LZ4 HC streaming state.
  86. * Newly created states are automatically initialized.
  87. * A same state can be used multiple times consecutively,
  88. * starting with LZ4_resetStreamHC_fast() to start a new stream of blocks.
  89. */
  90. LZ4LIB_API LZ4_streamHC_t* LZ4_createStreamHC(void);
  91. LZ4LIB_API int LZ4_freeStreamHC (LZ4_streamHC_t* streamHCPtr);
  92. /*
  93. These functions compress data in successive blocks of any size,
  94. using previous blocks as dictionary, to improve compression ratio.
  95. One key assumption is that previous blocks (up to 64 KB) remain read-accessible while compressing next blocks.
  96. There is an exception for ring buffers, which can be smaller than 64 KB.
  97. Ring-buffer scenario is automatically detected and handled within LZ4_compress_HC_continue().
  98. Before starting compression, state must be allocated and properly initialized.
  99. LZ4_createStreamHC() does both, though compression level is set to LZ4HC_CLEVEL_DEFAULT.
  100. Selecting the compression level can be done with LZ4_resetStreamHC_fast() (starts a new stream)
  101. or LZ4_setCompressionLevel() (anytime, between blocks in the same stream) (experimental).
  102. LZ4_resetStreamHC_fast() only works on states which have been properly initialized at least once,
  103. which is automatically the case when state is created using LZ4_createStreamHC().
  104. After reset, a first "fictional block" can be designated as initial dictionary,
  105. using LZ4_loadDictHC() (Optional).
  106. Invoke LZ4_compress_HC_continue() to compress each successive block.
  107. The number of blocks is unlimited.
  108. Previous input blocks, including initial dictionary when present,
  109. must remain accessible and unmodified during compression.
  110. It's allowed to update compression level anytime between blocks,
  111. using LZ4_setCompressionLevel() (experimental).
  112. 'dst' buffer should be sized to handle worst case scenarios
  113. (see LZ4_compressBound(), it ensures compression success).
  114. In case of failure, the API does not guarantee recovery,
  115. so the state _must_ be reset.
  116. To ensure compression success
  117. whenever `dst` buffer size cannot be made >= LZ4_compressBound(),
  118. consider using LZ4_compress_HC_continue_destSize().
  119. Whenever previous input blocks can't be preserved unmodified in-place during compression of next blocks,
  120. it's possible to copy the last blocks into a more stable memory space, using LZ4_saveDictHC().
  121. Return value of LZ4_saveDictHC() is the size of dictionary effectively saved into 'safeBuffer' (<= 64 KB)
  122. After completing a streaming compression,
  123. it's possible to start a new stream of blocks, using the same LZ4_streamHC_t state,
  124. just by resetting it, using LZ4_resetStreamHC_fast().
  125. */
  126. LZ4LIB_API void LZ4_resetStreamHC_fast(LZ4_streamHC_t* streamHCPtr, int compressionLevel); /* v1.9.0+ */
  127. LZ4LIB_API int LZ4_loadDictHC (LZ4_streamHC_t* streamHCPtr, const char* dictionary, int dictSize);
  128. LZ4LIB_API int LZ4_compress_HC_continue (LZ4_streamHC_t* streamHCPtr,
  129. const char* src, char* dst,
  130. int srcSize, int maxDstSize);
  131. /*! LZ4_compress_HC_continue_destSize() : v1.9.0+
  132. * Similar to LZ4_compress_HC_continue(),
  133. * but will read as much data as possible from `src`
  134. * to fit into `targetDstSize` budget.
  135. * Result is provided into 2 parts :
  136. * @return : the number of bytes written into 'dst' (necessarily <= targetDstSize)
  137. * or 0 if compression fails.
  138. * `srcSizePtr` : on success, *srcSizePtr will be updated to indicate how much bytes were read from `src`.
  139. * Note that this function may not consume the entire input.
  140. */
  141. LZ4LIB_API int LZ4_compress_HC_continue_destSize(LZ4_streamHC_t* LZ4_streamHCPtr,
  142. const char* src, char* dst,
  143. int* srcSizePtr, int targetDstSize);
  144. LZ4LIB_API int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, int maxDictSize);
  145. /*^**********************************************
  146. * !!!!!! STATIC LINKING ONLY !!!!!!
  147. ***********************************************/
  148. /*-******************************************************************
  149. * PRIVATE DEFINITIONS :
  150. * Do not use these definitions directly.
  151. * They are merely exposed to allow static allocation of `LZ4_streamHC_t`.
  152. * Declare an `LZ4_streamHC_t` directly, rather than any type below.
  153. * Even then, only do so in the context of static linking, as definitions may change between versions.
  154. ********************************************************************/
  155. #define LZ4HC_DICTIONARY_LOGSIZE 16
  156. #define LZ4HC_MAXD (1<<LZ4HC_DICTIONARY_LOGSIZE)
  157. #define LZ4HC_MAXD_MASK (LZ4HC_MAXD - 1)
  158. #define LZ4HC_HASH_LOG 15
  159. #define LZ4HC_HASHTABLESIZE (1 << LZ4HC_HASH_LOG)
  160. #define LZ4HC_HASH_MASK (LZ4HC_HASHTABLESIZE - 1)
  161. #if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
  162. #include <stdint.h>
  163. typedef struct LZ4HC_CCtx_internal LZ4HC_CCtx_internal;
  164. struct LZ4HC_CCtx_internal
  165. {
  166. uint32_t hashTable[LZ4HC_HASHTABLESIZE];
  167. uint16_t chainTable[LZ4HC_MAXD];
  168. const uint8_t* end; /* next block here to continue on current prefix */
  169. const uint8_t* base; /* All index relative to this position */
  170. const uint8_t* dictBase; /* alternate base for extDict */
  171. uint32_t dictLimit; /* below that point, need extDict */
  172. uint32_t lowLimit; /* below that point, no more dict */
  173. uint32_t nextToUpdate; /* index from which to continue dictionary update */
  174. short compressionLevel;
  175. int8_t favorDecSpeed; /* favor decompression speed if this flag set,
  176. otherwise, favor compression ratio */
  177. int8_t dirty; /* stream has to be fully reset if this flag is set */
  178. const LZ4HC_CCtx_internal* dictCtx;
  179. };
  180. #else
  181. typedef struct LZ4HC_CCtx_internal LZ4HC_CCtx_internal;
  182. struct LZ4HC_CCtx_internal
  183. {
  184. unsigned int hashTable[LZ4HC_HASHTABLESIZE];
  185. unsigned short chainTable[LZ4HC_MAXD];
  186. const unsigned char* end; /* next block here to continue on current prefix */
  187. const unsigned char* base; /* All index relative to this position */
  188. const unsigned char* dictBase; /* alternate base for extDict */
  189. unsigned int dictLimit; /* below that point, need extDict */
  190. unsigned int lowLimit; /* below that point, no more dict */
  191. unsigned int nextToUpdate; /* index from which to continue dictionary update */
  192. short compressionLevel;
  193. char favorDecSpeed; /* favor decompression speed if this flag set,
  194. otherwise, favor compression ratio */
  195. char dirty; /* stream has to be fully reset if this flag is set */
  196. const LZ4HC_CCtx_internal* dictCtx;
  197. };
  198. #endif
  199. /* Do not use these definitions directly !
  200. * Declare or allocate an LZ4_streamHC_t instead.
  201. */
  202. #define LZ4_STREAMHCSIZE (4*LZ4HC_HASHTABLESIZE + 2*LZ4HC_MAXD + 56 + ((sizeof(void*)==16) ? 56 : 0) /* AS400*/ ) /* 262200 or 262256*/
  203. #define LZ4_STREAMHCSIZE_SIZET (LZ4_STREAMHCSIZE / sizeof(size_t))
  204. union LZ4_streamHC_u {
  205. size_t table[LZ4_STREAMHCSIZE_SIZET];
  206. LZ4HC_CCtx_internal internal_donotuse;
  207. }; /* previously typedef'd to LZ4_streamHC_t */
  208. /* LZ4_streamHC_t :
  209. * This structure allows static allocation of LZ4 HC streaming state.
  210. * This can be used to allocate statically, on state, or as part of a larger structure.
  211. *
  212. * Such state **must** be initialized using LZ4_initStreamHC() before first use.
  213. *
  214. * Note that invoking LZ4_initStreamHC() is not required when
  215. * the state was created using LZ4_createStreamHC() (which is recommended).
  216. * Using the normal builder, a newly created state is automatically initialized.
  217. *
  218. * Static allocation shall only be used in combination with static linking.
  219. */
  220. /* LZ4_initStreamHC() : v1.9.0+
  221. * Required before first use of a statically allocated LZ4_streamHC_t.
  222. * Before v1.9.0 : use LZ4_resetStreamHC() instead
  223. */
  224. LZ4LIB_API LZ4_streamHC_t* LZ4_initStreamHC (void* buffer, size_t size);
  225. /*-************************************
  226. * Deprecated Functions
  227. **************************************/
  228. /* see lz4.h LZ4_DISABLE_DEPRECATE_WARNINGS to turn off deprecation warnings */
  229. /* deprecated compression functions */
  230. LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC (const char* source, char* dest, int inputSize);
  231. LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize);
  232. LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC2 (const char* source, char* dest, int inputSize, int compressionLevel);
  233. LZ4_DEPRECATED("use LZ4_compress_HC() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
  234. LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC_withStateHC (void* state, const char* source, char* dest, int inputSize);
  235. LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput_withStateHC (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
  236. LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC2_withStateHC (void* state, const char* source, char* dest, int inputSize, int compressionLevel);
  237. LZ4_DEPRECATED("use LZ4_compress_HC_extStateHC() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput_withStateHC(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
  238. LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize);
  239. LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC_limitedOutput_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* source, char* dest, int inputSize, int maxOutputSize);
  240. /* Obsolete streaming functions; degraded functionality; do not use!
  241. *
  242. * In order to perform streaming compression, these functions depended on data
  243. * that is no longer tracked in the state. They have been preserved as well as
  244. * possible: using them will still produce a correct output. However, use of
  245. * LZ4_slideInputBufferHC() will truncate the history of the stream, rather
  246. * than preserve a window-sized chunk of history.
  247. */
  248. LZ4_DEPRECATED("use LZ4_createStreamHC() instead") LZ4LIB_API void* LZ4_createHC (const char* inputBuffer);
  249. LZ4_DEPRECATED("use LZ4_saveDictHC() instead") LZ4LIB_API char* LZ4_slideInputBufferHC (void* LZ4HC_Data);
  250. LZ4_DEPRECATED("use LZ4_freeStreamHC() instead") LZ4LIB_API int LZ4_freeHC (void* LZ4HC_Data);
  251. LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC2_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int compressionLevel);
  252. LZ4_DEPRECATED("use LZ4_compress_HC_continue() instead") LZ4LIB_API int LZ4_compressHC2_limitedOutput_continue (void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel);
  253. LZ4_DEPRECATED("use LZ4_createStreamHC() instead") LZ4LIB_API int LZ4_sizeofStreamStateHC(void);
  254. LZ4_DEPRECATED("use LZ4_initStreamHC() instead") LZ4LIB_API int LZ4_resetStreamStateHC(void* state, char* inputBuffer);
  255. /* LZ4_resetStreamHC() is now replaced by LZ4_initStreamHC().
  256. * The intention is to emphasize the difference with LZ4_resetStreamHC_fast(),
  257. * which is now the recommended function to start a new stream of blocks,
  258. * but cannot be used to initialize a memory segment containing arbitrary garbage data.
  259. *
  260. * It is recommended to switch to LZ4_initStreamHC().
  261. * LZ4_resetStreamHC() will generate deprecation warnings in a future version.
  262. */
  263. LZ4LIB_API void LZ4_resetStreamHC (LZ4_streamHC_t* streamHCPtr, int compressionLevel);
  264. #if defined (__cplusplus)
  265. }
  266. #endif
  267. #endif /* LZ4_HC_H_19834876238432 */
  268. /*-**************************************************
  269. * !!!!! STATIC LINKING ONLY !!!!!
  270. * Following definitions are considered experimental.
  271. * They should not be linked from DLL,
  272. * as there is no guarantee of API stability yet.
  273. * Prototypes will be promoted to "stable" status
  274. * after successfull usage in real-life scenarios.
  275. ***************************************************/
  276. #ifdef LZ4_HC_STATIC_LINKING_ONLY /* protection macro */
  277. #ifndef LZ4_HC_SLO_098092834
  278. #define LZ4_HC_SLO_098092834
  279. #define LZ4_STATIC_LINKING_ONLY /* LZ4LIB_STATIC_API */
  280. #include "lz4.h"
  281. #if defined (__cplusplus)
  282. extern "C" {
  283. #endif
  284. /*! LZ4_setCompressionLevel() : v1.8.0+ (experimental)
  285. * It's possible to change compression level
  286. * between successive invocations of LZ4_compress_HC_continue*()
  287. * for dynamic adaptation.
  288. */
  289. LZ4LIB_STATIC_API void LZ4_setCompressionLevel(
  290. LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel);
  291. /*! LZ4_favorDecompressionSpeed() : v1.8.2+ (experimental)
  292. * Opt. Parser will favor decompression speed over compression ratio.
  293. * Only applicable to levels >= LZ4HC_CLEVEL_OPT_MIN.
  294. */
  295. LZ4LIB_STATIC_API void LZ4_favorDecompressionSpeed(
  296. LZ4_streamHC_t* LZ4_streamHCPtr, int favor);
  297. /*! LZ4_resetStreamHC_fast() : v1.9.0+
  298. * When an LZ4_streamHC_t is known to be in a internally coherent state,
  299. * it can often be prepared for a new compression with almost no work, only
  300. * sometimes falling back to the full, expensive reset that is always required
  301. * when the stream is in an indeterminate state (i.e., the reset performed by
  302. * LZ4_resetStreamHC()).
  303. *
  304. * LZ4_streamHCs are guaranteed to be in a valid state when:
  305. * - returned from LZ4_createStreamHC()
  306. * - reset by LZ4_resetStreamHC()
  307. * - memset(stream, 0, sizeof(LZ4_streamHC_t))
  308. * - the stream was in a valid state and was reset by LZ4_resetStreamHC_fast()
  309. * - the stream was in a valid state and was then used in any compression call
  310. * that returned success
  311. * - the stream was in an indeterminate state and was used in a compression
  312. * call that fully reset the state (LZ4_compress_HC_extStateHC()) and that
  313. * returned success
  314. *
  315. * Note:
  316. * A stream that was last used in a compression call that returned an error
  317. * may be passed to this function. However, it will be fully reset, which will
  318. * clear any existing history and settings from the context.
  319. */
  320. LZ4LIB_STATIC_API void LZ4_resetStreamHC_fast(
  321. LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel);
  322. /*! LZ4_compress_HC_extStateHC_fastReset() :
  323. * A variant of LZ4_compress_HC_extStateHC().
  324. *
  325. * Using this variant avoids an expensive initialization step. It is only safe
  326. * to call if the state buffer is known to be correctly initialized already
  327. * (see above comment on LZ4_resetStreamHC_fast() for a definition of
  328. * "correctly initialized"). From a high level, the difference is that this
  329. * function initializes the provided state with a call to
  330. * LZ4_resetStreamHC_fast() while LZ4_compress_HC_extStateHC() starts with a
  331. * call to LZ4_resetStreamHC().
  332. */
  333. LZ4LIB_STATIC_API int LZ4_compress_HC_extStateHC_fastReset (
  334. void* state,
  335. const char* src, char* dst,
  336. int srcSize, int dstCapacity,
  337. int compressionLevel);
  338. /*! LZ4_attach_HC_dictionary() :
  339. * This is an experimental API that allows for the efficient use of a
  340. * static dictionary many times.
  341. *
  342. * Rather than re-loading the dictionary buffer into a working context before
  343. * each compression, or copying a pre-loaded dictionary's LZ4_streamHC_t into a
  344. * working LZ4_streamHC_t, this function introduces a no-copy setup mechanism,
  345. * in which the working stream references the dictionary stream in-place.
  346. *
  347. * Several assumptions are made about the state of the dictionary stream.
  348. * Currently, only streams which have been prepared by LZ4_loadDictHC() should
  349. * be expected to work.
  350. *
  351. * Alternatively, the provided dictionary stream pointer may be NULL, in which
  352. * case any existing dictionary stream is unset.
  353. *
  354. * A dictionary should only be attached to a stream without any history (i.e.,
  355. * a stream that has just been reset).
  356. *
  357. * The dictionary will remain attached to the working stream only for the
  358. * current stream session. Calls to LZ4_resetStreamHC(_fast) will remove the
  359. * dictionary context association from the working stream. The dictionary
  360. * stream (and source buffer) must remain in-place / accessible / unchanged
  361. * through the lifetime of the stream session.
  362. */
  363. LZ4LIB_STATIC_API void LZ4_attach_HC_dictionary(
  364. LZ4_streamHC_t *working_stream,
  365. const LZ4_streamHC_t *dictionary_stream);
  366. #if defined (__cplusplus)
  367. }
  368. #endif
  369. #endif /* LZ4_HC_SLO_098092834 */
  370. #endif /* LZ4_HC_STATIC_LINKING_ONLY */