json 2.0.0 → 2.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ea58c6d7f4166c9c44e7c5c09b9dddcc5e7e4fa
4
- data.tar.gz: 7bb5f27daeedbd962911bedcc4a599cc11ee7c87
3
+ metadata.gz: 1efee0e68bf5921252dd9b741bbcca87cc9fd5a7
4
+ data.tar.gz: 0d211eec8241b54738a9a42e3cd598e4980fead3
5
5
  SHA512:
6
- metadata.gz: 682e3deed31ab69160034d51060aa34cf494338db37ea1580523652fedf008196246d08b390fdf0975168e557e92c863077c7d991f6de0f413fb0873937892e6
7
- data.tar.gz: c7f75172c95785474562701804306301e47943cdcc887ac066c5d28721f33fef3f1135dd3e6dbfd2237e2db6ab1f55bf5af20ad99b261d563f5994e9680e274a
6
+ metadata.gz: eacc17c70c8cc3573725d9d9bd5b311bae7cdc77608ba72f6f346df04c2e64ad4f15e0ace6b7fd4e0da8bf06df24e03a3ae7f144a55de4fa178c61d50f8b0b75
7
+ data.tar.gz: 793ed905cb3143430683f0d65ba2e58dbcef2b04e06e49511c6b994bb61a34343c7d72da273ce4f4116f6a4a961208048665000e6153ac89475519b9aabfa0e6
@@ -1,4 +1,12 @@
1
- 2015-09-11 (2.0.0)
1
+ # Changes
2
+
3
+ ## 2016-07-01 (2.0.1)
4
+ * Fix problem when requiring json\_pure and Parser constant was defiend top
5
+ level.
6
+ * Add `RB_GC_GUARD` to avoid possible GC problem via Pete Johns.
7
+ * Store `current_nesting` on stack by Aaron Patterson.
8
+
9
+ ## 2015-09-11 (2.0.0)
2
10
  * Now complies to newest JSON RFC 7159.
3
11
  * Implements compatibiliy to ruby 2.4 integer unification.
4
12
  * Drops support for old rubies whose life has ended, that is rubies < 2.0.
@@ -10,97 +18,119 @@
10
18
  however a GPL compatible license according to the Free Software Foundation.
11
19
  I changed these mentions to be consistent with the Ruby license setting in
12
20
  the gemspec files which were already correct now.
13
- 2015-06-01 (1.8.3)
21
+
22
+ ## 2015-06-01 (1.8.3)
14
23
  * Fix potential memory leak, thx to nobu.
15
- 2015-01-08 (1.8.2)
24
+
25
+ ## 2015-01-08 (1.8.2)
16
26
  * Some performance improvements by Vipul A M <vipulnsward@gmail.com>.
17
27
  * Fix by Jason R. Clark <jclark@newrelic.com> to avoid mutation of
18
- JSON.dump_default_options.
28
+ `JSON.dump_default_options`.
19
29
  * More tests by Michael Mac-Vicar <mmacvicar@gmail.com> and fixing
20
- space_before accessor in generator.
30
+ `space_before` accessor in generator.
21
31
  * Performance on Jruby improvemed by Ben Browning <bbrownin@redhat.com>.
22
32
  * Some fixes to be compatible with the new Ruby 2.2 by Zachary Scott <e@zzak.io>
23
33
  and SHIBATA Hiroshi <hsbt@ruby-lang.org>.
24
- 2013-05-13 (1.8.1)
34
+
35
+ ## 2013-05-13 (1.8.1)
25
36
  * Remove Rubinius exception since transcoding should be working now.
26
- 2013-05-13 (1.8.0)
37
+
38
+ ## 2013-05-13 (1.8.0)
27
39
  * Fix https://github.com/flori/json/issues/162 reported by Marc-Andre
28
40
  Lafortune <github_rocks@marc-andre.ca>. Thanks!
29
41
  * Applied patches by Yui NARUSE <naruse@airemix.jp> to suppress warning with
30
42
  -Wchar-subscripts and better validate UTF-8 strings.
31
43
  * Applied patch by ginriki@github to remove unnecessary if.
32
- * Add load/dump interface to JSON::GenericObject to make
33
- serialize :some_attribute, JSON::GenericObject
34
- work in Rails active models for convenient SomeModel#some_attribute.foo.bar
44
+ * Add load/dump interface to `JSON::GenericObject` to make
45
+ serialize :some_attribute, `JSON::GenericObject`
46
+ work in Rails active models for convenient `SomeModel#some_attribute.foo.bar`
35
47
  access to serialised JSON data.
36
- 2013-02-04 (1.7.7)
48
+
49
+ ## 2013-02-04 (1.7.7)
37
50
  * Security fix for JSON create_additions default value and
38
- JSON::GenericObject. It should not be possible to create additions unless
51
+ `JSON::GenericObject`. It should not be possible to create additions unless
39
52
  explicitely requested by setting the create_additions argument to true or
40
- using the JSON.load/dump interface. If JSON::GenericObject is supposed to
53
+ using the JSON.load/dump interface. If `JSON::GenericObject` is supposed to
41
54
  be automatically deserialised, this has to be explicitely enabled by
42
55
  setting
43
- JSON::GenericObject.json_creatable = true
56
+ JSON::GenericObject.json_creatable = true
44
57
  as well.
45
58
  * Remove useless assert in fbuffer implementation.
46
59
  * Apply patch attached to https://github.com/flori/json/issues#issue/155
47
60
  provided by John Shahid <jvshahid@gmail.com>, Thx!
48
61
  * Add license information to rubygems spec data, reported by Jordi Massaguer Pla <jmassaguerpla@suse.de>.
49
62
  * Improve documentation, thx to Zachary Scott <zachary@zacharyscott.net>.
50
- 2012-11-29 (1.7.6)
51
- * Add GeneratorState#merge alias for JRuby, fix state accessor methods. Thx to
63
+
64
+ ## 2012-11-29 (1.7.6)
65
+ * Add `GeneratorState#merge` alias for JRuby, fix state accessor methods. Thx to
52
66
  jvshahid@github.
53
67
  * Increase hash likeness of state objects.
54
- 2012-08-17 (1.7.5)
68
+
69
+ ## 2012-08-17 (1.7.5)
55
70
  * Fix compilation of extension on older rubies.
56
- 2012-07-26 (1.7.4)
71
+
72
+ ## 2012-07-26 (1.7.4)
57
73
  * Fix compilation problem on AIX, see https://github.com/flori/json/issues/142
58
- 2012-05-12 (1.7.3)
74
+
75
+ ## 2012-05-12 (1.7.3)
59
76
  * Work around Rubinius encoding issues using iconv for conversion instead.
60
- 2012-05-11 (1.7.2)
77
+
78
+ ## 2012-05-11 (1.7.2)
61
79
  * Fix some encoding issues, that cause problems for the pure and the
62
80
  extension variant in jruby 1.9 mode.
63
- 2012-04-28 (1.7.1)
81
+
82
+ ## 2012-04-28 (1.7.1)
64
83
  * Some small fixes for building
65
- 2012-04-28 (1.7.0)
66
- * Add JSON::GenericObject for method access to objects transmitted via JSON.
67
- 2012-04-27 (1.6.7)
84
+
85
+ ## 2012-04-28 (1.7.0)
86
+ * Add `JSON::GenericObject` for method access to objects transmitted via JSON.
87
+
88
+ ## 2012-04-27 (1.6.7)
68
89
  * Fix possible crash when trying to parse nil value.
69
- 2012-02-11 (1.6.6)
90
+
91
+ ## 2012-02-11 (1.6.6)
70
92
  * Propagate src encoding to values made from it (fixes 1.9 mode converting
71
93
  everything to ascii-8bit; harmless for 1.8 mode too) (Thomas E. Enebo
72
94
  <tom.enebo@gmail.com>), should fix
73
95
  https://github.com/flori/json/issues#issue/119.
74
96
  * Fix https://github.com/flori/json/issues#issue/124 Thx to Jason Hutchens.
75
97
  * Fix https://github.com/flori/json/issues#issue/117
76
- 2012-01-15 (1.6.5)
98
+
99
+ ## 2012-01-15 (1.6.5)
77
100
  * Vit Ondruch <v.ondruch@tiscali.cz> reported a bug that shows up when using
78
101
  optimisation under GCC 4.7. Thx to him, Bohuslav Kabrda
79
102
  <bkabrda@redhat.com> and Yui NARUSE <naruse@airemix.jp> for debugging and
80
103
  developing a patch fix.
81
- 2011-12-24 (1.6.4)
104
+
105
+ ## 2011-12-24 (1.6.4)
82
106
  * Patches that improve speed on JRuby contributed by Charles Oliver Nutter
83
107
  <headius@headius.com>.
84
- * Support object_class/array_class with duck typed hash/array.
85
- 2011-12-01 (1.6.3)
86
- * Let JSON.load('') return nil as well to make mysql text columns (default to
87
- '') work better for serialization.
88
- 2011-11-21 (1.6.2)
108
+ * Support `object_class`/`array_class` with duck typed hash/array.
109
+
110
+ ## 2011-12-01 (1.6.3)
111
+ * Let `JSON.load('')` return nil as well to make mysql text columns (default to
112
+ `''`) work better for serialization.
113
+
114
+ ## 2011-11-21 (1.6.2)
89
115
  * Add support for OpenStruct and BigDecimal.
90
- * Fix bug when parsing nil in quirks_mode.
116
+ * Fix bug when parsing nil in `quirks_mode`.
91
117
  * Make JSON.dump and JSON.load methods better cooperate with Rails' serialize
92
- method. Just use: serialize :value, JSON
118
+ method. Just use:
119
+ serialize :value, JSON
93
120
  * Fix bug with time serialization concerning nanoseconds. Thanks for the
94
121
  patch go to Josh Partlow (jpartlow@github).
95
122
  * Improve parsing speed for JSON numbers (integers and floats) in a similar way to
96
123
  what Evan Phoenix <evan@phx.io> suggested in:
97
124
  https://github.com/flori/json/pull/103
98
- 2011-09-18 (1.6.1)
125
+
126
+ ## 2011-09-18 (1.6.1)
99
127
  * Using -target 1.5 to force Java bits to compile with 1.5.
100
- 2011-09-12 (1.6.0)
128
+
129
+ ## 2011-09-12 (1.6.0)
101
130
  * Extract utilities (prettifier and GUI-editor) in its own gem json-utils.
102
131
  * Split json/add/core into different files for classes to be serialised.
103
- 2011-08-31 (1.5.4)
132
+
133
+ ## 2011-08-31 (1.5.4)
104
134
  * Fix memory leak when used from multiple JRuby. (Patch by
105
135
  jfirebaugh@github).
106
136
  * Apply patch by Eric Wong <nocode@yhbt.net> that fixes garbage collection problem
@@ -108,42 +138,50 @@
108
138
  * Add :quirks_mode option to parser and generator.
109
139
  * Add support for Rational and Complex number additions via json/add/complex
110
140
  and json/add/rational requires.
111
- 2011-06-20 (1.5.3)
141
+
142
+ ## 2011-06-20 (1.5.3)
112
143
  * Alias State#configure method as State#merge to increase duck type synonymy with Hash.
113
- * Add as_json methods in json/add/core, so rails can create its json objects
144
+ * Add `as_json` methods in json/add/core, so rails can create its json objects
114
145
  the new way.
115
- 2011-05-11 (1.5.2)
146
+
147
+ ## 2011-05-11 (1.5.2)
116
148
  * Apply documentation patch by Cory Monty <cory.monty@gmail.com>.
117
- * Add gemspecs for json and json_pure.
149
+ * Add gemspecs for json and json\_pure.
118
150
  * Fix bug in jruby pretty printing.
119
- * Fix bug in object_class and array_class when inheriting from Hash or Array.
120
- 2011-01-24 (1.5.1)
151
+ * Fix bug in `object_class` and `array_class` when inheriting from Hash or
152
+ Array.
153
+
154
+ ## 2011-01-24 (1.5.1)
121
155
  * Made rake-compiler build a fat binary gem. This should fix issue
122
156
  https://github.com/flori/json/issues#issue/54.
123
- 2011-01-22 (1.5.0)
157
+
158
+ ## 2011-01-22 (1.5.0)
124
159
  * Included Java source codes for the Jruby extension made by Daniel Luz
125
160
  <dev@mernen.com>.
126
- * Output full exception message of deep_const_get to aid debugging.
127
- * Fixed an issue with ruby 1.9 Module#const_defined? method, that was
161
+ * Output full exception message of `deep_const_get` to aid debugging.
162
+ * Fixed an issue with ruby 1.9 `Module#const_defined?` method, that was
128
163
  reported by Riley Goodside.
129
- 2010-08-09 (1.4.6)
164
+
165
+ ## 2010-08-09 (1.4.6)
130
166
  * Fixed oversight reported in http://github.com/flori/json/issues/closed#issue/23,
131
167
  always create a new object from the state prototype.
132
168
  * Made pure and ext api more similar again.
133
- 2010-08-07 (1.4.5)
169
+
170
+ ## 2010-08-07 (1.4.5)
134
171
  * Manage data structure nesting depth in state object during generation. This
135
- should reduce problems with to_json method definіtions that only have one
172
+ should reduce problems with `to_json` method definіtions that only have one
136
173
  argument.
137
174
  * Some fixes in the state objects and additional tests.
138
- 2010-08-06 (1.4.4)
175
+ ## 2010-08-06 (1.4.4)
139
176
  * Fixes build problem for rubinius under OS X, http://github.com/flori/json/issues/closed#issue/25
140
177
  * Fixes crashes described in http://github.com/flori/json/issues/closed#issue/21 and
141
178
  http://github.com/flori/json/issues/closed#issue/23
142
- 2010-05-05 (1.4.3)
179
+ ## 2010-05-05 (1.4.3)
143
180
  * Fixed some test assertions, from Ruby r27587 and r27590, patch by nobu.
144
181
  * Fixed issue http://github.com/flori/json/issues/#issue/20 reported by
145
182
  electronicwhisper@github. Thx!
146
- 2010-04-26 (1.4.2)
183
+
184
+ ## 2010-04-26 (1.4.2)
147
185
  * Applied patch from naruse Yui NARUSE <naruse@airemix.com> to make building with
148
186
  Microsoft Visual C possible again.
149
187
  * Applied patch from devrandom <c1.github@niftybox.net> in order to allow building of
@@ -151,34 +189,43 @@
151
189
  * Thanks to Dustin Schneider <dustin@stocktwits.com>, who reported a memory
152
190
  leak, which is fixed in this release.
153
191
  * Applied 993f261ccb8f911d2ae57e9db48ec7acd0187283 patch from josh@github.
154
- 2010-04-25 (1.4.1)
192
+
193
+ ## 2010-04-25 (1.4.1)
155
194
  * Fix for a bug reported by Dan DeLeo <dan@kallistec.com>, caused by T_FIXNUM
156
195
  being different on 32bit/64bit architectures.
157
- 2010-04-23 (1.4.0)
196
+
197
+ ## 2010-04-23 (1.4.0)
158
198
  * Major speed improvements and building with simplified
159
199
  directory/file-structure.
160
200
  * Extension should at least be comapatible with MRI, YARV and Rubinius.
161
- 2010-04-07 (1.2.4)
201
+
202
+ ## 2010-04-07 (1.2.4)
162
203
  * Triger const_missing callback to make Rails' dynamic class loading work.
163
- 2010-03-11 (1.2.3)
164
- * Added a State#[] method which returns an attribute's value in order to
204
+
205
+ ## 2010-03-11 (1.2.3)
206
+ * Added a `State#[]` method which returns an attribute's value in order to
165
207
  increase duck type compatibility to Hash.
166
- 2010-02-27 (1.2.2)
208
+
209
+ ## 2010-02-27 (1.2.2)
167
210
  * Made some changes to make the building of the parser/generator compatible
168
211
  to Rubinius.
169
- 2009-11-25 (1.2.1)
170
- * Added :symbolize_names option to Parser, which returns symbols instead of
212
+
213
+ ## 2009-11-25 (1.2.1)
214
+ * Added `:symbolize_names` option to Parser, which returns symbols instead of
171
215
  strings in object names/keys.
172
- 2009-10-01 (1.2.0)
173
- * fast_generate now raises an exeception for nan and infinite floats.
216
+
217
+ ## 2009-10-01 (1.2.0)
218
+ * `fast_generate` now raises an exeception for nan and infinite floats.
174
219
  * On Ruby 1.8 json supports parsing of UTF-8, UTF-16BE, UTF-16LE, UTF-32BE,
175
220
  and UTF-32LE JSON documents now. Under Ruby 1.9 the M17n conversion
176
221
  functions are used to convert from all supported encodings. ASCII-8BIT
177
222
  encoded strings are handled like all strings under Ruby 1.8 were.
178
223
  * Better documentation
179
- 2009-08-23 (1.1.9)
180
- * Added forgotten main doc file extra_rdoc_files.
181
- 2009-08-23 (1.1.8)
224
+
225
+ ## 2009-08-23 (1.1.9)
226
+ * Added forgotten main doc file `extra_rdoc_files`.
227
+
228
+ ## 2009-08-23 (1.1.8)
182
229
  * Applied a patch by OZAWA Sakuro <sakuro@2238club.org> to make json/pure
183
230
  work in environments that don't provide iconv.
184
231
  * Applied patch by okkez_ in order to fix Ruby Bug #1768:
@@ -186,7 +233,8 @@
186
233
  * Finally got around to avoid the rather paranoid escaping of ?/ characters
187
234
  in the generator's output. The parsers aren't affected by this change.
188
235
  Thanks to Rich Apodaca <rapodaca@metamolecular.com> for the suggestion.
189
- 2009-06-29 (1.1.7)
236
+
237
+ ## 2009-06-29 (1.1.7)
190
238
  * Security Fix for JSON::Pure::Parser. A specially designed string could
191
239
  cause catastrophic backtracking in one of the parser's regular expressions
192
240
  in earlier 1.1.x versions. JSON::Ext::Parser isn't affected by this issue.
@@ -194,16 +242,19 @@
194
242
  problem.
195
243
  * This release also uses a less strict ruby version requirement for the
196
244
  creation of the mswin32 native gem.
197
- 2009-05-10 (1.1.6)
245
+
246
+ ## 2009-05-10 (1.1.6)
198
247
  * No changes. І tested native linux gems in the last release and they don't
199
248
  play well with different ruby versions other than the one the gem was built
200
249
  with. This release is just to bump the version number in order to skip the
201
250
  native gem on rubyforge.
202
- 2009-05-10 (1.1.5)
251
+
252
+ ## 2009-05-10 (1.1.5)
203
253
  * Started to build gems with rake-compiler gem.
204
254
  * Applied patch object/array class patch from Brian Candler
205
255
  <B.Candler@pobox.com> and fixes.
206
- 2009-04-01 (1.1.4)
256
+
257
+ ## 2009-04-01 (1.1.4)
207
258
  * Fixed a bug in the creation of serialized generic rails objects reported by
208
259
  Friedrich Graeter <graeter@hydrixos.org>.
209
260
  * Deleted tests/runner.rb, we're using testrb instead.
@@ -212,7 +263,8 @@
212
263
  1.9.
213
264
  * Improved speed of the code path for the fast_generate method in the pure
214
265
  variant.
215
- 2008-07-10 (1.1.3)
266
+
267
+ ## 2008-07-10 (1.1.3)
216
268
  * Wesley Beary <monki@geemus.com> reported a bug in json/add/core's DateTime
217
269
  handling: If the nominator and denominator of the offset were divisible by
218
270
  each other Ruby's Rational#to_s returns them as an integer not a fraction
@@ -222,7 +274,8 @@
222
274
  * Supports ragel >= 6.0 now.
223
275
  * Corrected some tests.
224
276
  * Some minor changes.
225
- 2007-11-27 (1.1.2)
277
+
278
+ ## 2007-11-27 (1.1.2)
226
279
  * Remember default dir (last used directory) in editor.
227
280
  * JSON::Editor.edit method added, the editor can now receive json texts from
228
281
  the clipboard via C-v.
@@ -238,13 +291,14 @@
238
291
  generator by returning something other than a String instance from a
239
292
  to_json method. I now guard against this by doing a rather crude type
240
293
  check, which raises an exception instead of crashing.
241
- 2007-07-06 (1.1.1)
294
+
295
+ ## 2007-07-06 (1.1.1)
242
296
  * Yui NARUSE <naruse@airemix.com> sent some patches to fix tests for Ruby
243
297
  1.9. I applied them and adapted some of them a bit to run both on 1.8 and
244
298
  1.9.
245
- * Introduced a JSON.parse! method without depth checking for people who like
246
- danger.
247
- * Made generate and pretty_generate methods configurable by an options hash.
299
+ * Introduced a `JSON.parse!` method without depth checking for people who
300
+ like danger.
301
+ * Made generate and `pretty_generate` methods configurable by an options hash.
248
302
  * Added :allow_nan option to parser and generator in order to handle NaN,
249
303
  Infinity, and -Infinity correctly - if requested. Floats, which aren't numbers,
250
304
  aren't valid JSON according to RFC4627, so by default an exception will be
@@ -253,55 +307,65 @@
253
307
  * Fixed some more tests for Ruby 1.9.
254
308
  * Implemented dump/load interface of Marshal as suggested in ruby-core:11405
255
309
  by murphy <murphy@rubychan.de>.
256
- * Implemented the max_nesting feature for generate methods, too.
310
+ * Implemented the `max_nesting` feature for generate methods, too.
257
311
  * Added some implementations for ruby core's custom objects for
258
312
  serialisation/deserialisation purposes.
259
- 2007-05-21 (1.1.0)
313
+
314
+ ## 2007-05-21 (1.1.0)
260
315
  * Implemented max_nesting feature for parser to avoid stack overflows for
261
316
  data from untrusted sources. If you trust the source, you can disable it
262
317
  with the option max_nesting => false.
263
318
  * Piers Cawley <pdcawley@bofh.org.uk> reported a bug, that not every
264
- character can be escaped by ?\ as required by RFC4627. There's a
319
+ character can be escaped by `\` as required by RFC4627. There's a
265
320
  contradiction between David Crockford's JSON checker test vectors (in
266
321
  tests/fixtures) and RFC4627, though. I decided to stick to the RFC, because
267
322
  the JSON checker seems to be a bit older than the RFC.
268
323
  * Extended license to Ruby License, which includes the GPL.
269
324
  * Added keyboard shortcuts, and 'Open location' menu item to edit_json.rb.
270
- 2007-05-09 (1.0.4)
325
+
326
+ ## 2007-05-09 (1.0.4)
271
327
  * Applied a patch from Yui NARUSE <naruse@airemix.com> to make JSON compile
272
328
  under Ruby 1.9. Thank you very much for mailing it to me!
273
329
  * Made binary variants of JSON fail early, instead of falling back to the
274
330
  pure version. This should avoid overshadowing of eventual problems while
275
331
  loading of the binary.
276
- 2007-03-24 (1.0.3)
332
+
333
+ ## 2007-03-24 (1.0.3)
277
334
  * Improved performance of pure variant a bit.
278
335
  * The ext variant of this release supports the mswin32 platform. Ugh!
279
- 2007-03-24 (1.0.2)
336
+
337
+ ## 2007-03-24 (1.0.2)
280
338
  * Ext Parser didn't parse 0e0 correctly into 0.0: Fixed!
281
- 2007-03-24 (1.0.1)
339
+
340
+ ## 2007-03-24 (1.0.1)
282
341
  * Forgot some object files in the build dir. I really like that - not!
283
- 2007-03-24 (1.0.0)
342
+
343
+ ## 2007-03-24 (1.0.0)
284
344
  * Added C implementations for the JSON generator and a ragel based JSON
285
345
  parser in C.
286
346
  * Much more tests, especially fixtures from json.org.
287
347
  * Further improved conformance to RFC4627.
288
- 2007-02-09 (0.4.3)
348
+
349
+ ## 2007-02-09 (0.4.3)
289
350
  * Conform more to RFC4627 for JSON: This means JSON strings
290
- now always must contain exactly one object "{ ... }" or array "[ ... ]" in
351
+ now always must contain exactly one object `"{ ... }"` or array `"[ ... ]"` in
291
352
  order to be parsed without raising an exception. The definition of what
292
353
  constitutes a whitespace is narrower in JSON than in Ruby ([ \t\r\n]), and
293
354
  there are differences in floats and integers (no octals or hexadecimals) as
294
355
  well.
295
- * Added aliases generate and pretty_generate of unparse and pretty_unparse.
356
+ * Added aliases generate and `pretty_generate` of unparse and `pretty_unparse`.
296
357
  * Fixed a test case.
297
- * Catch an Iconv::InvalidEncoding exception, that seems to occur on some Sun
358
+ * Catch an `Iconv::InvalidEncoding` exception, that seems to occur on some Sun
298
359
  boxes with SunOS 5.8, if iconv doesn't support utf16 conversions. This was
299
360
  reported by Andrew R Jackson <andrewj@bcm.tmc.edu>, thanks a bunch!
300
- 2006-08-25 (0.4.2)
361
+
362
+ ## 2006-08-25 (0.4.2)
301
363
  * Fixed a bug in handling solidi (/-characters), that was reported by
302
364
  Kevin Gilpin <kevin.gilpin@alum.mit.edu>.
303
- 2006-02-06 (0.4.1)
365
+
366
+ ## 2006-02-06 (0.4.1)
304
367
  * Fixed a bug related to escaping with backslashes. Thanks for the report go
305
368
  to Florian Munz <surf@theflow.de>.
306
- 2005-09-23 (0.4.0)
369
+
370
+ ## 2005-09-23 (0.4.0)
307
371
  * Initial Rubyforge Version
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.0.1
@@ -222,6 +222,7 @@ static void convert_UTF8_to_JSON_ASCII(FBuffer *buffer, VALUE string)
222
222
  unicode_escape_to_buffer(buffer, buf, (UTF16)((ch & halfMask) + UNI_SUR_LOW_START));
223
223
  }
224
224
  }
225
+ RB_GC_GUARD(string);
225
226
  }
226
227
 
227
228
  /* Converts string to a JSON string in FBuffer buffer, where only the
@@ -113,14 +113,14 @@ enum {JSON_object_en_main = 1};
113
113
  #line 165 "parser.rl"
114
114
 
115
115
 
116
- static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result)
116
+ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
117
117
  {
118
118
  int cs = EVIL;
119
119
  VALUE last_name = Qnil;
120
120
  VALUE object_class = json->object_class;
121
121
 
122
- if (json->max_nesting && json->current_nesting > json->max_nesting) {
123
- rb_raise(eNestingError, "nesting of %d is too deep", json->current_nesting);
122
+ if (json->max_nesting && current_nesting > json->max_nesting) {
123
+ rb_raise(eNestingError, "nesting of %d is too deep", current_nesting);
124
124
  }
125
125
 
126
126
  *result = NIL_P(object_class) ? rb_hash_new() : rb_class_new_instance(0, 0, object_class);
@@ -244,7 +244,7 @@ tr11:
244
244
  #line 132 "parser.rl"
245
245
  {
246
246
  VALUE v = Qnil;
247
- char *np = JSON_parse_value(json, p, pe, &v);
247
+ char *np = JSON_parse_value(json, p, pe, &v, current_nesting);
248
248
  if (np == NULL) {
249
249
  p--; {p++; cs = 9; goto _out;}
250
250
  } else {
@@ -488,10 +488,10 @@ enum {JSON_value_error = 0};
488
488
  enum {JSON_value_en_main = 1};
489
489
 
490
490
 
491
- #line 285 "parser.rl"
491
+ #line 281 "parser.rl"
492
492
 
493
493
 
494
- static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result)
494
+ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
495
495
  {
496
496
  int cs = EVIL;
497
497
 
@@ -501,7 +501,7 @@ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *resul
501
501
  cs = JSON_value_start;
502
502
  }
503
503
 
504
- #line 292 "parser.rl"
504
+ #line 288 "parser.rl"
505
505
 
506
506
  #line 507 "parser.c"
507
507
  {
@@ -567,19 +567,15 @@ tr7:
567
567
  #line 256 "parser.rl"
568
568
  {
569
569
  char *np;
570
- json->current_nesting++;
571
- np = JSON_parse_array(json, p, pe, result);
572
- json->current_nesting--;
570
+ np = JSON_parse_array(json, p, pe, result, current_nesting + 1);
573
571
  if (np == NULL) { p--; {p++; cs = 29; goto _out;} } else {p = (( np))-1;}
574
572
  }
575
573
  goto st29;
576
574
  tr11:
577
- #line 264 "parser.rl"
575
+ #line 262 "parser.rl"
578
576
  {
579
577
  char *np;
580
- json->current_nesting++;
581
- np = JSON_parse_object(json, p, pe, result);
582
- json->current_nesting--;
578
+ np = JSON_parse_object(json, p, pe, result, current_nesting + 1);
583
579
  if (np == NULL) { p--; {p++; cs = 29; goto _out;} } else {p = (( np))-1;}
584
580
  }
585
581
  goto st29;
@@ -625,9 +621,9 @@ st29:
625
621
  if ( ++p == pe )
626
622
  goto _test_eof29;
627
623
  case 29:
628
- #line 272 "parser.rl"
624
+ #line 268 "parser.rl"
629
625
  { p--; {p++; cs = 29; goto _out;} }
630
- #line 631 "parser.c"
626
+ #line 627 "parser.c"
631
627
  switch( (*p) ) {
632
628
  case 13: goto st29;
633
629
  case 32: goto st29;
@@ -868,7 +864,7 @@ case 28:
868
864
  _out: {}
869
865
  }
870
866
 
871
- #line 293 "parser.rl"
867
+ #line 289 "parser.rl"
872
868
 
873
869
  if (cs >= JSON_value_first_final) {
874
870
  return p;
@@ -878,7 +874,7 @@ case 28:
878
874
  }
879
875
 
880
876
 
881
- #line 882 "parser.c"
877
+ #line 878 "parser.c"
882
878
  enum {JSON_integer_start = 1};
883
879
  enum {JSON_integer_first_final = 3};
884
880
  enum {JSON_integer_error = 0};
@@ -886,7 +882,7 @@ enum {JSON_integer_error = 0};
886
882
  enum {JSON_integer_en_main = 1};
887
883
 
888
884
 
889
- #line 309 "parser.rl"
885
+ #line 305 "parser.rl"
890
886
 
891
887
 
892
888
  static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -894,15 +890,15 @@ static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *res
894
890
  int cs = EVIL;
895
891
 
896
892
 
897
- #line 898 "parser.c"
893
+ #line 894 "parser.c"
898
894
  {
899
895
  cs = JSON_integer_start;
900
896
  }
901
897
 
902
- #line 316 "parser.rl"
898
+ #line 312 "parser.rl"
903
899
  json->memo = p;
904
900
 
905
- #line 906 "parser.c"
901
+ #line 902 "parser.c"
906
902
  {
907
903
  if ( p == pe )
908
904
  goto _test_eof;
@@ -936,14 +932,14 @@ case 3:
936
932
  goto st0;
937
933
  goto tr4;
938
934
  tr4:
939
- #line 306 "parser.rl"
935
+ #line 302 "parser.rl"
940
936
  { p--; {p++; cs = 4; goto _out;} }
941
937
  goto st4;
942
938
  st4:
943
939
  if ( ++p == pe )
944
940
  goto _test_eof4;
945
941
  case 4:
946
- #line 947 "parser.c"
942
+ #line 943 "parser.c"
947
943
  goto st0;
948
944
  st5:
949
945
  if ( ++p == pe )
@@ -962,7 +958,7 @@ case 5:
962
958
  _out: {}
963
959
  }
964
960
 
965
- #line 318 "parser.rl"
961
+ #line 314 "parser.rl"
966
962
 
967
963
  if (cs >= JSON_integer_first_final) {
968
964
  long len = p - json->memo;
@@ -977,7 +973,7 @@ case 5:
977
973
  }
978
974
 
979
975
 
980
- #line 981 "parser.c"
976
+ #line 977 "parser.c"
981
977
  enum {JSON_float_start = 1};
982
978
  enum {JSON_float_first_final = 8};
983
979
  enum {JSON_float_error = 0};
@@ -985,7 +981,7 @@ enum {JSON_float_error = 0};
985
981
  enum {JSON_float_en_main = 1};
986
982
 
987
983
 
988
- #line 343 "parser.rl"
984
+ #line 339 "parser.rl"
989
985
 
990
986
 
991
987
  static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result)
@@ -993,15 +989,15 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
993
989
  int cs = EVIL;
994
990
 
995
991
 
996
- #line 997 "parser.c"
992
+ #line 993 "parser.c"
997
993
  {
998
994
  cs = JSON_float_start;
999
995
  }
1000
996
 
1001
- #line 350 "parser.rl"
997
+ #line 346 "parser.rl"
1002
998
  json->memo = p;
1003
999
 
1004
- #line 1005 "parser.c"
1000
+ #line 1001 "parser.c"
1005
1001
  {
1006
1002
  if ( p == pe )
1007
1003
  goto _test_eof;
@@ -1059,14 +1055,14 @@ case 8:
1059
1055
  goto st0;
1060
1056
  goto tr9;
1061
1057
  tr9:
1062
- #line 337 "parser.rl"
1058
+ #line 333 "parser.rl"
1063
1059
  { p--; {p++; cs = 9; goto _out;} }
1064
1060
  goto st9;
1065
1061
  st9:
1066
1062
  if ( ++p == pe )
1067
1063
  goto _test_eof9;
1068
1064
  case 9:
1069
- #line 1070 "parser.c"
1065
+ #line 1066 "parser.c"
1070
1066
  goto st0;
1071
1067
  st5:
1072
1068
  if ( ++p == pe )
@@ -1127,7 +1123,7 @@ case 7:
1127
1123
  _out: {}
1128
1124
  }
1129
1125
 
1130
- #line 352 "parser.rl"
1126
+ #line 348 "parser.rl"
1131
1127
 
1132
1128
  if (cs >= JSON_float_first_final) {
1133
1129
  long len = p - json->memo;
@@ -1143,7 +1139,7 @@ case 7:
1143
1139
 
1144
1140
 
1145
1141
 
1146
- #line 1147 "parser.c"
1142
+ #line 1143 "parser.c"
1147
1143
  enum {JSON_array_start = 1};
1148
1144
  enum {JSON_array_first_final = 17};
1149
1145
  enum {JSON_array_error = 0};
@@ -1151,28 +1147,28 @@ enum {JSON_array_error = 0};
1151
1147
  enum {JSON_array_en_main = 1};
1152
1148
 
1153
1149
 
1154
- #line 395 "parser.rl"
1150
+ #line 391 "parser.rl"
1155
1151
 
1156
1152
 
1157
- static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result)
1153
+ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
1158
1154
  {
1159
1155
  int cs = EVIL;
1160
1156
  VALUE array_class = json->array_class;
1161
1157
 
1162
- if (json->max_nesting && json->current_nesting > json->max_nesting) {
1163
- rb_raise(eNestingError, "nesting of %d is too deep", json->current_nesting);
1158
+ if (json->max_nesting && current_nesting > json->max_nesting) {
1159
+ rb_raise(eNestingError, "nesting of %d is too deep", current_nesting);
1164
1160
  }
1165
1161
  *result = NIL_P(array_class) ? rb_ary_new() : rb_class_new_instance(0, 0, array_class);
1166
1162
 
1167
1163
 
1168
- #line 1169 "parser.c"
1164
+ #line 1165 "parser.c"
1169
1165
  {
1170
1166
  cs = JSON_array_start;
1171
1167
  }
1172
1168
 
1173
- #line 408 "parser.rl"
1169
+ #line 404 "parser.rl"
1174
1170
 
1175
- #line 1176 "parser.c"
1171
+ #line 1172 "parser.c"
1176
1172
  {
1177
1173
  if ( p == pe )
1178
1174
  goto _test_eof;
@@ -1211,10 +1207,10 @@ case 2:
1211
1207
  goto st2;
1212
1208
  goto st0;
1213
1209
  tr2:
1214
- #line 372 "parser.rl"
1210
+ #line 368 "parser.rl"
1215
1211
  {
1216
1212
  VALUE v = Qnil;
1217
- char *np = JSON_parse_value(json, p, pe, &v);
1213
+ char *np = JSON_parse_value(json, p, pe, &v, current_nesting);
1218
1214
  if (np == NULL) {
1219
1215
  p--; {p++; cs = 3; goto _out;}
1220
1216
  } else {
@@ -1231,7 +1227,7 @@ st3:
1231
1227
  if ( ++p == pe )
1232
1228
  goto _test_eof3;
1233
1229
  case 3:
1234
- #line 1235 "parser.c"
1230
+ #line 1231 "parser.c"
1235
1231
  switch( (*p) ) {
1236
1232
  case 13: goto st3;
1237
1233
  case 32: goto st3;
@@ -1331,14 +1327,14 @@ case 12:
1331
1327
  goto st3;
1332
1328
  goto st12;
1333
1329
  tr4:
1334
- #line 387 "parser.rl"
1330
+ #line 383 "parser.rl"
1335
1331
  { p--; {p++; cs = 17; goto _out;} }
1336
1332
  goto st17;
1337
1333
  st17:
1338
1334
  if ( ++p == pe )
1339
1335
  goto _test_eof17;
1340
1336
  case 17:
1341
- #line 1342 "parser.c"
1337
+ #line 1338 "parser.c"
1342
1338
  goto st0;
1343
1339
  st13:
1344
1340
  if ( ++p == pe )
@@ -1394,7 +1390,7 @@ case 16:
1394
1390
  _out: {}
1395
1391
  }
1396
1392
 
1397
- #line 409 "parser.rl"
1393
+ #line 405 "parser.rl"
1398
1394
 
1399
1395
  if(cs >= JSON_array_first_final) {
1400
1396
  return p + 1;
@@ -1475,7 +1471,7 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
1475
1471
  }
1476
1472
 
1477
1473
 
1478
- #line 1479 "parser.c"
1474
+ #line 1475 "parser.c"
1479
1475
  enum {JSON_string_start = 1};
1480
1476
  enum {JSON_string_first_final = 8};
1481
1477
  enum {JSON_string_error = 0};
@@ -1483,7 +1479,7 @@ enum {JSON_string_error = 0};
1483
1479
  enum {JSON_string_en_main = 1};
1484
1480
 
1485
1481
 
1486
- #line 508 "parser.rl"
1482
+ #line 504 "parser.rl"
1487
1483
 
1488
1484
 
1489
1485
  static int
@@ -1505,15 +1501,15 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
1505
1501
 
1506
1502
  *result = rb_str_buf_new(0);
1507
1503
 
1508
- #line 1509 "parser.c"
1504
+ #line 1505 "parser.c"
1509
1505
  {
1510
1506
  cs = JSON_string_start;
1511
1507
  }
1512
1508
 
1513
- #line 529 "parser.rl"
1509
+ #line 525 "parser.rl"
1514
1510
  json->memo = p;
1515
1511
 
1516
- #line 1517 "parser.c"
1512
+ #line 1513 "parser.c"
1517
1513
  {
1518
1514
  if ( p == pe )
1519
1515
  goto _test_eof;
@@ -1538,7 +1534,7 @@ case 2:
1538
1534
  goto st0;
1539
1535
  goto st2;
1540
1536
  tr2:
1541
- #line 494 "parser.rl"
1537
+ #line 490 "parser.rl"
1542
1538
  {
1543
1539
  *result = json_string_unescape(*result, json->memo + 1, p);
1544
1540
  if (NIL_P(*result)) {
@@ -1549,14 +1545,14 @@ tr2:
1549
1545
  {p = (( p + 1))-1;}
1550
1546
  }
1551
1547
  }
1552
- #line 505 "parser.rl"
1548
+ #line 501 "parser.rl"
1553
1549
  { p--; {p++; cs = 8; goto _out;} }
1554
1550
  goto st8;
1555
1551
  st8:
1556
1552
  if ( ++p == pe )
1557
1553
  goto _test_eof8;
1558
1554
  case 8:
1559
- #line 1560 "parser.c"
1555
+ #line 1556 "parser.c"
1560
1556
  goto st0;
1561
1557
  st3:
1562
1558
  if ( ++p == pe )
@@ -1632,7 +1628,7 @@ case 7:
1632
1628
  _out: {}
1633
1629
  }
1634
1630
 
1635
- #line 531 "parser.rl"
1631
+ #line 527 "parser.rl"
1636
1632
 
1637
1633
  if (json->create_additions && RTEST(match_string = json->match_string)) {
1638
1634
  VALUE klass;
@@ -1801,7 +1797,6 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
1801
1797
  json->array_class = Qnil;
1802
1798
  }
1803
1799
  source = convert_encoding(StringValue(source));
1804
- json->current_nesting = 0;
1805
1800
  StringValue(source);
1806
1801
  json->len = RSTRING_LEN(source);
1807
1802
  json->source = RSTRING_PTR(source);;
@@ -1810,7 +1805,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
1810
1805
  }
1811
1806
 
1812
1807
 
1813
- #line 1814 "parser.c"
1808
+ #line 1809 "parser.c"
1814
1809
  enum {JSON_start = 1};
1815
1810
  enum {JSON_first_final = 10};
1816
1811
  enum {JSON_error = 0};
@@ -1818,7 +1813,7 @@ enum {JSON_error = 0};
1818
1813
  enum {JSON_en_main = 1};
1819
1814
 
1820
1815
 
1821
- #line 722 "parser.rl"
1816
+ #line 717 "parser.rl"
1822
1817
 
1823
1818
 
1824
1819
  /*
@@ -1835,16 +1830,16 @@ static VALUE cParser_parse(VALUE self)
1835
1830
  GET_PARSER;
1836
1831
 
1837
1832
 
1838
- #line 1839 "parser.c"
1833
+ #line 1834 "parser.c"
1839
1834
  {
1840
1835
  cs = JSON_start;
1841
1836
  }
1842
1837
 
1843
- #line 738 "parser.rl"
1838
+ #line 733 "parser.rl"
1844
1839
  p = json->source;
1845
1840
  pe = p + json->len;
1846
1841
 
1847
- #line 1848 "parser.c"
1842
+ #line 1843 "parser.c"
1848
1843
  {
1849
1844
  if ( p == pe )
1850
1845
  goto _test_eof;
@@ -1878,9 +1873,9 @@ st0:
1878
1873
  cs = 0;
1879
1874
  goto _out;
1880
1875
  tr2:
1881
- #line 714 "parser.rl"
1876
+ #line 709 "parser.rl"
1882
1877
  {
1883
- char *np = JSON_parse_value(json, p, pe, &result);
1878
+ char *np = JSON_parse_value(json, p, pe, &result, 0);
1884
1879
  if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;}
1885
1880
  }
1886
1881
  goto st10;
@@ -1888,7 +1883,7 @@ st10:
1888
1883
  if ( ++p == pe )
1889
1884
  goto _test_eof10;
1890
1885
  case 10:
1891
- #line 1892 "parser.c"
1886
+ #line 1887 "parser.c"
1892
1887
  switch( (*p) ) {
1893
1888
  case 13: goto st10;
1894
1889
  case 32: goto st10;
@@ -1977,7 +1972,7 @@ case 9:
1977
1972
  _out: {}
1978
1973
  }
1979
1974
 
1980
- #line 741 "parser.rl"
1975
+ #line 736 "parser.rl"
1981
1976
 
1982
1977
  if (cs >= JSON_first_final && p == pe) {
1983
1978
  return result;
@@ -34,7 +34,6 @@ typedef struct JSON_ParserStruct {
34
34
  char *memo;
35
35
  VALUE create_id;
36
36
  int max_nesting;
37
- int current_nesting;
38
37
  int allow_nan;
39
38
  int parsing_name;
40
39
  int symbolize_names;
@@ -57,11 +56,11 @@ typedef struct JSON_ParserStruct {
57
56
 
58
57
  static UTF32 unescape_unicode(const unsigned char *p);
59
58
  static int convert_UTF32_to_UTF8(char *buf, UTF32 ch);
60
- static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result);
61
- static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result);
59
+ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting);
60
+ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting);
62
61
  static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result);
63
62
  static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result);
64
- static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result);
63
+ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting);
65
64
  static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd);
66
65
  static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result);
67
66
  static VALUE convert_encoding(VALUE source);
@@ -131,7 +131,7 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
131
131
 
132
132
  action parse_value {
133
133
  VALUE v = Qnil;
134
- char *np = JSON_parse_value(json, fpc, pe, &v);
134
+ char *np = JSON_parse_value(json, fpc, pe, &v, current_nesting);
135
135
  if (np == NULL) {
136
136
  fhold; fbreak;
137
137
  } else {
@@ -164,14 +164,14 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
164
164
  ) @exit;
165
165
  }%%
166
166
 
167
- static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result)
167
+ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
168
168
  {
169
169
  int cs = EVIL;
170
170
  VALUE last_name = Qnil;
171
171
  VALUE object_class = json->object_class;
172
172
 
173
- if (json->max_nesting && json->current_nesting > json->max_nesting) {
174
- rb_raise(eNestingError, "nesting of %d is too deep", json->current_nesting);
173
+ if (json->max_nesting && current_nesting > json->max_nesting) {
174
+ rb_raise(eNestingError, "nesting of %d is too deep", current_nesting);
175
175
  }
176
176
 
177
177
  *result = NIL_P(object_class) ? rb_hash_new() : rb_class_new_instance(0, 0, object_class);
@@ -255,17 +255,13 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
255
255
 
256
256
  action parse_array {
257
257
  char *np;
258
- json->current_nesting++;
259
- np = JSON_parse_array(json, fpc, pe, result);
260
- json->current_nesting--;
258
+ np = JSON_parse_array(json, fpc, pe, result, current_nesting + 1);
261
259
  if (np == NULL) { fhold; fbreak; } else fexec np;
262
260
  }
263
261
 
264
262
  action parse_object {
265
263
  char *np;
266
- json->current_nesting++;
267
- np = JSON_parse_object(json, fpc, pe, result);
268
- json->current_nesting--;
264
+ np = JSON_parse_object(json, fpc, pe, result, current_nesting + 1);
269
265
  if (np == NULL) { fhold; fbreak; } else fexec np;
270
266
  }
271
267
 
@@ -284,7 +280,7 @@ main := ignore* (
284
280
  ) ignore* %*exit;
285
281
  }%%
286
282
 
287
- static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result)
283
+ static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
288
284
  {
289
285
  int cs = EVIL;
290
286
 
@@ -371,7 +367,7 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
371
367
 
372
368
  action parse_value {
373
369
  VALUE v = Qnil;
374
- char *np = JSON_parse_value(json, fpc, pe, &v);
370
+ char *np = JSON_parse_value(json, fpc, pe, &v, current_nesting);
375
371
  if (np == NULL) {
376
372
  fhold; fbreak;
377
373
  } else {
@@ -394,13 +390,13 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
394
390
  end_array @exit;
395
391
  }%%
396
392
 
397
- static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result)
393
+ static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting)
398
394
  {
399
395
  int cs = EVIL;
400
396
  VALUE array_class = json->array_class;
401
397
 
402
- if (json->max_nesting && json->current_nesting > json->max_nesting) {
403
- rb_raise(eNestingError, "nesting of %d is too deep", json->current_nesting);
398
+ if (json->max_nesting && current_nesting > json->max_nesting) {
399
+ rb_raise(eNestingError, "nesting of %d is too deep", current_nesting);
404
400
  }
405
401
  *result = NIL_P(array_class) ? rb_ary_new() : rb_class_new_instance(0, 0, array_class);
406
402
 
@@ -696,7 +692,6 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
696
692
  json->array_class = Qnil;
697
693
  }
698
694
  source = convert_encoding(StringValue(source));
699
- json->current_nesting = 0;
700
695
  StringValue(source);
701
696
  json->len = RSTRING_LEN(source);
702
697
  json->source = RSTRING_PTR(source);;
@@ -712,7 +707,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
712
707
  include JSON_common;
713
708
 
714
709
  action parse_value {
715
- char *np = JSON_parse_value(json, fpc, pe, &result);
710
+ char *np = JSON_parse_value(json, fpc, pe, &result, 0);
716
711
  if (np == NULL) { fhold; fbreak; } else fexec np;
717
712
  }
718
713
 
Binary file
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: json_pure 2.0.0 ruby lib
2
+ # stub: json_pure 2.0.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "json_pure".freeze
6
- s.version = "2.0.0"
6
+ s.version = "2.0.1"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.description = "This is a JSON implementation in pure Ruby.".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.extra_rdoc_files = ["README.md".freeze]
15
- s.files = ["./tests/test_helper.rb".freeze, ".gitignore".freeze, ".travis.yml".freeze, "CHANGES".freeze, "Gemfile".freeze, "README-json-jruby.markdown".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "data/example.json".freeze, "data/index.html".freeze, "data/prototype.js".freeze, "diagrams/.keep".freeze, "ext/json/ext/fbuffer/fbuffer.h".freeze, "ext/json/ext/generator/depend".freeze, "ext/json/ext/generator/extconf.rb".freeze, "ext/json/ext/generator/generator.c".freeze, "ext/json/ext/generator/generator.h".freeze, "ext/json/ext/parser/depend".freeze, "ext/json/ext/parser/extconf.rb".freeze, "ext/json/ext/parser/parser.c".freeze, "ext/json/ext/parser/parser.h".freeze, "ext/json/ext/parser/parser.rl".freeze, "ext/json/extconf.rb".freeze, "install.rb".freeze, "java/src/json/ext/ByteListTranscoder.java".freeze, "java/src/json/ext/Generator.java".freeze, "java/src/json/ext/GeneratorMethods.java".freeze, "java/src/json/ext/GeneratorService.java".freeze, "java/src/json/ext/GeneratorState.java".freeze, "java/src/json/ext/OptionsReader.java".freeze, "java/src/json/ext/Parser.java".freeze, "java/src/json/ext/Parser.rl".freeze, "java/src/json/ext/ParserService.java".freeze, "java/src/json/ext/RuntimeInfo.java".freeze, "java/src/json/ext/StringDecoder.java".freeze, "java/src/json/ext/StringEncoder.java".freeze, "java/src/json/ext/Utils.java".freeze, "json-java.gemspec".freeze, "json.gemspec".freeze, "json_pure.gemspec".freeze, "lib/json.rb".freeze, "lib/json/add/bigdecimal.rb".freeze, "lib/json/add/complex.rb".freeze, "lib/json/add/core.rb".freeze, "lib/json/add/date.rb".freeze, "lib/json/add/date_time.rb".freeze, "lib/json/add/exception.rb".freeze, "lib/json/add/ostruct.rb".freeze, "lib/json/add/range.rb".freeze, "lib/json/add/rational.rb".freeze, "lib/json/add/regexp.rb".freeze, "lib/json/add/struct.rb".freeze, "lib/json/add/symbol.rb".freeze, "lib/json/add/time.rb".freeze, "lib/json/common.rb".freeze, "lib/json/ext.rb".freeze, "lib/json/ext/.keep".freeze, "lib/json/generic_object.rb".freeze, "lib/json/pure.rb".freeze, "lib/json/pure/generator.rb".freeze, "lib/json/pure/parser.rb".freeze, "lib/json/version.rb".freeze, "references/rfc7159.txt".freeze, "tests/fixtures/fail10.json".freeze, "tests/fixtures/fail11.json".freeze, "tests/fixtures/fail12.json".freeze, "tests/fixtures/fail13.json".freeze, "tests/fixtures/fail14.json".freeze, "tests/fixtures/fail18.json".freeze, "tests/fixtures/fail19.json".freeze, "tests/fixtures/fail2.json".freeze, "tests/fixtures/fail20.json".freeze, "tests/fixtures/fail21.json".freeze, "tests/fixtures/fail22.json".freeze, "tests/fixtures/fail23.json".freeze, "tests/fixtures/fail24.json".freeze, "tests/fixtures/fail25.json".freeze, "tests/fixtures/fail27.json".freeze, "tests/fixtures/fail28.json".freeze, "tests/fixtures/fail3.json".freeze, "tests/fixtures/fail4.json".freeze, "tests/fixtures/fail5.json".freeze, "tests/fixtures/fail6.json".freeze, "tests/fixtures/fail7.json".freeze, "tests/fixtures/fail8.json".freeze, "tests/fixtures/fail9.json".freeze, "tests/fixtures/obsolete_fail1.json".freeze, "tests/fixtures/pass1.json".freeze, "tests/fixtures/pass15.json".freeze, "tests/fixtures/pass16.json".freeze, "tests/fixtures/pass17.json".freeze, "tests/fixtures/pass2.json".freeze, "tests/fixtures/pass26.json".freeze, "tests/fixtures/pass3.json".freeze, "tests/json_addition_test.rb".freeze, "tests/json_common_interface_test.rb".freeze, "tests/json_encoding_test.rb".freeze, "tests/json_ext_parser_test.rb".freeze, "tests/json_fixtures_test.rb".freeze, "tests/json_generator_test.rb".freeze, "tests/json_generic_object_test.rb".freeze, "tests/json_parser_test.rb".freeze, "tests/json_string_matching_test.rb".freeze, "tests/test_helper.rb".freeze, "tools/diff.sh".freeze, "tools/fuzz.rb".freeze, "tools/server.rb".freeze]
15
+ s.files = ["./tests/test_helper.rb".freeze, ".gitignore".freeze, ".travis.yml".freeze, "CHANGES.md".freeze, "Gemfile".freeze, "README-json-jruby.md".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "data/example.json".freeze, "data/index.html".freeze, "data/prototype.js".freeze, "diagrams/.keep".freeze, "ext/json/ext/fbuffer/fbuffer.h".freeze, "ext/json/ext/generator/depend".freeze, "ext/json/ext/generator/extconf.rb".freeze, "ext/json/ext/generator/generator.c".freeze, "ext/json/ext/generator/generator.h".freeze, "ext/json/ext/parser/depend".freeze, "ext/json/ext/parser/extconf.rb".freeze, "ext/json/ext/parser/parser.c".freeze, "ext/json/ext/parser/parser.h".freeze, "ext/json/ext/parser/parser.rl".freeze, "ext/json/extconf.rb".freeze, "install.rb".freeze, "java/src/json/ext/ByteListTranscoder.java".freeze, "java/src/json/ext/Generator.java".freeze, "java/src/json/ext/GeneratorMethods.java".freeze, "java/src/json/ext/GeneratorService.java".freeze, "java/src/json/ext/GeneratorState.java".freeze, "java/src/json/ext/OptionsReader.java".freeze, "java/src/json/ext/Parser.java".freeze, "java/src/json/ext/Parser.rl".freeze, "java/src/json/ext/ParserService.java".freeze, "java/src/json/ext/RuntimeInfo.java".freeze, "java/src/json/ext/StringDecoder.java".freeze, "java/src/json/ext/StringEncoder.java".freeze, "java/src/json/ext/Utils.java".freeze, "json-java.gemspec".freeze, "json.gemspec".freeze, "json_pure.gemspec".freeze, "lib/json.rb".freeze, "lib/json/add/bigdecimal.rb".freeze, "lib/json/add/complex.rb".freeze, "lib/json/add/core.rb".freeze, "lib/json/add/date.rb".freeze, "lib/json/add/date_time.rb".freeze, "lib/json/add/exception.rb".freeze, "lib/json/add/ostruct.rb".freeze, "lib/json/add/range.rb".freeze, "lib/json/add/rational.rb".freeze, "lib/json/add/regexp.rb".freeze, "lib/json/add/struct.rb".freeze, "lib/json/add/symbol.rb".freeze, "lib/json/add/time.rb".freeze, "lib/json/common.rb".freeze, "lib/json/ext.rb".freeze, "lib/json/ext/.keep".freeze, "lib/json/generic_object.rb".freeze, "lib/json/pure.rb".freeze, "lib/json/pure/generator.rb".freeze, "lib/json/pure/parser.rb".freeze, "lib/json/version.rb".freeze, "references/rfc7159.txt".freeze, "tests/fixtures/fail10.json".freeze, "tests/fixtures/fail11.json".freeze, "tests/fixtures/fail12.json".freeze, "tests/fixtures/fail13.json".freeze, "tests/fixtures/fail14.json".freeze, "tests/fixtures/fail18.json".freeze, "tests/fixtures/fail19.json".freeze, "tests/fixtures/fail2.json".freeze, "tests/fixtures/fail20.json".freeze, "tests/fixtures/fail21.json".freeze, "tests/fixtures/fail22.json".freeze, "tests/fixtures/fail23.json".freeze, "tests/fixtures/fail24.json".freeze, "tests/fixtures/fail25.json".freeze, "tests/fixtures/fail27.json".freeze, "tests/fixtures/fail28.json".freeze, "tests/fixtures/fail3.json".freeze, "tests/fixtures/fail4.json".freeze, "tests/fixtures/fail5.json".freeze, "tests/fixtures/fail6.json".freeze, "tests/fixtures/fail7.json".freeze, "tests/fixtures/fail8.json".freeze, "tests/fixtures/fail9.json".freeze, "tests/fixtures/obsolete_fail1.json".freeze, "tests/fixtures/pass1.json".freeze, "tests/fixtures/pass15.json".freeze, "tests/fixtures/pass16.json".freeze, "tests/fixtures/pass17.json".freeze, "tests/fixtures/pass2.json".freeze, "tests/fixtures/pass26.json".freeze, "tests/fixtures/pass3.json".freeze, "tests/json_addition_test.rb".freeze, "tests/json_common_interface_test.rb".freeze, "tests/json_encoding_test.rb".freeze, "tests/json_ext_parser_test.rb".freeze, "tests/json_fixtures_test.rb".freeze, "tests/json_generator_test.rb".freeze, "tests/json_generic_object_test.rb".freeze, "tests/json_parser_test.rb".freeze, "tests/json_string_matching_test.rb".freeze, "tests/test_helper.rb".freeze, "tools/diff.sh".freeze, "tools/fuzz.rb".freeze, "tools/server.rb".freeze]
16
16
  s.homepage = "http://flori.github.com/json".freeze
17
17
  s.licenses = ["Ruby".freeze]
18
18
  s.rdoc_options = ["--title".freeze, "JSON implemention for ruby".freeze, "--main".freeze, "README.md".freeze]
@@ -25,7 +25,7 @@ module JSON
25
25
  # Set the JSON parser class _parser_ to be used by JSON.
26
26
  def parser=(parser) # :nodoc:
27
27
  @parser = parser
28
- remove_const :Parser if const_defined?(:Parser, true)
28
+ remove_const :Parser if const_defined?(:Parser, false)
29
29
  const_set :Parser, parser
30
30
  end
31
31
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
  module JSON
3
3
  # JSON version
4
- VERSION = '2.0.0'
4
+ VERSION = '2.0.1'
5
5
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
6
6
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
7
7
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -51,9 +51,9 @@ files:
51
51
  - "./tests/test_helper.rb"
52
52
  - ".gitignore"
53
53
  - ".travis.yml"
54
- - CHANGES
54
+ - CHANGES.md
55
55
  - Gemfile
56
- - README-json-jruby.markdown
56
+ - README-json-jruby.md
57
57
  - README.md
58
58
  - Rakefile
59
59
  - VERSION