mirror of
https://github.com/facebook/zstd.git
synced 2025-11-28 00:04:28 -05:00
Remove 'opaque' naming from internal functions
This commit is contained in:
parent
8fd1636776
commit
23fc0e41fa
@ -372,17 +372,17 @@ size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs,
|
|||||||
ZSTD_CCtx_params ZSTD_getCCtxParamsFromCDict(const ZSTD_CDict* cdict);
|
ZSTD_CCtx_params ZSTD_getCCtxParamsFromCDict(const ZSTD_CDict* cdict);
|
||||||
|
|
||||||
/* INTERNAL */
|
/* INTERNAL */
|
||||||
size_t ZSTD_compressBegin_advanced_opaque(ZSTD_CCtx* cctx,
|
size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx,
|
||||||
const void* dict, size_t dictSize,
|
const void* dict, size_t dictSize,
|
||||||
ZSTD_CCtx_params params,
|
ZSTD_CCtx_params params,
|
||||||
unsigned long long pledgedSrcSize);
|
unsigned long long pledgedSrcSize);
|
||||||
|
|
||||||
/* INTERNAL */
|
/* INTERNAL */
|
||||||
size_t ZSTD_compress_advanced_opaque(ZSTD_CCtx* cctx,
|
size_t ZSTD_compress_advanced_internal(ZSTD_CCtx* cctx,
|
||||||
void* dst, size_t dstCapacity,
|
void* dst, size_t dstCapacity,
|
||||||
const void* src, size_t srcSize,
|
const void* src, size_t srcSize,
|
||||||
const void* dict,size_t dictSize,
|
const void* dict,size_t dictSize,
|
||||||
ZSTD_CCtx_params params);
|
ZSTD_CCtx_params params);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
blockType_e blockType;
|
blockType_e blockType;
|
||||||
|
|||||||
@ -3418,7 +3418,7 @@ static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx,
|
|||||||
return ZSTD_compress_insertDictionary(cctx, dict, dictSize, params.dictMode);
|
return ZSTD_compress_insertDictionary(cctx, dict, dictSize, params.dictMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ZSTD_compressBegin_advanced_opaque(
|
size_t ZSTD_compressBegin_advanced_internal(
|
||||||
ZSTD_CCtx* cctx,
|
ZSTD_CCtx* cctx,
|
||||||
const void* dict, size_t dictSize,
|
const void* dict, size_t dictSize,
|
||||||
ZSTD_CCtx_params params,
|
ZSTD_CCtx_params params,
|
||||||
@ -3443,8 +3443,8 @@ size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx,
|
|||||||
cctxParams.fParams = params.fParams;
|
cctxParams.fParams = params.fParams;
|
||||||
cctxParams.dictMode = ZSTD_dm_auto;
|
cctxParams.dictMode = ZSTD_dm_auto;
|
||||||
|
|
||||||
return ZSTD_compressBegin_advanced_opaque(cctx, dict, dictSize, cctxParams,
|
return ZSTD_compressBegin_advanced_internal(cctx, dict, dictSize, cctxParams,
|
||||||
pledgedSrcSize);
|
pledgedSrcSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3535,11 +3535,11 @@ static size_t ZSTD_compress_internal (ZSTD_CCtx* cctx,
|
|||||||
cctxParams.cParams = params.cParams;
|
cctxParams.cParams = params.cParams;
|
||||||
cctxParams.fParams = params.fParams;
|
cctxParams.fParams = params.fParams;
|
||||||
cctxParams.dictMode = ZSTD_dm_auto;
|
cctxParams.dictMode = ZSTD_dm_auto;
|
||||||
return ZSTD_compress_advanced_opaque(cctx,
|
return ZSTD_compress_advanced_internal(cctx,
|
||||||
dst, dstCapacity,
|
dst, dstCapacity,
|
||||||
src, srcSize,
|
src, srcSize,
|
||||||
dict, dictSize,
|
dict, dictSize,
|
||||||
cctxParams);
|
cctxParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ZSTD_compress_advanced (ZSTD_CCtx* ctx,
|
size_t ZSTD_compress_advanced (ZSTD_CCtx* ctx,
|
||||||
@ -3553,7 +3553,7 @@ size_t ZSTD_compress_advanced (ZSTD_CCtx* ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Internal */
|
/* Internal */
|
||||||
size_t ZSTD_compress_advanced_opaque(
|
size_t ZSTD_compress_advanced_internal(
|
||||||
ZSTD_CCtx* cctx,
|
ZSTD_CCtx* cctx,
|
||||||
void* dst, size_t dstCapacity,
|
void* dst, size_t dstCapacity,
|
||||||
const void* src, size_t srcSize,
|
const void* src, size_t srcSize,
|
||||||
@ -3888,7 +3888,7 @@ size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*! ZSTD_initCStream_internal() :
|
/*! ZSTD_initCStream_internal() :
|
||||||
* Note : not static (but hidden) (not exposed). Used by zstdmt_compress.c
|
* Note : not static, but hidden (not exposed). Used by zstdmt_compress.c
|
||||||
* Assumption 1 : params are valid
|
* Assumption 1 : params are valid
|
||||||
* Assumption 2 : either dict, or cdict, is defined, not both */
|
* Assumption 2 : either dict, or cdict, is defined, not both */
|
||||||
size_t ZSTD_initCStream_internal(
|
size_t ZSTD_initCStream_internal(
|
||||||
@ -4154,12 +4154,12 @@ size_t ZSTD_compressStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output, ZSTD_inBuf
|
|||||||
return ZSTD_compressStream_generic(zcs, output, input, ZSTD_e_continue);
|
return ZSTD_compressStream_generic(zcs, output, input, ZSTD_e_continue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! ZSTDMT_initCStream_internal_opaque() :
|
/*! ZSTDMT_initCStream_internal() :
|
||||||
* Private use only. Init streaming operation.
|
* Private use only. Init streaming operation.
|
||||||
* expects params to be valid.
|
* expects params to be valid.
|
||||||
* must receive dict, or cdict, or none, but not both.
|
* must receive dict, or cdict, or none, but not both.
|
||||||
* @return : 0, or an error code */
|
* @return : 0, or an error code */
|
||||||
size_t ZSTDMT_initCStream_internal_opaque(ZSTDMT_CCtx* zcs,
|
size_t ZSTDMT_initCStream_internal(ZSTDMT_CCtx* zcs,
|
||||||
const void* dict, size_t dictSize, const ZSTD_CDict* cdict,
|
const void* dict, size_t dictSize, const ZSTD_CDict* cdict,
|
||||||
ZSTD_CCtx_params params, unsigned long long pledgedSrcSize);
|
ZSTD_CCtx_params params, unsigned long long pledgedSrcSize);
|
||||||
|
|
||||||
@ -4188,7 +4188,7 @@ size_t ZSTD_compress_generic (ZSTD_CCtx* cctx,
|
|||||||
#ifdef ZSTD_MULTITHREAD
|
#ifdef ZSTD_MULTITHREAD
|
||||||
if (params.nbThreads > 1) {
|
if (params.nbThreads > 1) {
|
||||||
DEBUGLOG(4, "call ZSTDMT_initCStream_internal as nbThreads=%u", params.nbThreads);
|
DEBUGLOG(4, "call ZSTDMT_initCStream_internal as nbThreads=%u", params.nbThreads);
|
||||||
CHECK_F( ZSTDMT_initCStream_internal_opaque(cctx->mtctx, prefix, prefixSize, cctx->cdict, params, cctx->pledgedSrcSizePlusOne-1) );
|
CHECK_F( ZSTDMT_initCStream_internal(cctx->mtctx, prefix, prefixSize, cctx->cdict, params, cctx->pledgedSrcSizePlusOne-1) );
|
||||||
cctx->streamStage = zcss_load;
|
cctx->streamStage = zcss_load;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -342,7 +342,7 @@ void ZSTDMT_compressChunk(void* jobDescription)
|
|||||||
} else { /* srcStart points at reloaded section */
|
} else { /* srcStart points at reloaded section */
|
||||||
if (!job->firstChunk) job->params.fParams.contentSizeFlag = 0; /* ensure no srcSize control */
|
if (!job->firstChunk) job->params.fParams.contentSizeFlag = 0; /* ensure no srcSize control */
|
||||||
{ size_t const dictModeError = ZSTD_setCCtxParameter(cctx, ZSTD_p_forceRawDict, 1); /* Force loading dictionary in "content-only" mode (no header analysis) */
|
{ size_t const dictModeError = ZSTD_setCCtxParameter(cctx, ZSTD_p_forceRawDict, 1); /* Force loading dictionary in "content-only" mode (no header analysis) */
|
||||||
size_t const initError = ZSTD_compressBegin_advanced_opaque(cctx, job->srcStart, job->dictSize, job->params, job->fullFrameSize);
|
size_t const initError = ZSTD_compressBegin_advanced_internal(cctx, job->srcStart, job->dictSize, job->params, job->fullFrameSize);
|
||||||
if (ZSTD_isError(initError) || ZSTD_isError(dictModeError)) { job->cSize = initError; goto _endJob; }
|
if (ZSTD_isError(initError) || ZSTD_isError(dictModeError)) { job->cSize = initError; goto _endJob; }
|
||||||
ZSTD_setCCtxParameter(cctx, ZSTD_p_forceWindow, 1);
|
ZSTD_setCCtxParameter(cctx, ZSTD_p_forceWindow, 1);
|
||||||
} }
|
} }
|
||||||
@ -540,7 +540,7 @@ static unsigned computeNbChunks(size_t srcSize, unsigned windowLog, unsigned nbT
|
|||||||
return (multiplier>1) ? nbChunksLarge : nbChunksSmall;
|
return (multiplier>1) ? nbChunksLarge : nbChunksSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t ZSTDMT_compress_advanced_opaque(
|
static size_t ZSTDMT_compress_advanced_internal(
|
||||||
ZSTDMT_CCtx* mtctx,
|
ZSTDMT_CCtx* mtctx,
|
||||||
void* dst, size_t dstCapacity,
|
void* dst, size_t dstCapacity,
|
||||||
const void* src, size_t srcSize,
|
const void* src, size_t srcSize,
|
||||||
@ -564,7 +564,7 @@ static size_t ZSTDMT_compress_advanced_opaque(
|
|||||||
if (nbChunks==1) { /* fallback to single-thread mode */
|
if (nbChunks==1) { /* fallback to single-thread mode */
|
||||||
ZSTD_CCtx* const cctx = mtctx->cctxPool->cctx[0];
|
ZSTD_CCtx* const cctx = mtctx->cctxPool->cctx[0];
|
||||||
if (cdict) return ZSTD_compress_usingCDict_advanced(cctx, dst, dstCapacity, src, srcSize, cdict, cctxParams.fParams);
|
if (cdict) return ZSTD_compress_usingCDict_advanced(cctx, dst, dstCapacity, src, srcSize, cdict, cctxParams.fParams);
|
||||||
return ZSTD_compress_advanced_opaque(cctx, dst, dstCapacity, src, srcSize, NULL, 0, requestedParams);
|
return ZSTD_compress_advanced_internal(cctx, dst, dstCapacity, src, srcSize, NULL, 0, requestedParams);
|
||||||
}
|
}
|
||||||
assert(avgChunkSize >= 256 KB); /* condition for ZSTD_compressBound(A) + ZSTD_compressBound(B) <= ZSTD_compressBound(A+B), which is required for compressWithinDst */
|
assert(avgChunkSize >= 256 KB); /* condition for ZSTD_compressBound(A) + ZSTD_compressBound(B) <= ZSTD_compressBound(A+B), which is required for compressWithinDst */
|
||||||
ZSTDMT_setBufferSize(mtctx->bufPool, ZSTD_compressBound(avgChunkSize) );
|
ZSTDMT_setBufferSize(mtctx->bufPool, ZSTD_compressBound(avgChunkSize) );
|
||||||
@ -674,10 +674,10 @@ size_t ZSTDMT_compress_advanced(ZSTDMT_CCtx* mtctx,
|
|||||||
ZSTD_CCtx_params cctxParams = mtctx->params;
|
ZSTD_CCtx_params cctxParams = mtctx->params;
|
||||||
cctxParams.cParams = params.cParams;
|
cctxParams.cParams = params.cParams;
|
||||||
cctxParams.fParams = params.fParams;
|
cctxParams.fParams = params.fParams;
|
||||||
return ZSTDMT_compress_advanced_opaque(mtctx,
|
return ZSTDMT_compress_advanced_internal(mtctx,
|
||||||
dst, dstCapacity,
|
dst, dstCapacity,
|
||||||
src, srcSize,
|
src, srcSize,
|
||||||
cdict, cctxParams, overlapLog);
|
cdict, cctxParams, overlapLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -712,7 +712,7 @@ static void ZSTDMT_waitForAllJobsCompleted(ZSTDMT_CCtx* zcs)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ZSTDMT_initCStream_internal_opaque(
|
size_t ZSTDMT_initCStream_internal(
|
||||||
ZSTDMT_CCtx* zcs, const void* dict, size_t dictSize,
|
ZSTDMT_CCtx* zcs, const void* dict, size_t dictSize,
|
||||||
const ZSTD_CDict* cdict, ZSTD_CCtx_params cctxParams,
|
const ZSTD_CDict* cdict, ZSTD_CCtx_params cctxParams,
|
||||||
unsigned long long pledgedSrcSize)
|
unsigned long long pledgedSrcSize)
|
||||||
@ -773,25 +773,17 @@ size_t ZSTDMT_initCStream_internal_opaque(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ZSTDMT_initCStream_internal() */
|
|
||||||
static size_t ZSTDMT_initCStream_internal(ZSTDMT_CCtx* zcs,
|
|
||||||
const void* dict, size_t dictSize, const ZSTD_CDict* cdict,
|
|
||||||
ZSTD_parameters params, unsigned long long pledgedSrcSize)
|
|
||||||
{
|
|
||||||
ZSTD_CCtx_params cctxParams = zcs->params;
|
|
||||||
cctxParams.cParams = params.cParams;
|
|
||||||
cctxParams.fParams = params.fParams;
|
|
||||||
return ZSTDMT_initCStream_internal_opaque(zcs, dict, dictSize, cdict,
|
|
||||||
cctxParams, pledgedSrcSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t ZSTDMT_initCStream_advanced(ZSTDMT_CCtx* mtctx,
|
size_t ZSTDMT_initCStream_advanced(ZSTDMT_CCtx* mtctx,
|
||||||
const void* dict, size_t dictSize,
|
const void* dict, size_t dictSize,
|
||||||
ZSTD_parameters params,
|
ZSTD_parameters params,
|
||||||
unsigned long long pledgedSrcSize)
|
unsigned long long pledgedSrcSize)
|
||||||
{
|
{
|
||||||
|
ZSTD_CCtx_params cctxParams = mtctx->params;
|
||||||
DEBUGLOG(5, "ZSTDMT_initCStream_advanced");
|
DEBUGLOG(5, "ZSTDMT_initCStream_advanced");
|
||||||
return ZSTDMT_initCStream_internal(mtctx, dict, dictSize, NULL, params, pledgedSrcSize);
|
cctxParams.cParams = params.cParams;
|
||||||
|
cctxParams.fParams = params.fParams;
|
||||||
|
return ZSTDMT_initCStream_internal(mtctx, dict, dictSize, NULL,
|
||||||
|
cctxParams, pledgedSrcSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ZSTDMT_initCStream_usingCDict(ZSTDMT_CCtx* mtctx,
|
size_t ZSTDMT_initCStream_usingCDict(ZSTDMT_CCtx* mtctx,
|
||||||
@ -799,12 +791,11 @@ size_t ZSTDMT_initCStream_usingCDict(ZSTDMT_CCtx* mtctx,
|
|||||||
ZSTD_frameParameters fParams,
|
ZSTD_frameParameters fParams,
|
||||||
unsigned long long pledgedSrcSize)
|
unsigned long long pledgedSrcSize)
|
||||||
{
|
{
|
||||||
ZSTD_CCtx_params requestedParams =
|
ZSTD_CCtx_params requestedParams = ZSTD_getCCtxParamsFromCDict(cdict);
|
||||||
ZSTDMT_makeJobCCtxParams(ZSTD_getCCtxParamsFromCDict(cdict));
|
|
||||||
if (cdict==NULL) return ERROR(dictionary_wrong); /* method incompatible with NULL cdict */
|
if (cdict==NULL) return ERROR(dictionary_wrong); /* method incompatible with NULL cdict */
|
||||||
requestedParams.fParams = fParams;
|
requestedParams.fParams = fParams;
|
||||||
return ZSTDMT_initCStream_internal_opaque(mtctx, NULL, 0 /*dictSize*/, cdict,
|
return ZSTDMT_initCStream_internal(mtctx, NULL, 0 /*dictSize*/, cdict,
|
||||||
requestedParams, pledgedSrcSize);
|
requestedParams, pledgedSrcSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -814,13 +805,16 @@ size_t ZSTDMT_resetCStream(ZSTDMT_CCtx* zcs, unsigned long long pledgedSrcSize)
|
|||||||
{
|
{
|
||||||
if (zcs->nbThreads==1)
|
if (zcs->nbThreads==1)
|
||||||
return ZSTD_resetCStream(zcs->cctxPool->cctx[0], pledgedSrcSize);
|
return ZSTD_resetCStream(zcs->cctxPool->cctx[0], pledgedSrcSize);
|
||||||
return ZSTDMT_initCStream_internal_opaque(zcs, NULL, 0, 0, zcs->params,
|
return ZSTDMT_initCStream_internal(zcs, NULL, 0, 0, zcs->params,
|
||||||
pledgedSrcSize);
|
pledgedSrcSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ZSTDMT_initCStream(ZSTDMT_CCtx* zcs, int compressionLevel) {
|
size_t ZSTDMT_initCStream(ZSTDMT_CCtx* zcs, int compressionLevel) {
|
||||||
ZSTD_parameters const params = ZSTD_getParams(compressionLevel, 0, 0);
|
ZSTD_parameters const params = ZSTD_getParams(compressionLevel, 0, 0);
|
||||||
return ZSTDMT_initCStream_internal(zcs, NULL, 0, NULL, params, 0);
|
ZSTD_CCtx_params cctxParams = zcs->params;
|
||||||
|
cctxParams.cParams = params.cParams;
|
||||||
|
cctxParams.fParams = params.fParams;
|
||||||
|
return ZSTDMT_initCStream_internal(zcs, NULL, 0, NULL, cctxParams, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -973,7 +967,7 @@ size_t ZSTDMT_compressStream_generic(ZSTDMT_CCtx* mtctx,
|
|||||||
&& (mtctx->inBuff.filled==0) /* nothing buffered */
|
&& (mtctx->inBuff.filled==0) /* nothing buffered */
|
||||||
&& (endOp==ZSTD_e_end) /* end order */
|
&& (endOp==ZSTD_e_end) /* end order */
|
||||||
&& (output->size - output->pos >= ZSTD_compressBound(input->size - input->pos)) ) { /* enough room */
|
&& (output->size - output->pos >= ZSTD_compressBound(input->size - input->pos)) ) { /* enough room */
|
||||||
size_t const cSize = ZSTDMT_compress_advanced_opaque(mtctx,
|
size_t const cSize = ZSTDMT_compress_advanced_internal(mtctx,
|
||||||
(char*)output->dst + output->pos, output->size - output->pos,
|
(char*)output->dst + output->pos, output->size - output->pos,
|
||||||
(const char*)input->src + input->pos, input->size - input->pos,
|
(const char*)input->src + input->pos, input->size - input->pos,
|
||||||
mtctx->cdict, mtctx->params, mtctx->overlapLog);
|
mtctx->cdict, mtctx->params, mtctx->overlapLog);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user