oj 2.12.4 → 2.12.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/ext/oj/dump.c +30 -9
  4. data/lib/oj/version.rb +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19a014def903ab0e1994fd5c35f882bbfc4d19b4
4
- data.tar.gz: b02d7ad3224f234b26c3a53039c4f802fc362427
3
+ metadata.gz: e34ba8c73f9262974880d2fcf2be2b7d541b636b
4
+ data.tar.gz: 11828007a4ddd9c8817e0039e86ff7c8e555a0d2
5
5
  SHA512:
6
- metadata.gz: d48e74d74f16124fe1a3db9111071886cbcdb2f92714b75a73534125a6c6ae79697d419a31e99a7aa0546a53075e90c83f4d1ee99ebf979c14667f66375c1125
7
- data.tar.gz: b8ec4119322934662c75def9c6951b1d27ee10dc9872fa9214f6e511afe4e3e47adc9cd4cde3b7a3addfeaee6cd786f4474c92042c5fe267ff514ebb0c3adba2
6
+ metadata.gz: 45f5d1cc476dded1921261dbb4ab1eda551ade35d6f66a97174167fed2b09f05d9c6fa8b1c3a1daa8a6f73238a5b48aad8cd81609aa2c5cf99dd696f71be46ce
7
+ data.tar.gz: 9e89459bceb129fd3607b938c304ebcd6a7c92fdd1aa055b9cea9086a1cdcfa2768c2015c15128840be049e9dac91c76227d4f3b46a5761339babb397a62f183
data/README.md CHANGED
@@ -26,9 +26,9 @@ Follow [@peterohler on Twitter](http://twitter.com/#!/peterohler) for announceme
26
26
 
27
27
  [![Build Status](https://secure.travis-ci.org/ohler55/oj.png?branch=master)](http://travis-ci.org/ohler55/oj)
28
28
 
29
- ## Current Release 2.12.4
29
+ ## Release 2.12.5
30
30
 
31
- - Fixed memory leak in Oj::Doc when not using a given proc.
31
+ - In :null mode Oj now dumps Infinity and NaN as null.
32
32
 
33
33
  [Older release notes](http://www.ohler.com/dev/oj_misc/release_notes.html).
34
34
 
@@ -457,23 +457,44 @@ dump_float(VALUE obj, Out out) {
457
457
  *b++ = '\0';
458
458
  cnt = 3;
459
459
  } else if (OJ_INFINITY == d) {
460
- if (StrictMode == out->opts->mode) {
460
+ switch (out->opts->mode) {
461
+ case StrictMode:
461
462
  raise_strict(obj);
463
+ case NullMode:
464
+ strcpy(buf, "null");
465
+ cnt = 4;
466
+ break;
467
+ default:
468
+ strcpy(buf, "Infinity");
469
+ cnt = 8;
470
+ break;
462
471
  }
463
- strcpy(buf, "Infinity");
464
- cnt = 8;
465
472
  } else if (-OJ_INFINITY == d) {
466
- if (StrictMode == out->opts->mode) {
473
+ switch (out->opts->mode) {
474
+ case StrictMode:
467
475
  raise_strict(obj);
476
+ case NullMode:
477
+ strcpy(buf, "null");
478
+ cnt = 4;
479
+ break;
480
+ default:
481
+ strcpy(buf, "-Infinity");
482
+ cnt = 9;
483
+ break;
468
484
  }
469
- strcpy(buf, "-Infinity");
470
- cnt = 9;
471
485
  } else if (isnan(d)) {
472
- if (StrictMode == out->opts->mode) {
486
+ switch (out->opts->mode) {
487
+ case StrictMode:
473
488
  raise_strict(obj);
489
+ case NullMode:
490
+ strcpy(buf, "null");
491
+ cnt = 4;
492
+ break;
493
+ default:
494
+ strcpy(buf, "NaN");
495
+ cnt = 3;
496
+ break;
474
497
  }
475
- strcpy(buf, "NaN");
476
- cnt = 3;
477
498
  } else if (d == (double)(long long int)d) {
478
499
  cnt = snprintf(buf, sizeof(buf), "%.1f", d);
479
500
  } else if (0 == out->opts->float_prec) {
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '2.12.4'
4
+ VERSION = '2.12.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oj
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.4
4
+ version: 2.12.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-20 00:00:00.000000000 Z
11
+ date: 2015-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler