oj 3.16.0 → 3.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +107 -0
  3. data/README.md +0 -16
  4. data/ext/oj/cache.c +4 -2
  5. data/ext/oj/cache.h +3 -2
  6. data/ext/oj/compat.c +3 -3
  7. data/ext/oj/custom.c +17 -11
  8. data/ext/oj/dump.c +624 -90
  9. data/ext/oj/dump.h +9 -2
  10. data/ext/oj/dump_compat.c +15 -9
  11. data/ext/oj/dump_leaf.c +1 -1
  12. data/ext/oj/dump_object.c +32 -17
  13. data/ext/oj/dump_strict.c +20 -14
  14. data/ext/oj/extconf.rb +11 -9
  15. data/ext/oj/fast.c +50 -32
  16. data/ext/oj/intern.c +24 -7
  17. data/ext/oj/mimic_json.c +17 -11
  18. data/ext/oj/object.c +21 -13
  19. data/ext/oj/oj.c +387 -140
  20. data/ext/oj/oj.h +59 -55
  21. data/ext/oj/parse.c +248 -47
  22. data/ext/oj/parser.c +179 -89
  23. data/ext/oj/parser.h +4 -2
  24. data/ext/oj/rails.c +64 -42
  25. data/ext/oj/reader.c +1 -1
  26. data/ext/oj/rxclass.c +1 -1
  27. data/ext/oj/rxclass.h +1 -1
  28. data/ext/oj/safe.c +230 -0
  29. data/ext/oj/safe.h +79 -0
  30. data/ext/oj/saj.c +15 -10
  31. data/ext/oj/scp.c +3 -6
  32. data/ext/oj/simd.h +219 -0
  33. data/ext/oj/sparse.c +6 -3
  34. data/ext/oj/stream_writer.c +38 -28
  35. data/ext/oj/strict.c +2 -4
  36. data/ext/oj/string_writer.c +54 -22
  37. data/ext/oj/usual.c +57 -35
  38. data/ext/oj/usual.h +1 -0
  39. data/ext/oj/val_stack.c +13 -2
  40. data/ext/oj/wab.c +5 -4
  41. data/lib/oj/mimic.rb +1 -5
  42. data/lib/oj/schandler.rb +5 -4
  43. data/lib/oj/version.rb +1 -1
  44. data/pages/Encoding.md +1 -1
  45. metadata +36 -100
  46. data/test/_test_active.rb +0 -75
  47. data/test/_test_active_mimic.rb +0 -95
  48. data/test/_test_mimic_rails.rb +0 -123
  49. data/test/activerecord/result_test.rb +0 -31
  50. data/test/activesupport6/abstract_unit.rb +0 -44
  51. data/test/activesupport6/decoding_test.rb +0 -133
  52. data/test/activesupport6/encoding_test.rb +0 -507
  53. data/test/activesupport6/encoding_test_cases.rb +0 -98
  54. data/test/activesupport6/test_common.rb +0 -17
  55. data/test/activesupport6/test_helper.rb +0 -163
  56. data/test/activesupport6/time_zone_test_helpers.rb +0 -39
  57. data/test/activesupport7/abstract_unit.rb +0 -49
  58. data/test/activesupport7/decoding_test.rb +0 -125
  59. data/test/activesupport7/encoding_test.rb +0 -486
  60. data/test/activesupport7/encoding_test_cases.rb +0 -104
  61. data/test/activesupport7/time_zone_test_helpers.rb +0 -47
  62. data/test/files.rb +0 -29
  63. data/test/foo.rb +0 -14
  64. data/test/helper.rb +0 -39
  65. data/test/isolated/shared.rb +0 -309
  66. data/test/isolated/test_mimic_after.rb +0 -13
  67. data/test/isolated/test_mimic_alone.rb +0 -12
  68. data/test/isolated/test_mimic_as_json.rb +0 -45
  69. data/test/isolated/test_mimic_before.rb +0 -13
  70. data/test/isolated/test_mimic_define.rb +0 -28
  71. data/test/isolated/test_mimic_rails_after.rb +0 -22
  72. data/test/isolated/test_mimic_rails_before.rb +0 -21
  73. data/test/isolated/test_mimic_redefine.rb +0 -15
  74. data/test/json_gem/json_addition_test.rb +0 -216
  75. data/test/json_gem/json_common_interface_test.rb +0 -155
  76. data/test/json_gem/json_encoding_test.rb +0 -107
  77. data/test/json_gem/json_ext_parser_test.rb +0 -21
  78. data/test/json_gem/json_fixtures_test.rb +0 -36
  79. data/test/json_gem/json_generator_test.rb +0 -407
  80. data/test/json_gem/json_generic_object_test.rb +0 -90
  81. data/test/json_gem/json_parser_test.rb +0 -477
  82. data/test/json_gem/json_string_matching_test.rb +0 -42
  83. data/test/json_gem/test_helper.rb +0 -30
  84. data/test/mem.rb +0 -34
  85. data/test/perf.rb +0 -102
  86. data/test/perf_compat.rb +0 -128
  87. data/test/perf_dump.rb +0 -50
  88. data/test/perf_fast.rb +0 -162
  89. data/test/perf_file.rb +0 -62
  90. data/test/perf_object.rb +0 -134
  91. data/test/perf_once.rb +0 -59
  92. data/test/perf_parser.rb +0 -183
  93. data/test/perf_saj.rb +0 -101
  94. data/test/perf_scp.rb +0 -140
  95. data/test/perf_simple.rb +0 -289
  96. data/test/perf_strict.rb +0 -137
  97. data/test/perf_wab.rb +0 -129
  98. data/test/prec.rb +0 -23
  99. data/test/sample/change.rb +0 -13
  100. data/test/sample/dir.rb +0 -18
  101. data/test/sample/doc.rb +0 -35
  102. data/test/sample/file.rb +0 -47
  103. data/test/sample/group.rb +0 -15
  104. data/test/sample/hasprops.rb +0 -15
  105. data/test/sample/layer.rb +0 -11
  106. data/test/sample/line.rb +0 -20
  107. data/test/sample/oval.rb +0 -10
  108. data/test/sample/rect.rb +0 -9
  109. data/test/sample/shape.rb +0 -34
  110. data/test/sample/text.rb +0 -19
  111. data/test/sample.rb +0 -54
  112. data/test/sample_json.rb +0 -37
  113. data/test/test_compat.rb +0 -567
  114. data/test/test_custom.rb +0 -554
  115. data/test/test_debian.rb +0 -50
  116. data/test/test_fast.rb +0 -526
  117. data/test/test_file.rb +0 -250
  118. data/test/test_gc.rb +0 -60
  119. data/test/test_generate.rb +0 -21
  120. data/test/test_hash.rb +0 -39
  121. data/test/test_integer_range.rb +0 -72
  122. data/test/test_null.rb +0 -376
  123. data/test/test_object.rb +0 -1016
  124. data/test/test_parser.rb +0 -11
  125. data/test/test_parser_debug.rb +0 -27
  126. data/test/test_parser_saj.rb +0 -337
  127. data/test/test_parser_usual.rb +0 -217
  128. data/test/test_rails.rb +0 -35
  129. data/test/test_saj.rb +0 -188
  130. data/test/test_scp.rb +0 -431
  131. data/test/test_strict.rb +0 -431
  132. data/test/test_various.rb +0 -801
  133. data/test/test_wab.rb +0 -311
  134. data/test/test_writer.rb +0 -380
  135. data/test/tests.rb +0 -33
  136. data/test/tests_mimic.rb +0 -23
  137. data/test/tests_mimic_addition.rb +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: affe42de16d26dfe301f38df7c0bc8ceee39ab25e5a6bd14bd7af6671cc3b422
4
- data.tar.gz: ee1d7227f864b197aca62cb767f9202798b6d3d13cf0b5f89eae3f3a36450dbb
3
+ metadata.gz: e7458dcdf494ef6b1b283ca86d51fba0b3102ecf5cec13f43682878c01708c80
4
+ data.tar.gz: ab8099b8b275aa5acab45a012bbc96ef0c860e041be2c4ae7d6f7cd331da1755
5
5
  SHA512:
6
- metadata.gz: 8dbf6a0b5fef2b179dba864b595113f73ac27a952307559422bf1feda19fcc008a5e43a142d1bb3eb0cc4125ff18f35730208c7f82b11089ff90690e7b1f17d0
7
- data.tar.gz: be09c04fa551288e2708c9151d0c966a09c3768ba15442cc54b8b4dd5850e2228b45608c06c8251c4e2ca32333353713f9c1feff81e4d34a48d1c6bf725014f6
6
+ metadata.gz: 60d445fd27bbea120359c21d0c1b0ac1d4fbbd678c8fd28efe620706d382a2f0cc434645967c9bac0b6d08d1065fe99dc4b15e2623d98ca0e15a61eb591a993b
7
+ data.tar.gz: b7736fd3a7b27f98ef3e4df05464000849403ff33a3f82ecd6d8c51b40d0c2753d23ed14c078eb26506d504de991e35ebe68e5703225c80aab6ebbd28b7a80dc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,111 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.17.3 - 2026-06-04
4
+
5
+ - Fixed issue in intern.c and fast.c.
6
+
7
+ ## 3.17.2 - 2026-05-27
8
+
9
+ - Fixed multiple issues related to extreme sizes.
10
+
11
+ ## 3.17.1 - 2026-05-15
12
+
13
+ - Fixed "quoted string not terminated" error.
14
+
15
+ ## 3.17.0 - 2026-04-19
16
+
17
+ - A "safe" parser has been added as a variation of the Oj:Parser thanks to @meinac.
18
+
19
+ ## 3.16.17 - 2026-04-12
20
+
21
+ - Rails optimize for Hash and Array now overrides `as_json` for those
22
+ classes. Note that when either is optimized with `Oj.optimize_rails`
23
+ the `Array.as_json` and `Hash.as_json` will not be called.
24
+
25
+ - Add support for the rails encoder `:only` and `:except` options.
26
+
27
+ - Handle unterminated strings in usual parser (#1002)
28
+
29
+ - Fix read() not handling partial reads for large files (#1004)
30
+
31
+ - Raise error for incomplete primitive literals (#1005)
32
+
33
+ ## 3.16.16 - 2026-03-13
34
+
35
+ - Not closed arrays and objects are reported corrected in the usual parser.
36
+
37
+ ## 3.16.15 - 2026-02-05
38
+
39
+ - Fixed by putting the ostruct dependency back until a better way is found to conditionally include it.
40
+
41
+ ## 3.16.14 - 2026-02-04
42
+
43
+ - Fixed SSE issue #989.
44
+
45
+ - Removed ostruct dependency.
46
+
47
+ - Removed generic object JSON gem tests.
48
+
49
+ ## 3.16.13 - 2025-12-05
50
+
51
+ - Fixed rails encoding for Hash and Array subclasses.
52
+
53
+ ## 3.16.12 - 2025-10-29
54
+
55
+ - Fixed dump realloc bug that occurred when using the compat mode dump options.
56
+
57
+ ## 3.16.11 - 2025-05-29
58
+
59
+ - Fixed range encoding with the :circular option
60
+
61
+ ## 3.16.10 - 2025-02-24
62
+
63
+ - Changed oj_parser_type to be non-static.
64
+
65
+ - Changed ARM versions to used Neon instructions thanks to @samyron.
66
+
67
+ ## 3.16.9 - 2024-12-28
68
+
69
+ - Fixed `Oj::Parser` create_id size issue #931.
70
+
71
+ - Changed parser to be more optimized (PR from @Watson1978)
72
+
73
+ ## 3.16.8 - 2024-12-14
74
+
75
+ - Fixed StreamWriter to write to non-file IO thanks to @jscheid.
76
+
77
+ ## 3.16.7 - 2024-11-01
78
+
79
+ - Changed string_writer_as_json to allow multiple arguments.
80
+
81
+ - Fixed Global variable registration added to mimic_json and rails code thanks to @byroot.
82
+
83
+ ## 3.16.6 - 2024-09-09
84
+
85
+ - Fixed issue with Rails 7.2 that changed the order of calls to to_json and as_json.
86
+
87
+ ## 3.16.5 - 2024-08-07
88
+
89
+ - Fixed Oj::Parser so that block procedures work correctly.
90
+
91
+ ## 3.16.4 - 2024-06-08
92
+
93
+ - Fixed Oj::Parse EOF issue on larger stream input.
94
+
95
+ ## 3.16.3 - 2023-12-11
96
+
97
+ - Fixed the gemspec to allow earlier versions of the bigdecimal gem.
98
+
99
+ ## 3.16.2 - 2023-12-06
100
+
101
+ - Fixed documentation formatting.
102
+
103
+ - Added option to the "usual" parser to raise an error on an empty input string.
104
+
105
+ ## 3.16.1 - 2023-09-01
106
+
107
+ - Fixed exception type on number parsing. (thank you @jasonpenny)
108
+
3
109
  ## 3.16.0 - 2023-08-16
4
110
 
5
111
  - Added the `float_format` option.
@@ -22,6 +128,7 @@
22
128
  ## 3.14.3 - 2023-04-07
23
129
 
24
130
  - Fixed compat parse with optimized Hash when parsing a JSON::GenericObject.
131
+ - Deprecated Ruby <= 2.6.10
25
132
 
26
133
  ## 3.14.2 - 2023-02-10
27
134
 
data/README.md CHANGED
@@ -46,11 +46,6 @@ gem 'oj'
46
46
 
47
47
  See the Quickstart sections of the [Rails](pages/Rails.md) and [json](pages/JsonGem.md) docs.
48
48
 
49
- ## multi_json
50
-
51
- Code which uses [multi_json](https://github.com/intridea/multi_json)
52
- will automatically prefer Oj if it is installed.
53
-
54
49
  ## Support
55
50
 
56
51
  [Get supported Oj with a Tidelift Subscription.](https://tidelift.com/subscription/pkg/rubygems-oj?utm_source=rubygems-oj&utm_medium=referral&utm_campaign=readme) Security updates are [supported](https://tidelift.com/security).
@@ -83,17 +78,6 @@ See [{file:CHANGELOG.md}](CHANGELOG.md) and [{file:RELEASE_NOTES.md}](RELEASE_NO
83
78
 
84
79
  - *RubyGems* *repo*: https://rubygems.org/gems/oj
85
80
 
86
- Follow [@peterohler on Twitter](http://twitter.com/peterohler) for announcements and news about the Oj gem.
87
-
88
- #### Performance Comparisons
89
-
90
- - [Oj Strict Mode Performance](http://www.ohler.com/dev/oj_misc/performance_strict.html) compares Oj strict mode parser performance to other JSON parsers.
91
-
92
- - [Oj Compat Mode Performance](http://www.ohler.com/dev/oj_misc/performance_compat.html) compares Oj compat mode parser performance to other JSON parsers.
93
-
94
- - [Oj Object Mode Performance](http://www.ohler.com/dev/oj_misc/performance_object.html) compares Oj object mode parser performance to other marshallers.
95
-
96
- - [Oj Callback Performance](http://www.ohler.com/dev/oj_misc/performance_callback.html) compares Oj callback parser performance to other JSON parsers.
97
81
 
98
82
  #### Links of Interest
99
83
 
data/ext/oj/cache.c CHANGED
@@ -260,7 +260,8 @@ void cache_set_expunge_rate(Cache c, int rate) {
260
260
  c->xrate = (uint8_t)rate;
261
261
  }
262
262
 
263
- void cache_free(Cache c) {
263
+ void cache_free(void *data) {
264
+ Cache c = (Cache)data;
264
265
  uint64_t i;
265
266
 
266
267
  for (i = 0; i < c->size; i++) {
@@ -276,7 +277,8 @@ void cache_free(Cache c) {
276
277
  OJ_FREE(c);
277
278
  }
278
279
 
279
- void cache_mark(Cache c) {
280
+ void cache_mark(void *data) {
281
+ Cache c = (Cache)data;
280
282
  uint64_t i;
281
283
 
282
284
  #if !HAVE_PTHREAD_MUTEX_INIT
data/ext/oj/cache.h CHANGED
@@ -10,10 +10,11 @@
10
10
  #define CACHE_MAX_KEY 35
11
11
 
12
12
  struct _cache;
13
+ typedef struct _cache *Cache;
13
14
 
14
15
  extern struct _cache *cache_create(size_t size, VALUE (*form)(const char *str, size_t len), bool mark, bool locking);
15
- extern void cache_free(struct _cache *c);
16
- extern void cache_mark(struct _cache *c);
16
+ extern void cache_free(void *data);
17
+ extern void cache_mark(void *data);
17
18
  extern void cache_set_form(struct _cache *c, VALUE (*form)(const char *str, size_t len));
18
19
  extern VALUE cache_intern(struct _cache *c, const char *key, size_t len);
19
20
  extern void cache_set_expunge_rate(struct _cache *c, int rate);
data/ext/oj/compat.c CHANGED
@@ -27,7 +27,7 @@ static void hash_set_cstr(ParseInfo pi, Val kval, const char *str, size_t len, c
27
27
  volatile VALUE rkey = oj_calc_hash_key(pi, kval);
28
28
 
29
29
  if (Yes == pi->options.create_ok && NULL != pi->options.str_rx.head) {
30
- VALUE clas = oj_rxclass_match(&pi->options.str_rx, str, (int)len);
30
+ VALUE clas = oj_rxclass_match(&pi->options.str_rx, str, len);
31
31
 
32
32
  if (Qnil != clas) {
33
33
  rstr = rb_funcall(clas, oj_json_create_id, 1, rstr);
@@ -84,7 +84,7 @@ static void add_cstr(ParseInfo pi, const char *str, size_t len, const char *orig
84
84
  volatile VALUE rstr = oj_cstr_to_value(str, len, (size_t)pi->options.cache_str);
85
85
 
86
86
  if (Yes == pi->options.create_ok && NULL != pi->options.str_rx.head) {
87
- VALUE clas = oj_rxclass_match(&pi->options.str_rx, str, (int)len);
87
+ VALUE clas = oj_rxclass_match(&pi->options.str_rx, str, len);
88
88
 
89
89
  if (Qnil != clas) {
90
90
  pi->stack.head->val = rb_funcall(clas, oj_json_create_id, 1, rstr);
@@ -155,7 +155,7 @@ static void array_append_cstr(ParseInfo pi, const char *str, size_t len, const c
155
155
  volatile VALUE rstr = oj_cstr_to_value(str, len, (size_t)pi->options.cache_str);
156
156
 
157
157
  if (Yes == pi->options.create_ok && NULL != pi->options.str_rx.head) {
158
- VALUE clas = oj_rxclass_match(&pi->options.str_rx, str, (int)len);
158
+ VALUE clas = oj_rxclass_match(&pi->options.str_rx, str, len);
159
159
 
160
160
  if (Qnil != clas) {
161
161
  rb_ary_push(stack_peek(&pi->stack)->val, rb_funcall(clas, oj_json_create_id, 1, rstr));
data/ext/oj/custom.c CHANGED
@@ -40,7 +40,7 @@ static void dump_obj_as_str(VALUE obj, int depth, Out out) {
40
40
  static void bigdecimal_dump(VALUE obj, int depth, Out out) {
41
41
  volatile VALUE rstr = oj_safe_string_convert(obj);
42
42
  const char *str = RSTRING_PTR(rstr);
43
- int len = (int)RSTRING_LEN(rstr);
43
+ size_t len = RSTRING_LEN(rstr);
44
44
 
45
45
  if (0 == strcasecmp("Infinity", str)) {
46
46
  str = oj_nan_str(obj, out->opts->dump_opts.nan_dump, out->opts->mode, true, &len);
@@ -123,7 +123,7 @@ static void date_dump(VALUE obj, int depth, Out out) {
123
123
  case RubyTime:
124
124
  case XmlTime:
125
125
  v = rb_funcall(obj, rb_intern("iso8601"), 0);
126
- oj_dump_cstr(RSTRING_PTR(v), (int)RSTRING_LEN(v), 0, 0, out);
126
+ oj_dump_cstr(RSTRING_PTR(v), RSTRING_LEN(v), 0, 0, out);
127
127
  break;
128
128
  case UnixZTime:
129
129
  v = rb_funcall(obj, rb_intern("to_time"), 0);
@@ -287,6 +287,11 @@ static int hash_cb(VALUE key, VALUE value, VALUE ov) {
287
287
  if (out->omit_nil && Qnil == value) {
288
288
  return ST_CONTINUE;
289
289
  }
290
+ if (NULL != out->opts->dump_opts.only || NULL != out->opts->dump_opts.except) {
291
+ if (oj_key_skip(key, out->opts->dump_opts.only, out->opts->dump_opts.except)) {
292
+ return ST_CONTINUE;
293
+ }
294
+ }
290
295
  if (!out->opts->dump_opts.use) {
291
296
  assure_size(out, depth * out->indent + 1);
292
297
  fill_indent(out, depth);
@@ -405,7 +410,7 @@ static void dump_odd(VALUE obj, Odd odd, VALUE clas, int depth, Out out) {
405
410
  rb_raise(rb_eEncodingError, "Invalid type for raw JSON.\n");
406
411
  } else {
407
412
  const char *s = RSTRING_PTR(v);
408
- int len = (int)RSTRING_LEN(v);
413
+ size_t len = RSTRING_LEN(v);
409
414
  const char *name = rb_id2name(*odd->attrs);
410
415
  size_t nlen = strlen(name);
411
416
 
@@ -478,7 +483,7 @@ static VALUE dump_common(VALUE obj, int depth, Out out) {
478
483
  } else if (Yes == out->opts->to_json && rb_respond_to(obj, oj_to_json_id)) {
479
484
  volatile VALUE rs;
480
485
  const char *s;
481
- int len;
486
+ size_t len;
482
487
 
483
488
  TRACE(out->opts->trace, "to_json", obj, depth + 1, TraceRubyIn);
484
489
  if (0 == rb_obj_method_arity(obj, oj_to_json_id)) {
@@ -488,7 +493,7 @@ static VALUE dump_common(VALUE obj, int depth, Out out) {
488
493
  }
489
494
  TRACE(out->opts->trace, "to_json", obj, depth + 1, TraceRubyOut);
490
495
  s = RSTRING_PTR(rs);
491
- len = (int)RSTRING_LEN(rs);
496
+ len = RSTRING_LEN(rs);
492
497
 
493
498
  assure_size(out, len + 1);
494
499
  APPEND_CHARS(out->cur, s, len);
@@ -509,7 +514,7 @@ static VALUE dump_common(VALUE obj, int depth, Out out) {
509
514
  if (aj == obj) {
510
515
  volatile VALUE rstr = oj_safe_string_convert(obj);
511
516
 
512
- oj_dump_cstr(RSTRING_PTR(rstr), (int)RSTRING_LEN(rstr), false, false, out);
517
+ oj_dump_cstr(RSTRING_PTR(rstr), RSTRING_LEN(rstr), false, false, out);
513
518
  } else {
514
519
  oj_dump_custom_val(aj, depth, out, true);
515
520
  }
@@ -676,7 +681,8 @@ static void dump_obj(VALUE obj, int depth, Out out, bool as_ok) {
676
681
 
677
682
  static void dump_array(VALUE a, int depth, Out out, bool as_ok) {
678
683
  size_t size;
679
- int i, cnt;
684
+ size_t i;
685
+ size_t cnt;
680
686
  int d2 = depth + 1;
681
687
  long id = oj_check_circular(a, out);
682
688
 
@@ -684,7 +690,7 @@ static void dump_array(VALUE a, int depth, Out out, bool as_ok) {
684
690
  oj_dump_nil(Qnil, depth, out, false);
685
691
  return;
686
692
  }
687
- cnt = (int)RARRAY_LEN(a);
693
+ cnt = RARRAY_LEN(a);
688
694
  *out->cur++ = '[';
689
695
  assure_size(out, 2);
690
696
  if (0 == cnt) {
@@ -795,7 +801,7 @@ static void dump_struct(VALUE obj, int depth, Out out, bool as_ok) {
795
801
  volatile VALUE s = rb_sym2str(RARRAY_AREF(ma, i));
796
802
 
797
803
  name = RSTRING_PTR(s);
798
- len = (int)RSTRING_LEN(s);
804
+ len = RSTRING_LEN(s);
799
805
  } else {
800
806
  len = snprintf(num_id, sizeof(num_id), "%d", i);
801
807
  name = num_id;
@@ -909,7 +915,7 @@ static void hash_set_cstr(ParseInfo pi, Val kval, const char *str, size_t len, c
909
915
  volatile VALUE rkey = oj_calc_hash_key(pi, kval);
910
916
 
911
917
  if (Yes == pi->options.create_ok && NULL != pi->options.str_rx.head) {
912
- VALUE clas = oj_rxclass_match(&pi->options.str_rx, str, (int)len);
918
+ VALUE clas = oj_rxclass_match(&pi->options.str_rx, str, len);
913
919
 
914
920
  if (Qnil != clas) {
915
921
  rstr = rb_funcall(clas, oj_json_create_id, 1, rstr);
@@ -1014,7 +1020,7 @@ static void array_append_cstr(ParseInfo pi, const char *str, size_t len, const c
1014
1020
  volatile VALUE rstr = rb_utf8_str_new(str, len);
1015
1021
 
1016
1022
  if (Yes == pi->options.create_ok && NULL != pi->options.str_rx.head) {
1017
- VALUE clas = oj_rxclass_match(&pi->options.str_rx, str, (int)len);
1023
+ VALUE clas = oj_rxclass_match(&pi->options.str_rx, str, len);
1018
1024
 
1019
1025
  if (Qnil != clas) {
1020
1026
  rb_ary_push(stack_peek(&pi->stack)->val, rb_funcall(clas, oj_json_create_id, 1, rstr));