]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
redirection to deflateReset and inflateReset
authorinikep <inikep@gmail.com>
Tue, 27 Sep 2016 15:14:04 +0000 (17:14 +0200)
committerinikep <inikep@gmail.com>
Tue, 27 Sep 2016 15:14:04 +0000 (17:14 +0200)
zlibWrapper/zstd_zlibwrapper.c
zlibWrapper/zstd_zlibwrapper.h

index 0a7995b0b7ca11c4da851c8152092f6ff520703f..803d491110d2c1b803e2a1359a4ec97fd3841274 100644 (file)
@@ -205,6 +205,10 @@ ZEXTERN int ZEXPORT z_deflateInit2_ OF((z_streamp strm, int level, int method,
 
 int ZWRAP_deflateResetWithoutDict(z_streamp strm)
 {
+    LOG_WRAPPERC("- ZWRAP_deflateResetWithoutDict\n");
+    if (!g_ZWRAP_useZSTDcompression)
+        return deflateReset(strm);
+
     strm->total_in = 0;
     strm->total_out = 0;
     strm->adler = 0;
@@ -520,6 +524,10 @@ ZEXTERN int ZEXPORT z_inflateInit2_ OF((z_streamp strm, int  windowBits,
 
 int ZWRAP_inflateResetWithoutDict(z_streamp strm)
 {
+    LOG_WRAPPERD("- ZWRAP_inflateResetWithoutDict\n");
+    if (g_ZWRAPdecompressionType == ZWRAP_FORCE_ZLIB || !strm->reserved)
+        return inflateReset(strm);
+
     {   ZWRAP_DCtx* zwd = (ZWRAP_DCtx*) strm->state;
         if (zwd == NULL) return Z_STREAM_ERROR;
         if (zwd->zbd) { 
index 9df055814569b6e52eba09806be41760bbf48db4..f2e4ce2651206b074d6ce28bacf4b01468d2c846 100644 (file)
@@ -45,10 +45,13 @@ int ZWRAP_isUsingZSTDcompression(void);
    as this case is automatically detected.  */
 int ZWRAP_setPledgedSrcSize(z_streamp strm, unsigned long long pledgedSrcSize);
 
-/* similar to deflateReset but preserves dictionary set using deflateSetDictionary */
+/* Similar to deflateReset but preserves dictionary set using deflateSetDictionary.
+   It should improve compression speed because there will be less calls to deflateSetDictionary 
+   When using zlib compression this method redirects to deflateReset. */
 int ZWRAP_deflateResetWithoutDict(z_streamp strm);
 
 
+
 /*** DECOMPRESSION ***/
 typedef enum { ZWRAP_FORCE_ZLIB, ZWRAP_AUTO } ZWRAP_decompress_type;
 
@@ -62,7 +65,8 @@ ZWRAP_decompress_type ZWRAP_getDecompressionType(void);
 int ZWRAP_isUsingZSTDdecompression(z_streamp strm);
 
 /* Similar to inflateReset but preserves dictionary set using inflateSetDictionary.
-   inflate() will return Z_NEED_DICT only for the first time. */
+   inflate() will return Z_NEED_DICT only for the first time what will improve decompression speed.
+   For zlib streams this method redirects to inflateReset. */
 int ZWRAP_inflateResetWithoutDict(z_streamp strm);