oj 3.10.10 → 3.10.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/ext/oj/buf.h +2 -30
  3. data/ext/oj/cache8.h +1 -29
  4. data/ext/oj/circarray.c +4 -8
  5. data/ext/oj/circarray.h +1 -4
  6. data/ext/oj/code.c +3 -6
  7. data/ext/oj/code.h +1 -4
  8. data/ext/oj/compat.c +1 -4
  9. data/ext/oj/custom.c +1 -4
  10. data/ext/oj/dump.c +1 -4
  11. data/ext/oj/dump.h +1 -4
  12. data/ext/oj/dump_compat.c +1 -4
  13. data/ext/oj/dump_leaf.c +2 -5
  14. data/ext/oj/dump_object.c +1 -4
  15. data/ext/oj/dump_strict.c +1 -4
  16. data/ext/oj/encode.h +1 -29
  17. data/ext/oj/err.c +1 -4
  18. data/ext/oj/err.h +1 -29
  19. data/ext/oj/fast.c +14 -42
  20. data/ext/oj/hash.c +4 -32
  21. data/ext/oj/hash.h +1 -29
  22. data/ext/oj/hash_test.c +1 -29
  23. data/ext/oj/mimic_json.c +1 -4
  24. data/ext/oj/object.c +1 -4
  25. data/ext/oj/odd.c +1 -4
  26. data/ext/oj/odd.h +1 -4
  27. data/ext/oj/oj.c +1 -4
  28. data/ext/oj/oj.h +1 -4
  29. data/ext/oj/parse.c +1 -4
  30. data/ext/oj/parse.h +1 -4
  31. data/ext/oj/rails.c +1 -4
  32. data/ext/oj/rails.h +1 -4
  33. data/ext/oj/reader.c +5 -8
  34. data/ext/oj/reader.h +2 -5
  35. data/ext/oj/resolve.c +1 -4
  36. data/ext/oj/resolve.h +1 -4
  37. data/ext/oj/rxclass.c +3 -6
  38. data/ext/oj/rxclass.h +1 -4
  39. data/ext/oj/saj.c +6 -9
  40. data/ext/oj/scp.c +1 -4
  41. data/ext/oj/sparse.c +1 -4
  42. data/ext/oj/stream_writer.c +4 -9
  43. data/ext/oj/strict.c +3 -6
  44. data/ext/oj/string_writer.c +1 -4
  45. data/ext/oj/trace.c +5 -8
  46. data/ext/oj/trace.h +1 -4
  47. data/ext/oj/util.c +1 -1
  48. data/ext/oj/util.h +1 -1
  49. data/ext/oj/val_stack.c +1 -29
  50. data/ext/oj/val_stack.h +1 -29
  51. data/ext/oj/wab.c +1 -4
  52. data/lib/oj.rb +0 -8
  53. data/lib/oj/version.rb +1 -1
  54. data/test/json_gem/json_common_interface_test.rb +6 -7
  55. data/test/test_custom.rb +1 -1
  56. metadata +2 -16
@@ -1,7 +1,4 @@
1
- /* strict.c
2
- * Copyright (c) 2012, Peter Ohler
3
- * All rights reserved.
4
- */
1
+ // Copyright (c) 2012 Peter Ohler. All rights reserved.
5
2
 
6
3
  #include <stdlib.h>
7
4
  #include <stdio.h>
@@ -102,7 +99,7 @@ hash_set_cstr(ParseInfo pi, Val parent, const char *str, size_t len, const char
102
99
  static void
103
100
  hash_set_num(ParseInfo pi, Val parent, NumInfo ni) {
104
101
  volatile VALUE v;
105
-
102
+
106
103
  if (ni->infinity || ni->nan) {
107
104
  oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "not a number or other value");
108
105
  }
@@ -143,7 +140,7 @@ array_append_cstr(ParseInfo pi, const char *str, size_t len, const char *orig) {
143
140
  static void
144
141
  array_append_num(ParseInfo pi, NumInfo ni) {
145
142
  volatile VALUE v;
146
-
143
+
147
144
  if (ni->infinity || ni->nan) {
148
145
  oj_set_error_at(pi, oj_parse_error_class, __FILE__, __LINE__, "not a number or other value");
149
146
  }
@@ -1,7 +1,4 @@
1
- /* strwriter.c
2
- * Copyright (c) 2012, 2017, Peter Ohler
3
- * All rights reserved.
4
- */
1
+ // Copyright (c) 2012, 2017 Peter Ohler. All rights reserved.
5
2
 
6
3
  #include "dump.h"
7
4
  #include "encode.h"
@@ -1,7 +1,4 @@
1
- /* trace.h
2
- * Copyright (c) 2018, Peter Ohler
3
- * All rights reserved.
4
- */
1
+ // Copyright (c) 2018 Peter Ohler. All rights reserved.
5
2
 
6
3
  #include "parse.h"
7
4
  #include "trace.h"
@@ -37,7 +34,7 @@ oj_trace_parse_call(const char *func, ParseInfo pi, const char *file, int line,
37
34
  char fmt[64];
38
35
  char indent[MAX_INDENT];
39
36
  int depth = (int)(stack_size(&pi->stack) * 2);
40
-
37
+
41
38
  fill_indent(indent, depth);
42
39
  sprintf(fmt, "#0:%%13s:%%3d:Oj:-:%%%ds %%s %%s\n", depth);
43
40
  printf(fmt, file, line, indent, func, rb_obj_classname(obj));
@@ -48,7 +45,7 @@ oj_trace_parse_in(const char *func, ParseInfo pi, const char *file, int line) {
48
45
  char fmt[64];
49
46
  char indent[MAX_INDENT];
50
47
  int depth = (int)(stack_size(&pi->stack) * 2);
51
-
48
+
52
49
  fill_indent(indent, depth);
53
50
  sprintf(fmt, "#0:%%13s:%%3d:Oj:}:%%%ds %%s\n", depth);
54
51
  printf(fmt, file, line, indent, func);
@@ -61,7 +58,7 @@ oj_trace_parse_hash_end(ParseInfo pi, const char *file, int line) {
61
58
  int depth = (int)(stack_size(&pi->stack) * 2 - 2);
62
59
  Val v = stack_peek(&pi->stack);
63
60
  VALUE obj = v->val;
64
-
61
+
65
62
  fill_indent(indent, depth);
66
63
  sprintf(fmt, "#0:%%13s:%%3d:Oj:{:%%%ds hash_end %%s\n", depth);
67
64
  printf(fmt, file, line, indent, rb_obj_classname(obj));
@@ -72,7 +69,7 @@ oj_trace_parse_array_end(ParseInfo pi, const char *file, int line) {
72
69
  char fmt[64];
73
70
  char indent[MAX_INDENT];
74
71
  int depth = (int)(stack_size(&pi->stack) * 2);
75
-
72
+
76
73
  fill_indent(indent, depth);
77
74
  sprintf(fmt, "#0:%%13s:%%3d:Oj:{:%%%ds array_ned\n", depth);
78
75
  printf(fmt, file, line, indent);
@@ -1,7 +1,4 @@
1
- /* trace.h
2
- * Copyright (c) 2018, Peter Ohler
3
- * All rights reserved.
4
- */
1
+ // Copyright (c) 2018 Peter Ohler. All rights reserved.
5
2
 
6
3
  #ifndef OJ_TRACE_H
7
4
  #define OJ_TRACE_H
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2019, Peter Ohler, All rights reserved.
1
+ // Copyright (c) 2019 Peter Ohler. All rights reserved.
2
2
 
3
3
  #include "util.h"
4
4
 
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2019, Peter Ohler, All rights reserved.
1
+ // Copyright (c) 2019 Peter Ohler. All rights reserved.
2
2
 
3
3
  #ifndef OJ_UTIL_H
4
4
  #define OJ_UTIL_H
@@ -1,32 +1,4 @@
1
- /* val_stack.c
2
- * Copyright (c) 2011, Peter Ohler
3
- * All rights reserved.
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
7
- *
8
- * - Redistributions of source code must retain the above copyright notice, this
9
- * list of conditions and the following disclaimer.
10
- *
11
- * - Redistributions in binary form must reproduce the above copyright notice,
12
- * this list of conditions and the following disclaimer in the documentation
13
- * and/or other materials provided with the distribution.
14
- *
15
- * - Neither the name of Peter Ohler nor the names of its contributors may be
16
- * used to endorse or promote products derived from this software without
17
- * specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
1
+ // Copyright (c) 2011 Peter Ohler. All rights reserved.
30
2
 
31
3
  #include <string.h>
32
4
 
@@ -1,32 +1,4 @@
1
- /* val_stack.h
2
- * Copyright (c) 2011, Peter Ohler
3
- * All rights reserved.
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions are met:
7
- *
8
- * - Redistributions of source code must retain the above copyright notice, this
9
- * list of conditions and the following disclaimer.
10
- *
11
- * - Redistributions in binary form must reproduce the above copyright notice,
12
- * this list of conditions and the following disclaimer in the documentation
13
- * and/or other materials provided with the distribution.
14
- *
15
- * - Neither the name of Peter Ohler nor the names of its contributors may be
16
- * used to endorse or promote products derived from this software without
17
- * specific prior written permission.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
- */
1
+ // Copyright (c) 2011 Peter Ohler. All rights reserved.
30
2
 
31
3
  #ifndef OJ_VAL_STACK_H
32
4
  #define OJ_VAL_STACK_H
@@ -1,7 +1,4 @@
1
- /* wab.c
2
- * Copyright (c) 2012, Peter Ohler
3
- * All rights reserved.
4
- */
1
+ // Copyright (c) 2012 Peter Ohler. All rights reserved.
5
2
 
6
3
  #include <stdlib.h>
7
4
  #include <stdio.h>
data/lib/oj.rb CHANGED
@@ -2,14 +2,6 @@
2
2
  module Oj
3
3
  end
4
4
 
5
- begin
6
- # This require exists to get around Rubinius failing to load bigdecimal from
7
- # the C extension.
8
- require 'bigdecimal'
9
- rescue Exception
10
- # ignore
11
- end
12
-
13
5
  require 'oj/version'
14
6
  require 'oj/bag'
15
7
  require 'oj/easy_hash'
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '3.10.10'
4
+ VERSION = '3.10.15'
5
5
  end
@@ -15,7 +15,7 @@ class JSONCommonInterfaceTest < Test::Unit::TestCase
15
15
  def setup
16
16
  @hash = {
17
17
  'a' => 2,
18
- 'b' => 5.23683071,
18
+ #'b' => 5.23683071,
19
19
  'c' => 'c',
20
20
  'd' => [ 1, "b", 3.14 ],
21
21
  'e' => { 'foo' => 'bar' },
@@ -23,14 +23,13 @@ class JSONCommonInterfaceTest < Test::Unit::TestCase
23
23
  'h' => 1000.0,
24
24
  'i' => 0.001
25
25
  }
26
- # Tired of chasing floating point rounding and precision. Oj not uses the
26
+ # Tired of chasing floating point rounding and precision. Oj now uses the
27
27
  # Ruby float parser in compat mode yet on i386 machines there are issues
28
28
  # with this test when the float is included.
29
-
30
- @json = '{"a":2,"b":5.23683071,"c":"c","d":[1,"b",3.14],"e":{"foo":"bar"},'\
31
- '"g":"\\"\\u0000\\u001f","h":1000.0,"i":0.001}'
32
- #@json = '{"a":2,"c":"c","d":[1,"b",3.14],"e":{"foo":"bar"},'\
33
- #p '"g":"\\"\\u0000\\u001f","h":1000.0,"i":0.001}'
29
+ #@json = '{"a":2,"b":5.23683071,"c":"c","d":[1,"b",3.14],"e":{"foo":"bar"},'\
30
+ #'"g":"\\"\\u0000\\u001f","h":1000.0,"i":0.001}'
31
+ @json = '{"a":2,"c":"c","d":[1,"b",3.14],"e":{"foo":"bar"},'\
32
+ '"g":"\\"\\u0000\\u001f","h":1000.0,"i":0.001}'
34
33
  end
35
34
 
36
35
  def test_index
@@ -126,7 +126,7 @@ class CustomJuice < Minitest::Test
126
126
  def test_float_parse_fast
127
127
  f = Oj.load("12.123456789012345678", mode: :custom, bigdecimal_load: :fast);
128
128
  assert_equal(Float, f.class)
129
- assert_equal('12.12345678901235', "%0.14f" % [f]) # only care about 16 digits
129
+ assert(12.12345678901234 <= f && f < 12.12345678901236)
130
130
  end
131
131
 
132
132
  def test_nan_dump
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oj
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.10
4
+ version: 3.10.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-20 00:00:00.000000000 Z
11
+ date: 2020-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bigdecimal
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake-compiler
29
15
  requirement: !ruby/object:Gem::Requirement