json 1.4.0 → 1.4.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.
- data/CHANGES +7 -0
- data/VERSION +1 -1
- data/benchmarks/parser2_benchmark.rb +5 -5
- data/ext/json/ext/generator.c +6 -6
- data/ext/json/ext/generator.h +1 -1
- data/lib/json/version.rb +1 -1
- data/tests/test_json.rb +13 -0
- metadata +2 -2
data/CHANGES
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
2010-04-25 (1.4.1)
|
2
|
+
* Fix for a bug reported by Dan DeLeo <dan@kallistec.com>, caused by T_FIXNUM
|
3
|
+
being different on 32bit/64bit architectures.
|
4
|
+
2010-04-23 (1.4.0)
|
5
|
+
* Major speed improvements and building with simplified
|
6
|
+
directory/file-structure.
|
7
|
+
* Extension should at least be comapatible with MRI, YARV and Rubinius.
|
1
8
|
2010-04-07 (1.2.4)
|
2
9
|
* Triger const_missing callback to make Rails' dynamic class loading work.
|
3
10
|
2010-03-11 (1.2.3)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.1
|
@@ -39,7 +39,7 @@ class Parser2BenchmarkExt < Bullshit::RepeatCase
|
|
39
39
|
include Parser2BenchmarkCommon
|
40
40
|
|
41
41
|
warmup yes
|
42
|
-
iterations
|
42
|
+
iterations 2000
|
43
43
|
|
44
44
|
truncate_data do
|
45
45
|
enabled false
|
@@ -76,7 +76,7 @@ class Parser2BenchmarkPure < Bullshit::RepeatCase
|
|
76
76
|
include Parser2BenchmarkCommon
|
77
77
|
|
78
78
|
warmup yes
|
79
|
-
iterations
|
79
|
+
iterations 400
|
80
80
|
|
81
81
|
truncate_data do
|
82
82
|
enabled false
|
@@ -111,7 +111,7 @@ end
|
|
111
111
|
|
112
112
|
class Parser2BenchmarkYAML < Bullshit::RepeatCase
|
113
113
|
warmup yes
|
114
|
-
iterations
|
114
|
+
iterations 400
|
115
115
|
|
116
116
|
truncate_data do
|
117
117
|
enabled false
|
@@ -146,7 +146,7 @@ end
|
|
146
146
|
|
147
147
|
class Parser2BenchmarkRails < Bullshit::RepeatCase
|
148
148
|
warmup yes
|
149
|
-
iterations
|
149
|
+
iterations 400
|
150
150
|
|
151
151
|
truncate_data do
|
152
152
|
alpha_level 0.05
|
@@ -182,7 +182,7 @@ end
|
|
182
182
|
|
183
183
|
class Parser2BenchmarkYajl < Bullshit::RepeatCase
|
184
184
|
warmup yes
|
185
|
-
iterations
|
185
|
+
iterations 2000
|
186
186
|
|
187
187
|
truncate_data do
|
188
188
|
alpha_level 0.05
|
data/ext/json/ext/generator.c
CHANGED
@@ -367,10 +367,10 @@ static void freverse(char *start, char *end)
|
|
367
367
|
}
|
368
368
|
}
|
369
369
|
|
370
|
-
static int
|
370
|
+
static int fltoa(long number, char *buf)
|
371
371
|
{
|
372
372
|
static char digits[] = "0123456789";
|
373
|
-
|
373
|
+
long sign = number;
|
374
374
|
char* tmp = buf;
|
375
375
|
|
376
376
|
if (sign < 0) number = -number;
|
@@ -380,10 +380,10 @@ static int fitoa(int number, char *buf)
|
|
380
380
|
return tmp - buf;
|
381
381
|
}
|
382
382
|
|
383
|
-
static void
|
383
|
+
static void fbuffer_append_long(FBuffer *fb, long number)
|
384
384
|
{
|
385
|
-
char buf[
|
386
|
-
int len =
|
385
|
+
char buf[20];
|
386
|
+
int len = fltoa(number, buf);
|
387
387
|
fbuffer_append(fb, buf, len);
|
388
388
|
}
|
389
389
|
|
@@ -841,7 +841,7 @@ static void generate_json(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *s
|
|
841
841
|
fbuffer_append(buffer, "true", 4);
|
842
842
|
break;
|
843
843
|
case T_FIXNUM:
|
844
|
-
|
844
|
+
fbuffer_append_long(buffer, FIX2LONG(obj));
|
845
845
|
break;
|
846
846
|
case T_BIGNUM:
|
847
847
|
tmp = rb_funcall(obj, i_to_s, 0);
|
data/ext/json/ext/generator.h
CHANGED
@@ -70,7 +70,7 @@ static void fbuffer_free(FBuffer *fb);
|
|
70
70
|
static void fbuffer_free_only_buffer(FBuffer *fb);
|
71
71
|
static void fbuffer_clear(FBuffer *fb);
|
72
72
|
static void fbuffer_append(FBuffer *fb, const char *newstr, unsigned int len);
|
73
|
-
static void
|
73
|
+
static void fbuffer_append_long(FBuffer *fb, long number);
|
74
74
|
static void fbuffer_append_char(FBuffer *fb, char newchr);
|
75
75
|
static FBuffer *fbuffer_dup(FBuffer *fb);
|
76
76
|
|
data/lib/json/version.rb
CHANGED
data/tests/test_json.rb
CHANGED
@@ -324,4 +324,17 @@ EOT
|
|
324
324
|
JSON.dump(eval(too_deep), output, 20)
|
325
325
|
assert_equal too_deep, output.string
|
326
326
|
end
|
327
|
+
|
328
|
+
def test_big_integers
|
329
|
+
json1 = JSON([orig = (1 << 31) - 1])
|
330
|
+
assert_equal orig, JSON[json1][0]
|
331
|
+
json2 = JSON([orig = 1 << 31])
|
332
|
+
assert_equal orig, JSON[json2][0]
|
333
|
+
json3 = JSON([orig = (1 << 62) - 1])
|
334
|
+
assert_equal orig, JSON[json3][0]
|
335
|
+
json4 = JSON([orig = 1 << 62])
|
336
|
+
assert_equal orig, JSON[json4][0]
|
337
|
+
json5 = JSON([orig = 1 << 64])
|
338
|
+
assert_equal orig, JSON[json5][0]
|
339
|
+
end
|
327
340
|
end
|
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: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-04-
|
12
|
+
date: 2010-04-25 00:00:00 +02:00
|
13
13
|
default_executable: edit_json.rb
|
14
14
|
dependencies: []
|
15
15
|
|