1
0
Fork 0

[F] Fixed old compiler warnings

This commit is contained in:
seleznevae 2018-12-03 23:07:58 +03:00
parent 703e6451f2
commit 6f49a77e5e
3 changed files with 32 additions and 26 deletions

View File

@ -127,12 +127,12 @@ script:
fi
# basic build with old c standard
- |
if [ "${BASIC_LINUX_GCC}" = "yes" ]; then
cd lib
gcc -Wextra -Wall -Werror --std=c89 fort.c -c -o fort.o
rm fort.o
cd ..
- if [ "${BASIC_LINUX_GCC}" = "yes" ];
then
cd lib
gcc -Wextra -Wall -Werror --std=c89 fort.c -c -o fort.o
rm fort.o
cd ..
fi
# cppcheck run

View File

@ -1256,8 +1256,9 @@ ft_table_t *ft_copy_table(ft_table_t *table)
if (result == NULL)
return NULL;
size_t i = 0;
size_t rows_n = vector_size(table->rows);
for (size_t i = 0; i < rows_n; ++i) {
for (i = 0; i < rows_n; ++i) {
fort_row_t *row = *(fort_row_t **)vector_at(table->rows, i);
fort_row_t *new_row = copy_row(row);
if (new_row == NULL) {
@ -1268,7 +1269,7 @@ ft_table_t *ft_copy_table(ft_table_t *table)
}
size_t sep_sz = vector_size(table->separators);
for (size_t i = 0; i < sep_sz; ++i) {
for (i = 0; i < sep_sz; ++i) {
separator_t *sep = *(separator_t **)vector_at(table->separators, i);
separator_t *new_sep = copy_separator(sep);
if (new_sep == NULL) {
@ -1821,7 +1822,6 @@ const char *ft_to_string(const ft_table_t *table)
clear:
F_FREE(col_width_arr);
F_FREE(row_height_arr);
// F_FREE(buffer);
return NULL;
#undef EMPTY_STRING
}
@ -1924,7 +1924,6 @@ const wchar_t *ft_to_wstring(const ft_table_t *table)
clear:
F_FREE(col_width_arr);
F_FREE(row_height_arr);
// F_FREE(buffer);
return NULL;
#undef EMPTY_STRING
}
@ -2027,9 +2026,11 @@ static void set_border_props_for_props(fort_table_properties_t *properties, cons
BOR_CHARS[LI_bip] = BOR_CHARS[TI_bip] = BOR_CHARS[RI_bip] = BOR_CHARS[BI_bip] = border_chs->in_intersect_ch;
// if (border_chs->separator_ch == '\0' && border_chs->in_intersect_ch == '\0') {
// BOR_CHARS[LH_bip] = BOR_CHARS[RH_bip] = '\0';
// }
/*
if (border_chs->separator_ch == '\0' && border_chs->in_intersect_ch == '\0') {
BOR_CHARS[LH_bip] = BOR_CHARS[RH_bip] = '\0';
}
*/
if (strlen(border_chs->separator_ch) == 0 && strlen(border_chs->in_intersect_ch) == 0) {
BOR_CHARS[LH_bip] = BOR_CHARS[RH_bip] = "\0";
}
@ -2047,9 +2048,11 @@ static void set_border_props_for_props(fort_table_properties_t *properties, cons
H_BOR_CHARS[LI_bip] = H_BOR_CHARS[TI_bip] = H_BOR_CHARS[RI_bip] = H_BOR_CHARS[BI_bip] = header_border_chs->in_intersect_ch;
// if (header_border_chs->separator_ch == '\0' && header_border_chs->in_intersect_ch == '\0') {
// H_BOR_CHARS[LH_bip] = H_BOR_CHARS[RH_bip] = '\0';
// }
/*
if (header_border_chs->separator_ch == '\0' && header_border_chs->in_intersect_ch == '\0') {
H_BOR_CHARS[LH_bip] = H_BOR_CHARS[RH_bip] = '\0';
}
*/
if (strlen(header_border_chs->separator_ch) == 0 && strlen(header_border_chs->in_intersect_ch) == 0) {
BOR_CHARS[LH_bip] = BOR_CHARS[RH_bip] = "\0";
}

View File

@ -101,8 +101,9 @@ ft_table_t *ft_copy_table(ft_table_t *table)
if (result == NULL)
return NULL;
size_t i = 0;
size_t rows_n = vector_size(table->rows);
for (size_t i = 0; i < rows_n; ++i) {
for (i = 0; i < rows_n; ++i) {
fort_row_t *row = *(fort_row_t **)vector_at(table->rows, i);
fort_row_t *new_row = copy_row(row);
if (new_row == NULL) {
@ -113,7 +114,7 @@ ft_table_t *ft_copy_table(ft_table_t *table)
}
size_t sep_sz = vector_size(table->separators);
for (size_t i = 0; i < sep_sz; ++i) {
for (i = 0; i < sep_sz; ++i) {
separator_t *sep = *(separator_t **)vector_at(table->separators, i);
separator_t *new_sep = copy_separator(sep);
if (new_sep == NULL) {
@ -666,7 +667,6 @@ const char *ft_to_string(const ft_table_t *table)
clear:
F_FREE(col_width_arr);
F_FREE(row_height_arr);
// F_FREE(buffer);
return NULL;
#undef EMPTY_STRING
}
@ -769,7 +769,6 @@ const wchar_t *ft_to_wstring(const ft_table_t *table)
clear:
F_FREE(col_width_arr);
F_FREE(row_height_arr);
// F_FREE(buffer);
return NULL;
#undef EMPTY_STRING
}
@ -872,9 +871,11 @@ static void set_border_props_for_props(fort_table_properties_t *properties, cons
BOR_CHARS[LI_bip] = BOR_CHARS[TI_bip] = BOR_CHARS[RI_bip] = BOR_CHARS[BI_bip] = border_chs->in_intersect_ch;
// if (border_chs->separator_ch == '\0' && border_chs->in_intersect_ch == '\0') {
// BOR_CHARS[LH_bip] = BOR_CHARS[RH_bip] = '\0';
// }
/*
if (border_chs->separator_ch == '\0' && border_chs->in_intersect_ch == '\0') {
BOR_CHARS[LH_bip] = BOR_CHARS[RH_bip] = '\0';
}
*/
if (strlen(border_chs->separator_ch) == 0 && strlen(border_chs->in_intersect_ch) == 0) {
BOR_CHARS[LH_bip] = BOR_CHARS[RH_bip] = "\0";
}
@ -892,9 +893,11 @@ static void set_border_props_for_props(fort_table_properties_t *properties, cons
H_BOR_CHARS[LI_bip] = H_BOR_CHARS[TI_bip] = H_BOR_CHARS[RI_bip] = H_BOR_CHARS[BI_bip] = header_border_chs->in_intersect_ch;
// if (header_border_chs->separator_ch == '\0' && header_border_chs->in_intersect_ch == '\0') {
// H_BOR_CHARS[LH_bip] = H_BOR_CHARS[RH_bip] = '\0';
// }
/*
if (header_border_chs->separator_ch == '\0' && header_border_chs->in_intersect_ch == '\0') {
H_BOR_CHARS[LH_bip] = H_BOR_CHARS[RH_bip] = '\0';
}
*/
if (strlen(header_border_chs->separator_ch) == 0 && strlen(header_border_chs->in_intersect_ch) == 0) {
BOR_CHARS[LH_bip] = BOR_CHARS[RH_bip] = "\0";
}