]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fparamsPtr->windowLog==0 means that a frame is skippable
authorinikep <inikep@gmail.com>
Wed, 1 Jun 2016 16:47:04 +0000 (18:47 +0200)
committerinikep <inikep@gmail.com>
Wed, 1 Jun 2016 16:47:04 +0000 (18:47 +0200)
lib/common/zstd_static.h
lib/decompress/zbuff_decompress.c
lib/decompress/zstd_decompress.c

index e4c992beeced39f8deccb274f8dde414138ff4f2..19118f4649367c32ea8f1c0f6443254e0f41f4b6 100644 (file)
@@ -246,6 +246,15 @@ ZSTDLIB_API size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t ds
 
   A frame is fully decoded when ZSTD_nextSrcSizeToDecompress() returns zero.
   Context can then be reset to start a new decompression.
+
+  Skippable frames allow the integration of user-defined data into a flow of concatenated frames.
+  Skippable frames will be ignored (skipped) by a decompressor. The format of skippable frame is following:
+  a) Skippable frame ID - 4 Bytes, Little endian format, any value from 0x184D2A50 to 0x184D2A5F
+  b) Frame Size - 4 Bytes, Little endian format, unsigned 32-bits
+  c) Frame Content - any content (User Data) of length equal to Frame Size
+  For skippable frames ZSTD_decompressContinue() always returns 0. 
+  For skippable frames ZSTD_getFrameParams() returns fparamsPtr->windowLog==0 what means that a frame is skippable.
+  It also returns Frame Size as fparamsPtr->frameContentSize.
 */
 
 
index 72456fd5fabdcde324394b33227d56439061c956..69898fdb921a3b0de5e230ba094003a7967043a7 100644 (file)
@@ -192,6 +192,8 @@ size_t ZBUFF_decompressContinue(ZBUFF_DCtx* zbd,
                     if (ZSTD_isError(h2Result)) return h2Result;
             }   }
 
+            if (zbd->fParams.windowLog < ZSTD_WINDOWLOG_ABSOLUTEMIN) zbd->fParams.windowLog = ZSTD_WINDOWLOG_ABSOLUTEMIN;  /* required for buffer allocation */
+    
             /* Frame header instruct buffer sizes */
             {   size_t const blockSize = MIN(1 << zbd->fParams.windowLog, ZSTD_BLOCKSIZE_MAX);
                 zbd->blockSize = blockSize;
index e88b873c8ee7b865395a68ef0275322594731089..27dd780add0d13065c672cee6f11cc440f70a84f 100644 (file)
@@ -335,7 +335,7 @@ size_t ZSTD_getFrameParams(ZSTD_frameParams* fparamsPtr, const void* src, size_t
             if (srcSize < ZSTD_skippableHeaderSize) return ZSTD_skippableHeaderSize; /* magic number + skippable frame length */
             memset(fparamsPtr, 0, sizeof(*fparamsPtr));
             fparamsPtr->frameContentSize = MEM_readLE32((const char *)src + 4);
-            fparamsPtr->windowLog = ZSTD_WINDOWLOG_ABSOLUTEMIN;
+            fparamsPtr->windowLog = 0; /* windowLog==0 means a frame is skippable */
             return 0;
         }
         return ERROR(prefix_unknown);