converted checks into user validation generating error codes
had to create a new error code for this condition, none of the existing ones were fitting enough.
This commit is contained in:
parent
af3d9c506e
commit
b99ece96b9
@ -38,6 +38,7 @@ const char* ERR_getErrorString(ERR_enum code)
|
|||||||
case PREFIX(tableLog_tooLarge): return "tableLog requires too much memory : unsupported";
|
case PREFIX(tableLog_tooLarge): return "tableLog requires too much memory : unsupported";
|
||||||
case PREFIX(maxSymbolValue_tooLarge): return "Unsupported max Symbol Value : too large";
|
case PREFIX(maxSymbolValue_tooLarge): return "Unsupported max Symbol Value : too large";
|
||||||
case PREFIX(maxSymbolValue_tooSmall): return "Specified maxSymbolValue is too small";
|
case PREFIX(maxSymbolValue_tooSmall): return "Specified maxSymbolValue is too small";
|
||||||
|
case PREFIX(stabilityCondition_notRespected): return "pledged buffer stability condition is not respected";
|
||||||
case PREFIX(dictionary_corrupted): return "Dictionary is corrupted";
|
case PREFIX(dictionary_corrupted): return "Dictionary is corrupted";
|
||||||
case PREFIX(dictionary_wrong): return "Dictionary mismatch";
|
case PREFIX(dictionary_wrong): return "Dictionary mismatch";
|
||||||
case PREFIX(dictionaryCreation_failed): return "Cannot create Dictionary from provided samples";
|
case PREFIX(dictionaryCreation_failed): return "Cannot create Dictionary from provided samples";
|
||||||
|
@ -5678,8 +5678,8 @@ size_t ZSTD_compressStream2( ZSTD_CCtx* cctx,
|
|||||||
&& (totalInputSize < ZSTD_BLOCKSIZE_MAX) ) { /* not even reached one block yet */
|
&& (totalInputSize < ZSTD_BLOCKSIZE_MAX) ) { /* not even reached one block yet */
|
||||||
if (cctx->stableIn_notConsumed) { /* not the first time */
|
if (cctx->stableIn_notConsumed) { /* not the first time */
|
||||||
/* check stable source guarantees */
|
/* check stable source guarantees */
|
||||||
assert(input->src == cctx->expectedInBuffer.src);
|
RETURN_ERROR_IF(input->src != cctx->expectedInBuffer.src, stabilityCondition_notRespected, "stableInBuffer condition not respected: wrong src pointer");
|
||||||
assert(input->pos == cctx->expectedInBuffer.size);
|
RETURN_ERROR_IF(input->pos != cctx->expectedInBuffer.size, stabilityCondition_notRespected, "stableInBuffer condition not respected: externally modified pos");
|
||||||
}
|
}
|
||||||
/* pretend input was consumed, to give a sense forward progress */
|
/* pretend input was consumed, to give a sense forward progress */
|
||||||
input->pos = input->size;
|
input->pos = input->size;
|
||||||
|
@ -66,6 +66,7 @@ typedef enum {
|
|||||||
ZSTD_error_tableLog_tooLarge = 44,
|
ZSTD_error_tableLog_tooLarge = 44,
|
||||||
ZSTD_error_maxSymbolValue_tooLarge = 46,
|
ZSTD_error_maxSymbolValue_tooLarge = 46,
|
||||||
ZSTD_error_maxSymbolValue_tooSmall = 48,
|
ZSTD_error_maxSymbolValue_tooSmall = 48,
|
||||||
|
ZSTD_error_stabilityCondition_notRespected = 50,
|
||||||
ZSTD_error_stage_wrong = 60,
|
ZSTD_error_stage_wrong = 60,
|
||||||
ZSTD_error_init_missing = 62,
|
ZSTD_error_init_missing = 62,
|
||||||
ZSTD_error_memory_allocation = 64,
|
ZSTD_error_memory_allocation = 64,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user