Skip to content

Commit 356a293

Browse files
ramsay-jonesgitster
authored andcommitted
cache.h: hex2chr() - avoid -Wsign-compare warnings
Signed-off-by: Ramsay Jones <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fddfedc commit 356a293

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,8 +1264,8 @@ static inline unsigned int hexval(unsigned char c)
12641264
*/
12651265
static inline int hex2chr(const char *s)
12661266
{
1267-
int val = hexval(s[0]);
1268-
return (val < 0) ? val : (val << 4) | hexval(s[1]);
1267+
unsigned int val = hexval(s[0]);
1268+
return (val & ~0xf) ? val : (val << 4) | hexval(s[1]);
12691269
}
12701270

12711271
/* Convert to/from hex/sha1 representation */

0 commit comments

Comments
 (0)