summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml22
-rw-r--r--examples/Makefile5
-rw-r--r--examples/dictionaryRandomAccess.c4
3 files changed, 29 insertions, 2 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 74e203d..5c0afb1 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -265,6 +265,7 @@ jobs:
# - ubsan
# - asan
# - unicode-lint
+# - build examples
#
lz4-cppcheck:
name: make cppcheck
@@ -392,6 +393,27 @@ jobs:
run: bash ./tests/unicode_lint.sh
+ lz4-examples:
+ name: make examples
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2 # https://github.com/actions/checkout
+ - name: apt-get install
+ run: |
+ sudo apt-get update
+
+ - name: Environment info
+ run: |
+ echo && type cc && which cc && cc --version
+ echo && type c++ && which c++ && c++ --version
+
+ - name: examples
+ run: make V=1 clean examples
+
+ - name: examples (compile as C++ code)
+ run: make V=1 -C examples clean cxxtest
+
+
###############################################################
# Platforms
#
diff --git a/examples/Makefile b/examples/Makefile
index 24b58c9..a5af0c1 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -95,6 +95,11 @@ test : all $(LZ4)
./frameCompress$(EXT) $(TESTFILE)
$(LZ4) -vt $(TESTFILE).lz4
+.PHONY: cxxtest
+cxxtest: CFLAGS := -O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror
+cxxtest: clean
+ CC=$(CXX) $(MAKE) -C . all CFLAGS="$(CFLAGS)"
+
clean:
@rm -f core *.o *.dec *-0 *-9 *-8192 *.lz4s *.lz4 \
printVersion$(EXT) doubleBuffer$(EXT) dictionaryRandomAccess$(EXT) \
diff --git a/examples/dictionaryRandomAccess.c b/examples/dictionaryRandomAccess.c
index f7d1b67..3aa4609 100644
--- a/examples/dictionaryRandomAccess.c
+++ b/examples/dictionaryRandomAccess.c
@@ -78,7 +78,7 @@ void test_compress(FILE* outFp, FILE* inpFp, void *dict, int dictSize)
}
/* Forget previously compressed data and load the dictionary */
- LZ4_loadDict(lz4Stream, dict, dictSize);
+ LZ4_loadDict(lz4Stream, (const char*) dict, dictSize);
{
char cmpBuf[LZ4_COMPRESSBOUND(BLOCK_BYTES)];
const int cmpBytes = LZ4_compress_fast_continue(
@@ -153,7 +153,7 @@ void test_decompress(FILE* outFp, FILE* inpFp, void *dict, int dictSize, int off
}
/* Load the dictionary */
- LZ4_setStreamDecode(lz4StreamDecode, dict, dictSize);
+ LZ4_setStreamDecode(lz4StreamDecode, (const char*) dict, dictSize);
{
const int decBytes = LZ4_decompress_safe_continue(
lz4StreamDecode, cmpBuf, decBuf, cmpBytes, BLOCK_BYTES);