[A] Added more checks
This commit is contained in:
parent
8a79a05a96
commit
abcd7aeb99
@ -160,7 +160,7 @@ int main()
|
||||
FT_NWWRITE_LN(table, L"4", L"Бегущий по лезвию", L"1982", L"8.1");
|
||||
|
||||
/* Ранг | Название | Год | Рейтинг */
|
||||
/*FT_NWWRITE_LN(table, L"\x420\x430\x43d\x433", L"\x41d\x430\x437\x432\x430\x43d\x438\x435", L"\x413\x43e\x434", L"\x420\x435\x439\x442\x438\x43d\x433");
|
||||
/*FT_NWWRITE_LN(table, L"\x420\x430\x43d\x433", L"\x41d\x430\x437\x432\x430\x43d\x438\x435", L"\x413\x43e\x434", L"\x420\x435\x439\x442\x438\x43d\x433"); */
|
||||
|
||||
/*FT_NWWRITE_LN(table, L"1", L"\x41f\x43e\x431\x435\x433 \x438\x437 \x428\x43e\x443\x448\x435\x43d\x43a\x430", L"1994", L"9.5");*/ /* Побег из Шоушенка */
|
||||
/*FT_NWWRITE_LN(table, L"2", L"12 \x440\x430\x437\x433\x43d\x435\x432\x430\x43d\x43d\x44b\x445 \x43c\x443\x436\x447\x438\x43d", L"1957", L"8.8");*/ /* 12 разгневанных мужчин */
|
||||
|
24
src/row.c
24
src/row.c
@ -516,27 +516,27 @@ int snprintf_row(const fort_row_t *row, char *buffer, size_t buf_sz, size_t *col
|
||||
/* Print left margin */
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, context->table_options->entire_table_options.left_margin, space_char));
|
||||
|
||||
dev += snprint_n_chars_(buffer + dev, buf_sz - dev, 1, (char_type)*L);
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, 1, (char_type)*L));
|
||||
size_t j = 0;
|
||||
for (j = 0; j < col_width_arr_sz; ++j) {
|
||||
((context_t *)context)->column = j;
|
||||
if (j < cols_in_row) {
|
||||
fort_cell_t *cell = *(fort_cell_t**)vector_at(row->cells, j);
|
||||
dev += cell_printf_(cell, i, j, buffer + dev, col_width_arr[j] + 1, context);
|
||||
CHECK_RESULT_AND_MOVE_DEV(cell_printf_(cell, i, j, buffer + dev, col_width_arr[j] + 1, context));
|
||||
} else {
|
||||
dev += snprint_n_chars_(buffer + dev, buf_sz - dev, col_width_arr[j], space_char);
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, col_width_arr[j], space_char));
|
||||
}
|
||||
if (j == col_width_arr_sz - 1) {
|
||||
dev += snprint_n_chars_(buffer + dev, buf_sz - dev, 1, (char_type)*R);
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, 1, (char_type)*R));
|
||||
} else {
|
||||
dev += snprint_n_chars_(buffer + dev, buf_sz - dev, 1, (char_type)*IV);
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, 1, (char_type)*IV));
|
||||
}
|
||||
}
|
||||
|
||||
/* Print right margin */
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, context->table_options->entire_table_options.right_margin, space_char));
|
||||
|
||||
dev += snprint_n_chars_(buffer + dev, buf_sz - dev, 1, new_line_char);
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, 1, new_line_char));
|
||||
}
|
||||
return dev;
|
||||
|
||||
@ -594,27 +594,27 @@ int wsnprintf_row(const fort_row_t *row, wchar_t *buffer, size_t buf_sz, size_t
|
||||
/* Print left margin */
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, context->table_options->entire_table_options.left_margin, space_char));
|
||||
|
||||
dev += snprint_n_chars_(buffer + dev, buf_sz - dev, 1, (char_type)*L);
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, 1, (char_type)*L));
|
||||
size_t j = 0;
|
||||
for (j = 0; j < col_width_arr_sz; ++j) {
|
||||
((context_t *)context)->column = j;
|
||||
if (j < cols_in_row) {
|
||||
fort_cell_t *cell = *(fort_cell_t**)vector_at(row->cells, j);
|
||||
dev += cell_printf_(cell, i, j, buffer + dev, col_width_arr[j] + 1, context);
|
||||
CHECK_RESULT_AND_MOVE_DEV(cell_printf_(cell, i, j, buffer + dev, col_width_arr[j] + 1, context));
|
||||
} else {
|
||||
dev += snprint_n_chars_(buffer + dev, buf_sz - dev, col_width_arr[j], space_char);
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, col_width_arr[j], space_char));
|
||||
}
|
||||
if (j == col_width_arr_sz - 1) {
|
||||
dev += snprint_n_chars_(buffer + dev, buf_sz - dev, 1, (char_type)*R);
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, 1, (char_type)*R));
|
||||
} else {
|
||||
dev += snprint_n_chars_(buffer + dev, buf_sz - dev, 1, (char_type)*IV);
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, 1, (char_type)*IV));
|
||||
}
|
||||
}
|
||||
|
||||
/* Print right margin */
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, context->table_options->entire_table_options.right_margin, space_char));
|
||||
|
||||
dev += snprint_n_chars_(buffer + dev, buf_sz - dev, 1, new_line_char);
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, 1, new_line_char));
|
||||
}
|
||||
return dev;
|
||||
|
||||
|
@ -70,7 +70,7 @@ void test_table_tbl_options(void)
|
||||
}
|
||||
|
||||
|
||||
WHEN("Test setting entire table options") {
|
||||
WHEN("Test setting entire table options(wide strings case)") {
|
||||
set_test_options_as_default();
|
||||
|
||||
table = create_test_int_wtable(0);
|
||||
|
Loading…
Reference in New Issue
Block a user