summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorRamsay Jones <ramsay@ramsayjones.plus.com>2017-09-21 17:48:38 +0100
committerJunio C Hamano <gitster@pobox.com>2017-09-22 13:00:38 +0900
commit356a293f39e101326b274e968552a7379735e230 (patch)
tree96ad2cc8bde965ba5c85fa6785e5afde6fbf97e6 /cache.h
parentfddfedc361b56195503d885874ed1162f66c773c (diff)
downloadgit-356a293f39e101326b274e968552a7379735e230.tar.gz
cache.h: hex2chr() - avoid -Wsign-compare warnings
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h4
1 files changed, 2 insertions, 2 deletions
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 */