From aeda376bc0ba4d1207f4e61d106ef07db17f78ed Mon Sep 17 00:00:00 2001 From: tbeu Date: Sun, 25 Feb 2024 12:14:21 +0100 Subject: [PATCH] update --- cmake/staticAnalyzers.cmake | 6 ++---- src/mat5.c | 5 +++++ tools/matdump.c | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cmake/staticAnalyzers.cmake b/cmake/staticAnalyzers.cmake index 08b47c65..4ce3d935 100644 --- a/cmake/staticAnalyzers.cmake +++ b/cmake/staticAnalyzers.cmake @@ -3,6 +3,7 @@ if(MATIO_ENABLE_CPPCHECK) if(CPPCHECK) set(CMAKE_C_CPPCHECK ${CPPCHECK} --language=c + --quiet --check-level=exhaustive --suppress=checkersReport --suppress=unusedFunction @@ -11,11 +12,8 @@ if(MATIO_ENABLE_CPPCHECK) --enable=all --inline-suppr --inconclusive - -i ${CMAKE_SOURCE_DIR}/test - -i ${CMAKE_SOURCE_DIR}/snprintf - -i ${CMAKE_SOURCE_DIR}/getopt ) - message(VERBOSE "Cppcheck finished setting up.") + message("Cppcheck finished setting up: ${CMAKE_SOURCE_DIR}/test") else() message(SEND_ERROR "Cppcheck requested but executable not found.") endif() diff --git a/src/mat5.c b/src/mat5.c index fd4dae3c..282f89ad 100644 --- a/src/mat5.c +++ b/src/mat5.c @@ -942,6 +942,7 @@ WriteCompressedData(mat_t *mat, z_streamp z, void *data, int N, enum matio_types z->next_in = ZLIB_BYTE_PTR(data_tag); z->avail_in = 8; do { + /* // cppcheck-suppress uninitvar */ z->next_out = buf; z->avail_out = buf_size; deflate(z, Z_NO_FLUSH); @@ -2296,6 +2297,7 @@ WriteCompressedTypeArrayFlags(mat_t *mat, matvar_t *matvar, z_streamp z) z->next_in = ZLIB_BYTE_PTR(uncomp_buf); z->avail_in = (6 + i) * sizeof(*uncomp_buf); do { + /* // cppcheck-suppress uninitvar */ z->next_out = ZLIB_BYTE_PTR(comp_buf); z->avail_out = buf_size * sizeof(*comp_buf); deflate(z, Z_NO_FLUSH); @@ -2537,6 +2539,7 @@ WriteCompressedCellArrayField(mat_t *mat, matvar_t *matvar, z_streamp z) z->next_in = ZLIB_BYTE_PTR(uncomp_buf); z->avail_in = 8; do { + /* // cppcheck-suppress uninitvar */ z->next_out = ZLIB_BYTE_PTR(comp_buf); z->avail_out = buf_size * sizeof(*comp_buf); deflate(z, Z_NO_FLUSH); @@ -2670,6 +2673,7 @@ WriteCompressedStructField(mat_t *mat, matvar_t *matvar, z_streamp z) z->next_in = ZLIB_BYTE_PTR(uncomp_buf); z->avail_in = 8; do { + /* // cppcheck-suppress uninitvar */ z->next_out = ZLIB_BYTE_PTR(comp_buf); z->avail_out = buf_size * sizeof(*comp_buf); deflate(z, Z_NO_FLUSH); @@ -5022,6 +5026,7 @@ Mat_VarWrite5(mat_t *mat, matvar_t *matvar, int compress) z->next_in = ZLIB_BYTE_PTR(uncomp_buf); z->avail_in = 8; do { + /* // cppcheck-suppress uninitvar */ z->next_out = ZLIB_BYTE_PTR(comp_buf); z->avail_out = buf_size * sizeof(*comp_buf); deflate(z, Z_NO_FLUSH); diff --git a/tools/matdump.c b/tools/matdump.c index b8a8c3d7..2f44530d 100644 --- a/tools/matdump.c +++ b/tools/matdump.c @@ -660,7 +660,7 @@ print_default_numeric_2d(const matvar_t *matvar) printf("\n"); } } else { - char *data = (char *)matvar->data; + const char *data = (char *)matvar->data; for ( i = 0; i < matvar->dims[0]; i++ ) { for ( j = 0; j < matvar->dims[1]; j++ ) { size_t idx = matvar->dims[0] * j + i;