[F] Fixed msvc warnings
This commit is contained in:
parent
c63c1fcfb2
commit
361d356dff
@ -58,11 +58,16 @@ SOFTWARE.
|
||||
#define FT_RESTRICT __restrict
|
||||
#endif /* if defined(FT_CLANG_COMPILER) */
|
||||
#else
|
||||
|
||||
#if defined(FT_MICROSOFT_COMPILER)
|
||||
#define FT_RESTRICT restrict
|
||||
#else
|
||||
#if __STDC_VERSION__ < 199901L
|
||||
#define FT_RESTRICT
|
||||
#else
|
||||
#define FT_RESTRICT restrict
|
||||
#endif /* __STDC_VERSION__ < 199901L */
|
||||
#endif /* if defined(FT_MICROSOFT_COMPILER) */
|
||||
#endif /* if defined(__cplusplus) */
|
||||
|
||||
|
||||
|
14
src/cell.c
14
src/cell.c
@ -14,7 +14,7 @@ struct fort_cell
|
||||
fort_table_options_t *options;
|
||||
};
|
||||
|
||||
fort_cell_t * create_cell()
|
||||
fort_cell_t * create_cell(void)
|
||||
{
|
||||
fort_cell_t *cell = (fort_cell_t *)F_CALLOC(sizeof(fort_cell_t), 1);
|
||||
if (cell == NULL)
|
||||
@ -95,10 +95,10 @@ static int lines_number_cell(fort_cell_t *cell)
|
||||
}
|
||||
*/
|
||||
|
||||
int cell_printf(fort_cell_t *cell, size_t row, size_t column, char *buf, size_t buf_len, const context_t *context)
|
||||
int cell_printf(fort_cell_t *cell, size_t row, char *buf, size_t buf_len, const context_t *context)
|
||||
{
|
||||
char space_char = ' ';
|
||||
int (*buffer_printf_)(string_buffer_t *, size_t , size_t , char *, size_t , const context_t *) = buffer_printf;
|
||||
int (*buffer_printf_)(string_buffer_t *, size_t ,char *, size_t , const context_t *) = buffer_printf;
|
||||
int (*snprint_n_chars_)(char *, size_t , size_t , char) = snprint_n_chars;
|
||||
|
||||
|
||||
@ -124,7 +124,7 @@ int cell_printf(fort_cell_t *cell, size_t row, size_t column, char *buf, size_t
|
||||
written += snprint_n_chars_(buf + written, buf_len - written, left, space_char);
|
||||
|
||||
if (cell->str_buffer)
|
||||
written += buffer_printf_(cell->str_buffer, row - cell_padding_top, column, buf + written, buf_len - written - right, context);
|
||||
written += buffer_printf_(cell->str_buffer, row - cell_padding_top, buf + written, buf_len - written - right, context);
|
||||
else
|
||||
written += snprint_n_chars_(buf + written, buf_len - written, buf_len - written - right, space_char);
|
||||
written += snprint_n_chars_(buf + written, buf_len - written, right, space_char);
|
||||
@ -133,10 +133,10 @@ int cell_printf(fort_cell_t *cell, size_t row, size_t column, char *buf, size_t
|
||||
}
|
||||
}
|
||||
|
||||
int cell_wprintf(fort_cell_t *cell, size_t row, size_t column, wchar_t *buf, size_t buf_len, const context_t *context)
|
||||
int cell_wprintf(fort_cell_t *cell, size_t row, wchar_t *buf, size_t buf_len, const context_t *context)
|
||||
{
|
||||
wchar_t space_char = L' ';
|
||||
int (*buffer_printf_)(string_buffer_t *, size_t , size_t , wchar_t *, size_t , const context_t *) = buffer_wprintf;
|
||||
int (*buffer_printf_)(string_buffer_t *, size_t , wchar_t *, size_t , const context_t *) = buffer_wprintf;
|
||||
int (*snprint_n_chars_)(wchar_t *, size_t , size_t , wchar_t) = wsnprint_n_chars;
|
||||
|
||||
|
||||
@ -162,7 +162,7 @@ int cell_wprintf(fort_cell_t *cell, size_t row, size_t column, wchar_t *buf, siz
|
||||
written += snprint_n_chars_(buf + written, buf_len - written, left, space_char);
|
||||
|
||||
if (cell->str_buffer)
|
||||
written += buffer_printf_(cell->str_buffer, row - cell_padding_top, column, buf + written, buf_len - written - right, context);
|
||||
written += buffer_printf_(cell->str_buffer, row - cell_padding_top, buf + written, buf_len - written - right, context);
|
||||
else
|
||||
written += snprint_n_chars_(buf + written, buf_len - written, buf_len - written - right, space_char);
|
||||
written += snprint_n_chars_(buf + written, buf_len - written, right, space_char);
|
||||
|
@ -9,7 +9,7 @@
|
||||
/*****************************************************************************
|
||||
* CELL
|
||||
* ***************************************************************************/
|
||||
fort_cell_t * create_cell();
|
||||
fort_cell_t * create_cell(void);
|
||||
|
||||
|
||||
void destroy_cell(fort_cell_t *cell);
|
||||
@ -23,8 +23,8 @@ int hint_height_cell(const fort_cell_t *cell, const context_t *context);
|
||||
*/
|
||||
/* static int lines_number_cell(fort_cell_t *cell); */
|
||||
|
||||
int cell_printf(fort_cell_t *cell, size_t row, size_t column, char *buf, size_t buf_len, const context_t *context);
|
||||
int cell_wprintf(fort_cell_t *cell, size_t row, size_t column, wchar_t *buf, size_t buf_len, const context_t *context);
|
||||
int cell_printf(fort_cell_t *cell, size_t row, char *buf, size_t buf_len, const context_t *context);
|
||||
int cell_wprintf(fort_cell_t *cell, size_t row, wchar_t *buf, size_t buf_len, const context_t *context);
|
||||
|
||||
|
||||
fort_status_t fill_cell_from_string(fort_cell_t *cell, const char *str);
|
||||
|
32
src/fort.c
32
src/fort.c
@ -682,23 +682,23 @@ clear:
|
||||
/*
|
||||
* TMP
|
||||
*/
|
||||
static int dummy_function()
|
||||
#if defined(FT_CLANG_COMPILER) || defined(FT_GCC_COMPILER)
|
||||
__attribute__ ((unused))
|
||||
#endif
|
||||
;
|
||||
//static int dummy_function(void)
|
||||
//#if defined(FT_CLANG_COMPILER) || defined(FT_GCC_COMPILER)
|
||||
//__attribute__ ((unused))
|
||||
//#endif
|
||||
//;
|
||||
|
||||
static int dummy_function()
|
||||
{
|
||||
if (0) {
|
||||
vector_t *v = create_vector(1, DEFAULT_VECTOR_CAPACITY);
|
||||
vector_clear(v);
|
||||
vector_erase(v, 0);
|
||||
vector_index_of(v, NULL);
|
||||
vector_capacity(v);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//static int dummy_function(void)
|
||||
//{
|
||||
// if (0) {
|
||||
// vector_t *v = create_vector(1, DEFAULT_VECTOR_CAPACITY);
|
||||
// vector_clear(v);
|
||||
// vector_erase(v, 0);
|
||||
// vector_index_of(v, NULL);
|
||||
// vector_capacity(v);
|
||||
// }
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
14
src/row.c
14
src/row.c
@ -13,7 +13,7 @@ struct fort_row
|
||||
|
||||
|
||||
|
||||
fort_row_t * create_row()
|
||||
fort_row_t * create_row(void)
|
||||
{
|
||||
fort_row_t * row = (fort_row_t *)F_CALLOC(sizeof(fort_row_t), 1);
|
||||
if (row == NULL)
|
||||
@ -428,8 +428,8 @@ fort_row_t* create_row_from_fmt_string(const char* FT_RESTRICT fmt, va_list *va_
|
||||
if (buffer == NULL)
|
||||
return NULL;
|
||||
|
||||
int cols_origin = number_of_columns_in_format_string(fmt);
|
||||
int cols = 0;
|
||||
size_t cols_origin = number_of_columns_in_format_string(fmt);
|
||||
size_t cols = 0;
|
||||
|
||||
while (1) {
|
||||
va_list va;
|
||||
@ -483,7 +483,7 @@ int snprintf_row(const fort_row_t *row, char *buffer, size_t buf_sz, size_t *col
|
||||
char space_char = ' ';
|
||||
char new_line_char = '\n';
|
||||
int (*snprint_n_chars_)(char *, size_t , size_t , char) = snprint_n_chars;
|
||||
int (*cell_printf_)(fort_cell_t *, size_t, size_t, char *, size_t, const context_t *) = cell_printf;
|
||||
int (*cell_printf_)(fort_cell_t *, size_t, char *, size_t, const context_t *) = cell_printf;
|
||||
|
||||
|
||||
assert(context);
|
||||
@ -522,7 +522,7 @@ int snprintf_row(const fort_row_t *row, char *buffer, size_t buf_sz, size_t *col
|
||||
((context_t *)context)->column = j;
|
||||
if (j < cols_in_row) {
|
||||
fort_cell_t *cell = *(fort_cell_t**)vector_at(row->cells, j);
|
||||
CHECK_RESULT_AND_MOVE_DEV(cell_printf_(cell, i, j, buffer + dev, col_width_arr[j] + 1, context));
|
||||
CHECK_RESULT_AND_MOVE_DEV(cell_printf_(cell, i, buffer + dev, col_width_arr[j] + 1, context));
|
||||
} else {
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, col_width_arr[j], space_char));
|
||||
}
|
||||
@ -561,7 +561,7 @@ int wsnprintf_row(const fort_row_t *row, wchar_t *buffer, size_t buf_sz, size_t
|
||||
char space_char = L' ';
|
||||
char new_line_char = L'\n';
|
||||
int (*snprint_n_chars_)(wchar_t *, size_t , size_t , wchar_t) = wsnprint_n_chars;
|
||||
int (*cell_printf_)(fort_cell_t *, size_t, size_t, wchar_t *, size_t, const context_t *) = cell_wprintf;
|
||||
int (*cell_printf_)(fort_cell_t *, size_t, wchar_t *, size_t, const context_t *) = cell_wprintf;
|
||||
|
||||
|
||||
assert(context);
|
||||
@ -600,7 +600,7 @@ int wsnprintf_row(const fort_row_t *row, wchar_t *buffer, size_t buf_sz, size_t
|
||||
((context_t *)context)->column = j;
|
||||
if (j < cols_in_row) {
|
||||
fort_cell_t *cell = *(fort_cell_t**)vector_at(row->cells, j);
|
||||
CHECK_RESULT_AND_MOVE_DEV(cell_printf_(cell, i, j, buffer + dev, col_width_arr[j] + 1, context));
|
||||
CHECK_RESULT_AND_MOVE_DEV(cell_printf_(cell, i, buffer + dev, col_width_arr[j] + 1, context));
|
||||
} else {
|
||||
CHECK_RESULT_AND_MOVE_DEV(snprint_n_chars_(buffer + dev, buf_sz - dev, col_width_arr[j], space_char));
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ enum RowType
|
||||
*/
|
||||
|
||||
|
||||
fort_row_t * create_row();
|
||||
fort_row_t * create_row(void);
|
||||
void destroy_row(fort_row_t *row);
|
||||
fort_row_t * create_row_from_string(const char *str);
|
||||
fort_row_t* create_row_from_fmt_string(const char* FT_RESTRICT fmt, va_list *va_args);
|
||||
|
@ -261,7 +261,6 @@ size_t buffer_text_width(string_buffer_t *buffer)
|
||||
|
||||
int line_width = mk_wcswidth(beg, end - beg);
|
||||
max_length = MAX(max_length, line_width);
|
||||
// max_length = MAX(max_length, (end - beg));
|
||||
|
||||
++n;
|
||||
}
|
||||
@ -270,7 +269,7 @@ size_t buffer_text_width(string_buffer_t *buffer)
|
||||
|
||||
|
||||
|
||||
int buffer_printf(string_buffer_t *buffer, size_t buffer_row, size_t table_column, char *buf, size_t buf_len, const context_t *context)
|
||||
int buffer_printf(string_buffer_t *buffer, size_t buffer_row, char *buf, size_t buf_len, const context_t *context)
|
||||
{
|
||||
#define CHAR_TYPE char
|
||||
#define NULL_CHAR '\0'
|
||||
@ -354,7 +353,7 @@ int buffer_printf(string_buffer_t *buffer, size_t buffer_row, size_t table_colum
|
||||
}
|
||||
|
||||
|
||||
int buffer_wprintf(string_buffer_t *buffer, size_t buffer_row, size_t table_column, wchar_t *buf, size_t buf_len, const context_t *context)
|
||||
int buffer_wprintf(string_buffer_t *buffer, size_t buffer_row, wchar_t *buf, size_t buf_len, const context_t *context)
|
||||
{
|
||||
#define CHAR_TYPE wchar_t
|
||||
#define NULL_CHAR L'\0'
|
||||
|
@ -40,7 +40,7 @@ void *buffer_get_data(string_buffer_t *buffer);
|
||||
|
||||
|
||||
size_t buffer_text_width(string_buffer_t *buffer);
|
||||
int buffer_printf(string_buffer_t *buffer, size_t buffer_row, size_t table_column, char *buf, size_t buf_len, const context_t *context);
|
||||
int buffer_wprintf(string_buffer_t *buffer, size_t buffer_row, size_t table_column, wchar_t *buf, size_t buf_len, const context_t *context);
|
||||
int buffer_printf(string_buffer_t *buffer, size_t buffer_row, char *buf, size_t buf_len, const context_t *context);
|
||||
int buffer_wprintf(string_buffer_t *buffer, size_t buffer_row, wchar_t *buf, size_t buf_len, const context_t *context);
|
||||
|
||||
#endif /* STRING_BUFFER_H */
|
||||
|
Loading…
Reference in New Issue
Block a user