ensure we don't pass a negative int to ctypes functions

Some implementations, e.g. cygwin, use a table lookup that can cast
a char to a negative array offset.
This commit is contained in:
Brent Cook 2015-11-23 02:06:03 -06:00
parent 9574b6c8ec
commit 7109fb3260

View File

@ -141,11 +141,11 @@ restart:
if (p < end) {
if ((flags & RPP_SEVENBIT))
ch &= 0x7f;
if (isalpha(ch)) {
if (isalpha((unsigned char)ch)) {
if ((flags & RPP_FORCELOWER))
ch = (char)tolower(ch);
ch = (char)tolower((unsigned char)ch);
if ((flags & RPP_FORCEUPPER))
ch = (char)toupper(ch);
ch = (char)toupper((unsigned char)ch);
}
*p++ = ch;
}