1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-24 15:26:10 +02:00

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>
This commit is contained in:
Ramsay Jones 2017-09-21 17:48:38 +01:00 committed by Junio C Hamano
parent fddfedc361
commit 356a293f39

View File

@ -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 */