summaryrefslogtreecommitdiffstats
path: root/programs
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2014-11-30 12:54:04 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2014-11-30 12:54:04 (GMT)
commitdee47d11be17aec91a16a6381ea321b4d79f4200 (patch)
treee478b0dde6dc6f5d301078b6051c0c87e05a4046 /programs
parent73554386ed8c9b08940411c0e62bbdca3216f8cd (diff)
parentd0a6cccf75e147301b430a43bc9e591fdd80fce9 (diff)
downloadlz4-dee47d11be17aec91a16a6381ea321b4d79f4200.zip
lz4-dee47d11be17aec91a16a6381ea321b4d79f4200.tar.gz
lz4-dee47d11be17aec91a16a6381ea321b4d79f4200.tar.bz2
Merge pull request #36 from Cyan4973/AlignEndian
Align endian
Diffstat (limited to 'programs')
-rw-r--r--programs/Makefile16
-rw-r--r--programs/frametest.c2
-rw-r--r--programs/fullbench.c20
-rw-r--r--programs/lz4cli.c17
-rw-r--r--programs/lz4io.c2
5 files changed, 30 insertions, 27 deletions
diff --git a/programs/Makefile b/programs/Makefile
index 1d7e17f..8a3ed95 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -30,7 +30,7 @@
# fullbench32: Same as fullbench, but forced to compile in 32-bits mode
# ##########################################################################
-RELEASE=r124
+RELEASE=r125
DESTDIR?=
PREFIX ?= /usr
@@ -113,9 +113,9 @@ ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU))
install: lz4 lz4c
@echo Installing binaries
@install -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/
- @install -m 755 lz4 $(DESTDIR)$(BINDIR)/lz4
- @ln -sf lz4 $(DESTDIR)$(BINDIR)/lz4cat
- @install -m 755 lz4c $(DESTDIR)$(BINDIR)/lz4c
+ @install -m 755 lz4$(EXT) $(DESTDIR)$(BINDIR)/lz4$(EXT)
+ @ln -sf lz4$(EXT) $(DESTDIR)$(BINDIR)/lz4cat
+ @install -m 755 lz4c$(EXT) $(DESTDIR)$(BINDIR)/lz4c$(EXT)
@echo Installing man pages
@install -m 644 lz4.1 $(DESTDIR)$(MANDIR)/lz4.1
@install -m 644 lz4c.1 $(DESTDIR)$(MANDIR)/lz4c.1
@@ -124,12 +124,12 @@ install: lz4 lz4c
uninstall:
rm -f $(DESTDIR)$(BINDIR)/lz4cat
- [ -x $(DESTDIR)$(BINDIR)/lz4 ] && rm -f $(DESTDIR)$(BINDIR)/lz4
- [ -x $(DESTDIR)$(BINDIR)/lz4c ] && rm -f $(DESTDIR)$(BINDIR)/lz4c
+ [ -x $(DESTDIR)$(BINDIR)/lz4$(EXT) ] && rm -f $(DESTDIR)$(BINDIR)/lz4$(EXT)
+ [ -x $(DESTDIR)$(BINDIR)/lz4c$(EXT) ] && rm -f $(DESTDIR)$(BINDIR)/lz4c$(EXT)
[ -f $(DESTDIR)$(MANDIR)/lz4.1 ] && rm -f $(DESTDIR)$(MANDIR)/lz4.1
[ -f $(DESTDIR)$(MANDIR)/lz4c.1 ] && rm -f $(DESTDIR)$(MANDIR)/lz4c.1
[ -f $(DESTDIR)$(MANDIR)/lz4cat.1 ] && rm -f $(DESTDIR)$(MANDIR)/lz4cat.1
- @echo lz4 successfully uninstalled
+ @echo lz4 programs successfully uninstalled
test: test-lz4 test-lz4c test-frametest test-fullbench test-fuzzer test-mem
@@ -193,7 +193,7 @@ test-mem: lz4 datagen fuzzer frametest
./datagen -g16MB > tmp
valgrind --leak-check=yes ./lz4 -9 -B5D -f tmp /dev/null
./datagen -g256MB > tmp
- valgrind --leak-check=yes ./lz4 -B4D -f tmp /dev/null
+ valgrind --leak-check=yes ./lz4 -B4D -f -vq tmp /dev/null
rm tmp
valgrind --leak-check=yes ./fuzzer -i50 -t0
valgrind --leak-check=yes ./frametest -i100
diff --git a/programs/frametest.c b/programs/frametest.c
index c7e6f45..2a0c603 100644
--- a/programs/frametest.c
+++ b/programs/frametest.c
@@ -663,7 +663,7 @@ int main(int argc, char** argv)
if (nbTests<=0) nbTests=1;
- //if (testNb==0) result = basicTests(seed, ((double)proba) / 100);
+ if (testNb==0) result = basicTests(seed, ((double)proba) / 100);
if (result) return 1;
return fuzzerTests(seed, nbTests, testNb, ((double)proba) / 100);
}
diff --git a/programs/fullbench.c b/programs/fullbench.c
index cdf1d1d..647a458 100644
--- a/programs/fullbench.c
+++ b/programs/fullbench.c
@@ -454,7 +454,7 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles)
// Alloc
chunkP = (struct chunkParameters*) malloc(((benchedSize / (size_t)chunkSize)+1) * sizeof(struct chunkParameters));
orig_buff = (char*) malloc((size_t)benchedSize);
- nbChunks = (int) ((int)benchedSize / chunkSize) + 1;
+ nbChunks = (int) (((int)benchedSize + (chunkSize-1))/ chunkSize);
maxCompressedChunkSize = LZ4_compressBound(chunkSize);
compressedBuffSize = nbChunks * maxCompressedChunkSize;
compressed_buff = (char*)malloc((size_t)compressedBuffSize);
@@ -511,7 +511,7 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles)
size_t remaining = benchedSize;
char* in = orig_buff;
char* out = compressed_buff;
- nbChunks = (int) ((int)benchedSize / chunkSize) + 1;
+ nbChunks = (int) (((int)benchedSize + (chunkSize-1))/ chunkSize);
for (i=0; i<nbChunks; i++)
{
chunkP[i].id = i;
@@ -593,6 +593,22 @@ int fullSpeedBench(char** fileNamesTable, int nbFiles)
}
// Prepare layout for decompression
+ // Init data chunks
+ {
+ int i;
+ size_t remaining = benchedSize;
+ char* in = orig_buff;
+ char* out = compressed_buff;
+ nbChunks = (int) (((int)benchedSize + (chunkSize-1))/ chunkSize);
+ for (i=0; i<nbChunks; i++)
+ {
+ chunkP[i].id = i;
+ chunkP[i].origBuffer = in; in += chunkSize;
+ if ((int)remaining > chunkSize) { chunkP[i].origSize = chunkSize; remaining -= chunkSize; } else { chunkP[i].origSize = (int)remaining; remaining = 0; }
+ chunkP[i].compressedBuffer = out; out += maxCompressedChunkSize;
+ chunkP[i].compressedSize = 0;
+ }
+ }
for (chunkNb=0; chunkNb<nbChunks; chunkNb++)
{
chunkP[chunkNb].compressedSize = LZ4_compress(chunkP[chunkNb].origBuffer, chunkP[chunkNb].compressedBuffer, chunkP[chunkNb].origSize);
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index 2d612e7..6e52ec6 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -48,10 +48,6 @@
# pragma warning(disable : 4127) // disable: C4127: conditional expression is constant
#endif
-#ifdef __clang__
-# pragma clang diagnostic ignored "-Wunused-const-variable" // const variable one is really used !
-#endif
-
#define _FILE_OFFSET_BITS 64 // Large file support on 32-bits unix
#define _POSIX_SOURCE 1 // for fileno() within <stdio.h> on unix
@@ -113,7 +109,7 @@
//****************************
#define COMPRESSOR_NAME "LZ4 Compression CLI"
#ifndef LZ4_VERSION
-# define LZ4_VERSION "r122"
+# define LZ4_VERSION "r125"
#endif
#define AUTHOR "Yann Collet"
#define WELCOME_MESSAGE "*** %s %i-bits %s, by %s (%s) ***\n", COMPRESSOR_NAME, (int)(sizeof(void*)*8), LZ4_VERSION, AUTHOR, __DATE__
@@ -128,15 +124,6 @@
//**************************************
-// Architecture Macros
-//**************************************
-static const int one = 1;
-#define CPU_LITTLE_ENDIAN (*(char*)(&one))
-#define CPU_BIG_ENDIAN (!CPU_LITTLE_ENDIAN)
-#define LITTLE_ENDIAN_32(i) (CPU_LITTLE_ENDIAN?(i):swap32(i))
-
-
-//**************************************
// Macros
//**************************************
#define DISPLAY(...) fprintf(stderr, __VA_ARGS__)
@@ -462,7 +449,7 @@ int main(int argc, char** argv)
}
DISPLAYLEVEL(3, WELCOME_MESSAGE);
- DISPLAYLEVEL(4, "Blocks size : %i KB\n", blockSize>>10);
+ if (!decode) DISPLAYLEVEL(4, "Blocks size : %i KB\n", blockSize>>10);
// No input filename ==> use stdin
if(!input_filename) { input_filename=stdinmark; }
diff --git a/programs/lz4io.c b/programs/lz4io.c
index 3a84866..afaa59f 100644
--- a/programs/lz4io.c
+++ b/programs/lz4io.c
@@ -357,7 +357,7 @@ int LZ4IO_compressFilename_Legacy(char* input_filename, char* output_filename, i
static void* LZ4IO_LZ4_createStream (const char* inputBuffer)
{
(void)inputBuffer;
- return calloc(4, LZ4_STREAMSIZE_U32);
+ return calloc(8, LZ4_STREAMSIZE_U64);
}
static int LZ4IO_LZ4_compress_limitedOutput_continue (void* ctx, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel)