summaryrefslogtreecommitdiffstats
path: root/programs/lz4io.c
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2015-04-21 17:31:35 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2015-04-21 17:31:35 (GMT)
commitf11afafe234ea45a6d80f8b21df1d603ace4e025 (patch)
tree1a8b6b7e38a9bdb6da6878adfd5b8ad4079c4ce6 /programs/lz4io.c
parent72e679438f9ead31e671e0738b7730f846ebde70 (diff)
downloadlz4-f11afafe234ea45a6d80f8b21df1d603ace4e025.zip
lz4-f11afafe234ea45a6d80f8b21df1d603ace4e025.tar.gz
lz4-f11afafe234ea45a6d80f8b21df1d603ace4e025.tar.bz2
Removed LZ4_compress() (obsolete) from lz4
Diffstat (limited to 'programs/lz4io.c')
-rw-r--r--programs/lz4io.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/programs/lz4io.c b/programs/lz4io.c
index 40bdbb7..efe1fcd 100644
--- a/programs/lz4io.c
+++ b/programs/lz4io.c
@@ -327,11 +327,12 @@ static void LZ4IO_writeLE32 (void* p, unsigned value32)
* 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*, char*, int);
+ int (*compressionFunction)(const char* src, char* dst, int srcSize, int dstSize);
unsigned long long filesize = 0;
unsigned long long compressedfilesize = MAGICNUMBER_SIZE;
char* in_buff;
char* out_buff;
+ const int outBuffSize = LZ4_compressBound(LEGACY_BLOCKSIZE);
FILE* finput;
FILE* foutput;
clock_t start, end;
@@ -340,15 +341,14 @@ int LZ4IO_compressFilename_Legacy(const char* input_filename, const char* output
/* Init */
start = clock();
- if (compressionlevel < 3) compressionFunction = LZ4_compress; else compressionFunction = LZ4_compressHC;
+ if (compressionlevel < 3) compressionFunction = LZ4_compress_safe; else compressionFunction = LZ4_compressHC_limitedOutput;
if (LZ4IO_getFiles(input_filename, output_filename, &finput, &foutput))
EXM_THROW(20, "File error");
- if ((g_displayLevel==2) && (compressionlevel==1)) g_displayLevel=3;
/* Allocate Memory */
in_buff = (char*)malloc(LEGACY_BLOCKSIZE);
- out_buff = (char*)malloc(LZ4_compressBound(LEGACY_BLOCKSIZE));
+ out_buff = (char*)malloc(outBuffSize);
if (!in_buff || !out_buff) EXM_THROW(21, "Allocation error : not enough memory");
/* Write Archive Header */
@@ -366,9 +366,9 @@ int LZ4IO_compressFilename_Legacy(const char* input_filename, const char* output
filesize += inSize;
/* Compress Block */
- outSize = compressionFunction(in_buff, out_buff+4, inSize);
+ outSize = compressionFunction(in_buff, out_buff+4, inSize, outBuffSize);
compressedfilesize += outSize+4;
- DISPLAYUPDATE(3, "\rRead : %i MB ==> %.2f%% ", (int)(filesize>>20), (double)compressedfilesize/filesize*100);
+ DISPLAYUPDATE(2, "\rRead : %i MB ==> %.2f%% ", (int)(filesize>>20), (double)compressedfilesize/filesize*100);
/* Write Block */
LZ4IO_writeLE32(out_buff, outSize);