diff options
author | Yann Collet <cyan@fb.com> | 2017-09-11 10:25:47 -0700 |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2017-09-11 10:25:47 -0700 |
commit | 810e2ca27b3561e0f6bfa7a88e0fde6faf807064 (patch) | |
tree | d6944102061953ea64aa04601cc8925e0051a03f /examples | |
parent | e5bd29a2fb019ddd19f9817ba701733552afbdbd (diff) | |
download | lz4-810e2ca27b3561e0f6bfa7a88e0fde6faf807064.tar.gz lz4-810e2ca27b3561e0f6bfa7a88e0fde6faf807064.tar.bz2 lz4-810e2ca27b3561e0f6bfa7a88e0fde6faf807064.zip |
minor improvements to examples
cosmetic : better display
added optional variable MOREFLAGS
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile | 20 | ||||
-rw-r--r-- | examples/blockStreaming_ringBuffer.c | 8 |
2 files changed, 18 insertions, 10 deletions
diff --git a/examples/Makefile b/examples/Makefile index 7647f16..9321c24 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -30,11 +30,11 @@ CPPFLAGS += -I../lib CFLAGS ?= -O3 CFLAGS += -std=gnu99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -FLAGS := $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) +FLAGS := $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(MOREFLAGS) -TESTFILE= Makefile -LZ4DIR := ../lib -LZ4 = ../programs/lz4 +TESTFILE = Makefile +LZ4DIR := ../lib +LZ4 = ../programs/lz4 # Define *.exe as extension for Windows systems @@ -80,14 +80,22 @@ simpleBuffer: $(LZ4DIR)/lz4.c simple_buffer.c $(CC) $(FLAGS) $^ -o $@$(EXT) test : all + @echo "\n=== Print Version ===" ./printVersion$(EXT) + @echo "\n=== Simple compression example ===" + ./simpleBuffer$(EXT) + @echo "\n=== Double-buffer ===" ./doubleBuffer$(EXT) $(TESTFILE) - ./dictionaryRandomAccess$(EXT) $(TESTFILE) $(TESTFILE) 1100 1400 + @echo "\n=== Ring Buffer ===" ./ringBuffer$(EXT) $(TESTFILE) + @echo "\n=== Ring Buffer + LZ4 HC ===" ./ringBufferHC$(EXT) $(TESTFILE) + @echo "\n=== Compress line by line ===" ./lineCompress$(EXT) $(TESTFILE) + @echo "\n=== Dictionary Random Access ===" + ./dictionaryRandomAccess$(EXT) $(TESTFILE) $(TESTFILE) 1100 1400 + @echo "\n=== Frame compression ===" ./frameCompress$(EXT) $(TESTFILE) - ./simpleBuffer$(EXT) $(LZ4) -vt $(TESTFILE).lz4 clean: diff --git a/examples/blockStreaming_ringBuffer.c b/examples/blockStreaming_ringBuffer.c index 40109b5..dec78af 100644 --- a/examples/blockStreaming_ringBuffer.c +++ b/examples/blockStreaming_ringBuffer.c @@ -6,7 +6,7 @@ * Compiler Options **************************************/ #ifdef _MSC_VER /* Visual Studio */ -# define _CRT_SECURE_NO_WARNINGS // for MSVC +# define _CRT_SECURE_NO_WARNINGS # define snprintf sprintf_s #endif @@ -24,7 +24,7 @@ enum { MESSAGE_MAX_BYTES = 1024, RING_BUFFER_BYTES = 1024 * 8 + MESSAGE_MAX_BYTES, - DECODE_RING_BUFFER = RING_BUFFER_BYTES + MESSAGE_MAX_BYTES // Intentionally larger, to test unsynchronized ring buffers + DECODE_RING_BUFFER = RING_BUFFER_BYTES + MESSAGE_MAX_BYTES /* Intentionally larger, to test unsynchronized ring buffers */ }; @@ -138,7 +138,7 @@ int main(int argc, char** argv) char lz4Filename[256] = { 0 }; char decFilename[256] = { 0 }; - if(argc < 2) { + if (argc < 2) { printf("Please specify input filename\n"); return 0; } @@ -176,7 +176,7 @@ int main(int argc, char** argv) FILE* const decFp = fopen(decFilename, "rb"); const int cmp = compare(inpFp, decFp); - if(0 == cmp) { + if (0 == cmp) { printf("Verify : OK\n"); } else { printf("Verify : NG\n"); |