diff options
author | Jeff King <peff@peff.net> | 2014-10-15 18:34:05 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-10-16 10:10:36 -0700 |
commit | 50a71776ab14c63c72c86e3ce1529052bcb2634a (patch) | |
tree | c0027d319cbd238fbc20bf260e7d0d5bb37ac1b6 /git-compat-util.h | |
parent | fe1b22686f26bed3047294cc4552e50ce58fa954 (diff) | |
download | git-50a71776ab14c63c72c86e3ce1529052bcb2634a.tar.gz |
isxdigit: cast input to unsigned char
Otherwise, callers must do so or risk triggering warnings
-Wchar-subscript (and rightfully so; a signed char might
cause us to use a bogus negative index into the
hexval_table).
While we are dropping the now-unnecessary casts from the
caller in urlmatch.c, we can get rid of similar casts in
actually parsing the hex by using the hexval() helper, which
implicitly casts to unsigned (but note that we cannot
implement isxdigit in terms of hexval(), as it also casts
its return value to unsigned).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r-- | git-compat-util.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index fb41118c07..44890d5b18 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -677,7 +677,7 @@ extern const unsigned char sane_ctype[256]; #define iscntrl(x) (sane_istest(x,GIT_CNTRL)) #define ispunct(x) sane_istest(x, GIT_PUNCT | GIT_REGEX_SPECIAL | \ GIT_GLOB_SPECIAL | GIT_PATHSPEC_MAGIC) -#define isxdigit(x) (hexval_table[x] != -1) +#define isxdigit(x) (hexval_table[(unsigned char)(x)] != -1) #define tolower(x) sane_case((unsigned char)(x), 0x20) #define toupper(x) sane_case((unsigned char)(x), 0) #define is_pathspec_magic(x) sane_istest(x,GIT_PATHSPEC_MAGIC) |