as Makefile target and Travis CI test.
Fixed last cppcheck warnings in tests and examples
- qemu-user-static
- gcc-powerpc-linux-gnu
- - env: Ubu=14.04 Cmd='make staticAnalyze' COMPILER=clang
+ - env: Ubu=14.04 Cmd='make staticAnalyze && make cppcheck' COMPILER=clang
dist: trusty
sudo: required
addons:
apt:
packages:
- clang
+ - cppcheck
- env: Ubu=14.04 Cmd='make clean all CC=gcc-4.4 MOREFLAGS=-Werror && make clean && CFLAGS=-fPIC LDFLAGS="-pie -fPIE -D_FORTIFY_SOURCE=2" make -C programs' COMPILER=gcc-4.4
dist: trusty
usan32: clean
CFLAGS="-m32 -O3 -g -fsanitize=undefined" $(MAKE) test FUZZER_TIME="-T30s" NB_LOOPS=-i1
+.PHONY: staticAnalyze
staticAnalyze: clean
CFLAGS=-g scan-build --status-bugs -v $(MAKE) all
+.PHONY: cppcheck
+cppcheck:
+ cppcheck . --force --enable=warning,portability,performance,style --error-exitcode=1 > /dev/null
+
platformTest: clean
@echo "\n ---- test lz4 with $(CC) compiler ----"
@$(CC) -v
if (!comments.empty())
comments[comments.size()-1] = comments[comments.size()-1].substr(0, comments[comments.size()-1].find("*/"));
for (l=0; l<comments.size(); l++) {
- if (comments[l].find(" *") == 0)
+ if (comments[l].compare(0, 2, " *") == 0)
comments[l] = comments[l].substr(2);
- else if (comments[l].find(" *") == 0)
+ else if (comments[l].compare(0, 3, " *") == 0)
comments[l] = comments[l].substr(3);
trim(comments[l], "*-=");
}
LZ4F_CDict* const cdict = LZ4F_createCDict(CNBuffer, dictSize);
if (cdict == NULL) goto _output_error;
CHECK( LZ4F_createCompressionContext(&cctx, LZ4F_VERSION) );
-
+
DISPLAYLEVEL(3, "LZ4F_compressFrame_usingCDict, with NULL dict : ");
CHECK_V(cSizeNoDict,
LZ4F_compressFrame_usingCDict(cctx, compressedBuffer, dstCapacity,
size_t const iSize = MIN(sampleMax, (size_t)(iend-ip));
size_t const oSize = LZ4F_compressBound(iSize, prefsPtr);
cOptions.stableSrc = ((FUZ_rand(&randState) & 3) == 1);
- DISPLAYLEVEL(6, "Sending %zi bytes to compress (stableSrc:%u) \n",
+ DISPLAYLEVEL(6, "Sending %zu bytes to compress (stableSrc:%u) \n",
iSize, cOptions.stableSrc);
result = LZ4F_compressUpdate(cCtx, op, oSize, ip, iSize, &cOptions);
size_t readSize;
int compressedBuffSize;
U32 crcOriginal;
- size_t errorCode;
/* Check file existence */
if (inFile==NULL) { DISPLAY( "Pb opening %s\n", inFileName); return 11; }
case 8: decompressionFunction = local_LZ4_decompress_safe_forceExtDict; dName = "LZ4_decompress_safe_forceExtDict"; break;
#endif
case 9: decompressionFunction = local_LZ4F_decompress; dName = "LZ4F_decompress";
- errorCode = LZ4F_compressFrame(compressed_buff, compressedBuffSize, orig_buff, benchedSize, NULL);
+ { size_t const errorCode = LZ4F_compressFrame(compressed_buff, compressedBuffSize, orig_buff, benchedSize, NULL);
if (LZ4F_isError(errorCode)) {
DISPLAY("Error while preparing compressed frame\n");
free(orig_buff);
chunkP[0].compressedSize = (int)errorCode;
nbChunks = 1;
break;
+ }
default :
continue; /* skip if unknown ID */
}