[F] Fixed compiler warnings

This commit is contained in:
seleznevae 2018-07-29 11:24:05 +03:00
parent 0c8a8793a0
commit 087ad4e10b
4 changed files with 17 additions and 13 deletions

View File

@ -3,9 +3,9 @@
[![Build Status](https://travis-ci.org/seleznevae/libfort.svg?branch=master)](https://travis-ci.org/seleznevae/libfort) [![Build Status](https://travis-ci.org/seleznevae/libfort.svg?branch=master)](https://travis-ci.org/seleznevae/libfort)
[![Build status](https://ci.appveyor.com/api/projects/status/ll1qygb56pho95xw/branch/master?svg=true)](https://ci.appveyor.com/project/seleznevae/libfort/branch/master) [![Build status](https://ci.appveyor.com/api/projects/status/ll1qygb56pho95xw/branch/master?svg=true)](https://ci.appveyor.com/project/seleznevae/libfort/branch/master)
[![Coverage Status](https://coveralls.io/repos/github/seleznevae/libfort/badge.svg?branch=master)](https://coveralls.io/github/seleznevae/libfort?branch=master) [![Coverage Status](https://coveralls.io/repos/github/seleznevae/libfort/badge.svg?branch=master)](https://coveralls.io/github/seleznevae/libfort?branch=master)
[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://wandbox.org/permlink/6QTaJLeXIf6mS6KN)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
**libfort** - a simple library to create formatted ASCII tables. **libfort** is written in C language and can be used in C and C++ projects. For C++ projects that use compiler with c++11 support there are also availabe convenient c++ wrappers around c functions (see **fort.hpp** in **lib** direrctory). **libfort** - a simple library to create formatted ASCII tables. **libfort** is written in C language and can be used in C and C++ projects. For C++ projects that use compiler with c++11 support there are also availabe convenient c++ wrappers around c functions (see **fort.hpp** in **lib** direrctory).
**Features:** **Features:**

View File

@ -3092,6 +3092,7 @@ int buffer_printf(string_buffer_t *buffer, size_t buffer_row, char *buf, size_t
int written = 0; int written = 0;
int tmp = 0; int tmp = 0;
ptrdiff_t str_it_width = 0;
const CHAR_TYPE *beg = NULL; const CHAR_TYPE *beg = NULL;
const CHAR_TYPE *end = NULL; const CHAR_TYPE *end = NULL;
CHAR_TYPE old_value; CHAR_TYPE old_value;
@ -3104,7 +3105,7 @@ int buffer_printf(string_buffer_t *buffer, size_t buffer_row, char *buf, size_t
old_value = *end; old_value = *end;
*(CHAR_TYPE *)end = NULL_CHAR; *(CHAR_TYPE *)end = NULL_CHAR;
ptrdiff_t str_it_width = STR_ITER_WIDTH(beg, end); str_it_width = STR_ITER_WIDTH(beg, end);
if (str_it_width < 0 || content_width < (size_t)str_it_width) if (str_it_width < 0 || content_width < (size_t)str_it_width)
return - 1; return - 1;
@ -3177,6 +3178,7 @@ int buffer_wprintf(string_buffer_t *buffer, size_t buffer_row, wchar_t *buf, siz
int written = 0; int written = 0;
int tmp = 0; int tmp = 0;
ptrdiff_t str_it_width = 0;
const CHAR_TYPE *beg = NULL; const CHAR_TYPE *beg = NULL;
const CHAR_TYPE *end = NULL; const CHAR_TYPE *end = NULL;
CHAR_TYPE old_value; CHAR_TYPE old_value;
@ -3189,7 +3191,7 @@ int buffer_wprintf(string_buffer_t *buffer, size_t buffer_row, wchar_t *buf, siz
old_value = *end; old_value = *end;
*(CHAR_TYPE *)end = NULL_CHAR; *(CHAR_TYPE *)end = NULL_CHAR;
ptrdiff_t str_it_width = STR_ITER_WIDTH(beg, end); str_it_width = STR_ITER_WIDTH(beg, end);
if (str_it_width < 0 || content_width < (size_t)str_it_width) if (str_it_width < 0 || content_width < (size_t)str_it_width)
return - 1; return - 1;
@ -3835,6 +3837,8 @@ int print_row_separator(char *buffer, size_t buffer_sz,
} }
} }
size_t i = 0;
/* If all chars are not printable, skip line separator */ /* todo: add processing for wchar_t */ /* If all chars are not printable, skip line separator */ /* todo: add processing for wchar_t */
// if (!isprint(*L) && !isprint(*I) && !isprint(*IV) && !isprint(*R)) { // if (!isprint(*L) && !isprint(*I) && !isprint(*IV) && !isprint(*R)) {
// status = 0; // status = 0;
@ -3848,8 +3852,6 @@ int print_row_separator(char *buffer, size_t buffer_sz,
goto clear; goto clear;
} }
size_t i = 0;
/* Print left margin */ /* Print left margin */
CHCK_RSLT_ADD_TO_WRITTEN(snprint_n_strings_(buffer + written, buffer_sz - written, context->table_options->entire_table_options.left_margin, space_char)); CHCK_RSLT_ADD_TO_WRITTEN(snprint_n_strings_(buffer + written, buffer_sz - written, context->table_options->entire_table_options.left_margin, space_char));
@ -4008,6 +4010,8 @@ int wprint_row_separator(wchar_t *buffer, size_t buffer_sz,
} }
} }
size_t i = 0;
/* If all chars are not printable, skip line separator */ /* todo: add processing for wchar_t */ /* If all chars are not printable, skip line separator */ /* todo: add processing for wchar_t */
// if (!isprint(*L) && !isprint(*I) && !isprint(*IV) && !isprint(*R)) { // if (!isprint(*L) && !isprint(*I) && !isprint(*IV) && !isprint(*R)) {
// status = 0; // status = 0;
@ -4021,8 +4025,6 @@ int wprint_row_separator(wchar_t *buffer, size_t buffer_sz,
goto clear; goto clear;
} }
size_t i = 0;
/* Print left margin */ /* Print left margin */
CHCK_RSLT_ADD_TO_WRITTEN(snprint_n_strings_(buffer + written, buffer_sz - written, context->table_options->entire_table_options.left_margin, space_char)); CHCK_RSLT_ADD_TO_WRITTEN(snprint_n_strings_(buffer + written, buffer_sz - written, context->table_options->entire_table_options.left_margin, space_char));

View File

@ -313,6 +313,8 @@ int print_row_separator(char *buffer, size_t buffer_sz,
} }
} }
size_t i = 0;
/* If all chars are not printable, skip line separator */ /* todo: add processing for wchar_t */ /* If all chars are not printable, skip line separator */ /* todo: add processing for wchar_t */
// if (!isprint(*L) && !isprint(*I) && !isprint(*IV) && !isprint(*R)) { // if (!isprint(*L) && !isprint(*I) && !isprint(*IV) && !isprint(*R)) {
// status = 0; // status = 0;
@ -326,8 +328,6 @@ int print_row_separator(char *buffer, size_t buffer_sz,
goto clear; goto clear;
} }
size_t i = 0;
/* Print left margin */ /* Print left margin */
CHCK_RSLT_ADD_TO_WRITTEN(snprint_n_strings_(buffer + written, buffer_sz - written, context->table_options->entire_table_options.left_margin, space_char)); CHCK_RSLT_ADD_TO_WRITTEN(snprint_n_strings_(buffer + written, buffer_sz - written, context->table_options->entire_table_options.left_margin, space_char));
@ -486,6 +486,8 @@ int wprint_row_separator(wchar_t *buffer, size_t buffer_sz,
} }
} }
size_t i = 0;
/* If all chars are not printable, skip line separator */ /* todo: add processing for wchar_t */ /* If all chars are not printable, skip line separator */ /* todo: add processing for wchar_t */
// if (!isprint(*L) && !isprint(*I) && !isprint(*IV) && !isprint(*R)) { // if (!isprint(*L) && !isprint(*I) && !isprint(*IV) && !isprint(*R)) {
// status = 0; // status = 0;
@ -499,8 +501,6 @@ int wprint_row_separator(wchar_t *buffer, size_t buffer_sz,
goto clear; goto clear;
} }
size_t i = 0;
/* Print left margin */ /* Print left margin */
CHCK_RSLT_ADD_TO_WRITTEN(snprint_n_strings_(buffer + written, buffer_sz - written, context->table_options->entire_table_options.left_margin, space_char)); CHCK_RSLT_ADD_TO_WRITTEN(snprint_n_strings_(buffer + written, buffer_sz - written, context->table_options->entire_table_options.left_margin, space_char));

View File

@ -326,6 +326,7 @@ int buffer_printf(string_buffer_t *buffer, size_t buffer_row, char *buf, size_t
int written = 0; int written = 0;
int tmp = 0; int tmp = 0;
ptrdiff_t str_it_width = 0;
const CHAR_TYPE *beg = NULL; const CHAR_TYPE *beg = NULL;
const CHAR_TYPE *end = NULL; const CHAR_TYPE *end = NULL;
CHAR_TYPE old_value; CHAR_TYPE old_value;
@ -338,7 +339,7 @@ int buffer_printf(string_buffer_t *buffer, size_t buffer_row, char *buf, size_t
old_value = *end; old_value = *end;
*(CHAR_TYPE *)end = NULL_CHAR; *(CHAR_TYPE *)end = NULL_CHAR;
ptrdiff_t str_it_width = STR_ITER_WIDTH(beg, end); str_it_width = STR_ITER_WIDTH(beg, end);
if (str_it_width < 0 || content_width < (size_t)str_it_width) if (str_it_width < 0 || content_width < (size_t)str_it_width)
return - 1; return - 1;
@ -411,6 +412,7 @@ int buffer_wprintf(string_buffer_t *buffer, size_t buffer_row, wchar_t *buf, siz
int written = 0; int written = 0;
int tmp = 0; int tmp = 0;
ptrdiff_t str_it_width = 0;
const CHAR_TYPE *beg = NULL; const CHAR_TYPE *beg = NULL;
const CHAR_TYPE *end = NULL; const CHAR_TYPE *end = NULL;
CHAR_TYPE old_value; CHAR_TYPE old_value;
@ -423,7 +425,7 @@ int buffer_wprintf(string_buffer_t *buffer, size_t buffer_row, wchar_t *buf, siz
old_value = *end; old_value = *end;
*(CHAR_TYPE *)end = NULL_CHAR; *(CHAR_TYPE *)end = NULL_CHAR;
ptrdiff_t str_it_width = STR_ITER_WIDTH(beg, end); str_it_width = STR_ITER_WIDTH(beg, end);
if (str_it_width < 0 || content_width < (size_t)str_it_width) if (str_it_width < 0 || content_width < (size_t)str_it_width)
return - 1; return - 1;