From 4c7eef8081cb98881d85ac880b79dae1fd946660 Mon Sep 17 00:00:00 2001 From: seleznevae Date: Sun, 18 Nov 2018 11:32:07 +0300 Subject: [PATCH] [A] Added more checks --- .travis.yml | 5 ++++- lib/fort.c | 4 +++- src/string_buffer.c | 3 ++- src/table.c | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index bc355a8..b2afcdb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -104,7 +104,10 @@ script: # cppcheck run - | if [ "${FORT_C_COMPILER}" = "gcc-8" ]; then - cppcheck --enable=warning,style,performance,portability,information,missingInclude --error-exitcode=1 lib + cppcheck --std=posix --enable=warning,style,performance,portability,information,missingInclude --error-exitcode=1 lib + cppcheck --std=c89 --enable=warning,style,performance,portability,information,missingInclude --error-exitcode=1 lib + cppcheck --std=c99 --enable=warning,style,performance,portability,information,missingInclude --error-exitcode=1 lib + cppcheck --std=c++11 --enable=warning,style,performance,portability,information,missingInclude --error-exitcode=1 lib fi # Print all environment variables to aid in CI development diff --git a/lib/fort.c b/lib/fort.c index fa852b4..00efd0d 100644 --- a/lib/fort.c +++ b/lib/fort.c @@ -4945,8 +4945,8 @@ FT_INTERNAL size_t buffer_text_width(string_buffer_t *buffer) { size_t max_length = 0; - int n = 0; if (buffer->type == CharBuf) { + int n = 0; while (1) { const char *beg = NULL; const char *end = NULL; @@ -4959,6 +4959,7 @@ size_t buffer_text_width(string_buffer_t *buffer) } #ifdef FT_HAVE_WCHAR } else { + int n = 0; while (1) { const wchar_t *beg = NULL; const wchar_t *end = NULL; @@ -5307,6 +5308,7 @@ fort_status_t get_table_sizes(const ft_table_t *table, size_t *rows, size_t *col *rows = vector_size(table->rows); fort_row_t *row = NULL; FOR_EACH(fort_row_t *, row, table->rows) { + (void)i0; size_t cols_in_row = columns_in_row(row); if (cols_in_row > *cols) *cols = cols_in_row; diff --git a/src/string_buffer.c b/src/string_buffer.c index dee01d3..1bb816a 100644 --- a/src/string_buffer.c +++ b/src/string_buffer.c @@ -307,8 +307,8 @@ FT_INTERNAL size_t buffer_text_width(string_buffer_t *buffer) { size_t max_length = 0; - int n = 0; if (buffer->type == CharBuf) { + int n = 0; while (1) { const char *beg = NULL; const char *end = NULL; @@ -321,6 +321,7 @@ size_t buffer_text_width(string_buffer_t *buffer) } #ifdef FT_HAVE_WCHAR } else { + int n = 0; while (1) { const wchar_t *beg = NULL; const wchar_t *end = NULL; diff --git a/src/table.c b/src/table.c index 12a4bb3..1e3d606 100644 --- a/src/table.c +++ b/src/table.c @@ -110,6 +110,7 @@ fort_status_t get_table_sizes(const ft_table_t *table, size_t *rows, size_t *col *rows = vector_size(table->rows); fort_row_t *row = NULL; FOR_EACH(fort_row_t *, row, table->rows) { + (void)i0; size_t cols_in_row = columns_in_row(row); if (cols_in_row > *cols) *cols = cols_in_row;