From 8164e30603514a77c2d3aef8ec49a78468ec8563 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 21 Jun 2019 12:56:54 +0900 Subject: [PATCH] util: fix sign-compare warning --- src/basic/time-util.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/basic/time-util.c b/src/basic/time-util.c index 8ccb4a9..434159f 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -267,13 +267,12 @@ static char *format_timestamp_internal( assert(buf); - if (l < - 3 + /* week day */ - 1 + 10 + /* space and date */ - 1 + 8 + /* space and time */ - (us ? 1 + 6 : 0) + /* "." and microsecond part */ - 1 + 1 + /* space and shortest possible zone */ - 1) + if (l < (size_t) (3 + /* week day */ + 1 + 10 + /* space and date */ + 1 + 8 + /* space and time */ + (us ? 1 + 6 : 0) + /* "." and microsecond part */ + 1 + 1 + /* space and shortest possible zone */ + 1)) return NULL; /* Not enough space even for the shortest form. */ if (t <= 0 || t == USEC_INFINITY) return NULL; /* Timestamp is unset */ -- 2.7.4