summaryrefslogtreecommitdiff
path: root/ext/json
diff options
context:
space:
mode:
authorSHIBATA Hiroshi <hsbt@ruby-lang.org>2015-01-13 12:14:11 +0900
committerFlorian Frank <flori@ping.de>2015-02-12 22:36:04 +0100
commitfcf3a8b799955581c92055a4398d12ae0279338a (patch)
tree16161b8deb49816f450cb096587393abda1208ed /ext/json
parent259dee6c9bdda08ed0c1fc2e69bfbb2d377faba0 (diff)
downloadjson-fcf3a8b799955581c92055a4398d12ae0279338a.tar.gz
sync trunk again: fixed regression of r49027
Diffstat (limited to 'ext/json')
-rw-r--r--ext/json/ext/parser/parser.c8
-rw-r--r--ext/json/ext/parser/parser.rl10
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");