]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
implemented deflateReset
authorinikep <inikep@gmail.com>
Tue, 20 Sep 2016 10:54:26 +0000 (12:54 +0200)
committerinikep <inikep@gmail.com>
Tue, 20 Sep 2016 10:54:26 +0000 (12:54 +0200)
zlibWrapper/README.md
zlibWrapper/zstd_zlibwrapper.c

index 5ea542f23d7df3cf7ac77384d55ad69f86e98a51..e86da2f5800c4d8966108413e528b208452ce002 100644 (file)
@@ -73,10 +73,12 @@ Supported methods:
 - deflate (with exception of Z_FULL_FLUSH)
 - deflateSetDictionary
 - deflateEnd
+- deflateReset
 - deflateBound
 - inflateInit
 - inflate
 - inflateSetDictionary
+- inflateReset
 - compress
 - compress2
 - compressBound
@@ -88,7 +90,6 @@ Ignored methods (they do nothing):
 Unsupported methods:
 - gzip file access functions
 - deflateCopy
-- deflateReset
 - deflateTune
 - deflatePending
 - deflatePrime
@@ -96,7 +97,6 @@ Unsupported methods:
 - inflateGetDictionary
 - inflateCopy
 - inflateSync
-- inflateReset
 - inflateReset2
 - inflatePrime
 - inflateMark
index 3e4d0a45f292ae9591bb3423f822347c7895c95b..d842ae75fecde1248f54259beac56884b802c7b9 100644 (file)
@@ -173,7 +173,16 @@ ZEXTERN int ZEXPORT z_deflateReset OF((z_streamp strm))
     if (!g_useZSTD)
         return deflateReset(strm);
 
-    FINISH_WITH_ERR(strm, "deflateReset is not supported!");
+    {   ZWRAP_CCtx* zwc = (ZWRAP_CCtx*) strm->state;
+        LOG_WRAPPER("- z_deflateReset\n");
+        if (zwc == NULL) return Z_STREAM_ERROR;
+        { size_t const errorCode = ZSTD_resetCStream(zwc->zbc, 0);
+          if (ZSTD_isError(errorCode)) return ZWRAPC_finish_with_error(zwc, strm, 0); }
+    }
+    
+    strm->total_in = 0;
+    strm->total_out = 0;
+    return Z_OK;
 }