From: Ramsay Jones Date: Thu, 21 Sep 2017 16:48:38 +0000 (+0100) Subject: cache.h: hex2chr() - avoid -Wsign-compare warnings X-Git-Tag: v2.14.3~4^2~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/356a293f39e101326b274e968552a7379735e230?ds=inline;hp=--cc cache.h: hex2chr() - avoid -Wsign-compare warnings Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano --- 356a293f39e101326b274e968552a7379735e230 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 */