From d5da787c1bd92a22c87b6428321668548155995f Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Sun, 29 Mar 2015 11:20:09 +0100 Subject: Changed struct member to contentSize --- lib/lz4frame.c | 20 ++++++++++---------- lib/lz4frame.h | 2 +- programs/frametest.c | 6 +++--- programs/lz4io.c | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/lz4frame.c b/lib/lz4frame.c index 644f3e8..521be86 100644 --- a/lib/lz4frame.c +++ b/lib/lz4frame.c @@ -299,10 +299,10 @@ size_t LZ4F_compressFrame(void* dstBuffer, size_t dstMaxSize, const void* srcBuf else { memset(&prefs, 0, sizeof(prefs)); - prefs.frameInfo.frameOSize = (U64)srcSize; + prefs.frameInfo.contentSize = (U64)srcSize; } - if (prefs.frameInfo.frameOSize != 0) - prefs.frameInfo.frameOSize = (U64)srcSize; /* correct frame size if selected (!=0) */ + if (prefs.frameInfo.contentSize != 0) + prefs.frameInfo.contentSize = (U64)srcSize; /* correct content size if selected (!=0) */ if (prefs.compressionLevel < minHClevel) { @@ -446,13 +446,13 @@ size_t LZ4F_compressBegin(LZ4F_compressionContext_t compressionContext, void* ds *dstPtr++ = ((1 & _2BITS) << 6) /* Version('01') */ + ((cctxPtr->prefs.frameInfo.blockMode & _1BIT ) << 5) /* Block mode */ + (BYTE)((cctxPtr->prefs.frameInfo.contentChecksumFlag & _1BIT ) << 2) /* Frame checksum */ - + (BYTE)((cctxPtr->prefs.frameInfo.frameOSize > 0) << 3); /* Frame content size */ + + (BYTE)((cctxPtr->prefs.frameInfo.contentSize > 0) << 3); /* Frame content size */ /* BD Byte */ *dstPtr++ = (BYTE)((cctxPtr->prefs.frameInfo.blockSizeID & _3BITS) << 4); /* Optional Frame content size field */ - if (cctxPtr->prefs.frameInfo.frameOSize) + if (cctxPtr->prefs.frameInfo.contentSize) { - LZ4F_writeLE64(dstPtr, cctxPtr->prefs.frameInfo.frameOSize); + LZ4F_writeLE64(dstPtr, cctxPtr->prefs.frameInfo.contentSize); dstPtr += 8; cctxPtr->totalInSize = 0; } @@ -729,9 +729,9 @@ size_t LZ4F_compressEnd(LZ4F_compressionContext_t compressionContext, void* dstB cctxPtr->cStage = 0; /* state is now re-usable (with identical preferences) */ - if (cctxPtr->prefs.frameInfo.frameOSize) + if (cctxPtr->prefs.frameInfo.contentSize) { - if (cctxPtr->prefs.frameInfo.frameOSize != cctxPtr->totalInSize) + if (cctxPtr->prefs.frameInfo.contentSize != cctxPtr->totalInSize) return (size_t)-ERROR_frameSize_wrong; } @@ -871,7 +871,7 @@ static size_t LZ4F_decodeHeader(LZ4F_dctx_internal_t* dctxPtr, const void* srcVo dctxPtr->frameInfo.blockSizeID = (blockSizeID_t)blockSizeID; dctxPtr->maxBlockSize = LZ4F_getBlockSize(blockSizeID); if (contentSizeFlag) - dctxPtr->frameInfo.frameOSize = LZ4F_readLE64(srcPtr+6); + dctxPtr->frameInfo.contentSize = LZ4F_readLE64(srcPtr+6); /* init */ if (contentChecksumFlag) XXH32_reset(&(dctxPtr->xxh), 0); @@ -1389,7 +1389,7 @@ size_t LZ4F_decompress(LZ4F_decompressionContext_t decompressionContext, /* case dstage_decodeSBlockSize: */ /* no direct access */ { size_t SFrameSize = LZ4F_readLE32(selectedIn); - dctxPtr->frameInfo.frameOSize = SFrameSize; + dctxPtr->frameInfo.contentSize = SFrameSize; dctxPtr->tmpInTarget = SFrameSize; dctxPtr->dStage = dstage_skipSkippable; break; diff --git a/lib/lz4frame.h b/lib/lz4frame.h index 54db165..e29f84a 100644 --- a/lib/lz4frame.h +++ b/lib/lz4frame.h @@ -72,7 +72,7 @@ typedef struct { blockMode_t blockMode; /* blockLinked, blockIndependent ; 0 == default */ contentChecksum_t contentChecksumFlag; /* noContentChecksum, contentChecksumEnabled ; 0 == default */ frameType_t frameType; /* LZ4F_frame, skippableFrame ; 0 == default */ - unsigned long long frameOSize; /* Size of uncompressed (original) content ; 0 == unknown */ + unsigned long long contentSize; /* Size of uncompressed (original) content ; 0 == unknown */ unsigned reserved[2]; /* must be zero for forward compatibility */ } LZ4F_frameInfo_t; diff --git a/programs/frametest.c b/programs/frametest.c index 2a087ec..b73cc4e 100644 --- a/programs/frametest.c +++ b/programs/frametest.c @@ -402,7 +402,7 @@ int basicTests(U32 seed, double compressibility) DISPLAYLEVEL(3, "Compressed %i bytes into a %i bytes frame \n", (int)testSize, (int)(op-ostart)); DISPLAYLEVEL(3, "compress with frameSize : \n"); - prefs.frameInfo.frameOSize = testSize; + prefs.frameInfo.contentSize = testSize; op = ostart; errorCode = LZ4F_compressBegin(cctx, compressedBuffer, testSize, &prefs); if (LZ4F_isError(errorCode)) goto _output_error; @@ -415,7 +415,7 @@ int basicTests(U32 seed, double compressibility) DISPLAYLEVEL(3, "Compressed %i bytes into a %i bytes frame \n", (int)testSize, (int)(op-ostart)); DISPLAYLEVEL(3, "compress with wrong frameSize : \n"); - prefs.frameInfo.frameOSize = testSize+1; + prefs.frameInfo.contentSize = testSize+1; op = ostart; errorCode = LZ4F_compressBegin(cctx, compressedBuffer, testSize, &prefs); if (LZ4F_isError(errorCode)) goto _output_error; @@ -594,7 +594,7 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi prefs.frameInfo.blockMode = (blockMode_t)BMId; prefs.frameInfo.blockSizeID = (blockSizeID_t)BSId; prefs.frameInfo.contentChecksumFlag = (contentChecksum_t)CCflag; - prefs.frameInfo.frameOSize = frameContentSize; + prefs.frameInfo.contentSize = frameContentSize; prefs.autoFlush = autoflush; prefs.compressionLevel = FUZ_rand(&randState) % 5; if ((FUZ_rand(&randState) & 0xF) == 1) prefsPtr = NULL; diff --git a/programs/lz4io.c b/programs/lz4io.c index f5c5e98..34d24bf 100644 --- a/programs/lz4io.c +++ b/programs/lz4io.c @@ -423,7 +423,7 @@ int LZ4IO_compressFilename(const char* input_filename, const char* output_filena if (g_contentSizeFlag) { unsigned long long fileSize = LZ4IO_GetFileSize(input_filename); - prefs.frameInfo.frameOSize = fileSize; /* == 0 if input == stdin */ + prefs.frameInfo.contentSize = fileSize; /* == 0 if input == stdin */ } /* Allocate Memory */ -- cgit v0.12