From a458d7fdf617d53da10c3d10099160d26b3726b5 Mon Sep 17 00:00:00 2001 From: seleznevae Date: Tue, 1 Jan 2019 19:07:57 +0300 Subject: [PATCH] [F] Fixed more clang-tidy warnings --- lib/fort.c | 10 +++++----- src/fort_impl.c | 2 +- src/fort_utils.c | 4 ++-- src/row.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/fort.c b/lib/fort.c index 8527929..f7f3646 100644 --- a/lib/fort.c +++ b/lib/fort.c @@ -1994,7 +1994,7 @@ static void set_border_props_for_props(fort_table_properties_t *properties, cons || (const struct fort_border_style *)style == &FORT_BOLD_STYLE || (const struct fort_border_style *)style == &FORT_BOLD2_STYLE || (const struct fort_border_style *)style == &FORT_FRAME_STYLE) { - memcpy(&(properties->border_style), (struct fort_border_style *)style, sizeof(struct fort_border_style)); + memcpy(&(properties->border_style), (const struct fort_border_style *)style, sizeof(struct fort_border_style)); return; } @@ -2308,7 +2308,7 @@ wchar_t *fort_wcsdup(const wchar_t *str) FT_INTERNAL size_t number_of_columns_in_format_string(const char *fmt) { - int separator_counter = 0; + size_t separator_counter = 0; const char *pos = fmt; while (1) { pos = strchr(pos, FORT_COL_SEPARATOR); @@ -2326,7 +2326,7 @@ size_t number_of_columns_in_format_string(const char *fmt) FT_INTERNAL size_t number_of_columns_in_format_wstring(const wchar_t *fmt) { - int separator_counter = 0; + size_t separator_counter = 0; const wchar_t *pos = fmt; while (1) { pos = wcschr(pos, FORT_COL_SEPARATOR); @@ -3610,7 +3610,6 @@ fort_cell_t *get_cell_implementation(fort_row_t *row, size_t col, enum PolicyOnN return *(fort_cell_t **)vector_at(row->cells, col); } return NULL; - break; case Create: while (col >= columns_in_row(row)) { fort_cell_t *new_cell = create_cell(); @@ -3622,8 +3621,9 @@ fort_cell_t *get_cell_implementation(fort_row_t *row, size_t col, enum PolicyOnN } } return *(fort_cell_t **)vector_at(row->cells, col); - break; } + + assert(0 && "Shouldn't be here!"); return NULL; } diff --git a/src/fort_impl.c b/src/fort_impl.c index 8e372c5..b08af5a 100644 --- a/src/fort_impl.c +++ b/src/fort_impl.c @@ -838,7 +838,7 @@ static void set_border_props_for_props(fort_table_properties_t *properties, cons || (const struct fort_border_style *)style == &FORT_BOLD_STYLE || (const struct fort_border_style *)style == &FORT_BOLD2_STYLE || (const struct fort_border_style *)style == &FORT_FRAME_STYLE) { - memcpy(&(properties->border_style), (struct fort_border_style *)style, sizeof(struct fort_border_style)); + memcpy(&(properties->border_style), (const struct fort_border_style *)style, sizeof(struct fort_border_style)); return; } diff --git a/src/fort_utils.c b/src/fort_utils.c index 0980558..a59b342 100644 --- a/src/fort_utils.c +++ b/src/fort_utils.c @@ -136,7 +136,7 @@ wchar_t *fort_wcsdup(const wchar_t *str) FT_INTERNAL size_t number_of_columns_in_format_string(const char *fmt) { - int separator_counter = 0; + size_t separator_counter = 0; const char *pos = fmt; while (1) { pos = strchr(pos, FORT_COL_SEPARATOR); @@ -154,7 +154,7 @@ size_t number_of_columns_in_format_string(const char *fmt) FT_INTERNAL size_t number_of_columns_in_format_wstring(const wchar_t *fmt) { - int separator_counter = 0; + size_t separator_counter = 0; const wchar_t *pos = fmt; while (1) { pos = wcschr(pos, FORT_COL_SEPARATOR); diff --git a/src/row.c b/src/row.c index 168efc3..3002bd6 100644 --- a/src/row.c +++ b/src/row.c @@ -96,7 +96,6 @@ fort_cell_t *get_cell_implementation(fort_row_t *row, size_t col, enum PolicyOnN return *(fort_cell_t **)vector_at(row->cells, col); } return NULL; - break; case Create: while (col >= columns_in_row(row)) { fort_cell_t *new_cell = create_cell(); @@ -108,8 +107,9 @@ fort_cell_t *get_cell_implementation(fort_row_t *row, size_t col, enum PolicyOnN } } return *(fort_cell_t **)vector_at(row->cells, col); - break; } + + assert(0 && "Shouldn't be here!"); return NULL; }