summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2013-12-03 15:50:46 (GMT)
committeryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2013-12-03 15:50:46 (GMT)
commit8ac549f10a3bb36575621f7d969bde22a8aa7de1 (patch)
treeb0c94420464d5244c3c583d1b646602c598cf56a
parent7a863abfc2da21cf69fc2db2ad92e9f8e2c72004 (diff)
downloadlz4-8ac549f10a3bb36575621f7d969bde22a8aa7de1.zip
lz4-8ac549f10a3bb36575621f7d969bde22a8aa7de1.tar.gz
lz4-8ac549f10a3bb36575621f7d969bde22a8aa7de1.tar.bz2
lz4.c : corrected issue 98 within LZ4_compress_limitedOutput()
Makefile : can specify version number git-svn-id: https://lz4.googlecode.com/svn/trunk@109 650e7d94-2a16-8b24-b05c-7c0b3f6821cd
-rw-r--r--Makefile4
-rw-r--r--NEWS4
-rw-r--r--fullbench.c9
-rw-r--r--fuzzer.c6
-rw-r--r--lz4.c12
-rw-r--r--lz4cli.c7
6 files changed, 26 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index bacc702..b630038 100644
--- a/Makefile
+++ b/Makefile
@@ -30,14 +30,14 @@
# fullbench32: Same as fullbench, but forced to compile in 32-bits mode
# ################################################################
-RELEASE=r108
+RELEASE=r109
DESTDIR=
PREFIX=${DESTDIR}/usr
BINDIR=$(PREFIX)/bin
MANDIR=$(PREFIX)/share/man/man1
DISTRIBNAME=lz4-$(RELEASE).tar.gz
CC=gcc
-CFLAGS=-I. -std=c99 -Wall -W -Wundef
+CFLAGS=-I. -std=c99 -Wall -W -Wundef -DLZ4_VERSION=\"v1.0.9\"
# Define *.exe as extension for Windows systems
# ifeq ($(OS),Windows_NT)
diff --git a/NEWS b/NEWS
index 01945ea..20c1949 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+r109 :
+lz4.c : corrected issue 98 (LZ4_compress_limitedOutput())
+Makefile : can specify version number from makefile
+
r108 :
lz4.c : corrected compression efficiency issue 97 in 64-bits chained mode (-BD) for streams > 4 GB (thanks Roman Strashkin for reporting)
diff --git a/fullbench.c b/fullbench.c
index cbb7483..88e37b6 100644
--- a/fullbench.c
+++ b/fullbench.c
@@ -103,11 +103,12 @@
//****************************
// Constants
//****************************
-#define COMPRESSOR_NAME "LZ4 speed analyzer"
-#define COMPRESSOR_VERSION ""
-#define COMPILED __DATE__
+#define PROGRAM_DESCRIPTION "LZ4 speed analyzer"
+#ifndef LZ4_VERSION
+# define LZ4_VERSION ""
+#endif
#define AUTHOR "Yann Collet"
-#define WELCOME_MESSAGE "*** %s %s %i-bits, by %s (%s) ***\n", COMPRESSOR_NAME, COMPRESSOR_VERSION, (int)(sizeof(void*)*8), AUTHOR, COMPILED
+#define WELCOME_MESSAGE "*** %s %s %i-bits, by %s (%s) ***\n", PROGRAM_DESCRIPTION, LZ4_VERSION, (int)(sizeof(void*)*8), AUTHOR, __DATE__
#define NBLOOPS 6
#define TIMELOOP 2500
diff --git a/fuzzer.c b/fuzzer.c
index fdbc3c0..3c9847b 100644
--- a/fuzzer.c
+++ b/fuzzer.c
@@ -42,6 +42,10 @@
//**************************************
// Constants
//**************************************
+#ifndef LZ4_VERSION
+# define LZ4_VERSION ""
+#endif
+
#define NB_ATTEMPTS (1<<17)
#define LEN ((1<<15))
#define SEQ_POW 2
@@ -135,7 +139,7 @@ int main() {
# define FUZ_CHECKTEST(cond, message) if (cond) { printf("Test %i : %s : seed %u, cycle %i \n", testNb, message, seed, attemptNb); goto _output_error; }
# define FUZ_DISPLAYTEST testNb++; printf("%2i\b\b", testNb);
- printf("starting LZ4 fuzzer\n");
+ printf("starting LZ4 fuzzer (%s)\n", LZ4_VERSION);
printf("Select an Initialisation number (default : random) : ");
fflush(stdout);
if ( fgets(userInput, sizeof userInput, stdin) )
diff --git a/lz4.c b/lz4.c
index 5668521..4e864de 100644
--- a/lz4.c
+++ b/lz4.c
@@ -469,7 +469,7 @@ FORCE_INLINE int LZ4_compress_generic(
// Encode Literal length
length = (int)(ip - anchor);
token = op++;
- if ((limitedOutput) && unlikely(op + length + (2 + 1 + LASTLITERALS) + (length>>8) > oend)) return 0; // Check output limit
+ if ((limitedOutput) && unlikely(op + length + (2 + 1 + LASTLITERALS) + (length/255) > oend)) return 0; // Check output limit
if (length>=(int)RUN_MASK)
{
int len = length-RUN_MASK;
@@ -534,7 +534,7 @@ _last_literals:
// Encode Last Literals
{
int lastRun = (int)(iend - anchor);
- if ((limitedOutput) && (((char*)op - dest) + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > (U32)maxOutputSize)) return 0; // Check output limit
+ if ((limitedOutput) && (((char*)op - dest) + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > (U32)maxOutputSize)) return 0; // Check output limit
if (lastRun>=(int)RUN_MASK) { *op++=(RUN_MASK<<ML_BITS); lastRun-=RUN_MASK; for(; lastRun >= 255 ; lastRun-=255) *op++ = 255; *op++ = (BYTE) lastRun; }
else *op++ = (BYTE)(lastRun<<ML_BITS);
memcpy(op, anchor, iend - anchor);
@@ -648,10 +648,10 @@ char* LZ4_slideInputBuffer (void* LZ4_Data)
}
else
{
- memcpy((void*)(lz4ds->bufferStart), (const void*)(lz4ds->nextBlock - 64 KB), 64 KB);
- lz4ds->nextBlock -= delta;
- lz4ds->base -= delta;
- }
+ memcpy((void*)(lz4ds->bufferStart), (const void*)(lz4ds->nextBlock - 64 KB), 64 KB);
+ lz4ds->nextBlock -= delta;
+ lz4ds->base -= delta;
+ }
return (char*)(lz4ds->nextBlock);
}
diff --git a/lz4cli.c b/lz4cli.c
index 5375ac6..ba6897c 100644
--- a/lz4cli.c
+++ b/lz4cli.c
@@ -107,11 +107,12 @@
// Constants
//****************************
#define COMPRESSOR_NAME "LZ4 Compression CLI"
-#define COMPRESSOR_VERSION "v1.0.8"
-#define COMPILED __DATE__
+#ifndef LZ4_VERSION
+# define LZ4_VERSION "v1.0.9"
+#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__
#define LZ4_EXTENSION ".lz4"
-#define WELCOME_MESSAGE "*** %s %i-bits %s, by %s (%s) ***\n", COMPRESSOR_NAME, (int)(sizeof(void*)*8), COMPRESSOR_VERSION, AUTHOR, COMPILED
#define KB *(1U<<10)
#define MB *(1U<<20)