new field frameHeader.headerSize
This commit is contained in:
+10
-11
@@ -344,16 +344,6 @@ size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inB
|
|||||||
ZSTD_frameParameters fParams;
|
ZSTD_frameParameters fParams;
|
||||||
} ZSTD_parameters;
|
} ZSTD_parameters;
|
||||||
</b></pre><BR>
|
</b></pre><BR>
|
||||||
<pre><b>typedef enum { ZSTD_frame, ZSTD_skippableFrame } ZSTD_frameType_e;
|
|
||||||
</b></pre><BR>
|
|
||||||
<pre><b>typedef struct {
|
|
||||||
unsigned long long frameContentSize; </b>/* ZSTD_CONTENTSIZE_UNKNOWN means this field is not available. 0 means "empty" */<b>
|
|
||||||
unsigned long long windowSize; </b>/* can be very large, up to <= frameContentSize */<b>
|
|
||||||
ZSTD_frameType_e frameType; </b>/* if == ZSTD_skippableFrame, frameContentSize is the size of skippable content */<b>
|
|
||||||
unsigned dictID;
|
|
||||||
unsigned checksumFlag;
|
|
||||||
} ZSTD_frameHeader;
|
|
||||||
</b></pre><BR>
|
|
||||||
<h3>Custom memory allocation functions</h3><pre></pre><b><pre>typedef void* (*ZSTD_allocFunction) (void* opaque, size_t size);
|
<h3>Custom memory allocation functions</h3><pre></pre><b><pre>typedef void* (*ZSTD_allocFunction) (void* opaque, size_t size);
|
||||||
typedef void (*ZSTD_freeFunction) (void* opaque, void* address);
|
typedef void (*ZSTD_freeFunction) (void* opaque, void* address);
|
||||||
typedef struct { ZSTD_allocFunction customAlloc; ZSTD_freeFunction customFree; void* opaque; } ZSTD_customMem;
|
typedef struct { ZSTD_allocFunction customAlloc; ZSTD_freeFunction customFree; void* opaque; } ZSTD_customMem;
|
||||||
@@ -765,7 +755,16 @@ size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned lo
|
|||||||
It also returns Frame Size as fparamsPtr->frameContentSize.
|
It also returns Frame Size as fparamsPtr->frameContentSize.
|
||||||
<BR></pre>
|
<BR></pre>
|
||||||
|
|
||||||
<h3>Buffer-less streaming decompression functions</h3><pre></pre><b><pre>size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize); </b>/**< doesn't consume input */<b>
|
<h3>Buffer-less streaming decompression functions</h3><pre></pre><b><pre>typedef enum { ZSTD_frame, ZSTD_skippableFrame } ZSTD_frameType_e;
|
||||||
|
typedef struct {
|
||||||
|
unsigned long long frameContentSize; </b>/* ZSTD_CONTENTSIZE_UNKNOWN means this field is not available. 0 means "empty" */<b>
|
||||||
|
unsigned long long windowSize; </b>/* can be very large, up to <= frameContentSize */<b>
|
||||||
|
ZSTD_frameType_e frameType; </b>/* if == ZSTD_skippableFrame, frameContentSize is the size of skippable content */<b>
|
||||||
|
unsigned headerSize;
|
||||||
|
unsigned dictID;
|
||||||
|
unsigned checksumFlag;
|
||||||
|
} ZSTD_frameHeader;
|
||||||
|
size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize); </b>/**< doesn't consume input */<b>
|
||||||
size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx);
|
size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx);
|
||||||
size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
|
size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
|
||||||
size_t ZSTD_decompressBegin_usingDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict);
|
size_t ZSTD_decompressBegin_usingDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict);
|
||||||
|
|||||||
@@ -312,8 +312,10 @@ size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t src
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ensure there is enough `srcSize` to fully read/decode frame header */
|
/* ensure there is enough `srcSize` to fully read/decode frame header */
|
||||||
{ size_t const fhsize = ZSTD_frameHeaderSize(src, srcSize);
|
{ size_t const fhsize = ZSTD_frameHeaderSize(src, srcSize);
|
||||||
if (srcSize < fhsize) return fhsize; }
|
if (srcSize < fhsize) return fhsize;
|
||||||
|
zfhPtr->headerSize = (U32)fhsize;
|
||||||
|
}
|
||||||
|
|
||||||
{ BYTE const fhdByte = ip[4];
|
{ BYTE const fhdByte = ip[4];
|
||||||
size_t pos = 5;
|
size_t pos = 5;
|
||||||
@@ -1445,17 +1447,14 @@ size_t ZSTD_findFrameCompressedSize(const void *src, size_t srcSize)
|
|||||||
size_t remainingSize = srcSize;
|
size_t remainingSize = srcSize;
|
||||||
ZSTD_frameHeader zfh;
|
ZSTD_frameHeader zfh;
|
||||||
|
|
||||||
size_t const headerSize = ZSTD_frameHeaderSize(src, srcSize);
|
/* Extract Frame Header */
|
||||||
if (ZSTD_isError(headerSize)) return headerSize;
|
|
||||||
|
|
||||||
/* Frame Header */
|
|
||||||
{ size_t const ret = ZSTD_getFrameHeader(&zfh, src, srcSize);
|
{ size_t const ret = ZSTD_getFrameHeader(&zfh, src, srcSize);
|
||||||
if (ZSTD_isError(ret)) return ret;
|
if (ZSTD_isError(ret)) return ret;
|
||||||
if (ret > 0) return ERROR(srcSize_wrong);
|
if (ret > 0) return ERROR(srcSize_wrong);
|
||||||
}
|
}
|
||||||
|
|
||||||
ip += headerSize;
|
ip += zfh.headerSize;
|
||||||
remainingSize -= headerSize;
|
remainingSize -= zfh.headerSize;
|
||||||
|
|
||||||
/* Loop on each block */
|
/* Loop on each block */
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|||||||
+9
-10
@@ -425,16 +425,6 @@ typedef struct {
|
|||||||
ZSTD_frameParameters fParams;
|
ZSTD_frameParameters fParams;
|
||||||
} ZSTD_parameters;
|
} ZSTD_parameters;
|
||||||
|
|
||||||
typedef enum { ZSTD_frame, ZSTD_skippableFrame } ZSTD_frameType_e;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
unsigned long long frameContentSize; /* ZSTD_CONTENTSIZE_UNKNOWN means this field is not available. 0 means "empty" */
|
|
||||||
unsigned long long windowSize; /* can be very large, up to <= frameContentSize */
|
|
||||||
ZSTD_frameType_e frameType; /* if == ZSTD_skippableFrame, frameContentSize is the size of skippable content */
|
|
||||||
unsigned dictID;
|
|
||||||
unsigned checksumFlag;
|
|
||||||
} ZSTD_frameHeader;
|
|
||||||
|
|
||||||
/*= Custom memory allocation functions */
|
/*= Custom memory allocation functions */
|
||||||
typedef void* (*ZSTD_allocFunction) (void* opaque, size_t size);
|
typedef void* (*ZSTD_allocFunction) (void* opaque, size_t size);
|
||||||
typedef void (*ZSTD_freeFunction) (void* opaque, void* address);
|
typedef void (*ZSTD_freeFunction) (void* opaque, void* address);
|
||||||
@@ -877,6 +867,15 @@ ZSTDLIB_API size_t ZSTD_compressEnd(ZSTD_CCtx* cctx, void* dst, size_t dstCapaci
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*===== Buffer-less streaming decompression functions =====*/
|
/*===== Buffer-less streaming decompression functions =====*/
|
||||||
|
typedef enum { ZSTD_frame, ZSTD_skippableFrame } ZSTD_frameType_e;
|
||||||
|
typedef struct {
|
||||||
|
unsigned long long frameContentSize; /* ZSTD_CONTENTSIZE_UNKNOWN means this field is not available. 0 means "empty" */
|
||||||
|
unsigned long long windowSize; /* can be very large, up to <= frameContentSize */
|
||||||
|
ZSTD_frameType_e frameType; /* if == ZSTD_skippableFrame, frameContentSize is the size of skippable content */
|
||||||
|
unsigned headerSize;
|
||||||
|
unsigned dictID;
|
||||||
|
unsigned checksumFlag;
|
||||||
|
} ZSTD_frameHeader;
|
||||||
ZSTDLIB_API size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize); /**< doesn't consume input */
|
ZSTDLIB_API size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize); /**< doesn't consume input */
|
||||||
ZSTDLIB_API size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx);
|
ZSTDLIB_API size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx);
|
||||||
ZSTDLIB_API size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
|
ZSTDLIB_API size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize);
|
||||||
|
|||||||
Reference in New Issue
Block a user