where it can't be EOF, cast a value to unsigned char before passing it to ctype functions to avoid unintended sign extension.
Signed-off-by: YAMAMOTO Takashi <y...@mwd.biglobe.ne.jp> --- lib/json.c | 14 +++++++------- lib/ofp-util.c | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/json.c b/lib/json.c index 06a9a42..af385c6 100644 --- a/lib/json.c +++ b/lib/json.c @@ -620,11 +620,11 @@ json_lex_number(struct json_parser *p) significand = 0; if (*cp == '0') { cp++; - if (isdigit(*cp)) { + if (isdigit((unsigned char) *cp)) { json_error(p, "leading zeros not allowed"); return; } - } else if (isdigit(*cp)) { + } else if (isdigit((unsigned char) *cp)) { do { if (significand <= ULLONG_MAX / 10) { significand = significand * 10 + (*cp - '0'); @@ -635,7 +635,7 @@ json_lex_number(struct json_parser *p) } } cp++; - } while (isdigit(*cp)); + } while (isdigit((unsigned char) *cp)); } else { json_error(p, "'-' must be followed by digit"); return; @@ -644,7 +644,7 @@ json_lex_number(struct json_parser *p) /* Optional fraction. */ if (*cp == '.') { cp++; - if (!isdigit(*cp)) { + if (!isdigit((unsigned char) *cp)) { json_error(p, "decimal point must be followed by digit"); return; } @@ -656,7 +656,7 @@ json_lex_number(struct json_parser *p) imprecise = true; } cp++; - } while (isdigit(*cp)); + } while (isdigit((unsigned char) *cp)); } /* Optional exponent. */ @@ -672,7 +672,7 @@ json_lex_number(struct json_parser *p) cp++; } - if (!isdigit(*cp)) { + if (!isdigit((unsigned char) *cp)) { json_error(p, "exponent must contain at least one digit"); return; } @@ -685,7 +685,7 @@ json_lex_number(struct json_parser *p) } exponent = exponent * 10 + (*cp - '0'); cp++; - } while (isdigit(*cp)); + } while (isdigit((unsigned char) *cp)); if (negative_exponent) { pow10 -= exponent; diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 6b78f84..42c3613 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -922,7 +922,7 @@ ofputil_version_from_string(const char *s) } static bool -is_delimiter(char c) +is_delimiter(unsigned char c) { return isspace(c) || c == ','; } -- 1.8.0.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev