Fix calls to ctype functions.
authorBen Pfaff <blp@nicira.com>
Fri, 15 Apr 2011 16:31:36 +0000 (09:31 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 29 Apr 2011 21:31:59 +0000 (14:31 -0700)
commit101c55a1af7998a009a5c88c20e30837bc1a9765
tree0d533c6538e79f233481d5afe396c237d3ef7c94
parent54ebd8ea7dfdd53e36ef4e0cd0877d52dd95a8ad
Fix calls to ctype functions.

The ctype functions often need casts to be fully C standards compliant.
Here's the full explanation that I used to post to comp.lang.c from time
to time when the issue came up:

    With the to*() and is*() functions, you should be careful to cast
    `char' arguments to `unsigned char' before calling them.  Type `char'
    may be signed or unsigned, depending on your compiler or its
    configuration.  If `char' is signed, then some characters have
    negative values; however, the arguments to is*() and to*() functions
    must be nonnegative (or EOF).  Casting to `unsigned char' fixes this
    problem by forcing the character to the corresponding positive value.

This fixes the following warnings from some version of GCC:

lib/ofp-parse.c:828: warning: array subscript has type 'char'
lib/ofp-print.c:617: warning: array subscript has type 'char'

Reported-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
AUTHORS
lib/ofp-parse.c
lib/ofp-print.c