lz4.c : corrected issue 98 within LZ4_compress_limitedOutput()
authoryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>
Tue, 3 Dec 2013 15:50:46 +0000 (15:50 +0000)
committeryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>
Tue, 3 Dec 2013 15:50:46 +0000 (15:50 +0000)
Makefile : can specify version number

git-svn-id: https://lz4.googlecode.com/svn/trunk@109 650e7d94-2a16-8b24-b05c-7c0b3f6821cd

Makefile
NEWS
fullbench.c
fuzzer.c
lz4.c
lz4cli.c

index bacc702..b630038 100644 (file)
--- a/Makefile
+++ b/Makefile
 # 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 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+r109 :\r
+lz4.c : corrected issue 98 (LZ4_compress_limitedOutput())\r
+Makefile : can specify version number from makefile\r
+\r
 r108 :\r
 lz4.c : corrected compression efficiency issue 97 in 64-bits chained mode (-BD) for streams > 4 GB (thanks Roman Strashkin for reporting)\r
 \r
index cbb7483..88e37b6 100644 (file)
 //****************************\r
 // Constants\r
 //****************************\r
-#define COMPRESSOR_NAME "LZ4 speed analyzer"\r
-#define COMPRESSOR_VERSION ""\r
-#define COMPILED __DATE__\r
+#define PROGRAM_DESCRIPTION "LZ4 speed analyzer"\r
+#ifndef LZ4_VERSION\r
+#  define LZ4_VERSION ""\r
+#endif\r
 #define AUTHOR "Yann Collet"\r
-#define WELCOME_MESSAGE "*** %s %s %i-bits, by %s (%s) ***\n", COMPRESSOR_NAME, COMPRESSOR_VERSION, (int)(sizeof(void*)*8), AUTHOR, COMPILED\r
+#define WELCOME_MESSAGE "*** %s %s %i-bits, by %s (%s) ***\n", PROGRAM_DESCRIPTION, LZ4_VERSION, (int)(sizeof(void*)*8), AUTHOR, __DATE__\r
 \r
 #define NBLOOPS    6\r
 #define TIMELOOP   2500\r
index fdbc3c0..3c9847b 100644 (file)
--- a/fuzzer.c
+++ b/fuzzer.c
 //**************************************\r
 // Constants\r
 //**************************************\r
+#ifndef LZ4_VERSION\r
+#  define LZ4_VERSION ""\r
+#endif\r
+\r
 #define NB_ATTEMPTS (1<<17)\r
 #define LEN ((1<<15))\r
 #define SEQ_POW 2\r
@@ -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; }\r
 #       define FUZ_DISPLAYTEST              testNb++; printf("%2i\b\b", testNb);\r
 \r
-        printf("starting LZ4 fuzzer\n");\r
+        printf("starting LZ4 fuzzer (%s)\n", LZ4_VERSION);\r
         printf("Select an Initialisation number (default : random) : ");\r
         fflush(stdout);\r
         if ( fgets(userInput, sizeof userInput, stdin) )\r
diff --git a/lz4.c b/lz4.c
index 5668521..4e864de 100644 (file)
--- a/lz4.c
+++ b/lz4.c
@@ -469,7 +469,7 @@ FORCE_INLINE int LZ4_compress_generic(
         // Encode Literal length\r
         length = (int)(ip - anchor);\r
         token = op++;\r
-        if ((limitedOutput) && unlikely(op + length + (2 + 1 + LASTLITERALS) + (length>>8) > oend)) return 0;   // Check output limit\r
+        if ((limitedOutput) && unlikely(op + length + (2 + 1 + LASTLITERALS) + (length/255) > oend)) return 0;   // Check output limit\r
         if (length>=(int)RUN_MASK) \r
         { \r
             int len = length-RUN_MASK; \r
@@ -534,7 +534,7 @@ _last_literals:
     // Encode Last Literals\r
     {\r
         int lastRun = (int)(iend - anchor);\r
-        if ((limitedOutput) && (((char*)op - dest) + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > (U32)maxOutputSize)) return 0;  // Check output limit\r
+        if ((limitedOutput) && (((char*)op - dest) + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > (U32)maxOutputSize)) return 0;   // Check output limit\r
         if (lastRun>=(int)RUN_MASK) { *op++=(RUN_MASK<<ML_BITS); lastRun-=RUN_MASK; for(; lastRun >= 255 ; lastRun-=255) *op++ = 255; *op++ = (BYTE) lastRun; }\r
         else *op++ = (BYTE)(lastRun<<ML_BITS);\r
         memcpy(op, anchor, iend - anchor);\r
@@ -648,10 +648,10 @@ char* LZ4_slideInputBuffer (void* LZ4_Data)
     }\r
     else\r
     {\r
-               memcpy((void*)(lz4ds->bufferStart), (const void*)(lz4ds->nextBlock - 64 KB), 64 KB);\r
-               lz4ds->nextBlock -= delta;\r
-               lz4ds->base -= delta;\r
-       }\r
+        memcpy((void*)(lz4ds->bufferStart), (const void*)(lz4ds->nextBlock - 64 KB), 64 KB);\r
+        lz4ds->nextBlock -= delta;\r
+        lz4ds->base -= delta;\r
+    }\r
 \r
     return (char*)(lz4ds->nextBlock);\r
 }\r
index 5375ac6..ba6897c 100644 (file)
--- a/lz4cli.c
+++ b/lz4cli.c
 // Constants\r
 //****************************\r
 #define COMPRESSOR_NAME "LZ4 Compression CLI"\r
-#define COMPRESSOR_VERSION "v1.0.8"\r
-#define COMPILED __DATE__\r
+#ifndef LZ4_VERSION\r
+#  define LZ4_VERSION "v1.0.9"\r
+#endif\r
 #define AUTHOR "Yann Collet"\r
+#define WELCOME_MESSAGE "*** %s %i-bits %s, by %s (%s) ***\n", COMPRESSOR_NAME, (int)(sizeof(void*)*8), LZ4_VERSION, AUTHOR, __DATE__\r
 #define LZ4_EXTENSION ".lz4"\r
-#define WELCOME_MESSAGE "*** %s %i-bits %s, by %s (%s) ***\n", COMPRESSOR_NAME, (int)(sizeof(void*)*8), COMPRESSOR_VERSION, AUTHOR, COMPILED\r
 \r
 #define KB *(1U<<10)\r
 #define MB *(1U<<20)\r