json 1.8.2 → 1.8.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of json might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGES +2 -0
- data/README.rdoc +3 -3
- data/VERSION +1 -1
- data/ext/json/ext/generator/generator.c +3 -9
- data/ext/json/ext/generator/generator.h +11 -3
- data/ext/json/ext/parser/parser.c +41 -48
- data/ext/json/ext/parser/parser.h +11 -3
- data/ext/json/ext/parser/parser.rl +9 -16
- data/json.gemspec +0 -0
- data/json_pure.gemspec +4 -4
- data/lib/json/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80c313748cbdd4d21299d85d68b5fad41fc042ed
|
4
|
+
data.tar.gz: 6ec0ef5f281c89d45401a266d75023e0e6e1414f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 662fd98151f47aeaaa3e0c90be27331aed79a17ff5871e8751803f2e1398ffdfa46952b098099b3bdc0e10ed1fed0280a52d728f2570e33d8b37ad39f31b7c4a
|
7
|
+
data.tar.gz: c5908b10b4a178e0869b6fa26f48d65ccd78e6e0df971db9abb4eace9c33486021098936421ad30939aa6dcb8600aac5ba3f37584841417518af35dd1bfea2fb
|
data/.travis.yml
CHANGED
data/CHANGES
CHANGED
data/README.rdoc
CHANGED
@@ -8,9 +8,9 @@ will be two variants available:
|
|
8
8
|
|
9
9
|
* A pure ruby variant, that relies on the iconv and the stringscan
|
10
10
|
extensions, which are both part of the ruby standard library.
|
11
|
-
* The quite a bit faster
|
12
|
-
in C and comes with its own unicode conversion
|
13
|
-
generated by the ragel state machine compiler
|
11
|
+
* The quite a bit faster native extension variant, which is in parts
|
12
|
+
implemented in C or Java and comes with its own unicode conversion
|
13
|
+
functions and a parser generated by the ragel state machine compiler
|
14
14
|
http://www.cs.queensu.ca/~thurston/ragel .
|
15
15
|
|
16
16
|
Both variants of the JSON generator generate UTF-8 character sequences by
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.8.
|
1
|
+
1.8.3
|
@@ -526,17 +526,11 @@ static const rb_data_type_t JSON_Generator_State_type = {
|
|
526
526
|
};
|
527
527
|
#endif
|
528
528
|
|
529
|
-
static JSON_Generator_State *State_allocate(void)
|
530
|
-
{
|
531
|
-
JSON_Generator_State *state = ALLOC(JSON_Generator_State);
|
532
|
-
MEMZERO(state, JSON_Generator_State, 1);
|
533
|
-
return state;
|
534
|
-
}
|
535
|
-
|
536
529
|
static VALUE cState_s_allocate(VALUE klass)
|
537
530
|
{
|
538
|
-
JSON_Generator_State *state
|
539
|
-
return
|
531
|
+
JSON_Generator_State *state;
|
532
|
+
return TypedData_Make_Struct(klass, JSON_Generator_State,
|
533
|
+
&JSON_Generator_State_type, state);
|
540
534
|
}
|
541
535
|
|
542
536
|
/*
|
@@ -112,7 +112,6 @@ static VALUE mFalseClass_to_json(int argc, VALUE *argv, VALUE self);
|
|
112
112
|
static VALUE mNilClass_to_json(int argc, VALUE *argv, VALUE self);
|
113
113
|
static VALUE mObject_to_json(int argc, VALUE *argv, VALUE self);
|
114
114
|
static void State_free(void *state);
|
115
|
-
static JSON_Generator_State *State_allocate(void);
|
116
115
|
static VALUE cState_s_allocate(VALUE klass);
|
117
116
|
static VALUE cState_configure(VALUE self, VALUE opts);
|
118
117
|
static VALUE cState_to_h(VALUE self);
|
@@ -147,11 +146,20 @@ static VALUE cState_ascii_only_p(VALUE self);
|
|
147
146
|
static VALUE cState_depth(VALUE self);
|
148
147
|
static VALUE cState_depth_set(VALUE self, VALUE depth);
|
149
148
|
static FBuffer *cState_prepare_buffer(VALUE self);
|
150
|
-
#
|
149
|
+
#ifndef ZALLOC
|
150
|
+
#define ZALLOC(type) ((type *)ruby_zalloc(sizeof(type)))
|
151
|
+
static inline void *ruby_zalloc(size_t n)
|
152
|
+
{
|
153
|
+
void *p = ruby_xmalloc(n);
|
154
|
+
memset(p, 0, n);
|
155
|
+
return p;
|
156
|
+
}
|
157
|
+
#endif
|
158
|
+
#ifdef TypedData_Make_Struct
|
151
159
|
static const rb_data_type_t JSON_Generator_State_type;
|
152
160
|
#define NEW_TYPEDDATA_WRAPPER 1
|
153
161
|
#else
|
154
|
-
#define
|
162
|
+
#define TypedData_Make_Struct(klass, type, ignore, json) Data_Make_Struct(klass, type, NULL, State_free, json)
|
155
163
|
#define TypedData_Get_Struct(self, JSON_Generator_State, ignore, json) Data_Get_Struct(self, JSON_Generator_State, json)
|
156
164
|
#endif
|
157
165
|
|
@@ -28,16 +28,16 @@ static UTF32 unescape_unicode(const unsigned char *p)
|
|
28
28
|
UTF32 result = 0;
|
29
29
|
b = digit_values[p[0]];
|
30
30
|
if (b < 0) return UNI_REPLACEMENT_CHAR;
|
31
|
-
result = (result << 4) | b;
|
31
|
+
result = (result << 4) | (unsigned char)b;
|
32
32
|
b = digit_values[p[1]];
|
33
|
-
result = (result << 4) | b;
|
34
33
|
if (b < 0) return UNI_REPLACEMENT_CHAR;
|
34
|
+
result = (result << 4) | (unsigned char)b;
|
35
35
|
b = digit_values[p[2]];
|
36
|
-
result = (result << 4) | b;
|
37
36
|
if (b < 0) return UNI_REPLACEMENT_CHAR;
|
37
|
+
result = (result << 4) | (unsigned char)b;
|
38
38
|
b = digit_values[p[3]];
|
39
|
-
result = (result << 4) | b;
|
40
39
|
if (b < 0) return UNI_REPLACEMENT_CHAR;
|
40
|
+
result = (result << 4) | (unsigned char)b;
|
41
41
|
return result;
|
42
42
|
}
|
43
43
|
|
@@ -89,11 +89,11 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
|
|
89
89
|
|
90
90
|
|
91
91
|
#line 92 "parser.c"
|
92
|
-
|
93
|
-
|
94
|
-
|
92
|
+
enum {JSON_object_start = 1};
|
93
|
+
enum {JSON_object_first_final = 27};
|
94
|
+
enum {JSON_object_error = 0};
|
95
95
|
|
96
|
-
|
96
|
+
enum {JSON_object_en_main = 1};
|
97
97
|
|
98
98
|
|
99
99
|
#line 151 "parser.rl"
|
@@ -467,11 +467,11 @@ case 26:
|
|
467
467
|
|
468
468
|
|
469
469
|
#line 470 "parser.c"
|
470
|
-
|
471
|
-
|
472
|
-
|
470
|
+
enum {JSON_value_start = 1};
|
471
|
+
enum {JSON_value_first_final = 21};
|
472
|
+
enum {JSON_value_error = 0};
|
473
473
|
|
474
|
-
|
474
|
+
enum {JSON_value_en_main = 1};
|
475
475
|
|
476
476
|
|
477
477
|
#line 271 "parser.rl"
|
@@ -776,11 +776,11 @@ case 20:
|
|
776
776
|
|
777
777
|
|
778
778
|
#line 779 "parser.c"
|
779
|
-
|
780
|
-
|
781
|
-
|
779
|
+
enum {JSON_integer_start = 1};
|
780
|
+
enum {JSON_integer_first_final = 3};
|
781
|
+
enum {JSON_integer_error = 0};
|
782
782
|
|
783
|
-
|
783
|
+
enum {JSON_integer_en_main = 1};
|
784
784
|
|
785
785
|
|
786
786
|
#line 295 "parser.rl"
|
@@ -875,11 +875,11 @@ case 5:
|
|
875
875
|
|
876
876
|
|
877
877
|
#line 878 "parser.c"
|
878
|
-
|
879
|
-
|
880
|
-
|
878
|
+
enum {JSON_float_start = 1};
|
879
|
+
enum {JSON_float_first_final = 8};
|
880
|
+
enum {JSON_float_error = 0};
|
881
881
|
|
882
|
-
|
882
|
+
enum {JSON_float_en_main = 1};
|
883
883
|
|
884
884
|
|
885
885
|
#line 329 "parser.rl"
|
@@ -1041,11 +1041,11 @@ case 7:
|
|
1041
1041
|
|
1042
1042
|
|
1043
1043
|
#line 1044 "parser.c"
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1044
|
+
enum {JSON_array_start = 1};
|
1045
|
+
enum {JSON_array_first_final = 17};
|
1046
|
+
enum {JSON_array_error = 0};
|
1047
1047
|
|
1048
|
-
|
1048
|
+
enum {JSON_array_en_main = 1};
|
1049
1049
|
|
1050
1050
|
|
1051
1051
|
#line 381 "parser.rl"
|
@@ -1373,11 +1373,11 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
|
|
1373
1373
|
|
1374
1374
|
|
1375
1375
|
#line 1376 "parser.c"
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1376
|
+
enum {JSON_string_start = 1};
|
1377
|
+
enum {JSON_string_first_final = 8};
|
1378
|
+
enum {JSON_string_error = 0};
|
1379
1379
|
|
1380
|
-
|
1380
|
+
enum {JSON_string_en_main = 1};
|
1381
1381
|
|
1382
1382
|
|
1383
1383
|
#line 494 "parser.rl"
|
@@ -1730,11 +1730,11 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
|
|
1730
1730
|
|
1731
1731
|
|
1732
1732
|
#line 1733 "parser.c"
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1733
|
+
enum {JSON_start = 1};
|
1734
|
+
enum {JSON_first_final = 10};
|
1735
|
+
enum {JSON_error = 0};
|
1736
1736
|
|
1737
|
-
|
1737
|
+
enum {JSON_en_main = 1};
|
1738
1738
|
|
1739
1739
|
|
1740
1740
|
#line 740 "parser.rl"
|
@@ -1904,11 +1904,11 @@ case 9:
|
|
1904
1904
|
|
1905
1905
|
|
1906
1906
|
#line 1907 "parser.c"
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1907
|
+
enum {JSON_quirks_mode_start = 1};
|
1908
|
+
enum {JSON_quirks_mode_first_final = 10};
|
1909
|
+
enum {JSON_quirks_mode_error = 0};
|
1910
1910
|
|
1911
|
-
|
1911
|
+
enum {JSON_quirks_mode_en_main = 1};
|
1912
1912
|
|
1913
1913
|
|
1914
1914
|
#line 778 "parser.rl"
|
@@ -2091,15 +2091,6 @@ static VALUE cParser_parse(VALUE self)
|
|
2091
2091
|
}
|
2092
2092
|
}
|
2093
2093
|
|
2094
|
-
|
2095
|
-
static JSON_Parser *JSON_allocate(void)
|
2096
|
-
{
|
2097
|
-
JSON_Parser *json = ALLOC(JSON_Parser);
|
2098
|
-
MEMZERO(json, JSON_Parser, 1);
|
2099
|
-
json->fbuffer = fbuffer_alloc(0);
|
2100
|
-
return json;
|
2101
|
-
}
|
2102
|
-
|
2103
2094
|
static void JSON_mark(void *ptr)
|
2104
2095
|
{
|
2105
2096
|
JSON_Parser *json = ptr;
|
@@ -2136,8 +2127,10 @@ static const rb_data_type_t JSON_Parser_type = {
|
|
2136
2127
|
|
2137
2128
|
static VALUE cJSON_parser_s_allocate(VALUE klass)
|
2138
2129
|
{
|
2139
|
-
JSON_Parser *json
|
2140
|
-
|
2130
|
+
JSON_Parser *json;
|
2131
|
+
VALUE obj = TypedData_Make_Struct(klass, JSON_Parser, &JSON_Parser_type, json);
|
2132
|
+
json->fbuffer = fbuffer_alloc(0);
|
2133
|
+
return obj;
|
2141
2134
|
}
|
2142
2135
|
|
2143
2136
|
/*
|
@@ -2164,7 +2157,7 @@ static VALUE cParser_quirks_mode_p(VALUE self)
|
|
2164
2157
|
}
|
2165
2158
|
|
2166
2159
|
|
2167
|
-
void Init_parser()
|
2160
|
+
void Init_parser(void)
|
2168
2161
|
{
|
2169
2162
|
rb_require("json/common");
|
2170
2163
|
mJSON = rb_define_module("JSON");
|
@@ -68,16 +68,24 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
|
68
68
|
static VALUE convert_encoding(VALUE source);
|
69
69
|
static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self);
|
70
70
|
static VALUE cParser_parse(VALUE self);
|
71
|
-
static JSON_Parser *JSON_allocate(void);
|
72
71
|
static void JSON_mark(void *json);
|
73
72
|
static void JSON_free(void *json);
|
74
73
|
static VALUE cJSON_parser_s_allocate(VALUE klass);
|
75
74
|
static VALUE cParser_source(VALUE self);
|
76
|
-
#
|
75
|
+
#ifndef ZALLOC
|
76
|
+
#define ZALLOC(type) ((type *)ruby_zalloc(sizeof(type)))
|
77
|
+
static inline void *ruby_zalloc(size_t n)
|
78
|
+
{
|
79
|
+
void *p = ruby_xmalloc(n);
|
80
|
+
memset(p, 0, n);
|
81
|
+
return p;
|
82
|
+
}
|
83
|
+
#endif
|
84
|
+
#ifdef TypedData_Make_Struct
|
77
85
|
static const rb_data_type_t JSON_Parser_type;
|
78
86
|
#define NEW_TYPEDDATA_WRAPPER 1
|
79
87
|
#else
|
80
|
-
#define
|
88
|
+
#define TypedData_Make_Struct(klass, type, ignore, json) Data_Make_Struct(klass, type, NULL, JSON_free, json)
|
81
89
|
#define TypedData_Get_Struct(self, JSON_Parser, ignore, json) Data_Get_Struct(self, JSON_Parser, json)
|
82
90
|
#endif
|
83
91
|
|
@@ -26,16 +26,16 @@ static UTF32 unescape_unicode(const unsigned char *p)
|
|
26
26
|
UTF32 result = 0;
|
27
27
|
b = digit_values[p[0]];
|
28
28
|
if (b < 0) return UNI_REPLACEMENT_CHAR;
|
29
|
-
result = (result << 4) | b;
|
29
|
+
result = (result << 4) | (unsigned char)b;
|
30
30
|
b = digit_values[p[1]];
|
31
|
-
result = (result << 4) | b;
|
32
31
|
if (b < 0) return UNI_REPLACEMENT_CHAR;
|
32
|
+
result = (result << 4) | (unsigned char)b;
|
33
33
|
b = digit_values[p[2]];
|
34
|
-
result = (result << 4) | b;
|
35
34
|
if (b < 0) return UNI_REPLACEMENT_CHAR;
|
35
|
+
result = (result << 4) | (unsigned char)b;
|
36
36
|
b = digit_values[p[3]];
|
37
|
-
result = (result << 4) | b;
|
38
37
|
if (b < 0) return UNI_REPLACEMENT_CHAR;
|
38
|
+
result = (result << 4) | (unsigned char)b;
|
39
39
|
return result;
|
40
40
|
}
|
41
41
|
|
@@ -814,15 +814,6 @@ static VALUE cParser_parse(VALUE self)
|
|
814
814
|
}
|
815
815
|
}
|
816
816
|
|
817
|
-
|
818
|
-
static JSON_Parser *JSON_allocate(void)
|
819
|
-
{
|
820
|
-
JSON_Parser *json = ALLOC(JSON_Parser);
|
821
|
-
MEMZERO(json, JSON_Parser, 1);
|
822
|
-
json->fbuffer = fbuffer_alloc(0);
|
823
|
-
return json;
|
824
|
-
}
|
825
|
-
|
826
817
|
static void JSON_mark(void *ptr)
|
827
818
|
{
|
828
819
|
JSON_Parser *json = ptr;
|
@@ -859,8 +850,10 @@ static const rb_data_type_t JSON_Parser_type = {
|
|
859
850
|
|
860
851
|
static VALUE cJSON_parser_s_allocate(VALUE klass)
|
861
852
|
{
|
862
|
-
JSON_Parser *json
|
863
|
-
|
853
|
+
JSON_Parser *json;
|
854
|
+
VALUE obj = TypedData_Make_Struct(klass, JSON_Parser, &JSON_Parser_type, json);
|
855
|
+
json->fbuffer = fbuffer_alloc(0);
|
856
|
+
return obj;
|
864
857
|
}
|
865
858
|
|
866
859
|
/*
|
@@ -887,7 +880,7 @@ static VALUE cParser_quirks_mode_p(VALUE self)
|
|
887
880
|
}
|
888
881
|
|
889
882
|
|
890
|
-
void Init_parser()
|
883
|
+
void Init_parser(void)
|
891
884
|
{
|
892
885
|
rb_require("json/common");
|
893
886
|
mJSON = rb_define_module("JSON");
|
data/json.gemspec
CHANGED
Binary file
|
data/json_pure.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: json_pure 1.8.
|
2
|
+
# stub: json_pure 1.8.3 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "json_pure"
|
6
|
-
s.version = "1.8.
|
6
|
+
s.version = "1.8.3"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Florian Frank"]
|
11
|
-
s.date = "2015-01
|
11
|
+
s.date = "2015-06-01"
|
12
12
|
s.description = "This is a JSON implementation in pure Ruby."
|
13
13
|
s.email = "flori@ping.de"
|
14
14
|
s.extra_rdoc_files = ["README.rdoc"]
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.homepage = "http://flori.github.com/json"
|
17
17
|
s.licenses = ["Ruby"]
|
18
18
|
s.rdoc_options = ["--title", "JSON implemention for ruby", "--main", "README.rdoc"]
|
19
|
-
s.rubygems_version = "2.4.
|
19
|
+
s.rubygems_version = "2.4.6"
|
20
20
|
s.summary = "JSON Implementation for Ruby"
|
21
21
|
s.test_files = ["./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_generic_object.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"]
|
22
22
|
|
data/lib/json/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01
|
11
|
+
date: 2015-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: permutation
|
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
188
|
version: '0'
|
189
189
|
requirements: []
|
190
190
|
rubyforge_project:
|
191
|
-
rubygems_version: 2.4.
|
191
|
+
rubygems_version: 2.4.6
|
192
192
|
signing_key:
|
193
193
|
specification_version: 4
|
194
194
|
summary: JSON Implementation for Ruby
|