update external sequence error to fit error naming scheme
This commit is contained in:
@@ -53,7 +53,7 @@ const char* ERR_getErrorString(ERR_enum code)
|
|||||||
case PREFIX(dstBuffer_wrong): return "Destination buffer is wrong";
|
case PREFIX(dstBuffer_wrong): return "Destination buffer is wrong";
|
||||||
case PREFIX(srcBuffer_wrong): return "Source buffer is wrong";
|
case PREFIX(srcBuffer_wrong): return "Source buffer is wrong";
|
||||||
case PREFIX(externalMatchFinder_failed): return "External matchfinder returned an error code";
|
case PREFIX(externalMatchFinder_failed): return "External matchfinder returned an error code";
|
||||||
case PREFIX(invalid_external_sequences): return "External sequences are not valid";
|
case PREFIX(externalSequences_invalid): return "External sequences are not valid";
|
||||||
case PREFIX(maxCode):
|
case PREFIX(maxCode):
|
||||||
default: return notErrorCode;
|
default: return notErrorCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6167,9 +6167,9 @@ ZSTD_validateSequence(U32 offCode, U32 matchLength, U32 minMatch,
|
|||||||
*/
|
*/
|
||||||
size_t const offsetBound = posInSrc > windowSize ? (size_t)windowSize : posInSrc + (size_t)dictSize;
|
size_t const offsetBound = posInSrc > windowSize ? (size_t)windowSize : posInSrc + (size_t)dictSize;
|
||||||
size_t const matchLenLowerBound = (minMatch == 3 || useExternalMatchFinder) ? 3 : 4;
|
size_t const matchLenLowerBound = (minMatch == 3 || useExternalMatchFinder) ? 3 : 4;
|
||||||
RETURN_ERROR_IF(offCode > OFFSET_TO_OFFBASE(offsetBound), invalid_external_sequences, "Offset too large!");
|
RETURN_ERROR_IF(offCode > OFFSET_TO_OFFBASE(offsetBound), externalSequences_invalid, "Offset too large!");
|
||||||
/* Validate maxNbSeq is large enough for the given matchLength and minMatch */
|
/* Validate maxNbSeq is large enough for the given matchLength and minMatch */
|
||||||
RETURN_ERROR_IF(matchLength < matchLenLowerBound, invalid_external_sequences, "Matchlength too small for the minMatch");
|
RETURN_ERROR_IF(matchLength < matchLenLowerBound, externalSequences_invalid, "Matchlength too small for the minMatch");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6226,7 +6226,7 @@ ZSTD_copySequencesToSeqStoreExplicitBlockDelim(ZSTD_CCtx* cctx,
|
|||||||
cctx->appliedParams.cParams.windowLog, dictSize, cctx->appliedParams.useExternalMatchFinder),
|
cctx->appliedParams.cParams.windowLog, dictSize, cctx->appliedParams.useExternalMatchFinder),
|
||||||
"Sequence validation failed");
|
"Sequence validation failed");
|
||||||
}
|
}
|
||||||
RETURN_ERROR_IF(idx - seqPos->idx >= cctx->seqStore.maxNbSeq, invalid_external_sequences,
|
RETURN_ERROR_IF(idx - seqPos->idx >= cctx->seqStore.maxNbSeq, externalSequences_invalid,
|
||||||
"Not enough memory allocated. Try adjusting ZSTD_c_minMatch.");
|
"Not enough memory allocated. Try adjusting ZSTD_c_minMatch.");
|
||||||
ZSTD_storeSeq(&cctx->seqStore, litLength, ip, iend, offBase, matchLength);
|
ZSTD_storeSeq(&cctx->seqStore, litLength, ip, iend, offBase, matchLength);
|
||||||
ip += matchLength + litLength;
|
ip += matchLength + litLength;
|
||||||
@@ -6339,7 +6339,7 @@ ZSTD_copySequencesToSeqStoreNoBlockDelim(ZSTD_CCtx* cctx, ZSTD_sequencePosition*
|
|||||||
"Sequence validation failed");
|
"Sequence validation failed");
|
||||||
}
|
}
|
||||||
DEBUGLOG(6, "Storing sequence: (of: %u, ml: %u, ll: %u)", offBase, matchLength, litLength);
|
DEBUGLOG(6, "Storing sequence: (of: %u, ml: %u, ll: %u)", offBase, matchLength, litLength);
|
||||||
RETURN_ERROR_IF(idx - seqPos->idx >= cctx->seqStore.maxNbSeq, invalid_external_sequences,
|
RETURN_ERROR_IF(idx - seqPos->idx >= cctx->seqStore.maxNbSeq, externalSequences_invalid,
|
||||||
"Not enough memory allocated. Try adjusting ZSTD_c_minMatch.");
|
"Not enough memory allocated. Try adjusting ZSTD_c_minMatch.");
|
||||||
ZSTD_storeSeq(&cctx->seqStore, litLength, ip, iend, offBase, matchLength);
|
ZSTD_storeSeq(&cctx->seqStore, litLength, ip, iend, offBase, matchLength);
|
||||||
ip += matchLength + litLength;
|
ip += matchLength + litLength;
|
||||||
|
|||||||
+1
-1
@@ -94,7 +94,7 @@ typedef enum {
|
|||||||
ZSTD_error_dstBuffer_wrong = 104,
|
ZSTD_error_dstBuffer_wrong = 104,
|
||||||
ZSTD_error_srcBuffer_wrong = 105,
|
ZSTD_error_srcBuffer_wrong = 105,
|
||||||
ZSTD_error_externalMatchFinder_failed = 106,
|
ZSTD_error_externalMatchFinder_failed = 106,
|
||||||
ZSTD_error_invalid_external_sequences = 107,
|
ZSTD_error_externalSequences_invalid = 107,
|
||||||
ZSTD_error_maxCode = 120 /* never EVER use this value directly, it can change in future versions! Use ZSTD_isError() instead */
|
ZSTD_error_maxCode = 120 /* never EVER use this value directly, it can change in future versions! Use ZSTD_isError() instead */
|
||||||
} ZSTD_ErrorCode;
|
} ZSTD_ErrorCode;
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -2097,7 +2097,7 @@ static int basicUnitTests(U32 seed, double compressibility, int bigTests)
|
|||||||
src, srcSize);
|
src, srcSize);
|
||||||
|
|
||||||
CHECK(!ZSTD_isError(cSize), "Should throw an error"); /* maxNbSeq is too small and an assert will fail */
|
CHECK(!ZSTD_isError(cSize), "Should throw an error"); /* maxNbSeq is too small and an assert will fail */
|
||||||
CHECK(ZSTD_getErrorCode(cSize) != ZSTD_error_invalid_external_sequences, "Wrong error code: %s", ZSTD_getErrorName(cSize)); /* fails sequence validation */
|
CHECK(ZSTD_getErrorCode(cSize) != ZSTD_error_externalSequences_invalid, "Wrong error code: %s", ZSTD_getErrorName(cSize)); /* fails sequence validation */
|
||||||
|
|
||||||
ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters);
|
ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters);
|
||||||
|
|
||||||
@@ -2111,7 +2111,7 @@ static int basicUnitTests(U32 seed, double compressibility, int bigTests)
|
|||||||
src, srcSize);
|
src, srcSize);
|
||||||
|
|
||||||
CHECK(!ZSTD_isError(cSize), "Should throw an error"); /* maxNbSeq is too small and an assert will fail */
|
CHECK(!ZSTD_isError(cSize), "Should throw an error"); /* maxNbSeq is too small and an assert will fail */
|
||||||
CHECK(ZSTD_getErrorCode(cSize) != ZSTD_error_invalid_external_sequences, "Wrong error code: %s", ZSTD_getErrorName(cSize)); /* fails sequence validation */
|
CHECK(ZSTD_getErrorCode(cSize) != ZSTD_error_externalSequences_invalid, "Wrong error code: %s", ZSTD_getErrorName(cSize)); /* fails sequence validation */
|
||||||
|
|
||||||
free(sequences);
|
free(sequences);
|
||||||
}
|
}
|
||||||
@@ -2145,7 +2145,7 @@ static int basicUnitTests(U32 seed, double compressibility, int bigTests)
|
|||||||
src, srcSize);
|
src, srcSize);
|
||||||
|
|
||||||
CHECK(!ZSTD_isError(cSize), "Should throw an error"); /* maxNbSeq is too small and an assert will fail */
|
CHECK(!ZSTD_isError(cSize), "Should throw an error"); /* maxNbSeq is too small and an assert will fail */
|
||||||
CHECK(ZSTD_getErrorCode(cSize) != ZSTD_error_invalid_external_sequences, "Wrong error code: %s", ZSTD_getErrorName(cSize)); /* fails sequence validation */
|
CHECK(ZSTD_getErrorCode(cSize) != ZSTD_error_externalSequences_invalid, "Wrong error code: %s", ZSTD_getErrorName(cSize)); /* fails sequence validation */
|
||||||
|
|
||||||
ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters);
|
ZSTD_CCtx_reset(cctx, ZSTD_reset_session_and_parameters);
|
||||||
|
|
||||||
@@ -2159,7 +2159,7 @@ static int basicUnitTests(U32 seed, double compressibility, int bigTests)
|
|||||||
src, srcSize);
|
src, srcSize);
|
||||||
|
|
||||||
CHECK(!ZSTD_isError(cSize), "Should throw an error"); /* maxNbSeq is too small and an assert will fail */
|
CHECK(!ZSTD_isError(cSize), "Should throw an error"); /* maxNbSeq is too small and an assert will fail */
|
||||||
CHECK(ZSTD_getErrorCode(cSize) != ZSTD_error_invalid_external_sequences, "Wrong error code: %s", ZSTD_getErrorName(cSize)); /* fails sequence validation */
|
CHECK(ZSTD_getErrorCode(cSize) != ZSTD_error_externalSequences_invalid, "Wrong error code: %s", ZSTD_getErrorName(cSize)); /* fails sequence validation */
|
||||||
|
|
||||||
free(sequences);
|
free(sequences);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user