From b805d581b97be95fcc000134a54aa7c591b3ef09 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Tue, 21 Apr 2015 19:07:31 +0100 Subject: Removed obsolete functions from lz4 cli --- lib/lz4frame.c | 8 ++++---- lib/lz4hc.c | 3 ++- programs/lz4io.c | 12 +++++++++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/lz4frame.c b/lib/lz4frame.c index a70dbaf..a2b6a22 100644 --- a/lib/lz4frame.c +++ b/lib/lz4frame.c @@ -516,19 +516,19 @@ static size_t LZ4F_compressBlock(void* dst, const void* src, size_t srcSize, com static int LZ4F_localLZ4_compress_limitedOutput_withState(void* ctx, const char* src, char* dst, int srcSize, int dstSize, int level) { (void) level; - return LZ4_compress_limitedOutput_withState(ctx, src, dst, srcSize, dstSize); + return LZ4_compress_safe_extState(ctx, src, dst, srcSize, dstSize); } static int LZ4F_localLZ4_compress_limitedOutput_continue(void* ctx, const char* src, char* dst, int srcSize, int dstSize, int level) { (void) level; - return LZ4_compress_limitedOutput_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstSize); + return LZ4_compress_safe_continue((LZ4_stream_t*)ctx, src, dst, srcSize, dstSize); } static int LZ4F_localLZ4_compressHC_limitedOutput_continue(void* ctx, const char* src, char* dst, int srcSize, int dstSize, int level) { (void) level; - return LZ4_compressHC_limitedOutput_continue((LZ4_streamHC_t*)ctx, src, dst, srcSize, dstSize); + return LZ4_compressHC_safe_continue((LZ4_streamHC_t*)ctx, src, dst, srcSize, dstSize); } static compressFunc_t LZ4F_selectCompression(LZ4F_blockMode_t blockMode, int level) @@ -538,7 +538,7 @@ static compressFunc_t LZ4F_selectCompression(LZ4F_blockMode_t blockMode, int lev if (blockMode == LZ4F_blockIndependent) return LZ4F_localLZ4_compress_limitedOutput_withState; return LZ4F_localLZ4_compress_limitedOutput_continue; } - if (blockMode == LZ4F_blockIndependent) return LZ4_compressHC2_limitedOutput_withStateHC; + if (blockMode == LZ4F_blockIndependent) return LZ4_compressHC_safe_extStateHC; return LZ4F_localLZ4_compressHC_limitedOutput_continue; } diff --git a/lib/lz4hc.c b/lib/lz4hc.c index 4f1272c..909481e 100644 --- a/lib/lz4hc.c +++ b/lib/lz4hc.c @@ -673,7 +673,8 @@ int LZ4_saveDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, char* safeBuffer, int dictS * Deprecated Functions ***********************************/ /* Deprecated compression functions */ -int LZ4_compressHC(const char* source, char* dest, int inputSize) { return LZ4_compressHC2(source, dest, inputSize, 0); } +/* These functions are planned to start generate warnings by r131 approximately */ +int LZ4_compressHC(const char* src, char* dst, int srcSize) { return LZ4_compressHC_safe (src, dst, srcSize, LZ4_compressBound(srcSize), 0); } int LZ4_compressHC_limitedOutput(const char* src, char* dst, int srcSize, int maxDstSize) { return LZ4_compressHC_safe(src, dst, srcSize, maxDstSize, 0); } int LZ4_compressHC2(const char* src, char* dst, int srcSize, int cLevel) { return LZ4_compressHC_safe (src, dst, srcSize, LZ4_compressBound(srcSize), cLevel); } int LZ4_compressHC2_limitedOutput(const char* src, char* dst, int srcSize, int maxDstSize, int cLevel) { return LZ4_compressHC_safe(src, dst, srcSize, maxDstSize, cLevel); } diff --git a/programs/lz4io.c b/programs/lz4io.c index efe1fcd..88f94dd 100644 --- a/programs/lz4io.c +++ b/programs/lz4io.c @@ -322,12 +322,18 @@ static void LZ4IO_writeLE32 (void* p, unsigned value32) dstPtr[3] = (unsigned char)(value32 >> 24); } +static int LZ4IO_LZ4_compress(const char* src, char* dst, int srcSize, int dstSize, int cLevel) +{ + (void)cLevel; + return LZ4_compress_safe(src, dst, srcSize, dstSize); +} + /* LZ4IO_compressFilename_Legacy : * This function is intentionally "hidden" (not published in .h) * It generates compressed streams using the old 'legacy' format */ int LZ4IO_compressFilename_Legacy(const char* input_filename, const char* output_filename, int compressionlevel) { - int (*compressionFunction)(const char* src, char* dst, int srcSize, int dstSize); + int (*compressionFunction)(const char* src, char* dst, int srcSize, int dstSize, int cLevel); unsigned long long filesize = 0; unsigned long long compressedfilesize = MAGICNUMBER_SIZE; char* in_buff; @@ -341,7 +347,7 @@ int LZ4IO_compressFilename_Legacy(const char* input_filename, const char* output /* Init */ start = clock(); - if (compressionlevel < 3) compressionFunction = LZ4_compress_safe; else compressionFunction = LZ4_compressHC_limitedOutput; + if (compressionlevel < 3) compressionFunction = LZ4IO_LZ4_compress; else compressionFunction = LZ4_compressHC_safe; if (LZ4IO_getFiles(input_filename, output_filename, &finput, &foutput)) EXM_THROW(20, "File error"); @@ -366,7 +372,7 @@ int LZ4IO_compressFilename_Legacy(const char* input_filename, const char* output filesize += inSize; /* Compress Block */ - outSize = compressionFunction(in_buff, out_buff+4, inSize, outBuffSize); + outSize = compressionFunction(in_buff, out_buff+4, inSize, outBuffSize, compressionlevel); compressedfilesize += outSize+4; DISPLAYUPDATE(2, "\rRead : %i MB ==> %.2f%% ", (int)(filesize>>20), (double)compressedfilesize/filesize*100); -- cgit v0.12