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 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.0
1
+ 1.4.1
@@ -39,7 +39,7 @@ class Parser2BenchmarkExt < Bullshit::RepeatCase
39
39
  include Parser2BenchmarkCommon
40
40
 
41
41
  warmup yes
42
- iterations 500
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 100
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 100
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 100
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 500
185
+ iterations 2000
186
186
 
187
187
  truncate_data do
188
188
  alpha_level 0.05
@@ -367,10 +367,10 @@ static void freverse(char *start, char *end)
367
367
  }
368
368
  }
369
369
 
370
- static int fitoa(int number, char *buf)
370
+ static int fltoa(long number, char *buf)
371
371
  {
372
372
  static char digits[] = "0123456789";
373
- int sign = number;
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 fbuffer_append_integer(FBuffer *fb, int number)
383
+ static void fbuffer_append_long(FBuffer *fb, long number)
384
384
  {
385
- char buf[12];
386
- int len = fitoa(number, buf);
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
- fbuffer_append_integer(buffer, FIX2INT(obj));
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);
@@ -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 fbuffer_append_integer(FBuffer *fb, int number);
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
 
@@ -1,6 +1,6 @@
1
1
  module JSON
2
2
  # JSON version
3
- VERSION = '1.4.0'
3
+ VERSION = '1.4.1'
4
4
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -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.0
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-23 00:00:00 +02:00
12
+ date: 2010-04-25 00:00:00 +02:00
13
13
  default_executable: edit_json.rb
14
14
  dependencies: []
15
15