summaryrefslogtreecommitdiffstats
path: root/programs
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
parent72e679438f9ead31e671e0738b7730f846ebde70 (diff)
downloadlz4-f11afafe234ea45a6d80f8b21df1d603ace4e025.zip
lz4-f11afafe234ea45a6d80f8b21df1d603ace4e025.tar.gz
lz4-f11afafe234ea45a6d80f8b21df1d603ace4e025.tar.bz2
Removed LZ4_compress() (obsolete) from lz4
Diffstat (limited to 'programs')
-rw-r--r--programs/bench.c10
-rw-r--r--programs/lz4io.c12
2 files changed, 11 insertions, 11 deletions
diff --git a/programs/bench.c b/programs/bench.c
index d3b060c..384a425 100644
--- a/programs/bench.c
+++ b/programs/bench.c
@@ -58,9 +58,9 @@
#include "lz4.h"
#define COMPRESSOR0 LZ4_compress_local
-static int LZ4_compress_local(const char* src, char* dst, int size, int clevel) { (void)clevel; return LZ4_compress(src, dst, size); }
+static int LZ4_compress_local(const char* src, char* dst, int srcSize, int dstSize, int clevel) { (void)clevel; return LZ4_compress_safe(src, dst, srcSize, dstSize); }
#include "lz4hc.h"
-#define COMPRESSOR1 LZ4_compressHC2
+#define COMPRESSOR1 LZ4_compressHC_safe
#define DEFAULTCOMPRESSOR COMPRESSOR0
#include "xxhash.h"
@@ -121,8 +121,8 @@ struct chunkParameters
struct compressionParameters
{
- int (*compressionFunction)(const char*, char*, int, int);
- int (*decompressionFunction)(const char*, char*, int);
+ int (*compressionFunction)(const char* src, char* dst, int srcSize, int dstSize, int cLevel);
+ int (*decompressionFunction)(const char* src, char* dst, int dstSize);
};
@@ -371,7 +371,7 @@ int BMK_benchFiles(const char** fileNamesTable, int nbFiles, int cLevel)
while(BMK_GetMilliSpan(milliTime) < TIMELOOP)
{
for (chunkNb=0; chunkNb<nbChunks; chunkNb++)
- chunkP[chunkNb].compressedSize = compP.compressionFunction(chunkP[chunkNb].origBuffer, chunkP[chunkNb].compressedBuffer, chunkP[chunkNb].origSize, cLevel);
+ chunkP[chunkNb].compressedSize = compP.compressionFunction(chunkP[chunkNb].origBuffer, chunkP[chunkNb].compressedBuffer, chunkP[chunkNb].origSize, maxCompressedChunkSize, cLevel);
nbLoops++;
}
milliTime = BMK_GetMilliSpan(milliTime);
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);