Implemented ZSTD_CCtx_refCDict()
This commit is contained in:
@@ -228,9 +228,7 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned v
|
|||||||
return ERROR(compressionParameter_unsupported); \
|
return ERROR(compressionParameter_unsupported); \
|
||||||
} }
|
} }
|
||||||
|
|
||||||
if (cctx->streamStage != zcss_init) {
|
if (cctx->streamStage != zcss_init) return ERROR(stage_wrong);
|
||||||
return ERROR(stage_wrong);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(param)
|
switch(param)
|
||||||
{
|
{
|
||||||
@@ -326,14 +324,14 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, unsigned v
|
|||||||
|
|
||||||
ZSTDLIB_API size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx* cctx, unsigned long long pledgedSrcSize)
|
ZSTDLIB_API size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx* cctx, unsigned long long pledgedSrcSize)
|
||||||
{
|
{
|
||||||
|
if (cctx->streamStage != zcss_init) return ERROR(stage_wrong);
|
||||||
cctx->frameContentSize = pledgedSrcSize;
|
cctx->frameContentSize = pledgedSrcSize;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, size_t dictSize)
|
ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, size_t dictSize)
|
||||||
{
|
{
|
||||||
DEBUGLOG(5, "ZSTD_CCtx_loadDictionary : dictSize = %u",
|
if (cctx->streamStage != zcss_init) return ERROR(stage_wrong);
|
||||||
(unsigned)dictSize);
|
|
||||||
ZSTD_freeCDict(cctx->cdictLocal); /* in case one already exists */
|
ZSTD_freeCDict(cctx->cdictLocal); /* in case one already exists */
|
||||||
if (dict==NULL || dictSize==0) { /* no dictionary mode */
|
if (dict==NULL || dictSize==0) { /* no dictionary mode */
|
||||||
cctx->cdictLocal = NULL;
|
cctx->cdictLocal = NULL;
|
||||||
@@ -358,13 +356,14 @@ ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, s
|
|||||||
ZSTDLIB_API size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize)
|
ZSTDLIB_API size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize)
|
||||||
{
|
{
|
||||||
(void)cctx; (void)prefix; (void)prefixSize; /* to be done later */
|
(void)cctx; (void)prefix; (void)prefixSize; /* to be done later */
|
||||||
|
if (cctx->streamStage != zcss_init) return ERROR(stage_wrong);
|
||||||
return ERROR(compressionParameter_unsupported);
|
return ERROR(compressionParameter_unsupported);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Not ready yet ! */
|
|
||||||
ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict)
|
ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict)
|
||||||
{
|
{
|
||||||
(void)cctx; (void)cdict; /* to be done later */
|
if (cctx->streamStage != zcss_init) return ERROR(stage_wrong);
|
||||||
|
cctx->cdict = cdict;
|
||||||
return ERROR(compressionParameter_unsupported);
|
return ERROR(compressionParameter_unsupported);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,7 +383,6 @@ size_t ZSTD_checkCParams(ZSTD_compressionParameters cParams)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** ZSTD_cycleLog() :
|
/** ZSTD_cycleLog() :
|
||||||
* condition for correct operation : hashLog > 1 */
|
* condition for correct operation : hashLog > 1 */
|
||||||
static U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat)
|
static U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat)
|
||||||
|
|||||||
+1
-1
@@ -746,7 +746,7 @@ ZSTDLIB_API size_t ZSTD_CDict_loadDictionary(ZSTD_CDict* cdict, const void* dict
|
|||||||
* Adding a new dictionary effectively "discards" any previous one.
|
* Adding a new dictionary effectively "discards" any previous one.
|
||||||
* Note 2 : CDict is just referenced, its lifetime must outlive CCtx.
|
* Note 2 : CDict is just referenced, its lifetime must outlive CCtx.
|
||||||
*/
|
*/
|
||||||
ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict); /* Not ready yet ! */
|
ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user