diff options
author | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2015-01-13 12:14:11 +0900 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2015-02-12 22:36:04 +0100 |
commit | fcf3a8b799955581c92055a4398d12ae0279338a (patch) | |
tree | 16161b8deb49816f450cb096587393abda1208ed /ext/json | |
parent | 259dee6c9bdda08ed0c1fc2e69bfbb2d377faba0 (diff) | |
download | json-fcf3a8b799955581c92055a4398d12ae0279338a.tar.gz |
sync trunk again: fixed regression of r49027
Diffstat (limited to 'ext/json')
-rw-r--r-- | ext/json/ext/parser/parser.c | 8 | ||||
-rw-r--r-- | ext/json/ext/parser/parser.rl | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index 8824b30..20531b3 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -28,16 +28,16 @@ static UTF32 unescape_unicode(const unsigned char *p) UTF32 result = 0; b = digit_values[p[0]]; if (b < 0) return UNI_REPLACEMENT_CHAR; - result = (result << 4) | b; + result = (result << 4) | (unsigned char)b; b = digit_values[p[1]]; - result = (result << 4) | b; if (b < 0) return UNI_REPLACEMENT_CHAR; + result = (result << 4) | (unsigned char)b; b = digit_values[p[2]]; - result = (result << 4) | b; if (b < 0) return UNI_REPLACEMENT_CHAR; + result = (result << 4) | (unsigned char)b; b = digit_values[p[3]]; - result = (result << 4) | b; if (b < 0) return UNI_REPLACEMENT_CHAR; + result = (result << 4) | (unsigned char)b; return result; } diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl index 2af1cc6..70f3f9a 100644 --- a/ext/json/ext/parser/parser.rl +++ b/ext/json/ext/parser/parser.rl @@ -26,16 +26,16 @@ static UTF32 unescape_unicode(const unsigned char *p) UTF32 result = 0; b = digit_values[p[0]]; if (b < 0) return UNI_REPLACEMENT_CHAR; - result = (result << 4) | b; + result = (result << 4) | (unsigned char)b; b = digit_values[p[1]]; - result = (result << 4) | b; if (b < 0) return UNI_REPLACEMENT_CHAR; + result = (result << 4) | (unsigned char)b; b = digit_values[p[2]]; - result = (result << 4) | b; if (b < 0) return UNI_REPLACEMENT_CHAR; + result = (result << 4) | (unsigned char)b; b = digit_values[p[3]]; - result = (result << 4) | b; if (b < 0) return UNI_REPLACEMENT_CHAR; + result = (result << 4) | (unsigned char)b; return result; } @@ -887,7 +887,7 @@ static VALUE cParser_quirks_mode_p(VALUE self) } -void Init_parser() +void Init_parser(void) { rb_require("json/common"); mJSON = rb_define_module("JSON"); |