mirror of
https://github.com/facebook/zstd.git
synced 2025-07-25 01:42:11 +03:00
codemod: ZSTD_sequenceFormat_e -> ZSTD_SequenceFormat_e
since it's a type name. Note: in contrast with previous names, this one is on the Public API side. So there is a #define, so that existing programs using ZSTD_sequenceFormat_e still work.
This commit is contained in:
@ -1317,7 +1317,7 @@ ZSTDLIB_STATIC_API size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr,
|
|||||||
<pre><b>typedef enum {
|
<pre><b>typedef enum {
|
||||||
ZSTD_sf_noBlockDelimiters = 0, </b>/* Representation of ZSTD_Sequence has no block delimiters, sequences only */<b>
|
ZSTD_sf_noBlockDelimiters = 0, </b>/* Representation of ZSTD_Sequence has no block delimiters, sequences only */<b>
|
||||||
ZSTD_sf_explicitBlockDelimiters = 1 </b>/* Representation of ZSTD_Sequence contains explicit block delimiters */<b>
|
ZSTD_sf_explicitBlockDelimiters = 1 </b>/* Representation of ZSTD_Sequence contains explicit block delimiters */<b>
|
||||||
} ZSTD_sequenceFormat_e;
|
} ZSTD_SequenceFormat_e;
|
||||||
</b></pre><BR>
|
</b></pre><BR>
|
||||||
<pre><b>ZSTDLIB_STATIC_API size_t ZSTD_sequenceBound(size_t srcSize);
|
<pre><b>ZSTDLIB_STATIC_API size_t ZSTD_sequenceBound(size_t srcSize);
|
||||||
</b><p> `srcSize` : size of the input buffer
|
</b><p> `srcSize` : size of the input buffer
|
||||||
|
@ -974,7 +974,7 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams,
|
|||||||
|
|
||||||
case ZSTD_c_blockDelimiters:
|
case ZSTD_c_blockDelimiters:
|
||||||
BOUNDCHECK(ZSTD_c_blockDelimiters, value);
|
BOUNDCHECK(ZSTD_c_blockDelimiters, value);
|
||||||
CCtxParams->blockDelimiters = (ZSTD_sequenceFormat_e)value;
|
CCtxParams->blockDelimiters = (ZSTD_SequenceFormat_e)value;
|
||||||
return CCtxParams->blockDelimiters;
|
return CCtxParams->blockDelimiters;
|
||||||
|
|
||||||
case ZSTD_c_validateSequences:
|
case ZSTD_c_validateSequences:
|
||||||
@ -6815,10 +6815,10 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim(ZSTD_CCtx* cctx,
|
|||||||
typedef size_t (*ZSTD_sequenceCopier) (ZSTD_CCtx* cctx, ZSTD_sequencePosition* seqPos,
|
typedef size_t (*ZSTD_sequenceCopier) (ZSTD_CCtx* cctx, ZSTD_sequencePosition* seqPos,
|
||||||
const ZSTD_Sequence* const inSeqs, size_t inSeqsSize,
|
const ZSTD_Sequence* const inSeqs, size_t inSeqsSize,
|
||||||
const void* src, size_t blockSize, ZSTD_paramSwitch_e externalRepSearch);
|
const void* src, size_t blockSize, ZSTD_paramSwitch_e externalRepSearch);
|
||||||
static ZSTD_sequenceCopier ZSTD_selectSequenceCopier(ZSTD_sequenceFormat_e mode)
|
static ZSTD_sequenceCopier ZSTD_selectSequenceCopier(ZSTD_SequenceFormat_e mode)
|
||||||
{
|
{
|
||||||
ZSTD_sequenceCopier sequenceCopier = NULL;
|
ZSTD_sequenceCopier sequenceCopier = NULL;
|
||||||
assert(ZSTD_cParam_withinBounds(ZSTD_c_blockDelimiters, mode));
|
assert(ZSTD_cParam_withinBounds(ZSTD_c_blockDelimiters, (int)mode));
|
||||||
if (mode == ZSTD_sf_explicitBlockDelimiters) {
|
if (mode == ZSTD_sf_explicitBlockDelimiters) {
|
||||||
return ZSTD_copySequencesToSeqStoreExplicitBlockDelim;
|
return ZSTD_copySequencesToSeqStoreExplicitBlockDelim;
|
||||||
} else if (mode == ZSTD_sf_noBlockDelimiters) {
|
} else if (mode == ZSTD_sf_noBlockDelimiters) {
|
||||||
@ -6862,7 +6862,7 @@ static size_t blockSize_noDelimiter(size_t blockSize, size_t remaining)
|
|||||||
return lastBlock ? remaining : blockSize;
|
return lastBlock ? remaining : blockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t determine_blockSize(ZSTD_sequenceFormat_e mode,
|
static size_t determine_blockSize(ZSTD_SequenceFormat_e mode,
|
||||||
size_t blockSize, size_t remaining,
|
size_t blockSize, size_t remaining,
|
||||||
const ZSTD_Sequence* inSeqs, size_t inSeqsSize, ZSTD_sequencePosition seqPos)
|
const ZSTD_Sequence* inSeqs, size_t inSeqsSize, ZSTD_sequencePosition seqPos)
|
||||||
{
|
{
|
||||||
@ -6941,11 +6941,13 @@ ZSTD_compressSequences_internal(ZSTD_CCtx* cctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
RETURN_ERROR_IF(dstCapacity < ZSTD_blockHeaderSize, dstSize_tooSmall, "not enough dstCapacity to write a new compressed block");
|
RETURN_ERROR_IF(dstCapacity < ZSTD_blockHeaderSize, dstSize_tooSmall, "not enough dstCapacity to write a new compressed block");
|
||||||
compressedSeqsSize = ZSTD_entropyCompressSeqStore(&cctx->seqStore,
|
compressedSeqsSize = ZSTD_entropyCompressSeqStore_wExtLitBuffer(
|
||||||
|
op + ZSTD_blockHeaderSize /* Leave space for block header */, dstCapacity - ZSTD_blockHeaderSize,
|
||||||
|
cctx->seqStore.litStart, (size_t)(cctx->seqStore.lit - cctx->seqStore.litStart),
|
||||||
|
blockSize,
|
||||||
|
&cctx->seqStore,
|
||||||
&cctx->blockState.prevCBlock->entropy, &cctx->blockState.nextCBlock->entropy,
|
&cctx->blockState.prevCBlock->entropy, &cctx->blockState.nextCBlock->entropy,
|
||||||
&cctx->appliedParams,
|
&cctx->appliedParams,
|
||||||
op + ZSTD_blockHeaderSize /* Leave space for block header */, dstCapacity - ZSTD_blockHeaderSize,
|
|
||||||
blockSize,
|
|
||||||
cctx->tmpWorkspace, cctx->tmpWkspSize /* statically allocated in resetCCtx */,
|
cctx->tmpWorkspace, cctx->tmpWkspSize /* statically allocated in resetCCtx */,
|
||||||
cctx->bmi2);
|
cctx->bmi2);
|
||||||
FORWARD_IF_ERROR(compressedSeqsSize, "Compressing sequences of block failed");
|
FORWARD_IF_ERROR(compressedSeqsSize, "Compressing sequences of block failed");
|
||||||
|
@ -404,7 +404,7 @@ struct ZSTD_CCtx_params_s {
|
|||||||
ZSTD_bufferMode_e outBufferMode;
|
ZSTD_bufferMode_e outBufferMode;
|
||||||
|
|
||||||
/* Sequence compression API */
|
/* Sequence compression API */
|
||||||
ZSTD_sequenceFormat_e blockDelimiters;
|
ZSTD_SequenceFormat_e blockDelimiters;
|
||||||
int validateSequences;
|
int validateSequences;
|
||||||
|
|
||||||
/* Block splitting
|
/* Block splitting
|
||||||
|
@ -1562,7 +1562,8 @@ ZSTDLIB_STATIC_API size_t ZSTD_decompressionMargin(const void* src, size_t srcSi
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
ZSTD_sf_noBlockDelimiters = 0, /* Representation of ZSTD_Sequence has no block delimiters, sequences only */
|
ZSTD_sf_noBlockDelimiters = 0, /* Representation of ZSTD_Sequence has no block delimiters, sequences only */
|
||||||
ZSTD_sf_explicitBlockDelimiters = 1 /* Representation of ZSTD_Sequence contains explicit block delimiters */
|
ZSTD_sf_explicitBlockDelimiters = 1 /* Representation of ZSTD_Sequence contains explicit block delimiters */
|
||||||
} ZSTD_sequenceFormat_e;
|
} ZSTD_SequenceFormat_e;
|
||||||
|
#define ZSTD_sequenceFormat_e ZSTD_SequenceFormat_e /* old name */
|
||||||
|
|
||||||
/*! ZSTD_sequenceBound() :
|
/*! ZSTD_sequenceBound() :
|
||||||
* `srcSize` : size of the input buffer
|
* `srcSize` : size of the input buffer
|
||||||
|
@ -76,7 +76,7 @@ static char* generatePseudoRandomString(char* str, size_t size, FUZZ_dataProduce
|
|||||||
static size_t decodeSequences(void* dst, size_t nbSequences,
|
static size_t decodeSequences(void* dst, size_t nbSequences,
|
||||||
size_t literalsSize,
|
size_t literalsSize,
|
||||||
const void* dict, size_t dictSize,
|
const void* dict, size_t dictSize,
|
||||||
ZSTD_sequenceFormat_e mode)
|
ZSTD_SequenceFormat_e mode)
|
||||||
{
|
{
|
||||||
const uint8_t* litPtr = literalsBuffer;
|
const uint8_t* litPtr = literalsBuffer;
|
||||||
const uint8_t* const litBegin = literalsBuffer;
|
const uint8_t* const litBegin = literalsBuffer;
|
||||||
@ -141,7 +141,7 @@ static size_t decodeSequences(void* dst, size_t nbSequences,
|
|||||||
*/
|
*/
|
||||||
static size_t generateRandomSequences(FUZZ_dataProducer_t* producer,
|
static size_t generateRandomSequences(FUZZ_dataProducer_t* producer,
|
||||||
size_t literalsSizeLimit, size_t dictSize,
|
size_t literalsSizeLimit, size_t dictSize,
|
||||||
size_t windowLog, ZSTD_sequenceFormat_e mode)
|
size_t windowLog, ZSTD_SequenceFormat_e mode)
|
||||||
{
|
{
|
||||||
const uint32_t repCode = 0; /* not used by sequence ingestion api */
|
const uint32_t repCode = 0; /* not used by sequence ingestion api */
|
||||||
size_t windowSize = 1ULL << windowLog;
|
size_t windowSize = 1ULL << windowLog;
|
||||||
@ -232,7 +232,7 @@ static size_t roundTripTest(void* result, size_t resultCapacity,
|
|||||||
const void* src, size_t srcSize,
|
const void* src, size_t srcSize,
|
||||||
const ZSTD_Sequence* seqs, size_t seqSize,
|
const ZSTD_Sequence* seqs, size_t seqSize,
|
||||||
unsigned hasDict,
|
unsigned hasDict,
|
||||||
ZSTD_sequenceFormat_e mode)
|
ZSTD_SequenceFormat_e mode)
|
||||||
{
|
{
|
||||||
size_t cSize;
|
size_t cSize;
|
||||||
size_t dSize;
|
size_t dSize;
|
||||||
@ -276,7 +276,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* src, size_t size)
|
|||||||
unsigned hasDict;
|
unsigned hasDict;
|
||||||
unsigned wLog;
|
unsigned wLog;
|
||||||
int cLevel;
|
int cLevel;
|
||||||
ZSTD_sequenceFormat_e mode;
|
ZSTD_SequenceFormat_e mode;
|
||||||
|
|
||||||
FUZZ_dataProducer_t* const producer = FUZZ_dataProducer_create(src, size);
|
FUZZ_dataProducer_t* const producer = FUZZ_dataProducer_create(src, size);
|
||||||
FUZZ_ASSERT(producer);
|
FUZZ_ASSERT(producer);
|
||||||
@ -293,7 +293,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* src, size_t size)
|
|||||||
/* Generate window log first so we don't generate offsets too large */
|
/* Generate window log first so we don't generate offsets too large */
|
||||||
wLog = FUZZ_dataProducer_uint32Range(producer, ZSTD_WINDOWLOG_MIN, ZSTD_WINDOWLOG_MAX);
|
wLog = FUZZ_dataProducer_uint32Range(producer, ZSTD_WINDOWLOG_MIN, ZSTD_WINDOWLOG_MAX);
|
||||||
cLevel = FUZZ_dataProducer_int32Range(producer, -3, 22);
|
cLevel = FUZZ_dataProducer_int32Range(producer, -3, 22);
|
||||||
mode = (ZSTD_sequenceFormat_e)FUZZ_dataProducer_int32Range(producer, 0, 1);
|
mode = (ZSTD_SequenceFormat_e)FUZZ_dataProducer_int32Range(producer, 0, 1);
|
||||||
|
|
||||||
ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters);
|
ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters);
|
||||||
ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 0);
|
ZSTD_CCtx_setParameter(cctx, ZSTD_c_nbWorkers, 0);
|
||||||
|
@ -310,7 +310,7 @@ static int FUZ_mallocTests(unsigned seed, double compressibility, unsigned part)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void FUZ_decodeSequences(BYTE* dst, ZSTD_Sequence* seqs, size_t seqsSize,
|
static void FUZ_decodeSequences(BYTE* dst, ZSTD_Sequence* seqs, size_t seqsSize,
|
||||||
BYTE* src, size_t size, ZSTD_sequenceFormat_e format)
|
BYTE* src, size_t size, ZSTD_SequenceFormat_e format)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
size_t j;
|
size_t j;
|
||||||
|
Reference in New Issue
Block a user