mirror of
				https://github.com/facebook/zstd.git
				synced 2025-10-31 16:47:48 +02:00 
			
		
		
		
	Fix new typos found by codespell
This commit is contained in:
		| @@ -17,11 +17,11 @@ option(ZSTD_BUILD_DECOMPRESSION "BUILD DECOMPRESSION MODULE" ON) | ||||
| option(ZSTD_BUILD_DICTBUILDER "BUILD DICTBUILDER MODULE" ON) | ||||
| option(ZSTD_BUILD_DEPRECATED "BUILD DEPRECATED MODULE" OFF) | ||||
|  | ||||
| set(ZSTDLIB_VISIBLE "" CACHE STRING "Visiblity for ZSTDLIB API") | ||||
| set(ZSTDERRORLIB_VISIBLE "" CACHE STRING "Visiblity for ZSTDERRORLIB_VISIBLE API") | ||||
| set(ZDICTLIB_VISIBLE "" CACHE STRING "Visiblity for ZDICTLIB_VISIBLE API") | ||||
| set(ZSTDLIB_STATIC_API "" CACHE STRING "Visiblity for ZSTDLIB_STATIC_API API") | ||||
| set(ZDICTLIB_STATIC_API "" CACHE STRING "Visiblity for ZDICTLIB_STATIC_API API") | ||||
| set(ZSTDLIB_VISIBLE "" CACHE STRING "Visibility for ZSTDLIB API") | ||||
| set(ZSTDERRORLIB_VISIBLE "" CACHE STRING "Visibility for ZSTDERRORLIB_VISIBLE API") | ||||
| set(ZDICTLIB_VISIBLE "" CACHE STRING "Visibility for ZDICTLIB_VISIBLE API") | ||||
| set(ZSTDLIB_STATIC_API "" CACHE STRING "Visibility for ZSTDLIB_STATIC_API API") | ||||
| set(ZDICTLIB_STATIC_API "" CACHE STRING "Visibility for ZDICTLIB_STATIC_API API") | ||||
|  | ||||
| set_property(CACHE ZSTDLIB_VISIBLE PROPERTY STRINGS "" "hidden" "default" "protected" "internal") | ||||
| set_property(CACHE ZSTDERRORLIB_VISIBLE PROPERTY STRINGS "" "hidden" "default" "protected" "internal") | ||||
|   | ||||
| @@ -1213,7 +1213,7 @@ static void decode_seq_table(FSE_dtable *const table, istream_t *const in, | ||||
|         break; | ||||
|     } | ||||
|     case seq_repeat: | ||||
|         // "Repeat_Mode : re-use distribution table from previous compressed | ||||
|         // "Repeat_Mode : reuse distribution table from previous compressed | ||||
|         // block." | ||||
|         // Nothing to do here, table will be unchanged | ||||
|         if (!table->symbols) { | ||||
|   | ||||
| @@ -174,7 +174,7 @@ int         ZSTD_defaultCLevel(void);           </b>/*!< default compression lev | ||||
|  | ||||
| <h3>Compression context</h3><pre>  When compressing many times, | ||||
|   it is recommended to allocate a context just once, | ||||
|   and re-use it for each successive compression operation. | ||||
|   and reuse it for each successive compression operation. | ||||
|   This will make workload friendlier for system's memory. | ||||
|   Note : re-using context is just a speed / resource optimization. | ||||
|          It doesn't change the compression ratio, which remains identical. | ||||
| @@ -200,7 +200,7 @@ size_t     ZSTD_freeCCtx(ZSTD_CCtx* cctx);  </b>/* accept NULL pointer */<b> | ||||
|  | ||||
| <h3>Decompression context</h3><pre>  When decompressing many times, | ||||
|   it is recommended to allocate a context only once, | ||||
|   and re-use it for each successive compression operation. | ||||
|   and reuse it for each successive compression operation. | ||||
|   This will make workload friendlier for system's memory. | ||||
|   Use one context per thread for parallel execution.  | ||||
| </pre><b><pre>typedef struct ZSTD_DCtx_s ZSTD_DCtx; | ||||
| @@ -568,14 +568,14 @@ size_t     ZSTD_freeDCtx(ZSTD_DCtx* dctx);  </b>/* accept NULL pointer */<b> | ||||
|   A ZSTD_CStream object is required to track streaming operation. | ||||
|   Use ZSTD_createCStream() and ZSTD_freeCStream() to create/release resources. | ||||
|   ZSTD_CStream objects can be reused multiple times on consecutive compression operations. | ||||
|   It is recommended to re-use ZSTD_CStream since it will play nicer with system's memory, by re-using already allocated memory. | ||||
|   It is recommended to reuse ZSTD_CStream since it will play nicer with system's memory, by re-using already allocated memory. | ||||
|  | ||||
|   For parallel execution, use one separate ZSTD_CStream per thread. | ||||
|  | ||||
|   note : since v1.3.0, ZSTD_CStream and ZSTD_CCtx are the same thing. | ||||
|  | ||||
|   Parameters are sticky : when starting a new compression on the same context, | ||||
|   it will re-use the same sticky parameters as previous compression session. | ||||
|   it will reuse the same sticky parameters as previous compression session. | ||||
|   When in doubt, it's recommended to fully initialize the context before usage. | ||||
|   Use ZSTD_CCtx_reset() to reset the context and ZSTD_CCtx_setParameter(), | ||||
|   ZSTD_CCtx_setPledgedSrcSize(), or ZSTD_CCtx_loadDictionary() and friends to | ||||
| @@ -698,7 +698,7 @@ size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output); | ||||
| <a name="Chapter9"></a><h2>Streaming decompression - HowTo</h2><pre> | ||||
|   A ZSTD_DStream object is required to track streaming operations. | ||||
|   Use ZSTD_createDStream() and ZSTD_freeDStream() to create/release resources. | ||||
|   ZSTD_DStream objects can be re-used multiple times. | ||||
|   ZSTD_DStream objects can be reused multiple times. | ||||
|  | ||||
|   Use ZSTD_initDStream() to start a new decompression operation. | ||||
|  @return : recommended first input size | ||||
| @@ -869,7 +869,7 @@ size_t ZSTD_freeDStream(ZSTD_DStream* zds);  </b>/* accept NULL pointer */<b> | ||||
| <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_decompressDCtx(). | ||||
|  Dictionaries are sticky, they remain valid when same context is re-used, | ||||
|  Dictionaries are sticky, they remain valid when same context is reused, | ||||
|  they only reset when the context is reset | ||||
|  with ZSTD_reset_parameters or ZSTD_reset_session_and_parameters. | ||||
|  In contrast, Prefixes are single-use. | ||||
| @@ -1857,7 +1857,7 @@ size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize); | ||||
|        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. | ||||
|   This is typically useful to skip dictionary loading stage, since it will reuse it in-place. | ||||
|   Note that zcs must be init at least once before using ZSTD_resetCStream(). | ||||
|   If pledgedSrcSize is not known at reset time, use macro ZSTD_CONTENTSIZE_UNKNOWN. | ||||
|   If pledgedSrcSize > 0, its value must be correct, as it will be written in header, and controlled at the end. | ||||
| @@ -1918,7 +1918,7 @@ ZSTDLIB_STATIC_API size_t ZSTD_resetDStream(ZSTD_DStream* zds); | ||||
| </b><p> | ||||
|      ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); | ||||
|  | ||||
|  re-use decompression parameters from previous init; saves dictionary loading | ||||
|  reuse decompression parameters from previous init; saves dictionary loading | ||||
|   | ||||
| </p></pre><BR> | ||||
|  | ||||
| @@ -1964,7 +1964,7 @@ ZSTD_registerSequenceProducer( | ||||
| <a name="Chapter21"></a><h2>Buffer-less streaming compression (synchronous mode)</h2><pre> | ||||
|   A ZSTD_CCtx object is required to track streaming operations. | ||||
|   Use ZSTD_createCCtx() / ZSTD_freeCCtx() to manage resource. | ||||
|   ZSTD_CCtx object can be re-used multiple times within successive compression operations. | ||||
|   ZSTD_CCtx object can be reused multiple times within successive compression operations. | ||||
|  | ||||
|   Start by initializing a context. | ||||
|   Use ZSTD_compressBegin(), or ZSTD_compressBegin_usingDict() for dictionary compression. | ||||
| @@ -1985,7 +1985,7 @@ ZSTD_registerSequenceProducer( | ||||
|   It's possible to use srcSize==0, in which case, it will write a final empty block to end the frame. | ||||
|   Without last block mark, frames are considered unfinished (hence corrupted) by compliant decoders. | ||||
|  | ||||
|   `ZSTD_CCtx` object can be re-used (ZSTD_compressBegin()) to compress again. | ||||
|   `ZSTD_CCtx` object can be reused (ZSTD_compressBegin()) to compress again. | ||||
| <BR></pre> | ||||
|  | ||||
| <h3>Buffer-less streaming compression functions</h3><pre></pre><b><pre>ZSTD_DEPRECATED("The buffer-less API is deprecated in favor of the normal streaming API. See docs.") | ||||
| @@ -2002,7 +2002,7 @@ ZSTDLIB_STATIC_API size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx* cctx, const Z | ||||
| <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. | ||||
|   A ZSTD_DCtx object can be re-used multiple times. | ||||
|   A ZSTD_DCtx object can be reused multiple times. | ||||
|  | ||||
|   First typical operation is to retrieve frame parameters, using ZSTD_getFrameHeader(). | ||||
|   Frame header is extracted from the beginning of compressed frame, so providing only the frame's beginning is enough. | ||||
|   | ||||
| @@ -47,7 +47,7 @@ void POOL_joinJobs(POOL_ctx* ctx); | ||||
| /*! POOL_resize() : | ||||
|  *  Expands or shrinks pool's number of threads. | ||||
|  *  This is more efficient than releasing + creating a new context, | ||||
|  *  since it tries to preserve and re-use existing threads. | ||||
|  *  since it tries to preserve and reuse existing threads. | ||||
|  * `numThreads` must be at least 1. | ||||
|  * @return : 0 when resize was successful, | ||||
|  *           !0 (typically 1) if there is an error. | ||||
|   | ||||
| @@ -1447,7 +1447,7 @@ size_t HUF_compress1X_repeat (void* dst, size_t dstSize, | ||||
| /* HUF_compress4X_repeat(): | ||||
|  * compress input using 4 streams. | ||||
|  * consider skipping quickly | ||||
|  * re-use an existing huffman compression table */ | ||||
|  * reuse an existing huffman compression table */ | ||||
| size_t HUF_compress4X_repeat (void* dst, size_t dstSize, | ||||
|                       const void* src, size_t srcSize, | ||||
|                       unsigned maxSymbolValue, unsigned huffLog, | ||||
|   | ||||
| @@ -2606,7 +2606,7 @@ ZSTD_reduceTable_internal (U32* const table, U32 const size, U32 const reducerVa | ||||
|     assert(size < (1U<<31));   /* can be casted to int */ | ||||
|  | ||||
| #if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE) | ||||
|     /* To validate that the table re-use logic is sound, and that we don't | ||||
|     /* To validate that the table reuse logic is sound, and that we don't | ||||
|      * access table space that we haven't cleaned, we re-"poison" the table | ||||
|      * space every time we mark it dirty. | ||||
|      * | ||||
|   | ||||
| @@ -39,7 +39,7 @@ extern "C" { | ||||
|                                        It's not a big deal though : candidate will just be sorted again. | ||||
|                                        Additionally, candidate position 1 will be lost. | ||||
|                                        But candidate 1 cannot hide a large tree of candidates, so it's a minimal loss. | ||||
|                                        The benefit is that ZSTD_DUBT_UNSORTED_MARK cannot be mishandled after table re-use with a different strategy. | ||||
|                                        The benefit is that ZSTD_DUBT_UNSORTED_MARK cannot be mishandled after table reuse with a different strategy. | ||||
|                                        This constant is required by ZSTD_compressBlock_btlazy2() and ZSTD_reduceTable_internal() */ | ||||
|  | ||||
|  | ||||
| @@ -228,7 +228,7 @@ struct ZSTD_matchState_t { | ||||
|     U32 rowHashLog;                          /* For row-based matchfinder: Hashlog based on nb of rows in the hashTable.*/ | ||||
|     BYTE* tagTable;                          /* For row-based matchFinder: A row-based table containing the hashes and head index. */ | ||||
|     U32 hashCache[ZSTD_ROW_HASH_CACHE_SIZE]; /* For row-based matchFinder: a cache of hashes to improve speed */ | ||||
|     U64 hashSalt;                            /* For row-based matchFinder: salts the hash for re-use of tag table */ | ||||
|     U64 hashSalt;                            /* For row-based matchFinder: salts the hash for reuse of tag table */ | ||||
|     U32 hashSaltEntropy;                     /* For row-based matchFinder: collects entropy for salt generation */ | ||||
|  | ||||
|     U32* hashTable; | ||||
|   | ||||
| @@ -434,7 +434,7 @@ MEM_STATIC void* ZSTD_cwksp_reserve_aligned(ZSTD_cwksp* ws, size_t bytes) | ||||
|  | ||||
| /** | ||||
|  * Aligned on 64 bytes. These buffers have the special property that | ||||
|  * their values remain constrained, allowing us to re-use them without | ||||
|  * their values remain constrained, allowing us to reuse them without | ||||
|  * memset()-ing them. | ||||
|  */ | ||||
| MEM_STATIC void* ZSTD_cwksp_reserve_table(ZSTD_cwksp* ws, size_t bytes) | ||||
| @@ -526,7 +526,7 @@ MEM_STATIC void ZSTD_cwksp_mark_tables_dirty(ZSTD_cwksp* ws) | ||||
|     DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_dirty"); | ||||
|  | ||||
| #if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE) | ||||
|     /* To validate that the table re-use logic is sound, and that we don't | ||||
|     /* To validate that the table reuse logic is sound, and that we don't | ||||
|      * access table space that we haven't cleaned, we re-"poison" the table | ||||
|      * space every time we mark it dirty. | ||||
|      * Since tableValidEnd space and initOnce space may overlap we don't poison | ||||
| @@ -603,9 +603,9 @@ MEM_STATIC void ZSTD_cwksp_clear(ZSTD_cwksp* ws) { | ||||
|     DEBUGLOG(4, "cwksp: clearing!"); | ||||
|  | ||||
| #if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE) | ||||
|     /* To validate that the context re-use logic is sound, and that we don't | ||||
|     /* To validate that the context reuse logic is sound, and that we don't | ||||
|      * access stuff that this compression hasn't initialized, we re-"poison" | ||||
|      * the workspace except for the areas in which we expect memory re-use | ||||
|      * the workspace except for the areas in which we expect memory reuse | ||||
|      * without initialization (objects, valid tables area and init once | ||||
|      * memory). */ | ||||
|     { | ||||
|   | ||||
| @@ -1431,7 +1431,7 @@ ZSTD_decompressSequences_bodySplitLitBuffer( ZSTD_DCtx* dctx, | ||||
|                 BIT_DStream_completed < BIT_DStream_overflow); | ||||
|  | ||||
|         /* decompress without overrunning litPtr begins */ | ||||
|         {   seq_t sequence = {0,0,0};  /* some static analyzer believe that @sequence is not initialized (it necessarily is, since for(;;) loop as at least one interation) */ | ||||
|         {   seq_t sequence = {0,0,0};  /* some static analyzer believe that @sequence is not initialized (it necessarily is, since for(;;) loop as at least one iteration) */ | ||||
|             /* Align the decompression loop to 32 + 16 bytes. | ||||
|                 * | ||||
|                 * zstd compiled with gcc-9 on an Intel i9-9900k shows 10% decompression | ||||
| @@ -1591,7 +1591,7 @@ ZSTD_decompressSequences_bodySplitLitBuffer( ZSTD_DCtx* dctx, | ||||
|         litBufferEnd = dctx->litExtraBuffer + ZSTD_LITBUFFEREXTRASIZE; | ||||
|         dctx->litBufferLocation = ZSTD_not_in_dst; | ||||
|     } | ||||
|     /* copy last literals from interal buffer */ | ||||
|     /* copy last literals from internal buffer */ | ||||
|     {   size_t const lastLLSize = litBufferEnd - litPtr; | ||||
|         RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall, ""); | ||||
|         if (op != NULL) { | ||||
|   | ||||
							
								
								
									
										22
									
								
								lib/zstd.h
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								lib/zstd.h
									
									
									
									
									
								
							| @@ -249,7 +249,7 @@ ZSTDLIB_API int         ZSTD_defaultCLevel(void);           /*!< default compres | ||||
| /*= Compression context | ||||
|  *  When compressing many times, | ||||
|  *  it is recommended to allocate a context just once, | ||||
|  *  and re-use it for each successive compression operation. | ||||
|  *  and reuse it for each successive compression operation. | ||||
|  *  This will make workload friendlier for system's memory. | ||||
|  *  Note : re-using context is just a speed / resource optimization. | ||||
|  *         It doesn't change the compression ratio, which remains identical. | ||||
| @@ -276,7 +276,7 @@ ZSTDLIB_API size_t ZSTD_compressCCtx(ZSTD_CCtx* cctx, | ||||
| /*= Decompression context | ||||
|  *  When decompressing many times, | ||||
|  *  it is recommended to allocate a context only once, | ||||
|  *  and re-use it for each successive compression operation. | ||||
|  *  and reuse it for each successive compression operation. | ||||
|  *  This will make workload friendlier for system's memory. | ||||
|  *  Use one context per thread for parallel execution. */ | ||||
| typedef struct ZSTD_DCtx_s ZSTD_DCtx; | ||||
| @@ -682,14 +682,14 @@ typedef struct ZSTD_outBuffer_s { | ||||
| *  A ZSTD_CStream object is required to track streaming operation. | ||||
| *  Use ZSTD_createCStream() and ZSTD_freeCStream() to create/release resources. | ||||
| *  ZSTD_CStream objects can be reused multiple times on consecutive compression operations. | ||||
| *  It is recommended to re-use ZSTD_CStream since it will play nicer with system's memory, by re-using already allocated memory. | ||||
| *  It is recommended to reuse ZSTD_CStream since it will play nicer with system's memory, by re-using already allocated memory. | ||||
| * | ||||
| *  For parallel execution, use one separate ZSTD_CStream per thread. | ||||
| * | ||||
| *  note : since v1.3.0, ZSTD_CStream and ZSTD_CCtx are the same thing. | ||||
| * | ||||
| *  Parameters are sticky : when starting a new compression on the same context, | ||||
| *  it will re-use the same sticky parameters as previous compression session. | ||||
| *  it will reuse the same sticky parameters as previous compression session. | ||||
| *  When in doubt, it's recommended to fully initialize the context before usage. | ||||
| *  Use ZSTD_CCtx_reset() to reset the context and ZSTD_CCtx_setParameter(), | ||||
| *  ZSTD_CCtx_setPledgedSrcSize(), or ZSTD_CCtx_loadDictionary() and friends to | ||||
| @@ -837,7 +837,7 @@ ZSTDLIB_API size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output); | ||||
| * | ||||
| *  A ZSTD_DStream object is required to track streaming operations. | ||||
| *  Use ZSTD_createDStream() and ZSTD_freeDStream() to create/release resources. | ||||
| *  ZSTD_DStream objects can be re-used multiple times. | ||||
| *  ZSTD_DStream objects can be reused multiple times. | ||||
| * | ||||
| *  Use ZSTD_initDStream() to start a new decompression operation. | ||||
| * @return : recommended first input size | ||||
| @@ -1023,7 +1023,7 @@ ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize); | ||||
|  * | ||||
|  * This API allows dictionaries to be used with ZSTD_compress2(), | ||||
|  * ZSTD_compressStream2(), and ZSTD_decompressDCtx(). | ||||
|  * Dictionaries are sticky, they remain valid when same context is re-used, | ||||
|  * Dictionaries are sticky, they remain valid when same context is reused, | ||||
|  * they only reset when the context is reset | ||||
|  * with ZSTD_reset_parameters or ZSTD_reset_session_and_parameters. | ||||
|  * In contrast, Prefixes are single-use. | ||||
| @@ -2581,7 +2581,7 @@ size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs, | ||||
|  *       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. | ||||
|  *  This is typically useful to skip dictionary loading stage, since it will reuse it in-place. | ||||
|  *  Note that zcs must be init at least once before using ZSTD_resetCStream(). | ||||
|  *  If pledgedSrcSize is not known at reset time, use macro ZSTD_CONTENTSIZE_UNKNOWN. | ||||
|  *  If pledgedSrcSize > 0, its value must be correct, as it will be written in header, and controlled at the end. | ||||
| @@ -2657,7 +2657,7 @@ ZSTDLIB_STATIC_API size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const Z | ||||
|  * | ||||
|  *     ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); | ||||
|  * | ||||
|  * re-use decompression parameters from previous init; saves dictionary loading | ||||
|  * reuse decompression parameters from previous init; saves dictionary loading | ||||
|  */ | ||||
| ZSTD_DEPRECATED("use ZSTD_DCtx_reset, see zstd.h for detailed instructions") | ||||
| ZSTDLIB_STATIC_API size_t ZSTD_resetDStream(ZSTD_DStream* zds); | ||||
| @@ -2844,7 +2844,7 @@ ZSTD_registerSequenceProducer( | ||||
|  | ||||
|   A ZSTD_CCtx object is required to track streaming operations. | ||||
|   Use ZSTD_createCCtx() / ZSTD_freeCCtx() to manage resource. | ||||
|   ZSTD_CCtx object can be re-used multiple times within successive compression operations. | ||||
|   ZSTD_CCtx object can be reused multiple times within successive compression operations. | ||||
|  | ||||
|   Start by initializing a context. | ||||
|   Use ZSTD_compressBegin(), or ZSTD_compressBegin_usingDict() for dictionary compression. | ||||
| @@ -2865,7 +2865,7 @@ ZSTD_registerSequenceProducer( | ||||
|   It's possible to use srcSize==0, in which case, it will write a final empty block to end the frame. | ||||
|   Without last block mark, frames are considered unfinished (hence corrupted) by compliant decoders. | ||||
|  | ||||
|   `ZSTD_CCtx` object can be re-used (ZSTD_compressBegin()) to compress again. | ||||
|   `ZSTD_CCtx` object can be reused (ZSTD_compressBegin()) to compress again. | ||||
| */ | ||||
|  | ||||
| /*=====   Buffer-less streaming compression functions  =====*/ | ||||
| @@ -2897,7 +2897,7 @@ size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx* const cctx, const ZSTD_ | ||||
|  | ||||
|   A ZSTD_DCtx object is required to track streaming operations. | ||||
|   Use ZSTD_createDCtx() / ZSTD_freeDCtx() to manage it. | ||||
|   A ZSTD_DCtx object can be re-used multiple times. | ||||
|   A ZSTD_DCtx object can be reused multiple times. | ||||
|  | ||||
|   First typical operation is to retrieve frame parameters, using ZSTD_getFrameHeader(). | ||||
|   Frame header is extracted from the beginning of compressed frame, so providing only the frame's beginning is enough. | ||||
|   | ||||
| @@ -52,7 +52,7 @@ extern "C" { | ||||
| size_t FUZZ_seqProdSetup(void); | ||||
|  | ||||
| /* The fuzzer will call this function after each test-case. It should free | ||||
|  * resources aquired by FUZZ_seqProdSetup() to prevent leaks across test-cases. | ||||
|  * resources acquired by FUZZ_seqProdSetup() to prevent leaks across test-cases. | ||||
|  * | ||||
|  * The fuzzer will assert() that the return value is zero. To signal an error, | ||||
|  * please return a non-zero value. */ | ||||
| @@ -72,7 +72,7 @@ size_t FUZZ_seqProdTearDown(void); | ||||
| void* FUZZ_createSeqProdState(void); | ||||
|  | ||||
| /* The fuzzer will call this function after each test-case. It should free any | ||||
|  * resources aquired by FUZZ_createSeqProdState(). | ||||
|  * resources acquired by FUZZ_createSeqProdState(). | ||||
|  * | ||||
|  * The fuzzer will assert() that the return value is zero. To signal an error, | ||||
|  * please return a non-zero value. */ | ||||
|   | ||||
| @@ -376,7 +376,7 @@ static int threadPoolTests(void) { | ||||
|  | ||||
|     RDG_genBuffer(CNBuffer, CNBuffSize, 0.5, 0.5, 0); | ||||
|  | ||||
|     DISPLAYLEVEL(3, "thread pool test : threadPool re-use roundtrips: "); | ||||
|     DISPLAYLEVEL(3, "thread pool test : threadPool reuse roundtrips: "); | ||||
|     { | ||||
|         ZSTD_CCtx* cctx = ZSTD_createCCtx(); | ||||
|         ZSTD_threadPool* pool = ZSTD_createThreadPool(kPoolNumThreads); | ||||
| @@ -1525,14 +1525,14 @@ static int basicUnitTests(U32 const seed, double compressibility) | ||||
|     } | ||||
|     DISPLAYLEVEL(3, "OK \n"); | ||||
|  | ||||
|     DISPLAYLEVEL(3, "test%3d : re-use CCtx with expanding block size : ", testNb++); | ||||
|     DISPLAYLEVEL(3, "test%3d : reuse CCtx with expanding block size : ", testNb++); | ||||
|     {   ZSTD_CCtx* const cctx = ZSTD_createCCtx(); | ||||
|         ZSTD_parameters const params = ZSTD_getParams(1, ZSTD_CONTENTSIZE_UNKNOWN, 0); | ||||
|         assert(params.fParams.contentSizeFlag == 1);  /* block size will be adapted if pledgedSrcSize is enabled */ | ||||
|         CHECK_Z( ZSTD_compressBegin_advanced(cctx, NULL, 0, params, 1 /*pledgedSrcSize*/) ); | ||||
|         CHECK_Z( ZSTD_compressEnd(cctx, compressedBuffer, compressedBufferSize, CNBuffer, 1) ); /* creates a block size of 1 */ | ||||
|  | ||||
|         CHECK_Z( ZSTD_compressBegin_advanced(cctx, NULL, 0, params, ZSTD_CONTENTSIZE_UNKNOWN) );  /* re-use same parameters */ | ||||
|         CHECK_Z( ZSTD_compressBegin_advanced(cctx, NULL, 0, params, ZSTD_CONTENTSIZE_UNKNOWN) );  /* reuse same parameters */ | ||||
|         {   size_t const inSize = 2* 128 KB; | ||||
|             size_t const outSize = ZSTD_compressBound(inSize); | ||||
|             CHECK_Z( ZSTD_compressEnd(cctx, compressedBuffer, outSize, CNBuffer, inSize) ); | ||||
| @@ -1827,7 +1827,7 @@ static int basicUnitTests(U32 const seed, double compressibility) | ||||
|         params.cParams.windowLog = ZSTD_WINDOWLOG_MAX; | ||||
|         for (cnb = 0; cnb < nbCompressions; ++cnb) { | ||||
|             DISPLAYLEVEL(6, "run %zu / %zu \n", cnb, nbCompressions); | ||||
|             CHECK_Z( ZSTD_compressBegin_advanced(cctx, NULL, 0, params, ZSTD_CONTENTSIZE_UNKNOWN) );  /* re-use same parameters */ | ||||
|             CHECK_Z( ZSTD_compressBegin_advanced(cctx, NULL, 0, params, ZSTD_CONTENTSIZE_UNKNOWN) );  /* reuse same parameters */ | ||||
|             CHECK_Z( ZSTD_compressEnd(cctx, compressedBuffer, compressedBufferSize, CNBuffer, CNBuffSize) ); | ||||
|         } | ||||
|         ZSTD_freeCCtx(cctx); | ||||
|   | ||||
| @@ -408,8 +408,8 @@ static int basicUnitTests(U32 seed, double compressibility, int bigTests) | ||||
|     if (inBuff.pos != inBuff.size) goto _output_error;   /* should have read the entire frame */ | ||||
|     DISPLAYLEVEL(3, "OK \n"); | ||||
|  | ||||
|     /* Re-use without init */ | ||||
|     DISPLAYLEVEL(3, "test%3i : decompress again without init (re-use previous settings): ", testNb++); | ||||
|     /* Reuse without init */ | ||||
|     DISPLAYLEVEL(3, "test%3i : decompress again without init (reuse previous settings): ", testNb++); | ||||
|     outBuff.pos = 0; | ||||
|     { size_t const remaining = ZSTD_decompressStream(zd, &outBuff, &inBuff2); | ||||
|       if (remaining != 0) goto _output_error; }  /* should reach end of frame == 0; otherwise, some data left, or an error */ | ||||
| @@ -653,8 +653,8 @@ static int basicUnitTests(U32 seed, double compressibility, int bigTests) | ||||
|             DISPLAYLEVEL(3, "OK (error detected : %s) \n", ZSTD_getErrorName(r)); | ||||
|     }   } | ||||
|  | ||||
|     /* Compression state re-use scenario */ | ||||
|     DISPLAYLEVEL(3, "test%3i : context re-use : ", testNb++); | ||||
|     /* Compression state reuse scenario */ | ||||
|     DISPLAYLEVEL(3, "test%3i : context reuse : ", testNb++); | ||||
|     ZSTD_freeCStream(zc); | ||||
|     zc = ZSTD_createCStream(); | ||||
|     if (zc==NULL) goto _output_error;   /* memory allocation issue */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user