Those casts are really necessary.
# Heads up; please be careful using is*() functions. The function of that kind
# takes an integer value as its argument and expects the value to be range of
# 0-255 as a parameter. So if you pass a plain char value to it, the char
# value will be converted implicitly to an integer value of the range
# -128 ~ 127, which will end up with an unwanted result, most likely with
# non-ASCII characters. This has been considered to be a big flaw in the
# specification of the ctype functions. However, the malfunction is not
# reproducible with the recent versions of the GNU C library because it is
# made to deal with such exceptional cases, while Microsoft's C library
# and several standard C libraries of BSD origin aren't.
#
# See also bug #10896, #12127, #18318, and #21689.
#