language: c
compiler: gcc
-script: make test-travis
+script: make $LZ4_TRAVIS_CI_ENV
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq gcc-arm-linux-gnueabi
- LZ4_TRAVIS_CI_ENV=gpptest
- LZ4_TRAVIS_CI_ENV=armtest
- LZ4_TRAVIS_CI_ENV=versionsTest
- - LZ4_TRAVIS_CI_ENV=test-lz4
- - LZ4_TRAVIS_CI_ENV=test-lz4c
- - LZ4_TRAVIS_CI_ENV=test-lz4c32
- - LZ4_TRAVIS_CI_ENV=test-fullbench
- - LZ4_TRAVIS_CI_ENV=test-fullbench32
- - LZ4_TRAVIS_CI_ENV=test-fuzzer
- - LZ4_TRAVIS_CI_ENV=test-fuzzer32
- - LZ4_TRAVIS_CI_ENV=test-frametest
- - LZ4_TRAVIS_CI_ENV=test-frametest32
- - LZ4_TRAVIS_CI_ENV=test-mem
+ - LZ4_TRAVIS_CI_ENV="-C programs test-lz4"
+ - LZ4_TRAVIS_CI_ENV="-C programs test-lz4c"
+ - LZ4_TRAVIS_CI_ENV="-C programs test-lz4c32"
+ - LZ4_TRAVIS_CI_ENV="-C programs test-fullbench"
+ - LZ4_TRAVIS_CI_ENV="-C programs test-fullbench32"
+ - LZ4_TRAVIS_CI_ENV="-C programs test-fuzzer"
+ - LZ4_TRAVIS_CI_ENV="-C programs test-fuzzer32"
+ - LZ4_TRAVIS_CI_ENV="-C programs test-frametest"
+ - LZ4_TRAVIS_CI_ENV="-C programs test-frametest32"
+ - LZ4_TRAVIS_CI_ENV="-C programs test-mem"
matrix:
fast_finish: true
LZ4DIR = lib
-# Select test target for Travis CI's Build Matrix
-ifneq (,$(filter test-%,$(LZ4_TRAVIS_CI_ENV)))
-TRAVIS_TARGET=prg-travis
-else
-TRAVIS_TARGET=$(LZ4_TRAVIS_CI_ENV)
-endif
-
# Define nul output
ifneq (,$(filter Windows%,$(OS)))
VOID = nul
default: lz4programs
-all: lib
- @cd $(PRGDIR); $(MAKE) all
+all: lib lz4programs
lib:
- @cd $(LZ4DIR); $(MAKE) all
+ @$(MAKE) -C $(LZ4DIR) all
lz4programs:
- @cd $(PRGDIR); $(MAKE)
+ @$(MAKE) -C $(PRGDIR)
clean:
- @cd $(PRGDIR); $(MAKE) clean > $(VOID)
- @cd $(LZ4DIR); $(MAKE) clean > $(VOID)
- @cd examples; $(MAKE) clean > $(VOID)
- @cd versionsTest; $(MAKE) clean > $(VOID)
+ @$(MAKE) -C $(PRGDIR) $@ > $(VOID)
+ @$(MAKE) -C $(LZ4DIR) $@ > $(VOID)
+ @$(MAKE) -C examples $@ > $(VOID)
+ @$(MAKE) -C versionsTest $@ > $(VOID)
@echo Cleaning completed
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU))
install:
- @cd $(LZ4DIR); $(MAKE) install
- @cd $(PRGDIR); $(MAKE) install
+ @$(MAKE) -C $(LZ4DIR) $@
+ @$(MAKE) -C $(PRGDIR) $@
uninstall:
- @cd $(LZ4DIR); $(MAKE) uninstall
- @cd $(PRGDIR); $(MAKE) uninstall
+ @$(MAKE) -C $(LZ4DIR) $@
+ @$(MAKE) -C $(PRGDIR) $@
travis-install:
sudo $(MAKE) install
test:
- @cd $(PRGDIR); $(MAKE) test
-
-test-travis: $(TRAVIS_TARGET)
+ $(MAKE) -C $(PRGDIR) test
cmake:
@cd cmake_unofficial; cmake CMakeLists.txt; $(MAKE)
CFLAGS=-g scan-build --status-bugs -v $(MAKE) all
armtest: clean
- cd lib; CFLAGS="-O3 -Werror" $(MAKE) all CC=arm-linux-gnueabi-gcc
- cd programs; CFLAGS="-O3 -Werror" $(MAKE) bins CC=arm-linux-gnueabi-gcc
+ CFLAGS="-O3 -Werror" $(MAKE) -C $(LZ4DIR) all CC=arm-linux-gnueabi-gcc
+ CFLAGS="-O3 -Werror" $(MAKE) -C $(PRGDIR) bins CC=arm-linux-gnueabi-gcc
versionsTest: clean
- @cd versionsTest; $(MAKE)
+ $(MAKE) -C versionsTest
examples:
- cd lib; $(MAKE)
- cd programs; $(MAKE) lz4
- cd examples; $(MAKE) test
-
-prg-travis:
- @cd $(PRGDIR); $(MAKE) test-travis
+ $(MAKE) -C $(LZ4DIR)
+ $(MAKE) -C $(PRGDIR) lz4
+ $(MAKE) -C examples test
endif
r132
Improved: Small decompression speed boost (+4%)
-Improved: Performance on ARMv6
-Makefile: Generate intermediate object files (*.o) for faster compilation on low power systems
+Improved: Performance on ARMv6 and ARMv7
+Added : Debianization, by Evgeniy Polyakov
+Makefile: Safely protects lz4 version when selecting custom CFLAGS
+Makefile: Generates intermediate object files (*.o) for faster compilation on low power systems
r131
New : Dos/DJGPP target, thanks to Louis Santillan (#114)
Name: lz4
Description: fast lossless compression algorithm library
-URL: http://code.google.com/p/lz4/
+URL: http://lz4.org/
Version: @VERSION@
Libs: -L@LIBDIR@ -llz4
Cflags: -I@INCLUDEDIR@
memcpy(memPtr, &value, sizeof(value));
}
-#endif // LZ4_FORCE_DIRECT_MEMORY_ACCESS
+#endif // LZ4_FORCE_MEMORY_ACCESS
static U16 LZ4_readLE16(const void* memPtr)
BYTE* d = (BYTE*)dstPtr;
const BYTE* s = (const BYTE*)srcPtr;
BYTE* const e = (BYTE*)dstEnd;
+
+#if 1
+ const size_t l2 = 8 - (((size_t)d) & (sizeof(void*)-1));
+ LZ4_copy8(d,s); if (d>e-9) return;
+ d+=l2; s+=l2;
+#endif // join to align
+
do { LZ4_copy8(d,s); d+=8; s+=8; } while (d<e);
}
*/
/* LZ4F is a stand-alone API to create LZ4-compressed frames
- * fully conformant to specification v1.5.1.
- * All related operations, including memory management, are handled by the library.
+ * conformant with specification v1.5.1.
+ * All related operations, including memory management, are handled internally by the library.
* You don't need lz4.h when using lz4frame.h.
* */
/**************************************
- * Error management
- * ************************************/
+* Error management
+**************************************/
typedef size_t LZ4F_errorCode_t;
unsigned LZ4F_isError(LZ4F_errorCode_t code);
/**************************************
- * Frame compression types
- * ************************************/
+* Frame compression types
+**************************************/
//#define LZ4F_DISABLE_OBSOLETE_ENUMS
#ifndef LZ4F_DISABLE_OBSOLETE_ENUMS
# define LZ4F_OBSOLETE_ENUM(x) ,x
/***********************************
- * Simple compression function
- * *********************************/
+* Simple compression function
+***********************************/
size_t LZ4F_compressFrameBound(size_t srcSize, const LZ4F_preferences_t* preferencesPtr);
size_t LZ4F_compressFrame(void* dstBuffer, size_t dstMaxSize, const void* srcBuffer, size_t srcSize, const LZ4F_preferences_t* preferencesPtr);
const void* srcBuffer, size_t* srcSizePtr);
/* LZ4F_getFrameInfo()
* This function decodes frame header information (such as max blockSize, frame checksum, etc.).
- * Its usage is optional : you can start by calling directly LZ4F_decompress() instead.
- * The objective is to extract frame header information, typically for allocation purposes.
- * LZ4F_getFrameInfo() can also be used anytime *after* starting decompression, on any valid LZ4F_decompressionContext_t.
- * The result is *copied* into an existing LZ4F_frameInfo_t structure which must be already allocated.
- * The number of bytes read from srcBuffer will be provided within *srcSizePtr (necessarily <= original value).
- * The function result is an hint of how many srcSize bytes LZ4F_decompress() expects for next call,
+ * Its usage is optional. The objective is to extract frame header information, typically for allocation purposes.
+ * A header size is variable and can be from 7 to 15 bytes. It's also possible to input more bytes than that.
+ * The number of bytes read from srcBuffer will be updated within *srcSizePtr (necessarily <= original value).
+ * (note that LZ4F_getFrameInfo() can also be used anytime *after* starting decompression, in this case 0 input byte is enough)
+ * Frame header info is *copied into* an already allocated LZ4F_frameInfo_t structure.
+ * The function result is an hint about how many srcSize bytes LZ4F_decompress() expects for next call,
* or an error code which can be tested using LZ4F_isError()
* (typically, when there is not enough src bytes to fully decode the frame header)
- * You are expected to resume decompression from where it stopped (srcBuffer + *srcSizePtr)
+ * Decompression is expected to resume from where it stopped (srcBuffer + *srcSizePtr)
*/
size_t LZ4F_decompress(LZ4F_decompressionContext_t dctx,
DESTDIR ?=
PREFIX ?= /usr/local
-CFLAGS ?= -O3 # can select your own settings, for example : CFLAGS="-O2 -g" make
+CFLAGS ?= -O3 # can select customized flags instead, for example : CFLAGS="-O2 -g" make
CFLAGS += -I../lib -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -pedantic
CPPFLAGS:= -DXXH_NAMESPACE=LZ4_ -DLZ4_VERSION=\"$(RELEASE)\"
FLAGS := $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
# Select test target for Travis CI's Build Matrix
-TRAVIS_TARGET:= $(LZ4_TRAVIS_CI_ENV)
TEST_FILES := COPYING
-TEST_TARGETS := test-native
FUZZER_TIME := -T9mn
test-all: test test32
-test-travis: $(TRAVIS_TARGET)
-
test-lz4-sparse: lz4 datagen
@echo "\n ---- test sparse file support ----"
./datagen -g5M -P100 > tmpSrc
./lz4 tmpSrc | ./lz4 -dv --no-sparse > tmpNoSparse
diff -s tmpSrc tmpNoSparse
ls -ls tmp*
- ./datagen -s1 -g1200007 -P100 | ./lz4 | ./lz4 -dv --sparse > tmpOdd # Odd size file (to not finish on an exact nb of blocks)
+ ./datagen -s1 -g1200007 -P100 | ./lz4 | ./lz4 -dv --sparse > tmpOdd # Odd size file (to generate non-full last block)
./datagen -s1 -g1200007 -P100 | diff -s - tmpOdd
ls -ls tmpOdd
@rm tmp*
diff tmp2M tmpR
@rm tmp*
-
-
test-lz4-contentSize: lz4 datagen
@echo "\n ---- test original size support ----"
./datagen -g15M > tmp
valgrind --leak-check=yes --error-exitcode=1 ./frametest -i256
test-mem32: lz4c32 datagen
-# unfortunately, valgrind doesn't seem to work with non-native binary. If someone knows how to do a valgrind-test on a 32-bits exe with a 64-bits system...
+# unfortunately, valgrind doesn't seem to work with non-native binary...
endif
\"
\" lz4.1: This is a manual page for 'lz4' program. This file is part of the
-\" lz4 <https://code.google.com/p/lz4/> project.
+\" lz4 <http://www.lz4.org/> project.
\" Author: Yann Collet
\"
iteration loops [1-9](default : 3), benchmark mode only
.SH BUGS
-Report bugs at: https://github.com/Cyan4973/lz4
+Report bugs at: https://github.com/Cyan4973/lz4/issues
.SH AUTHOR
Yann Collet