* ext/json/generator/generator.c (isArrayOrObject): cast char to

unsigned char. [Bug #8378]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2013-05-08 05:00:02 +00:00
parent 279c7bdd88
commit ce573f3166
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
Wed May 8 13:49:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
* ext/json/generator/generator.c (isArrayOrObject): cast char to
unsigned char. [Bug #8378]
Wed May 8 13:46:10 2013 NARUSE, Yui <naruse@ruby-lang.org> Wed May 8 13:46:10 2013 NARUSE, Yui <naruse@ruby-lang.org>
* ext/json/generator/depend: fix dependencies [Bug #8379] * ext/json/generator/depend: fix dependencies [Bug #8379]

View File

@ -894,8 +894,8 @@ static int isArrayOrObject(VALUE string)
long string_len = RSTRING_LEN(string); long string_len = RSTRING_LEN(string);
char *p = RSTRING_PTR(string), *q = p + string_len - 1; char *p = RSTRING_PTR(string), *q = p + string_len - 1;
if (string_len < 2) return 0; if (string_len < 2) return 0;
for (; p < q && isspace(*p); p++); for (; p < q && isspace((unsigned char)*p); p++);
for (; q > p && isspace(*q); q--); for (; q > p && isspace((unsigned char)*q); q--);
return (*p == '[' && *q == ']') || (*p == '{' && *q == '}'); return (*p == '[' && *q == ']') || (*p == '{' && *q == '}');
} }