summaryrefslogtreecommitdiffstats
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
parentd37926b0b58b2eaae972946713b92d7c8bb8621f (diff)
downloadlz4-4e574e7395323d7fe0edb4313d79d5ab3b2607ae.zip
lz4-4e574e7395323d7fe0edb4313d79d5ab3b2607ae.tar.gz
lz4-4e574e7395323d7fe0edb4313d79d5ab3b2607ae.tar.bz2
Updated lz4frame error names
-rw-r--r--lib/lz4frame.c20
-rw-r--r--lib/lz4frame_static.h14
-rw-r--r--programs/Makefile4
-rw-r--r--programs/frametest.c3
-rw-r--r--programs/lz4.16
5 files changed, 22 insertions, 25 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
diff --git a/programs/Makefile b/programs/Makefile
index 6008c7b..7bbe060 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -226,10 +226,10 @@ test-lz4c32: lz4 lz4c32 datagen
./datagen -g6GB | ./lz4c32 -vq9BD | ./lz4 -qt
test-fullbench: fullbench
- ./fullbench --no-prompt $(TEST_FILES)
+ ./fullbench --no-prompt $(NB_LOOPS) $(TEST_FILES)
test-fullbench32: fullbench32
- ./fullbench32 --no-prompt $(TEST_FILES)
+ ./fullbench32 --no-prompt $(NB_LOOPS) $(TEST_FILES)
test-fuzzer: fuzzer
./fuzzer $(FUZZER_TIME)
diff --git a/programs/frametest.c b/programs/frametest.c
index 8a51be8..6adf408 100644
--- a/programs/frametest.c
+++ b/programs/frametest.c
@@ -678,7 +678,8 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi
dOptions.stableDst = FUZ_rand(&randState) & 1;
if (nonContiguousDst==2) dOptions.stableDst = 0;
result = LZ4F_decompress(dCtx, op, &oSize, ip, &iSize, &dOptions);
- if (result == (size_t)-ERROR_checksum_invalid) locateBuffDiff((BYTE*)srcBuffer+srcStart, decodedBuffer, srcSize, nonContiguousDst);
+ if (result == (size_t)-LZ4F_ERROR_contentChecksum_invalid)
+ locateBuffDiff((BYTE*)srcBuffer+srcStart, decodedBuffer, srcSize, nonContiguousDst);
CHECK(LZ4F_isError(result), "Decompression failed (error %i:%s)", (int)result, LZ4F_getErrorName((LZ4F_errorCode_t)result));
XXH64_update(&xxh64, op, (U32)oSize);
totalOut += oSize;
diff --git a/programs/lz4.1 b/programs/lz4.1
index eea248f..a9b5195 100644
--- a/programs/lz4.1
+++ b/programs/lz4.1
@@ -177,12 +177,12 @@ independently, and the resulting name of the compressed file will be
block dependency (improve compression ratio)
.TP
.B \--[no-]frame-crc
- disable stream checksum (default:enabled)
+ select frame checksum (default:enabled)
.TP
.B \--[no-]content-size
- compressed file includes original size (default:not present)
+ header includes original size (default:not present)
Note : this option can only be activated when the original size can be determined,
-hence for a file. It won't work with unknown source size, such as stdin pipe.
+hence for a file. It won't work with unknown source size, such as stdin or pipe.
.TP
.B \--[no-]sparse
enable sparse file (default:disabled)(experimental)