1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
From c65023ef46cbfb4cd3f4c177a479d70e39bcd4b2 Mon Sep 17 00:00:00 2001
From: Michael Biebl <biebl@debian.org>
Date: Wed, 5 Oct 2016 00:23:38 +0200
Subject: [PATCH 2/3] use proper type for OffsetHour in ln_parseRFC5424Date()
GCC spotted the following errors:
v1_parser.c: In function 'ln_parseRFC5424Date':
v1_parser.c:266:17: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if(OffsetHour < 0 || OffsetHour > 23)
^
parser.c: In function 'ln_v2_parseRFC5424Date':
parser.c:227:17: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if(OffsetHour < 0 || OffsetHour > 23)
^
Fix it by using type int for OffsetHour.
---
src/parser.c | 2 +-
src/v1_parser.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/parser.c b/src/parser.c
index 8da8d20..76f0836 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -161,7 +161,7 @@ PARSER_Parse(RFC5424Date)
int second;
__attribute__((unused)) int secfrac; /* fractional seconds (must be 32 bit!) */
__attribute__((unused)) int secfracPrecision;
- char OffsetHour; /* UTC offset in hours */
+ int OffsetHour; /* UTC offset in hours */
int OffsetMinute; /* UTC offset in minutes */
size_t len;
size_t orglen;
diff --git a/src/v1_parser.c b/src/v1_parser.c
index 3c1a875..436876d 100644
--- a/src/v1_parser.c
+++ b/src/v1_parser.c
@@ -200,7 +200,7 @@ PARSER(RFC5424Date)
int second;
__attribute__((unused)) int secfrac; /* fractional seconds (must be 32 bit!) */
__attribute__((unused)) int secfracPrecision;
- char OffsetHour; /* UTC offset in hours */
+ int OffsetHour; /* UTC offset in hours */
int OffsetMinute; /* UTC offset in minutes */
size_t len;
size_t orglen;
--
2.9.3
|