gcc 9 fixes

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2020-06-29 19:38:38 +02:00
parent 4b353afa7a
commit 97f63a11a6
2 changed files with 5 additions and 1 deletions

View File

@ -424,6 +424,8 @@ void fixupEncodedHeaderLine(char *buf, int buflen){
} }
if(need_encoding == 1 && ret == OK){ if(need_encoding == 1 && ret == OK){
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncat(puf, tmpbuf, sizeof(puf)-strlen(puf)-1); strncat(puf, tmpbuf, sizeof(puf)-strlen(puf)-1);
} }
else { else {

View File

@ -25,6 +25,7 @@ struct str_pair {
static void test_parse_date_header(){ static void test_parse_date_header(){
unsigned int i; unsigned int i;
struct config cfg; struct config cfg;
time_t delta;
struct date_test date_test[] = { struct date_test date_test[] = {
{"Date: Mon, 02 Nov 2015 09:39:31 -0000", 1446457171}, {"Date: Mon, 02 Nov 2015 09:39:31 -0000", 1446457171},
{"Date: Mon, 2 Nov 2015 10:39:45 +0100", 1446457185}, {"Date: Mon, 2 Nov 2015 10:39:45 +0100", 1446457185},
@ -48,7 +49,8 @@ static void test_parse_date_header(){
TEST_HEADER(); TEST_HEADER();
for(i=0; i<sizeof(date_test)/sizeof(struct date_test); i++){ for(i=0; i<sizeof(date_test)/sizeof(struct date_test); i++){
ASSERT(abs(parse_date_header(date_test[i].date_str) - date_test[i].timestamp) <= 3600, date_test[i].date_str); delta = parse_date_header(date_test[i].date_str) - date_test[i].timestamp;
ASSERT(delta <= 3600 && delta >= -3600, date_test[i].date_str);
} }
TEST_FOOTER(); TEST_FOOTER();