summaryrefslogtreecommitdiffstats
path: root/programs
diff options
context:
space:
mode:
Diffstat (limited to 'programs')
-rw-r--r--programs/bench.c11
-rw-r--r--programs/bench.h17
-rw-r--r--programs/datagen.c4
-rw-r--r--programs/frametest.c11
-rw-r--r--[-rwxr-xr-x]programs/fullbench.c2
-rw-r--r--programs/fuzzer.c2
-rw-r--r--programs/lz4cli.c29
-rw-r--r--programs/lz4io.c178
-rw-r--r--programs/lz4io.h6
9 files changed, 37 insertions, 223 deletions
diff --git a/programs/bench.c b/programs/bench.c
index 77120f2..0ed7fcb 100644
--- a/programs/bench.c
+++ b/programs/bench.c
@@ -1,6 +1,7 @@
/*
- bench.c - Demo program to benchmark open-source compression algorithm
+ bench.c - Demo program to benchmark open-source compression algorithms
Copyright (C) Yann Collet 2012-2015
+
GPL v2 License
This program is free software; you can redistribute it and/or modify
@@ -141,15 +142,15 @@ static int chunkSize = DEFAULT_CHUNKSIZE;
static int nbIterations = NBLOOPS;
static int BMK_pause = 0;
-void BMK_SetBlocksize(int bsize) { chunkSize = bsize; }
+void BMK_setBlocksize(int bsize) { chunkSize = bsize; }
-void BMK_SetNbIterations(int nbLoops)
+void BMK_setNbIterations(int nbLoops)
{
nbIterations = nbLoops;
DISPLAY("- %i iterations -\n", nbIterations);
}
-void BMK_SetPause(void) { BMK_pause = 1; }
+void BMK_setPause(void) { BMK_pause = 1; }
/*********************************************************
@@ -234,7 +235,7 @@ static U64 BMK_GetFileSize(const char* infilename)
* Public function
**********************************************************/
-int BMK_benchFile(const char** fileNamesTable, int nbFiles, int cLevel)
+int BMK_benchFiles(const char** fileNamesTable, int nbFiles, int cLevel)
{
int fileIdx=0;
char* orig_buff;
diff --git a/programs/bench.h b/programs/bench.h
index 2a20cdb..3231727 100644
--- a/programs/bench.h
+++ b/programs/bench.h
@@ -22,21 +22,12 @@
*/
#pragma once
-#if defined (__cplusplus)
-extern "C" {
-#endif
-
/* Main function */
-int BMK_benchFile(const char** fileNamesTable, int nbFiles, int cLevel);
+int BMK_benchFiles(const char** fileNamesTable, int nbFiles, int cLevel);
/* Set Parameters */
-void BMK_SetBlocksize(int bsize);
-void BMK_SetNbIterations(int nbLoops);
-void BMK_SetPause(void);
-
-
+void BMK_setBlocksize(int bsize);
+void BMK_setNbIterations(int nbLoops);
+void BMK_setPause(void);
-#if defined (__cplusplus)
-}
-#endif
diff --git a/programs/datagen.c b/programs/datagen.c
index 2a10b81..743691e 100644
--- a/programs/datagen.c
+++ b/programs/datagen.c
@@ -90,7 +90,7 @@ static unsigned int RDG_rand(U32* src)
#define LTMASK (LTSIZE-1)
static void* RDG_createLiteralDistrib(double ld)
{
- BYTE* lt = malloc(LTSIZE);
+ BYTE* lt = (BYTE*)malloc(LTSIZE);
U32 i = 0;
BYTE character = '0';
BYTE firstChar = '(';
@@ -117,7 +117,7 @@ static void* RDG_createLiteralDistrib(double ld)
static char RDG_genChar(U32* seed, const void* ltctx)
{
- const BYTE* lt = ltctx;
+ const BYTE* lt = (const BYTE*)ltctx;
U32 id = RDG_rand(seed) & LTMASK;
return lt[id];
}
diff --git a/programs/frametest.c b/programs/frametest.c
index a5a23c2..df37e5f 100644
--- a/programs/frametest.c
+++ b/programs/frametest.c
@@ -229,11 +229,12 @@ int basicTests(U32 seed, double compressibility)
void* decodedBuffer;
U32 randState = seed;
size_t cSize, testSize;
- LZ4F_preferences_t prefs = { 0 };
+ LZ4F_preferences_t prefs;
LZ4F_decompressionContext_t dCtx;
U64 crcOrig;
// Create compressible test buffer
+ memset(&prefs, 0, sizeof(prefs));
CNBuffer = malloc(COMPRESSIBLE_NOISE_LENGTH);
compressedBuffer = malloc(LZ4F_compressFrameBound(COMPRESSIBLE_NOISE_LENGTH, NULL));
decodedBuffer = malloc(COMPRESSIBLE_NOISE_LENGTH);
@@ -441,7 +442,7 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi
unsigned BMId = FUZ_rand(&randState) & 1;
unsigned CCflag = FUZ_rand(&randState) & 1;
unsigned autoflush = (FUZ_rand(&randState) & 7) == 2;
- LZ4F_preferences_t prefs = { 0 };
+ LZ4F_preferences_t prefs;
LZ4F_compressOptions_t cOptions = { 0 };
LZ4F_decompressOptions_t dOptions = { 0 };
unsigned nbBits = (FUZ_rand(&randState) % (FUZ_highbit(srcDataLength-1) - 1)) + 1;
@@ -452,6 +453,7 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi
LZ4F_preferences_t* prefsPtr = &prefs;
(void)FUZ_rand(&coreRand); // update rand seed
+ memset(&prefs, 0, sizeof(prefs));
prefs.frameInfo.blockMode = (blockMode_t)BMId;
prefs.frameInfo.blockSizeID = (blockSizeID_t)BSId;
prefs.frameInfo.contentChecksumFlag = (contentChecksum_t)CCflag;
@@ -523,17 +525,14 @@ int fuzzerTests(U32 seed, unsigned nbTests, unsigned startTest, double compressi
if (oSize > (size_t)(oend-op)) oSize = oend-op;
dOptions.stableDst = FUZ_rand(&randState) & 1;
if (nonContiguousDst==2) dOptions.stableDst = 0;
- //if (ip == compressedBuffer+62073) DISPLAY("oSize : %i : pos %i \n", (int)oSize, (int)(op-(BYTE*)decodedBuffer));
result = LZ4F_decompress(dCtx, op, &oSize, ip, &iSize, &dOptions);
- //if (op+oSize >= (BYTE*)decodedBuffer+94727) DISPLAY("iSize : %i : pos %i \n", (int)iSize, (int)(ip-(BYTE*)compressedBuffer));
- //if ((int)result<0) DISPLAY("iSize : %i : pos %i \n", (int)iSize, (int)(ip-(BYTE*)compressedBuffer));
if (result == (size_t)-ERROR_checksum_invalid) locateBuffDiff((BYTE*)srcBuffer+srcStart, decodedBuffer, srcSize, nonContiguousDst);
CHECK(LZ4F_isError(result), "Decompression failed (error %i:%s)", (int)result, LZ4F_getErrorName((LZ4F_errorCode_t)result));
XXH64_update(&xxh64, op, (U32)oSize);
op += oSize;
ip += iSize;
op += nonContiguousDst;
- if (nonContiguousDst==2) op = decodedBuffer; // overwritten destination
+ if (nonContiguousDst==2) op = (BYTE*)decodedBuffer; /* overwritten destination */
}
CHECK(result != 0, "Frame decompression failed (error %i)", (int)result);
crcDecoded = XXH64_digest(&xxh64);
diff --git a/programs/fullbench.c b/programs/fullbench.c
index 756357a..6ae28d7 100755..100644
--- a/programs/fullbench.c
+++ b/programs/fullbench.c
@@ -687,7 +687,7 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles)
milliTime = BMK_GetMilliStart();
while(BMK_GetMilliSpan(milliTime) < TIMELOOP)
{
- if (initFunction!=NULL) ctx = initFunction(chunkP[0].origBuffer);
+ if (initFunction!=NULL) ctx = (LZ4_stream_t*)initFunction(chunkP[0].origBuffer);
for (chunkNb=0; chunkNb<nbChunks; chunkNb++)
{
chunkP[chunkNb].compressedSize = compressionFunction(chunkP[chunkNb].origBuffer, chunkP[chunkNb].compressedBuffer, chunkP[chunkNb].origSize);
diff --git a/programs/fuzzer.c b/programs/fuzzer.c
index f9467d9..ee2beb8 100644
--- a/programs/fuzzer.c
+++ b/programs/fuzzer.c
@@ -323,6 +323,7 @@ static int FUZ_test(U32 seed, const U32 nbCycles, const U32 startCycle, const do
U32 crcOrig, crcCheck;
U32 coreRandState = seed;
U32 randState = coreRandState ^ PRIME3;
+ int result = 0;
// init
@@ -688,7 +689,6 @@ static int FUZ_test(U32 seed, const U32 nbCycles, const U32 startCycle, const do
// unalloc
{
- int result = 0;
_exit:
free(CNBuffer);
free(compressedBuffer);
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index 0a4d71d..10b980f 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -83,11 +83,6 @@
/*****************************
* Constants
******************************/
-#if defined(LZ4IO_ENABLE_SPARSE_FILE)
-# undef LZ4_VERSION
-# define LZ4_VERSION "EXPERIMENTAL_SPARSE_FILE"
-#endif
-
#define COMPRESSOR_NAME "LZ4 command line interface"
#ifndef LZ4_VERSION
# define LZ4_VERSION "r128"
@@ -192,10 +187,6 @@ static int usage_advanced(void)
DISPLAY( " -y : overwrite output without prompting \n");
DISPLAY( " -s : suppress warnings \n");
#endif /* ENABLE_LZ4C_LEGACY_OPTIONS */
-#if defined(LZ4IO_ENABLE_SPARSE_FILE)
- DISPLAY( "Experimental : Sparse file\n");
- DISPLAY( " -x : enable sparse file\n");
-#endif /* LZ4IO_ENABLE_SPARSE_FILE */
EXTENDED_HELP;
return 0;
}
@@ -288,9 +279,6 @@ int main(int argc, char** argv)
/* Init */
programName = argv[0];
LZ4IO_setOverwrite(0);
-#if defined(LZ4IO_ENABLE_SPARSE_FILE)
- LZ4IO_setSparseFile(0);
-#endif /* LZ4IO_ENABLE_SPARSE_FILE */
blockSize = LZ4IO_setBlockSizeID(LZ4_BLOCKSIZEID_DEFAULT);
/* lz4cat predefined behavior */
@@ -387,7 +375,7 @@ int main(int argc, char** argv)
{
int B = argument[1] - '0';
blockSize = LZ4IO_setBlockSizeID(B);
- BMK_SetBlocksize(blockSize);
+ BMK_setBlocksize(blockSize);
argument++;
break;
}
@@ -405,13 +393,13 @@ int main(int argc, char** argv)
/* Benchmark */
case 'b': bench=1; multiple_inputs=1;
if (inFileNames == NULL)
- inFileNames = malloc(argc * sizeof(char*));
+ inFileNames = (const char**) malloc(argc * sizeof(char*));
break;
/* Treat non-option args as input files. See https://code.google.com/p/lz4/issues/detail?id=151 */
case 'm': multiple_inputs=1;
if (inFileNames == NULL)
- inFileNames = malloc(argc * sizeof(char*));
+ inFileNames = (const char**) malloc(argc * sizeof(char*));
break;
/* Modify Nb Iterations (benchmark only) */
@@ -419,18 +407,13 @@ int main(int argc, char** argv)
if ((argument[1] >='1') && (argument[1] <='9'))
{
int iters = argument[1] - '0';
- BMK_SetNbIterations(iters);
+ BMK_setNbIterations(iters);
argument++;
}
break;
/* Pause at the end (hidden option) */
- case 'p': main_pause=1; BMK_SetPause(); break;
-
-#if defined(LZ4IO_ENABLE_SPARSE_FILE)
- /* Experimental : Enable sparse file */
- case 'x': LZ4IO_setSparseFile(1); break;
-#endif /* LZ4IO_ENABLE_SPARSE_FILE */
+ case 'p': main_pause=1; BMK_setPause(); break;
/* Specific commands for customized versions */
EXTENDED_ARGUMENTS;
@@ -471,7 +454,7 @@ int main(int argc, char** argv)
if (!strcmp(input_filename, stdinmark) && IS_CONSOLE(stdin) ) badusage();
/* Check if benchmark is selected */
- if (bench) return BMK_benchFile(inFileNames, ifnIdx, cLevel);
+ if (bench) return BMK_benchFiles(inFileNames, ifnIdx, cLevel);
/* No output filename ==> try to select one automatically (when possible) */
while (!output_filename)
diff --git a/programs/lz4io.c b/programs/lz4io.c
index 9d5bee5..fd98247 100644
--- a/programs/lz4io.c
+++ b/programs/lz4io.c
@@ -39,20 +39,15 @@
#endif
#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
-#ifdef __GNUC__
-# pragma GCC diagnostic ignored "-Wmissing-braces" /* GCC bug 53119 : doesn't accept { 0 } as initializer (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119) */
-# pragma GCC diagnostic ignored "-Wmissing-field-initializers" /* GCC bug 53119 : doesn't accept { 0 } as initializer (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119) */
-#endif
#define _LARGE_FILES /* Large file support on 32-bits AIX */
#define _FILE_OFFSET_BITS 64 /* Large file support on 32-bits unix */
-#define _POSIX_SOURCE 1 /* for fileno() within <stdio.h> on unix */
/****************************
* Includes
*****************************/
-#include <stdio.h> /* fprintf, fopen, fread, _fileno, stdin, stdout */
+#include <stdio.h> /* fprintf, fopen, fread, stdin, stdout */
#include <stdlib.h> /* malloc, free */
#include <string.h> /* strcmp, strlen */
#include <time.h> /* clock */
@@ -62,55 +57,18 @@
#include "lz4frame.h"
-/**************************************
- Basic Types
-**************************************/
-#if defined(LZ4IO_ENABLE_SPARSE_FILE)
-#if defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */
-# include <stdint.h>
- typedef uint8_t BYTE;
- typedef uint16_t U16;
- typedef uint32_t U32;
- typedef int32_t S32;
- typedef uint64_t U64;
-#else
- typedef unsigned char BYTE;
- typedef unsigned short U16;
- typedef unsigned int U32;
- typedef signed int S32;
- typedef unsigned long long U64;
-#endif
-#endif /* LZ4IO_ENABLE_SPARSE_FILE */
-
-
/****************************
* OS-specific Includes
*****************************/
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
# include <fcntl.h> /* _O_BINARY */
-# include <io.h> /* _setmode, _isatty */
-# ifdef __MINGW32__
- int _fileno(FILE *stream); /* MINGW somehow forgets to include this windows declaration into <stdio.h> */
-# endif
+# include <io.h> /* _setmode, _fileno */
+# define SET_BINARY_MODE(file) _setmode(_fileno(file), _O_BINARY)
# if defined(_MSC_VER) && (_MSC_VER >= 1400) /* Avoid MSVC fseek()'s 2GiB barrier */
# define fseek _fseeki64
# endif
-# define SET_BINARY_MODE(file) _setmode(_fileno(file), _O_BINARY)
-# define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream))
-# if defined(LZ4IO_ENABLE_SPARSE_FILE)
-# include <windows.h>
-# define SET_SPARSE_FILE_MODE(file) do { DWORD dw; DeviceIoControl((HANDLE) _get_osfhandle(_fileno(file)), FSCTL_SET_SPARSE, 0, 0, 0, 0, &dw, 0); } while(0)
-# if defined(_MSC_VER) && (_MSC_VER >= 1400)
-# define fseek _fseeki64
-# endif
-# endif /* LZ4IO_ENABLE_SPARSE_FILE */
#else
-# include <unistd.h> /* isatty */
# define SET_BINARY_MODE(file)
-# define IS_CONSOLE(stdStream) isatty(fileno(stdStream))
-# if defined(LZ4IO_ENABLE_SPARSE_FILE)
-# define SET_SPARSE_FILE_MODE(file)
-# endif /* LZ4IO_ENABLE_SPARSE_FILE */
#endif
@@ -164,9 +122,6 @@ static int globalBlockSizeId = LZ4S_BLOCKSIZEID_DEFAULT;
static int blockChecksum = 0;
static int streamChecksum = 1;
static int blockIndependence = 1;
-#if defined(LZ4IO_ENABLE_SPARSE_FILE)
-static int sparseFile = 0;
-#endif /* LZ4IO_ENABLE_SPARSE_FILE */
static const int minBlockSizeID = 4;
static const int maxBlockSizeID = 7;
@@ -193,7 +148,6 @@ static const int maxBlockSizeID = 7;
#define EXTENDED_ARGUMENTS
#define EXTENDED_HELP
#define EXTENDED_FORMAT
-#define DEFAULT_COMPRESSOR compress_file
#define DEFAULT_DECOMPRESSOR decodeLZ4S
@@ -208,75 +162,6 @@ int LZ4IO_setOverwrite(int yes)
return overwrite;
}
-#if defined(LZ4IO_ENABLE_SPARSE_FILE)
-/* Default setting : sparseFile = 0; (Disable)
- return : sparse file mode (0:Disable / 1:Enable) */
-int LZ4IO_setSparseFile(int yes)
-{
- sparseFile = yes;
- return sparseFile;
-}
-
-static int isSparse(const void* p, size_t size)
-{
-#if 0
- /* naive */
- const char* p8 = p;
- for(; size; --size)
- {
- if(*p8 != 0)
- {
- return 0;
- }
- ++p8;
- }
- return 1;
-#elif 0
- /* xz method */
- const U64* p64 = (const U64*) p;
- const char* p8 = (const char*) p;
- const size_t n = size / sizeof(*p64);
- size_t i;
-
- for (i = 0; i < n; ++i)
- {
- if (p64[i] != 0)
- {
- return 0;
- }
- }
-
- for(i = n * sizeof(*p64); i < size; ++i)
- {
- if (p8[i] != 0)
- {
- return 0;
- }
- }
-
- return 1;
-#elif 0
- /* Neil's */
- const char* buf = (const char*) p;
- return buf[0] == 0 && !memcmp(buf, buf + 1, size - 1);
-#else
- /* GNU Core Utilities : coreutils/src/system.h / is_nul() */
- const U64* wp = (const U64*) p;
- const char* cbuf = (const char*) p;
- const char* cp;
-
- // Find first nonzero *word*, or the word with the sentinel.
- while(*wp++ == 0) ;
-
- // Find the first nonzero *byte*, or the sentinel.
- cp = (const char*) (wp - 1);
- while(*cp++ == 0) ;
-
- return cbuf + size < cp;
-#endif
-}
-#endif /* LZ4IO_ENABLE_SPARSE_FILE */
-
/* blockSizeID : valid values : 4-5-6-7 */
int LZ4IO_setBlockSizeID(int bsid)
{
@@ -386,7 +271,7 @@ static int get_fileHandle(const char* input_filename, const char* output_filenam
/* unoptimized version; solves endianess & alignment issues */
static void LZ4IO_writeLE32 (void* p, unsigned value32)
{
- unsigned char* dstPtr = p;
+ unsigned char* dstPtr = (unsigned char*)p;
dstPtr[0] = (unsigned char)value32;
dstPtr[1] = (unsigned char)(value32 >> 8);
dstPtr[2] = (unsigned char)(value32 >> 16);
@@ -483,11 +368,12 @@ int LZ4IO_compressFilename(const char* input_filename, const char* output_filena
size_t sizeCheck, headerSize, readSize, outBuffSize;
LZ4F_compressionContext_t ctx;
LZ4F_errorCode_t errorCode;
- LZ4F_preferences_t prefs = {0};
+ LZ4F_preferences_t prefs;
/* Init */
start = clock();
+ memset(&prefs, 0, sizeof(prefs));
if ((displayLevel==2) && (compressionLevel>=3)) displayLevel=3;
errorCode = LZ4F_createCompressionContext(&ctx, LZ4F_VERSION);
if (LZ4F_isError(errorCode)) EXM_THROW(30, "Allocation error : can't create LZ4F context : %s", LZ4F_getErrorName(errorCode));
@@ -497,9 +383,9 @@ int LZ4IO_compressFilename(const char* input_filename, const char* output_filena
/* Set compression parameters */
prefs.autoFlush = 1;
prefs.compressionLevel = compressionLevel;
- prefs.frameInfo.blockMode = blockIndependence;
- prefs.frameInfo.blockSizeID = globalBlockSizeId;
- prefs.frameInfo.contentChecksumFlag = streamChecksum;
+ prefs.frameInfo.blockMode = (blockMode_t)blockIndependence;
+ prefs.frameInfo.blockSizeID = (blockSizeID_t)globalBlockSizeId;
+ prefs.frameInfo.contentChecksumFlag = (contentChecksum_t)streamChecksum;
/* Allocate Memory */
in_buff = (char*)malloc(blockSize);
@@ -578,7 +464,7 @@ int LZ4IO_compressMultipleFilenames(const char** inFileNamesTable, int ifntSize,
for (i=0; i<ifntSize; i++)
{
size_t ifnSize = strlen(inFileNamesTable[i]);
- if (ofnSize <= ifnSize+suffixSize+1) { free(outFileName); ofnSize = ifnSize + 20; outFileName = malloc(ofnSize); }
+ if (ofnSize <= ifnSize+suffixSize+1) { free(outFileName); ofnSize = ifnSize + 20; outFileName = (char*)malloc(ofnSize); }
strcpy(outFileName, inFileNamesTable[i]);
strcat(outFileName, suffix);
LZ4IO_compressFilename(inFileNamesTable[i], outFileName, compressionlevel);
@@ -595,7 +481,7 @@ int LZ4IO_compressMultipleFilenames(const char** inFileNamesTable, int ifntSize,
static unsigned LZ4IO_readLE32 (const void* s)
{
- const unsigned char* srcPtr = s;
+ const unsigned char* srcPtr = (const unsigned char*)s;
unsigned value32 = srcPtr[0];
value32 += (srcPtr[1]<<8);
value32 += (srcPtr[2]<<16);
@@ -663,9 +549,6 @@ static unsigned long long decodeLZ4S(FILE* finput, FILE* foutput)
LZ4F_decompressionContext_t ctx;
LZ4F_errorCode_t errorCode;
LZ4F_frameInfo_t frameInfo;
-#if defined(LZ4IO_ENABLE_SPARSE_FILE)
- size_t sparsePending = 0;
-#endif /* LZ4IO_ENABLE_SPARSE_FILE */
/* init */
errorCode = LZ4F_createDecompressionContext(&ctx, LZ4F_VERSION);
@@ -687,12 +570,7 @@ static unsigned long long decodeLZ4S(FILE* finput, FILE* foutput)
outBuffSize = LZ4IO_setBlockSizeID(frameInfo.blockSizeID);
inBuffSize = outBuffSize + 4;
inBuff = (char*)malloc(inBuffSize);
-#if defined(LZ4IO_ENABLE_SPARSE_FILE)
- outBuff = (char*)malloc(outBuffSize+sizeof(U64));
- *(U64*) &outBuff[outBuffSize] = (U64) -1; /* sentinel */
-#else /* LZ4IO_ENABLE_SPARSE_FILE */
outBuff = (char*)malloc(outBuffSize);
-#endif /* LZ4IO_ENABLE_SPARSE_FILE */
if (!inBuff || !outBuff) EXM_THROW(65, "Allocation error : not enough memory");
/* Main Loop */
@@ -712,35 +590,9 @@ static unsigned long long decodeLZ4S(FILE* finput, FILE* foutput)
filesize += decodedBytes;
/* Write Block */
-#if defined(LZ4IO_ENABLE_SPARSE_FILE)
- if(sparseFile)
- {
- if(isSparse(outBuff, decodedBytes))
- {
- sparsePending += decodedBytes;
- continue;
- }
- if(sparsePending > 0)
- {
- fseek(foutput, sparsePending, SEEK_CUR);
- sparsePending = 0;
- }
- }
-#endif /* LZ4IO_ENABLE_SPARSE_FILE */
sizeCheck = fwrite(outBuff, 1, decodedBytes, foutput);
if (sizeCheck != decodedBytes) EXM_THROW(68, "Write error : cannot write decoded block\n");
}
-#if defined(LZ4IO_ENABLE_SPARSE_FILE)
- if(sparseFile)
- {
- if(sparsePending > 0)
- {
- fseek(foutput, sparsePending-1, SEEK_CUR);
- fputc(0, foutput);
- sparsePending = 0;
- }
- }
-#endif /* LZ4IO_ENABLE_SPARSE_FILE */
/* Free */
free(inBuff);
@@ -803,14 +655,6 @@ int LZ4IO_decompressFilename(const char* input_filename, const char* output_file
start = clock();
get_fileHandle(input_filename, output_filename, &finput, &foutput);
-#if defined(LZ4IO_ENABLE_SPARSE_FILE)
- if (sparseFile!=0 && foutput!=0)
- {
- DISPLAY("Experimental : Using sparse file\n");
- SET_SPARSE_FILE_MODE(foutput);
- }
-#endif /* LZ4IO_ENABLE_SPARSE_FILE */
-
/* Loop over multiple streams */
do
{
diff --git a/programs/lz4io.h b/programs/lz4io.h
index 1c9b837..f99e8bb 100644
--- a/programs/lz4io.h
+++ b/programs/lz4io.h
@@ -29,6 +29,7 @@
- The license of this source file is GPLv2.
*/
+#pragma once
/* ************************************************** */
/* Special input/output values */
@@ -77,8 +78,3 @@ int LZ4IO_setStreamChecksumMode(int xxhash);
/* Default setting : 0 (no notification) */
int LZ4IO_setNotificationLevel(int level);
-
-#if defined(LZ4IO_ENABLE_SPARSE_FILE)
-/* Default setting : 0 (sparseFile = 0; disable sparse file) */
-int LZ4IO_setSparseFile(int yes);
-#endif