From 356a293f39e101326b274e968552a7379735e230 Mon Sep 17 00:00:00 2001 From: Ramsay Jones Date: Thu, 21 Sep 2017 17:48:38 +0100 Subject: cache.h: hex2chr() - avoid -Wsign-compare warnings Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano --- cache.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cache.h') diff --git a/cache.h b/cache.h index 849bc0dcdd..5cc116ba42 100644 --- a/cache.h +++ b/cache.h @@ -1264,8 +1264,8 @@ static inline unsigned int hexval(unsigned char c) */ static inline int hex2chr(const char *s) { - int val = hexval(s[0]); - return (val < 0) ? val : (val << 4) | hexval(s[1]); + unsigned int val = hexval(s[0]); + return (val & ~0xf) ? val : (val << 4) | hexval(s[1]); } /* Convert to/from hex/sha1 representation */ -- cgit v1.2.1