Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
tbeu committed Feb 25, 2024
1 parent 324f59b commit 80c187a
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repos:
rev: v17.0.6
hooks:
- id: clang-format
files: ^(src\/.+\.[ch]|tools\/matdump.c)$
files: ^(src\/.+\.[ch]|tools\/matdump.c|test\/test_mat.c)$
exclude: ^(src\/fortran\/matio_internal.c|src\/snprintf.c|src\/safe-math.h)$

- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
5 changes: 1 addition & 4 deletions cmake/staticAnalyzers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -11,11 +12,7 @@ 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.")
else()
message(SEND_ERROR "Cppcheck requested but executable not found.")
endif()
Expand Down
5 changes: 5 additions & 0 deletions src/mat5.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ WriteCompressedData(mat_t *mat, z_streamp z, void *data, int N, enum matio_types
z->next_out = buf;
z->avail_out = buf_size;
deflate(z, Z_NO_FLUSH);
/* // cppcheck-suppress uninitvar */
byteswritten += fwrite(buf, 1, buf_size - z->avail_out, (FILE *)mat->fp);
} while ( z->avail_out == 0 );

Expand Down Expand Up @@ -2299,6 +2300,7 @@ WriteCompressedTypeArrayFlags(mat_t *mat, matvar_t *matvar, z_streamp z)
z->next_out = ZLIB_BYTE_PTR(comp_buf);
z->avail_out = buf_size * sizeof(*comp_buf);
deflate(z, Z_NO_FLUSH);
/* // cppcheck-suppress uninitvar */
byteswritten +=
fwrite(comp_buf, 1, buf_size * sizeof(*comp_buf) - z->avail_out, (FILE *)mat->fp);
} while ( z->avail_out == 0 );
Expand Down Expand Up @@ -2540,6 +2542,7 @@ WriteCompressedCellArrayField(mat_t *mat, matvar_t *matvar, z_streamp z)
z->next_out = ZLIB_BYTE_PTR(comp_buf);
z->avail_out = buf_size * sizeof(*comp_buf);
deflate(z, Z_NO_FLUSH);
/* // cppcheck-suppress uninitvar */
byteswritten +=
fwrite(comp_buf, 1, buf_size * sizeof(*comp_buf) - z->avail_out, (FILE *)mat->fp);
} while ( z->avail_out == 0 );
Expand Down Expand Up @@ -2673,6 +2676,7 @@ WriteCompressedStructField(mat_t *mat, matvar_t *matvar, z_streamp z)
z->next_out = ZLIB_BYTE_PTR(comp_buf);
z->avail_out = buf_size * sizeof(*comp_buf);
deflate(z, Z_NO_FLUSH);
/* // cppcheck-suppress uninitvar */
byteswritten +=
fwrite(comp_buf, 1, buf_size * sizeof(*comp_buf) - z->avail_out, (FILE *)mat->fp);
} while ( z->avail_out == 0 );
Expand Down Expand Up @@ -5025,6 +5029,7 @@ Mat_VarWrite5(mat_t *mat, matvar_t *matvar, int compress)
z->next_out = ZLIB_BYTE_PTR(comp_buf);
z->avail_out = buf_size * sizeof(*comp_buf);
deflate(z, Z_NO_FLUSH);
/* // cppcheck-suppress uninitvar */
fwrite(comp_buf, 1, buf_size * sizeof(*comp_buf) - z->avail_out, (FILE *)mat->fp);
} while ( z->avail_out == 0 );
uncomp_buf[0] = array_flags_type;
Expand Down
Loading

0 comments on commit 80c187a

Please sign in to comment.