From 051b3145f791b40f9536d2069b100af4089a2015 Mon Sep 17 00:00:00 2001 From: seleznevae Date: Mon, 26 Aug 2019 12:33:17 +0300 Subject: [PATCH] [F] Fixed compilation problems --- lib/fort.c | 18 +++++++++--------- src/fort_impl.c | 2 +- src/fort_utils.c | 8 ++++---- src/string_buffer.c | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/fort.c b/lib/fort.c index 402e93b..57d09f7 100644 --- a/lib/fort.c +++ b/lib/fort.c @@ -3151,7 +3151,7 @@ clear: const char *ft_to_string(const ft_table_t *table) { - return ft_to_string_impl(table, CHAR_BUF); + return (const char *)ft_to_string_impl(table, CHAR_BUF); } #ifdef FT_HAVE_WCHAR @@ -3627,9 +3627,9 @@ FT_INTERNAL size_t number_of_columns_in_format_u8string(const void *fmt) { size_t separator_counter = 0; - const char *pos = fmt; + const char *pos = (const char *)fmt; while (1) { - pos = utf8chr(pos, g_col_separator); + pos = (const char *)utf8chr(pos, g_col_separator); if (pos == NULL) break; @@ -3789,8 +3789,8 @@ int ft_nwprint(conv_context_t *cntx, const wchar_t *str, size_t strlen) FT_INTERNAL int ft_nu8print(conv_context_t *cntx, const void *beg, const void *end) { - const char *bc = beg; - const char *ec = end; + const char *bc = (const char *)beg; + const char *ec = (const char *)end; size_t raw_len = ec - bc; if (cntx->raw_avail + 1 < raw_len) return -1; @@ -6024,16 +6024,16 @@ void wstr_n_substring(const wchar_t *str, wchar_t ch_separator, size_t n, const FT_INTERNAL void utf8_n_substring(const void *str, utf8_int32_t ch_separator, size_t n, const void **begin, const void **end) { - const char *beg = utf8_n_substring_beg(str, ch_separator, n); + const char *beg = (const char *)utf8_n_substring_beg(str, ch_separator, n); if (beg == NULL) { *begin = NULL; *end = NULL; return; } - const char *en = utf8chr(beg, ch_separator); + const char *en = (const char *)utf8chr(beg, ch_separator); if (en == NULL) { - en = (const char *)str + strlen(str); + en = (const char *)str + strlen((const char *)str); } *begin = beg; @@ -6219,7 +6219,7 @@ FT_INTERNAL size_t ut8_width(const void *beg, const void *end) { size_t sz = (size_t)((const char *)end - (const char *)beg); - char *tmp = F_MALLOC(sizeof(char) * (sz + 1)); + char *tmp = (char *)F_MALLOC(sizeof(char) * (sz + 1)); // @todo: add check to tmp assert(tmp); diff --git a/src/fort_impl.c b/src/fort_impl.c index e5fcd23..0b19bd0 100644 --- a/src/fort_impl.c +++ b/src/fort_impl.c @@ -697,7 +697,7 @@ clear: const char *ft_to_string(const ft_table_t *table) { - return ft_to_string_impl(table, CHAR_BUF); + return (const char *)ft_to_string_impl(table, CHAR_BUF); } #ifdef FT_HAVE_WCHAR diff --git a/src/fort_utils.c b/src/fort_utils.c index 0158c04..66c23b7 100644 --- a/src/fort_utils.c +++ b/src/fort_utils.c @@ -179,9 +179,9 @@ FT_INTERNAL size_t number_of_columns_in_format_u8string(const void *fmt) { size_t separator_counter = 0; - const char *pos = fmt; + const char *pos = (const char *)fmt; while (1) { - pos = utf8chr(pos, g_col_separator); + pos = (const char *)utf8chr(pos, g_col_separator); if (pos == NULL) break; @@ -341,8 +341,8 @@ int ft_nwprint(conv_context_t *cntx, const wchar_t *str, size_t strlen) FT_INTERNAL int ft_nu8print(conv_context_t *cntx, const void *beg, const void *end) { - const char *bc = beg; - const char *ec = end; + const char *bc = (const char *)beg; + const char *ec = (const char *)end; size_t raw_len = ec - bc; if (cntx->raw_avail + 1 < raw_len) return -1; diff --git a/src/string_buffer.c b/src/string_buffer.c index 87ae61b..d63c54b 100644 --- a/src/string_buffer.c +++ b/src/string_buffer.c @@ -226,16 +226,16 @@ void wstr_n_substring(const wchar_t *str, wchar_t ch_separator, size_t n, const FT_INTERNAL void utf8_n_substring(const void *str, utf8_int32_t ch_separator, size_t n, const void **begin, const void **end) { - const char *beg = utf8_n_substring_beg(str, ch_separator, n); + const char *beg = (const char *)utf8_n_substring_beg(str, ch_separator, n); if (beg == NULL) { *begin = NULL; *end = NULL; return; } - const char *en = utf8chr(beg, ch_separator); + const char *en = (const char *)utf8chr(beg, ch_separator); if (en == NULL) { - en = (const char *)str + strlen(str); + en = (const char *)str + strlen((const char *)str); } *begin = beg; @@ -421,7 +421,7 @@ FT_INTERNAL size_t ut8_width(const void *beg, const void *end) { size_t sz = (size_t)((const char *)end - (const char *)beg); - char *tmp = F_MALLOC(sizeof(char) * (sz + 1)); + char *tmp = (char *)F_MALLOC(sizeof(char) * (sz + 1)); // @todo: add check to tmp assert(tmp);