diff options
author | NARUSE, Yui <naruse@airemix.jp> | 2013-05-08 13:55:11 +0900 |
---|---|---|
committer | NARUSE, Yui <naruse@airemix.jp> | 2013-05-08 13:55:11 +0900 |
commit | 855c63bdfb1051176c5f5cd36ff8b1cc1ff364a7 (patch) | |
tree | fce070c7d99d6c9ed1069a2ed5b34ec09d38d7fb | |
parent | a7e69ec559caccae36f875ad035f034c7c491d8e (diff) | |
download | json-855c63bdfb1051176c5f5cd36ff8b1cc1ff364a7.tar.gz |
Suppress warning: -Wchar-subscripts
On some platforms char is signed char and giving signed char to
isspace(int c) can cause unexpected behavior.
To avoid such situation, it should cast as unsigned char.
-rw-r--r-- | ext/json/ext/generator/generator.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c index 8ceaa2b..ed7bb82 100644 --- a/ext/json/ext/generator/generator.c +++ b/ext/json/ext/generator/generator.c @@ -902,8 +902,8 @@ static int isArrayOrObject(VALUE string) long string_len = RSTRING_LEN(string); char *p = RSTRING_PTR(string), *q = p + string_len - 1; if (string_len < 2) return 0; - for (; p < q && isspace(*p); p++); - for (; q > p && isspace(*q); q--); + for (; p < q && isspace((unsigned char)*p); p++); + for (; q > p && isspace((unsigned char)*q); q--); return (*p == '[' && *q == ']') || (*p == '{' && *q == '}'); } |