summaryrefslogtreecommitdiffstats
path: root/programs
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2014-07-14 22:04:10 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2014-07-14 22:04:10 (GMT)
commitfbe14d128e881abb12aaf55d5ff31be0066b69ad (patch)
tree266adb51d292714d52eee37e794eaa2a61cd9437 /programs
parentd3c43d3251057da84f036c1e43fe015d2731cdd1 (diff)
downloadlz4-fbe14d128e881abb12aaf55d5ff31be0066b69ad.zip
lz4-fbe14d128e881abb12aaf55d5ff31be0066b69ad.tar.gz
lz4-fbe14d128e881abb12aaf55d5ff31be0066b69ad.tar.bz2
Modified : lz4 streaming API, strong types
Diffstat (limited to 'programs')
-rw-r--r--programs/fuzzer.c4
-rw-r--r--programs/lz4io.c20
2 files changed, 13 insertions, 11 deletions
diff --git a/programs/fuzzer.c b/programs/fuzzer.c
index f78e72d..0f74f40 100644
--- a/programs/fuzzer.c
+++ b/programs/fuzzer.c
@@ -67,7 +67,7 @@
Constants
**************************************/
#ifndef LZ4_VERSION
-# define LZ4_VERSION "rc118"
+# define LZ4_VERSION ""
#endif
#define NB_ATTEMPTS (1<<16)
@@ -527,7 +527,7 @@ int FUZ_test(U32 seed, int nbCycles, int startCycle, double compressibility) {
LZ4_compress_continue (LZ4continue, dict, compressedBuffer, dictSize); // Just to fill hash tables
blockContinueCompressedSize = LZ4_compress_continue (LZ4continue, block, compressedBuffer, blockSize);
FUZ_CHECKTEST(blockContinueCompressedSize==0, "LZ4_compress_continue failed");
- LZ4_free (LZ4continue);
+ free (LZ4continue);
// Decompress with dictionary as prefix
FUZ_DISPLAYTEST;
diff --git a/programs/lz4io.c b/programs/lz4io.c
index 7617cff..8bd10fc 100644
--- a/programs/lz4io.c
+++ b/programs/lz4io.c
@@ -202,14 +202,12 @@ int LZ4IO_setBlockSizeID(int bsid)
return blockSizeTable[globalBlockSizeId-minBlockSizeID];
}
-
int LZ4IO_setBlockMode(blockMode_t blockMode)
{
blockIndependence = (blockMode == independentBlocks);
return blockIndependence;
}
-
/* Default setting : no checksum */
int LZ4IO_setBlockChecksumMode(int xxhash)
{
@@ -217,7 +215,6 @@ int LZ4IO_setBlockChecksumMode(int xxhash)
return blockChecksum;
}
-
/* Default setting : checksum enabled */
int LZ4IO_setStreamChecksumMode(int xxhash)
{
@@ -225,7 +222,6 @@ int LZ4IO_setStreamChecksumMode(int xxhash)
return streamChecksum;
}
-
/* Default setting : 0 (no notification) */
int LZ4IO_setNotificationLevel(int level)
{
@@ -367,7 +363,7 @@ int LZ4IO_compressFilename_Legacy(char* input_filename, char* output_filename, i
static void* LZ4IO_LZ4_createStream (const char* inputBuffer)
{
(void)inputBuffer;
- return LZ4_createStream();
+ return calloc(4, LZ4_STREAMSIZE_U32);
}
static int LZ4IO_LZ4_compress_limitedOutput_continue (void* ctx, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel)
@@ -389,6 +385,12 @@ static int LZ4IO_LZ4_slideInputBufferHC (void* ctx, char* buffer, int size)
}
+static int LZ4IO_free (void* ptr)
+{
+ free(ptr);
+ return 0;
+}
+
static int compress_file_blockDependency(char* input_filename, char* output_filename, int compressionlevel)
{
void* (*initFunction) (const char*);
@@ -417,14 +419,14 @@ static int compress_file_blockDependency(char* input_filename, char* output_file
initFunction = LZ4IO_LZ4_createStream;
compressionFunction = LZ4IO_LZ4_compress_limitedOutput_continue;
nextBlockFunction = LZ4IO_LZ4_saveDict;
- freeFunction = LZ4_free;
+ freeFunction = LZ4IO_free;
}
else
{
initFunction = LZ4_createHC;
compressionFunction = LZ4_compressHC2_limitedOutput_continue;
nextBlockFunction = LZ4IO_LZ4_slideInputBufferHC;
- freeFunction = LZ4_free;
+ freeFunction = LZ4IO_free;
}
get_fileHandle(input_filename, output_filename, &finput, &foutput);
@@ -753,7 +755,7 @@ static unsigned long long decodeLZ4S(FILE* finput, FILE* foutput)
size_t sizeCheck;
int blockChecksumFlag, streamChecksumFlag, blockIndependenceFlag;
void* streamChecksumState=NULL;
- int (*decompressionFunction)(void* ctx, const char* src, char* dst, int cSize, int maxOSize) = LZ4_decompress_safe_continue;
+ int (*decompressionFunction)(LZ4_streamDecode_t* ctx, const char* src, char* dst, int cSize, int maxOSize) = LZ4_decompress_safe_continue;
LZ4_streamDecode_t ctx;
// init
@@ -845,7 +847,7 @@ static unsigned long long decodeLZ4S(FILE* finput, FILE* foutput)
{
// handle dictionary for streaming
memcpy(in_buff + blockSize - 64 KB, out_buff, 64 KB);
- LZ4_setDictDecode(&ctx, out_buff, 64 KB);
+ LZ4_setStreamDecode(&ctx, out_buff, 64 KB);
out_start = out_buff + 64 KB;
}
}