summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2015-04-15 09:34:08 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2015-04-15 09:34:08 (GMT)
commit4e574e7395323d7fe0edb4313d79d5ab3b2607ae (patch)
tree7fcdf9e8353f205a9a41f567fa35ef988739af44 /lib
parentd37926b0b58b2eaae972946713b92d7c8bb8621f (diff)
downloadlz4-4e574e7395323d7fe0edb4313d79d5ab3b2607ae.zip
lz4-4e574e7395323d7fe0edb4313d79d5ab3b2607ae.tar.gz
lz4-4e574e7395323d7fe0edb4313d79d5ab3b2607ae.tar.bz2
Updated lz4frame error names
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4frame.c20
-rw-r--r--lib/lz4frame_static.h14
2 files changed, 15 insertions, 19 deletions
diff --git a/lib/lz4frame.c b/lib/lz4frame.c
index 619481d..6f53897 100644
--- a/lib/lz4frame.c
+++ b/lib/lz4frame.c
@@ -478,7 +478,7 @@ size_t LZ4F_compressBound(size_t srcSize, const LZ4F_preferences_t* preferencesP
{
LZ4F_preferences_t prefsNull;
memset(&prefsNull, 0, sizeof(prefsNull));
- prefsNull.frameInfo.contentChecksumFlag = contentChecksumEnabled; /* worst case */
+ prefsNull.frameInfo.contentChecksumFlag = LZ4F_contentChecksumEnabled; /* worst case */
{
const LZ4F_preferences_t* prefsPtr = (preferencesPtr==NULL) ? &prefsNull : preferencesPtr;
LZ4F_blockSizeID_t bid = prefsPtr->frameInfo.blockSizeID;
@@ -862,16 +862,16 @@ static size_t LZ4F_decodeHeader(LZ4F_dctx_internal_t* dctxPtr, const void* srcVo
blockSizeID = (BD>>4) & _3BITS;
/* validate */
- if (version != 1) return (size_t)-ERROR_version_wrong; /* Version Number, only supported value */
- if (blockChecksumFlag != 0) return (size_t)-ERROR_unsupported_checksum; /* Only supported value for the time being */
- if (((FLG>>0)&_2BITS) != 0) return (size_t)-ERROR_reserved_flag_set; /* Reserved bits */
- if (((BD>>7)&_1BIT) != 0) return (size_t)-ERROR_reserved_flag_set; /* Reserved bit */
- if (blockSizeID < 4) return (size_t)-ERROR_unsupported_block_size; /* 4-7 only supported values for the time being */
- if (((BD>>0)&_4BITS) != 0) return (size_t)-ERROR_reserved_flag_set; /* Reserved bits */
+ if (version != 1) return (size_t)-LZ4F_ERROR_headerVersion_wrong; /* Version Number, only supported value */
+ if (blockChecksumFlag != 0) return (size_t)-LZ4F_ERROR_blockChecksum_unsupported; /* Not supported for the time being */
+ if (((FLG>>0)&_2BITS) != 0) return (size_t)-LZ4F_ERROR_reservedFlag_set; /* Reserved bits */
+ if (((BD>>7)&_1BIT) != 0) return (size_t)-LZ4F_ERROR_reservedFlag_set; /* Reserved bit */
+ if (blockSizeID < 4) return (size_t)-LZ4F_ERROR_maxBlockSize_invalid; /* 4-7 only supported values for the time being */
+ if (((BD>>0)&_4BITS) != 0) return (size_t)-LZ4F_ERROR_reservedFlag_set; /* Reserved bits */
/* check */
HC = LZ4F_headerChecksum(srcPtr+4, frameHeaderSize-5);
- if (HC != srcPtr[frameHeaderSize-1]) return (size_t)-ERROR_header_checksum_invalid; /* Bad header checksum error */
+ if (HC != srcPtr[frameHeaderSize-1]) return (size_t)-LZ4F_ERROR_headerChecksum_invalid; /* Bad header checksum error */
/* save */
dctxPtr->frameInfo.blockMode = (LZ4F_blockMode_t)blockMode;
@@ -1058,7 +1058,7 @@ size_t LZ4F_decompress(LZ4F_decompressionContext_t decompressionContext,
/* expect to continue decoding src buffer where it left previously */
if (dctxPtr->srcExpect != NULL)
{
- if (srcStart != dctxPtr->srcExpect) return (size_t)-LZ4F_ERROR_wrongSrcPtr;
+ if (srcStart != dctxPtr->srcExpect) return (size_t)-LZ4F_ERROR_srcPtr_wrong;
}
/* programmed as a state machine */
@@ -1360,7 +1360,7 @@ size_t LZ4F_decompress(LZ4F_decompressionContext_t decompressionContext,
{
U32 readCRC = LZ4F_readLE32(selectedIn);
U32 resultCRC = XXH32_digest(&(dctxPtr->xxh));
- if (readCRC != resultCRC) return (size_t)-LZ4F_ERROR_checksum_invalid;
+ if (readCRC != resultCRC) return (size_t)-LZ4F_ERROR_contentChecksum_invalid;
nextSrcSizeHint = 0;
dctxPtr->dStage = dstage_getHeader;
doAnotherStage = 0;
diff --git a/lib/lz4frame_static.h b/lib/lz4frame_static.h
index afcf7da..25afed4 100644
--- a/lib/lz4frame_static.h
+++ b/lib/lz4frame_static.h
@@ -50,20 +50,16 @@ extern "C" {
ITEM(OK_NoError) ITEM(ERROR_GENERIC) \
ITEM(ERROR_maxBlockSize_invalid) ITEM(ERROR_blockMode_invalid) ITEM(ERROR_contentChecksumFlag_invalid) \
ITEM(ERROR_compressionLevel_invalid) \
+ ITEM(ERROR_headerVersion_wrong) ITEM(ERROR_blockChecksum_unsupported) ITEM(ERROR_reservedFlag_set) \
ITEM(ERROR_allocation_failed) \
ITEM(ERROR_srcSize_tooLarge) ITEM(ERROR_dstMaxSize_tooSmall) \
- ITEM(ERROR_frameSize_wrong) \
- ITEM(ERROR_frameType_unknown) \
- ITEM(ERROR_wrongSrcPtr) \
+ ITEM(ERROR_frameType_unknown) ITEM(ERROR_frameSize_wrong) \
+ ITEM(ERROR_srcPtr_wrong) \
ITEM(ERROR_decompressionFailed) \
- ITEM(ERROR_checksum_invalid) \
- ITEM(ERROR_version_wrong) \
- ITEM(ERROR_unsupported_checksum) \
- ITEM(ERROR_reserved_flag_set) \
- ITEM(ERROR_unsupported_block_size) \
- ITEM(ERROR_header_checksum_invalid) \
+ ITEM(ERROR_headerChecksum_invalid) ITEM(ERROR_contentChecksum_invalid) \
ITEM(ERROR_maxCode)
+//#define LZ4F_DISABLE_OLD_ENUMS
#ifndef LZ4F_DISABLE_OLD_ENUMS
#define LZ4F_GENERATE_ENUM(ENUM) LZ4F_##ENUM, ENUM = LZ4F_##ENUM,
#else