From 7273da38babc3ab5b2ca011b46c5e7e2602ca48a Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Sun, 28 Jun 2015 02:34:12 -0800 Subject: minor example clarification --- .travis.yml | 2 +- Makefile | 2 +- examples/Makefile | 2 +- examples/frameCompress.c | 12 ++++++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6c505bc..e42ed82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ before_install: env: - LZ4_TRAVIS_CI_ENV=travis-install - - LZ4_TRAVIS_CI_ENV=streaming-examples + - LZ4_TRAVIS_CI_ENV=examples - LZ4_TRAVIS_CI_ENV=cmake - LZ4_TRAVIS_CI_ENV=clangtest - LZ4_TRAVIS_CI_ENV=sanitize diff --git a/Makefile b/Makefile index 9113e5f..8fa72f0 100644 --- a/Makefile +++ b/Makefile @@ -121,7 +121,7 @@ armtest: clean versionstest: clean @cd test; $(MAKE) -streaming-examples: +examples: cd lib; $(MAKE) -e cd programs; $(MAKE) -e lz4 cd examples; $(MAKE) -e test diff --git a/examples/Makefile b/examples/Makefile index b7f6eca..069f7d9 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -78,7 +78,7 @@ test : all $(LZ4) -vt $(TESTFILE).lz4 clean: - @rm -f core *.o *.dec *-0 *-9 *-8192 *.lz4s \ + @rm -f core *.o *.dec *-0 *-9 *-8192 *.lz4s *.lz4 \ printVersion$(EXT) doubleBuffer$(EXT) ringBuffer$(EXT) ringBufferHC$(EXT) \ lineCompress$(EXT) frameCompress$(EXT) @echo Cleaning completed diff --git a/examples/frameCompress.c b/examples/frameCompress.c index 7b13579..b52b042 100644 --- a/examples/frameCompress.c +++ b/examples/frameCompress.c @@ -1,3 +1,6 @@ +// LZ4frame API example : compress a file +// Based on sample code from Zbigniew Jędrzejewski-Szmek + #include #include #include @@ -10,10 +13,10 @@ #define LZ4_FOOTER_SIZE 4 static const LZ4F_preferences_t lz4_preferences = { - { 5, 0, 0, 0, 0, { 0, 0 } }, - 0, - 0, - { 0, 0, 0, 0 }, + { LZ4F_max256KB, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0, { 0, 0 } }, + 0, /* compression level */ + 0, /* autoflush */ + { 0, 0, 0, 0 }, /* reserved, must be set to 0 */ }; static int compress_file(FILE *in, FILE *out, size_t *size_in, size_t *size_out) { @@ -155,6 +158,7 @@ static int compress(const char *input, const char *output) { return r; } + int main(int argc, char **argv) { if (argc < 2 || argc > 3) { fprintf(stderr, "Syntax: %s \n", argv[0]); -- cgit v0.12