]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
added ZSTD_CCtx_reset
authorYann Collet <cyan@fb.com>
Fri, 16 Jun 2017 17:17:50 +0000 (10:17 -0700)
committerYann Collet <cyan@fb.com>
Fri, 16 Jun 2017 17:17:50 +0000 (10:17 -0700)
lib/compress/zstd_compress.c
lib/zstd.h

index 1d4f4f5a1cb7eea80bec38ba0649bae42148b7b2..1be0e97b3f3a1bd98687273e6141d9f9ac5f9937 100644 (file)
@@ -399,14 +399,14 @@ ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, s
 }
 
 /* Not ready yet ! */
-ZSTDLIB_API size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize)
+size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize)
 {
     (void)cctx; (void)prefix; (void)prefixSize; /* to be done later */
     if (cctx->streamStage != zcss_init) return ERROR(stage_wrong);
     return ERROR(compressionParameter_unsupported);
 }
 
-ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict)
+size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict)
 {
     if (cctx->streamStage != zcss_init) return ERROR(stage_wrong);
     cctx->cdict = cdict;
@@ -414,6 +414,13 @@ ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict)
 }
 
 
+void ZSTD_CCtx_reset(ZSTD_CCtx* cctx)
+{
+    cctx->streamStage = zcss_init;
+    cctx->frameContentSize = ZSTD_CONTENTSIZE_UNKNOWN;
+    cctx->cdict = NULL;
+}
+
 /** ZSTD_checkParams() :
     ensure param values remain within authorized range.
     @return : 0, or an error code if one value is beyond authorized range */
index eb72fc4e529064d048548c1ffcc99425ca620621..a195438143b88ee0563d6ea7ac445653128b3a79 100644 (file)
@@ -819,10 +819,11 @@ ZSTDLIB_API size_t ZSTD_compress_generic (ZSTD_CCtx* cctx,
 /*! ZSTD_CCtx_reset() :
  *  Return a CCtx to clean state.
  *  Useful after an error, or to interrupt an ongoing compression job and start a new one.
- *  It's possible to modify compression parameters after a reset.
  *  Any internal data not yet flushed is cancelled.
+ *  Dictionary (if any) is dropped, next compression starts with srcSize==unknown by default.
+ *  It's possible to modify compression parameters after a reset.
  */
-ZSTDLIB_API size_t ZSTD_CCtx_reset(ZSTD_CCtx* cctx);   /* Not ready yet ! */
+ZSTDLIB_API void ZSTD_CCtx_reset(ZSTD_CCtx* cctx);   /* Not ready yet ! */
 
 
 /*! ZSTD_compress_generic_simpleArgs() :